From 2bcc50379ce985545d26b42ffd5717ab265b5635 Mon Sep 17 00:00:00 2001 From: sakamocchi Date: Sun, 27 May 2012 22:06:14 +0900 Subject: [PATCH] =?utf8?q?ADD:=20=E3=83=97=E3=83=A9=E3=82=B0=E3=82=A4?= =?utf8?q?=E3=83=B3=E3=80=8CNP=5FMedium=E3=80=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit メディアファイルを管理するための仕組みであるmedia.phpの代替となるプラグインを追加。 これによりmedia.phpとそれが参照するスタイルシート、JavaScriptをすべてコア機能から取り去ることができる。 プラグインはJavaScriptのmediumオブジェクトにすべてのコードを入れている。プラグイン呼び出しは、デフォルト管理画面用スキンのedit.jsのaddMedia()で行う。addMedia()はmediumオブジェクトが定義されていたらmedium.addMedia()を、そうでなければ新たにウィンドウを開き、nucleusMediaPopupURLをロードする。この条件分岐により下位互換性を維持する。 --- install/index.php | 2 +- nucleus/plugins/NP_Medium.php | 428 +++++++++++++++++++++ nucleus/plugins/medium/MediumActions.php | 312 +++++++++++++++ .../plugins/medium/locales/en_Latn_US.UTF-8.php | 9 + nucleus/plugins/medium/scripts/medium.js | 184 +++++++++ nucleus/plugins/medium/skins/choose.skn | 31 ++ nucleus/plugins/medium/skins/error.skn | 7 + nucleus/plugins/medium/skins/login.skn | 25 ++ nucleus/plugins/medium/skins/pagefoot.skn | 2 + nucleus/plugins/medium/skins/pagehead.skn | 8 + nucleus/plugins/medium/skins/select.skn | 48 +++ nucleus/plugins/medium/styles/medium.css | 59 +++ skins/admin/bookmarklet/javascripts/edit.js | 15 +- skins/admin/default/javascripts/edit.js | 17 +- 14 files changed, 1134 insertions(+), 13 deletions(-) create mode 100644 nucleus/plugins/NP_Medium.php create mode 100644 nucleus/plugins/medium/MediumActions.php create mode 100644 nucleus/plugins/medium/locales/en_Latn_US.UTF-8.php create mode 100644 nucleus/plugins/medium/scripts/medium.js create mode 100644 nucleus/plugins/medium/skins/choose.skn create mode 100644 nucleus/plugins/medium/skins/error.skn create mode 100644 nucleus/plugins/medium/skins/login.skn create mode 100644 nucleus/plugins/medium/skins/pagefoot.skn create mode 100644 nucleus/plugins/medium/skins/pagehead.skn create mode 100644 nucleus/plugins/medium/skins/select.skn create mode 100644 nucleus/plugins/medium/styles/medium.css diff --git a/install/index.php b/install/index.php index 03d65f9..01f0d0a 100644 --- a/install/index.php +++ b/install/index.php @@ -43,7 +43,7 @@ if ( version_compare(PHP_VERSION, '5.3.0', '<') ) } /* default installed plugins and skins */ -$aConfPlugsToInstall = array('NP_SecurityEnforcer', 'NP_SkinFiles'); +$aConfPlugsToInstall = array('NP_SecurityEnforcer', 'NP_SkinFiles', 'NP_Medium'); $aConfSkinsToImport = array('atom', 'rss2.0', 'rsd', 'default', 'admin/default', 'admin/bookmarklet'); // Check if some important files diff --git a/nucleus/plugins/NP_Medium.php b/nucleus/plugins/NP_Medium.php new file mode 100644 index 0000000..b35354c --- /dev/null +++ b/nucleus/plugins/NP_Medium.php @@ -0,0 +1,428 @@ +getDirectory() . 'locales/' . i18n::get_current_locale() . '.' . i18n::get_current_charset() . '.php') ) + { + include_once($this->getDirectory() . 'locales/' . i18n::get_current_locale() . '.' . i18n::get_current_charset() . '.php'); + } + else + { + include_once($this->getDirectory() . 'locales/en_Latn_US.UTF-8.php'); + } + return; + } + + public function install() + { + $this->createOption('collectionlist_head', 'NP_MEDIUM_COLLECTIONLIST_HEAD', 'textarea', + "" + . "\n"); + + $this->createOption('medialist_head', 'NP_MEDIUM_MEDIALIST_HEAD', 'textarea', + "\">\n" + . "\n" + . "\n" + . "\n" + . "\n" + . "\n" + . "\n" + . "\n" + . "\n" + . "\n"); + + $this->createOption('medialist_body_image', 'NP_MEDIUM_MEDIALIST_BODY_IMAGE', 'textarea', + "\n" + . "\n" + . "\n" + . "\n" + . "\n"); + + $this->createOption('medialist_body_other', 'NP_MEDIUM_MEDIALIST_BODY_OTHER', 'textarea', + "\n" + . "\n" + . "\n" + . "\n" + . "\n"); + + $this->createOption('medialist_foot', 'NP_MEDIUM_MEDIALIST_FOOT', 'textarea', + "\n" + . "
<%text(_MEDIA_COLLECTION_LABEL)%> <%description%>
<%text(_MEDIA_MODIFIED)%><%text(_MEDIA_FILENAME)%><%text(_MEDIA_DIMENSIONS)%>
<%timestamp%>\n" + . "\" onclick=\"medium.chooseImage('<%collection%>', '<%filename%>', <%width%>, <%height%>);\" title=\"<%filename%>\">\n" + . "<%shortfilename%>\n" + . "\n" + . "(\n" + . "\" onclick=\"window.open(this.href); return false;\" title=\"<%text(_MEDIA_VIEW_TT%>\">\n" + . "<%text(_MEDIA_VIEW)%>\n" + . "\n" + . ")\n" + . "<%width%> x <%height%>
<%timestamp%>\n" + . "\" onclick=\"medium.chooseOther('<%collection%>', '<%filename%>');\" title=\"<%filename%>\">\n" + . "<%shortfilename%>\n" + . "\n" + . "<%size%> KB
\n"); + + $this->createOption('medialist_blank', 'NP_MEDIUM_MEDIALIST_BLANK', 'textarea', + "

Nothing

\n"); + + return; + } + + public function event_AdminPrePageHead($data) + { + global $CONF; + + if ( !in_array($data['action'], array('createitem', 'itemedit')) ) + { + return; + } + + $data['extrahead'] .= "\n" + . "'."\n"; + + return; + } + + public function doAction($type) + { + global $CONF, $DIR_MEDIA, $manager, $member; + + /* + * defines how much media items will be shown per page. You can override this + * in config.php if you like. (changing it in config.php instead of here will + * allow your settings to be kept even after a Nucleus upgrade) + */ + $CONF['MediaPerPage'] = 10; + + /* include all classes */ + if ( !class_exists('Media', FALSE) ) + { + include_libs('MEDIA.php', FALSE, FALSE); + } + + /* include all classes */ + if ( !class_exists('BaseActions', FALSE) ) + { + include_libs('BaseActions.php', FALSE, FALSE); + } + + if ( !class_exists('MediumActions', FALSE) ) + { + include($this->getDirectory() . 'MediumActions.php'); + } + + /* get skin object */ + $skinid = $CONF['AdminSkin']; + if ( !Skin::existsID($skinid) ) + { + echo _ERROR_SKIN; + exit; + } + $this->skin = new Skin($skinid, 'MediumActions', 'MediumSkin'); + + /* user needs to be logged in to use this */ + if ( !$member->isLoggedIn() ) + { + $this->login(); + exit; + } + + /* check if member is on at least one teamlist */ + $query = 'SELECT * FROM %s WHERE tmember=%d;'; + $query = sprintf($query, sql_table('team'), $member->getID()); + $teams = DB::getResult($query); + if ( $teams->rowCount() == 0 && !$member->isAdmin() ) + { + $this->error(_ERROR_DISALLOWEDUPLOAD); + return; + } + + /* avoid directory travarsal and accessing invalid directory */ + $this->collection = requestVar('collection'); + $this->description = $this->collection; + if ( !$this->collection || $this->collection == $member->getID() + || !@is_dir("{$DIR_MEDIA}{$this->collection}") ) + { + $this->collection = $member->getID(); + $this->description = PRIVATE_COLLECTION; + } + else if ( !Media::isValidCollection($this->collection) ) + { + $this->error(_ERROR_DISALLOWED); + return; + } + + /* check type */ + if ( !in_array($type, array('select', 'choose', 'upload')) ) + { + $type = 'select'; + } + + /* check ticket */ + $needless_to_check = array('select', 'choose'); + if ( !in_array($type, $needless_to_check) ) + { + if ( !$manager->checkTicket() ) + { + $this->error(_ERROR_BADTICKET); + return; + } + } + + /* processing */ + switch ( $type ) + { + case 'choose': + if ( !$member->isAdmin() && !$CONF['AllowUpload'] ) + { + $this->error(_ERROR_DISALLOWED); + return; + } + $this->choose(); + break; + case 'upload': + if ( !$member->isAdmin() && !$CONF['AllowUpload'] ) + { + $this->error(_ERROR_DISALLOWED); + return; + } + $this->upload(); + break; + case 'select': + default: + $this->select(); + break; + } + exit; + } + + private function select() + { + global $CONF; + + $this->type = 'select'; + $this->filter = requestVar('filter'); + + $media = Media::getMediaListByCollection($this->collection, $this->filter); + + $this->amount = count($media); + $this->offset = intRequestVar('offset'); + + if ( $this->amount > 0 ) + { + if ( ($this->offset + $CONF['MediaPerPage']) >= $this->amount ) + { + $this->offset = $this->amount - $CONF['MediaPerPage']; + } + + if ( $this->offset < 0 ) + { + $this->offset = 0; + } + + $start = $this->offset; + $end = $this->offset + $CONF['MediaPerPage']; + $next = $end; + $prev = $start - $CONF['MediaPerPage']; + + if ( $prev < 0 ) + { + $prev = 0; + } + + if ( $end > $this->amount ) + { + $end = $this->amount; + } + + if ( $start > 0 ) + { + $this->prev = $prev; + } + + if ( $end < $this->amount ) + { + $this->next = $next; + } + + for( $index = $start; $index < $end; $index++ ) + { + $this->media[] = $media[$index]; + } + + unset($media); + } + + $this->skin->parse('fileparse', $this->getDirectory() . 'skins/select.skn'); + return; + } + + private function choose() + { + $this->type = 'choose'; + $this->skin->parse('fileparse', $this->getDirectory() . 'skins/choose.skn'); + } + + private function upload() + { + global $CONF; + + $this->type = 'upload'; + + $uploadInfo = postFileInfo('uploadfile'); + + $filename = $uploadInfo['name']; + $filetype = $uploadInfo['type']; + $filesize = $uploadInfo['size']; + $filetempname = $uploadInfo['tmp_name']; + $fileerror = (integer) $uploadInfo['error']; + + switch ( $fileerror ) + { + // include error code for debugging + // (see http://www.php.net/manual/en/features.file-upload.errors.php) + case 0: // = UPLOAD_ERR_OK + break; + case 1: // = UPLOAD_ERR_INI_SIZE + case 2: // = UPLOAD_ERR_FORM_SIZE + $this->error(_ERROR_FILE_TOO_BIG); + return; + case 3: // = UPLOAD_ERR_PARTIAL + case 4: // = UPLOAD_ERR_NO_FILE + case 6: // = UPLOAD_ERR_NO_TMP_DIR + case 7: // = UPLOAD_ERR_CANT_WRITE + default: + $this->error(_ERROR_BADREQUEST . ' (' . $fileerror . ')'); + return; + } + + if ( $filesize > $CONF['MaxUploadSize'] ) + { + $this->error(_ERROR_FILE_TOO_BIG); + return; + } + + // check file type against allowed types + $ok = 0; + $allowedtypes = preg_split('#,#', $CONF['AllowedTypes']); + foreach ( $allowedtypes as $type ) + { + if ( preg_match("#.{$type}$#i", $filename) ) + { + $ok = 1; + } + } + if ( !$ok ) + { + $this->error(_ERROR_BADFILETYPE); + return; + } + + if ( !is_uploaded_file($filetempname) ) + { + $this->error(_ERROR_BADREQUEST); + return; + } + // prefix filename with current date (YYYY-MM-DD-) + // this to avoid nameclashes + if ( $CONF['MediaPrefix'] ) + { + $filename = i18n::formatted_datetime("%Y%m%d-", time()) . $filename; + } + + $res = Media::addMediaObject($this->collection, $filetempname, $filename); + + if ( $res != '' ) + { + $this->error($res); + return; + } + + $this->select(); + return; + } + + private function login() + { + $this->type = 'login'; + $this->skin->parse('fileparse', $this->getDirectory() . 'skins/login.skn'); + return; + } + + private function error($msg) + { + $this->type = 'error'; + $this->message = $msg; + $this->skin->parse('fileparse', $this->getDirectory() . 'skins/error.skn'); + return; + } +} diff --git a/nucleus/plugins/medium/MediumActions.php b/nucleus/plugins/medium/MediumActions.php new file mode 100644 index 0000000..7810bdd --- /dev/null +++ b/nucleus/plugins/medium/MediumActions.php @@ -0,0 +1,312 @@ + 'NP_Medium', + 'choose' => _UPLOAD_TITLE, + 'select' => _SKIN_PART_ALIST, + 'error' => _ERROR + ); + + static public function getAvailableSkinTypes() + { + return self::$default_skin_types; + } + + public function getAvailableActions() + { + global $manager; + + $extra_actions = array(); + + switch ( $manager->getPlugin('NP_Medium')->type ) + { + case 'login': + $extra_actions = array( + 'name', + ); + break; + case 'select': + $extra_actions = array( + 'amount', + 'filter', + 'medialist', + 'next', + 'prev' + ); + break; + case 'choose': + $extra_actions = array( + 'pluginextras', + 'ticket', + ); + break; + case 'error': + $extra_actions = array( + 'message', + ); + break; + } + + $defined_actions = array_merge(self::$default_actions, $extra_actions); + + return array_merge($defined_actions, parent::getAvailableActions()); + } + + /** + * MediumActions::_construct + * + * @param string $type always 'fileparse' + * @return void + */ + public function __construct($type) + { + parent::__construct(); + return; + } + + public function parse_conf($key) + { + global $CONF; + if ( array_key_exists($key, $CONF) ) + { + echo $CONF[$key]; + } + return; + } + + public function parse_actionurl() + { + global $CONF; + echo "{$CONF['ActionURL']}?action=plugin&name=medium"; + return; + } + + public function parse_collection() + { + global $manager; + echo (string) $manager->getPlugin('NP_Medium')->collection; + return; + } + + public function parse_pagehead() + { + global $manager; + $path = $manager->getPlugin('NP_Medium')->getDirectory() . 'skins/pagehead.skn'; + $contents = $this->parser->skin->getContentFromFile($path); + $this->parser->parse($contents); + return; + } + + public function parse_pagefoot() + { + global $manager; + $path = $manager->getPlugin('NP_Medium')->getDirectory() . 'skins/pagefoot.skn'; + $contents = $this->parser->skin->getContentFromFile($path); + $this->parser->parse($contents); + return; + } + + public function parse_stylesheet($name) + { + global $CONF; + echo "{$CONF['PluginURL']}medium/styles/{$name}"; + return; + } + + public function parse_script($name) + { + global $CONF; + echo "{$CONF['PluginURL']}medium/scripts/{$name}"; + return; + } + + public function parse_name() + { + global $member; + + if ( !$member->isLoggedIn() ) + { + echo (string) requestVar('login'); + } + else + { + echo (string) $member->getDisplayName(); + } + return; + } + + public function parse_filter() + { + global $manager; + echo (string) $manager->getPlugin('NP_Medium')->filter; + return; + } + + public function parse_ticket() + { + global $manager; + echo $manager->addTicketHidden(); + return; + } + + public function parse_message() + { + global $manager; + echo (string) $manager->getPlugin('NP_Medium')->message; + return; + } + + public function parse_pluginextras() + { + global $manager; + $manager->notify("MediaUploadFormExtras", array()); + return; + } + + public function parse_amount() + { + global $manager; + echo (string) $manager->getPlugin('NP_Medium')->amount; + return; + } + + public function parseoffset() + { + global $manager; + echo (string) $manager->getPlugin('NP_Medium')->offset; + return; + } + + public function parse_prev() + { + global $manager; + echo (string) $manager->getPlugin('NP_Medium')->prev; + return; + } + + public function parse_next() + { + global $manager; + echo (string) $manager->getPlugin('NP_Medium')->next; + return; + } + + public function parse_collectionlist() + { + global $CONF, $manager; + + $plugin = $manager->getPlugin('NP_Medium'); + + $data = array( + 'actionurl' => "{$CONF['ActionURL']}?action=plugin&type=medium" + ); + $this->parser->parse(Template::fill($plugin->getOption('collectionlist_head'), $data)); + + $collections = Media::getCollectionList(); + foreach ( $collections as $name => $desc ) + { + $data = array( + 'name' => $name, + 'desc' => $desc + ); + + if ( $plugin->collection == $name ) + { + $data['selected'] = 'selected="selected"'; + } + + $this->parser->parse(Template::fill($plugin->getOption('collectionlist_body'), $data)); + } + + $data = array( + 'actionurl' => "{$CONF['ActionURL']}?action=plugin&type=medium", + 'collection' => $plugin->collection + ); + $this->parser->parse(Template::fill($plugin->getOption('collectionlist_foot'), $data)); + } + + public function parse_medialist() + { + global $CONF, $manager; + + $plugin = $manager->getPlugin('NP_Medium'); + + $data = array( + 'actionurl' => "{$CONF['ActionURL']}?action=plugin&type=medium", + 'collection' => $plugin->collection, + 'description' => $plugin->description + ); + $this->parser->parse(Template::fill($plugin->getOption('medialist_head'), $data)); + + $image_template = $plugin->getOption('medialist_body_image'); + $other_template = $plugin->getOption('medialist_body_other'); + + foreach ( $plugin->media as $medium ) + { + $data = array( + 'mime' => $medium->mime, + 'collection' => $medium->collection, + 'filename' => $medium->filename, + 'shortfilename' => Entity::shorten($medium->filename, 24, '...'), + 'prefix' => $medium->prefix, + 'name' => $medium->name, + 'suffix' => $medium->suffix, + 'timestamp' => date("Y-m-d", $medium->timestamp), + 'size' => $medium->size, + 'width' => $medium->width, + 'height' => $medium->height, + 'mediumurl' => "{$CONF['MediaURL']}{$medium->collection}/{$medium->filename}" + ); + + if ( !array_key_exists($medium->mime, Media::$image_mime) ) + { + $this->parser->parse(Template::fill($other_template, $data)); + } + else + { + $this->parser->parse(Template::fill($image_template, $data)); + } + } + + $data = array(); + $this->parser->parse(Template::fill($plugin->getOption('medialist_foot'), $data)); + + return; + } + + protected function checkCondition($field, $name='', $value = '') + { + global $manager; + + $plugin = $manager->getPlugin('NP_Medium'); + + $condition = 0; + switch ( $field ) + { + case 'prev': + $condition = (boolean) ($plugin->prev != $plugin->offset ); + break; + case 'next': + $condition = (boolean) $plugin->next; + break; + default: + break; + } + return $condition; + } +} diff --git a/nucleus/plugins/medium/locales/en_Latn_US.UTF-8.php b/nucleus/plugins/medium/locales/en_Latn_US.UTF-8.php new file mode 100644 index 0000000..b3101db --- /dev/null +++ b/nucleus/plugins/medium/locales/en_Latn_US.UTF-8.php @@ -0,0 +1,9 @@ + -1 ) + { + document.getElementById('input' + nonie_FormType).scrollTop = scrollTop; + } + } + else if ( textEl ) + { + textEl.value += text; + } + else + { + document.getElementById('input' + nonie_FormType).value += text; + if ( scrollTop > -1 ) + { + document.getElementById('input' + nonie_FormType).scrollTop = scrollTop; + } + } + /* updAllPreviews() is on main window */ + updAllPreviews(); + return; +} + +medium.includeImage = function(collection, filename, type, width, height) +{ + var fullName; + var replaceBy; + + if ( this.isCaretEmpty() ) + { + text = prompt("Text to display ?", filename); + } + else + { + text = this.getCaretText(); + } + + /* + * add collection name when not private collection + * (or editing a message that's not your) + */ + if ( isNaN(collection) || (nucleusAuthorId != collection) ) + { + fullName = collection + '/' + filename; + } + else + { + fullName = filename; + } + + switch ( type ) + { + case 'popup': + replaceBy = '<%popup(' + fullName + '|'+width+'|'+height+'|' + text +')%>'; + break; + case 'inline': + default: + replaceBy = '<%image(' + fullName + '|'+width+'|'+height+'|' + text +')%>'; + break; + } + + this.insertAtCaret(replaceBy); + return; +} + +medium.includeOtherMedia = function(collection, filename) +{ + var fullName; + var replaceBy; + + if ( this.isCaretEmpty() ) + { + text = prompt("Text to display ?",filename); + } + else + { + text = getCaretText(); + } + + // add collection name when not private collection (or editing a message that's not your) + if ( isNaN(collection) || (nucleusAuthorId != collection) ) + { + fullName = collection + '/' + filename; + } + else + { + fullName = filename; + } + + replaceBy = '<%media(' + fullName + '|' + text +')%>'; + + this.insertAtCaret(replaceBy); + return; +} + +/* for sub window */ +medium.setType = function(value) +{ + this.type = value; +}; + +medium.chooseImage = function(collection, filename, width, height) +{ + if ( this.type != 'inline' ) + { + this.type = 'popup'; + } + + window.close(); + window.opener.focus(); + window.opener.medium.includeImage(collection, filename, this.type, width, height); + return; +} + +medium.chooseOther = function(collection, filename) +{ + + window.close(); + window.opener.focus(); + window.opener.medium.type = this.type; + window.opener.medium.includeOtherMedia(collection, filename); + return; +} diff --git a/nucleus/plugins/medium/skins/choose.skn b/nucleus/plugins/medium/skins/choose.skn new file mode 100644 index 0000000..3262c0e --- /dev/null +++ b/nucleus/plugins/medium/skins/choose.skn @@ -0,0 +1,31 @@ +<%pagehead%> + +

<%text(_UPLOAD_TITLE)%>

+ +

<%text(_UPLOAD_MSG)%>

+ +
+ +

+File: + +

+ +

<%text(_SETTINGS_ALLOWUPLOADTYPES)%>: <%conf(AllowedTypes)%>

+ +

+<%collectionlist%> +

+ +<%pluginextras%> + +

+<%ticket%> + + + +

+ +
+ +<%pagefoot%> diff --git a/nucleus/plugins/medium/skins/error.skn b/nucleus/plugins/medium/skins/error.skn new file mode 100644 index 0000000..2d444ca --- /dev/null +++ b/nucleus/plugins/medium/skins/error.skn @@ -0,0 +1,7 @@ +<%pagehead%> + +

<%text(_ERROR)%>

+

<%message%>

+

<%text(_BACK)%>

+ +<%pagefoot%> diff --git a/nucleus/plugins/medium/skins/login.skn b/nucleus/plugins/medium/skins/login.skn new file mode 100644 index 0000000..4d71604 --- /dev/null +++ b/nucleus/plugins/medium/skins/login.skn @@ -0,0 +1,25 @@ +<%pagehead%> + +

<%text(_LOGIN_PLEASE)%>

+ +
+ +
+
<%text(_LOGINFORM_NAME)%>
+
+
<%text(_LOGINFORM_PWD)%>
+
+
+ +

+ + + + +

+ +
+ +

<%text(_POPUP_CLOSE)%>

+ +<%pagefoot%> diff --git a/nucleus/plugins/medium/skins/pagefoot.skn b/nucleus/plugins/medium/skins/pagefoot.skn new file mode 100644 index 0000000..691287b --- /dev/null +++ b/nucleus/plugins/medium/skins/pagefoot.skn @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/nucleus/plugins/medium/skins/pagehead.skn b/nucleus/plugins/medium/skins/pagehead.skn new file mode 100644 index 0000000..e7d34c9 --- /dev/null +++ b/nucleus/plugins/medium/skins/pagehead.skn @@ -0,0 +1,8 @@ + + + +Nucleus Media + + + + diff --git a/nucleus/plugins/medium/skins/select.skn b/nucleus/plugins/medium/skins/select.skn new file mode 100644 index 0000000..b5c4064 --- /dev/null +++ b/nucleus/plugins/medium/skins/select.skn @@ -0,0 +1,48 @@ +<%pagehead%> + +
+

+ +<%collectionlist%> + + + + +

+ +

+ + + + +

+ +
+ +<%medialist%> + +

+ +<%if(prev)%> + +<%text(_LISTS_PREV)%> + +<%endif%> +<%if(next)%> + +<%text(_LISTS_NEXT)%> + +<%endif%> + + + + + + +

+ +<%pagefoot%> diff --git a/nucleus/plugins/medium/styles/medium.css b/nucleus/plugins/medium/styles/medium.css new file mode 100644 index 0000000..81bfb20 --- /dev/null +++ b/nucleus/plugins/medium/styles/medium.css @@ -0,0 +1,59 @@ +body { + font-family: verdana, arial; + font-size: small; + background-color: #FFFFFF; + color: #000000; +} + +a:link, a:visited { + color: #1D3565; + font-weight: bold; + text-decoration: none; +} +a:hover { + text-decoration: underline; +} + +h1 { + border-bottom: 1px dotted gray; + font-size: x-large; + color: #596d9d; +} + +h2 { + color: gray; + font-size: large; + margin-left: 20px; + text-indent: 10px; + border-bottom: 1px solid #ddd; +} + +table { + border: none; + width: 100%; +} + +table th { + background-color: linen; + font-size: medium; +} + +table th, +table td { + padding: 5px; +} + +table td { + background-color: #dddddd; + font-size: small; + vertical-align: top; + text-align: left; +} + +p { + margin: 0px 0px 5px 0px +} + +label { + cursor: pointer; +} \ No newline at end of file diff --git a/skins/admin/bookmarklet/javascripts/edit.js b/skins/admin/bookmarklet/javascripts/edit.js index 0faa6da..131860c 100644 --- a/skins/admin/bookmarklet/javascripts/edit.js +++ b/skins/admin/bookmarklet/javascripts/edit.js @@ -137,14 +137,17 @@ var nonie_FormType = 'body'; // Add media to new item function addMedia() { - - var mediapopup = window.open(nucleusMediaPopupURL + 'media.php','name', - 'status=yes,toolbar=no,scrollbars=yes,resizable=yes,width=500,height=450,top=0,left=0'); - - return; + if ( typeof(medium) != 'undefined' ) + { + medium.addMedia(); + } + else + { + var mediapopup = window.open(nucleusMediaPopupURL + 'media.php','name', + 'status=yes,toolbar=no,scrollbars=yes,resizable=yes,width=500,height=450,top=0,left=0'); + } } - function setMediaPopupURL(url) { nucleusMediaPopupURL = url; } diff --git a/skins/admin/default/javascripts/edit.js b/skins/admin/default/javascripts/edit.js index 0faa6da..adf6fa5 100644 --- a/skins/admin/default/javascripts/edit.js +++ b/skins/admin/default/javascripts/edit.js @@ -136,15 +136,20 @@ function execAndUpdate(action) { var nonie_FormType = 'body'; // Add media to new item -function addMedia() { - - var mediapopup = window.open(nucleusMediaPopupURL + 'media.php','name', - 'status=yes,toolbar=no,scrollbars=yes,resizable=yes,width=500,height=450,top=0,left=0'); - +function addMedia() +{ + if ( typeof(medium) != 'undefined' ) + { + medium.addMedia(); + } + else + { + var mediapopup = window.open(nucleusMediaPopupURL + 'media.php','name', + 'status=yes,toolbar=no,scrollbars=yes,resizable=yes,width=500,height=450,top=0,left=0'); + } return; } - function setMediaPopupURL(url) { nucleusMediaPopupURL = url; } -- 2.11.0