use wcf\system\WCF;
// set default landing page
-$sql = "UPDATE wcf" . WCF_N . "_page
- SET isLandingPage = ?
- WHERE identifier = ?";
-$statement = WCF::getDB()->prepareStatement($sql);
+$sql = "UPDATE wcf1_application
+ SET landingPageID = (
+ SELECT pageID
+ FROM wcf1_page
+ WHERE identifier = ?
+ )
+ WHERE packageID = ?";
+$statement = WCF::getDB()->prepare($sql);
$statement->execute([
- 1,
'com.woltlab.wcf.Dashboard',
+ 1,
]);
// update administrator user rank and user online marking
{include file='header' pageTitle='wcf.acp.page.'|concat:$action}
-<script data-relocate="true">
- $(function() {
- var isDisabled = elById('isDisabled');
- if (isDisabled !== null) {
- $('#isLandingPage').change(function() {
- if ($('#isLandingPage')[0].checked) {
- isDisabled.checked = false;
- isDisabled.disabled = true;
- }
- else {
- isDisabled.disabled = false;
- }
- }).trigger('change');
- }
-
- {if $action != 'edit' || !$page->isLandingPage}
- $('#isDisabled').change(function(event) {
- if ($('#isDisabled')[0].checked) {
- $('#isLandingPage')[0].checked = false;
- $('#isLandingPage')[0].disabled = true;
- }
- else {
- $('#isLandingPage')[0].disabled = false;
- }
- }).trigger('change');
- {/if}
- });
-</script>
-
{if $action == 'add'}
<script data-relocate="true">
elById('name').addEventListener('blur', function() {
</dd>
</dl>
- {if $action != 'edit' || (!$page->requireObjectID && !$page->excludeFromLandingPage)}
- <dl>
- <dt></dt>
- <dd>
- <label><input type="checkbox" id="isLandingPage" name="isLandingPage" value="1"{if $isLandingPage} checked{/if}{if $action == 'edit' && $page->isLandingPage} disabled{/if}> {lang}wcf.acp.page.isLandingPage{/lang}</label>
- </dd>
- </dl>
- {/if}
-
{if $action != 'edit' || $page->pageType != 'system'}
<dl>
<dt></dt>
{event name='rowButtons'}
</td>
<td class="columnID columnPageID">{@$page->pageID}</td>
- <td class="columnTitle columnName">{if $page->isLandingPage}<span class="icon icon16 fa-home jsTooltip" title="{lang}wcf.acp.page.isLandingPage{/lang}"></span> {/if}<a href="{link controller='PageEdit' id=$page->pageID}{/link}">{$page->name}</a></td>
+ <td class="columnTitle columnName"><a href="{link controller='PageEdit' id=$page->pageID}{/link}">{$page->name}</a></td>
<td class="columnText columnURL">
{if $page->applicationPackageID === null}
<span class="icon icon16 fa-exclamation-triangle red"></span> <span>{lang}wcf.acp.page.application.error.missing{/lang}</span>
$this->saved();
- if (!empty($this->landingPageID[1])) {
- (new Page($this->landingPageID[1]))->setAsLandingPage();
- } else {
- $sql = "UPDATE wcf" . WCF_N . "_page
- SET isLandingPage = ?
- WHERE isLandingPage = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute([
- 0,
- 1,
- ]);
- }
-
ApplicationHandler::rebuild();
// Reset caches to reflect the new landing pages.
*/
public $isDisabled = 0;
- /**
- * true if page is landing page
- * @var bool
- */
- public $isLandingPage = 0;
-
/**
* application id of the page
* @var int
if (isset($_POST['isDisabled'])) {
$this->isDisabled = 1;
}
- if (isset($_POST['isLandingPage'])) {
- $this->isLandingPage = 1;
- }
if (isset($_POST['availableDuringOfflineMode'])) {
$this->availableDuringOfflineMode = 1;
}
'name' => $this->name,
'cssClassName' => $this->cssClassName,
'isDisabled' => $this->isDisabled ? 1 : 0,
- 'isLandingPage' => 0,
'availableDuringOfflineMode' => $this->availableDuringOfflineMode,
'allowSpidersToIndex' => $this->allowSpidersToIndex,
'enableShareButtons' => $this->enableShareButtons,
'identifier' => 'com.woltlab.wcf.generic' . $page->pageID,
]);
- if ($this->isLandingPage) {
- $page->setAsLandingPage();
- }
-
// save acl
SimpleAclHandler::getInstance()->setValues('com.woltlab.wcf.page', $page->pageID, $this->aclValues);
]);
// reset variables
- $this->parentPageID = $this->isDisabled = $this->isLandingPage = $this->availableDuringOfflineMode = $this->enableShareButtons = $this->addPageToMainMenu = 0;
+ $this->parentPageID = $this->isDisabled = $this->availableDuringOfflineMode = $this->enableShareButtons = $this->addPageToMainMenu = 0;
$this->parentMenuItemID = null;
$this->applicationPackageID = 1;
$this->cssClassName = $this->name = '';
if ($this->presetPage->controllerCustomURL) {
$this->customURL[0] = $this->presetPage->controllerCustomURL;
}
- $this->isLandingPage = 0;
$this->isDisabled = 1;
if ($this->presetPage->availableDuringOfflineMode) {
$this->availableDuringOfflineMode = 1;
'name' => $this->name,
'cssClassName' => $this->cssClassName,
'isDisabled' => $this->isDisabled,
- 'isLandingPage' => $this->isLandingPage,
'availableDuringOfflineMode' => $this->availableDuringOfflineMode,
'allowSpidersToIndex' => $this->allowSpidersToIndex,
'isMultilingual' => $this->isMultilingual,
} else {
$this->overrideApplicationPackageID = null;
}
-
- if ($this->page->requireObjectID || $this->page->excludeFromLandingPage) {
- // pages that require an object id can never be set as landing page
- $this->isLandingPage = 0;
- }
}
/**
$this->objectAction->executeAction();
}
- if ($this->isLandingPage != $this->page->isLandingPage) {
- $this->page->setAsLandingPage();
- }
-
// save acl
if ($this->page->pageType != 'system') {
SimpleAclHandler::getInstance()->setValues('com.woltlab.wcf.page', $this->page->pageID, $this->aclValues);
if ($this->page->controllerCustomURL) {
$this->customURL[0] = $this->page->controllerCustomURL;
}
- if ($this->page->isLandingPage) {
- $this->isLandingPage = 1;
- }
if ($this->page->isDisabled) {
$this->isDisabled = 1;
}
* @property-read string $name monolingual name of the page shown in the ACP
* @property-read string $pageType type of the page, default types: `text`, `html`, `tpl` `system`
* @property-read int $isDisabled is `1` if the page is disabled and thus cannot be accessed, otherwise `0`
- * @property-read int $isLandingPage is `1` if the page is the landing page, otherwise `0`
* @property-read int $isMultilingual is `1` if the page is available in different languages, otherwise `0`
* @property-read int $originIsSystem is `1` if the page has been delivered by a package, otherwise `0` (i.e. the page has been created in the ACP)
* @property-read int $packageID id of the package the which delivers the page or `1` if it has been created in the ACP
*/
public function canDelete()
{
- if (WCF::getSession()->getPermission('admin.content.cms.canManagePage') && !$this->originIsSystem && !$this->isLandingPage) {
+ if (WCF::getSession()->getPermission('admin.content.cms.canManagePage') && !$this->originIsSystem) {
return true;
}
*/
public function canDisable()
{
- if (WCF::getSession()->getPermission('admin.content.cms.canManagePage') && (!$this->originIsSystem || $this->pageType != 'system') && !$this->isLandingPage) {
+ if (WCF::getSession()->getPermission('admin.content.cms.canManagePage') && (!$this->originIsSystem || $this->pageType != 'system')) {
return true;
}
}
/**
- * Sets the current page as landing page.
- *
- * @throws SystemException
+ * @deprecated 5.6 The landing page is a property of the 'wcf' app.
*/
public function setAsLandingPage()
{
}
WCF::getDB()->beginTransaction();
- // unmark existing landing page
- $sql = "UPDATE wcf" . WCF_N . "_page
- SET isLandingPage = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute([
- 0,
- ]);
-
- // set current page as landing page
- $sql = "UPDATE wcf" . WCF_N . "_page
- SET isLandingPage = ?
- WHERE pageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute([
- 1,
- $this->pageID,
- ]);
-
$sql = "UPDATE wcf" . WCF_N . "_application
SET landingPageID = ?
WHERE packageID = ?";
$data['pageMetaDescriptions'][$pageID][$row['languageID'] ?: 0] = $row['metaDescription'];
}
+ $sql = "SELECT landingPageID
+ FROM wcf1_application
+ WHERE packageID = ?";
+ $statement = WCF::getDB()->prepare($sql);
+ $statement->execute([1]);
+ $landingPageID = $statement->fetchSingleColumn();
+
// build lookup table
/** @var Page $page */
foreach ($pageList as $page) {
$data['identifier'][$page->identifier] = $page->pageID;
$data['controller'][$page->controller] = $page->pageID;
- if ($page->isLandingPage || ($data['landingPage'] === null && $page->identifier === 'com.woltlab.wcf.ArticleList')) {
+ if ($page->pageID == $landingPageID || ($data['landingPage'] === null && $page->identifier === 'com.woltlab.wcf.ArticleList')) {
$data['landingPage'] = $page;
}
}
<item name="wcf.acp.page.i18n.i18n.description"><![CDATA[Inhalt, URL und Meta-Daten werden individuell pro Sprache festgelegt.]]></item>
<item name="wcf.acp.page.i18n.none"><![CDATA[Einsprachige Seite]]></item>
<item name="wcf.acp.page.i18n.none.description"><![CDATA[Der Inhalt der Seite ist sprachneutral oder soll nur in einer Sprache verfasst werden.]]></item>
- <item name="wcf.acp.page.isLandingPage"><![CDATA[Seite ist Startseite]]></item>
<item name="wcf.acp.page.isDisabled"><![CDATA[Seite deaktivieren]]></item>
<item name="wcf.acp.page.lastUpdateTime"><![CDATA[Letzte Aktualisierung]]></item>
<item name="wcf.acp.page.list"><![CDATA[Seiten]]></item>
<item name="wcf.acp.page.i18n.i18n.description"><![CDATA[The content, URL and meta data will be provided for each language separately.]]></item>
<item name="wcf.acp.page.i18n.none"><![CDATA[Monolingual page]]></item>
<item name="wcf.acp.page.i18n.none.description"><![CDATA[The content is not tied to a specific language or there should be no translation.]]></item>
- <item name="wcf.acp.page.isLandingPage"><![CDATA[Landing page]]></item>
<item name="wcf.acp.page.isDisabled"><![CDATA[Disable page]]></item>
<item name="wcf.acp.page.lastUpdateTime"><![CDATA[Last Change]]></item>
<item name="wcf.acp.page.list"><![CDATA[Pages]]></item>
name VARCHAR(255) NOT NULL,
pageType VARCHAR(255) NOT NULL,
isDisabled TINYINT(1) NOT NULL DEFAULT 0,
- isLandingPage TINYINT(1) NOT NULL DEFAULT 0,
isMultilingual TINYINT(1) NOT NULL DEFAULT 0,
originIsSystem TINYINT(1) NOT NULL DEFAULT 0,
packageID INT(10) NOT NULL,