From 59ab4d0f66ddd21bc800b49ebbedcd91e6ae0c5c Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Tue, 22 Dec 2015 17:07:05 +0100 Subject: [PATCH] Add media management (WIP) --- com.woltlab.wcf/acpMenu.xml | 15 +- com.woltlab.wcf/clipboardAction.xml | 21 + com.woltlab.wcf/objectType.xml | 5 + com.woltlab.wcf/option.xml | 68 +++ com.woltlab.wcf/templates/dashboard.tpl | 31 ++ .../templates/headIncludeJavaScript.tpl | 1 + com.woltlab.wcf/templates/languageChooser.tpl | 31 ++ com.woltlab.wcf/templates/mediaEditor.tpl | 65 +++ com.woltlab.wcf/templates/mediaListItems.tpl | 30 ++ com.woltlab.wcf/templates/mediaManager.tpl | 33 ++ .../multipleLanguageInputJavascript.tpl | 17 +- com.woltlab.wcf/templates/sitemap.tpl | 15 - com.woltlab.wcf/userGroupOption.xml | 18 +- .../install/files/acp/js/WCF.ACP.Style.js | 1 + .../files/acp/templates/languageChooser.tpl | 31 ++ .../install/files/acp/templates/mediaAdd.tpl | 173 +++++++ .../install/files/acp/templates/mediaList.tpl | 131 +++++ .../multipleLanguageInputJavascript.tpl | 2 +- .../install/files/acp/templates/styleAdd.tpl | 5 +- .../WoltLab/WCF/Acp/Ui/Style/Image/Upload.js | 69 +++ .../files/js/WoltLab/WCF/Attachment/Upload.js | 308 ++++++++++++ .../js/WoltLab/WCF/Controller/Clipboard.js | 1 + .../files/js/WoltLab/WCF/Dictionary.js | 18 +- .../install/files/js/WoltLab/WCF/File/Util.js | 71 +++ .../files/js/WoltLab/WCF/Language/Chooser.js | 274 +++++++++++ .../files/js/WoltLab/WCF/Media/Editor.js | 325 ++++++++++++ .../files/js/WoltLab/WCF/Media/Manager.js | 448 +++++++++++++++++ .../files/js/WoltLab/WCF/Media/Search.js | 188 +++++++ .../files/js/WoltLab/WCF/Media/Upload.js | 194 ++++++++ .../install/files/js/WoltLab/WCF/Ui/Dialog.js | 10 + .../install/files/js/WoltLab/WCF/Upload.js | 6 +- wcfsetup/install/files/js/require.config.js | 4 +- .../lib/acp/form/MediaEditForm.class.php | 188 +++++++ .../files/lib/acp/page/MediaAddPage.class.php | 36 ++ .../lib/acp/page/MediaListPage.class.php | 64 +++ .../install/files/lib/data/IFile.class.php | 22 + .../files/lib/data/IThumbnailFile.class.php | 39 ++ .../files/lib/data/IUploadAction.class.php | 27 + .../lib/data/attachment/Attachment.class.php | 68 ++- .../attachment/AttachmentAction.class.php | 281 +++-------- .../files/lib/data/media/Media.class.php | 148 ++++++ .../lib/data/media/MediaAction.class.php | 461 ++++++++++++++++++ .../lib/data/media/MediaEditor.class.php | 35 ++ .../files/lib/data/media/MediaList.class.php | 21 + .../lib/data/media/ViewableMedia.class.php | 38 ++ .../data/media/ViewableMediaList.class.php | 32 ++ .../lib/data/style/StyleAction.class.php | 127 +++-- .../files/lib/page/MediaPage.class.php | 161 ++++++ .../action/MediaClipboardAction.class.php | 89 ++++ .../lib/system/language/I18nHandler.class.php | 6 +- .../DefaultUploadFileSaveStrategy.class.php | 248 ++++++++++ .../install/files/lib/util/FileUtil.class.php | 60 ++- wcfsetup/install/files/media/.htaccess | 1 + wcfsetup/install/files/style/ui/alert.scss | 30 +- wcfsetup/install/files/style/ui/media.scss | 95 ++++ wcfsetup/install/lang/en.xml | 33 ++ wcfsetup/setup/db/install.sql | 57 ++- 57 files changed, 4631 insertions(+), 345 deletions(-) create mode 100644 com.woltlab.wcf/templates/languageChooser.tpl create mode 100644 com.woltlab.wcf/templates/mediaEditor.tpl create mode 100644 com.woltlab.wcf/templates/mediaListItems.tpl create mode 100644 com.woltlab.wcf/templates/mediaManager.tpl create mode 100644 wcfsetup/install/files/acp/templates/languageChooser.tpl create mode 100644 wcfsetup/install/files/acp/templates/mediaAdd.tpl create mode 100644 wcfsetup/install/files/acp/templates/mediaList.tpl create mode 100644 wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Style/Image/Upload.js create mode 100644 wcfsetup/install/files/js/WoltLab/WCF/Attachment/Upload.js create mode 100644 wcfsetup/install/files/js/WoltLab/WCF/File/Util.js create mode 100644 wcfsetup/install/files/js/WoltLab/WCF/Language/Chooser.js create mode 100644 wcfsetup/install/files/js/WoltLab/WCF/Media/Editor.js create mode 100644 wcfsetup/install/files/js/WoltLab/WCF/Media/Manager.js create mode 100644 wcfsetup/install/files/js/WoltLab/WCF/Media/Search.js create mode 100644 wcfsetup/install/files/js/WoltLab/WCF/Media/Upload.js create mode 100644 wcfsetup/install/files/lib/acp/form/MediaEditForm.class.php create mode 100644 wcfsetup/install/files/lib/acp/page/MediaAddPage.class.php create mode 100644 wcfsetup/install/files/lib/acp/page/MediaListPage.class.php create mode 100644 wcfsetup/install/files/lib/data/IFile.class.php create mode 100644 wcfsetup/install/files/lib/data/IThumbnailFile.class.php create mode 100644 wcfsetup/install/files/lib/data/IUploadAction.class.php create mode 100644 wcfsetup/install/files/lib/data/media/Media.class.php create mode 100644 wcfsetup/install/files/lib/data/media/MediaAction.class.php create mode 100644 wcfsetup/install/files/lib/data/media/MediaEditor.class.php create mode 100644 wcfsetup/install/files/lib/data/media/MediaList.class.php create mode 100644 wcfsetup/install/files/lib/data/media/ViewableMedia.class.php create mode 100644 wcfsetup/install/files/lib/data/media/ViewableMediaList.class.php create mode 100644 wcfsetup/install/files/lib/page/MediaPage.class.php create mode 100644 wcfsetup/install/files/lib/system/clipboard/action/MediaClipboardAction.class.php create mode 100644 wcfsetup/install/files/lib/system/upload/DefaultUploadFileSaveStrategy.class.php create mode 100644 wcfsetup/install/files/media/.htaccess create mode 100644 wcfsetup/install/files/style/ui/media.scss diff --git a/com.woltlab.wcf/acpMenu.xml b/com.woltlab.wcf/acpMenu.xml index 65f790266e..e0f5acc146 100644 --- a/com.woltlab.wcf/acpMenu.xml +++ b/com.woltlab.wcf/acpMenu.xml @@ -617,7 +617,6 @@ wcf.acp.menu.link.cms admin.content.cms.canManagePage - wcf.acp.menu.link.cms.page.list @@ -630,7 +629,6 @@ wcf.acp.menu.link.cms admin.content.cms.canManageMenu - wcf.acp.menu.link.cms.menu.list @@ -643,12 +641,23 @@ wcf.acp.menu.link.cms admin.content.cms.canManageBox - wcf.acp.menu.link.cms.box.list admin.content.cms.canManageBox fa-plus + + + + wcf.acp.menu.link.cms + admin.content.cms.canManageMedia + + + + wcf.acp.menu.link.cms.media.list + admin.content.cms.canManageMedia + fa-plus + diff --git a/com.woltlab.wcf/clipboardAction.xml b/com.woltlab.wcf/clipboardAction.xml index c91192b202..d633a98d87 100644 --- a/com.woltlab.wcf/clipboardAction.xml +++ b/com.woltlab.wcf/clipboardAction.xml @@ -83,5 +83,26 @@ + + + + + 1 + + + + + + + + 2 + + + + + diff --git a/com.woltlab.wcf/objectType.xml b/com.woltlab.wcf/objectType.xml index dc9c8000aa..e9b0d6f37a 100644 --- a/com.woltlab.wcf/objectType.xml +++ b/com.woltlab.wcf/objectType.xml @@ -12,6 +12,11 @@ com.woltlab.wcf.clipboardItem + + com.woltlab.wcf.media + com.woltlab.wcf.clipboardItem + + diff --git a/com.woltlab.wcf/option.xml b/com.woltlab.wcf/option.xml index be74404b4e..f09b7fd1da 100644 --- a/com.woltlab.wcf/option.xml +++ b/com.woltlab.wcf/option.xml @@ -244,6 +244,16 @@ dashboard.sidebar + + + + + cms + + + cms.media + + @@ -1471,6 +1481,64 @@ DESC:wcf.global.sortOrder.descending]]> 100 + + + + + + + + + + + + diff --git a/com.woltlab.wcf/templates/dashboard.tpl b/com.woltlab.wcf/templates/dashboard.tpl index a3b3daf148..eda866905a 100644 --- a/com.woltlab.wcf/templates/dashboard.tpl +++ b/com.woltlab.wcf/templates/dashboard.tpl @@ -29,6 +29,37 @@ {/if} +{*TODO: remove dummy media manager dialog demonstration code later on*} +

click

+ + +{* /end *} + {include file='userNotice'}
diff --git a/com.woltlab.wcf/templates/headIncludeJavaScript.tpl b/com.woltlab.wcf/templates/headIncludeJavaScript.tpl index 47caae7d03..f938b8d995 100644 --- a/com.woltlab.wcf/templates/headIncludeJavaScript.tpl +++ b/com.woltlab.wcf/templates/headIncludeJavaScript.tpl @@ -65,6 +65,7 @@ requirejs.config({ 'wcf.global.form.error.greaterThan': '{lang __literal=true}wcf.global.form.error.greaterThan{/lang}', 'wcf.global.form.error.lessThan': '{lang __literal=true}wcf.global.form.error.lessThan{/lang}', 'wcf.global.form.input.maxItems': '{lang}wcf.global.form.input.maxItems{/lang}', + 'wcf.global.form.error.multilingual': '{lang}wcf.global.form.error.multilingual{/lang}', 'wcf.global.language.noSelection': '{lang}wcf.global.language.noSelection{/lang}', 'wcf.global.loading': '{lang}wcf.global.loading{/lang}', 'wcf.global.page.jumpTo': '{lang}wcf.global.page.jumpTo{/lang}', diff --git a/com.woltlab.wcf/templates/languageChooser.tpl b/com.woltlab.wcf/templates/languageChooser.tpl new file mode 100644 index 0000000000..c75dfaa79c --- /dev/null +++ b/com.woltlab.wcf/templates/languageChooser.tpl @@ -0,0 +1,31 @@ +{if !$label|isset}{assign var='label' value='wcf.user.language'}{/if} + +{if $languages|count} + +
{lang}{$label}{/lang}
+
+ +
+ + + +{/if} diff --git a/com.woltlab.wcf/templates/mediaEditor.tpl b/com.woltlab.wcf/templates/mediaEditor.tpl new file mode 100644 index 0000000000..65172e57e8 --- /dev/null +++ b/com.woltlab.wcf/templates/mediaEditor.tpl @@ -0,0 +1,65 @@ +
+ +
+ + +
+
{lang}wcf.media.filename{/lang}
+
+ +
{lang}wcf.media.filesize{/lang}
+
+ +
{lang}wcf.media.imageDimensions{/lang}
+
+ +
{lang}wcf.media.uploader{/lang}
+
+
+
+ +
+ {lang}wcf.global.form.data{/lang} + +
+
+
+ +
+
+ + {include file='languageChooser' label='wcf.media.languageID'} + +
+
{lang}wcf.global.title{/lang}
+
+ +
+
+ {include file='multipleLanguageInputJavascript' elementIdentifier='title' forceSelection=true} + +
+
{lang}wcf.media.caption{/lang}
+
+ +
+
+ {include file='multipleLanguageInputJavascript' elementIdentifier='caption' forceSelection=true} + +
+
{lang}wcf.media.altText{/lang}
+
+ +
+
+ {include file='multipleLanguageInputJavascript' elementIdentifier='altText' forceSelection=true} + + {event name='dataFields'} +
+ +
+ +
diff --git a/com.woltlab.wcf/templates/mediaListItems.tpl b/com.woltlab.wcf/templates/mediaListItems.tpl new file mode 100644 index 0000000000..1621bd5ccb --- /dev/null +++ b/com.woltlab.wcf/templates/mediaListItems.tpl @@ -0,0 +1,30 @@ +{foreach from=$mediaList item=media} +
  • +
    + {@$media->getElementTag(96)} +
    + +
    +

    {if $media->title}{$media->title}{else}{$media->filename}{/if}

    +
    + + +
  • +{/foreach} diff --git a/com.woltlab.wcf/templates/mediaManager.tpl b/com.woltlab.wcf/templates/mediaManager.tpl new file mode 100644 index 0000000000..6f53d90ff4 --- /dev/null +++ b/com.woltlab.wcf/templates/mediaManager.tpl @@ -0,0 +1,33 @@ + + +{if $__wcf->session->getPermission('admin.content.cms.canManageMedia')} +
    +{/if} + +
    + +
      + {include file='mediaListItems'} +
    + +
    + +
    +
    diff --git a/com.woltlab.wcf/templates/multipleLanguageInputJavascript.tpl b/com.woltlab.wcf/templates/multipleLanguageInputJavascript.tpl index f59328760d..cdacde6704 100644 --- a/com.woltlab.wcf/templates/multipleLanguageInputJavascript.tpl +++ b/com.woltlab.wcf/templates/multipleLanguageInputJavascript.tpl @@ -1,11 +1,14 @@ {if $availableLanguages|count > 1} -{/if} \ No newline at end of file +{/if} diff --git a/com.woltlab.wcf/templates/sitemap.tpl b/com.woltlab.wcf/templates/sitemap.tpl index 3518a73820..cffdc03122 100644 --- a/com.woltlab.wcf/templates/sitemap.tpl +++ b/com.woltlab.wcf/templates/sitemap.tpl @@ -17,21 +17,6 @@
    {/foreach} - - {hascontentelse} {@$sitemap} {/hascontent} diff --git a/com.woltlab.wcf/userGroupOption.xml b/com.woltlab.wcf/userGroupOption.xml index 7f2b18aea3..0209520d25 100644 --- a/com.woltlab.wcf/userGroupOption.xml +++ b/com.woltlab.wcf/userGroupOption.xml @@ -413,7 +413,7 @@ pdf]]> 1 1 - + + + + +