1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 20:57:26 +02:00

admin UI - better 'layout' type interface; old featurebox 'method' disabled, shortcode handler reset scClass object method added (start of 'functions to methods' task)

This commit is contained in:
secretr
2009-12-12 16:40:41 +00:00
parent 361b05ce6f
commit 84c75d3c5b
6 changed files with 121 additions and 49 deletions

View File

@@ -3099,6 +3099,10 @@ class e_admin_ui extends e_admin_controller_ui
$this->getTreeModel()->setMessages(); $this->getTreeModel()->setMessages();
} }
} }
else
{
$this->getTreeModel()->setMessages();// errors
}
} }
} }
@@ -3205,7 +3209,6 @@ class e_admin_ui extends e_admin_controller_ui
*/ */
function EditHeader() function EditHeader()
{ {
// TODO - make it part of e_from::textarea/bbarea(), invoke it on className (not all textarea elements)
e107::getJs()->requireCoreLib('core/admin.js'); e107::getJs()->requireCoreLib('core/admin.js');
} }

View File

@@ -9,9 +9,9 @@
* e107 Main * e107 Main
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/e107_class.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/e107_class.php,v $
* $Revision: 1.92 $ * $Revision: 1.93 $
* $Date: 2009-12-12 11:01:03 $ * $Date: 2009-12-12 16:40:41 $
* $Author: e107coders $ * $Author: secretr $
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
@@ -1216,14 +1216,15 @@ class e107
* @param string|null $key * @param string|null $key
* @param boolean $override see {@link getThemeInfo()) * @param boolean $override see {@link getThemeInfo())
* @param boolean $merge merge theme with core templates, default is false * @param boolean $merge merge theme with core templates, default is false
* @param boolean $info retrieve template info only
* @return string|array * @return string|array
*/ */
public static function getCoreTemplate($id, $key = null, $override = true, $merge = false) public static function getCoreTemplate($id, $key = null, $override = true, $merge = false, $info = false)
{ {
$reg_path = 'core/e107/templates/'.$id.($override ? '/ext' : ''); $reg_path = 'core/e107/templates/'.$id.($override ? '/ext' : '');
$path = self::coreTemplatePath($id, $override); $path = self::coreTemplatePath($id, $override);
$id = str_replace('/', '_', $id); $id = str_replace('/', '_', $id);
$ret = self::_getTemplate($id, $key, $reg_path, $path); $ret = self::_getTemplate($id, $key, $reg_path, $path, $info);
if(!$merge || !$override || !is_array($ret)) if(!$merge || !$override || !is_array($ret))
{ {
return $ret; return $ret;
@@ -1233,7 +1234,7 @@ class e107
$reg_path = 'core/e107/templates/'.$id; $reg_path = 'core/e107/templates/'.$id;
$path = self::coreTemplatePath($id, false); $path = self::coreTemplatePath($id, false);
$id = str_replace('/', '_', $id); $id = str_replace('/', '_', $id);
$ret_core = self::_getTemplate($id, $key, $reg_path, $path); $ret_core = self::_getTemplate($id, $key, $reg_path, $path, $info);
return (is_array($ret_core) ? array_merge($ret_core, $ret) : $ret); return (is_array($ret_core) ? array_merge($ret_core, $ret) : $ret);
} }
@@ -1261,14 +1262,15 @@ class e107
* @param string|null $key * @param string|null $key
* @param boolean $override see {@link getThemeInfo()) * @param boolean $override see {@link getThemeInfo())
* @param boolean $merge merge theme with plugin templates, default is false * @param boolean $merge merge theme with plugin templates, default is false
* @param boolean $info retrieve template info only
* @return string|array * @return string|array
*/ */
public static function getTemplate($plug_name, $id, $key = null, $override = true, $merge = false) public static function getTemplate($plug_name, $id, $key = null, $override = true, $merge = false, $info = false)
{ {
$reg_path = 'plugin/'.$plug_name.'/templates/'.$id.($override ? '/ext' : ''); $reg_path = 'plugin/'.$plug_name.'/templates/'.$id.($override ? '/ext' : '');
$path = self::templatePath($plug_name, $id, $override); $path = self::templatePath($plug_name, $id, $override);
$id = str_replace('/', '_', $id); $id = str_replace('/', '_', $id);
$ret = self::_getTemplate($id, $key, $reg_path, $path); $ret = self::_getTemplate($id, $key, $reg_path, $path, $info);
if(!$merge || !$override || !is_array($ret)) if(!$merge || !$override || !is_array($ret))
{ {
return $ret; return $ret;
@@ -1278,29 +1280,60 @@ class e107
$reg_path = 'plugin/'.$plug_name.'/templates/'.$id; $reg_path = 'plugin/'.$plug_name.'/templates/'.$id;
$path = self::templatePath($plug_name, $id, false); $path = self::templatePath($plug_name, $id, false);
$id = str_replace('/', '_', $id); $id = str_replace('/', '_', $id);
$ret_plug = self::_getTemplate($id, $key, $reg_path, $path); $ret_plug = self::_getTemplate($id, $key, $reg_path, $path, $info);
return (is_array($ret_plug) ? array_merge($ret_plug, $ret) : $ret); return (is_array($ret_plug) ? array_merge($ret_plug, $ret) : $ret);
} }
/**
* Get Template Info array.
* Note: Available only after getTemplate()/getCoreTemplate() call
*
* @param string $plug_name if null - search for core template
* @param string $id
* @param string $key
* @param boolean $override
* @param boolean $merge
* @return array
*/
public function getTemplateInfo($plug_name = null, $id, $key = null, $override = true, $merge = false)
{
if($plug_name)
{
$ret = self::getTemplate($plug_name, $id, null, $override, $merge, true);
}
else
{
$ret = self::getCoreTemplate($id, null, $override, $merge, true);
}
if($key && isset($ret[$key]) && is_array($ret[$key]))
{
return $ret[$key];
}
return $ret;
}
/** /**
* Return a list of available template IDs for a plugin(eg. $MYTEMPLATE['my_id'] -> array('id' => 'My Id')) * Return a list of available template IDs for a plugin(eg. $MYTEMPLATE['my_id'] -> array('id' => 'My Id'))
* @param string $plugin_name * @param string $plugin_name
* @param string $template_id [optional] if different from $plugin_name; * @param string $template_id [optional] if different from $plugin_name;
* @param mixed $where true - current theme, 'admin' - admin theme, 'front' (default) - front theme * @param mixed $where true - current theme, 'admin' - admin theme, 'front' (default) - front theme
* @param boolean $merge merge theme with core/plugin layouts, default is false * @param boolean $merge merge theme with core/plugin layouts, default is false
* @param boolean $allinfo reutrn nimerical array of templates and all available template information
* @return array * @return array
*/ */
public static function getLayouts($plugin_name, $template_id = '', $where = 'front', $filter_mask = '', $merge = false) public static function getLayouts($plugin_name, $template_id = '', $where = 'front', $filter_mask = '', $merge = false, $allinfo = true)
{ {
if(!$plugin_name) // Core template if(!$plugin_name) // Core template
{ {
$tmp = self::getCoreTemplate($template_id, null, $where, $merge); $tmp = self::getCoreTemplate($template_id, null, $where, $merge);
$tmp_info = self::getTemplateInfo(null, $template_id, null, $where, $merge);
} }
else // Plugin template else // Plugin template
{ {
$id = (!$template_id) ? $plugin_name : $template_id; $id = (!$template_id) ? $plugin_name : $template_id;
$tmp = self::getTemplate($plugin_name, $id, null, $where, $merge); $tmp = self::getTemplate($plugin_name, $id, null, $where, $merge);
$tmp_info = self::getTemplateInfo($plugin_name, $id, null, $where, $merge);
} }
$templates = array(); $templates = array();
@@ -1314,11 +1347,6 @@ class e107
} }
foreach($tmp as $key => $val) foreach($tmp as $key => $val)
{ {
// Special key INFO in format aray('layout' => array(info))
if($key == '__INFO__')
{
continue;
}
$match = true; $match = true;
if($filter_mask) if($filter_mask)
{ {
@@ -1333,44 +1361,51 @@ class e107
} }
if(!$match) continue; if(!$match) continue;
} }
if(isset($tmp['__INFO__'][$key])) if(isset($tmp_info[$key]))
{ {
$templates[$key] = defset($tmp['__INFO__'][$key]['title'], $tmp['__INFO__'][$key]['title']); $templates[$key] = defset($tmp_info[$key]['title'], $tmp_info[$key]['title']);
continue; continue;
} }
$templates[$key] = implode(' ', array_map('ucfirst', explode('_', $key))); //TODO add LANS? $templates[$key] = implode(' ', array_map('ucfirst', explode('_', $key))); //TODO add LANS?
} }
return $templates; return ($allinfo ? array($templates, $tmp_info) : $templates);
} }
/** /**
* More abstsract template loader, used * More abstsract template loader, used
* internal in {@link getTemplate()} and {@link getCoreTemplate()} methods * internal in {@link getTemplate()} and {@link getCoreTemplate()} methods
* If $info is set to true, only template informational array will be returned
* *
* @param string $id * @param string $id
* @param string|null $key * @param string|null $key
* @param string $reg_path * @param string $reg_path
* @param string $default_path * @param string $path
* @param string $override_path * @param boolean $info
* @return string|array * @return string|array
*/ */
public static function _getTemplate($id, $key, $reg_path, $path) public static function _getTemplate($id, $key, $reg_path, $path, $info = false)
{ {
$regPath = $reg_path; $regPath = $reg_path;
$var = strtoupper($id).'_TEMPLATE'; $var = strtoupper($id).'_TEMPLATE';
$regPathInfo = $reg_path.'/info';
$var_info = strtoupper($id).'_INFO';
if(null === self::getRegistry($regPath)) if(null === self::getRegistry($regPath))
{ {
(deftrue('E107_DEBUG_LEVEL') ? include_once($path) : @include_once($path)); (deftrue('E107_DEBUG_LEVEL') ? include_once($path) : @include_once($path));
self::setRegistry($regPath, (isset($$var) ? $$var : array())); self::setRegistry($regPath, (isset($$var) ? $$var : array()));
} }
if(null === self::getRegistry($regPathInfo))
{
self::setRegistry($regPathInfo, (isset($$var_info) && is_array($$var_info) ? $$var_info : array()));
}
$ret = (!$info ? self::getRegistry($regPath) : self::getRegistry($regPathInfo));
if(!$key) if(!$key)
{ {
return self::getRegistry($regPath); return $ret;
} }
$ret = self::getRegistry($regPath); return ($ret && is_array($ret) && isset($ret[$key]) ? $ret[$key] : '');
return ($ret && is_array($ret) && isset($ret[$key]) ? $ret[$key] : (is_array($ret) ? array() : ''));
} }
/** /**

View File

@@ -9,9 +9,9 @@
* Form Handler * Form Handler
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $
* $Revision: 1.96 $ * $Revision: 1.97 $
* $Date: 2009-12-11 00:51:19 $ * $Date: 2009-12-12 16:40:40 $
* $Author: e107coders $ * $Author: secretr $
* *
*/ */
@@ -407,14 +407,14 @@ class e_form
} }
function radio_multi($name, $elements, $checked, $multi_line = false) function radio_multi($name, $elements, $checked, $multi_line = false, $help = array())
{ {
$text = array(); $text = array();
if(is_string($elements)) parse_str($elements, $elements); if(is_string($elements)) parse_str($elements, $elements);
foreach ($elements as $value => $label) foreach ($elements as $value => $label)
{ {
$text[] = $this->radio($name, $value, $checked == $value)."".$this->label($label, $name, $value); $text[] = $this->radio($name, $value, $checked == $value)."".$this->label($label, $name, $value).(isset($help[$value]) ? "<div class='field-help'>".$help[$value]."</div>" : '');
} }
if(!$multi_line) if(!$multi_line)
return implode("&nbsp;&nbsp;", $text); return implode("&nbsp;&nbsp;", $text);
@@ -1351,12 +1351,23 @@ class e_form
$where = vartrue($parms['area'], 'front'); //default is 'front' $where = vartrue($parms['area'], 'front'); //default is 'front'
$filter = varset($parms['filter']); $filter = varset($parms['filter']);
$merge = vartrue($parms['merge']) ? true : false; $merge = vartrue($parms['merge']) ? true : false;
$layouts = e107::getLayouts($location, $ilocation, $where, $filter, $merge); $layouts = e107::getLayouts($location, $ilocation, $where, $filter, $merge, true);
if(varset($parms['default']) && !isset($layouts['default'])) if(varset($parms['default']) && !isset($layouts[0]['default']))
{ {
$layouts = array('default' => $parms['default']) + $layouts; $layouts[0] = array('default' => $parms['default']) + $layouts[0];
} }
return (vartrue($parms['raw']) ? $layouts : $this->selectbox($key, $layouts, $value)); $info = array();
if($layouts[1])
{
foreach ($layouts[1] as $key => $info_array)
{
if(isset($info_array['description']))
$info[$key] = defset($info_array['description'], $info_array['description']);
}
}
//$this->selectbox($key, $layouts, $value)
return (vartrue($parms['raw']) ? $layouts[0] : $this->radio_multi($key, $layouts[0], $value, true, $info));
break; break;
case 'templates': //to do - exclude param (exact match) case 'templates': //to do - exclude param (exact match)

View File

@@ -9,9 +9,9 @@
* e107 Shortcode handler * e107 Shortcode handler
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/shortcode_handler.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/shortcode_handler.php,v $
* $Revision: 1.38 $ * $Revision: 1.39 $
* $Date: 2009-11-23 10:27:42 $ * $Date: 2009-12-12 16:40:41 $
* $Author: e107coders $ * $Author: secretr $
*/ */
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
@@ -303,6 +303,14 @@ class e_shortcode
return in_array($code, $this->registered_codes); return in_array($code, $this->registered_codes);
} }
public function resetScClass($className, $object)
{
if($this->isScClass($className))
{
$this->scClasses[$className] = $object;
}
}
function isScClass($className) function isScClass($className)
{ {
return isset($this->scClasses[$className]); return isset($this->scClasses[$className]);

View File

@@ -9,8 +9,8 @@
* Featurebox administration * Featurebox administration
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/admin_config.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/admin_config.php,v $
* $Revision: 1.13 $ * $Revision: 1.14 $
* $Date: 2009-12-10 22:46:45 $ * $Date: 2009-12-12 16:40:41 $
* $Author: secretr $ * $Author: secretr $
* *
*/ */
@@ -101,6 +101,19 @@ class fb_category_ui extends e_admin_ui
{ {
$new_data['fb_category_limit'] = 1; $new_data['fb_category_limit'] = 1;
} }
if(!varset($new_data['fb_category_template']))
{
$new_data['fb_category_template'] = 'default';
}
return $new_data;
}
public function beforeUpdate($new_data)
{
if(!varset($new_data['fb_category_template']))
{
$new_data['fb_category_template'] = 'default';
}
return $new_data; return $new_data;
} }

View File

@@ -9,9 +9,9 @@
* News frontend * News frontend
* *
* $Source: /cvs_backup/e107_0.8/news.php,v $ * $Source: /cvs_backup/e107_0.8/news.php,v $
* $Revision: 1.24 $ * $Revision: 1.25 $
* $Date: 2009-11-18 01:04:24 $ * $Date: 2009-12-12 16:40:39 $
* $Author: e107coders $ * $Author: secretr $
*/ */
require_once("class2.php"); require_once("class2.php");
@@ -478,10 +478,11 @@ if($newsCachedPage = checkCache($cacheString)) // normal news front-page - with
if(!$action) if(!$action)
{ {
if (isset($pref['fb_active'])) // Removed, themes should use {FEATUREBOX} shortcode instead
{ // if (isset($pref['fb_active']))
require_once(e_PLUGIN."featurebox/featurebox.php"); // {
} // require_once(e_PLUGIN."featurebox/featurebox.php");
// }
if (isset($pref['nfp_display']) && $pref['nfp_display'] == 1) if (isset($pref['nfp_display']) && $pref['nfp_display'] == 1)
{ {
require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php"); require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php");
@@ -545,9 +546,10 @@ switch($action)
require_once(HEADERF); require_once(HEADERF);
if(!$action) if(!$action)
{ {
if (isset($pref['fb_active'])){ // --->feature box // Removed, themes should use {FEATUREBOX} shortcode instead
require_once(e_PLUGIN."featurebox/featurebox.php"); // if (isset($pref['fb_active'])){ // --->feature box
} // require_once(e_PLUGIN."featurebox/featurebox.php");
// }
if (isset($pref['nfp_display']) && $pref['nfp_display'] == 1){ if (isset($pref['nfp_display']) && $pref['nfp_display'] == 1){
require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php"); require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php");