From e67fa5e10b889a908b84ef978d39d6a52d8d3636 Mon Sep 17 00:00:00 2001 From: secretr Date: Tue, 17 Jan 2012 14:46:28 +0000 Subject: [PATCH] admin UI imporvements and bugfixes; bugfixed new admin image functions ( _I(), _ITAG(), _IPATH() ); shortcode admin_icon works again for plugins; --- .../shortcodes/batch/admin_shortcodes.php | 29 +++++++++++++++---- e107_handlers/admin_handler.php | 15 +++++++--- e107_handlers/admin_ui.php | 8 ++++- 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/e107_core/shortcodes/batch/admin_shortcodes.php b/e107_core/shortcodes/batch/admin_shortcodes.php index 6e858532a..710a465bf 100644 --- a/e107_core/shortcodes/batch/admin_shortcodes.php +++ b/e107_core/shortcodes/batch/admin_shortcodes.php @@ -101,18 +101,34 @@ class admin_shortcodes if (ADMIN) { global $e_sub_cat, $e_icon_array, $PLUGINS_DIRECTORY; - if (strstr(e_SELF, $PLUGINS_DIRECTORY)) + if (e_CURRENT_PLUGIN) { - if (is_readable('plugin.xml')) + $eplug_icon = ''; + $eplug_folder = e_CURRENT_PLUGIN.'/'; + if (is_readable(e_PLUGIN_DIR.'plugin.xml')) { $xml = e107::getXml(); /** * @todo: folder and administration are deprecated. What replaces them? + * XXX removed folder (as not needed), admininstration[icon] should be replaced with 'icon' only (root xml var), looking in adminlinks for icons isn't that easy */ $xml->filter = array('folder' => FALSE, 'administration' => FALSE); // Just need one variable - $readFile = $xml->loadXMLfile('plugin.xml', true, true); - $eplug_icon = $readFile['folder'].'/'.$readFile['administration']['icon']; - $eplug_folder = $readFile['folder']; + $readFile = $xml->loadXMLfile(e_PLUGIN_DIR.'plugin.xml', 'advanced', true); + + // TODO - the better way to go - simple! + //$eplug_icon = $readFile['icon']; + + if(isset($readFile['adminLinks']['link']) && is_array($readFile['adminLinks']['link'])) + { + foreach ($readFile['adminLinks']['link'] as $data) + { + if(isset($data['@attributes']['primary']) && $data['@attributes']['primary'] && vartrue($data['@attributes']['icon'])) + { + $eplug_icon = $data['@attributes']['icon']; + break; + } + } + } } elseif (is_readable('plugin.php')) { @@ -123,7 +139,8 @@ class admin_shortcodes $icon = E_32_CAT_PLUG; return $icon; } - $icon = ($eplug_icon && file_exists(e_PLUGIN.$eplug_icon)) ? "" : E_32_CAT_PLUG; + + $icon = ($eplug_icon && file_exists(e_PLUGIN.$eplug_folder.$eplug_icon)) ? "" : E_32_CAT_PLUG; } else { diff --git a/e107_handlers/admin_handler.php b/e107_handlers/admin_handler.php index 7207b6809..233524d1e 100644 --- a/e107_handlers/admin_handler.php +++ b/e107_handlers/admin_handler.php @@ -96,8 +96,8 @@ class e_admin_icons } else { - $this->path = e_IMAGE_ABS.'/admin_images/'; - $this->relpath = e_IMAGE.'/admin_images/'; + $this->path = e_IMAGE_ABS.'admin_images/'; + $this->relpath = e_IMAGE.'admin_images/'; } } @@ -111,6 +111,10 @@ class e_admin_icons */ public function url($name, $size = 16, $extension = 'png') { + if($size) + { + $name .= '_'.$size; + } return $this->path.$name.'.'.$extension; } @@ -129,14 +133,13 @@ class e_admin_icons $_class = 'icon'; if($size) { - $name .= '_'.$size; $_class .= ' S'.$size; } if($class) { $_class .= ' '.$class; } - $src = $this->url($name, $extension); + $src = $this->url($name, $size, $extension); return ''.$alt.''; } @@ -151,6 +154,10 @@ class e_admin_icons */ public function path($name, $size = 16, $extension = 'png') { + if($size) + { + $name .= '_'.$size; + } return $this->relpath.$name.'.'.$extension; } } diff --git a/e107_handlers/admin_ui.php b/e107_handlers/admin_ui.php index 24ad4ff25..555b3bed4 100644 --- a/e107_handlers/admin_ui.php +++ b/e107_handlers/admin_ui.php @@ -1848,12 +1848,17 @@ class e_admin_controller if($mode) $request->setMode($mode); if($action) $request->setAction($action); if(!$path) $path = e_SELF; + + //prevent cache + header('Cache-Control: private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); + header('Pragma: no-cache'); $url = $path.'?'.$request->buildQueryString($merge_query, false, $exclude_query); // Transfer all messages to session e107::getMessage()->moveToSession(); // write session data session_write_close(); + // do redirect header('Location: '.$url); exit; @@ -3099,7 +3104,8 @@ class e_admin_controller_ui extends e_admin_controller // where query if(count($searchQry) > 0) { - $qry .= " WHERE ".implode(" AND ", $searchQry); + if(strpos($qry, ' WHERE ') !== false) $qry .= " WHERE ".implode(" AND ", $searchQry); + else $qry .= " AND ".implode(" AND ", $searchQry); } // GROUP BY if needed