1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 14:17:49 +02:00

admin UI: Filter Ajax autocomplete, filters are now executed via AJAX calls by default, needs cleanup (buggy in some cases); some more UI improvements

This commit is contained in:
secretr
2009-11-11 20:57:34 +00:00
parent 217a2a2bd1
commit f8b49748d5
9 changed files with 381 additions and 331 deletions

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_admin/comment.php,v $ | $Source: /cvs_backup/e107_0.8/e107_admin/comment.php,v $
| $Revision: 1.18 $ | $Revision: 1.19 $
| $Date: 2009-11-10 19:13:07 $ | $Date: 2009-11-11 20:57:34 $
| $Author: secretr $ | $Author: secretr $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -79,13 +79,13 @@ class comments_admin_ui extends e_admin_ui
//TODO - finish 'user' type, set 'data' to all editable fields, set 'noedit' for all non-editable fields //TODO - finish 'user' type, set 'data' to all editable fields, set 'noedit' for all non-editable fields
protected $fields = array( 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'),
'comment_id' => array('title'=> LAN_ID, 'type' => 'int', 'width' =>'5%', 'forced'=> TRUE), 'comment_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'forced'=> TRUE),
'comment_item_id' => array('title'=> "item id", 'type' => 'text', 'width' => '5%'), 'comment_item_id' => array('title'=> "item id", 'type' => 'number', 'width' => '5%'),
'comment_subject' => array('title'=> "subject", 'type' => 'text', 'width' => 'auto', 'thclass' => 'left first'), // Display name 'comment_subject' => array('title'=> "subject", 'type' => 'text', 'width' => 'auto', 'thclass' => 'left first'), // Display name
'comment_comment' => array('title'=> "comment", 'type' => 'bbarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=50&bb=1'), // Display name 'comment_comment' => array('title'=> "comment", 'type' => 'bbarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=50&bb=1'), // Display name
'comment_author_id' => array('title'=> "authorID", 'type' => 'user', 'data' => 'int', 'width' => 'auto'), // User id 'comment_author_id' => array('title'=> "author", 'type' => 'user', 'data' => 'int', 'width' => 'auto', 'writeParms' => 'nameField=comment_author_name'), // User id
'comment_author_name' => array('title'=> "authorName", 'type' => 'text', 'width' => 'auto'), // User name 'comment_author_name' => array('title'=> "authorName", 'type' => 'user', 'width' => 'auto', 'readParms'=>'idField=comment_author_id&link=1', 'noedit' => true, 'forceSave' => true), // User name
'u.user_name' => array('title'=> "System user", 'type' => 'text', 'width' => 'auto', 'noedit' => true), // User name 'u.user_name' => array('title'=> "System user", 'type' => 'user', 'width' => 'auto', 'readParms'=>'idField=comment_author_id&link=1', 'noedit' => true), // User name
'comment_datestamp' => array('title'=> "datestamp", 'type' => 'datestamp', 'width' => 'auto'), // User date 'comment_datestamp' => array('title'=> "datestamp", 'type' => 'datestamp', 'width' => 'auto'), // User date
'comment_blocked' => array('title'=> "blocked", 'type' => 'boolean', 'data'=> 'int', 'thclass' => 'center', 'class'=>'center', 'filter' => true, 'batch' => true, 'width' => 'auto'), // Photo 'comment_blocked' => array('title'=> "blocked", 'type' => 'boolean', 'data'=> 'int', 'thclass' => 'center', 'class'=>'center', 'filter' => true, 'batch' => true, 'width' => 'auto'), // Photo
'comment_ip' => array('title'=> "IP", 'type' => 'ip', 'width' => '10%', 'thclass' => 'center' ), // Real name (no real vetting) 'comment_ip' => array('title'=> "IP", 'type' => 'ip', 'width' => '10%', 'thclass' => 'center' ), // Real name (no real vetting)

View File

@@ -9,8 +9,8 @@
* Admin Header * Admin Header
* *
* $Source: /cvs_backup/e107_0.8/e107_admin/header.php,v $ * $Source: /cvs_backup/e107_0.8/e107_admin/header.php,v $
* $Revision: 1.51 $ * $Revision: 1.52 $
* $Date: 2009-11-02 17:45:29 $ * $Date: 2009-11-11 20:57:34 $
* $Author: secretr $ * $Author: secretr $
*/ */
@@ -89,6 +89,7 @@ if (!defined('ADMIN_WIDTH'))
define('ADMIN_WIDTH', "width: 95%"); define('ADMIN_WIDTH', "width: 95%");
} }
// FIXME - move to e.g. admin_constants.php
if (!defined('ADMIN_TRUE_ICON')) if (!defined('ADMIN_TRUE_ICON'))
{ {
define("ADMIN_TRUE_ICON", "<img class='icon action S16' src='".e_IMAGE_ABS."admin_images/true_16.png' alt='' />"); define("ADMIN_TRUE_ICON", "<img class='icon action S16' src='".e_IMAGE_ABS."admin_images/true_16.png' alt='' />");

View File

@@ -8,8 +8,8 @@
* e107 Javascript API * e107 Javascript API
* *
* $Source: /cvs_backup/e107_0.8/e107_files/jslib/e107.js.php,v $ * $Source: /cvs_backup/e107_0.8/e107_files/jslib/e107.js.php,v $
* $Revision: 1.36 $ * $Revision: 1.37 $
* $Date: 2009-11-06 18:37:23 $ * $Date: 2009-11-11 20:57:33 $
* $Author: secretr $ * $Author: secretr $
* *
*/ */
@@ -877,16 +877,24 @@ Object.extend(e107Helper, {
* *
* *
*/ */
executeBatch: function(event) { executeAutoSubmit: function(event) {
var element = event.memo['element'] ? $(event.memo.element) : $$('body')[0]; var element = event.memo['element'] ? $(event.memo.element) : $$('body')[0];
Element.select(element, 'select.e-execute-batch').invoke('observe', 'change', function(e) { Element.select(element, 'select.e-autosubmit').invoke('observe', 'change', function(e) {
var frm = e.element().up('form'); e107Helper.selectAutoSubmit(e.element());
if (frm) {
frm.submit();
e.stop();
}
}); });
}, },
selectAutoSubmit: function(el) {
var frm = el.up('form');
if (frm) {
if(el.value == '___reset___') {
frm.getInputs('text').each(function(r) { r.value = '' });
frm.getInputs('password').each(function(r) { r.value = '' });
el.value = '';
}
frm.submit();
}
},
/** /**
* added as Element method below * added as Element method below
@@ -2518,11 +2526,9 @@ Object.extend(e107Ajax, {
if(!opt.parameters) opt.parameters = {}; if(!opt.parameters) opt.parameters = {};
Object.extend(opt.parameters, parm || {}); Object.extend(opt.parameters, parm || {});
opt.method = 'post'; if ($(form).hasAttribute('method') && !opt.method) opt.method = $(form).method;
if(!opt.method) opt.method = 'post';
if ($(form).hasAttribute('method') && !opt.method)
opt.method = $(form).method;
if(container) if(container)
return new e107Ajax.Updater(container, url, opt); return new e107Ajax.Updater(container, url, opt);
@@ -2685,6 +2691,6 @@ function sendInfo(handler, container, form) {
/* /*
* Core Auto-load * Core Auto-load
*/ */
$w('autoExternalLinks autoNoHistory autoHide toggleObserver toggleManyObserver scrollToObserver executeBatch').each( function(f) { $w('autoExternalLinks autoNoHistory autoHide toggleObserver toggleManyObserver scrollToObserver executeAutoSubmit').each( function(f) {
e107.runOnLoad(e107Helper[f], null, true); e107.runOnLoad(e107Helper[f], null, true);
}); });

View File

@@ -1319,6 +1319,7 @@ class e_admin_controller
* Currently used core parameters: * Currently used core parameters:
* - enable_triggers: don't use it direct, see {@link setTriggersEnabled()} * - enable_triggers: don't use it direct, see {@link setTriggersEnabled()}
* - modes - see dispatcher::$modes * - modes - see dispatcher::$modes
* - ajax_response - text|xml|json - default is 'text'; this should be set by the action method
* - TODO - more parameters/add missing to this list * - TODO - more parameters/add missing to this list
* *
* @param string $key [optional] if null - get whole array * @param string $key [optional] if null - get whole array
@@ -1548,8 +1549,8 @@ class e_admin_controller
protected function _preDispatch($action = '') protected function _preDispatch($action = '')
{ {
if(!$action) $action = $this->getAction(); if(!$action) $action = $this->getRequest()->getActionName();
$method = $this->toMethodName($action, 'page'); $method = $this->toMethodName($action, 'page');
if(!method_exists($this, $method)) if(!method_exists($this, $method))
{ {
$this->getRequest()->setAction($this->getDefaultAction()); $this->getRequest()->setAction($this->getDefaultAction());
@@ -1670,26 +1671,27 @@ class e_admin_controller
$this->setRequest($request); $this->setRequest($request);
} }
$response = $this->getResponse(); $response = $this->getResponse();
$this->_preDispatch($action);
$this->_preDispatch($action);
if(null === $action) if(null === $action)
{ {
$action = $request->getActionName(); $action = $request->getActionName();
} }
// check for observer // check for observer
$actionName = $this->toMethodName($action, 'page'); $actionName = $this->toMethodName($action, 'page');
$ret = ''; $ret = '';
if(!method_exists($this, $actionName)) // pre dispatch already switched to default action/not found page if needed if(!method_exists($this, $actionName)) // pre dispatch already switched to default action/not found page if needed
{ {
e107::getMessage()->add('Action '.$actionName.' no found!', E_MESSAGE_ERROR); e107::getMessage()->add('Action '.$actionName.' no found!', E_MESSAGE_ERROR);
return $response; return $response;
} }
//var_dump(call_user_func(array($this, $actionName)), $this->{$actionName}());
ob_start(); //catch any output ob_start(); //catch any output
$ret = $this->$actionName(); $ret = $this->{$actionName}();
//Ajax XML/JSON communictaion
//Ajax XML/JSON communication
if(e_AJAX_REQUEST && is_array($ret)) if(e_AJAX_REQUEST && is_array($ret))
{ {
$response_type = $this->getParam('ajax_response', 'xml'); $response_type = $this->getParam('ajax_response', 'xml');
@@ -1697,7 +1699,7 @@ class e_admin_controller
$js_helper = $response->getJsHelper(); $js_helper = $response->getJsHelper();
foreach ($ret as $act => $data) foreach ($ret as $act => $data)
{ {
$js_helper->addResponseAction($act, $data); $js_helper->addResponse($data, $act);
} }
$js_helper->sendResponse($response_type); $js_helper->sendResponse($response_type);
} }
@@ -1707,8 +1709,9 @@ class e_admin_controller
// Ajax text response // Ajax text response
if(e_AJAX_REQUEST) if(e_AJAX_REQUEST)
{ {
$response_type = $this->getParam('ajax_response', 'text'); $response_type = 'text';
$response->getJsHelper()->addTextResponse($ret)->sendResponse($response_type); $response->getJsHelper()->addResponse($ret)->sendResponse($response_type);
var_dump($response_type, $response->getJsHelper());
} }
else else
{ {
@@ -1728,6 +1731,12 @@ class e_admin_controller
return '<div class="center">Requested page was not found!</div>'; // TODO - lan return '<div class="center">Requested page was not found!</div>'; // TODO - lan
} }
public function E404AjaxPage()
{
exit;
}
/** /**
* Generic redirect handler, it handles almost everything we would need. * Generic redirect handler, it handles almost everything we would need.
* Additionally, it moves currently registered system messages to SESSION message stack * Additionally, it moves currently registered system messages to SESSION message stack
@@ -1939,17 +1948,6 @@ class e_admin_ui extends e_admin_controller_ui
$this->addTitle($this->pluginTitle, true)->parseAliases(); $this->addTitle($this->pluginTitle, true)->parseAliases();
} }
/**
* List action observer
* @return void
*/
public function ListObserver()
{
$this->getTreeModel()->setParam('db_query', $this->_modifyListQry())->load();
$this->addTitle('List'); // FIXME - get captions from dispatch list
//var_dump($_POST, $this->getParam('enable_triggers'));
}
/** /**
* Catch batch submit * Catch batch submit
* @param string $batch_trigger * @param string $batch_trigger
@@ -2009,6 +2007,16 @@ class e_admin_ui extends e_admin_controller_ui
e107::getJs()->headerCore('core/tabs.js') e107::getJs()->headerCore('core/tabs.js')
->headerCore('core/admin.js'); ->headerCore('core/admin.js');
} }
/**
* List action observer
* @return void
*/
public function ListObserver()
{
$this->getTreeModel()->setParam('db_query', $this->_modifyListQry())->load();
$this->addTitle('List'); // FIXME - get captions from dispatch list
}
/** /**
* Generic List action page * Generic List action page
@@ -2019,6 +2027,70 @@ class e_admin_ui extends e_admin_controller_ui
return $this->getUI()->getList(); return $this->getUI()->getList();
} }
public function FilterAjaxPage()
{
$ret = '<ul>';
$ret .= "<li><span class='informal warning'> clear filter </span></li>";
$srch = $this->getPosted('searchquery');
$this->getRequest()->setQuery('searchquery', $srch); //_modifyListQry() is requiring GET String
$reswords = array();
if(trim($srch) !== '')
{
// Build query
$qry = $this->_modifyListQry(true, 0, 20);
// Make query
$sql = e107::getDb();
if($qry && $sql->db_Select_gen($qry))
{
while ($res = $sql->db_Fetch())
{
$tmp1 = array();
$tmp = array_values(preg_grep('#'.$srch.'#i', $res));
foreach ($tmp as $w)
{
if($w == $srch)
{
array_unshift($reswords, $w); //exact match
continue;
}
preg_match('#[\S]*('.$srch.')[\S]*#i', $w, $tmp1);
if($tmp1[0]) $reswords[] = $tmp1[0];
}
}
}
// Build response
$reswords = array_unique($reswords);
if($reswords)
{
$ret .= '<li>'.implode("</li>\n\t<li>", $reswords).'</li>';
}
}
$ret .= '</ul>';
return $ret;
}
/**
* List action observer
* @return void
*/
public function ListAjaxObserver()
{
$this->getTreeModel()->setParam('db_query', $this->_modifyListQry(false, 0))->load();
}
/**
* Generic List action page (Ajax)
* @return string
*/
public function ListAjaxPage()
{
return $this->getUI()->getList(true);
}
/** /**
* Generic Edit observer * Generic Edit observer
*/ */
@@ -2363,9 +2435,10 @@ class e_admin_ui extends e_admin_controller_ui
} }
} }
protected function _modifyListQry() protected function _modifyListQry($isfilter = false, $forceFrom = false, $forceTo = false)
{ {
$searchQry = array(); $searchQry = array();
$filterFrom = array();
$request = $this->getRequest(); $request = $this->getRequest();
$tp = e107::getParser(); $tp = e107::getParser();
$tablePath = '`#'.$this->table.'`.'; $tablePath = '`#'.$this->table.'`.';
@@ -2381,23 +2454,38 @@ class e_admin_ui extends e_admin_controller_ui
$searchQuery = $tp->toDB($request->getQuery('searchquery', '')); $searchQuery = $tp->toDB($request->getQuery('searchquery', ''));
list($filterField, $filterValue) = $tp->toDB(explode('__', $request->getQuery('filter_options', ''))); list($filterField, $filterValue) = $tp->toDB(explode('__', $request->getQuery('filter_options', '')));
// TODO - we have var types in current model, use them! // FIXME - currently broken
if($filterField && $filterValue !== '' && isset($this->fields[$filterField])) if($filterField && $filterValue !== '' && isset($this->fields[$filterField]))
{ {
$searchQry[] = $this->fields[$filterField]['__tableField']." = '".$filterValue."'"; $searchQry[] = $this->fields[$filterField]['__tableField']." = '".$filterValue."'";
} }
$filter = array(); $filter = array();
foreach($this->fields as $key=>$var) // Commented for now - we should search in ALL searchable fields, not only currently active. Discuss.
//foreach($this->fieldpref as $key)
foreach($this->fields as $key => $var)
{ {
if(($var['type'] == 'text' || $var['type'] == 'method') && $searchQuery) //if(!vartrue($this->fields[$key])) continue;
//$var = $this->fields[$key];
$searchable_types = array('text', 'textearea', 'bbarea', 'user'); //method?
if(trim($searchQuery) !== '' && !vartrue($var['nolist']) && in_array($var['type'], $searchable_types))
{ {
//$ftable = vartrue($var['alias'], '#'.$this->getTableName()); $filter[] = $var['__tableField']." REGEXP ('".$searchQuery."')";
$filter[] = $var['__tableField']."` REGEXP ('".$searchQuery."'))"; if($isfilter)
{
$filterFrom[] = $var['__tableField'];
}
} }
} }
if($isfilter)
{
if(!$filterFrom) return false;
$tableSFields = implode(', ', $filterFrom);
}
$jwhere = array(); $jwhere = array();
$joins = array(); $joins = array();
if($this->tableJoin) if($this->tableJoin)
@@ -2406,20 +2494,22 @@ class e_admin_ui extends e_admin_controller_ui
foreach ($this->tableJoin as $jtable => $tparams) foreach ($this->tableJoin as $jtable => $tparams)
{ {
// Select fields // Select fields
$fields = vartrue($tparams['fields']); if(!$isfilter)
if('*' === $fields)
{ {
$qry .= ", {$tparams['__tablePath']}*"; $fields = vartrue($tparams['fields']);
} if('*' === $fields)
else
{
$fields = array_map('trim', explode(',', $fields));
foreach ($fields as $field)
{ {
$qry .= ", {$tparams['__tablePath']}`{$field}`"; $qry .= ", {$tparams['__tablePath']}*";
}
else
{
$fields = explode(',', $fields);
foreach ($fields as $field)
{
$qry .= ", {$tparams['__tablePath']}`".trim($field).'`';
}
} }
} }
// Prepare Joins // Prepare Joins
$joins[] = " $joins[] = "
".vartrue($tparams['joinType'], 'LEFT JOIN')." {$tparams['__tableFrom']} ON ".(vartrue($tparams['leftTable']) ? $tparams['leftTable'].'.' : $tablePath)."`".vartrue($tparams['leftField'])."` = {$tparams['__tablePath']}`".vartrue($tparams['rightField'])."`".(vartrue($tparams['whereJoin']) ? ' '.$tparams['whereJoin'] : ''); ".vartrue($tparams['joinType'], 'LEFT JOIN')." {$tparams['__tableFrom']} ON ".(vartrue($tparams['leftTable']) ? $tparams['leftTable'].'.' : $tablePath)."`".vartrue($tparams['leftField'])."` = {$tparams['__tablePath']}`".vartrue($tparams['rightField'])."`".(vartrue($tparams['whereJoin']) ? ' '.$tparams['whereJoin'] : '');
@@ -2453,7 +2543,7 @@ class e_admin_ui extends e_admin_controller_ui
// filter where // filter where
if(count($filter) > 0) if(count($filter) > 0)
{ {
$searchQry[] = " (".implode(" OR ",$filter)." )"; $searchQry[] = " ( ".implode(" OR ",$filter)." ) ";
} }
// where query // where query
@@ -2469,11 +2559,11 @@ class e_admin_ui extends e_admin_controller_ui
$qry .= ' ORDER BY '.$this->fields[$orderField]['__tableField'].' '.($request->getQuery('asc') == 'desc' ? 'DESC' : 'ASC'); $qry .= ' ORDER BY '.$this->fields[$orderField]['__tableField'].' '.($request->getQuery('asc') == 'desc' ? 'DESC' : 'ASC');
} }
if($this->getPerPage()) if($this->getPerPage() || false !== $forceTo)
{ {
$from = intval($request->getQuery('from', 0)); $from = false === $forceFrom ? intval($request->getQuery('from', 0)) : intval($forceFrom);
//$startfrom = ($from-1) * intval($this->getPerPage()); if(false === $forceTo) $forceTo = $this->getPerPage();
$qry .= ' LIMIT '.$from.', '.intval($this->getPerPage()); $qry .= ' LIMIT '.$from.', '.intval($forceTo);
} }
return $qry; return $qry;
@@ -2634,7 +2724,7 @@ class e_admin_ui extends e_admin_controller_ui
$this->dataFields = array(); $this->dataFields = array();
foreach ($this->fields as $key => $att) foreach ($this->fields as $key => $att)
{ {
if(null !== $att['type'] && !vartrue($att['noedit'])) if((null !== $att['type'] && !vartrue($att['noedit'])) || vartrue($att['forceSave']))
{ {
$this->dataFields[$key] = vartrue($att['data'], 'str'); $this->dataFields[$key] = vartrue($att['data'], 'str');
} }
@@ -2815,7 +2905,7 @@ class e_admin_form_ui extends e_form
); );
$models[] = $controller->getModel(); $models[] = $controller->getModel();
return $this->createForm($forms, $models); return $this->createForm($forms, $models, e_AJAX_REQUEST);
} }
/** /**
@@ -2846,7 +2936,7 @@ class e_admin_form_ui extends e_form
); );
$models[] = $controller->getConfig(); $models[] = $controller->getConfig();
return $this->createForm($forms, $models); return $this->createForm($forms, $models, e_AJAX_REQUEST);
} }
/** /**
@@ -2856,7 +2946,7 @@ class e_admin_form_ui extends e_form
* *
* @return string * @return string
*/ */
public function getList() public function getList($ajax = false)
{ {
$tp = e107::getParser(); $tp = e107::getParser();
$controller = $this->getController(); $controller = $this->getController();
@@ -2871,7 +2961,7 @@ class e_admin_form_ui extends e_form
'head_query' => $request->buildQueryString('field=[FIELD]&asc=[ASC]&from=[FROM]', false), // without field, asc and from vars, REQUIRED '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 'np_query' => $request->buildQueryString(array(), false, 'from'), // without from var, REQUIRED for next/prev functionality
'legend' => $controller->getPluginTitle(), // hidden by default 'legend' => $controller->getPluginTitle(), // hidden by default
'form_pre' => $this->renderFilter($tp->post_toForm(array($controller->getQuery('searchquery'), $controller->getQuery('filter_options'))), $controller->getMode().'/'.$controller->getAction()), // needs to be visible when a search returns nothing 'form_pre' => !$ajax ? $this->renderFilter($tp->post_toForm(array($controller->getQuery('searchquery'), $controller->getQuery('filter_options'))), $controller->getMode().'/'.$controller->getAction()) : '', // needs to be visible when a search returns nothing
'form_post' => '', // markup to be added after closing form element 'form_post' => '', // markup to be added after closing form element
'fields' => $controller->getFields(), // see e_admin_ui::$fields 'fields' => $controller->getFields(), // see e_admin_ui::$fields
'fieldpref' => $controller->getFieldPref(), // see e_admin_ui::$fieldpref 'fieldpref' => $controller->getFieldPref(), // see e_admin_ui::$fieldpref
@@ -2884,7 +2974,7 @@ class e_admin_form_ui extends e_form
'field' => $controller->getQuery('field'), //current order field name, default - primary field 'field' => $controller->getQuery('field'), //current order field name, default - primary field
'asc' => $controller->getQuery('asc', 'desc'), //current 'order by' rule, default 'asc' 'asc' => $controller->getQuery('asc', 'desc'), //current 'order by' rule, default 'asc'
); );
return $this->listForm($options, $tree); return $this->listForm($options, $tree, $ajax);
} }
function renderFilter($current_query = array(), $location = '', $input_options = array()) function renderFilter($current_query = array(), $location = '', $input_options = array())
@@ -2894,25 +2984,71 @@ class e_admin_form_ui extends e_form
{ {
$location = 'main/list'; //default location $location = 'main/list'; //default location
} }
$l = explode('/', $location); $l = e107::getParser()->post_toForm(explode('/', $location));
if(!is_array($input_options))
{
parse_str($input_options, $input_options);
}
$input_options['id'] = false;
$input_options['class'] = 'tbox input-text filter';
$text = " $text = "
<form method='get' action='".e_SELF."?".e_QUERY."'> <form method='get' action='".e_SELF."?".e_QUERY."'>
<fieldset class='e-filter'> <fieldset class='e-filter'>
<legend class='e-hideme'>Filter</legend> <legend class='e-hideme'>Filter</legend>
<div class='left'> <div class='left'>
".$this->text('searchquery', $current_query[0], 50, $input_options)." ".$this->text('searchquery', $current_query[0], 50, $input_options)."
".$this->select_open('filter_options', array('class' => 'tbox select e-filter-options', 'id' => false))." ".$this->select_open('filter_options', array('class' => 'tbox select filter', 'id' => false))."
".$this->option('Display All', '')." ".$this->option('Display All', '')."
".$this->option('Clear Filter', '___reset___')."
".$this->renderBatchFilter('filter', $current_query[1])." ".$this->renderBatchFilter('filter', $current_query[1])."
".$this->select_close()." ".$this->select_close()."
<div class='e-autocomplete'></div>
".$this->hidden('mode', $l[0])." ".$this->hidden('mode', $l[0])."
".$this->hidden('action', $l[1])." ".$this->hidden('action', $l[1])."
".$this->admin_button('etrigger_filter', LAN_FILTER)." ".$this->admin_button('etrigger_filter', 'etrigger_filter', 'filter e-hide-if-js', LAN_FILTER, array('id' => false))."
<span class='indicator' style='display: none;'>
<img src='".e_IMAGE_ABS."generic/loading_16.gif' class='icon action S16' alt='Loding...' />
</span>
</div> </div>
</fieldset> </fieldset>
</form> </form>
"; ";
e107::getJs()->requireCoreLib('scriptaculous/controls.js', 2);
//TODO - external JS
e107::getJs()->footerInline("
//autocomplete fields
\$\$('input[name=searchquery]').each(function(el, cnt) {
if(!cnt) el.focus();
else return;
new Ajax.Autocompleter(el, el.next('div.e-autocomplete'), '".e_SELF."?mode=".$l[0]."&action=filter', {
paramName: 'searchquery',
minChars: 2,
frequency: 0.5,
afterUpdateElement: function(txt, li) {
var cfrm = el.up('form'), cont = cfrm.next('.e-container');
if(!cont) {
return;
}
cfrm.submitForm(cont);
},
indicator: el.next('span.indicator'),
parameters: 'ajax_used=1'
});
var sel = el.next('select.filter');
if(sel) {
sel.observe('change', function (e) {
var cfrm = e.element().up('form'), cont = cfrm.next('.e-container');
if(cfrm && cont && e.element().value != '___reset___') {
e.stop();
cfrm.submitForm(cont);
return;
}
e107Helper.selectAutoSubmit(e.element());
});
}
});
");
return $text; return $text;
} }
@@ -2929,11 +3065,12 @@ class e_admin_form_ui extends e_form
$text = " $text = "
<div class='buttons-bar left'> <div class='buttons-bar left'>
<img src='".e_IMAGE_ABS."generic/branchbottom.gif' alt='' class='icon action' /> <img src='".e_IMAGE_ABS."generic/branchbottom.gif' alt='' class='icon action' />
".$this->select_open('etrigger_batch', array('class' => 'tbox select e-execute-batch', 'id' => false))." ".$this->select_open('etrigger_batch', array('class' => 'tbox select batch e-autosubmit', 'id' => false))."
".$this->option('With selected...', '')." ".$this->option('With selected...', '')."
".($allow_delete ? $this->option('&nbsp;&nbsp;&nbsp;&nbsp;'.LAN_DELETE, 'delete') : '')." ".($allow_delete ? $this->option('&nbsp;&nbsp;&nbsp;&nbsp;'.LAN_DELETE, 'delete') : '')."
".$this->renderBatchFilter('batch')." ".$this->renderBatchFilter('batch')."
".$this->select_close()." ".$this->select_close()."
".$this->admin_button('e__execute_batch', 'e__execute_batch', 'batch e-hide-if-js', 'Execute', array('id' => false))."
</div> </div>
"; ";
return $text; return $text;
@@ -3050,225 +3187,95 @@ class e_admin_form_ui extends e_form
} }
} }
// One handler to rule them all // FIXME - here because needed on AJAX calls (header.php not loaded), should be moved to separate file!
// see e107_plugins/release/admin_config.php. if (!defined('ADMIN_TRUE_ICON'))
class e_admin_ui_dummy extends e_form {
{ 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 e_admin_ui }
*/
protected $_controller = null;
/**
* Constructor
* @param e_admin_ui $controller
* @return
*/
function __construct($controller)
{
$this->_controller = $controller;
parent::__construct(false);
}
function init()
{
global $user_pref; // e107::getConfig('user') ??
$this->mode = varset($_GET['mode']) ? $_GET['mode'] : 'list';
$column_pref_name = "admin_".$this->table."_columns";
if(isset($_POST['submit-e-columns']))
{
$user_pref[$column_pref_name] = $_POST['e-columns'];
save_prefs('user');
$this->mode = 'list';
}
$this->fieldpref = (varset($user_pref[$column_pref_name])) ? $user_pref[$column_pref_name] : array_keys($this->fields);
foreach($this->fields as $k=>$v) // Find Primary table ID field (before checkboxes is run. ).
{
if(vartrue($v['primary']))
{
$this->pid = $k;
}
}
if(varset($_POST['execute_batch']))
{
if(vartrue($_POST['multiselect']))
{
// $_SESSION[$this->table."_batch"] = $_POST['execute_batch']; // DO we want this to 'stick'?
list($tmp,$field,$value) = explode('__',$_POST['execute_batch']);
$this->processBatch($field,$_POST['multiselect'],$value);
}
$this->mode = 'list';
}
if(varset($_POST['execute_filter'])) // Filter the db records.
{
$_SESSION[$this->table."_filter"] = $_POST['filter_options'];
list($tmp,$filterField,$filterValue) = explode('__',$_POST['filter_options']);
$this->modifyListQry($_POST['searchquery'],$filterField,$filterValue);
$this->mode = 'list';
}
if(varset($_POST['update']) || varset($_POST['create']))
{
$id = intval($_POST['record_id']);
$this->saveRecord($id);
}
if(varset($_POST['delete']))
{
$id = key($_POST['delete']);
$this->deleteRecord($id);
$this->mode = "list";
}
if(varset($_POST['saveOptions']))
{
$this->saveSettings();
}
if(varset($_POST['edit']))
{
$this->mode = 'create';
}
if($this->mode) // Render Page.
{
$method = $this->mode."Page";
$this->$method();
}
}
if (!defined('ADMIN_FALSE_ICON'))
{
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");
}
function modifyListQry($search,$filterField,$filterValue) if (!defined('ADMIN_EDIT_ICON'))
{ {
$searchQry = array(); 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");
if(vartrue($filterField) && vartrue($filterValue)) }
{
$searchQry[] = $filterField." = '".$filterValue."'";
}
$filter = array();
foreach($this->fields as $key=>$var)
{
if(($var['type'] == 'text' || $var['type'] == 'method') && vartrue($search))
{
$filter[] = "(".$key." REGEXP ('".$search."'))";
}
}
if(count($filter)>0)
{
$searchQry[] = " (".implode(" OR ",$filter)." )";
}
if(count($searchQry)>0)
{
$this->listQry .= " WHERE ".implode(" AND ",$searchQry);
}
}
if (!defined('ADMIN_DELETE_ICON'))
{
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");
}
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");
}
function processBatch($field,$ids,$value) if (!defined('ADMIN_WARNING_ICON'))
{ {
$sql = e107::getDb(); 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($field == 'delete') }
{
return $sql->db_Delete($this->table,$this->pid." IN (".implode(",",$ids).")");
}
if(!is_numeric($value))
{
$value = "'".$value."'";
}
$query = $field." = ".$value." WHERE ".$this->pid." IN (".implode(",",$ids).") ";
$count = $sql->db_Update($this->table,$query);
}
/** if (!defined('ADMIN_INFO_ICON'))
* Generic Options/Preferences Form. {
* @return 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");
function optionsPage() }
{
$pref = e107::getConfig()->getPref();
$frm = e107::getForm();
$ns = e107::getRender();
$mes = e107::getMessage();
//XXX Lan - Options if (!defined('ADMIN_CONFIGURE_ICON'))
$text = " {
<form method='post' action='".e_SELF."?".e_QUERY."'> define("ADMIN_CONFIGURE_ICON", "<img class='icon action S16' src='".e_IMAGE_ABS."admin_images/configure_16.png' alt='' />");
<fieldset id='core-cpage-options'> define("ADMIN_CONFIGURE_ICON_PATH", e_IMAGE."admin_images/configure_16.png");
<legend class='e-hideme'>".LAN_OPTIONS."</legend> }
<table cellpadding='0' cellspacing='0' class='adminform'>
<colgroup span='2'>
<col class='col-label' />
<col class='col-control' />
</colgroup>
<tbody>\n";
foreach($this->prefs as $key => $var)
{
$text .= "
<tr>
<td class='label'>".defset($var['title'], $var['title'])."</td>
<td class='control'>
".$this->renderElement($key, $pref)."
</td>
</tr>\n";
}
$text .= "</tbody>
</table>
<div class='buttons-bar center'>
".$frm->admin_button('saveOptions', LAN_SAVE, 'submit')."
</div>
</fieldset>
</form>
";
$ns->tablerender($this->pluginTitle." :: ".LAN_OPTIONS, $mes->render().$text); 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");
}
function saveSettings() //TODO needs to use native e_model functions, validation etc. if (!defined('ADMIN_URL_ICON'))
{ {
global $pref, $admin_log; 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");
unset($_POST['saveOptions'],$_POST['e-columns']); }
foreach($_POST as $key=>$val) if (!defined('ADMIN_INSTALLPLUGIN_ICON'))
{ {
e107::getConfig('core')->set($key,$val); 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");
}
e107::getConfig('core')->save();
} 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='' />");
* @return e_admin_ui define("ADMIN_UNINSTALLPLUGIN_ICON_PATH", e_IMAGE."admin_images/plugin_unstall_16.png");
*/ }
public function getController()
{ if (!defined('ADMIN_UPGRADEPLUGIN_ICON'))
return $this->_controller; {
} 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");
} }
/** /**

View File

@@ -9,8 +9,8 @@
* 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.76 $ * $Revision: 1.77 $
* $Date: 2009-11-10 19:13:06 $ * $Date: 2009-11-11 20:57:33 $
* $Author: secretr $ * $Author: secretr $
* *
*/ */
@@ -191,20 +191,11 @@ class e_form
{ {
if(!is_array($options)) parse_str($options, $options); if(!is_array($options)) parse_str($options, $options);
$reset = '';
if(vartrue($options['reset']))
{
$reset = '
<a href="#" onclick="$(\'subscriber-system-id\').value=0; \$(\'subscriber-system-id\').previous(\'input\').value=\'\'; return false;">reset</a>
';
}
//'.$this->text($id_fld, $default_id, 10, array('id' => false, 'readonly'=>true, 'class'=>'tbox number')).' //'.$this->text($id_fld, $default_id, 10, array('id' => false, 'readonly'=>true, 'class'=>'tbox number')).'
$ret = ' $ret = '
<div class="e-autocomplete-c"> <div class="e-autocomplete-c">
'.$this->text($name_fld, $default_name, 150, array('id' => false, 'readonly' => vartrue($options['readonly']) ? true : false)).' '.$this->text($name_fld, $default_name, 150, array('id' => false, 'readonly' => vartrue($options['readonly']) ? true : false)).'
'.$this->hidden($id_fld, $default_id, array('id' => false)).' '.$this->hidden($id_fld, $default_id, array('id' => false)).'
'.$reset.'
<span class="indicator" style="display: none;"> <span class="indicator" style="display: none;">
<img src="'.e_IMAGE_ABS.'generic/loading_16.gif" class="icon action S16" alt="Loading..." /> <img src="'.e_IMAGE_ABS.'generic/loading_16.gif" class="icon action S16" alt="Loading..." />
</span> </span>
@@ -213,7 +204,7 @@ class e_form
'; ';
e107::getJs()->requireCoreLib('scriptaculous/controls.js', 2); e107::getJs()->requireCoreLib('scriptaculous/controls.js', 2);
//TODO - external JS
e107::getJs()->footerInline(" e107::getJs()->footerInline("
//autocomplete fields //autocomplete fields
\$\$('input[name={$name_fld}]').each(function(el) { \$\$('input[name={$name_fld}]').each(function(el) {
@@ -229,7 +220,6 @@ class e_form
minChars: 2, minChars: 2,
frequency: 0.5, frequency: 0.5,
afterUpdateElement: function(txt, li) { afterUpdateElement: function(txt, li) {
console.log(\$(li).id, '{$id_fld}');
if(!\$(li)) return; if(!\$(li)) return;
if(\$(li).id) { if(\$(li).id) {
el.next('input[name={$id_fld}]').value = parseInt(\$(li).id); el.next('input[name={$id_fld}]').value = parseInt(\$(li).id);
@@ -535,12 +525,12 @@ class e_form
/** /**
* *
* @param object $name * @param string $name
* @param object $value * @param string $value
* @param object $action [optional] default is submit * @param string $action [optional] default is submit
* @param object $label [optional] * @param string $label [optional]
* @param object $options [optional] * @param string|array $options [optional]
* @return * @return string
*/ */
function admin_button($name, $value, $action = 'submit', $label = '', $options = array()) function admin_button($name, $value, $action = 'submit', $label = '', $options = array())
{ {
@@ -1263,14 +1253,30 @@ class e_form
case 'user': case 'user':
//user_id expected //user_id expected
// Just temporary solution, could be changed soon // Just temporary solution, could be changed soon
if(!isset($parms['__options'])) $parms['__options'] = array();
if(!is_array($parms['__options'])) parse_str($parms['__options'], $parms['__options']);
if((empty($value) && vartrue($parms['currentInit'])) || vartrue($parms['current']))
{
$value = USERID;
if(vartrue($parms['current']))
{
$parms['__options']['readonly'] = true;
}
}
if(!is_array($value)) if(!is_array($value))
{ {
$value = get_user_data($value); $value = get_user_data($value);
} }
$colname = vartrue($parms['nameType'], 'user_name');
$parms['__options']['name'] = $colname;
if(!$value) $value = array(); if(!$value) $value = array();
$uname = varset($value['user_name']); $uname = varset($value[$colname]);
$value = varset($value['user_id'], 0); $value = varset($value['user_id'], 0);
return $this->userpicker(vartrue($parms['nameField'] ,$key.'_usersearch'), $key, $uname, $value, $parms); return $this->userpicker(vartrue($parms['nameField'], $key.'_usersearch'), $key, $uname, $value, vartrue($parms['__options']));
break; break;
case 'boolean': case 'boolean':
@@ -1320,9 +1326,10 @@ class e_form
* </code> * </code>
* @param array $options * @param array $options
* @param e_admin_tree_model $list * @param e_admin_tree_model $list
* @param boolean $nocontainer don't enclose in div container
* @return string * @return string
*/ */
public function listForm($options, $list) public function listForm($options, $list, $nocontainer = false)
{ {
$tp = e107::getParser(); $tp = e107::getParser();
$tree = $list->getTree(); $tree = $list->getTree();
@@ -1340,7 +1347,6 @@ class e_form
$current_fields = varset($options['fieldpref']) ? $options['fieldpref'] : array_keys($options['fields']); $current_fields = varset($options['fieldpref']) ? $options['fieldpref'] : array_keys($options['fields']);
$text = " $text = "
".vartrue($options['form_pre'])."
<form method='post' action='{$formurl}' id='{$elid}-list-form'> <form method='post' action='{$formurl}' id='{$elid}-list-form'>
".vartrue($options['fieldset_pre'])." ".vartrue($options['fieldset_pre'])."
<fieldset id='{$elid}-list'> <fieldset id='{$elid}-list'>
@@ -1386,10 +1392,12 @@ class e_form
</fieldset> </fieldset>
".vartrue($options['fieldset_post'])." ".vartrue($options['fieldset_post'])."
</form> </form>
".vartrue($options['form_post'])."
"; ";
if(!$nocontainer)
return $text; {
$text = '<div class="e-container">'.$text.'</div>';
}
return (vartrue($options['form_pre']).$text.vartrue($options['form_post']));
} }
/** /**
@@ -1426,9 +1434,10 @@ class e_form
* </code> * </code>
* @param array $forms numerical array * @param array $forms numerical array
* @param array $models numerical array with values instance of e_admin_model * @param array $models numerical array with values instance of e_admin_model
* @param boolean $nocontainer don't enclose in div container
* @return string * @return string
*/ */
function createForm($forms, $models) function createForm($forms, $models, $nocontainer = false)
{ {
$text = ''; $text = '';
foreach ($forms as $fid => $form) foreach ($forms as $fid => $form)
@@ -1540,6 +1549,10 @@ class e_form
</form> </form>
"; ";
} }
if(!$nocontainer)
{
$text = '<div class="e-container">'.$text.'</div>';
}
return $text; return $text;
} }
@@ -1568,7 +1581,7 @@ class e_form
$text = " $text = "
<div class='f-left'> <div class='f-left'>
<img src='".e_IMAGE_ABS."generic/branchbottom.gif' alt='' class='icon action' /> <img src='".e_IMAGE_ABS."generic/branchbottom.gif' alt='' class='icon action' />
".$this->select_open('execute_batch', array('class' => 'tbox select e-execute-batch', 'id' => false))." ".$this->select_open('execute_batch', array('class' => 'tbox select batch e-autosubmit', 'id' => false))."
".$this->option('With selected...', '')." ".$this->option('With selected...', '')."
"; ";

View File

@@ -9,8 +9,8 @@
* Javascript Helper * Javascript Helper
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/js_helper.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/js_helper.php,v $
* $Revision: 1.7 $ * $Revision: 1.8 $
* $Date: 2009-10-28 01:32:40 $ * $Date: 2009-11-11 20:57:32 $
* $Author: secretr $ * $Author: secretr $
* *
*/ */
@@ -266,8 +266,8 @@ class e_jshelper
* @param string $action optional * @param string $action optional
* @param array $data_array optional * @param array $data_array optional
*/ */
function sendTextResponse($data_text) function sendTextResponse($data_text = '')
{ {
header('Content-type: text/html; charset='.CHARSET, true); header('Content-type: text/html; charset='.CHARSET, true);
echo $this->addTextResponse($data_text)->buildTextResponse(); echo $this->addTextResponse($data_text)->buildTextResponse();
exit; exit;
@@ -288,7 +288,7 @@ class e_jshelper
//TODO - pref? //TODO - pref?
$response_type = strtolower(ucfirst($this->_prefered_response_type)); $response_type = strtolower(ucfirst($this->_prefered_response_type));
} }
$method = "send{$response_type}Response"; $method = "send{$response_type}Response";
if(method_exists($this, $method)) if(method_exists($this, $method))
{ {
$this->$method(); $this->$method();
@@ -297,6 +297,30 @@ class e_jshelper
return false; return false;
} }
/**
* Add response by response type
*
* @param mixed $data
* @param string $action 'text' or response action string
* @return e_jshelper
*/
function addResponse($data, $action = '')
{
if(!$action)
{
$action = 'text';
}
if('text' == $action)
{
$this->addTextResponse($data);
}
else
{
$this->addResponseAction($action, $data);
}
return $this;
}
/** /**
* Reset response action array to prevent duplicates * Reset response action array to prevent duplicates

View File

@@ -216,6 +216,7 @@ if (!function_exists('strptime'))
{ {
$vals['tm_mon'] = $names[substr($vals['tm_mon'], 0, 3)] - 1; $vals['tm_mon'] = $names[substr($vals['tm_mon'], 0, 3)] - 1;
} }
//$vals['tm_sec'] -= 1; always increasing tm_sec + 1 ?????? //$vals['tm_sec'] -= 1; always increasing tm_sec + 1 ??????
#-- calculate wday/yday #-- calculate wday/yday

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/faqs/admin_config.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/faqs/admin_config.php,v $
| $Revision: 1.3 $ | $Revision: 1.4 $
| $Date: 2009-11-10 19:13:05 $ | $Date: 2009-11-11 20:57:32 $
| $Author: secretr $ | $Author: secretr $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -91,8 +91,8 @@ class faq_main_ui extends e_admin_ui
protected $tableJoin = array( protected $tableJoin = array(
'u.user' => array('leftField' => 'faq_author', 'rightField' => 'user_id', 'fields' => 'user_id,user_loginname,user_name') 'u.user' => array('leftField' => 'faq_author', 'rightField' => 'user_id', 'fields' => 'user_id,user_loginname,user_name')
); );
// without any Order or Limit.
protected $listQry = "SELECT * FROM #faqs"; // without any Order or Limit. //protected $listQry = "SELECT * FROM #faqs";
protected $editQry = "SELECT * FROM #faqs WHERE faq_id = {ID}"; protected $editQry = "SELECT * FROM #faqs WHERE faq_id = {ID}";
@@ -109,7 +109,7 @@ class faq_main_ui extends e_admin_ui
'faq_parent' => array('title'=> "Category", 'type' => 'method', 'data'=> 'int','width' => '5%', 'filter'=>TRUE, 'batch'=>TRUE), 'faq_parent' => array('title'=> "Category", 'type' => 'method', 'data'=> 'int','width' => '5%', 'filter'=>TRUE, 'batch'=>TRUE),
'faq_comment' => array('title'=> "Comment", 'type' => 'userclass', 'data' => 'int', 'width' => 'auto'), // User id 'faq_comment' => array('title'=> "Comment", 'type' => 'userclass', 'data' => 'int', 'width' => 'auto'), // User id
'faq_datestamp' => array('title'=> "datestamp", 'type' => 'datestamp', 'data'=> 'int','width' => 'auto'), // User date 'faq_datestamp' => array('title'=> "datestamp", 'type' => 'datestamp', 'data'=> 'int','width' => 'auto'), // User date
'faq_author' => array('title'=> LAN_USER, 'type' => 'user', 'data'=> 'int', 'thclass' => 'center', 'class'=>'center', 'filter' => true, 'batch' => true, 'width' => 'auto'), // Photo 'faq_author' => array('title'=> LAN_USER, 'type' => 'user', 'data'=> 'int', 'width' => 'auto', 'thclass' => 'center', 'class'=>'center', 'writeParms' => 'currentInit=1', 'filter' => true, 'batch' => true, 'nolist' => true ), // Photo
'u.user_name' => array('title'=> "User name", 'type' => 'user', 'width' => 'auto', 'noedit' => true, 'readParms'=>'idField=faq_author&link=1'), // User name 'u.user_name' => array('title'=> "User name", 'type' => 'user', 'width' => 'auto', 'noedit' => true, 'readParms'=>'idField=faq_author&link=1'), // User name
'u.user_loginname' => array('title'=> "User login", 'type' => 'user', 'width' => 'auto', 'noedit' => true, 'readParms'=>'idField=faq_author&link=1'), // User login name 'u.user_loginname' => array('title'=> "User login", 'type' => 'user', 'width' => 'auto', 'noedit' => true, 'readParms'=>'idField=faq_author&link=1'), // User login name
'faq_order' => array('title'=> "Order", 'type' => 'number', 'data'=> 'int','width' => '5%', 'thclass' => 'center' ), // Real name (no real vetting) 'faq_order' => array('title'=> "Order", 'type' => 'number', 'data'=> 'int','width' => '5%', 'thclass' => 'center' ), // Real name (no real vetting)
@@ -199,9 +199,7 @@ class faq_admin_form_ui extends e_admin_form_ui
new faq_admin(); new faq_admin();
require_once(e_ADMIN."auth.php"); require_once(e_ADMIN."auth.php");
e107::getAdminUI()->runPage(); e107::getAdminUI()->runPage();
require_once(e_ADMIN."footer.php"); require_once(e_ADMIN."footer.php");

View File

@@ -9,8 +9,8 @@
* Release Plugin Administration UI * Release Plugin Administration UI
* *
* $Source: /cvs_backup/e107_0.8/e107_plugins/release/includes/admin.php,v $ * $Source: /cvs_backup/e107_0.8/e107_plugins/release/includes/admin.php,v $
* $Revision: 1.8 $ * $Revision: 1.9 $
* $Date: 2009-11-10 19:13:06 $ * $Date: 2009-11-11 20:57:33 $
* $Author: secretr $ * $Author: secretr $
*/ */
@@ -178,7 +178,7 @@ class plugin_release_admin_ui extends e_admin_ui
* -> write: n/a * -> write: n/a
* *
* - user -> read: [optional] 'link' => true - create link to user profile, 'idField' => 'author_id' - tells to renderValue() where to search for user id (used when 'link' is true) * - user -> read: [optional] 'link' => true - create link to user profile, 'idField' => 'author_id' - tells to renderValue() where to search for user id (used when 'link' is true)
* -> write: [optional] 'nameField' => 'comment_author_name' the name of a 'user_name' field; * -> write: [optional] 'nameField' => 'comment_author_name' the name of a 'user_name' field; 'currentInit' - use currrent user if no data provided; 'current' - use always current user(editor); '__options' e_form::userpickup() options
* *
* - number -> read: (array) [optional] 'point' => '.', [optional] 'sep' => ' ', [optional] 'decimals' => 2, [optional] 'pre' => '&euro; ', [optional] 'post' => 'LAN_CURRENCY' * - number -> read: (array) [optional] 'point' => '.', [optional] 'sep' => ' ', [optional] 'decimals' => 2, [optional] 'pre' => '&euro; ', [optional] 'post' => 'LAN_CURRENCY'
* -> write: (array) [optional] 'pre' => '&euro; ', [optional] 'post' => 'LAN_CURRENCY', [optional] 'maxlength' => 50, [optional] '__options' => array(...) see e_form class description for __options format * -> write: (array) [optional] 'pre' => '&euro; ', [optional] 'post' => 'LAN_CURRENCY', [optional] 'maxlength' => 50, [optional] '__options' => array(...) see e_form class description for __options format