diff --git a/application/views/admin/templateoptions/index.php b/application/views/admin/templateoptions/index.php index 23d83552a65..6a151a9676c 100644 --- a/application/views/admin/templateoptions/index.php +++ b/application/views/admin/templateoptions/index.php @@ -56,7 +56,7 @@ array( 'header' => gT('extends'), 'name' => 'templates_extends', - 'value'=>'$data->template->extends_templates_name', + 'value'=>'$data->template->extends', 'htmlOptions' => array('class' => 'col-md-2'), ), diff --git a/installer/sql/create-mssql.sql b/installer/sql/create-mssql.sql index b4c2e667945..9a50b91080b 100644 --- a/installer/sql/create-mssql.sql +++ b/installer/sql/create-mssql.sql @@ -739,7 +739,7 @@ CREATE TABLE prefix_templates ( [description] nvarchar(max) NULL, [last_update] datetime NULL, [owner_id] int NULL, - [extends_templates_name] nvarchar(150) NULL + [extends] nvarchar(150) NULL ); diff --git a/installer/sql/create-mysql.sql b/installer/sql/create-mysql.sql index 6a615a71bcc..be9a2026feb 100644 --- a/installer/sql/create-mysql.sql +++ b/installer/sql/create-mysql.sql @@ -607,7 +607,7 @@ CREATE TABLE IF NOT EXISTS `prefix_notifications` ( -- -- Table settings_user -- -CREATE TABLE IF NOT EXISTS `prefix_settings_user` ( +CREATE TABLE `prefix_settings_user` ( `id` int(11) NOT NULL auto_increment, `uid` int(11) NOT NULL, `entity` VARCHAR(15) DEFAULT NULL, @@ -736,7 +736,7 @@ CREATE TABLE `prefix_templates` ( `description` text COLLATE utf8mb4_unicode_ci, `last_update` datetime DEFAULT NULL, `owner_id` int(11) DEFAULT NULL, - `extends_templates_name` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `extends` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; @@ -747,7 +747,7 @@ INSERT INTO `prefix_templates` VALUES INSERT INTO `prefix_templates` VALUES (2,'minimal', 'minimal', 'Minimal Template', '2017-07-12 10:00:00', 'Louis Gac', 'louis.gac@limesurvey.org', 'https://www.limesurvey.org/', 'Copyright (C) 2007-2017 The LimeSurvey Project Team\\r\\nAll rights reserved.', 'License: GNU/GPL License v2 or later, see LICENSE.php\\r\\n\\r\\nLimeSurvey is free software. This version may have been modified pursuant to the GNU General Public License, and as distributed it includes or is derivative of works licensed under the GNU General Public License or other free or open source software licenses. See COPYRIGHT.php for copyright notices and details.', '1.0', '3.0', 'views', 'files', 'LimeSurvey Minimal Template
A clean and simple base that can be used by developers to create their own solution.', NULL, 1, ''); INSERT INTO `prefix_templates` VALUES - ('material', 'material', 'Material Template', '2017-07-12 10:00:00', 'Louis Gac', 'louis.gac@limesurvey.org', 'https://www.limesurvey.org/', 'Copyright (C) 2007-2017 The LimeSurvey Project Team\\r\\nAll rights reserved.', 'License: GNU/GPL License v2 or later, see LICENSE.php\\r\\n\\r\\nLimeSurvey is free software. This version may have been modified pursuant to the GNU General Public License, and as distributed it includes or is derivative of works licensed under the GNU General Public License or other free or open source software licenses. See COPYRIGHT.php for copyright notices and details.', '1.0', '3.0', 'views', 'files', 'LimeSurvey Advanced Template
A template extending default, to show the inheritance concept. Notice the options, differents from Default.
uses FezVrasta''s Material design theme for Bootstrap 3', NULL, 1, 'default'); + (3,'material', 'material', 'Material Template', '2017-07-12 10:00:00', 'Louis Gac', 'louis.gac@limesurvey.org', 'https://www.limesurvey.org/', 'Copyright (C) 2007-2017 The LimeSurvey Project Team\\r\\nAll rights reserved.', 'License: GNU/GPL License v2 or later, see LICENSE.php\\r\\n\\r\\nLimeSurvey is free software. This version may have been modified pursuant to the GNU General Public License, and as distributed it includes or is derivative of works licensed under the GNU General Public License or other free or open source software licenses. See COPYRIGHT.php for copyright notices and details.', '1.0', '3.0', 'views', 'files', 'LimeSurvey Advanced Template
A template extending default, to show the inheritance concept. Notice the options, differents from Default.
uses FezVrasta''s Material design theme for Bootstrap 3', NULL, 1, 'default'); -- ----------------------------------------------------- @@ -785,7 +785,7 @@ INSERT INTO `prefix_template_configuration` VALUES -- Table prefix_surveys_groups -- ----------------------------------------------------- CREATE TABLE `prefix_surveys_groups` ( - `gsid` int(11) NOT NULL, + `gsid` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) COLLATE utf8mb4_unicode_ci NOT NULL, `title` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `template` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT 'default', diff --git a/installer/sql/create-pgsql.sql b/installer/sql/create-pgsql.sql index e7c9cc271d6..fe5cd7a1f7c 100644 --- a/installer/sql/create-pgsql.sql +++ b/installer/sql/create-pgsql.sql @@ -548,15 +548,14 @@ CREATE TABLE prefix_users ( --CREATE SEQUENCE prefix_boxes; CREATE TABLE prefix_boxes ( - "id" SERIAL, + "id" serial PRIMARY KEY NOT NULL, "position" integer DEFAULT NULL , "url" text NOT NULL , "title" text NOT NULL , "ico" text DEFAULT NULL, "desc" text NOT NULL , "page" text NOT NULL , - "usergroup" integer NOT NULL, - PRIMARY KEY (id) + "usergroup" integer NOT NULL ); INSERT INTO "prefix_boxes" ("id", "position", "url", "title", "ico", "desc", "page", "usergroup") VALUES @@ -588,10 +587,10 @@ create index labels_code_idx on prefix_labels (code); create unique index permissions_idx2 ON prefix_permissions (entity_id, entity, uid, permission); -- --- Notification table +-- Table notifications -- CREATE TABLE prefix_notifications ( - "id" SERIAL, + "id" serial PRIMARY KEY NOT NULL, "entity" character varying(15) NOT NULL, "entity_id" integer NOT NULL, "title" character varying(255) NOT NULL, @@ -608,24 +607,23 @@ CREATE INDEX prefix_index ON prefix_notifications USING btree (entity, entity_id CREATE INDEX notif_hash_index ON prefix_notifications USING btree (hash); -- --- User settings table +-- Table settings_user -- CREATE TABLE prefix_settings_user ( + "id" serial PRIMARY KEY NOT NULL, "uid" integer NOT NULL, "entity" character varying(15) DEFAULT NULL, "entity_id" character varying(31) DEFAULT NULL, "stg_name" character varying(63) NOT NULL, - "stg_value" text NULL, - CONSTRAINT prefix_user_settings_pkey PRIMARY KEY (uid, entity, entity_id, stg_name) + "stg_value" text NULL ); -- -- Surveymenu -- - CREATE TABLE prefix_surveymenu ( - "id" integer NOT NULL, + "id" serial PRIMARY KEY NOT NULL, "parent_id" integer DEFAULT NULL, "survey_id" integer DEFAULT NULL, "user_id" integer DEFAULT NULL, @@ -634,6 +632,7 @@ CREATE TABLE prefix_surveymenu ( "title" character varying(255) NOT NULL DEFAULT '', "position" character varying(255) NOT NULL DEFAULT 'side', "description" text , + "active" integer NOT NULL DEFAULT '0', "changed_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, "changed_by" integer NOT NULL DEFAULT '0', "created_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, @@ -641,17 +640,18 @@ CREATE TABLE prefix_surveymenu ( PRIMARY KEY ("id") ); -create index menu_parent_id_index on prefix_surveymenu (parent_id); -create index menu_user_id_index on prefix_surveymenu (user_id); -create index menu_order_index on prefix_surveymenu ("ordering"); -create index menu_title_index on prefix_surveymenu (title); +create index surveymenu_ordering_index on prefix_surveymenu ("ordering"); +create index surveymenu_title_index on prefix_surveymenu ("title"); INSERT INTO prefix_surveymenu VALUES (1,NULL,NULL,NULL,0,0,'surveymenu','side','Main survey menu',NOW(),0,NOW(),0); INSERT INTO prefix_surveymenu VALUES (2,NULL,NULL,NULL,0,0,'quickmenue','collapsed','quickmenu',NOW(),0,NOW(),0); +-- +-- Surveymenu entries +-- CREATE TABLE prefix_surveymenu_entries ( - "id" integer NOT NULL , + "id" serial PRIMARY KEY NOT NULL, "menu_id" integer DEFAULT NULL, "user_id" integer DEFAULT NULL, "ordering" integer DEFAULT '0', @@ -672,18 +672,17 @@ CREATE TABLE prefix_surveymenu_entries ( "data" text , "getdatamethod" character varying(255) NOT NULL DEFAULT '', "language" character varying(255) NOT NULL DEFAULT 'en-GB', - "changed_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + "changed_at" timestamp NULL, "changed_by" integer NOT NULL DEFAULT '0', - "created_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + "created_at" timestamp NOT NULL, "created_by" integer NOT NULL DEFAULT '0', - PRIMARY KEY (id), - FOREIGN KEY (menu_id) REFERENCES prefix_surveymenu (id) ON DELETE CASCADE + PRIMARY KEY (id) ); -create index entry_order_index on prefix_surveymenu_entries ("ordering"); -create index entry_user_index on prefix_surveymenu_entries ("user_id"); -create index entry_title_index on prefix_surveymenu_entries (title); -create index entry_menu_title_index on prefix_surveymenu_entries (menu_title); +create index surveymenu_entries_menu_id_index on prefix_surveymenu_entries (menu_id_index); +create index surveymenu_entries_ordering_index on prefix_surveymenu_entries ("ordering"); +create index surveymenu_entries_title_index on prefix_surveymenu_entries (title); +create index surveymenu_entries_menu_title_index on prefix_surveymenu_entries (menu_title); INSERT INTO prefix_surveymenu_entries VALUES (1,1,NULL,1,'overview','Survey overview','Overview','Open general survey overview and quick action','list','fontawesome','','admin/survey/sa/view','','','','','','','{\"render\": { \"link\": {\"data\": {\"surveyid\": [\"survey\",\"sid\"]}}}}','','en-GB',NOW(),0,NOW(),0), @@ -719,71 +718,48 @@ INSERT INTO prefix_surveymenu_entries VALUES (31,2,NULL,16,'reorder','Reorder questions/question groups','Reorder questions/question groups','Reorder questions/question groups','icon-organize','iconclass','','admin/survey/sa/organize/','','','','','surveycontent','update','{\"render\": {\"isActive\": false, \"link\": {\"data\": {\"surveyid\": [\"survey\",\"sid\"]}}}}','','en-GB',NOW(),0,NOW(),0); --- CREATE OR REPLACE FUNCTION upd_timestamp() RETURNS TRIGGER --- LANGUAGE plpgsql --- AS --- $$ --- BEGIN --- NEW.changed_at = CURRENT_TIMESTAMP; --- RETURN NEW; --- END; --- $$; - --- CREATE TRIGGER update_timestamp_menues --- BEFORE UPDATE --- ON prefix_surveymenu --- FOR EACH ROW --- EXECUTE PROCEDURE upd_timestamp(); --- CREATE TRIGGER update_timestamp_menue_entries --- BEFORE UPDATE --- ON prefix_surveymenu_entries --- FOR EACH ROW --- EXECUTE PROCEDURE upd_timestamp(); - - - -- ----------------------------------------------------- -- Table prefix_templates -- ----------------------------------------------------- CREATE TABLE prefix_templates ( - name character varying(150) NOT NULL, - folder character varying(45) DEFAULT NULL, - title character varying(100) NOT NULL, - creation_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - author character varying(150) DEFAULT NULL, - author_email character varying(255) DEFAULT NULL, - author_url character varying(255) DEFAULT NULL, - copyright text , - license text , - version character varying(45) DEFAULT NULL, - api_version character varying(45) NOT NULL, - view_folder character varying(45) NOT NULL, - files_folder character varying(45) NOT NULL, - description text , - last_update timestamp DEFAULT NULL, - owner_id int DEFAULT NULL, - extends_templates_name character varying(150) DEFAULT NULL, - PRIMARY KEY (name) + "id" serial PRIMARY KEY NOT NULL, + "name" character varying(150) NOT NULL, + "folder" character varying(45) DEFAULT NULL, + "title" character varying(100) NOT NULL, + "creation_date" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + "author" character varying(150) DEFAULT NULL, + "author_email" character varying(255) DEFAULT NULL, + "author_url" character varying(255) DEFAULT NULL, + "copyright" text , + "license" text , + "version" character varying(45) DEFAULT NULL, + "api_version" character varying(45) NOT NULL, + "view_folder" character varying(45) NOT NULL, + "files_folder" character varying(45) NOT NULL, + "description" text , + "last_update" timestamp DEFAULT NULL, + "owner_id" int DEFAULT NULL, + "extends" character varying(150) DEFAULT NULL ); INSERT INTO prefix_templates VALUES -('default', 'default', 'Advanced Template', '2017-07-12 10:00:00', 'Louis Gac', 'louis.gac@limesurvey.org', 'https://www.limesurvey.org/', 'Copyright (C) 2007-2017 The LimeSurvey Project Team\\r\\nAll rights reserved.', 'License: GNU/GPL License v2 or later, see LICENSE.php\\r\\n\\r\\nLimeSurvey is free software. This version may have been modified pursuant to the GNU General Public License, and as distributed it includes or is derivative of works licensed under the GNU General Public License or other free or open source software licenses. See COPYRIGHT.php for copyright notices and details.', '1.0', '3.0', 'views', 'files', 'LimeSurvey Advanced Template:\\r\\nMany options for user customizations. \\r\\n', NULL, 1, ''); +(1,'default', 'default', 'Advanced Template', '2017-07-12 10:00:00', 'Louis Gac', 'louis.gac@limesurvey.org', 'https://www.limesurvey.org/', 'Copyright (C) 2007-2017 The LimeSurvey Project Team\\r\\nAll rights reserved.', 'License: GNU/GPL License v2 or later, see LICENSE.php\\r\\n\\r\\nLimeSurvey is free software. This version may have been modified pursuant to the GNU General Public License, and as distributed it includes or is derivative of works licensed under the GNU General Public License or other free or open source software licenses. See COPYRIGHT.php for copyright notices and details.', '1.0', '3.0', 'views', 'files', 'LimeSurvey Advanced Template:\\r\\nMany options for user customizations. \\r\\n', NULL, 1, ''); INSERT INTO prefix_templates VALUES - ('minimal', 'minimal', 'Minimal Template', '2017-07-12 10:00:00', 'Louis Gac', 'louis.gac@limesurvey.org', 'https://www.limesurvey.org/', 'Copyright (C) 2007-2017 The LimeSurvey Project Team\\r\\nAll rights reserved.', 'License: GNU/GPL License v2 or later, see LICENSE.php\\r\\n\\r\\nLimeSurvey is free software. This version may have been modified pursuant to the GNU General Public License, and as distributed it includes or is derivative of works licensed under the GNU General Public License or other free or open source software licenses. See COPYRIGHT.php for copyright notices and details.', '1.0', '3.0', 'views', 'files', 'LimeSurvey Minimal Template
A clean and simple base that can be used by developers to create their own solution.', NULL, 1, ''); +(2,'minimal', 'minimal', 'Minimal Template', '2017-07-12 10:00:00', 'Louis Gac', 'louis.gac@limesurvey.org', 'https://www.limesurvey.org/', 'Copyright (C) 2007-2017 The LimeSurvey Project Team\\r\\nAll rights reserved.', 'License: GNU/GPL License v2 or later, see LICENSE.php\\r\\n\\r\\nLimeSurvey is free software. This version may have been modified pursuant to the GNU General Public License, and as distributed it includes or is derivative of works licensed under the GNU General Public License or other free or open source software licenses. See COPYRIGHT.php for copyright notices and details.', '1.0', '3.0', 'views', 'files', 'LimeSurvey Minimal Template
A clean and simple base that can be used by developers to create their own solution.', NULL, 1, ''); INSERT INTO prefix_templates VALUES -('material', 'material', 'Material Template', '2017-07-12 10:00:00', 'Louis Gac', 'louis.gac@limesurvey.org', 'https://www.limesurvey.org/', 'Copyright (C) 2007-2017 The LimeSurvey Project Team\\r\\nAll rights reserved.', 'License: GNU/GPL License v2 or later, see LICENSE.php\\r\\n\\r\\nLimeSurvey is free software. This version may have been modified pursuant to the GNU General Public License, and as distributed it includes or is derivative of works licensed under the GNU General Public License or other free or open source software licenses. See COPYRIGHT.php for copyright notices and details.', '1.0', '3.0', 'views', 'files', 'LimeSurvey Advanced Template
A template extending default, to show the inheritance concept. Notice the options, differents from Default.
uses FezVrasta''s Material design theme for Bootstrap 3', NULL, 1, 'default'); +(3,'material', 'material', 'Material Template', '2017-07-12 10:00:00', 'Louis Gac', 'louis.gac@limesurvey.org', 'https://www.limesurvey.org/', 'Copyright (C) 2007-2017 The LimeSurvey Project Team\\r\\nAll rights reserved.', 'License: GNU/GPL License v2 or later, see LICENSE.php\\r\\n\\r\\nLimeSurvey is free software. This version may have been modified pursuant to the GNU General Public License, and as distributed it includes or is derivative of works licensed under the GNU General Public License or other free or open source software licenses. See COPYRIGHT.php for copyright notices and details.', '1.0', '3.0', 'views', 'files', 'LimeSurvey Advanced Template
A template extending default, to show the inheritance concept. Notice the options, differents from Default.
uses FezVrasta''s Material design theme for Bootstrap 3', NULL, 1, 'default'); -- ----------------------------------------------------- -- Table prefix_template_configuration -- ----------------------------------------------------- CREATE TABLE prefix_template_configuration ( - id int NOT NULL, + "id" serial PRIMARY KEY NOT NULL, templates_name character varying(150) NOT NULL, - sid int DEFAULT NULL, - gsid int DEFAULT NULL, - uid int DEFAULT NULL, + sid integer DEFAULT NULL, + gsid integer DEFAULT NULL, + uid integer DEFAULT NULL, files_css text , files_js text , files_print_css text , @@ -793,8 +769,7 @@ CREATE TABLE prefix_template_configuration ( cssframework_js text , packages_to_load text , packages_ltr text , - packages_rtl text , - PRIMARY KEY(id) + packages_rtl text ); @@ -807,8 +782,28 @@ INSERT INTO prefix_template_configuration VALUES INSERT INTO prefix_template_configuration VALUES (3,'material',NULL,NULL,NULL,'{"add": ["css/template.css", "css/bootstrap-material-design.css", "css/ripples.min.css"]}','{"add": ["scripts/template.js", "scripts/material.js", "scripts/ripples.min.js"]}','{"add":"css/print_template.css",}','{"ajaxmode":"off","brandlogo":"on", "animatebody":"on","bodyanimation":"fadeInRight","animatequestion":"off","questionanimation":"flipInX","animatealert":"off","alertanimation":"shake"}','bootstrap','{"replace": [["css/bootstrap.css","css/bootstrap.css"]]}','','','',''); +-- ----------------------------------------------------- +-- Table prefix_surveys_groups +-- ----------------------------------------------------- +CREATE TABLE "prefix_surveys_groups" ( + "gsid" serial PRIMARY KEY NOT NULL, + "name" character varying(45) NOT NULL, + "title" character varying(100) DEFAULT NULL, + "template" character varying(128) DEFAULT 'default', + "description" text , + "sortorder" integer NOT NULL, + "owner_uid" integer DEFAULT NULL, + "parent_id" integer DEFAULT NULL, + "created" timestamp DEFAULT NULL, + "modified" timestamp DEFAULT NULL, + "created_by" integer NOT NULL +); + + +INSERT INTO "prefix_surveys_groups" ("gsid", "name", "title", "description", "order", "owner_uid", "parent_id", "created", "modified", "created_by") VALUES + (1, 'default', 'Default Survey Group', 'LimeSurvey core default survey group', 0, 1, NULL, '2017-07-20 17:09:30', '2017-07-20 17:09:30', 1); -- -- Version Info -- -INSERT INTO prefix_settings_global VALUES ('DBVersion', '309'); +INSERT INTO prefix_settings_global VALUES ('DBVersion', '315');