OSDN Git Service

<%itemtime%>タグをパースする度にイベント「PreAddItemForm」が発生するバグの修正
[nucleus-jp/nucleus-next.git] / nucleus / libs / AdminActions.php
index 58da74a..f09c6c6 100644 (file)
@@ -1187,16 +1187,37 @@ class AdminActions extends BaseActions
         */
        public function parse_defadminskinselect($template_name)
        {
-               global $CONF;
-
+               global $CONF, $action;
+               
+               if ( $action == 'editmembersettings' )
+               {
+                       global $member;
+                       $default = $member->adminskin;
+               }
+               elseif ( $action == 'memberedit' )
+               {
+                       global $manager;
+                       $mem = $manager->getMember(intRequestVar('memberid'));
+                       $default = $mem->adminskin;
+               }
+               else
+               {
+                       $default = $CONF['AdminSkin'];
+               }
+               
                $query  = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname LIKE 'admin/%%'";
                $query = sprintf($query, sql_table('skin_desc'));
-
                $template = array(
                                'name'          => 'adminskin',
                                'tabindex'      => 10080,
-                               'selected'      => $CONF['AdminSkin']
+                               'selected'      => $default
                );
+               
+               if ( $this->skintype != 'settingsedit' )
+               {
+                       $template['extra'] = Entity::hsc(_MEMBERS_USESITELANG);
+               }
+               
                $this->parser->parse(showlist($query, 'select', $template, $template_name));
                return;
        }
@@ -1210,16 +1231,38 @@ class AdminActions extends BaseActions
         */
        public function parse_defbookmarkletselect($template_name)
        {
-               global $CONF;
-       
+               global $CONF, $action;
+               
+               if ( $action == 'editmembersettings' )
+               {
+                       global $member;
+                       $default = $member->bookmarklet;
+               }
+               elseif ( $action == 'memberedit' )
+               {
+                       global $manager;
+                       $mem = $manager->getMember(intRequestVar('memberid'));
+                       $default = $mem->bookmarklet;
+               }
+               else
+               {
+                       $default = $CONF['BookmarkletSkin'];
+               }
+               
                $query  = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname LIKE 'admin/%%'";
                $query = sprintf($query, sql_table('skin_desc'));
        
                $template = array(
                                'name'          => 'bookmarklet',
                                'tabindex'      => 10085,
-                               'selected'      => $CONF['BookmarkletSkin']
+                               'selected'      => $default
                );
+               
+               if ( $this->skintype != 'settingsedit' )
+               {
+                       $template['extra'] = Entity::hsc(_MEMBERS_USESITELANG);
+               }
+               
                $this->parser->parse(showlist($query, 'select', $template, $template_name));
                return;
        }
@@ -1332,7 +1375,7 @@ class AdminActions extends BaseActions
                {
                        $template['content']  = 'categorylist';
                        $template['tabindex'] = 200;
-                       $this->parser->parse(listplug_batchlist('category', $resource, 'table', $template));
+                       $this->parser->parse(listplug_batchlist('category', $resource, 'table', $template, $template_name));
                }
                else
                {
@@ -1475,7 +1518,7 @@ class AdminActions extends BaseActions
                        $template['content']  = 'teamlist';
                        $template['tabindex'] = 10;
                                
-                       $this->parser->parse(listplug_batchlist('team', $resource, 'table', $template));
+                       $this->parser->parse(listplug_batchlist('team', $resource, 'table', $template, $template_name));
                }
                else
                {
@@ -2210,7 +2253,7 @@ class AdminActions extends BaseActions
                        $template['content'] = 'memberlist';
                        $template['tabindex'] = 10;
                                
-                       $this->parser->parse(listplug_batchlist('member', $resource, 'table', $template));
+                       $this->parser->parse(listplug_batchlist('member', $resource, 'table', $template, $template_name));
                }
                else
                {
@@ -3287,7 +3330,7 @@ class AdminActions extends BaseActions
                                
                        $template['content'] = 'itemlist';
                                
-                       $this->parser->parse(listplug_navlist('item', $query, 'table', $template));
+                       $this->parser->parse(listplug_navlist('item', $query, 'table', $template, $template_name));
                }
                else
                {
@@ -3309,34 +3352,7 @@ class AdminActions extends BaseActions
        {
                global $manager;
                
-               $item = false;
-               $itemid = intRequestVar('itemid');
-               $item =& $manager->getItem($itemid, 1, 1);
-               
-               if ( $item )
-               {
-                       $blog =& $manager->getBlog($item['blogid']);
-                       
-                       if ( $blog->convertBreaks() && requestVar('action') == 'itemedit' )
-                       {
-                               $item['body'] = removeBreaks($item['body']);
-                               $item['more'] = removeBreaks($item['more']);
-                       }
-               }
-               
-               $contents = array();
-               if ( requestVar('action') == 'itemedit' )
-               {
-                       $contents = $item;
-               }
-               elseif ( requestVar('action') == 'createitem' )
-               {
-                       $data = array(
-                               'contents'      => &$contents,
-                               'blog'          => &$this->blog
-                       );
-                       $manager->notify('PreAddItemForm', $data);
-               }
+               $contents = Admin::$contents;
                $itemtime = getdate($contents['timestamp']);
                echo $itemtime[$key];
                return;
@@ -3377,62 +3393,74 @@ class AdminActions extends BaseActions
         */
        public function parse_localeselectoptions()
        {
-               global $manager;
+               global $CONF, $member;
                
                $locales = i18n::get_available_locale_list();
                
-               $memid = intRequestVar('memberid');
-               if ( $memid )
+               /* default option */
+               if ( $this->skintype == 'editmembersettings' )
                {
-                       $mem =& $manager->getMember($memid);
-                       if ( !$mem->getLocale() || !in_array($mem->getLocale(), $locales) )
-                       {
-                               echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
-                       }
-                       else
-                       {
-                               echo "<option value=\"\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
-                       }
+                       if ( !$member->getLocale() )\r
+                       {\r
+                               echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";\r
+                       }\r
+                       else\r
+                       {\r
+                               echo "<option value=\"\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";\r
+                       }\r
                }
                else
                {
-                       if ( !i18n::get_current_locale() || !in_array(i18n::get_current_locale(), $locales) )
-                       {
-                               echo "<option value=\"\" selected=\"selected\">en_Latn_US</option>\n";
-                       }
-                       else
-                       {
-                               echo "<option value=\"\">en_Latn_US</option>\n";
-                       }
+                       if ( $CONF['Locale'] == 'en_Latn_US' )\r
+                       {\r
+                               echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_LOCALE_EN_LATN_US) . "</option>\n";\r
+                       }\r
+                       else\r
+                       {\r
+                               echo "<option value=\"\">" . Entity::hsc(_LOCALE_EN_LATN_US) . "</option>\n";\r
+                       }\r
                }
+               
+               /* optional options */
                foreach ( $locales as $locale )
                {
-                       if ( $locale == 'en_Latn_US' )
+                       if ( $this->skintype == 'editmembersettings' )\r
                        {
-                               continue;
+                               if ( $locale != $member->getLocale() )\r
+                               {\r
+                                       echo "<option value=\"{$locale}\">";\r
+                               }\r
+                               else\r
+                               {\r
+                                       echo "<option value=\"{$locale}\" selected=\"selected\">";\r
+                               }
                        }
-                       else if ($memid)
+                       else
                        {
-                               if ( $locale == $mem->getLocale() )
+                               if ( $locale == 'en_Latn_US' )
                                {
-                                       echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
-                               }
-                               else
-                               {
-                                       echo "<option value=\"{$locale}\">{$locale}</option>\n";
+                                       /* already output */
+                                       continue;
                                }
+                               else if ( $locale != $CONF['Locale'] )\r
+                               {\r
+                                       echo "<option value=\"{$locale}\">";\r
+                               }\r
+                               else\r
+                               {\r
+                                       echo "<option value=\"{$locale}\" selected=\"selected\">";\r
+                               }\r
+                       }
+                       $label = '_LOCALE_' . strtoupper($locale);
+                       if ( !defined($label) )
+                       {
+                               echo $locale;
                        }
                        else
                        {
-                               if ( $locale == i18n::get_current_locale() )
-                               {
-                                       echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
-                               }
-                               else
-                               {
-                                       echo "<option value=\"{$locale}\">{$locale}</option>\n";
-                               }
+                               echo constant($label);
                        }
+                       echo "</option>\n";\r
                }
                return;
        }