mirror of
https://github.com/e107inc/e107.git
synced 2025-06-06 10:54:57 +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:
parent
361b05ce6f
commit
84c75d3c5b
@ -3099,6 +3099,10 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
$this->getTreeModel()->setMessages();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->getTreeModel()->setMessages();// errors
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3205,7 +3209,6 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
*/
|
||||
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');
|
||||
}
|
||||
|
||||
|
@ -9,9 +9,9 @@
|
||||
* e107 Main
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/e107_class.php,v $
|
||||
* $Revision: 1.92 $
|
||||
* $Date: 2009-12-12 11:01:03 $
|
||||
* $Author: e107coders $
|
||||
* $Revision: 1.93 $
|
||||
* $Date: 2009-12-12 16:40:41 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
@ -1216,14 +1216,15 @@ class e107
|
||||
* @param string|null $key
|
||||
* @param boolean $override see {@link getThemeInfo())
|
||||
* @param boolean $merge merge theme with core templates, default is false
|
||||
* @param boolean $info retrieve template info only
|
||||
* @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' : '');
|
||||
$path = self::coreTemplatePath($id, $override);
|
||||
$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))
|
||||
{
|
||||
return $ret;
|
||||
@ -1233,7 +1234,7 @@ class e107
|
||||
$reg_path = 'core/e107/templates/'.$id;
|
||||
$path = self::coreTemplatePath($id, false);
|
||||
$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);
|
||||
}
|
||||
@ -1261,14 +1262,15 @@ class e107
|
||||
* @param string|null $key
|
||||
* @param boolean $override see {@link getThemeInfo())
|
||||
* @param boolean $merge merge theme with plugin templates, default is false
|
||||
* @param boolean $info retrieve template info only
|
||||
* @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' : '');
|
||||
$path = self::templatePath($plug_name, $id, $override);
|
||||
$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))
|
||||
{
|
||||
return $ret;
|
||||
@ -1278,10 +1280,38 @@ class e107
|
||||
$reg_path = 'plugin/'.$plug_name.'/templates/'.$id;
|
||||
$path = self::templatePath($plug_name, $id, false);
|
||||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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'))
|
||||
@ -1289,18 +1319,21 @@ class e107
|
||||
* @param string $template_id [optional] if different from $plugin_name;
|
||||
* @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 $allinfo reutrn nimerical array of templates and all available template information
|
||||
* @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
|
||||
{
|
||||
$tmp = self::getCoreTemplate($template_id, null, $where, $merge);
|
||||
$tmp_info = self::getTemplateInfo(null, $template_id, null, $where, $merge);
|
||||
}
|
||||
else // Plugin template
|
||||
{
|
||||
$id = (!$template_id) ? $plugin_name : $template_id;
|
||||
$tmp = self::getTemplate($plugin_name, $id, null, $where, $merge);
|
||||
$tmp_info = self::getTemplateInfo($plugin_name, $id, null, $where, $merge);
|
||||
}
|
||||
|
||||
$templates = array();
|
||||
@ -1314,11 +1347,6 @@ class e107
|
||||
}
|
||||
foreach($tmp as $key => $val)
|
||||
{
|
||||
// Special key INFO in format aray('layout' => array(info))
|
||||
if($key == '__INFO__')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$match = true;
|
||||
if($filter_mask)
|
||||
{
|
||||
@ -1333,44 +1361,51 @@ class e107
|
||||
}
|
||||
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;
|
||||
}
|
||||
$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
|
||||
* 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|null $key
|
||||
* @param string $reg_path
|
||||
* @param string $default_path
|
||||
* @param string $override_path
|
||||
* @param string $path
|
||||
* @param boolean $info
|
||||
* @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;
|
||||
$var = strtoupper($id).'_TEMPLATE';
|
||||
$regPathInfo = $reg_path.'/info';
|
||||
$var_info = strtoupper($id).'_INFO';
|
||||
|
||||
if(null === self::getRegistry($regPath))
|
||||
{
|
||||
(deftrue('E107_DEBUG_LEVEL') ? include_once($path) : @include_once($path));
|
||||
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)
|
||||
{
|
||||
return self::getRegistry($regPath);
|
||||
return $ret;
|
||||
}
|
||||
$ret = self::getRegistry($regPath);
|
||||
return ($ret && is_array($ret) && isset($ret[$key]) ? $ret[$key] : (is_array($ret) ? array() : ''));
|
||||
return ($ret && is_array($ret) && isset($ret[$key]) ? $ret[$key] : '');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9,9 +9,9 @@
|
||||
* Form Handler
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $
|
||||
* $Revision: 1.96 $
|
||||
* $Date: 2009-12-11 00:51:19 $
|
||||
* $Author: e107coders $
|
||||
* $Revision: 1.97 $
|
||||
* $Date: 2009-12-12 16:40:40 $
|
||||
* $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();
|
||||
if(is_string($elements)) parse_str($elements, $elements);
|
||||
|
||||
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)
|
||||
return implode(" ", $text);
|
||||
@ -1351,12 +1351,23 @@ class e_form
|
||||
$where = vartrue($parms['area'], 'front'); //default is 'front'
|
||||
$filter = varset($parms['filter']);
|
||||
$merge = vartrue($parms['merge']) ? true : false;
|
||||
$layouts = e107::getLayouts($location, $ilocation, $where, $filter, $merge);
|
||||
if(varset($parms['default']) && !isset($layouts['default']))
|
||||
$layouts = e107::getLayouts($location, $ilocation, $where, $filter, $merge, true);
|
||||
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;
|
||||
|
||||
case 'templates': //to do - exclude param (exact match)
|
||||
|
@ -9,9 +9,9 @@
|
||||
* e107 Shortcode handler
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/shortcode_handler.php,v $
|
||||
* $Revision: 1.38 $
|
||||
* $Date: 2009-11-23 10:27:42 $
|
||||
* $Author: e107coders $
|
||||
* $Revision: 1.39 $
|
||||
* $Date: 2009-12-12 16:40:41 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
@ -303,6 +303,14 @@ class e_shortcode
|
||||
return in_array($code, $this->registered_codes);
|
||||
}
|
||||
|
||||
public function resetScClass($className, $object)
|
||||
{
|
||||
if($this->isScClass($className))
|
||||
{
|
||||
$this->scClasses[$className] = $object;
|
||||
}
|
||||
}
|
||||
|
||||
function isScClass($className)
|
||||
{
|
||||
return isset($this->scClasses[$className]);
|
||||
|
@ -9,8 +9,8 @@
|
||||
* Featurebox administration
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/admin_config.php,v $
|
||||
* $Revision: 1.13 $
|
||||
* $Date: 2009-12-10 22:46:45 $
|
||||
* $Revision: 1.14 $
|
||||
* $Date: 2009-12-12 16:40:41 $
|
||||
* $Author: secretr $
|
||||
*
|
||||
*/
|
||||
@ -101,6 +101,19 @@ class fb_category_ui extends e_admin_ui
|
||||
{
|
||||
$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;
|
||||
}
|
||||
|
||||
|
22
news.php
22
news.php
@ -9,9 +9,9 @@
|
||||
* News frontend
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/news.php,v $
|
||||
* $Revision: 1.24 $
|
||||
* $Date: 2009-11-18 01:04:24 $
|
||||
* $Author: e107coders $
|
||||
* $Revision: 1.25 $
|
||||
* $Date: 2009-12-12 16:40:39 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
|
||||
require_once("class2.php");
|
||||
@ -478,10 +478,11 @@ if($newsCachedPage = checkCache($cacheString)) // normal news front-page - with
|
||||
|
||||
if(!$action)
|
||||
{
|
||||
if (isset($pref['fb_active']))
|
||||
{
|
||||
require_once(e_PLUGIN."featurebox/featurebox.php");
|
||||
}
|
||||
// Removed, themes should use {FEATUREBOX} shortcode instead
|
||||
// if (isset($pref['fb_active']))
|
||||
// {
|
||||
// require_once(e_PLUGIN."featurebox/featurebox.php");
|
||||
// }
|
||||
if (isset($pref['nfp_display']) && $pref['nfp_display'] == 1)
|
||||
{
|
||||
require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php");
|
||||
@ -545,9 +546,10 @@ switch($action)
|
||||
require_once(HEADERF);
|
||||
if(!$action)
|
||||
{
|
||||
if (isset($pref['fb_active'])){ // --->feature box
|
||||
require_once(e_PLUGIN."featurebox/featurebox.php");
|
||||
}
|
||||
// Removed, themes should use {FEATUREBOX} shortcode instead
|
||||
// if (isset($pref['fb_active'])){ // --->feature box
|
||||
// require_once(e_PLUGIN."featurebox/featurebox.php");
|
||||
// }
|
||||
|
||||
if (isset($pref['nfp_display']) && $pref['nfp_display'] == 1){
|
||||
require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php");
|
||||
|
Loading…
x
Reference in New Issue
Block a user