mirror of
https://github.com/e107inc/e107.git
synced 2025-04-21 21:21:54 +02:00
admin UI: bugless Filter, everything should work fine now (with or without JS/Ajax); admin icons handler experiment; bugfixes; TODO list update
This commit is contained in:
parent
2357a64f36
commit
54e4e7a46c
@ -1,4 +1,19 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2001-2010 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* Administration UI handlers, admin helper functions
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/admin_handler.php,v $
|
||||
* $Revision: 1.25 $
|
||||
* $Date: 2009-11-12 16:55:50 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
// Better Array-sort by key function by acecream (22-Apr-2003 11:02) http://php.net/manual/en/function.asort.php
|
||||
@ -2294,6 +2309,43 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle requested filter dropdown value
|
||||
* @param string $value
|
||||
* @return array field -> value
|
||||
*/
|
||||
protected function _parseFilterRequest($filter_value)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
if(!$filter_value || $filter_value === '___reset___')
|
||||
{
|
||||
return array();
|
||||
}
|
||||
$filter = $tp->toDB(explode('__', $filter_value));
|
||||
$res = array();
|
||||
switch($filter[0])
|
||||
{
|
||||
case 'bool':
|
||||
// direct query
|
||||
$res = array($filter[1], $filter[2]);
|
||||
break;
|
||||
|
||||
default:
|
||||
//something like handleListUrlTypeFilter(); for custom handling of 'url_type' field name filters
|
||||
$method = 'handle'.$this->getRequest()->getActionName().$this->getRequest()->camelize($filter[0]).'Filter';
|
||||
if(method_exists($this, $method)) // callback handling
|
||||
{
|
||||
return $this->$method($filter[1], $selected);
|
||||
}
|
||||
else // default handling
|
||||
{
|
||||
$res = array($filter[0], $filter[1]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
protected function parseAliases()
|
||||
{
|
||||
// parse table
|
||||
@ -2452,8 +2504,9 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
}
|
||||
|
||||
$searchQuery = $tp->toDB($request->getQuery('searchquery', ''));
|
||||
list($filterField, $filterValue) = $tp->toDB(explode('__', $request->getQuery('filter_options', '')));
|
||||
|
||||
$searchFilter = $this->_parseFilterRequest($request->getQuery('filter_options', ''));
|
||||
list($filterField, $filterValue) = $searchFilter;
|
||||
|
||||
// FIXME - currently broken
|
||||
if($filterField && $filterValue !== '' && isset($this->fields[$filterField]))
|
||||
{
|
||||
@ -2565,7 +2618,7 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
if(false === $forceTo) $forceTo = $this->getPerPage();
|
||||
$qry .= ' LIMIT '.$from.', '.intval($forceTo);
|
||||
}
|
||||
|
||||
|
||||
return $qry;
|
||||
}
|
||||
|
||||
@ -2957,7 +3010,7 @@ class e_admin_form_ui extends e_form
|
||||
'id' => $this->getElementId(), // unique string used for building element ids, REQUIRED
|
||||
'pid' => $controller->getPrimaryName(), // primary field name, REQUIRED
|
||||
//'url' => e_SELF, default
|
||||
//'query' => e_QUERY, default
|
||||
//'query' => $request->buildQueryString(array(), true, 'ajax_used'), - ajax_used is now removed from QUERY_STRING - class2
|
||||
'head_query' => $request->buildQueryString('field=[FIELD]&asc=[ASC]&from=[FROM]', false), // without field, asc and from vars, REQUIRED
|
||||
'np_query' => $request->buildQueryString(array(), false, 'from'), // without from var, REQUIRED for next/prev functionality
|
||||
'legend' => $controller->getPluginTitle(), // hidden by default
|
||||
@ -2992,7 +3045,7 @@ class e_admin_form_ui extends e_form
|
||||
$input_options['id'] = false;
|
||||
$input_options['class'] = 'tbox input-text filter';
|
||||
$text = "
|
||||
<form method='get' action='".e_SELF."?".e_QUERY."'>
|
||||
<form method='get' action='".e_SELF."'>
|
||||
<fieldset class='e-filter'>
|
||||
<legend class='e-hideme'>Filter</legend>
|
||||
<div class='left'>
|
||||
@ -3019,7 +3072,7 @@ class e_admin_form_ui extends e_form
|
||||
e107::getJs()->footerInline("
|
||||
//autocomplete fields
|
||||
\$\$('input[name=searchquery]').each(function(el, cnt) {
|
||||
if(!cnt) el.focus();
|
||||
if(!cnt) el.activate();
|
||||
else return;
|
||||
new Ajax.Autocompleter(el, el.next('div.e-autocomplete'), '".e_SELF."?mode=".$l[0]."&action=filter', {
|
||||
paramName: 'searchquery',
|
||||
@ -3187,101 +3240,162 @@ class e_admin_form_ui extends e_form
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME - here because needed on AJAX calls (header.php not loaded), should be moved to separate file!
|
||||
if (!defined('ADMIN_TRUE_ICON'))
|
||||
/**
|
||||
* Experiment
|
||||
* Most basic & performance wise solution for admin icons override
|
||||
*/
|
||||
class e_admin_icons
|
||||
{
|
||||
define("ADMIN_TRUE_ICON", "<img class='icon action S16' src='".e_IMAGE_ABS."admin_images/true_16.png' alt='' />");
|
||||
define("ADMIN_TRUE_ICON_PATH", e_IMAGE."admin_images/true_16.png");
|
||||
/**
|
||||
* @var string icons absolute URL path
|
||||
*/
|
||||
protected $path;
|
||||
|
||||
/**
|
||||
* @var string icons relative server path
|
||||
*/
|
||||
protected $relpath;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
//XXX maybe we should use admintheme pref instead THEME here?
|
||||
if(is_readable(THEME.'icons/admin/'))
|
||||
{
|
||||
$this->path = THEME_ABS.'icons/admin/';
|
||||
$this->relpath = THEME.'icons/admin/';
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->path = e_IMAGE_ABS.'/admin_images/';
|
||||
$this->relpath = e_IMAGE.'/admin_images/';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get icon absolute path (url, without domain)
|
||||
*
|
||||
* @param string $name without size and extension e.g. 'edit'
|
||||
* @param integer size pixel , default 16
|
||||
* @param string $extension without leading dot, default 'png'
|
||||
* @return string icon url without domain
|
||||
*/
|
||||
public function url($name, $size = 16, $extension = 'png')
|
||||
{
|
||||
return $this->path.$name.'.'.$extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get image tag of an icon
|
||||
*
|
||||
* @param string $name without size and extension e.g. 'edit'
|
||||
* @param integer $size default 16
|
||||
* @param string $class default empty
|
||||
* @param string $alt default empty
|
||||
* @param string $extension default 'png'
|
||||
* @return string img tag
|
||||
*/
|
||||
public function tag($name, $size = 16, $class='', $alt = '', $extension = 'png')
|
||||
{
|
||||
$_class = 'icon';
|
||||
if($size)
|
||||
{
|
||||
$name .= '_'.$size;
|
||||
$_class .= ' S'.$size;
|
||||
}
|
||||
if($class)
|
||||
{
|
||||
$_class .= ' '.$class;
|
||||
}
|
||||
$src = $this->url($name, $extension);
|
||||
|
||||
return '<img src="'.$src.'" alt="'.$alt.'" class="'.$_class.'" />';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get icon relative server path
|
||||
*
|
||||
* @param string $name without size and extension e.g. 'edit'
|
||||
* @param integer size pixel , default 16
|
||||
* @param string $extension without leading dot, default 'png'
|
||||
* @return string icon relative server path
|
||||
*/
|
||||
public function path($name, $size = 16, $extension = 'png')
|
||||
{
|
||||
return $this->relpath.$name.'.'.$extension;
|
||||
}
|
||||
}
|
||||
|
||||
if (!defined('ADMIN_FALSE_ICON'))
|
||||
/**
|
||||
* Convenient proxy to e_admin_icons::url()
|
||||
* Get icon absolute path (url, without domain)
|
||||
* Example:
|
||||
* <code>
|
||||
* echo ___I('edit');
|
||||
* // If icon path is overloaded by current admin theme:
|
||||
* // '/e107_themes/current_theme/icons/admin/edit_16.png'
|
||||
* // else
|
||||
* // '/e107_images/admin_images/edit_16.png'
|
||||
* </code>
|
||||
*
|
||||
* @param string $name without size and extension e.g. 'edit'
|
||||
* @param integer size pixel , default 16
|
||||
* @param string $extension without leading dot, default 'png'
|
||||
* @return string icon url without domain
|
||||
*/
|
||||
function ___I($name, $size = 16, $extension = 'png')
|
||||
{
|
||||
define("ADMIN_FALSE_ICON", "<img class='icon action S16' src='".e_IMAGE_ABS."admin_images/false_16.png' alt='' />");
|
||||
define("ADMIN_FALSE_ICON_PATH", e_IMAGE."admin_images/false_16.png");
|
||||
return e107::getSingleton('e_admin_icons')->url($name, $size, $extension);
|
||||
}
|
||||
|
||||
if (!defined('ADMIN_EDIT_ICON'))
|
||||
/**
|
||||
* Convenient proxy to e_admin_icons::tag()
|
||||
* Get image tag of an icon
|
||||
* Example: <code>echo ___ITAG('edit');</code>
|
||||
* @see ___I()
|
||||
* @param string $name without size and extension e.g. 'edit'
|
||||
* @param integer $size default 16
|
||||
* @param string $class default empty
|
||||
* @param string $alt default empty
|
||||
* @param string $extension default 'png'
|
||||
* @return string img tag
|
||||
*/
|
||||
function ___ITAG($name, $size = 16, $class = '', $alt = '', $extension = 'png')
|
||||
{
|
||||
define("ADMIN_EDIT_ICON", "<img class='icon action S16' src='".e_IMAGE_ABS."admin_images/edit_16.png' alt='' title='".LAN_EDIT."' />");
|
||||
define("ADMIN_EDIT_ICON_PATH", e_IMAGE."admin_images/edit_16.png");
|
||||
return e107::getSingleton('e_admin_icons')->tag($name, $size, $class, $alt, $extension);
|
||||
}
|
||||
|
||||
if (!defined('ADMIN_DELETE_ICON'))
|
||||
/**
|
||||
* Convenient proxy to e_admin_icons::path()
|
||||
* Get icon relative server path
|
||||
* <code>
|
||||
* echo ___IPATH('edit');
|
||||
* // If icon path is overloaded by current admin theme:
|
||||
* // '../e107_themes/current_theme/icons/admin/edit_16.png'
|
||||
* // else
|
||||
* // '../e107_images/admin_images/edit_16.png'
|
||||
* </code>
|
||||
*
|
||||
* @param string $name without size and extension e.g. 'edit'
|
||||
* @param integer size pixel , default 16
|
||||
* @param string $extension without leading dot, default 'png'
|
||||
* @return string icon relative server path
|
||||
*/
|
||||
function ___IPATH($name, $size = 16, $extension = 'png')
|
||||
{
|
||||
define("ADMIN_DELETE_ICON", "<img class='icon action S16' src='".e_IMAGE_ABS."admin_images/delete_16.png' alt='' title='".LAN_DELETE."' />");
|
||||
define("ADMIN_DELETE_ICON_PATH", e_IMAGE."admin_images/delete_16.png");
|
||||
return e107::getSingleton('e_admin_icons')->path($name, $size, $extension);
|
||||
}
|
||||
|
||||
if (!defined('ADMIN_UP_ICON'))
|
||||
{
|
||||
define("ADMIN_UP_ICON", "<img class='icon action S16' src='".e_IMAGE_ABS."admin_images/up_16.png' alt='' title='".LAN_DELETE."' />");
|
||||
define("ADMIN_UP_ICON_PATH", e_IMAGE."admin_images/up_16.png");
|
||||
}
|
||||
|
||||
if (!defined('ADMIN_DOWN_ICON'))
|
||||
{
|
||||
define("ADMIN_DOWN_ICON", "<img class='icon action S16' src='".e_IMAGE_ABS."admin_images/down_16.png' alt='' title='".LAN_DELETE."' />");
|
||||
define("ADMIN_DOWN_ICON_PATH", e_IMAGE."admin_images/down_16.png");
|
||||
}
|
||||
|
||||
if (!defined('ADMIN_WARNING_ICON'))
|
||||
{
|
||||
define("ADMIN_WARNING_ICON", "<img class='icon action S16' src='".e_IMAGE_ABS."admin_images/warning_16.png' alt='' />");
|
||||
define("ADMIN_WARNING_ICON_PATH", e_IMAGE."admin_images/warning_16.png");
|
||||
}
|
||||
|
||||
if (!defined('ADMIN_INFO_ICON'))
|
||||
{
|
||||
define("ADMIN_INFO_ICON", "<img class='icon action S16' src='".e_IMAGE_ABS."admin_images/info_16.png' alt='' />");
|
||||
define("ADMIN_INFO_ICON_PATH", e_IMAGE."admin_images/info_16.png");
|
||||
}
|
||||
|
||||
if (!defined('ADMIN_CONFIGURE_ICON'))
|
||||
{
|
||||
define("ADMIN_CONFIGURE_ICON", "<img class='icon action S16' src='".e_IMAGE_ABS."admin_images/configure_16.png' alt='' />");
|
||||
define("ADMIN_CONFIGURE_ICON_PATH", e_IMAGE."admin_images/configure_16.png");
|
||||
}
|
||||
|
||||
if (!defined('ADMIN_ADD_ICON'))
|
||||
{
|
||||
define("ADMIN_ADD_ICON", "<img class='icon action S16' src='".e_IMAGE_ABS."admin_images/add_16.png' alt='' />");
|
||||
define("ADMIN_ADD_ICON_PATH", e_IMAGE."admin_images/add_16.png");
|
||||
}
|
||||
|
||||
if (!defined('ADMIN_VIEW_ICON'))
|
||||
{
|
||||
define("ADMIN_VIEW_ICON", "<img class='icon action S16' src='".e_IMAGE_ABS."admin_images/search_16.png' alt='' />");
|
||||
define("ADMIN_VIEW_ICON_PATH", e_IMAGE."admin_images/admin_images/search_16.png");
|
||||
}
|
||||
|
||||
if (!defined('ADMIN_URL_ICON'))
|
||||
{
|
||||
define("ADMIN_URL_ICON", "<img class='icon action S16' src='".e_IMAGE_ABS."admin_images/forums_16.png' alt='' />");
|
||||
define("ADMIN_URL_ICON_PATH", e_IMAGE."admin_images/forums_16.png");
|
||||
}
|
||||
|
||||
if (!defined('ADMIN_INSTALLPLUGIN_ICON'))
|
||||
{
|
||||
define("ADMIN_INSTALLPLUGIN_ICON", "<img class='icon action S16' src='".e_IMAGE_ABS."admin_images/plugin_install_16.png' alt='' />");
|
||||
define("ADMIN_INSTALLPLUGIN_ICON_PATH", e_IMAGE."admin_images/plugin_install_16.png");
|
||||
}
|
||||
|
||||
if (!defined('ADMIN_UNINSTALLPLUGIN_ICON'))
|
||||
{
|
||||
define("ADMIN_UNINSTALLPLUGIN_ICON", "<img class='icon action S16' src='".e_IMAGE_ABS."admin_images/plugin_uninstall_16.png' alt='' />");
|
||||
define("ADMIN_UNINSTALLPLUGIN_ICON_PATH", e_IMAGE."admin_images/plugin_unstall_16.png");
|
||||
}
|
||||
|
||||
if (!defined('ADMIN_UPGRADEPLUGIN_ICON'))
|
||||
{
|
||||
define("ADMIN_UPGRADEPLUGIN_ICON", "<img class='icon action S16' src='".e_IMAGE_ABS."admin_images/up_16.png' alt='' />");
|
||||
define("ADMIN_UPGRADEPLUGIN_ICON_PATH", e_IMAGE."admin_images/up_16.png");
|
||||
}
|
||||
include_once(e107::coreTemplatePath('admin_icons'));
|
||||
|
||||
/**
|
||||
* TODO:
|
||||
* 1. move abstract peaces of code to the proper classes
|
||||
* 2. remove duplicated code (e_form & e_admin_form_ui), refactoring
|
||||
* 2. [DONE - at least for alpha release] remove duplicated code (e_form & e_admin_form_ui), refactoring
|
||||
* 3. make JS Manager handle Styles (.css files and inline CSS)
|
||||
* 4. [DONE] e_form is missing some methods used in e_admin_form_ui
|
||||
* 5. [DONE] date convert needs string-to-datestamp auto parsing, strptime() is the solution but needs support for
|
||||
@ -3291,10 +3405,12 @@ if (!defined('ADMIN_UPGRADEPLUGIN_ICON'))
|
||||
* 7. clean up/document all object vars (e_admin_ui, e_admin_dispatcher)
|
||||
* 8. [DONE hopefully] clean up/document all parameters (get/setParm()) in controller and model classes
|
||||
* 9. [DONE] 'ip' field type - convert to human readable format while showing/editing record
|
||||
* 10. draggable ordering (list view)
|
||||
* 11. realtime search filter (typing text) - like downloads currently
|
||||
* 12. autosubmit when 'filter' dropdown is changed (quick fix?)
|
||||
* 10. draggable (or not?) ordering (list view)
|
||||
* 11. [DONE] realtime search filter (typing text) - like downloads currently
|
||||
* 12. [DONE] autosubmit when 'filter' dropdown is changed (quick fix?)
|
||||
* 13. tablerender captions
|
||||
* 14. [DONE] textareas auto-height
|
||||
* 15. [DONE] multi JOIN table support (optional), aliases
|
||||
* 16. tabs support (create/edit view)
|
||||
* 17. tree list view (should handle cases like Site Links admin page)
|
||||
*/
|
@ -9,8 +9,8 @@
|
||||
* Form Handler
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $
|
||||
* $Revision: 1.77 $
|
||||
* $Date: 2009-11-11 20:57:33 $
|
||||
* $Revision: 1.78 $
|
||||
* $Date: 2009-11-12 16:55:49 $
|
||||
* $Author: secretr $
|
||||
*
|
||||
*/
|
||||
@ -657,7 +657,6 @@ class e_form
|
||||
return rtrim(str_replace(array('[]', '[', ']', '_', '/'), array('-', '-', '', '-', '-'), $name), '-');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Format options based on the field type,
|
||||
* merge with default
|
||||
@ -765,10 +764,6 @@ class e_form
|
||||
return $def_options;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function columnSelector($columnsArray, $columnsDefault = '', $id = 'column_options')
|
||||
{
|
||||
$columnsArray = array_filter($columnsArray);
|
||||
@ -909,6 +904,7 @@ class e_form
|
||||
";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Render Table cells from field listing.
|
||||
* @param array $fieldarray - eg. $this->fields
|
||||
@ -917,7 +913,6 @@ class e_form
|
||||
* @param string $pid - eg. table_id
|
||||
* @return
|
||||
*/
|
||||
|
||||
function renderTableRow($fieldarray, $currentlist, $fieldvalues, $pid)
|
||||
{
|
||||
$cnt = 0;
|
||||
@ -1145,7 +1140,7 @@ class e_form
|
||||
break;
|
||||
|
||||
case 'boolean':
|
||||
$value = $value ? ADMIN_TRUE_ICON : '';// TODO - ADMIN_FALSE_ICON
|
||||
$value = $value ? ADMIN_TRUE_ICON : ADMIN_FALSE_ICON;
|
||||
break;
|
||||
|
||||
case 'url':
|
||||
@ -1162,7 +1157,7 @@ class e_form
|
||||
$value = call_user_func_array(array($this, $method), array($value, 'read', $parms));
|
||||
break;
|
||||
|
||||
//TODO - form_userclass, order,... and maybe more types
|
||||
//TODO - order
|
||||
|
||||
default:
|
||||
//unknown type
|
||||
@ -1214,16 +1209,16 @@ class e_form
|
||||
break;
|
||||
|
||||
case 'image': //TODO - thumb, image list shortcode, js tooltip...
|
||||
$label = varset($parms['label']);
|
||||
$label = varset($parms['label'], 'LAN_EDIT');
|
||||
unset($parms['label']);
|
||||
return $this->imagepicker($key, $value, $label, vartrue($parms['__options']));
|
||||
return $this->imagepicker($key, $value, defset($label, $label), vartrue($parms['__options']));
|
||||
break;
|
||||
|
||||
case 'icon':
|
||||
$label = varset($parms['label']);
|
||||
$ajax = varset($parms['ajax']) ? true : false;
|
||||
$label = varset($parms['label'], 'LAN_EDIT');
|
||||
$ajax = varset($parms['ajax'], true) ? true : false;
|
||||
unset($parms['label'], $parms['ajax']);
|
||||
return $this->iconpicker($key, $value, $label, $parms, $ajax);
|
||||
return $this->iconpicker($key, $value, defset($label, $label), $parms, $ajax);
|
||||
break;
|
||||
|
||||
case 'datestamp':
|
||||
@ -1324,9 +1319,10 @@ class e_form
|
||||
* );
|
||||
* $list = new e_admin_tree_model($data);
|
||||
* </code>
|
||||
* TODO - move fieldset & table generation in separate methods, needed for ajax calls
|
||||
* @param array $options
|
||||
* @param e_admin_tree_model $list
|
||||
* @param boolean $nocontainer don't enclose in div container
|
||||
* @param boolean $nocontainer don't enclose form in div container
|
||||
* @return string
|
||||
*/
|
||||
public function listForm($options, $list, $nocontainer = false)
|
||||
@ -1403,6 +1399,7 @@ class e_form
|
||||
/**
|
||||
* Generic DB Record Management Form.
|
||||
* TODO - lans
|
||||
* TODO - move fieldset & table generation in separate methods, needed for ajax calls
|
||||
* Expected arrays format:
|
||||
* <code>
|
||||
* <?php
|
||||
@ -1420,6 +1417,7 @@ class e_form
|
||||
* 'triggers' => 'auto', // standard create/update-cancel triggers
|
||||
* //or custom trigger array in format array('sibmit' => array('Title', 'create', '1'), 'cancel') - trigger name - title, action, optional hidden value (in this case named sibmit_value)
|
||||
* ),
|
||||
*
|
||||
* 'advanced' => array(
|
||||
* 'legend' => 'Fieldset Legend',
|
||||
* 'fields' => array(...), //see e_admin_ui::$fields
|
||||
@ -1548,6 +1546,7 @@ class e_form
|
||||
$text .= "
|
||||
</form>
|
||||
";
|
||||
e107::getJs()->footerInline("Form.focusFirstElement('{$form['id']}-form');");
|
||||
}
|
||||
if(!$nocontainer)
|
||||
{
|
||||
@ -1578,7 +1577,7 @@ class e_form
|
||||
*/
|
||||
function batchoptions($options, $ucOptions = null)
|
||||
{
|
||||
$text = "
|
||||
$text = "
|
||||
<div class='f-left'>
|
||||
<img src='".e_IMAGE_ABS."generic/branchbottom.gif' alt='' class='icon action' />
|
||||
".$this->select_open('execute_batch', array('class' => 'tbox select batch e-autosubmit', 'id' => false))."
|
||||
|
@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/faqs/admin_config.php,v $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2009-11-11 20:57:32 $
|
||||
| $Revision: 1.5 $
|
||||
| $Date: 2009-11-12 16:55:49 $
|
||||
| $Author: secretr $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -36,7 +36,7 @@ class faq_admin extends e_admin_dispatcher
|
||||
'cat' => array(
|
||||
'controller' => 'faq_cat_ui',
|
||||
'path' => null,
|
||||
// 'ui' => 'faq_cat_form_ui',
|
||||
'ui' => 'faq_cat_form_ui',
|
||||
'uipath' => null
|
||||
)
|
||||
);
|
||||
@ -45,7 +45,7 @@ class faq_admin extends e_admin_dispatcher
|
||||
'main/list' => array('caption'=> 'FAQs', 'perm' => '0'),
|
||||
'main/create' => array('caption'=> 'Create FAQ', 'perm' => '0'),
|
||||
'cat/list' => array('caption'=> 'Categories', 'perm' => '0'),
|
||||
'cat/create' => array('caption'=> "Create New Cat.", 'perm' => '0'),
|
||||
'cat/create' => array('caption'=> "Create Category", 'perm' => '0'),
|
||||
'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => '0'),
|
||||
// 'main/custom' => array('caption'=> 'Custom Page', 'perm' => '0')
|
||||
);
|
||||
@ -63,23 +63,59 @@ class faq_cat_ui extends e_admin_ui
|
||||
protected $pluginName = 'plugin';
|
||||
protected $table = "faqs_info";
|
||||
protected $pid = "faq_info_id";
|
||||
// protected $perPage = 10;
|
||||
protected $perPage = 0; //no limit
|
||||
// protected $listQry = "SELECT * FROM #faq_info"; // without any Order or Limit.
|
||||
// protected $editQry = "SELECT * FROM #faq_info WHERE faq_info_id = {ID}";
|
||||
|
||||
protected $fields = array(
|
||||
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
|
||||
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
|
||||
'faq_info_icon' => array('title'=> LAN_ICON, 'type' => 'icon', 'width' => '5%', 'thclass' => 'left' ),
|
||||
'faq_info_id' => array('title'=> LAN_ID, 'type' => 'int', 'width' =>'5%', 'forced'=> TRUE),
|
||||
'faq_info_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'forced'=> TRUE),
|
||||
'faq_info_title' => array('title'=> LAN_TITLE, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left'),
|
||||
'faq_info_about' => array('title'=> LAN_DESCRIPTION, 'type' => 'textarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=50&bb=1'), // Display name
|
||||
'faq_info_about' => array('title'=> LAN_DESCRIPTION, 'type' => 'bbarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=50&bb=1'), // Display name
|
||||
'faq_info_parent' => array('title'=> LAN_CATEGORY, 'type' => 'text', 'width' => '5%'),
|
||||
'faq_info_class' => array('title'=> LAN_VISIBILE, 'type' => 'userclass', 'data' => 'int', 'width' => 'auto'),
|
||||
'faq_info_class' => array('title'=> LAN_VISIBILE, 'type' => 'userclass', 'width' => 'auto', 'data' => 'int'),
|
||||
'faq_info_order' => array('title'=> LAN_ORDER, 'type' => 'text', 'width' => '5%', 'thclass' => 'left' ),
|
||||
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center')
|
||||
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'forced'=>TRUE, 'thclass' => 'center last', 'class' => 'center')
|
||||
);
|
||||
|
||||
/**
|
||||
* Get FAQ Category data
|
||||
* @param integer $id [optional] get category title, false - return whole array
|
||||
* @param object $default [optional] default value if not found (default 'n/a')
|
||||
* @return
|
||||
*/
|
||||
function getFaqCategoryTree($id = false, $default = 'n/a')
|
||||
{
|
||||
// TODO get faq category tree
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class faq_cat_form_ui extends e_admin_form_ui
|
||||
{
|
||||
public function faq_info_parent($curVal,$mode)
|
||||
{
|
||||
// TODO - catlist combo without current cat ID in write mode, parents only for batch/filter
|
||||
// Get UI instance
|
||||
$controller = $this->getController();
|
||||
switch($mode)
|
||||
{
|
||||
case 'read':
|
||||
return e107::getParser()->toHTML($controller->getFaqCategoryTree($curVal), false, 'TITLE');
|
||||
break;
|
||||
|
||||
case 'write':
|
||||
return $this->selectbox('faq_info_parent', $controller->getFaqCategoryTree(), $curVal);
|
||||
break;
|
||||
|
||||
case 'filter':
|
||||
case 'batch':
|
||||
return $controller->getFaqCategoryTree();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class faq_main_ui extends e_admin_ui
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user