</dd>
</dl>
- <dl{if $errorField == 'packageID'} class="formError"{/if}>
- <dt><label for="packageID">{lang}wcf.acp.page.packageID{/lang}</label></dt>
+ <dl{if $errorField == 'applicationPackageID'} class="formError"{/if}>
+ <dt><label for="applicationPackageID">{lang}wcf.acp.page.applicationPackageID{/lang}</label></dt>
<dd>
- <select name="packageID" id="packageID"{if $action == 'edit' && $page->originIsSystem} disabled="disabled"{/if}>
+ <select name="applicationPackageID" id="applicationPackageID"{if $action == 'edit' && $page->originIsSystem} disabled="disabled"{/if}>
{foreach from=$availableApplications item=availableApplication}
- <option value="{@$availableApplication->packageID}"{if $availableApplication->packageID == $packageID} selected="selected"{/if}>{$availableApplication->getAbbreviation()}: {$availableApplication->domainName}{$availableApplication->domainPath}</option>
+ <option value="{@$availableApplication->packageID}"{if $availableApplication->packageID == $applicationPackageID} selected="selected"{/if}>{$availableApplication->getAbbreviation()}: {$availableApplication->domainName}{$availableApplication->domainPath}</option>
{/foreach}
</select>
- {if $errorField == 'parentPageID'}
+ {if $errorField == 'applicationPackageID'}
<small class="innerError">
{if $errorType == 'empty'}
{lang}wcf.global.form.error.empty{/lang}
{else}
- {lang}wcf.acp.page.packageID.error.{@$errorType}{/lang}
+ {lang}wcf.acp.page.applicationPackageID.error.{@$errorType}{/lang}
{/if}
</small>
{/if}
{if $name}{capture append=linkParameters}&name={@$name|rawurlencode}{/capture}{/if}
{if $title}{capture append=linkParameters}&title={@$title|rawurlencode}{/capture}{/if}
{if $content}{capture append=linkParameters}&content={@$content|rawurlencode}{/capture}{/if}
- {if $packageID}{capture append=linkParameters}&packageID={@$packageID}{/capture}{/if}
+ {if $applicationPackageID}{capture append=linkParameters}&applicationPackageID={@$applicationPackageID}{/capture}{/if}
{if $pageType}{capture append=linkParameters}&pageType={@$pageType|rawurlencode}{/capture}{/if}
{pages print=true assign=pagesLinks controller="PageList" link="pageNo=%d&sortField=$sortField&sortOrder=$sortOrder$linkParameters"}
<dt></dt>
<dd>
<label class="selectDropdown">
- <select name="packageID" id="packageID">
- <option value="0">{lang}wcf.acp.page.packageID{/lang}</option>
+ <select name="applicationPackageID" id="applicationPackageID">
+ <option value="0">{lang}wcf.acp.page.applicationPackageID{/lang}</option>
{foreach from=$availableApplications item=availableApplication}
- <option value="{@$availableApplication->packageID}"{if $availableApplication->packageID == $packageID} selected="selected"{/if}>{$availableApplication->getAbbreviation()}: {$availableApplication->domainName}{$availableApplication->domainPath}</option>
+ <option value="{@$availableApplication->packageID}"{if $availableApplication->packageID == $applicationPackageID} selected="selected"{/if}>{$availableApplication->getAbbreviation()}: {$availableApplication->domainName}{$availableApplication->domainPath}</option>
{/foreach}
</select>
</label>
public $isLandingPage = 0;
/**
- * package id of the page
+ * application id of the page
* @var integer
*/
- public $packageID = 1;
+ public $applicationPackageID = 1;
/**
* list of available applications
if (isset($_POST['name'])) $this->name = StringUtil::trim($_POST['name']);
if (isset($_POST['isDisabled'])) $this->isDisabled = 1;
if (isset($_POST['isLandingPage'])) $this->isLandingPage = 1;
- if (isset($_POST['packageID'])) $this->packageID = intval($_POST['packageID']);
+ if (isset($_POST['applicationPackageID'])) $this->applicationPackageID = intval($_POST['applicationPackageID']);
if (isset($_POST['controller'])) $this->controller = StringUtil::trim($_POST['controller']);
if (isset($_POST['customURL']) && is_array($_POST['customURL'])) $this->customURL = ArrayUtil::trim($_POST['customURL']);
$this->validateParentPageID();
- $this->validatePackageID();
+ $this->validateApplicationPackageID();
$this->validateController();
/**
* Validates package id.
*/
- protected function validatePackageID() {
- if (!isset($this->availableApplications[$this->packageID])) {
- throw new UserInputException('packageID', 'invalid');
+ protected function validateApplicationPackageID() {
+ if (!isset($this->availableApplications[$this->applicationPackageID])) {
+ throw new UserInputException('applicationPackageID', 'invalid');
}
}
'name' => $this->name,
'isDisabled' => ($this->isDisabled) ? 1 : 0,
'isLandingPage' => 0,
- 'packageID' => ($this->packageID ?: null),
+ 'applicationPackageID' => $this->applicationPackageID,
'lastUpdateTime' => TIME_NOW,
'isMultilingual' => $this->isMultilingual,
'identifier' => '',
- 'controller' => $this->controller
+ 'controller' => $this->controller,
+ 'packageID' => 1
]), 'content' => $content, 'boxToPage' => $this->getBoxToPage()]);
/** @var Page $page */
// reset variables
$this->parentPageID = $this->isDisabled = $this->isLandingPage = 0;
- $this->packageID = 1;
+ $this->applicationPackageID = 1;
$this->name = $this->controller = '';
$this->pageType = 'text';
$this->customURL = $this->title = $this->content = $this->metaDescription = $this->metaKeywords = [];
'isDisabled' => $this->isDisabled,
'isLandingPage' => $this->isLandingPage,
'isMultilingual' => $this->isMultilingual,
- 'packageID' => $this->packageID,
+ 'applicationPackageID' => $this->applicationPackageID,
'controller' => $this->controller,
'customURL' => $this->customURL,
'title' => $this->title,
$this->pageType = $this->page->pageType;
if ($this->page->originIsSystem) {
$this->parentPageID = $this->page->parentPageID;
- $this->packageID = $this->page->packageID;
+ $this->applicationPackageID = $this->page->applicationPackageID;
$this->controller = $this->page->controller;
}
'isDisabled' => ($this->isDisabled) ? 1 : 0,
'lastUpdateTime' => TIME_NOW,
'parentPageID' => ($this->parentPageID ?: null),
- 'packageID' => $this->packageID
+ 'applicationPackageID' => $this->applicationPackageID
);
if ($this->pageType == 'system') {
$this->name = $this->page->name;
$this->parentPageID = $this->page->parentPageID;
$this->pageType = $this->page->pageType;
- $this->packageID = $this->page->packageID;
+ $this->applicationPackageID = $this->page->applicationPackageID;
$this->controller = $this->page->controller;
if ($this->page->controllerCustomURL) $this->customURL[0] = $this->page->controllerCustomURL;
if ($this->page->isLandingPage) $this->isLandingPage = 1;
}
/**
- * @see \wcf\page\IPage::assignVariables()
+ * @inheritDoc
*/
public function assignVariables() {
parent::assignVariables();
public $content = '';
/**
- * package id of the page
+ * application id of the page
* @var integer
*/
- public $packageID = 0;
+ public $applicationPackageID = 0;
/**
* page type
if (!empty($_REQUEST['name'])) $this->name = StringUtil::trim($_REQUEST['name']);
if (!empty($_REQUEST['title'])) $this->title = StringUtil::trim($_REQUEST['title']);
if (!empty($_REQUEST['content'])) $this->content = StringUtil::trim($_REQUEST['content']);
- if (isset($_REQUEST['packageID'])) $this->packageID = intval($_REQUEST['packageID']);
+ if (isset($_REQUEST['applicationPackageID'])) $this->applicationPackageID = intval($_REQUEST['applicationPackageID']);
if (!empty($_REQUEST['pageType'])) $this->pageType = $_REQUEST['pageType'];
// get available applications
if (!empty($this->content)) {
$this->objectList->getConditionBuilder()->add('page.pageID IN (SELECT pageID FROM wcf'.WCF_N.'_page_content WHERE content LIKE ?)', array('%'.$this->content.'%'));
}
- if (!empty($this->packageID)) {
- $this->objectList->getConditionBuilder()->add('page.packageID = ?', array($this->packageID));
+ if (!empty($this->applicationPackageID)) {
+ $this->objectList->getConditionBuilder()->add('page.applicationPackageID = ?', array($this->applicationPackageID));
}
if ($this->pageType == 'static') {
$this->objectList->getConditionBuilder()->add('page.pageType IN (?, ?, ?)', array('text', 'html', 'tpl'));
'name' => $this->name,
'title' => $this->title,
'content' => $this->content,
- 'packageID' => $this->packageID,
+ 'applicationPackageID' => $this->applicationPackageID,
'pageType' => $this->pageType,
'availableApplications' => $this->availableApplications
));
* @property-read integer|null $parentPageID
* @property-read string $identifier
* @property-read string $name
+ * @property-read string $pageType
* @property-read integer $isDisabled
* @property-read integer $isLandingPage
* @property-read integer $isMultilingual
* @property-read integer $originIsSystem
* @property-read integer $packageID
+ * @property-read integer $applicationPackageID
* @property-read string $controller
* @property-read string $handler
* @property-read string $controllerCustomURL
* @return \wcf\data\application\Application
*/
public function getApplication() {
- return ApplicationHandler::getInstance()->getApplicationByID($this->packageID);
+ return ApplicationHandler::getInstance()->getApplicationByID($this->applicationPackageID);
}
/**
}
// fetch pages with a controller and a custom url
- $sql = "SELECT controller, controllerCustomURL, packageID
+ $sql = "SELECT controller, controllerCustomURL, applicationPackageID
FROM wcf".WCF_N."_page
WHERE controller <> ''
AND controllerCustomURL <> ''";
}
// fetch content pages using the common page controller
- $sql = "SELECT page_content.customURL AS controllerCustomURL, page_content.pageID, page_content.languageID, page.packageID
+ $sql = "SELECT page_content.customURL AS controllerCustomURL, page_content.pageID, page_content.languageID, page.applicationPackageID
FROM wcf".WCF_N."_page_content page_content
LEFT JOIN wcf".WCF_N."_page page
ON (page.pageID = page_content.pageID)";
$abbreviations = [];
foreach ($rows as $row) {
$customUrl = FileUtil::removeLeadingSlash(FileUtil::removeTrailingSlash($row['controllerCustomURL']));
- $packageID = $row['packageID'];
+ $packageID = $row['applicationPackageID'];
if (!isset($abbreviations[$packageID])) {
$abbreviations[$packageID] = ApplicationHandler::getInstance()->getAbbreviation($packageID);
}
<?php
namespace wcf\system\package\plugin;
+use wcf\data\package\Package;
+use wcf\data\package\PackageCache;
use wcf\data\page\PageEditor;
use wcf\system\exception\SystemException;
use wcf\system\language\LanguageFactory;
break;
}
+ // get application package id
+ $applicationPackageID = 1;
+ if ($this->installation->getPackage()->isApplication) {
+ $applicationPackageID = $this->installation->getPackageID();
+ }
+ if (!empty($data['elements']['application'])) {
+ $application = PackageCache::getInstance()->getPackageByIdentifier($data['elements']['application']);
+ if ($application === null || !$application->isApplication) {
+ throw new SystemException("Unknown application '".$data['elements']['application']."' for page '{$identifier}");
+ }
+ $applicationPackageID = $application->packageID;
+ }
+
return [
'pageType' => $pageType,
'content' => ($isStatic) ? $data['elements']['content'] : [],
'name' => $name,
'originIsSystem' => 1,
'parentPageID' => $parentPageID,
+ 'applicationPackageID' => $applicationPackageID,
'requireObjectID' => (!empty($data['elements']['requireObjectID'])) ? 1 : 0,
'options' => (isset($data['elements']['options'])) ? $data['elements']['options'] : '',
'permissions' => (isset($data['elements']['permissions'])) ? $data['elements']['permissions'] : ''
isMultilingual TINYINT(1) NOT NULL DEFAULT 0,
originIsSystem TINYINT(1) NOT NULL DEFAULT 0,
packageID INT(10) NOT NULL,
+ applicationPackageID INT(10),
controller VARCHAR(255) NOT NULL DEFAULT '',
handler VARCHAR(255) NOT NULL DEFAULT '',
controllerCustomURL VARCHAR(255) NOT NULL DEFAULT '',
ALTER TABLE wcf1_page ADD FOREIGN KEY (parentPageID) REFERENCES wcf1_page (pageID) ON DELETE SET NULL;
ALTER TABLE wcf1_page ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
+ALTER TABLE wcf1_page ADD FOREIGN KEY (applicationPackageID) REFERENCES wcf1_package (packageID) ON DELETE SET NULL;
ALTER TABLE wcf1_page_content ADD FOREIGN KEY (pageID) REFERENCES wcf1_page (pageID) ON DELETE CASCADE;
ALTER TABLE wcf1_page_content ADD FOREIGN KEY (languageID) REFERENCES wcf1_language (languageID) ON DELETE CASCADE;