Added function to generate predefined custom urls automatically
authorMarcel Werk <burntime@woltlab.com>
Tue, 28 Jun 2016 08:53:08 +0000 (10:53 +0200)
committerMarcel Werk <burntime@woltlab.com>
Tue, 28 Jun 2016 08:53:14 +0000 (10:53 +0200)
wcfsetup/install/files/acp/templates/pageAdd.tpl

index fa5747e590b4d36925b09d7b6b168935617705cd..efc5a834fb5267019474a645747ba079c81776fd 100644 (file)
        });
 </script>
 
+{if $action == 'add'}
+       <script data-relocate="true">
+               elBySel('#name').addEventListener('blur', function() {
+                       var name = elBySel('#name').value;
+                       name = name.replace(/ /g, '-');
+                       name = name.replace(/[^a-z0-9-]/gi, '');
+                       
+                       {if !$isMultilingual}
+                               if (elBySel('#customURL').value === '') {
+                                       elBySel('#customURL').value = name;
+                               }
+                       {else}
+                               {foreach from=$availableLanguages item=availableLanguage}
+                                       if (elBySel('#customURL{@$availableLanguage->languageID}').value === '') {
+                                               elBySel('#customURL{@$availableLanguage->languageID}').value = name + '-{@$availableLanguage->languageCode}';
+                                       }
+                               {/foreach}
+                       {/if}
+               });
+       </script>
+{/if}
+
 <header class="contentHeader">
        <div class="contentHeaderTitle">
                <h1 class="contentTitle">{if $action == 'add'}{lang}wcf.acp.page.add{/lang}{else}{lang}wcf.acp.page.edit{/lang}{/if}</h1>