MVC Module for sAPI
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Matthias Weiß 24b1780483 Updated to sApi 202209.01 3 months ago
documentation Version 3.0 5 months ago
inc Version 3.0 5 months ago
pu_all Updated to sApi 202209.01 3 months ago
pu_base Updated to sApi 202209.01 3 months ago
redFACT/customized Version 3.0 5 months ago
.gitattributes Initial commit 4 years ago
.gitignore Updates 1 year ago
LICENSE Initial commit 4 years ago
README.md Merge branch 'master' of https://codeberg.org/codeandcreate/sApi_MVC 4 months ago
index.php Updates 1 year ago

README.md

sApi MVC Module (for redFACT)

The sApi MVC Module is an implementation for a frontend MVC on vanilla javascript. It's based on the original SMD MVC2.

flow chart of the mvc

It's build for Newsfactory redFACT but can also used stand alone or with any other CMS. In this repository there are some sample scripts to use the MVC without redFACT. Some files may contain german comments. Pure.css is used for the sample frontend.

Version history

         Date              Version    Info
August 2022 3.0.1 Upgraded to sApi 202208.01
Juli 2022 3.0 Refactored the frontend controller as sApi module, dropped upload features (for now), removed some SMD specific code

Todos

  • (More) documentation

Installation

redFACT

  • Copy following files in your redFACT installation:
    • pu_all/ajax/mvcbackend.php
    • pu_all/scipts/s_mvc.min.js (or s_mvc.js if you want uncompressed code)
    • pu_all/scipts/sApi.min.js (needs to be loaded in your publication.tpl)
    • pu_base/scripts/s_mvc_platformSupport.js goes to your publication folder
    • redFACT/customized/classes/mixed/mvcClasses/mvc_base.php
    • redFACT/customized/classes/mixed/nfyc_mixed_mvcbackendcontroller.php
    • redFACT/customized/classes/mixed/nfyc_mixed_mvcclassloader.php
    • redFACT/customized/classes/mixed/nfyc_mixed_registry.php
  • pu_all/ajax/mvcbackend.php has a XSS protection: you need to add a $domains-Array to your inc/config.php (...) file with the domains that are allowed to access the mvc backend if not already set by your configuration
  • Take a look at the loader for contentbox, page or all other frontend related modules in pu_all/templates/frontendbox.php. This loader should always be loaded!
  • Configure the _emlConfig and the platform support file before sApi loads like this:
const _emlConfig = {
  "mvc": {
    "src": [
      "/pu_all/scripts/s_mvc.min.js"
    ],
    "fns": [
      "addListener",
      "initMvcObject"
    ]
  }
};
const mvcPlatformSupportFile = "/pu_base/scripts/s_mvc_platformSupport.js";

without redFACT

  • just copy the whole folder to your web server and take a look at the pu_base and inc folders.

Static installation

Whit the steps above the mvc loads on demand. This is usefull if you don't have on every page mvc boxes. But if you prefer to have a fully dynamic webpage with mvc boxes on every page you shouldn't use the eml-Loader of sApi. Just place the s_mvc.min.js/s_mvc.js in your /pu_all/scripts_min and your s_mvc_platformSupport.js in /pu_*/scripts_min directory.

Documentation