openrat-cms

OpenRat Content Management System
git clone http://git.code.weiherhei.de/openrat-cms.git
Log | Files | Refs | README

commit 9d872e337fd76f6f6a85fe8808644168d2eacc08
parent b398410df89b9822d1706e8aa3c9f103787ec6be
Author: Jan Dankert <develop@jandankert.de>
Date:   Sat, 20 Feb 2021 01:34:41 +0100

New: Publish-switch for templates.

Diffstat:
Mmodules/cms/action/folder/FolderPubAction.class.php | 11+++++++++++
Mmodules/cms/action/page/PagePubAction.class.php | 11+++++++++++
Mmodules/cms/action/project/ProjectEditAction.class.php | 1+
Mmodules/cms/action/template/TemplatePropAction.class.php | 6++++--
Mmodules/cms/model/Template.class.php | 35+++++++++++++++++++++++++++--------
Mmodules/cms/ui/themes/default/html/views/project/edit.php | 94++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mmodules/cms/ui/themes/default/html/views/project/edit.tpl.src.xml | 78+++++++++++++++++++++++++++++++++++++++++-------------------------------------
Mmodules/cms/ui/themes/default/html/views/template/prop.php | 9+++++++++
Mmodules/cms/ui/themes/default/html/views/template/prop.tpl.src.xml | 3+++
Mmodules/cms/ui/themes/default/html/views/templatelist/edit.php | 83++++++++++++++++++++++++++++++++++++++++++++-----------------------------------
Mmodules/cms/ui/themes/default/html/views/templatelist/edit.tpl.src.xml | 65++++++++++++++++++++++++++++++++++-------------------------------
Mmodules/cms/update/Update.class.php | 21+++++++++++++++++----
Amodules/cms/update/version/DBVersion000026.class.php | 25+++++++++++++++++++++++++
13 files changed, 276 insertions(+), 166 deletions(-)

diff --git a/modules/cms/action/folder/FolderPubAction.class.php b/modules/cms/action/folder/FolderPubAction.class.php @@ -10,8 +10,10 @@ use cms\generator\PageGenerator; use cms\generator\Producer; use cms\generator\Publisher; use cms\generator\PublishOrder; +use cms\model\Page; use cms\model\Permission; use cms\model\Folder; +use cms\model\Template; use util\Session; @@ -62,6 +64,15 @@ class FolderPubAction extends FolderAction implements Method { foreach( $folder->getPages() as $pageObjectId ) { + $page = new Page( $pageObjectId ); + $page->load(); + + $template = new Template( $page->templateid ); + $template->load(); + + if ( ! $template->publish ) + continue; // Template should not be published. + foreach( $project->getModelIds() as $modelId ) { foreach( $project->getLanguageIds() as $languageId ) { diff --git a/modules/cms/action/page/PagePubAction.class.php b/modules/cms/action/page/PagePubAction.class.php @@ -7,7 +7,10 @@ use cms\generator\PageGenerator; use cms\generator\Producer; use cms\generator\Publisher; use cms\generator\PublishOrder; +use cms\model\Page; use cms\model\Permission; +use cms\model\Template; +use language\Messages; use util\Session; class PagePubAction extends PageAction implements Method { @@ -20,6 +23,14 @@ class PagePubAction extends PageAction implements Method { $project = $this->page->getProject(); + $template = new Template( $this->page->templateid ); + $template->load(); + + if ( ! $template->publish ) { + $this->addWarningFor( $this->page,Messages::NOPUBLISH ); + return; + } + // Nothing is written to the session from this point. so we should free the session. Session::close(); diff --git a/modules/cms/action/project/ProjectEditAction.class.php b/modules/cms/action/project/ProjectEditAction.class.php @@ -6,6 +6,7 @@ use cms\action\ProjectAction; class ProjectEditAction extends ProjectAction implements Method { public function view() { + $this->setTemplateVar('name' ,$this->project->name); $this->setTemplateVar('projectid' ,$this->project->projectid); $this->setTemplateVar('rootobjectid' ,$this->project->getRootObjectId()); $this->setTemplateVar('is_project_admin',$this->userIsProjectAdmin()); diff --git a/modules/cms/action/template/TemplatePropAction.class.php b/modules/cms/action/template/TemplatePropAction.class.php @@ -11,13 +11,15 @@ class TemplatePropAction extends TemplateAction implements Method { public function view() { - $this->setTemplateVar('name' , $this->template->name ); + $this->setTemplateVar('name' , $this->template->name ); + $this->setTemplateVar('publish' , $this->template->publish ); } public function post() { - $this->template->name = $this->request->getRequiredText('name'); + $this->template->name = $this->request->getRequiredText('name'); + $this->template->publish = $this->request->hasRequestVar('publish'); $this->template->save(); $this->addNoticeFor($this->template,Messages::SAVED); diff --git a/modules/cms/model/Template.class.php b/modules/cms/model/Template.class.php @@ -30,6 +30,8 @@ use util\exception\ObjectNotFoundException; */ class Template extends ModelBase { + const TYPE_PUBLISH = 1; + /** * ID dieses Templates * @type Integer @@ -47,7 +49,13 @@ class Template extends ModelBase * @type String */ var $name = 'unnamed'; - + + /** + * Should this template be published? + * + * @var bool + */ + public $publish = true; // Konstruktor function __construct( $templateid='' ) @@ -72,6 +80,7 @@ class Template extends ModelBase $this->name = $row['name' ]; $this->projectid = $row['projectid']; + $this->publish = $row['type'] & self::TYPE_PUBLISH; } @@ -91,11 +100,21 @@ class Template extends ModelBase if ( $this->name == "" ) $this->name = \cms\base\Language::lang(Messages::TEMPLATE).' #'.$this->templateid; - $stmt = Db::sql( 'UPDATE {{template}}'. - ' SET name={name}'. - ' WHERE id={templateid}' ); + $stmt = Db::sql( <<<SQL + UPDATE {{template}} + SET name={name}, + type={type} + WHERE id={templateid} +SQL + ); $stmt->setString( 'name' ,$this->name ); $stmt->setInt ( 'templateid',$this->templateid ); + + $type = 0; + if( $this->publish ) $type |= self::TYPE_PUBLISH; + + $stmt->setInt ( 'type' ,$type ); + $stmt->query(); } @@ -121,7 +140,7 @@ class Template extends ModelBase /** * Ermitteln aller Elemente zu diesem Template * Es wird eine Liste nur mit den Element-IDs ermittelt und zur?ckgegeben - * @return Array + * @return array */ function getElementIds() { @@ -139,7 +158,7 @@ class Template extends ModelBase /** * Ermitteln aller Elemente zu diesem Template * Es wird eine Liste mit den kompletten Elementen ermittelt und zurueckgegeben - * @return Array + * @return array */ function getElements() { @@ -166,7 +185,7 @@ class Template extends ModelBase /** * Ermitteln aller Elemente zu diesem Template * Es wird eine Liste mit den kompletten Elementen ermittelt und zurueckgegeben - * @return Array + * @return array */ function getWritableElements() { @@ -264,7 +283,7 @@ SQL /** * Ermitteln alles Objekte (=Seiten), welche auf diesem Template basieren. * - * @return Array Liste von Objekt-IDs + * @return array Liste von Objekt-IDs */ function getDependentObjectIds() { diff --git a/modules/cms/ui/themes/default/html/views/project/edit.php b/modules/cms/ui/themes/default/html/views/project/edit.php @@ -1,48 +1,48 @@ <?php /* THIS FILE IS GENERATED from edit.tpl.src.xml - DO NOT CHANGE */ defined('APP_STARTED') || die('Forbidden'); use \template_engine\Output as O; ?> - <div class="<?php echo O::escapeHtml('or-table-wrapper') ?>"><?php echo O::escapeHtml('') ?> - <div class="<?php echo O::escapeHtml('or-table-area') ?>"><?php echo O::escapeHtml('') ?> - <table width="<?php echo O::escapeHtml('100%') ?>" class="<?php echo O::escapeHtml('or-table') ?>"><?php echo O::escapeHtml('') ?> - <tr class="<?php echo O::escapeHtml('or-table-header') ?>"><?php echo O::escapeHtml('') ?> - <td><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.@O::lang('TYPE').'') ?></span> - <span><?php echo O::escapeHtml(' / ') ?></span> - <span><?php echo O::escapeHtml(''.@O::lang('NAME').'') ?></span> - </td> - </tr> - <tr class="<?php echo O::escapeHtml('or-data') ?>"><?php echo O::escapeHtml('') ?> - <td class="<?php echo O::escapeHtml('or-act-clickable') ?>"><?php echo O::escapeHtml('') ?> - <a target="<?php echo O::escapeHtml('_self') ?>" data-type="<?php echo O::escapeHtml('open') ?>" data-action="<?php echo O::escapeHtml('folder') ?>" data-method="<?php echo O::escapeHtml('') ?>" data-id="<?php echo O::escapeHtml(''.@$rootobjectid.'') ?>" data-extra="<?php echo O::escapeHtml('[]') ?>" href="<?php echo O::escapeHtml('#/folder/'.@$rootobjectid.'') ?>" class="<?php echo O::escapeHtml('or-link') ?>"><?php echo O::escapeHtml('') ?> - <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--action-folder') ?>"><?php echo O::escapeHtml('') ?></i> - <span><?php echo O::escapeHtml(''.@O::lang('content').'') ?></span> - </a> - </td> - </tr> - <?php $if3=($is_project_admin); if($if3) { ?> - <tr class="<?php echo O::escapeHtml('or-data') ?>"><?php echo O::escapeHtml('') ?> - <td class="<?php echo O::escapeHtml('or-act-clickable') ?>"><?php echo O::escapeHtml('') ?> - <a target="<?php echo O::escapeHtml('_self') ?>" data-type="<?php echo O::escapeHtml('open') ?>" data-action="<?php echo O::escapeHtml('templatelist') ?>" data-method="<?php echo O::escapeHtml('') ?>" data-id="<?php echo O::escapeHtml(''.@$projectid.'') ?>" data-extra="<?php echo O::escapeHtml('[]') ?>" href="<?php echo O::escapeHtml('#/templatelist/'.@$projectid.'') ?>" class="<?php echo O::escapeHtml('or-link') ?>"><?php echo O::escapeHtml('') ?> - <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--action-template') ?>"><?php echo O::escapeHtml('') ?></i> - <span><?php echo O::escapeHtml(''.@O::lang('templates').'') ?></span> - </a> - </td> - </tr> - <tr class="<?php echo O::escapeHtml('or-data') ?>"><?php echo O::escapeHtml('') ?> - <td class="<?php echo O::escapeHtml('or-act-clickable') ?>"><?php echo O::escapeHtml('') ?> - <a target="<?php echo O::escapeHtml('_self') ?>" data-type="<?php echo O::escapeHtml('open') ?>" data-action="<?php echo O::escapeHtml('languagelist') ?>" data-method="<?php echo O::escapeHtml('') ?>" data-id="<?php echo O::escapeHtml(''.@$projectid.'') ?>" data-extra="<?php echo O::escapeHtml('[]') ?>" href="<?php echo O::escapeHtml('#/languagelist/'.@$projectid.'') ?>" class="<?php echo O::escapeHtml('or-link') ?>"><?php echo O::escapeHtml('') ?> - <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--action-language') ?>"><?php echo O::escapeHtml('') ?></i> - <span><?php echo O::escapeHtml(''.@O::lang('languages').'') ?></span> - </a> - </td> - </tr> - <tr class="<?php echo O::escapeHtml('or-data') ?>"><?php echo O::escapeHtml('') ?> - <td class="<?php echo O::escapeHtml('or-act-clickable') ?>"><?php echo O::escapeHtml('') ?> - <a target="<?php echo O::escapeHtml('_self') ?>" data-type="<?php echo O::escapeHtml('open') ?>" data-action="<?php echo O::escapeHtml('modellist') ?>" data-method="<?php echo O::escapeHtml('') ?>" data-id="<?php echo O::escapeHtml(''.@$projectid.'') ?>" data-extra="<?php echo O::escapeHtml('[]') ?>" href="<?php echo O::escapeHtml('#/modellist/'.@$projectid.'') ?>" class="<?php echo O::escapeHtml('or-link') ?>"><?php echo O::escapeHtml('') ?> - <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--action-model') ?>"><?php echo O::escapeHtml('') ?></i> - <span><?php echo O::escapeHtml(''.@O::lang('models').'') ?></span> - </a> - </td> - </tr> - <?php } ?> - </table> + <section class="<?php echo O::escapeHtml('or-group or-collapsible--is-open or-collapsible--show') ?>"><?php echo O::escapeHtml('') ?> + <h2 class="<?php echo O::escapeHtml('or-collapsible-title or-group-title or-collapsible-act-switch') ?>"><?php echo O::escapeHtml('') ?> + <span><?php echo O::escapeHtml(''.@O::lang('project').' '.@$name.'') ?></span> + </h2> + <div class="<?php echo O::escapeHtml('or-collapsible-value or-group-value') ?>"><?php echo O::escapeHtml('') ?> + <div class="<?php echo O::escapeHtml('or-table-wrapper') ?>"><?php echo O::escapeHtml('') ?> + <div class="<?php echo O::escapeHtml('or-table-area') ?>"><?php echo O::escapeHtml('') ?> + <table width="<?php echo O::escapeHtml('100%') ?>" class="<?php echo O::escapeHtml('or-table') ?>"><?php echo O::escapeHtml('') ?> + <tr class="<?php echo O::escapeHtml('or-data') ?>"><?php echo O::escapeHtml('') ?> + <td class="<?php echo O::escapeHtml('or-act-clickable') ?>"><?php echo O::escapeHtml('') ?> + <a target="<?php echo O::escapeHtml('_self') ?>" data-type="<?php echo O::escapeHtml('open') ?>" data-action="<?php echo O::escapeHtml('folder') ?>" data-method="<?php echo O::escapeHtml('') ?>" data-id="<?php echo O::escapeHtml(''.@$rootobjectid.'') ?>" data-extra="<?php echo O::escapeHtml('[]') ?>" href="<?php echo O::escapeHtml('#/folder/'.@$rootobjectid.'') ?>" class="<?php echo O::escapeHtml('or-link') ?>"><?php echo O::escapeHtml('') ?> + <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--action-folder') ?>"><?php echo O::escapeHtml('') ?></i> + <span><?php echo O::escapeHtml(''.@O::lang('content').'') ?></span> + </a> + </td> + </tr> + <?php $if4=($is_project_admin); if($if4) { ?> + <tr class="<?php echo O::escapeHtml('or-data') ?>"><?php echo O::escapeHtml('') ?> + <td class="<?php echo O::escapeHtml('or-act-clickable') ?>"><?php echo O::escapeHtml('') ?> + <a target="<?php echo O::escapeHtml('_self') ?>" data-type="<?php echo O::escapeHtml('open') ?>" data-action="<?php echo O::escapeHtml('templatelist') ?>" data-method="<?php echo O::escapeHtml('') ?>" data-id="<?php echo O::escapeHtml(''.@$projectid.'') ?>" data-extra="<?php echo O::escapeHtml('[]') ?>" href="<?php echo O::escapeHtml('#/templatelist/'.@$projectid.'') ?>" class="<?php echo O::escapeHtml('or-link') ?>"><?php echo O::escapeHtml('') ?> + <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--action-template') ?>"><?php echo O::escapeHtml('') ?></i> + <span><?php echo O::escapeHtml(''.@O::lang('templates').'') ?></span> + </a> + </td> + </tr> + <tr class="<?php echo O::escapeHtml('or-data') ?>"><?php echo O::escapeHtml('') ?> + <td class="<?php echo O::escapeHtml('or-act-clickable') ?>"><?php echo O::escapeHtml('') ?> + <a target="<?php echo O::escapeHtml('_self') ?>" data-type="<?php echo O::escapeHtml('open') ?>" data-action="<?php echo O::escapeHtml('languagelist') ?>" data-method="<?php echo O::escapeHtml('') ?>" data-id="<?php echo O::escapeHtml(''.@$projectid.'') ?>" data-extra="<?php echo O::escapeHtml('[]') ?>" href="<?php echo O::escapeHtml('#/languagelist/'.@$projectid.'') ?>" class="<?php echo O::escapeHtml('or-link') ?>"><?php echo O::escapeHtml('') ?> + <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--action-language') ?>"><?php echo O::escapeHtml('') ?></i> + <span><?php echo O::escapeHtml(''.@O::lang('languages').'') ?></span> + </a> + </td> + </tr> + <tr class="<?php echo O::escapeHtml('or-data') ?>"><?php echo O::escapeHtml('') ?> + <td class="<?php echo O::escapeHtml('or-act-clickable') ?>"><?php echo O::escapeHtml('') ?> + <a target="<?php echo O::escapeHtml('_self') ?>" data-type="<?php echo O::escapeHtml('open') ?>" data-action="<?php echo O::escapeHtml('modellist') ?>" data-method="<?php echo O::escapeHtml('') ?>" data-id="<?php echo O::escapeHtml(''.@$projectid.'') ?>" data-extra="<?php echo O::escapeHtml('[]') ?>" href="<?php echo O::escapeHtml('#/modellist/'.@$projectid.'') ?>" class="<?php echo O::escapeHtml('or-link') ?>"><?php echo O::escapeHtml('') ?> + <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--action-model') ?>"><?php echo O::escapeHtml('') ?></i> + <span><?php echo O::escapeHtml(''.@O::lang('models').'') ?></span> + </a> + </td> + </tr> + <?php } ?> + </table> + </div> + </div> </div> - </div>- \ No newline at end of file + </section>+ \ No newline at end of file diff --git a/modules/cms/ui/themes/default/html/views/project/edit.tpl.src.xml b/modules/cms/ui/themes/default/html/views/project/edit.tpl.src.xml @@ -1,49 +1,53 @@ <output xmlns="http://www.openrat.de/template" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openrat.de/template ../../../../../../../template_engine/components/template.xsd"> - <table filter="false"> - <row header="true"> - <column> - <text value="${message:TYPE}"/> - <text value=" / "/> - <text value="${message:NAME}"/> - </column> - </row> + <group collapsible="false" title="${message:project} ${name}"> - <row class="data"> - <column class="act-clickable"> - <link type="open" id="${rootobjectid}" name="" action="folder"> - <image action="folder"/> - <text value="${message:content}"/> - </link> - </column> - </row> + <table filter="false"> - <if true="${is_project_admin}"> - <row class="data"> - <column class="act-clickable"> - <link type="open" id="${projectid}" name="" action="templatelist"> - <image action="template"/> - <text value="${message:templates}"/> - </link> +<!-- <row header="true"> + <column> + <text value="${message:TYPE}"/> + <text value=" / "/> + <text value="${message:NAME}"/> </column> - </row> - <row class="data"> - <column class="act-clickable"> - <link type="open" id="${projectid}" name="" action="languagelist"> - <image action="language"/> - <text value="${message:languages}"/> - </link> - </column> - </row> + </row>--> + <row class="data"> <column class="act-clickable"> - <link type="open" id="${projectid}" name="" action="modellist"> - <image action="model"/> - <text value="${message:models}"/> + <link type="open" id="${rootobjectid}" name="" action="folder"> + <image action="folder"/> + <text value="${message:content}"/> </link> </column> </row> - </if> - </table> + + <if true="${is_project_admin}"> + <row class="data"> + <column class="act-clickable"> + <link type="open" id="${projectid}" name="" action="templatelist"> + <image action="template"/> + <text value="${message:templates}"/> + </link> + </column> + </row> + <row class="data"> + <column class="act-clickable"> + <link type="open" id="${projectid}" name="" action="languagelist"> + <image action="language"/> + <text value="${message:languages}"/> + </link> + </column> + </row> + <row class="data"> + <column class="act-clickable"> + <link type="open" id="${projectid}" name="" action="modellist"> + <image action="model"/> + <text value="${message:models}"/> + </link> + </column> + </row> + </if> + </table> + </group> </output> diff --git a/modules/cms/ui/themes/default/html/views/template/prop.php b/modules/cms/ui/themes/default/html/views/template/prop.php @@ -19,6 +19,15 @@ <input name="<?php echo O::escapeHtml('name') ?>" type="<?php echo O::escapeHtml('text') ?>" maxlength="<?php echo O::escapeHtml('50') ?>" value="<?php echo O::escapeHtml(''.@$name.'') ?>" class="<?php echo O::escapeHtml('or-input') ?>" /><?php echo O::escapeHtml('') ?> </div> </section> + <section class="<?php echo O::escapeHtml('or-fieldset') ?>"><?php echo O::escapeHtml('') ?> + <h3 class="<?php echo O::escapeHtml('or-fieldset-label') ?>"><?php echo O::escapeHtml(''.@O::lang('PUBLISH').'') ?></h3> + <div class="<?php echo O::escapeHtml('or-fieldset-value') ?>"><?php echo O::escapeHtml('') ?> + <label><?php echo O::escapeHtml('') ?> + <input type="<?php echo O::escapeHtml('checkbox') ?>" name="<?php echo O::escapeHtml('publish') ?>" value="<?php echo O::escapeHtml('1') ?>" <?php if(@$publish){ ?>checked="<?php echo O::escapeHtml('checked') ?>"<?php } ?> class="<?php echo O::escapeHtml('or-form-checkbox') ?>" /><?php echo O::escapeHtml('') ?> + <span class="<?php echo O::escapeHtml('or-form-label') ?>"><?php echo O::escapeHtml(''.@O::lang('publish').'') ?></span> + </label> + </div> + </section> </div> </section> </div> diff --git a/modules/cms/ui/themes/default/html/views/template/prop.tpl.src.xml b/modules/cms/ui/themes/default/html/views/template/prop.tpl.src.xml @@ -5,6 +5,9 @@ <fieldset label="${message:TEMPLATE_NAME}"> <input name="name" maxlength="50"/> </fieldset> + <fieldset label="${message:PUBLISH}"> + <checkbox label="${message:publish}" name="publish" /> + </fieldset> </group> </form> </output> diff --git a/modules/cms/ui/themes/default/html/views/templatelist/edit.php b/modules/cms/ui/themes/default/html/views/templatelist/edit.php @@ -1,38 +1,47 @@ <?php /* THIS FILE IS GENERATED from edit.tpl.src.xml - DO NOT CHANGE */ defined('APP_STARTED') || die('Forbidden'); use \template_engine\Output as O; ?> - <div class="<?php echo O::escapeHtml('or-table-wrapper') ?>"><?php echo O::escapeHtml('') ?> - <div class="<?php echo O::escapeHtml('or-table-filter') ?>"><?php echo O::escapeHtml('') ?> - <input type="<?php echo O::escapeHtml('search') ?>" name="<?php echo O::escapeHtml('filter') ?>" placeholder="<?php echo O::escapeHtml(''.@O::lang('SEARCH_FILTER').'') ?>" class="<?php echo O::escapeHtml('or-input or-table-filter-input') ?>" /><?php echo O::escapeHtml('') ?> + <section class="<?php echo O::escapeHtml('or-group or-collapsible or-collapsible--is-open or-collapsible--show') ?>"><?php echo O::escapeHtml('') ?> + <h2 class="<?php echo O::escapeHtml('or-collapsible-title or-group-title or-collapsible-act-switch') ?>"><?php echo O::escapeHtml('') ?> + <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--node-closed or-collapsible--on-closed') ?>"><?php echo O::escapeHtml('') ?></i> + <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--node-open or-collapsible--on-open') ?>"><?php echo O::escapeHtml('') ?></i> + <span><?php echo O::escapeHtml(''.@O::lang('templates').'') ?></span> + </h2> + <div class="<?php echo O::escapeHtml('or-collapsible-value or-group-value') ?>"><?php echo O::escapeHtml('') ?> + <div class="<?php echo O::escapeHtml('or-table-wrapper') ?>"><?php echo O::escapeHtml('') ?> + <div class="<?php echo O::escapeHtml('or-table-filter') ?>"><?php echo O::escapeHtml('') ?> + <input type="<?php echo O::escapeHtml('search') ?>" name="<?php echo O::escapeHtml('filter') ?>" placeholder="<?php echo O::escapeHtml(''.@O::lang('SEARCH_FILTER').'') ?>" class="<?php echo O::escapeHtml('or-input or-table-filter-input') ?>" /><?php echo O::escapeHtml('') ?> + </div> + <div class="<?php echo O::escapeHtml('or-table-area') ?>"><?php echo O::escapeHtml('') ?> + <table width="<?php echo O::escapeHtml('100%') ?>" class="<?php echo O::escapeHtml('or-table') ?>"><?php echo O::escapeHtml('') ?> + <tr class="<?php echo O::escapeHtml('or-headline') ?>"><?php echo O::escapeHtml('') ?> + <td><?php echo O::escapeHtml('') ?> + <span><?php echo O::escapeHtml(''.@O::lang('name').'') ?></span> + </td> + </tr> + <?php foreach((array)$templates as $list_key=>$list_value) { extract($list_value); ?> + <tr class="<?php echo O::escapeHtml('or-data') ?>"><?php echo O::escapeHtml('') ?> + <td class="<?php echo O::escapeHtml('or-act-clickable') ?>"><?php echo O::escapeHtml('') ?> + <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--action-template') ?>"><?php echo O::escapeHtml('') ?></i> + <a target="<?php echo O::escapeHtml('_self') ?>" data-name="<?php echo O::escapeHtml(''.@$name.'') ?>" name="<?php echo O::escapeHtml(''.@$name.'') ?>" data-type="<?php echo O::escapeHtml('open') ?>" data-action="<?php echo O::escapeHtml('template') ?>" data-method="<?php echo O::escapeHtml('') ?>" data-id="<?php echo O::escapeHtml(''.@$id.'') ?>" data-extra="<?php echo O::escapeHtml('[]') ?>" href="<?php echo O::escapeHtml('#/template/'.@$id.'') ?>" class="<?php echo O::escapeHtml('or-link') ?>"><?php echo O::escapeHtml('') ?> + <span><?php echo O::escapeHtml(''.@$name.'') ?></span> + </a> + </td> + </tr> + <?php } ?> + <?php $if4=(($templates)==FALSE); if($if4) { ?> + <tr><?php echo O::escapeHtml('') ?> + <span><?php echo O::escapeHtml(''.@O::lang('NO_TEMPLATES_AVAILABLE_DESC').'') ?></span> + </tr> + <?php } ?> + <tr class="<?php echo O::escapeHtml('or-data') ?>"><?php echo O::escapeHtml('') ?> + <td colspan="<?php echo O::escapeHtml('1') ?>" class="<?php echo O::escapeHtml('or-act-clickable') ?>"><?php echo O::escapeHtml('') ?> + <a target="<?php echo O::escapeHtml('_self') ?>" data-type="<?php echo O::escapeHtml('dialog') ?>" data-action="<?php echo O::escapeHtml('') ?>" data-method="<?php echo O::escapeHtml('add') ?>" data-id="<?php echo O::escapeHtml('') ?>" data-extra-dialogAction="<?php echo O::escapeHtml('') ?>" data-extra-dialogMethod="<?php echo O::escapeHtml('add') ?>" data-extra="<?php echo O::escapeHtml('{\'dialogAction\':null,\'dialogMethod\':\'add\'}') ?>" href="<?php echo O::escapeHtml('') ?>" class="<?php echo O::escapeHtml('or-link') ?>"><?php echo O::escapeHtml('') ?> + <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--method-add') ?>"><?php echo O::escapeHtml('') ?></i> + <span><?php echo O::escapeHtml(''.@O::lang('add').'') ?></span> + </a> + </td> + </tr> + </table> + </div> + </div> </div> - <div class="<?php echo O::escapeHtml('or-table-area') ?>"><?php echo O::escapeHtml('') ?> - <table width="<?php echo O::escapeHtml('100%') ?>" class="<?php echo O::escapeHtml('or-table') ?>"><?php echo O::escapeHtml('') ?> - <tr class="<?php echo O::escapeHtml('or-headline') ?>"><?php echo O::escapeHtml('') ?> - <td><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.@O::lang('name').'') ?></span> - </td> - </tr> - <?php foreach((array)$templates as $list_key=>$list_value) { extract($list_value); ?> - <tr class="<?php echo O::escapeHtml('or-data') ?>"><?php echo O::escapeHtml('') ?> - <td class="<?php echo O::escapeHtml('or-act-clickable') ?>"><?php echo O::escapeHtml('') ?> - <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--action-template') ?>"><?php echo O::escapeHtml('') ?></i> - <a target="<?php echo O::escapeHtml('_self') ?>" data-name="<?php echo O::escapeHtml(''.@$name.'') ?>" name="<?php echo O::escapeHtml(''.@$name.'') ?>" data-type="<?php echo O::escapeHtml('open') ?>" data-action="<?php echo O::escapeHtml('template') ?>" data-method="<?php echo O::escapeHtml('') ?>" data-id="<?php echo O::escapeHtml(''.@$id.'') ?>" data-extra="<?php echo O::escapeHtml('[]') ?>" href="<?php echo O::escapeHtml('#/template/'.@$id.'') ?>" class="<?php echo O::escapeHtml('or-link') ?>"><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.@$name.'') ?></span> - </a> - </td> - </tr> - <?php } ?> - <?php $if3=(($templates)==FALSE); if($if3) { ?> - <tr><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.@O::lang('NO_TEMPLATES_AVAILABLE_DESC').'') ?></span> - </tr> - <?php } ?> - <tr class="<?php echo O::escapeHtml('or-data') ?>"><?php echo O::escapeHtml('') ?> - <td colspan="<?php echo O::escapeHtml('1') ?>" class="<?php echo O::escapeHtml('or-act-clickable') ?>"><?php echo O::escapeHtml('') ?> - <a target="<?php echo O::escapeHtml('_self') ?>" data-type="<?php echo O::escapeHtml('dialog') ?>" data-action="<?php echo O::escapeHtml('') ?>" data-method="<?php echo O::escapeHtml('add') ?>" data-id="<?php echo O::escapeHtml('') ?>" data-extra-dialogAction="<?php echo O::escapeHtml('') ?>" data-extra-dialogMethod="<?php echo O::escapeHtml('add') ?>" data-extra="<?php echo O::escapeHtml('{\'dialogAction\':null,\'dialogMethod\':\'add\'}') ?>" href="<?php echo O::escapeHtml('') ?>" class="<?php echo O::escapeHtml('or-link') ?>"><?php echo O::escapeHtml('') ?> - <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--method-add') ?>"><?php echo O::escapeHtml('') ?></i> - <span><?php echo O::escapeHtml(''.@O::lang('add').'') ?></span> - </a> - </td> - </tr> - </table> - </div> - </div>- \ No newline at end of file + </section>+ \ No newline at end of file diff --git a/modules/cms/ui/themes/default/html/views/templatelist/edit.tpl.src.xml b/modules/cms/ui/themes/default/html/views/templatelist/edit.tpl.src.xml @@ -1,32 +1,35 @@ -<output xmlns="http://www.openrat.de/template" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openrat.de/template ../../../../../../../template_engine/components/template.xsd"> - <table> - <row class="headline"> - <column> - <text value="${message:name}"/> - </column> - </row> - <list list="${templates}" extract="true"> - <row class="data"> - <column class="act-clickable"> - <image action="template"/> - <link type="open" id="${id}" name="${name}" action="template"> - <text value="${name}"/> - </link> - </column> - </row> - </list> - <if empty="${templates}"> - <row> - <text value="${message:NO_TEMPLATES_AVAILABLE_DESC}"/> - </row> - </if> - <row class="data"> - <column colspan="1" class="act-clickable"> - <link type="dialog" subaction="add"> - <image method="add"/> - <text value="${message:add}"/> - </link> - </column> - </row> - </table> +<output xmlns="http://www.openrat.de/template" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.openrat.de/template ../../../../../../../template_engine/components/template.xsd"> + <group title="${message:templates}"> + <table> + <row class="headline"> + <column> + <text value="${message:name}"/> + </column> + </row> + <list list="${templates}" extract="true"> + <row class="data"> + <column class="act-clickable"> + <image action="template"/> + <link type="open" id="${id}" name="${name}" action="template"> + <text value="${name}"/> + </link> + </column> + </row> + </list> + <if empty="${templates}"> + <row> + <text value="${message:NO_TEMPLATES_AVAILABLE_DESC}"/> + </row> + </if> + <row class="data"> + <column colspan="1" class="act-clickable"> + <link type="dialog" subaction="add"> + <image method="add"/> + <text value="${message:add}"/> + </link> + </column> + </row> + </table> + </group> </output> diff --git a/modules/cms/update/Update.class.php b/modules/cms/update/Update.class.php @@ -12,12 +12,18 @@ use logger\Logger; class Update { // This is the required DB version: - const SUPPORTED_VERSION = 25; + const SUPPORTED_VERSION = 26; // -----------------------^^----------------------------- const STATUS_UPDATE_PROGRESS = 0; const STATUS_UPDATE_SUCCESS = 1; + /** + * Detects if the database must be upgraded. + * + * @param Database $db + * @return bool true if database must be updated + */ public function isUpdateRequired(Database $db) { $version = $this->getDbVersion($db); @@ -38,6 +44,8 @@ class Update /** + * Update the database to a newer version. + * * @param Database $db */ public function update(Database $db) @@ -81,7 +89,8 @@ class Update /** - * Ermittelt die Version des Datenbank-Schemas. + * Detects the actual version of the database scheme. + * * @param Database $db * @return int */ @@ -113,13 +122,16 @@ SQL // Tabelle 'version' wurde in Version 2 angelegt. return 2; } else { + // no version table exists. + + // find out if there is the project table... $projectTableExists = $this->testQuery($db, 'SELECT 1 FROM {{project}}'); if ($projectTableExists) - // Entspricht dem Stand vor Einf├╝hrung der automatischen Migration. + // seems to be the old baseline version without a version table. return 1; else - // Es gibt gar keine Tabellen, es muss also alles neu angelegt werden. + // there are no tables, everything must be created. return 0; } } @@ -127,6 +139,7 @@ SQL /** * Stellt fest, ob eine DB-Anfrage funktioniert. + * * @param $db Database * @param $sql * @return <code>true</code> falls SQL funktioniert. diff --git a/modules/cms/update/version/DBVersion000026.class.php b/modules/cms/update/version/DBVersion000026.class.php @@ -0,0 +1,24 @@ +<?php + +namespace cms\update\version; + +use database\DbVersion; +use database\Column; + +/** + * Templates now have a type. + * + * @author Jan Dankert + * + */ +class DBVersion000026 extends DbVersion +{ + /** + * + */ + public function update() { + + $templateTable = $this->table('template'); + $templateTable->column('type')->type( Column::TYPE_INT)->defaultValue(1 )->add(); + } +}+ \ No newline at end of file