Hide link input for system-type boxes
authorAlexander Ebert <ebert@woltlab.com>
Tue, 7 Nov 2017 14:02:32 +0000 (15:02 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 7 Nov 2017 14:02:32 +0000 (15:02 +0100)
wcfsetup/install/files/acp/templates/boxAdd.tpl
wcfsetup/install/files/lib/acp/form/BoxAddForm.class.php

index 7d3e8b7ce16396601c3cea38ed6da2288175637b..3b08d8e97cdb43c1403f80b2e3ac122dc3a70f84 100644 (file)
                                </dl>
                        </div>
                        
-                       <section class="section">
-                               <h2 class="sectionTitle">{lang}wcf.acp.box.link{/lang}</h2>
-                               
-                               <dl>
-                                       <dt></dt>
-                                       <dd class="floated">
-                                               <label><input type="radio" name="linkType" value="none"{if $linkType == 'none'} checked{/if}> {lang}wcf.acp.box.linkType.none{/lang}</label>
-                                               <label><input type="radio" name="linkType" value="internal"{if $linkType == 'internal'} checked{/if}> {lang}wcf.acp.box.linkType.internal{/lang}</label>
-                                               <label><input type="radio" name="linkType" value="external"{if $linkType == 'external'} checked{/if}> {lang}wcf.acp.box.linkType.external{/lang}</label>
-                                       </dd>
-                               </dl>
-                               
-                               <dl id="linkPageIDContainer"{if $errorField == 'linkPageID'} class="formError"{/if}{if $linkType != 'internal'} style="display: none;"{/if}>
-                                       <dt><label for="linkPageID">{lang}wcf.acp.page.page{/lang}</label></dt>
-                                       <dd>
-                                               <select name="linkPageID" id="linkPageID">
-                                                       <option value="0">{lang}wcf.global.noSelection{/lang}</option>
-                                                       
-                                                       {foreach from=$pageNodeList item=pageNode}
-                                                               <option value="{@$pageNode->pageID}"{if $pageNode->pageID == $linkPageID} selected{/if} data-identifier="{@$pageNode->identifier}">{if $pageNode->getDepth() > 1}{@"&nbsp;&nbsp;&nbsp;&nbsp;"|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->name}</option>
-                                                       {/foreach}
-                                               </select>
-                                               {if $errorField == 'linkPageID'}
-                                                       <small class="innerError">
-                                                               {if $errorType == 'empty'}
-                                                                       {lang}wcf.global.form.error.empty{/lang}
-                                                               {else}
-                                                                       {lang}wcf.acp.box.linkPageID.error.{@$errorType}{/lang}
-                                                               {/if}
-                                                       </small>
-                                               {/if}
-                                       </dd>
-                               </dl>
-                               
-                               <dl id="linkPageObjectIDContainer"{if $errorField == 'linkPageObjectID'} class="formError"{/if}{if !$linkPageID || !$pageHandler[$linkPageID]|isset} style="display: none;"{/if}>
-                                       <dt><label for="linkPageObjectID">{lang}wcf.page.pageObjectID{/lang}</label></dt>
-                                       <dd>
-                                               <div class="inputAddon">
-                                                       <input type="text" id="linkPageObjectID" name="linkPageObjectID" value="{$linkPageObjectID}" class="short">
-                                                       <a href="#" id="searchLinkPageObjectID" class="inputSuffix button jsTooltip" title="{lang}wcf.page.pageObjectID.search{/lang}"><span class="icon icon16 fa-search"></span></a>
-                                               </div>
-                                               {if $errorField == 'linkPageObjectID'}
-                                                       <small class="innerError">
-                                                               {if $errorType == 'empty'}
-                                                                       {lang}wcf.global.form.error.empty{/lang}
-                                                               {else}
-                                                                       {lang}wcf.acp.box.linkPageObjectID.error.{@$errorType}{/lang}
-                                                               {/if}
-                                                       </small>
-                                               {/if}
-                                       </dd>
-                               </dl>
-                               
-                               <dl id="externalURLContainer"{if $errorField == 'externalURL'} class="formError"{/if}{if $linkType != 'external'} style="display: none;"{/if}>
-                                       <dt><label for="externalURL">{lang}wcf.acp.box.link.externalURL{/lang}</label></dt>
-                                       <dd>
-                                               <input type="text" name="externalURL" id="externalURL" value="{$externalURL}" class="long" maxlength="255" placeholder="http://">
-                                               {if $errorField == 'externalURL'}
-                                                       <small class="innerError">
-                                                               {if $errorType == 'empty'}
-                                                                       {lang}wcf.global.form.error.empty{/lang}
-                                                               {else}
-                                                                       {lang}wcf.acp.box.link.externalURL.error.{$errorType}{/lang}
-                                                               {/if}
-                                                       </small>
-                                               {/if}
-                                       </dd>
-                               </dl>
+                       {if $boxType === 'system'}
+                               <input type="hidden" name="linkType" value="none">
+                       {else}
+                               <section class="section">
+                                       <h2 class="sectionTitle">{lang}wcf.acp.box.link{/lang}</h2>
+                                       
+                                       <dl>
+                                               <dt></dt>
+                                               <dd class="floated">
+                                                       <label><input type="radio" name="linkType" value="none"{if $linkType == 'none'} checked{/if}> {lang}wcf.acp.box.linkType.none{/lang}</label>
+                                                       <label><input type="radio" name="linkType" value="internal"{if $linkType == 'internal'} checked{/if}> {lang}wcf.acp.box.linkType.internal{/lang}</label>
+                                                       <label><input type="radio" name="linkType" value="external"{if $linkType == 'external'} checked{/if}> {lang}wcf.acp.box.linkType.external{/lang}</label>
+                                               </dd>
+                                       </dl>
+                                       
+                                       <dl id="linkPageIDContainer"{if $errorField == 'linkPageID'} class="formError"{/if}{if $linkType != 'internal'} style="display: none;"{/if}>
+                                               <dt><label for="linkPageID">{lang}wcf.acp.page.page{/lang}</label></dt>
+                                               <dd>
+                                                       <select name="linkPageID" id="linkPageID">
+                                                               <option value="0">{lang}wcf.global.noSelection{/lang}</option>
+                                                               
+                                                               {foreach from=$pageNodeList item=pageNode}
+                                                                       <option value="{@$pageNode->pageID}"{if $pageNode->pageID == $linkPageID} selected{/if} data-identifier="{@$pageNode->identifier}">{if $pageNode->getDepth() > 1}{@"&nbsp;&nbsp;&nbsp;&nbsp;"|str_repeat:($pageNode->getDepth() - 1)}{/if}{$pageNode->name}</option>
+                                                               {/foreach}
+                                                       </select>
+                                                       {if $errorField == 'linkPageID'}
+                                                               <small class="innerError">
+                                                                       {if $errorType == 'empty'}
+                                                                               {lang}wcf.global.form.error.empty{/lang}
+                                                                       {else}
+                                                                               {lang}wcf.acp.box.linkPageID.error.{@$errorType}{/lang}
+                                                                       {/if}
+                                                               </small>
+                                                       {/if}
+                                               </dd>
+                                       </dl>
+                                       
+                                       <dl id="linkPageObjectIDContainer"{if $errorField == 'linkPageObjectID'} class="formError"{/if}{if !$linkPageID || !$pageHandler[$linkPageID]|isset} style="display: none;"{/if}>
+                                               <dt><label for="linkPageObjectID">{lang}wcf.page.pageObjectID{/lang}</label></dt>
+                                               <dd>
+                                                       <div class="inputAddon">
+                                                               <input type="text" id="linkPageObjectID" name="linkPageObjectID" value="{$linkPageObjectID}" class="short">
+                                                               <a href="#" id="searchLinkPageObjectID" class="inputSuffix button jsTooltip" title="{lang}wcf.page.pageObjectID.search{/lang}"><span class="icon icon16 fa-search"></span></a>
+                                                       </div>
+                                                       {if $errorField == 'linkPageObjectID'}
+                                                               <small class="innerError">
+                                                                       {if $errorType == 'empty'}
+                                                                               {lang}wcf.global.form.error.empty{/lang}
+                                                                       {else}
+                                                                               {lang}wcf.acp.box.linkPageObjectID.error.{@$errorType}{/lang}
+                                                                       {/if}
+                                                               </small>
+                                                       {/if}
+                                               </dd>
+                                       </dl>
+                                       
+                                       <dl id="externalURLContainer"{if $errorField == 'externalURL'} class="formError"{/if}{if $linkType != 'external'} style="display: none;"{/if}>
+                                               <dt><label for="externalURL">{lang}wcf.acp.box.link.externalURL{/lang}</label></dt>
+                                               <dd>
+                                                       <input type="text" name="externalURL" id="externalURL" value="{$externalURL}" class="long" maxlength="255" placeholder="http://">
+                                                       {if $errorField == 'externalURL'}
+                                                               <small class="innerError">
+                                                                       {if $errorType == 'empty'}
+                                                                               {lang}wcf.global.form.error.empty{/lang}
+                                                                       {else}
+                                                                               {lang}wcf.acp.box.link.externalURL.error.{$errorType}{/lang}
+                                                                       {/if}
+                                                               </small>
+                                                       {/if}
+                                               </dd>
+                                       </dl>
+                                       
+                                       {event name='linkFields'}
+                               </section>
                                
-                               {event name='linkFields'}
-                       </section>
-                       
-                       <div id="boxConditions">
-                               {if $boxController && $boxController->getProcessor()|is_subclass_of:'wcf\system\box\IConditionBoxController'}
-                                       {@$boxController->getProcessor()->getConditionsTemplate()}
-                               {/if}
+                               <div id="boxConditions">
+                                       {if $boxController && $boxController->getProcessor()|is_subclass_of:'wcf\system\box\IConditionBoxController'}
+                                               {@$boxController->getProcessor()->getConditionsTemplate()}
+                                       {/if}
+                               </div>
                        </div>
-               </div>
+               {/if}
                
                <div id="contents" class="tabMenuContent">
                        {if !$isMultilingual && $boxType != 'system'}
index 22cec70961a25d258defec6219986ef8d3862b1b..a88c78451bd87ea5e622e9b8db5dd9bdca9ce0d2 100644 (file)
@@ -332,7 +332,7 @@ class BoxAddForm extends AbstractForm {
                $this->validateBoxPosition();
                
                // validate link
-               if ($this->linkType == 'internal') {
+               if ($this->boxType !== 'system' && $this->linkType == 'internal') {
                        $this->externalURL = '';
                        
                        if (!$this->linkPageID) {
@@ -356,7 +356,7 @@ class BoxAddForm extends AbstractForm {
                                }
                        }
                }
-               else if ($this->linkType == 'external') {
+               else if ($this->boxType !== 'system' && $this->linkType == 'external') {
                        $this->linkPageID = $this->linkPageObjectID = null;
                        
                        if (empty($this->externalURL)) {