OSDN Git Service

Revert "FIX: ブックマークレットのメッセージ表示を可能に"
authorsakamocchi <o-takashi@sakamocchi.jp>
Fri, 18 May 2012 00:29:51 +0000 (09:29 +0900)
committersakamocchi <o-takashi@sakamocchi.jp>
Fri, 18 May 2012 00:29:51 +0000 (09:29 +0900)
This reverts commit 01e5066217c785c3defd7bc44f9bf86ad76139bb.

nucleus/bookmarklet.php
nucleus/libs/ADMIN.php
nucleus/libs/AdminActions.php
skins/admin/bookmarklet/skinbackup.xml

index 867f541..b7d39e1 100644 (file)
@@ -64,7 +64,7 @@ if ( !in_array($action, $aActionsNotToCheck) )
 {
        if ( !$manager->checkTicket() )
        {
-               bm_doError($skin, _ERROR_BADTICKET);
+               bm_doError(_ERROR_BADTICKET);
        }
 }
 
@@ -124,7 +124,7 @@ function bm_doAddItem($skin)
                $extrahead = '';
        }
        
-       bm_message($skin, _ITEM_ADDED, $message,$extrahead);
+       bm_message($skin, _ITEM_ADDED, _ITEM_ADDED, $message,$extrahead);
        
        return;
        
@@ -141,7 +141,7 @@ function bm_doEditItem($skin)
        // only allow if user is allowed to alter item
        if ( !$member->canUpdateItem($itemid, $catid) )
        {
-               bm_doError($skin, _ERROR_DISALLOWED);
+               bm_doError(_ERROR_DISALLOWED);
        }
        
        $body = postVar('body');
@@ -171,7 +171,7 @@ function bm_doEditItem($skin)
                // show error when sth goes wrong
                if ( !$catid )
                {
-                       bm_doError($skin, 'Could not create new category');
+                       bm_doError('Could not create new category');
                }
        }
        
@@ -194,7 +194,7 @@ function bm_doEditItem($skin)
                        $timestamp = 0;
                        break;
                default:
-                       bm_doError($skin, 'Something went wrong');
+                       bm_doError('Something went wrong');
        }
        
        // update item for real
@@ -205,21 +205,16 @@ function bm_doEditItem($skin)
                Item::delete($draftid);
        }
        
-       if ( $result['status'] == 'newcategory' )
+       // show success message
+       if ( $catid != intPostVar('catid') )
        {
-               $href           = "index.php?action=categoryedit&amp;blogid={$blogid}&amp;catid={$result['catid']}";
-               $onclick        = 'if (event &amp;&amp; event.preventDefault) event.preventDefault(); window.open(this.href); return false;';
-               $title          = _BOOKMARKLET_NEW_WINDOW;
-               $aTag           = " <a href=\"{$href}\" onclick=\"{$onclick}\" title=\"{$title}\">";
-               $message        = _BOOKMARKLET_NEW_CATEGORY . $aTag . _BOOKMARKLET_NEW_CATEGORY_EDIT . '</a>';
+               bm_message($skin, _ITEM_UPDATED, _ITEM_UPDATED, 'Item was added, and a new category was created. <a href="index.php?action=categoryedit&amp;blogid=' . $blog->getID() . '&amp;catid=' . $catid . '" onclick="if (event &amp;&amp; event.preventDefault) event.preventDefault(); window.open(this.href); return false;" title="Opens in new window">Click here to edit the name and description of the category.</a>', '');
        }
        else
        {
-               $message = _ITEM_ADDED;
+               bm_message($skin, _ITEM_UPDATED, _ITEM_UPDATED, _ITEM_UPDATED, '');
        }
        
-       // show success message
-       bm_message($skin, _ITEM_ADDED, $message, '');
        return;
 }
 
@@ -257,11 +252,11 @@ function bm_doShowForm($skin)
        
        if ( !Blog::existsID($blogid) )
        {
-               bm_doError($skin, _ERROR_NOSUCHBLOG);
+               bm_doError(_ERROR_NOSUCHBLOG);
        }
        else if ( !$member->isTeamMember($blogid) )
        {
-               bm_doError($skin, _ERROR_NOTONTEAM);
+               bm_doError(_ERROR_NOTONTEAM);
        }
        
        $blog =& $manager->getBlog($blogid);
@@ -300,7 +295,7 @@ function bm_doShowForm($skin)
        }
        
        Admin::$blog = &$blog;
-       Admin::$contents = &$item;
+       Admin::$item = &$item;
        
        Admin::setAdminAction('createitem');
        $skin->parse('createitem');
@@ -316,11 +311,11 @@ function bm_doEditForm($skin)
        
        if ( !$manager->existsItem($itemid, 0, 0) )
        {
-               bm_doError($skin, _ERROR_NOSUCHITEM);
+               bm_doError(_ERROR_NOSUCHITEM);
        }
        else if ( !$member->canAlterItem($itemid) )
        {
-               bm_doError($skin, _ERROR_DISALLOWED);
+               bm_doError(_ERROR_DISALLOWED);
        }
        
        $blog =& $manager->getBlog(getBlogIDFromItemID($itemid) );
@@ -339,7 +334,7 @@ function bm_doEditForm($skin)
        }
        
        Admin::$blog = &$blog;
-       Admin::$contents = &$item;
+       Admin::$item = &$item;
        
        Admin::setAdminAction('itemedit');
        $skin->parse('itemedit');
@@ -348,17 +343,13 @@ function bm_doEditForm($skin)
 
 function bm_doError($skin, $msg)
 {
-       bm_message($skin, _ERRORMSG, $msg);
+       bm_message($skin, _ERROR, _ERRORMSG, $msg);
        die;
 }
 
-function bm_message($skin, $title, $msg, $extrahead = '')
+function bm_message($skin, $title, $head, $msg, $extrahead = '')
 {
-       Admin::$extrahead = $extrahead;
-       Admin::$contents = array(
-               'title' => $title,
-               'msg'   => $msg
-       );
+       /* TODO: $title, $head, $msg, $extraheadを渡す */
        $skin->parse('adminerrorpage');
        
        return;
index 0bae7a4..5458fa9 100644 (file)
@@ -31,10 +31,10 @@ class Admin
 \r
        static private $action;\r
        static private $skin;\r
+       static private $extrahead;\r
        static private $passvar;\r
        static private $aOptions;\r
        \r
-       static public $extrahead;\r
        static public $blog;\r
        static public $contents;\r
        \r
index 3b8ccc5..de60245 100644 (file)
@@ -134,7 +134,6 @@ class AdminActions extends BaseActions
                'addtickettourl',
                'adminurl',
                'codename',
-               'contents',
                'customhelplink',
                'date',
                'extrahead',
@@ -535,13 +534,14 @@ class AdminActions extends BaseActions
                                break;
                        case 'createaccountinput':
                                $extra_actions = array(
+                                       'contents',
                                        'pluginextras',
                                        'eventformextra',
                                );\r
                                break;
                        case 'createaccountsuccess':
                                $extra_actions = array(\r
-                                       /* nothing special */
+                                       'contents',
                                );\r
                                break;
                        case 'createaccountdisable':
@@ -553,6 +553,7 @@ class AdminActions extends BaseActions
                                $extra_actions = array(
                                        'adminbloglink',
                                        'blogid',
+                                       'contents',
                                        'categories',
                                        'currenttime',
                                        'init',
@@ -601,6 +602,7 @@ class AdminActions extends BaseActions
                        case 'itemedit':
                                $extra_actions = array(
                                        'init',
+                                       'contents',
                                        'checkedonval',
                                        'categories',
                                        'currenttime',
index 3569e5c..55f6c67 100644 (file)
@@ -597,13 +597,11 @@ at
        </form>\r
 <%pagefoot%>]]></part>\r
 \r
-<part name="adminerrorpage"><![CDATA[\r
-<%pagehead%>\r
-<h2><%contents(title)%></h2>\r
-<p><%contents(msg)%></p>\r
-<p><a href="bookmarklet.php" onclick="window.close();window.opener.location.reload();"><%text(_POPUP_CLOSE)%></a></p>\r
-<%pagefoot%>\r
-]]></part>\r
+<part name="adminerrorpage"><![CDATA[<%pagehead%>\r
+<%headmessage%>\r
+<h2>Error!</h2>\r
+<p><a href="bookmarklet.php" onclick="window.close();window.opener.location.reload();"></a></p>\r
+<%pagefoot%>]]></part>\r
 \r
 </skin>\r
 <template name="admin/bookmarklet">\r