Disable access to media when editing signatures
authorAlexander Ebert <ebert@woltlab.com>
Wed, 25 Jan 2017 13:29:36 +0000 (14:29 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 25 Jan 2017 13:29:41 +0000 (14:29 +0100)
com.woltlab.wcf/templates/signatureEdit.tpl
com.woltlab.wcf/templates/wysiwyg.tpl
wcfsetup/install/files/acp/templates/wysiwyg.tpl

index 55f65319157eb8b2ba8de63c2b6881d04b6945af..142565769f892ba726eab7eb2b155d3a23a06d2e 100644 (file)
                        <dl class="wide{if $errorField == 'text'} formError{/if}">
                                <dt><label for="text">{lang}wcf.user.signature{/lang}</label></dt>
                                <dd>
-                                       <textarea id="text" class="wysiwygTextarea" name="text" rows="20" cols="40" data-disable-attachments="true">{$text}</textarea>
+                                       <textarea id="text" class="wysiwygTextarea" name="text" rows="20" cols="40"
+                                                 data-disable-attachments="true"
+                                                 data-disable-media="true"
+                                       >{$text}</textarea>
                                        {if $errorField == 'text'}
                                                <small class="innerError">
                                                        {if $errorType == 'empty'}
index 34786632c3d9ba3af17c87876fb20859db62a6cc..f77d6b7a6cbf01ee6594dd0f4d9528b5e87bec5f 100644 (file)
                                element.value = autosave.getInitialValue();
                        }
                        
+                       var disableMedia = elDataBool(element, 'disable-media');
+                       
                        var config = {
                                buttons: buttons,
                                clipboardImageUpload: {if $__wcf->getBBCodeHandler()->isAvailableBBCode('img')}true{else}false{/if},
                        
                        // media
                        {if $__wcf->session->getPermission('admin.content.cms.canUseMedia')}
-                               config.plugins.push('WoltLabMedia');
+                               if (disableMedia) {
+                                       var index = config.buttons.indexOf('woltlabMedia');
+                                       if (index !== -1) {
+                                               config.buttons.splice(index, 1);
+                                       }
+                               }
+                               else {
+                                       config.plugins.push('WoltLabMedia');
+                               }
                        {/if}
                        
                        {if $__redactorConfig|isset}{@$__redactorConfig}{/if}
index 34786632c3d9ba3af17c87876fb20859db62a6cc..f77d6b7a6cbf01ee6594dd0f4d9528b5e87bec5f 100644 (file)
                                element.value = autosave.getInitialValue();
                        }
                        
+                       var disableMedia = elDataBool(element, 'disable-media');
+                       
                        var config = {
                                buttons: buttons,
                                clipboardImageUpload: {if $__wcf->getBBCodeHandler()->isAvailableBBCode('img')}true{else}false{/if},
                        
                        // media
                        {if $__wcf->session->getPermission('admin.content.cms.canUseMedia')}
-                               config.plugins.push('WoltLabMedia');
+                               if (disableMedia) {
+                                       var index = config.buttons.indexOf('woltlabMedia');
+                                       if (index !== -1) {
+                                               config.buttons.splice(index, 1);
+                                       }
+                               }
+                               else {
+                                       config.plugins.push('WoltLabMedia');
+                               }
                        {/if}
                        
                        {if $__redactorConfig|isset}{@$__redactorConfig}{/if}