1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 05:37:32 +02:00

admin UI imporvements and bugfixes; bugfixed new admin image functions ( _I(), _ITAG(), _IPATH() ); shortcode admin_icon works again for plugins;

This commit is contained in:
secretr
2012-01-17 14:46:28 +00:00
parent 65ed144ed7
commit e67fa5e10b
3 changed files with 41 additions and 11 deletions

View File

@@ -101,18 +101,34 @@ class admin_shortcodes
if (ADMIN) if (ADMIN)
{ {
global $e_sub_cat, $e_icon_array, $PLUGINS_DIRECTORY; 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(); $xml = e107::getXml();
/** /**
* @todo: folder and administration are deprecated. What replaces them? * @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 $xml->filter = array('folder' => FALSE, 'administration' => FALSE); // Just need one variable
$readFile = $xml->loadXMLfile('plugin.xml', true, true); $readFile = $xml->loadXMLfile(e_PLUGIN_DIR.'plugin.xml', 'advanced', true);
$eplug_icon = $readFile['folder'].'/'.$readFile['administration']['icon'];
$eplug_folder = $readFile['folder']; // 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')) elseif (is_readable('plugin.php'))
{ {
@@ -123,7 +139,8 @@ class admin_shortcodes
$icon = E_32_CAT_PLUG; $icon = E_32_CAT_PLUG;
return $icon; return $icon;
} }
$icon = ($eplug_icon && file_exists(e_PLUGIN.$eplug_icon)) ? "<img src='".e_PLUGIN_ABS.$eplug_icon."' alt='' class='icon S32' />" : E_32_CAT_PLUG;
$icon = ($eplug_icon && file_exists(e_PLUGIN.$eplug_folder.$eplug_icon)) ? "<img src='".e_PLUGIN_ABS.$eplug_folder.$eplug_icon."' alt='' class='icon S32' />" : E_32_CAT_PLUG;
} }
else else
{ {

View File

@@ -96,8 +96,8 @@ class e_admin_icons
} }
else else
{ {
$this->path = e_IMAGE_ABS.'/admin_images/'; $this->path = e_IMAGE_ABS.'admin_images/';
$this->relpath = e_IMAGE.'/admin_images/'; $this->relpath = e_IMAGE.'admin_images/';
} }
} }
@@ -111,6 +111,10 @@ class e_admin_icons
*/ */
public function url($name, $size = 16, $extension = 'png') public function url($name, $size = 16, $extension = 'png')
{ {
if($size)
{
$name .= '_'.$size;
}
return $this->path.$name.'.'.$extension; return $this->path.$name.'.'.$extension;
} }
@@ -129,14 +133,13 @@ class e_admin_icons
$_class = 'icon'; $_class = 'icon';
if($size) if($size)
{ {
$name .= '_'.$size;
$_class .= ' S'.$size; $_class .= ' S'.$size;
} }
if($class) if($class)
{ {
$_class .= ' '.$class; $_class .= ' '.$class;
} }
$src = $this->url($name, $extension); $src = $this->url($name, $size, $extension);
return '<img src="'.$src.'" alt="'.$alt.'" class="'.$_class.'" />'; return '<img src="'.$src.'" alt="'.$alt.'" class="'.$_class.'" />';
} }
@@ -151,6 +154,10 @@ class e_admin_icons
*/ */
public function path($name, $size = 16, $extension = 'png') public function path($name, $size = 16, $extension = 'png')
{ {
if($size)
{
$name .= '_'.$size;
}
return $this->relpath.$name.'.'.$extension; return $this->relpath.$name.'.'.$extension;
} }
} }

View File

@@ -1849,11 +1849,16 @@ class e_admin_controller
if($action) $request->setAction($action); if($action) $request->setAction($action);
if(!$path) $path = e_SELF; 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); $url = $path.'?'.$request->buildQueryString($merge_query, false, $exclude_query);
// Transfer all messages to session // Transfer all messages to session
e107::getMessage()->moveToSession(); e107::getMessage()->moveToSession();
// write session data // write session data
session_write_close(); session_write_close();
// do redirect // do redirect
header('Location: '.$url); header('Location: '.$url);
exit; exit;
@@ -3099,7 +3104,8 @@ class e_admin_controller_ui extends e_admin_controller
// where query // where query
if(count($searchQry) > 0) 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 // GROUP BY if needed