1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +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)
{
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)) ? "<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
{

View File

@@ -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 '<img src="'.$src.'" alt="'.$alt.'" class="'.$_class.'" />';
}
@@ -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;
}
}

View File

@@ -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