<?php
namespace wcf\acp\form;
+use wcf\data\package\Package;
+use wcf\data\package\PackageCache;
use wcf\data\template\group\TemplateGroup;
use wcf\data\template\group\TemplateGroupAction;
use wcf\data\template\group\TemplateGroupList;
*/
public $copiedTemplate = null;
+ /**
+ * application the template belongs to
+ * @var string
+ */
+ public $application = '';
+
/**
* @see wcf\page\IPage::readParameters()
*/
throw new IllegalLinkException();
}
+ $this->application = $this->copiedTemplate->application;
$this->packageID = $this->copiedTemplate->packageID;
}
}
public function save() {
parent::save();
+ if (empty($this->application)) {
+ $this->application = Package::getAbbreviation(PackageCache::getInstance()->getPackage($this->package));
+ }
+
$this->objectAction = new TemplateAction(array(), 'create', array('data' => array(
+ 'application' => $this->application,
'templateName' => $this->tplName,
'packageID' => $this->packageID,
'templateGroupID' => $this->templateGroupID
application VARCHAR(255) NOT NULL,
templateGroupID INT(10),
lastModificationTime INT(10) NOT NULL DEFAULT 0,
- UNIQUE KEY applicationTemplate (application, templateName),
- UNIQUE KEY templateGroupID (application, templateGroupID, templateName)
+ UNIQUE KEY applicationTemplate (application, templateGroupID, templateName),
+ KEY templateGroupID (packageID, templateGroupID, templateName)
);
DROP TABLE IF EXISTS wcf1_template_group;