From 56eb7314ae15956efc633f07fe99e6b332c619a3 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Thu, 24 Dec 2015 12:51:34 +0100 Subject: [PATCH] Add image selector for boxes --- com.woltlab.wcf/templates/mediaJavaScript.tpl | 22 ++ com.woltlab.wcf/templates/mediaListItems.tpl | 14 +- com.woltlab.wcf/templates/mediaManager.tpl | 29 +-- com.woltlab.wcf/templates/wysiwyg.tpl | 23 +- .../install/files/acp/templates/boxAdd.tpl | 83 ++++++- .../install/files/acp/templates/mediaAdd.tpl | 8 +- .../files/acp/templates/mediaEditor.tpl | 65 ++++++ .../files/acp/templates/mediaJavaScript.tpl | 22 ++ .../files/acp/templates/mediaListItems.tpl | 36 +++ .../files/acp/templates/mediaManager.tpl | 36 +++ .../redactor2/plugins/WoltLabMedia.js | 6 +- wcfsetup/install/files/js/WoltLab/WCF/Ajax.js | 2 +- .../WCF/Media/{Manager.js => Manager/Base.js} | 217 ++++++++---------- .../js/WoltLab/WCF/Media/Manager/Editor.js | 176 ++++++++++++++ .../js/WoltLab/WCF/Media/Manager/Select.js | 127 ++++++++++ .../files/js/WoltLab/WCF/Media/Search.js | 59 ++--- .../files/js/WoltLab/WCF/Media/Upload.js | 110 ++++----- .../files/js/WoltLab/WCF/Ui/Alignment.js | 1 - .../install/files/js/WoltLab/WCF/Upload.js | 36 ++- .../files/lib/acp/form/BoxAddForm.class.php | 86 +++++-- .../files/lib/acp/form/BoxEditForm.class.php | 19 +- .../lib/acp/form/MediaEditForm.class.php | 12 +- .../AbstractDatabaseObjectAction.class.php | 2 +- .../install/files/lib/data/box/Box.class.php | 100 +++++--- .../files/lib/data/box/BoxAction.class.php | 30 +-- .../files/lib/data/media/Media.class.php | 23 +- .../lib/data/media/MediaAction.class.php | 94 +++++--- .../lib/data/media/MediaEditor.class.php | 2 +- .../files/lib/data/media/MediaList.class.php | 26 +++ .../lib/data/media/ViewableMedia.class.php | 44 +++- .../data/media/ViewableMediaList.class.php | 2 +- .../files/lib/data/menu/Menu.class.php | 4 +- ...ediaUploadFileValidationStrategy.class.php | 63 +++++ wcfsetup/install/files/style/icon/icon.scss | 6 + wcfsetup/install/files/style/ui/media.scss | 23 +- wcfsetup/setup/db/install.sql | 4 +- 36 files changed, 1209 insertions(+), 403 deletions(-) create mode 100644 com.woltlab.wcf/templates/mediaJavaScript.tpl create mode 100644 wcfsetup/install/files/acp/templates/mediaEditor.tpl create mode 100644 wcfsetup/install/files/acp/templates/mediaJavaScript.tpl create mode 100644 wcfsetup/install/files/acp/templates/mediaListItems.tpl create mode 100644 wcfsetup/install/files/acp/templates/mediaManager.tpl rename wcfsetup/install/files/js/WoltLab/WCF/Media/{Manager.js => Manager/Base.js} (73%) create mode 100644 wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Editor.js create mode 100644 wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Select.js create mode 100644 wcfsetup/install/files/lib/system/upload/MediaUploadFileValidationStrategy.class.php diff --git a/com.woltlab.wcf/templates/mediaJavaScript.tpl b/com.woltlab.wcf/templates/mediaJavaScript.tpl new file mode 100644 index 0000000000..960d9f0665 --- /dev/null +++ b/com.woltlab.wcf/templates/mediaJavaScript.tpl @@ -0,0 +1,22 @@ +{if $__wcf->session->getPermission('admin.content.cms.canUseMedia')} + require(['Language', 'Permission'], function(Language, Permission) { + Language.addObject({ + 'wcf.global.button.insert': '{lang}wcf.global.button.insert{/lang}', + + 'wcf.media.insert': '{lang}wcf.media.insert{/lang}', + 'wcf.media.insert.imageSize': '{lang}wcf.media.insert.imageSize{/lang}', + 'wcf.media.insert.imageSize.small': '{lang __literal=true}wcf.media.insert.imageSize.small{/lang}', + 'wcf.media.insert.imageSize.medium': '{lang __literal=true}wcf.media.insert.imageSize.medium{/lang}', + 'wcf.media.insert.imageSize.large': '{lang __literal=true}wcf.media.insert.imageSize.large{/lang}', + 'wcf.media.insert.imageSize.original': '{lang __literal=true}wcf.media.insert.imageSize.original{/lang}', + 'wcf.media.manager': '{lang}wcf.media.manager{/lang}', + 'wcf.media.edit': '{lang}wcf.media.edit{/lang}', + 'wcf.media.imageDimensions.value': '{lang __literal=true}wcf.media.imageDimensions.value{/lang}', + 'wcf.media.button.insert': '{lang}wcf.media.button.insert{/lang}', + 'wcf.media.search.filetype': '{lang}wcf.media.search.filetype{/lang}', + 'wcf.media.search.noResults': '{lang}wcf.media.search.noResults{/lang}' + }); + + Permission.add('admin.content.cms.canManageMedia', {if $__wcf->session->getPermission('admin.content.cms.canManageMedia')}true{else}false{/if}); + }); +{/if} diff --git a/com.woltlab.wcf/templates/mediaListItems.tpl b/com.woltlab.wcf/templates/mediaListItems.tpl index 1621bd5ccb..45007323dd 100644 --- a/com.woltlab.wcf/templates/mediaListItems.tpl +++ b/com.woltlab.wcf/templates/mediaListItems.tpl @@ -1,7 +1,7 @@ {foreach from=$mediaList item=media}
  • - {@$media->getElementTag(96)} + {@$media->getElementTag(144)}
    @@ -21,9 +21,15 @@
  • {/if} -
  • - -
  • + {if $mode == 'editor'} +
  • + +
  • + {elseif $mode == 'select'} +
  • + +
  • + {/if} diff --git a/com.woltlab.wcf/templates/mediaManager.tpl b/com.woltlab.wcf/templates/mediaManager.tpl index 6f53d90ff4..2c33b79d9d 100644 --- a/com.woltlab.wcf/templates/mediaManager.tpl +++ b/com.woltlab.wcf/templates/mediaManager.tpl @@ -1,16 +1,19 @@ -