Added weight into to the CMS_LINK and provide a `sort' feature for CMS_MENU and related.

Protected cms service from registering many time the same module type.
Moved library/persistence/implementation/* under library/persistence/.
Moved site/www/themes to site/themes
For SQLite storage driver, auto create sqlite db file using associated sql script (to be completed).
Added code in demo module to reuse storage for module purpose.
Always call sql_post_execution in sql_query and sql_change, and not anymore by the callers.
Removed is_web and is_html from {CMS_SETUP}, it was not used.
Reused SHARED_*_ENCODER in CMS_ENCODERS
Added CMS_API.logger rather than using directly the SHARED_LOGGER.log ...
Centralize the implementation of current_user in CMS_REQUEST_UTIL
Removed the inheritance on WSF_FILTER for node handlers, since it is useless and unused.
Added CMS_NODE_API and CMS_USER_API
Prefix html id for block generated html items with "block-", to avoid css name conflict on "main", "content" or similar.
Code cleaning
This commit is contained in:
2015-02-16 13:01:06 +01:00
parent a810b1176c
commit 8d59d25ace
165 changed files with 1430 additions and 2206 deletions

View File

@@ -0,0 +1,3 @@
To build the MySQL schema use the schema.sql script.
The other script will be deleted soon.

View File

@@ -0,0 +1 @@
Added Stored Procedures

View File

@@ -0,0 +1,163 @@
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema cms_dev
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `cms_dev` DEFAULT CHARACTER SET latin1 ;
USE `cms_dev` ;
-- -----------------------------------------------------
-- Table `cms_dev`.`users`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `cms_dev`.`users` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`username` VARCHAR(100) NOT NULL,
`password` VARCHAR(100) NOT NULL,
`salt` VARCHAR(100) NOT NULL,
`email` VARCHAR(250) NOT NULL,
`creation_date` DATETIME NULL DEFAULT NULL,
`last_login_date` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `username` (`username` ASC))
ENGINE = InnoDB
AUTO_INCREMENT = 2
DEFAULT CHARACTER SET = latin1;
-- -----------------------------------------------------
-- Table `cms_dev`.`nodes`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `cms_dev`.`nodes` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`publication_date` DATE NOT NULL,
`creation_date` DATE NOT NULL,
`modification_date` DATE NOT NULL,
`title` VARCHAR(255) NOT NULL,
`summary` TEXT NOT NULL,
`content` MEDIUMTEXT NOT NULL,
`author_id` INT(10) UNSIGNED NULL DEFAULT NULL,
`version` INT(10) UNSIGNED ZEROFILL NULL DEFAULT NULL,
`editor_id` INT(10) UNSIGNED NULL DEFAULT NULL,
PRIMARY KEY (`id`),
INDEX `fk_nodes_users1_idx` (`author_id` ASC),
INDEX `fk_nodes_users2_idx` (`editor_id` ASC),
CONSTRAINT `fk_nodes_users1`
FOREIGN KEY (`author_id`)
REFERENCES `cms_dev`.`users` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_nodes_users2`
FOREIGN KEY (`editor_id`)
REFERENCES `cms_dev`.`users` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
AUTO_INCREMENT = 11
DEFAULT CHARACTER SET = latin1;
-- -----------------------------------------------------
-- Table `cms_dev`.`roles`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `cms_dev`.`roles` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`role` VARCHAR(100) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `role` (`role` ASC))
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;
-- -----------------------------------------------------
-- Table `cms_dev`.`permissions`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `cms_dev`.`permissions` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(45) NOT NULL,
`roles_id` INT(10) UNSIGNED NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `name_UNIQUE` (`name` ASC),
INDEX `fk_permissions_roles1_idx` (`roles_id` ASC),
CONSTRAINT `fk_permissions_roles1`
FOREIGN KEY (`roles_id`)
REFERENCES `cms_dev`.`roles` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;
-- -----------------------------------------------------
-- Table `cms_dev`.`profiles`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `cms_dev`.`profiles` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`key` VARCHAR(45) NOT NULL,
`value` VARCHAR(100) NULL DEFAULT NULL,
`users_id` INT(10) UNSIGNED NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `key_UNIQUE` (`key` ASC),
INDEX `fk_profiles_users1_idx` (`users_id` ASC),
CONSTRAINT `fk_profiles_users1`
FOREIGN KEY (`users_id`)
REFERENCES `cms_dev`.`users` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;
-- -----------------------------------------------------
-- Table `cms_dev`.`users_nodes`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `cms_dev`.`users_nodes` (
`users_id` INT(10) UNSIGNED NOT NULL,
`nodes_id` INT(10) UNSIGNED NOT NULL,
PRIMARY KEY (`users_id`, `nodes_id`),
INDEX `fk_users_has_nodes_nodes1_idx` (`nodes_id` ASC),
INDEX `fk_users_has_nodes_users_idx` (`users_id` ASC),
CONSTRAINT `fk_users_has_nodes_nodes1`
FOREIGN KEY (`nodes_id`)
REFERENCES `cms_dev`.`nodes` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_users_has_nodes_users`
FOREIGN KEY (`users_id`)
REFERENCES `cms_dev`.`users` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;
-- -----------------------------------------------------
-- Table `cms_dev`.`users_roles`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `cms_dev`.`users_roles` (
`users_id` INT(10) UNSIGNED NOT NULL,
`roles_id` INT(10) UNSIGNED NOT NULL,
PRIMARY KEY (`users_id`, `roles_id`),
INDEX `fk_users_has_roles_roles1_idx` (`roles_id` ASC),
INDEX `fk_users_has_roles_users1_idx` (`users_id` ASC),
CONSTRAINT `fk_users_has_roles_roles1`
FOREIGN KEY (`roles_id`)
REFERENCES `cms_dev`.`roles` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_users_has_roles_users1`
FOREIGN KEY (`users_id`)
REFERENCES `cms_dev`.`users` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

View File

@@ -0,0 +1,72 @@
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema roc_cms
-- -----------------------------------------------------
DROP SCHEMA IF EXISTS `roc_cms` ;
CREATE SCHEMA IF NOT EXISTS `roc_cms` DEFAULT CHARACTER SET latin1 ;
USE `roc_cms` ;
-- -----------------------------------------------------
-- Table `roc_cms`.`nodes`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `roc_cms`.`nodes` ;
CREATE TABLE IF NOT EXISTS `roc_cms`.`nodes` (
`nid` INT(11) NOT NULL AUTO_INCREMENT,
`version` INT(11) NULL DEFAULT NULL,
`type` INT(11) NULL DEFAULT NULL,
`title` VARCHAR(255) NOT NULL,
`summary` TEXT NOT NULL,
`content` MEDIUMTEXT NOT NULL,
`author` INT(11) NULL DEFAULT NULL,
`publish` DATETIME NULL DEFAULT NULL,
`created` DATETIME NOT NULL,
`changed` DATETIME NOT NULL,
PRIMARY KEY (`nid`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;
-- -----------------------------------------------------
-- Table `roc_cms`.`users`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `roc_cms`.`users` ;
CREATE TABLE IF NOT EXISTS `roc_cms`.`users` (
`uid` INT(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(100) NOT NULL,
`password` VARCHAR(100) NOT NULL,
`salt` VARCHAR(100) NOT NULL,
`email` VARCHAR(250) NOT NULL,
`status` INT(11) NULL DEFAULT NULL,
`created` DATETIME NOT NULL,
`signed` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`uid`),
UNIQUE INDEX `name` (`name` ASC))
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;
-- -----------------------------------------------------
-- Table `roc_cms`.`users_roles`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `roc_cms`.`users_roles` ;
CREATE TABLE IF NOT EXISTS `roc_cms`.`users_roles` (
`rid` INT(11) NOT NULL AUTO_INCREMENT,
`role` VARCHAR(100) NOT NULL,
PRIMARY KEY (`rid`),
UNIQUE INDEX `role` (`role` ASC))
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

View File

@@ -0,0 +1,14 @@
DROP TABLE IF EXISTS nodes;
CREATE TABLE nodes
(
id smallint unsigned NOT NULL auto_increment,
publication_date date NOT NULL, #When the article was published
creation_date date NOT NULL, #When the article was created
modification_date date NOT NULL, #When the article was updated
title varchar(255) NOT NULL, #Full title of the article
summary text NOT NULL, #A short summary of the articule
content mediumtext NOT NULL, #The HTML content of the article
PRIMARY KEY (ID)
);

View File

@@ -0,0 +1,8 @@
DELIMITER $$
CREATE TRIGGER update_editor
AFTER INSERT ON `users_nodes` FOR EACH ROW
UPDATE Nodes
SET editor_id = NEW.users_id
WHERE id = NEW.nodes_id;
$$
DELIMITER ;