</acpmenuitem>
<!-- /style -->
+ <!-- template -->
+ <acpmenuitem name="wcf.acp.menu.link.template">
+ <parent>wcf.acp.menu.link.display</parent>
+ </acpmenuitem>
+ <acpmenuitem name="wcf.acp.menu.link.template.list">
+ <controller><![CDATA[wcf\acp\page\TemplateListPage]]></controller>
+ <parent>wcf.acp.menu.link.template</parent>
+ <permissions>admin.template.canManageTemplate</permissions>
+ </acpmenuitem>
+ <acpmenuitem name="wcf.acp.menu.link.template.add">
+ <controller><![CDATA[wcf\acp\form\TemplateAddForm]]></controller>
+ <parent>wcf.acp.menu.link.template</parent>
+ <permissions>admin.template.canManageTemplate</permissions>
+ </acpmenuitem>
+ <acpmenuitem name="wcf.acp.menu.link.template.group.list">
+ <controller><![CDATA[wcf\acp\page\TemplateGroupListPage]]></controller>
+ <parent>wcf.acp.menu.link.template</parent>
+ <permissions>admin.template.canManageTemplate</permissions>
+ </acpmenuitem>
+ <acpmenuitem name="wcf.acp.menu.link.template.group.add">
+ <controller><![CDATA[wcf\acp\form\TemplateGroupAddForm]]></controller>
+ <parent>wcf.acp.menu.link.template</parent>
+ <permissions>admin.template.canManageTemplate</permissions>
+ </acpmenuitem>
+ <!-- /template -->
+
<!-- language -->
<acpmenuitem name="wcf.acp.menu.link.language">
<parent>wcf.acp.menu.link.display</parent>
<category name="admin.display.pageMenu">
<parent>admin.display</parent>
</category>
+ <category name="admin.template">
+ <parent>admin.display</parent>
+ </category>
<category name="admin.content">
<parent>admin</parent>
<optiontype>boolean</optiontype>
<defaultvalue>0</defaultvalue>
<admindefaultvalue>1</admindefaultvalue>
- <showorder>1</showorder>
</option>
<option name="admin.style.canEditStyle">
<categoryname>admin.style</categoryname>
<optiontype>boolean</optiontype>
<defaultvalue>0</defaultvalue>
<admindefaultvalue>1</admindefaultvalue>
- <showorder>2</showorder>
</option>
<option name="admin.style.canDeleteStyle">
<categoryname>admin.style</categoryname>
<optiontype>boolean</optiontype>
<defaultvalue>0</defaultvalue>
<admindefaultvalue>1</admindefaultvalue>
- <showorder>3</showorder>
</option>
<option name="admin.style.canUseDisabledStyle">
<categoryname>admin.style</categoryname>
<optiontype>boolean</optiontype>
<defaultvalue>0</defaultvalue>
<admindefaultvalue>1</admindefaultvalue>
- <showorder>4</showorder>
</option>
<option name="admin.display.canManagePageMenu">
<categoryname>admin.display.pageMenu</categoryname>
<defaultvalue>0</defaultvalue>
<admindefaultvalue>1</admindefaultvalue>
</option>
+ <option name="admin.template.canManageTemplate">
+ <categoryname>admin.template</categoryname>
+ <optiontype>boolean</optiontype>
+ <defaultvalue>0</defaultvalue>
+ <admindefaultvalue>1</admindefaultvalue>
+ </option>
</options>
</import>
</data>
{if $objects|count}
<div class="container marginTop">
- <ol class="containerList styleList">
+ <ol class="containerList">
{foreach from=$objects item=item}
<li>
<div>
--- /dev/null
+{include file='header'}
+
+<header class="boxHeadline">
+ <hgroup>
+ <h1>{lang}wcf.acp.template.{$action}{/lang}</h1>
+ </hgroup>
+</header>
+
+{if $errorField}
+ <p class="error">{lang}wcf.global.form.error{/lang}</p>
+{/if}
+
+{if $success|isset}
+ <p class="success">{lang}wcf.global.success.{$action}{/lang}</p>
+{/if}
+
+<div class="contentNavigation">
+ <nav>
+ <ul>
+ <li><a href="{link controller='TemplateList'}{/link}" class="button"><span class="icon icon16 icon-list"></span> <span>{lang}wcf.acp.menu.link.template.list{/lang}</span></a></li>
+
+ {event name='contentNavigationButtons'}
+ </ul>
+ </nav>
+</div>
+
+{if $availableTemplateGroups|count}
+ <form method="post" action="{if $action == 'add'}{link controller='TemplateAdd'}{/link}{else}{link controller='TemplateEdit' id=$templateID}{/link}{/if}">
+ <div class="container containerPadding marginTop">
+ <fieldset>
+ <legend>{lang}wcf.global.form.data{/lang}</legend>
+
+ <dl>
+ <dt><label for="templateGroupID">{lang}wcf.acp.template.templateGroup{/lang}</label></dt>
+ <dd>
+ <select name="templateGroupID" id="templateGroupID">
+ {foreach from=$availableTemplateGroups item=availableTemplateGroup}
+ <option value="{@$availableTemplateGroup->templateGroupID}"{if $availableTemplateGroup->templateGroupID == $templateGroupID} selected="selected"{/if}>{$availableTemplateGroup->templateGroupName}</option>
+ {/foreach}
+ </select>
+ </dd>
+ </dl>
+
+ <dl{if $errorField == 'templateName'} class="formError"{/if}>
+ <dt><label for="tplName">{lang}wcf.global.name{/lang}</label></dt>
+ <dd>
+ <input type="text" id="tplName" name="tplName" value="{$tplName}" required="required" class="long" />
+ {if $errorField == 'templateName'}
+ <small class="innerError">
+ {if $errorType == 'empty'}
+ {lang}wcf.global.form.error.empty{/lang}
+ {else}
+ {lang}wcf.acp.template.name.error.{@$errorType}{/lang}
+ {/if}
+ </small>
+ {/if}
+ </dd>
+ </dl>
+
+ {event name='dataFields'}
+ </fieldset>
+
+
+ <fieldset>
+ <legend><label for="templateSource">{lang}wcf.acp.template.source{/lang}</label></legend>
+
+ <dl class="wide">
+ <dt><label for="templateSource">{lang}wcf.acp.template.source{/lang}</label></dt>
+ <dd>
+ <textarea id="templateSource" name="templateSource" cols="40" rows="20">{$templateSource}</textarea>
+ </dd>
+ </dl>
+ </fieldset>
+
+
+ {event name='fieldsets'}
+ </div>
+
+ <div class="formSubmit">
+ <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s" />
+ </div>
+ </form>
+{else}
+ <p class="error">{lang}wcf.acp.template.error.noGroups{/lang}</p>
+{/if}
+
+
+{include file='footer'}
--- /dev/null
+{include file='header'}
+
+<header class="boxHeadline">
+ <hgroup>
+ <h1>{lang}wcf.acp.template.group.{$action}{/lang}</h1>
+ </hgroup>
+</header>
+
+{if $errorField}
+ <p class="error">{lang}wcf.global.form.error{/lang}</p>
+{/if}
+
+{if $success|isset}
+ <p class="success">{lang}wcf.global.success.{$action}{/lang}</p>
+{/if}
+
+<div class="contentNavigation">
+ <nav>
+ <ul>
+ <li><a href="{link controller='TemplateGroupList'}{/link}" class="button"><span class="icon icon16 icon-list"></span> <span>{lang}wcf.acp.menu.link.template.group.list{/lang}</span></a></li>
+
+ {event name='contentNavigationButtons'}
+ </ul>
+ </nav>
+</div>
+
+<form method="post" action="{if $action == 'add'}{link controller='TemplateGroupAdd'}{/link}{else}{link controller='TemplateGroupEdit' id=$templateGroupID}{/link}{/if}">
+ <div class="container containerPadding marginTop">
+ <fieldset>
+ <legend>{lang}wcf.global.form.data{/lang}</legend>
+
+ {if $availableTemplateGroups|count}
+ <dl>
+ <dt><label for="parentTemplateGroupID">{lang}wcf.acp.template.group.parentTemplateGroup{/lang}</label></dt>
+ <dd>
+ <select name="parentTemplateGroupID" id="parentTemplateGroupID">
+ <option value="0"></option>
+ {foreach from=$availableTemplateGroups item=availableTemplateGroup}
+ <option value="{@$availableTemplateGroup->templateGroupID}"{if $availableTemplateGroup->templateGroupID == $parentTemplateGroupID} selected="selected"{/if}>{$availableTemplateGroup->templateGroupName}</option>
+ {/foreach}
+ </select>
+ </dd>
+ </dl>
+ {/if}
+
+ <dl{if $errorField == 'templateGroupName'} class="formError"{/if}>
+ <dt><label for="templateGroupName">{lang}wcf.global.name{/lang}</label></dt>
+ <dd>
+ <input type="text" id="templateGroupName" name="templateGroupName" value="{$templateGroupName}" required="required" class="long" />
+ {if $errorField == 'templateGroupName'}
+ <small class="innerError">
+ {if $errorType == 'empty'}
+ {lang}wcf.global.form.error.empty{/lang}
+ {else}
+ {lang}wcf.acp.template.group.name.error.{@$errorType}{/lang}
+ {/if}
+ </small>
+ {/if}
+ </dd>
+ </dl>
+
+ <dl{if $errorField == 'templateGroupFolderName'} class="formError"{/if}>
+ <dt><label for="templateGroupFolderName">{lang}wcf.acp.template.group.folderName{/lang}</label></dt>
+ <dd>
+ <input type="text" id="templateGroupFolderName" name="templateGroupFolderName" value="{$templateGroupFolderName}" required="required" class="long" />
+ {if $errorField == 'templateGroupFolderName'}
+ <small class="innerError">
+ {if $errorType == 'empty'}
+ {lang}wcf.global.form.error.empty{/lang}
+ {else}
+ {lang}wcf.acp.template.group.name.error.{@$errorType}{/lang}
+ {/if}
+ </small>
+ {/if}
+ <small>{lang}wcf.acp.template.group.folderName.description{/lang}</small>
+ </dd>
+ </dl>
+
+ {event name='dataFields'}
+ </fieldset>
+
+ {event name='fieldsets'}
+ </div>
+
+ <div class="formSubmit">
+ <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s" />
+ </div>
+</form>
+
+
+{include file='footer'}
--- /dev/null
+{include file='header' pageTitle='wcf.acp.template.group.list'}
+
+<header class="boxHeadline">
+ <hgroup>
+ <h1>{lang}wcf.acp.template.group.list{/lang}</h1>
+ </hgroup>
+
+ <script type="text/javascript">
+ //<![CDATA[
+ $(function() {
+ new WCF.Action.Delete('wcf\\data\\template\\group\\TemplateGroupAction', '.jsTemplateGroupRow');
+ });
+ //]]>
+ </script>
+</header>
+
+<div class="contentNavigation">
+ {pages print=true assign=pagesLinks controller="TemplateGroupList" link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder"}
+
+ <nav>
+ <ul>
+ <li><a href="{link controller='TemplateGroupAdd'}{/link}" class="button"><span class="icon icon16 icon-plus"></span> <span>{lang}wcf.acp.template.group.add{/lang}</span></a></li>
+
+ {event name='contentNavigationButtonsTop'}
+ </ul>
+ </nav>
+</div>
+
+{if $objects|count}
+ <div class="tabularBox tabularBoxTitle marginTop">
+ <hgroup>
+ <h1>{lang}wcf.acp.template.group.list{/lang} <span class="badge badgeInverse">{#$items}</span></h1>
+ </hgroup>
+
+ <table class="table">
+ <thead>
+ <tr>
+ <th class="columnID columnTemplateGroupID{if $sortField == 'templateGroupID'} active {@$sortOrder}{/if}" colspan="2"><a href="{link controller='TemplateGroupList'}pageNo={@$pageNo}&sortField=templateGroupID&sortOrder={if $sortField == 'templateGroupID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.global.objectID{/lang}</a></th>
+ <th class="columnTitle columnTemplateGroupName{if $sortField == 'templateGroupName'} active {@$sortOrder}{/if}"><a href="{link controller='TemplateGroupList'}pageNo={@$pageNo}&sortField=templateGroupName&sortOrder={if $sortField == 'templateGroupName' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.global.name{/lang}</a></th>
+ <th class="columnText columnTemplateGroupFolderName{if $sortField == 'templateGroupFolderName'} active {@$sortOrder}{/if}"><a href="{link controller='TemplateGroupList'}pageNo={@$pageNo}&sortField=templateGroupFolderName&sortOrder={if $sortField == 'templateGroupFolderName' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.template.group.folderName{/lang}</a></th>
+ <th class="columnDigits columnTemplates{if $sortField == 'templates'} active {@$sortOrder}{/if}"><a href="{link controller='TemplateGroupList'}pageNo={@$pageNo}&sortField=templates&sortOrder={if $sortField == 'templates' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.template.group.templates{/lang}</a></th>
+
+ {event name='columnHeads'}
+ </tr>
+ </thead>
+
+ <tbody>
+ {foreach from=$objects item=templateGroup}
+ <tr class="jsTemplateGroupRow">
+ <td class="columnIcon">
+ <a href="{link controller='TemplateGroupEdit' id=$templateGroup->templateGroupID}{/link}" title="{lang}wcf.global.button.edit{/lang}" class="jsTooltip"><span class="icon icon16 icon-pencil"></span></a>
+ <span class="icon icon16 icon-remove jsDeleteButton jsTooltip pointer" title="{lang}wcf.global.button.delete{/lang}" data-object-id="{@$templateGroup->templateGroupID}" data-confirm-message="{lang}wcf.acp.template.group.delete.sure{/lang}"></span>
+
+ {event name='rowButtons'}
+ </td>
+ <td class="columnID">{@$templateGroup->templateGroupID}</td>
+ <td class="columnTitle columnTemplateGroupName"><a href="{link controller='TemplateGroupEdit' id=$templateGroup->templateGroupID}{/link}">{$templateGroup->templateGroupName}</a></td>
+ <td class="columnText columnTemplateGroupFolderName">{$templateGroup->templateGroupFolderName}</td>
+ <td class="columnDigits columnTemplates">{#$templateGroup->templates}</td>
+
+ {event name='columns'}
+ </tr>
+ {/foreach}
+ </tbody>
+ </table>
+
+ </div>
+
+ <div class="contentNavigation">
+ {@$pagesLinks}
+
+ <nav>
+ <ul>
+ <li><a href="{link controller='TemplateGroupAdd'}{/link}" class="button"><span class="icon icon16 icon-plus"></span> <span>{lang}wcf.acp.template.group.add{/lang}</span></a></li>
+
+ {event name='contentNavigationButtonsBottom'}
+ </ul>
+ </nav>
+ </div>
+{else}
+ <p class="info">{lang}wcf.acp.template.group.noItems{/lang}</p>
+{/if}
+
+{include file='footer'}
--- /dev/null
+{include file='header' pageTitle="wcf.acp.template.list"}
+
+<script type="text/javascript">
+ //<![CDATA[
+ $(function() {
+ new WCF.Action.Delete('wcf\\data\\template\\TemplateAction', '.jsTemplateRow');
+ });
+ //]]>
+</script>
+
+<header class="boxHeadline">
+ <hgroup>
+ <h1>{lang}wcf.acp.template.list{/lang}</h1>
+ </hgroup>
+</header>
+
+<form method="post" action="{link controller='TemplateList'}{/link}">
+ <div class="container containerPadding marginTop">
+ <fieldset>
+ <legend>{lang}wcf.acp.template.list.filter{/lang}</legend>
+
+ <dl>
+ <dt><label for="templateGroupID">{lang}wcf.acp.template.group{/lang}</label></dt>
+ <dd>
+ <select name="templateGroupID" id="templateGroupID">
+ <option value="0">{lang}wcf.acp.template.group.default{/lang}</option>
+ {foreach from=$availableTemplateGroups item=availableTemplateGroup}
+ <option value="{@$availableTemplateGroup->templateGroupID}"{if $availableTemplateGroup->templateGroupID == $templateGroupID} selected="selected"{/if}>{$availableTemplateGroup->templateGroupName}</option>
+ {/foreach}
+ </select>
+ </dd>
+ </dl>
+
+ <dl>
+ <dt><label for="searchTemplateName">{lang}wcf.global.name{/lang}</label></dt>
+ <dd>
+ <input type="text" id="searchTemplateName" name="searchTemplateName" value="{$searchTemplateName}" class="long" />
+ </dd>
+ </dl>
+ </fieldset>
+ </div>
+
+ <div class="formSubmit">
+ <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s" />
+ </div>
+</form>
+
+<div class="contentNavigation">
+ {assign var='linkParameters' value=''}
+ {if $templateGroupID}{capture append=linkParameters}&templateGroupID={@$templateGroupID}{/capture}{/if}
+ {if $searchTemplateName}{capture append=linkParameters}&searchTemplateName={@$searchTemplateName|rawurlencode}{/capture}{/if}
+
+ {pages print=true assign=pagesLinks controller="TemplateList" link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder$linkParameters"}
+
+ <nav>
+ <ul>
+ <li><a href="{link controller='TemplateAdd'}{/link}" class="button"><span class="icon icon16 icon-plus"></span> <span>{lang}wcf.acp.template.add{/lang}</span></a></li>
+
+ {event name='contentNavigationButtonsTop'}
+ </ul>
+ </nav>
+</div>
+
+{if $objects|count}
+ <div class="tabularBox tabularBoxTitle marginTop">
+ <hgroup>
+ <h1>{lang}wcf.acp.template.list{/lang} <span class="badge badgeInverse">{#$items}</span></h1>
+ </hgroup>
+
+ <table class="table">
+ <thead>
+ <tr>
+ <th class="columnID columnTemplateID{if $sortField == 'templateID'} active {@$sortOrder}{/if}" colspan="2"><a href="{link controller='TemplateList'}pageNo={@$pageNo}&sortField=templateID&sortOrder={if $sortField == 'templateID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{@$linkParameters}{/link}">{lang}wcf.global.objectID{/lang}</a></th>
+ <th class="columnTitle columnTemplateName{if $sortField == 'templateName'} active {@$sortOrder}{/if}"><a href="{link controller='TemplateList'}pageNo={@$pageNo}&sortField=templateName&sortOrder={if $sortField == 'templateName' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{@$linkParameters}{/link}">{lang}wcf.global.name{/lang}</a></th>
+ <th class="columnDate columnLastModificationTime{if $sortField == 'lastModificationTime'} active {@$sortOrder}{/if}"><a href="{link controller='TemplateList'}pageNo={@$pageNo}&sortField=lastModificationTime&sortOrder={if $sortField == 'lastModificationTime' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{@$linkParameters}{/link}">{lang}wcf.acp.template.lastModificationTime{/lang}</a></th>
+
+ {event name='columnHeads'}
+ </tr>
+ </thead>
+
+ <tbody>
+ {foreach from=$objects item=template}
+ <tr class="jsTemplateRow">
+ <td class="columnIcon">
+ <a href="{link controller='TemplateAdd'}copy={@$template->templateID}{/link}" title="{lang}wcf.acp.template.copy{/lang}" class="jsTooltip"><span class="icon icon16 icon-copy"></span></a>
+
+ {if $template->templateGroupID}
+ <a href="{link controller='TemplateEdit' id=$template->templateID}{/link}" title="{lang}wcf.global.button.edit{/lang}" class="jsTooltip"><span class="icon icon16 icon-pencil"></span></a>
+ <span class="icon icon16 icon-remove jsDeleteButton jsTooltip pointer" title="{lang}wcf.global.button.delete{/lang}" data-object-id="{@$template->templateID}" data-confirm-message="{lang}wcf.acp.template.delete.sure{/lang}"></span>
+ {else}
+ <span class="icon icon16 icon-pencil disabled" title="{lang}wcf.global.button.edit{/lang}"></span>
+ <span class="icon icon16 icon-remove disabled" title="{lang}wcf.global.button.delete{/lang}"></span>
+ {/if}
+
+ {event name='rowButtons'}
+ </td>
+ <td class="columnID">{@$template->templateID}</td>
+ <td class="columnTitle columnTemplateName">{if $template->templateGroupID}<a href="{link controller='TemplateEdit' id=$template->templateID}{/link}">{$template->templateName}</a>{else}{$template->templateName}{/if}</td>
+ <td class="columnDate columnLastModificationTime">{@$template->lastModificationTime|time}</td>
+
+ {event name='columns'}
+ </tr>
+ {/foreach}
+ </tbody>
+ </table>
+
+ </div>
+
+ <div class="contentNavigation">
+ {@$pagesLinks}
+
+ <nav>
+ <ul>
+ <li><a href="{link controller='TemplateAdd'}{/link}" class="button"><span class="icon icon16 icon-plus"></span> <span>{lang}wcf.acp.template.add{/lang}</span></a></li>
+
+ {event name='contentNavigationButtonsBottom'}
+ </ul>
+ </nav>
+ </div>
+{else}
+ <p class="info">{lang}wcf.acp.template.noItems{/lang}</p>
+{/if}
+
+{include file='footer'}
--- /dev/null
+<?php
+namespace wcf\acp\form;
+use wcf\data\template\group\TemplateGroup;
+use wcf\data\template\group\TemplateGroupAction;
+use wcf\data\template\group\TemplateGroupList;
+use wcf\data\template\Template;
+use wcf\data\template\TemplateAction;
+use wcf\form\AbstractForm;
+use wcf\system\exception\UserInputException;
+use wcf\system\WCF;
+use wcf\util\StringUtil;
+
+/**
+ * Shows the form for adding new templates.
+ *
+ * @author Marcel Werk
+ * @copyright 2001-2013 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage acp.form
+ * @category Community Framework
+ */
+class TemplateAddForm extends AbstractForm {
+ /**
+ * @see wcf\page\AbstractPage::$activeMenuItem
+ */
+ public $activeMenuItem = 'wcf.acp.menu.link.template.add';
+
+ /**
+ * @see wcf\page\AbstractPage::$neededPermissions
+ */
+ public $neededPermissions = array('admin.template.canManageTemplate');
+
+ /**
+ * template name
+ * @var string
+ */
+ public $tplName = '';
+
+ /**
+ * template group id
+ * @var integer
+ */
+ public $templateGroupID = 0;
+
+ /**
+ * template source code
+ * @var string
+ */
+ public $templateSource = '';
+
+ /**
+ * available template groups
+ * @var array
+ */
+ public $availableTemplateGroups = array();
+
+ /**
+ * template's package id
+ * @var integer
+ */
+ public $packageID = PACKAGE_ID;
+
+ /**
+ * @see wcf\form\IForm::readFormParameters()
+ */
+ public function readFormParameters() {
+ parent::readFormParameters();
+
+ if (isset($_POST['tplName'])) $this->tplName = StringUtil::trim($_POST['tplName']);
+ if (isset($_POST['templateSource'])) $this->templateSource = $_POST['templateSource'];
+ if (isset($_POST['templateGroupID'])) $this->templateGroupID = intval($_POST['templateGroupID']);
+
+ // get package id for this template
+ $sql = "SELECT packageID
+ FROM wcf".WCF_N."_template
+ WHERE templateName = ?
+ AND templateGroupID IS NULL";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute(array($this->tplName));
+ $row = $statement->fetchArray();
+ if ($row !== false) {
+ $this->packageID = $row['packageID'];
+ }
+ }
+
+ /**
+ * @see wcf\form\IForm::validate()
+ */
+ public function validate() {
+ parent::validate();
+
+ $this->validateName();
+ $this->validateGroup();
+ }
+
+ /**
+ * Validates the template name.
+ */
+ protected function validateName() {
+ if (empty($this->tplName)) {
+ throw new UserInputException('tplName');
+ }
+
+ if (!preg_match('^/[a-z0-9_\-]+$/i', $this->tplName)) {
+ throw new UserInputException('tplName', 'notValid');
+ }
+
+ $sql = "SELECT COUNT(*) AS count
+ FROM wcf".WCF_N."_template
+ WHERE templateName = ?
+ AND packageID = ?
+ AND templateGroupID = ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute(array(
+ $this->tplName,
+ $this->packageID,
+ $this->templateGroupID
+ ));
+ $row = $statement->fetchArray();
+ if ($row['count']) {
+ throw new UserInputException('tplName', 'notUnique');
+ }
+ }
+
+ /**
+ * Validates the selected template group.
+ */
+ protected function validateGroup() {
+ if (!$this->templateGroupID) {
+ throw new UserInputException('templateGroupID');
+ }
+
+ $templateGroup = new TemplateGroup($this->templateGroupID);
+ if (!$templateGroup->templateGroupID) {
+ throw new UserInputException('templateGroupID');
+ }
+ }
+
+ /**
+ * @see wcf\form\IForm::save()
+ */
+ public function save() {
+ parent::save();
+
+ $this->objectAction = new TemplateAction(array(), 'create', array('data' => array(
+ 'templateName' => $this->templateName,
+ 'packageID' => $this->packageID,
+ 'templateGroupID' => ($this->templateGroupID)
+ ), 'source' => $this->templateSource));
+ $this->objectAction->executeAction();
+ $this->saved();
+
+ // reset values
+ $this->templateName = $this->source = '';
+ $this->templateGroupID = 0;
+
+ // show success
+ WCF::getTPL()->assign(array(
+ 'success' => true
+ ));
+ }
+
+ /**
+ * @see wcf\page\IPage::readData()
+ */
+ public function readData() {
+ parent::readData();
+
+ $templateGroupList = new TemplateGroupList();
+ $templateGroupList->readObjects();
+ $this->availableTemplateGroups = $templateGroupList->getObjects();
+
+ if (!count($_POST)) {
+ if (!empty($_REQUEST['copy'])) {
+ $templateID = intval($_REQUEST['copy']);
+ $template = new Template($templateID);
+ $this->tplName = $template->templateName;
+ $this->templateSource = $template->getSource();
+ }
+ }
+ }
+
+ /**
+ * @see wcf\page\IPage::assignVariables()
+ */
+ public function assignVariables() {
+ parent::assignVariables();
+
+ WCF::getTPL()->assign(array(
+ 'action' => 'add',
+ 'tplName' => $this->tplName,
+ 'templateGroupID' => $this->templateGroupID,
+ 'templateSource' => $this->templateSource,
+ 'availableTemplateGroups' => $this->availableTemplateGroups
+ ));
+ }
+}
--- /dev/null
+<?php
+namespace wcf\acp\form;
+use wcf\data\template\group\TemplateGroupAction;
+use wcf\data\template\group\TemplateGroupList;
+use wcf\form\AbstractForm;
+use wcf\system\exception\UserInputException;
+use wcf\system\WCF;
+use wcf\util\StringUtil;
+
+/**
+ * Shows the form for adding new template groups.
+ *
+ * @author Marcel Werk
+ * @copyright 2001-2013 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage acp.form
+ * @category Community Framework
+ */
+class TemplateGroupAddForm extends AbstractForm {
+ /**
+ * @see wcf\page\AbstractPage::$activeMenuItem
+ */
+ public $activeMenuItem = 'wcf.acp.menu.link.template.group.add';
+
+ /**
+ * @see wcf\page\AbstractPage::$neededPermissions
+ */
+ public $neededPermissions = array('admin.template.canManageTemplate');
+
+ /**
+ * template group name
+ * @var string
+ */
+ public $templateGroupName = '';
+
+ /**
+ * template group folder
+ * @var integer
+ */
+ public $templateGroupFolderName = '';
+
+ /**
+ * parent template group id
+ * @var integer
+ */
+ public $parentTemplateGroupID = 0;
+
+ /**
+ * available template groups
+ * @var array
+ */
+ public $availableTemplateGroups = array();
+
+ /**
+ * @see wcf\form\IForm::readFormParameters()
+ */
+ public function readFormParameters() {
+ parent::readFormParameters();
+
+ if (isset($_POST['templateGroupName'])) $this->templateGroupName = StringUtil::trim($_POST['templateGroupName']);
+ if (isset($_POST['templateGroupFolderName'])) $this->templateGroupFolderName = StringUtil::trim($_POST['templateGroupFolderName']);
+ if (isset($_POST['parentTemplateGroupID'])) $this->parentTemplateGroupID = intval($_POST['parentTemplateGroupID']);
+ }
+
+ /**
+ * @see wcf\form\IForm::validate()
+ */
+ public function validate() {
+ parent::validate();
+
+ $this->validateName();
+ $this->validateFolderName();
+ }
+
+ /**
+ * Validates the template group name.
+ */
+ protected function validateName() {
+ if (empty($this->templateGroupName)) {
+ throw new UserInputException('templateGroupName');
+ }
+
+ $sql = "SELECT COUNT(*) AS count
+ FROM wcf".WCF_N."_template_group
+ WHERE templateGroupName = ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute(array($this->templateGroupName));
+ $row = $statement->fetchArray();
+ if ($row['count']) {
+ throw new UserInputException('templateGroupName', 'notUnique');
+ }
+ }
+
+ /**
+ * Validates the template group folder name.
+ */
+ protected function validateFolderName() {
+ if (empty($this->templateGroupFolderName)) {
+ throw new UserInputException('templateGroupFolderName');
+ }
+
+ if ($this->templateGroupFolderName == '/') {
+ throw new UserInputException('templateGroupFolderName', 'notUnique');
+ }
+
+ $sql = "SELECT COUNT(*) AS count
+ FROM wcf".WCF_N."_template_group
+ WHERE templateGroupFolderName = ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute(array($this->templateGroupFolderName));
+ $row = $statement->fetchArray();
+ if ($row['count']) {
+ throw new UserInputException('templateGroupFolderName', 'notUnique');
+ }
+ }
+
+ /**
+ * @see wcf\form\IForm::save()
+ */
+ public function save() {
+ parent::save();
+
+ $this->objectAction = new TemplateGroupAction(array(), 'create', array('data' => array(
+ 'templateGroupName' => $this->templateGroupName,
+ 'templateGroupFolderName' => $this->templateGroupFolderName,
+ 'parentTemplateGroupID' => ($this->parentTemplateGroupID ?: null)
+ )));
+ $this->objectAction->executeAction();
+ $this->saved();
+
+ // reset values
+ $this->templateGroupName = $this->templateGroupFolderName = '';
+
+ // show success
+ WCF::getTPL()->assign(array(
+ 'success' => true
+ ));
+ }
+
+ /**
+ * @see wcf\page\IPage::readData()
+ */
+ public function readData() {
+ parent::readData();
+
+ $templateGroupList = new TemplateGroupList();
+ $templateGroupList->readObjects();
+ $this->availableTemplateGroups = $templateGroupList->getObjects();
+ }
+
+ /**
+ * @see wcf\page\IPage::assignVariables()
+ */
+ public function assignVariables() {
+ parent::assignVariables();
+
+ WCF::getTPL()->assign(array(
+ 'action' => 'add',
+ 'templateGroupName' => $this->templateGroupName,
+ 'templateGroupFolderName' => $this->templateGroupFolderName,
+ 'parentTemplateGroupID' => $this->parentTemplateGroupID,
+ 'availableTemplateGroups' => $this->availableTemplateGroups
+ ));
+ }
+}
--- /dev/null
+<?php
+namespace wcf\acp\form;
+use wcf\data\template\group\TemplateGroup;
+use wcf\data\template\group\TemplateGroupAction;
+use wcf\data\template\group\TemplateGroupList;
+use wcf\form\AbstractForm;
+use wcf\system\exception\IllegalLinkException;
+use wcf\system\WCF;
+
+/**
+ * Shows the form for editing template groups.
+ *
+ * @author Marcel Werk
+ * @copyright 2001-2013 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage acp.form
+ * @category Community Framework
+ */
+class TemplateGroupEditForm extends TemplateGroupAddForm {
+ /**
+ * @see wcf\page\AbstractPage::$activeMenuItem
+ */
+ public $activeMenuItem = 'wcf.acp.menu.link.template';
+
+ /**
+ * template group id
+ * @var integer
+ */
+ public $templateGroupID = 0;
+
+ /**
+ * template group object
+ * @var wcf\data\template\group\TemplateGroup
+ */
+ public $templateGroup = null;
+
+ /**
+ * @see wcf\patge\IPage::readParameters()
+ */
+ public function readParameters() {
+ parent::readParameters();
+
+ if (isset($_REQUEST['id'])) $this->templateGroupID = intval($_REQUEST['id']);
+ $this->templateGroup = new TemplateGroup($this->templateGroupID);
+ if (!$this->templateGroup->templateGroupID) {
+ throw new IllegalLinkException();
+ }
+ }
+
+ /**
+ * @see wcf\acp\form\TemplateGroupAddForm::validateName()
+ */
+ protected function validateName() {
+ if ($this->templateGroupName != $this->templateGroup->templateGroupName) {
+ parent::validateName();
+ }
+ }
+
+ /**
+ * @see wcf\acp\form\TemplateGroupAddForm::validateFolderName()
+ */
+ protected function validateFolderName() {
+ if ($this->templateGroupFolderName != $this->templateGroup->templateGroupFolderName) {
+ parent::validateFolderName();
+ }
+ }
+
+ /**
+ * @see wcf\form\IForm::save()
+ */
+ public function save() {
+ AbstractForm::save();
+
+ $this->objectAction = new TemplateGroupAction(array($this->templateGroup), 'update', array('data' => array(
+ 'templateGroupName' => $this->templateGroupName,
+ 'templateGroupFolderName' => $this->templateGroupFolderName,
+ 'parentTemplateGroupID' => ($this->parentTemplateGroupID ?: null)
+ )));
+ $this->objectAction->executeAction();
+ $this->saved();
+
+ // show success
+ WCF::getTPL()->assign(array(
+ 'success' => true
+ ));
+ }
+
+ /**
+ * @see wcf\page\IPage::readData()
+ */
+ public function readData() {
+ AbstractForm::readData();
+
+ $templateGroupList = new TemplateGroupList();
+ $templateGroupList->getConditionBuilder()->add('templateGroupID <> ?', array($this->templateGroupID));
+ $templateGroupList->readObjects();
+ $this->availableTemplateGroups = $templateGroupList->getObjects();
+
+ // default values
+ if (!count($_POST)) {
+ $this->templateGroupName = $this->templateGroup->templateGroupName;
+ $this->templateGroupFolderName = $this->templateGroup->templateGroupFolderName;
+ $this->parentTemplateGroupID = $this->templateGroup->parentTemplateGroupID;
+ }
+ }
+
+ /**
+ * @see wcf\page\IPage::assignVariables()
+ */
+ public function assignVariables() {
+ parent::assignVariables();
+
+ WCF::getTPL()->assign(array(
+ 'action' => 'edit',
+ 'templateGroupID' => $this->templateGroupID,
+ 'templateGroup' => $this->templateGroup
+ ));
+ }
+}
--- /dev/null
+<?php
+namespace wcf\acp\page;
+use wcf\page\SortablePage;
+
+/**
+ * Shows a list of installed template groups.
+ *
+ * @author Marcel Werk
+ * @copyright 2001-2013 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage acp.page
+ * @category Community Framework
+ */
+class TemplateGroupListPage extends SortablePage {
+ /**
+ * @see wcf\page\AbstractPage::$activeMenuItem
+ */
+ public $activeMenuItem = 'wcf.acp.menu.link.template.group.list';
+
+ /**
+ * @see wcf\page\AbstractPage::$neededPermissions
+ */
+ public $neededPermissions = array('admin.template.canManageTemplate');
+
+ /**
+ * @see wcf\page\SortablePage::$defaultSortField
+ */
+ public $defaultSortField = 'templateGroupName';
+
+ /**
+ * @see wcf\page\MultipleLinkPage::$objectListClassName
+ */
+ public $objectListClassName = 'wcf\data\template\group\TemplateGroupList';
+
+ /**
+ * @see wcf\page\SortablePage::$defaultSortField
+ */
+ public $validSortFields = array('templateGroupID', 'templateGroupName', 'templateGroupFolderName', 'templates');
+
+ /**
+ * @see wcf\page\MultipleLinkPage::initObjectList
+ */
+ protected function initObjectList() {
+ parent::initObjectList();
+
+ $this->objectList->sqlSelects = "(SELECT COUNT(*) FROM wcf".WCF_N."_template WHERE templateGroupID = template_group.templateGroupID) AS templates";
+ }
+}
--- /dev/null
+<?php
+namespace wcf\acp\page;
+use wcf\data\template\group\TemplateGroupList;
+use wcf\page\SortablePage;
+use wcf\system\WCF;
+use wcf\util\StringUtil;
+
+/**
+ * Shows a list of templates.
+ *
+ * @author Marcel Werk
+ * @copyright 2001-2013 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage acp.page
+ * @category Community Framework
+ */
+class TemplateListPage extends SortablePage {
+ /**
+ * @see wcf\page\AbstractPage::$activeMenuItem
+ */
+ public $activeMenuItem = 'wcf.acp.menu.link.template.list';
+
+ /**
+ * @see wcf\page\AbstractPage::$neededPermissions
+ */
+ public $neededPermissions = array('admin.template.canManageTemplate');
+
+ /**
+ * @see wcf\page\MultipleLinkPage::$objectListClassName
+ */
+ public $objectListClassName = 'wcf\data\template\TemplateList';
+
+ /**
+ * @see wcf\page\MultipleLinkPage::$itemsPerPage
+ */
+ public $itemsPerPage = 100;
+
+ /**
+ * @see wcf\page\SortablePage::$itemsPerPage
+ */
+ public $defaultSortField = 'templateName';
+
+ /**
+ * @see wcf\page\SortablePage::$validSortFields
+ */
+ public $validSortFields = array('templateID', 'templateName', 'lastModificationTime');
+
+ /**
+ * template group id
+ * @var integer
+ */
+ public $templateGroupID = 0;
+
+ /**
+ * template name
+ * @var string
+ */
+ public $searchTemplateName = '';
+
+ /**
+ * available template groups
+ * @var array
+ */
+ public $availableTemplateGroups = array();
+
+ /**
+ * @see wcf\page\IPage::readParameters()
+ */
+ public function readParameters() {
+ parent::readParameters();
+
+ if (isset($_REQUEST['templateGroupID'])) $this->templateGroupID = intval($_REQUEST['templateGroupID']);
+ if (isset($_REQUEST['searchTemplateName'])) $this->searchTemplateName = StringUtil::trim($_REQUEST['searchTemplateName']);
+ }
+
+ /**
+ * @see wcf\page\MultipleLinkPage::initObjectList()
+ */
+ protected function initObjectList() {
+ parent::initObjectList();
+
+ if ($this->templateGroupID) $this->objectList->getConditionBuilder()->add('template.templateGroupID = ?', array($this->templateGroupID));
+ else $this->objectList->getConditionBuilder()->add('template.templateGroupID IS NULL');
+
+ if ($this->searchTemplateName) $this->objectList->getConditionBuilder()->add('templateName LIKE ?', array($this->searchTemplateName.'%'));
+ }
+
+ /**
+ * @see wcf\page\IPage::readData()
+ */
+ public function readData() {
+ parent::readData();
+
+ // get template groups
+ $templateGroupList = new TemplateGroupList();
+ $templateGroupList->readObjects();
+ $this->availableTemplateGroups = $templateGroupList->getObjects();
+ }
+
+ /**
+ * @see wcf\page\IPage::assignVariables()
+ */
+ public function assignVariables() {
+ parent::assignVariables();
+
+ WCF::getTPL()->assign(array(
+ 'templateGroupID' => $this->templateGroupID,
+ 'searchTemplateName' => $this->searchTemplateName,
+ 'availableTemplateGroups' => $this->availableTemplateGroups
+ ));
+ }
+}
*/
public function __construct($id, $row = null, DatabaseObject $object = null) {
if ($id !== null) {
- $sql = "SELECT template.*, group.templateGroupFolderName, package.packageDir
+ $sql = "SELECT template.*, template_group.templateGroupFolderName, package.packageDir
FROM wcf".WCF_N."_template template
- LEFT JOIN wcf".WCF_N."_template_group group
- ON (group.templateGroupID = template.templateGroupID)
+ LEFT JOIN wcf".WCF_N."_template_group template_group
+ ON (template_group.templateGroupID = template.templateGroupID)
LEFT JOIN wcf".WCF_N."_package package
ON (package.packageID = template.packageID)
- WHERE template.templateID = ?".$id;
+ WHERE template.templateID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array($id));
$row = $statement->fetchArray();
/**
* @see wcf\data\AbstractDatabaseObjectAction::$permissionsCreate
*/
- protected $permissionsCreate = array('admin.template.canAddTemplate');
+ protected $permissionsCreate = array('admin.template.canManageTemplate');
/**
* @see wcf\data\AbstractDatabaseObjectAction::$permissionsDelete
*/
- protected $permissionsDelete = array('admin.template.canDeleteTemplate');
+ protected $permissionsDelete = array('admin.template.canManageTemplate');
/**
* @see wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate
*/
- protected $permissionsUpdate = array('admin.template.canEditTemplate');
+ protected $permissionsUpdate = array('admin.template.canManageTemplate');
}
/**
* @see wcf\data\AbstractDatabaseObjectAction::$permissionsCreate
*/
- protected $permissionsCreate = array('admin.template.canAddTemplateGroup');
+ protected $permissionsCreate = array('admin.template.canManageTemplate');
/**
* @see wcf\data\AbstractDatabaseObjectAction::$permissionsDelete
*/
- protected $permissionsDelete = array('admin.template.canDeleteTemplateGroup');
+ protected $permissionsDelete = array('admin.template.canManageTemplate');
/**
* @see wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate
*/
- protected $permissionsUpdate = array('admin.template.canEditTemplateGroup');
+ protected $permissionsUpdate = array('admin.template.canManageTemplate');
}
<?php
namespace wcf\data\template\group;
use wcf\data\DatabaseObjectEditor;
-use wcf\system\WCF;
+use wcf\data\IEditableCachedObject;
+use wcf\system\cache\builder\TemplateGroupCacheBuilder;
use wcf\util\DirectoryUtil;
-use wcf\util\FileUtil;
/**
* Provides functions to edit template groups.
*
* @author Marcel Werk
- * @copyright 2001-2012 WoltLab GmbH
+ * @copyright 2001-2013 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage data.template.group
* @category Community Framework
*/
-class TemplateGroupEditor extends DatabaseObjectEditor {
+class TemplateGroupEditor extends DatabaseObjectEditor implements IEditableCachedObject {
/**
* @see wcf\data\DatabaseObjectDecorator::$baseClass
*/
parent::update($parameters);
if (isset($parameters['templateGroupFolderName']) && ($parameters['templateGroupFolderName'] != $this->templateGroupFolderName)) {
- $this->renameFolders($parameters['templateGroupFolderName']);
+ @rename(WCF_DIR . 'templates/' . $this->templateGroupFolderName, WCF_DIR . 'templates/' . $parameters['templateGroupFolderName']);
}
}
/**
- * Renames the folders of this template group.
- *
- * @param string $newFolderName
+ * @see wcf\data\IEditableObject::deleteAll()
*/
- public function renameFolders($newFolderName) {
- // default template dir
- $folders = array(WCF_DIR . 'templates/' . $this->templateGroupFolderName => WCF_DIR . 'templates/' . $newFolderName);
-
- // get package dirs
- $sql = "SELECT packageDir
- FROM wcf".WCF_N."_package
- WHERE packageDir <> ''";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute();
- while ($row = $statement->fetchArray()) {
- $packageDir = FileUtil::getRealPath(WCF_DIR . $row['packageDir']);
- $folders[$packageDir . 'templates/' . $this->templateGroupFolderName] = $packageDir . 'templates/' . $newFolderName;
+ public static function deleteAll(array $objectIDs = array()) {
+ $list = new TemplateGroupList();
+ $list->setObjectIDs($objectIDs);
+ $list->readObjects();
+ foreach ($list as $object) {
+ $editor = new TemplateGroupEditor($object);
+ $editor->deleteFolder();
}
- // rename folders
- foreach ($folders as $oldName => $newName) {
- if (file_exists($oldName)) {
- @rename($oldName, $newName);
- }
- }
+ return parent::deleteAll($objectIDs);
}
/**
- * @see wcf\data\IEditableObject::delete()
+ * Deletes the folder of this template group.
*/
- public function delete() {
- // update children
- $sql = "UPDATE wcf".WCF_N."_template_group
- SET parentTemplateGroupID = ?
- WHERE parentTemplateGroupID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($this->parentTemplateGroupID, $this->templateGroupID));
-
- parent::delete();
-
- $this->deleteFolders();
+ public function deleteFolder() {
+ DirectoryUtil::getInstance(WCF_DIR . 'templates/' . $this->templateGroupFolderName)->removeAll();
}
/**
- * Deletes the folders of this template group.
+ * @see wcf\data\IEditableCachedObject::resetCache()
*/
- public function deleteFolders() {
- // get package dirs
- $sql = "SELECT packageDir
- FROM wcf".WCF_N."_package
- WHERE packageDir <> ''";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute();
- while ($row = $statement->fetchArray()) {
- $packageDir = FileUtil::getRealPath(WCF_DIR . $row['packageDir']);
- DirectoryUtil::getInstance($packageDir . 'templates/' . $this->templateGroupFolderName)->deleteAll();
- }
+ public static function resetCache() {
+ TemplateGroupCacheBuilder::getInstance()->reset();
}
}
<item name="wcf.acp.menu.link.user.option.category.list"><![CDATA[Benutzerprofilfeld-Kategorien auflisten]]></item>
<item name="wcf.acp.menu.link.user.option.category.add"><![CDATA[Benutzerprofilfeld-Kategorie hinzufügen]]></item>
<item name="wcf.acp.menu.link.user.option.setDefaults"><![CDATA[Benutzerprofil-Einstellungen verwalten]]></item>
+ <item name="wcf.acp.menu.link.template"><![CDATA[Templates]]></item>
+ <item name="wcf.acp.menu.link.template.list"><![CDATA[Templates auflisten]]></item>
+ <item name="wcf.acp.menu.link.template.add"><![CDATA[Template hinzufügen]]></item>
+ <item name="wcf.acp.menu.link.template.group.list"><![CDATA[Templategruppen auflisten]]></item>
+ <item name="wcf.acp.menu.link.template.group.add"><![CDATA[Templategruppe hinzufügen]]></item>
</category>
<category name="wcf.acp.option">
<item name="wcf.acp.menu.link.user.option.category.list"><![CDATA[List Field Categories]]></item>
<item name="wcf.acp.menu.link.user.option.category.add"><![CDATA[Add Field Category]]></item>
<item name="wcf.acp.menu.link.user.option.setDefaults"><![CDATA[Manage User Field Settings]]></item>
+ <item name="wcf.acp.menu.link.template"><![CDATA[Templates]]></item>
+ <item name="wcf.acp.menu.link.template.list"><![CDATA[List Templates]]></item>
+ <item name="wcf.acp.menu.link.template.add"><![CDATA[Add Template]]></item>
+ <item name="wcf.acp.menu.link.template.group.list"><![CDATA[List Template Groups]]></item>
+ <item name="wcf.acp.menu.link.template.group.add"><![CDATA[Add Template Group]]></item>
</category>
<category name="wcf.acp.option">
packageID INT(10) NOT NULL,
templateName VARCHAR(255) NOT NULL DEFAULT '',
templateGroupID INT(10),
- obsolete TINYINT(1) NOT NULL DEFAULT 0,
+ lastModificationTime INT(10) NOT NULL DEFAULT 0,
KEY packageID (packageID, templateName),
KEY templateGroupID (packageID, templateGroupID, templateName)
);
DROP TABLE IF EXISTS wcf1_template_group;
CREATE TABLE wcf1_template_group (
templateGroupID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
- parentTemplateGroupID INT(10) NOT NULL DEFAULT 0,
+ parentTemplateGroupID INT(10),
templateGroupName VARCHAR(255) NOT NULL DEFAULT '',
templateGroupFolderName VARCHAR(255) NOT NULL DEFAULT ''
);
ALTER TABLE wcf1_template ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
ALTER TABLE wcf1_template ADD FOREIGN KEY (templateGroupID) REFERENCES wcf1_template_group (templateGroupID) ON DELETE CASCADE;
+ALTER TABLE wcf1_template_group ADD FOREIGN KEY (parentTemplateGroupID) REFERENCES wcf1_template_group (templateGroupID) ON DELETE SET NULL;
+
ALTER TABLE wcf1_template_listener ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
ALTER TABLE wcf1_user_collapsible_content ADD FOREIGN KEY (objectTypeID) REFERENCES wcf1_object_type (objectTypeID) ON DELETE CASCADE;