mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 20:57:26 +02:00
e_modeLinterface now handles batches and search/filtering with ease. :-)
This commit is contained in:
@@ -9,9 +9,9 @@
|
|||||||
* News Administration
|
* News Administration
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $
|
||||||
* $Revision: 1.60 $
|
* $Revision: 1.61 $
|
||||||
* $Date: 2009-10-23 18:14:41 $
|
* $Date: 2009-10-26 07:26:47 $
|
||||||
* $Author: secretr $
|
* $Author: e107coders $
|
||||||
*/
|
*/
|
||||||
require_once("../class2.php");
|
require_once("../class2.php");
|
||||||
|
|
||||||
@@ -259,7 +259,7 @@ class admin_newspost
|
|||||||
|
|
||||||
$this->fieldpref = varset($user_pref['admin_news_columns'], array('news_id', 'news_title', 'news_author', 'news_render_type', 'options'));
|
$this->fieldpref = varset($user_pref['admin_news_columns'], array('news_id', 'news_title', 'news_author', 'news_render_type', 'options'));
|
||||||
|
|
||||||
$this->_fields = array(
|
$this->fields = array(
|
||||||
'checkboxes' => array('title' => '', 'type' => null, 'width' => '3%', 'thclass' => 'center first', 'class' => 'center', 'nosort' => true, 'toggle' => 'news_selected', 'forced' => TRUE),
|
'checkboxes' => array('title' => '', 'type' => null, 'width' => '3%', 'thclass' => 'center first', 'class' => 'center', 'nosort' => true, 'toggle' => 'news_selected', 'forced' => TRUE),
|
||||||
'news_id' => array('title' => LAN_NEWS_45, 'type' => 'number', 'width' => '5%', 'thclass' => 'center', 'class' => 'center', 'nosort' => false),
|
'news_id' => array('title' => LAN_NEWS_45, 'type' => 'number', 'width' => '5%', 'thclass' => 'center', 'class' => 'center', 'nosort' => false),
|
||||||
'news_title' => array('title' => NWSLAN_40, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
'news_title' => array('title' => NWSLAN_40, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
||||||
@@ -1054,7 +1054,7 @@ class admin_newspost
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$field_columns = $this->_fields;
|
$field_columns = $this->fields;
|
||||||
|
|
||||||
$e107 = e107::getInstance();
|
$e107 = e107::getInstance();
|
||||||
|
|
||||||
@@ -1117,8 +1117,8 @@ class admin_newspost
|
|||||||
<fieldset id='core-newspost-list'>
|
<fieldset id='core-newspost-list'>
|
||||||
<legend class='e-hideme'>".NWSLAN_4."</legend>
|
<legend class='e-hideme'>".NWSLAN_4."</legend>
|
||||||
<table cellpadding='0' cellspacing='0' class='adminlist'>
|
<table cellpadding='0' cellspacing='0' class='adminlist'>
|
||||||
".$frm->colGroup($this->_fields, $this->fieldpref)."
|
".$frm->colGroup($this->fields, $this->fieldpref)."
|
||||||
".$frm->thead($this->_fields, $this->fieldpref, 'main.[FIELD].[ASC].[FROM]')."
|
".$frm->thead($this->fields, $this->fieldpref, 'main.[FIELD].[ASC].[FROM]')."
|
||||||
<tbody>";
|
<tbody>";
|
||||||
|
|
||||||
$ren_type = array("default","title","other-news","other-news 2");
|
$ren_type = array("default","title","other-news","other-news 2");
|
||||||
@@ -1143,7 +1143,7 @@ class admin_newspost
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AUTO RENDER
|
// AUTO RENDER
|
||||||
$text .= $frm->trow($this->_fields, $this->fieldpref, $row);
|
$text .= $frm->trow($this, $row);
|
||||||
}
|
}
|
||||||
|
|
||||||
$text .= "
|
$text .= "
|
||||||
@@ -2262,7 +2262,7 @@ class admin_newspost
|
|||||||
function ajax_exec_searchValue()
|
function ajax_exec_searchValue()
|
||||||
{
|
{
|
||||||
$frm = e107::getForm();
|
$frm = e107::getForm();
|
||||||
echo $frm->filterValue($_POST['filtertype'], $this->_fields);
|
echo $frm->filterValue($_POST['filtertype'], $this->fields);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -2564,12 +2564,13 @@ class admin_newspost
|
|||||||
$var['pref']['link'] = e_SELF."?pref";
|
$var['pref']['link'] = e_SELF."?pref";
|
||||||
$var['pref']['perm'] = "0";
|
$var['pref']['perm'] = "0";
|
||||||
|
|
||||||
$c = $e107->sql->db_Count('submitnews');
|
//TODO remove commented code before release.
|
||||||
if ($c) {
|
// $c = $e107->sql->db_Count('submitnews');
|
||||||
|
// if ($c) {
|
||||||
$var['sn']['text'] = NWSLAN_47." ({$c})";
|
$var['sn']['text'] = NWSLAN_47." ({$c})";
|
||||||
$var['sn']['link'] = e_SELF."?sn";
|
$var['sn']['link'] = e_SELF."?sn";
|
||||||
$var['sn']['perm'] = "N";
|
$var['sn']['perm'] = "N";
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (getperms('0'))
|
if (getperms('0'))
|
||||||
{
|
{
|
||||||
|
@@ -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.57 $
|
* $Revision: 1.58 $
|
||||||
* $Date: 2009-10-26 01:23:19 $
|
* $Date: 2009-10-26 07:26:47 $
|
||||||
* $Author: e107coders $
|
* $Author: e107coders $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -802,13 +802,19 @@ class e_form
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function trow($fieldarray, $currentlist, $fieldvalues)
|
function trow($obj, $fieldvalues)
|
||||||
{
|
{
|
||||||
$cnt = 0;
|
$cnt = 0;
|
||||||
$ret = '';
|
$ret = '';
|
||||||
|
|
||||||
|
$fieldarray = $obj->fields;
|
||||||
|
$currentlist = $obj->fieldpref;
|
||||||
|
$pid = $obj->pid;
|
||||||
|
|
||||||
|
|
||||||
foreach ($fieldarray as $field => $data)
|
foreach ($fieldarray as $field => $data)
|
||||||
{
|
{
|
||||||
|
|
||||||
//Not found
|
//Not found
|
||||||
if(!$data['forced'] && !in_array($field, $currentlist))
|
if(!$data['forced'] && !in_array($field, $currentlist))
|
||||||
{
|
{
|
||||||
@@ -834,20 +840,22 @@ class e_form
|
|||||||
$value = $fieldvalues[$field];
|
$value = $fieldvalues[$field];
|
||||||
|
|
||||||
$parms = array();
|
$parms = array();
|
||||||
if(isset($data['colparms']))
|
if(isset($data['colparms'])) //TODO rename to 'parms'.
|
||||||
{
|
{
|
||||||
if(!is_array($data['colparms'])) parse_str($data['colparms'], $data['colparms']);
|
if(!is_array($data['colparms'])) parse_str($data['colparms'], $data['colparms']);
|
||||||
$parms = $data['colparms'];
|
$parms = $data['colparms'];
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($field)
|
switch($field) // special fields
|
||||||
{
|
{
|
||||||
case 'options':
|
case 'options':
|
||||||
|
$value = "<input type='image' class='action edit' name='edit[{$fieldvalues[$pid]}]' src='".ADMIN_EDIT_ICON_PATH."' title='".LAN_EDIT."' />";
|
||||||
|
$value .= "<input type='image' class='action delete' name='delete[{$fieldvalues[$pid]}]' src='".ADMIN_DELETE_ICON_PATH."' title='".LAN_DELETE." [ ID: {$fieldvalues[$pid]} ]' />";
|
||||||
$data['type'] = 'text';
|
$data['type'] = 'text';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'checkboxes':
|
case 'checkboxes':
|
||||||
$value = $this->checkbox(vartrue($data['toggle'], 'multiselect').'[]', $value);
|
$value = $this->checkbox(vartrue($data['toggle'], 'multiselect').'['.$fieldvalues[$pid].']', $fieldvalues[$pid]);
|
||||||
$data['type'] = 'text';
|
$data['type'] = 'text';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -887,6 +895,15 @@ class e_form
|
|||||||
case 'boolean':
|
case 'boolean':
|
||||||
$value = $value ? ADMIN_TRUE_ICON : '';// TODO - ADMIN_FALSE_ICON
|
$value = $value ? ADMIN_TRUE_ICON : '';// TODO - ADMIN_FALSE_ICON
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'url':
|
||||||
|
$value = "<a href='".$value ."'>".$value."</a>";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'method': // Custom Function
|
||||||
|
$meth = $field;
|
||||||
|
$value = $obj->$meth($value,$obj->mode);
|
||||||
|
break;
|
||||||
|
|
||||||
//TODO - form_userclass, order,... and maybe more types
|
//TODO - form_userclass, order,... and maybe more types
|
||||||
|
|
||||||
@@ -895,7 +912,7 @@ class e_form
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO - this should be done per type!
|
//TODO - this should be done per type!
|
||||||
if(vartrue($parms['truncate']))
|
if(vartrue($parms['truncate']))
|
||||||
{
|
{
|
||||||
$value = e107::getParser()->text_truncate($value, $parms['truncate'], '...');
|
$value = e107::getParser()->text_truncate($value, $parms['truncate'], '...');
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
* e107 Base Model
|
* e107 Base Model
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $
|
||||||
* $Revision: 1.21 $
|
* $Revision: 1.22 $
|
||||||
* $Date: 2009-10-23 04:25:13 $
|
* $Date: 2009-10-26 07:26:47 $
|
||||||
* $Author: e107coders $
|
* $Author: e107coders $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -1651,7 +1651,7 @@ class e_model_interface
|
|||||||
var $fieldpref;
|
var $fieldpref;
|
||||||
var $listQry;
|
var $listQry;
|
||||||
var $table;
|
var $table;
|
||||||
var $primary;
|
var $pid;
|
||||||
var $mode; // as found in the URL query. $_GET['mode]
|
var $mode; // as found in the URL query. $_GET['mode]
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
@@ -1676,6 +1676,33 @@ class e_model_interface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->fieldpref = (varset($user_pref[$column_pref_name])) ? $user_pref[$column_pref_name] : array_keys($this->fields);
|
$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']))
|
||||||
|
{
|
||||||
|
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.
|
||||||
|
{
|
||||||
|
list($tmp,$filterField,$filterValue) = explode('__',$_POST['filter_options']);
|
||||||
|
$this->modifyListQry($_POST['searchquery'],$filterField,$filterValue);
|
||||||
|
$this->mode = 'list';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(varset($_POST['update']) || varset($_POST['create']))
|
if(varset($_POST['update']) || varset($_POST['create']))
|
||||||
{
|
{
|
||||||
@@ -1696,13 +1723,163 @@ class e_model_interface
|
|||||||
$this->saveSettings();
|
$this->saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->mode)
|
if(varset($_POST['edit']))
|
||||||
|
{
|
||||||
|
$this->mode = 'create';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if($this->mode) // Render Page.
|
||||||
{
|
{
|
||||||
$method = $this->mode."Page";
|
$method = $this->mode."Page";
|
||||||
$this->$method();
|
$this->$method();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function modifyListQry($search,$filterField,$filterValue)
|
||||||
|
{
|
||||||
|
$searchQry = array();
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function processBatch($field,$ids,$value)
|
||||||
|
{
|
||||||
|
$sql = e107::getDb();
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderFilter()
|
||||||
|
{
|
||||||
|
$frm = e107::getForm();
|
||||||
|
$text = "<form method='post' action='".e_SELF."?".e_QUERY."'>
|
||||||
|
<div class='left' style='padding-bottom:10px'>\n"; //TODO assign CSS
|
||||||
|
$text .= "<input class='tbox' type='text' name='searchquery' size='20' value=\"".$_POST['searchquery']."\" maxlength='50' />\n";
|
||||||
|
$text .= $frm->select_open('filter_options', array('class' => 'tbox select e-filter-options', 'id' => false));
|
||||||
|
$text .= $frm->option('Display All', '');
|
||||||
|
$text .= $this->renderBatchFilter('filter');
|
||||||
|
|
||||||
|
$text .= $frm->admin_button('execute_filter', ADLAN_142);
|
||||||
|
$text .= "</div></form>\n";
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderBatch()
|
||||||
|
{
|
||||||
|
$frm = e107::getForm();
|
||||||
|
|
||||||
|
|
||||||
|
if(!varset($this->fields['checkboxes']))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$text = "<div class='buttons-bar left'>
|
||||||
|
<img src='".e_IMAGE_ABS."generic/branchbottom.gif' alt='' class='icon action' />";
|
||||||
|
$text .= $frm->select_open('execute_batch', array('class' => 'tbox select e-execute-batch', 'id' => false)).
|
||||||
|
$frm->option('With selected...', '');
|
||||||
|
$frm->option(LAN_DELETE, 'batch__delete');
|
||||||
|
$text .= $this->renderBatchFilter('batch');
|
||||||
|
$text .= "</div>";
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderBatchFilter($type='batch') // Common function used for both batches and filters.
|
||||||
|
{
|
||||||
|
$frm = e107::getForm();
|
||||||
|
|
||||||
|
$optdiz = array('batch' => 'Modify ', 'filter'=> 'Filter by ');
|
||||||
|
|
||||||
|
foreach($this->fields as $key=>$val)
|
||||||
|
{
|
||||||
|
if(!varset($val[$type]))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$text .= "\t".$frm->optgroup_open($optdiz[$type].$val['title'], $disabled)."\n";
|
||||||
|
if(!is_array($val[$type]))
|
||||||
|
{
|
||||||
|
switch($val['type'])
|
||||||
|
{
|
||||||
|
case 'boolean': //TODO modify description based on $val['parm]
|
||||||
|
$text .= $frm->option(LAN_YES, $type.'__'.$key."__1");
|
||||||
|
$text .= $frm->option(LAN_NO, $type.'__'.$key."__0");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'dropdown': // use the array $parm;
|
||||||
|
foreach($val['parm'] as $k=>$name)
|
||||||
|
{
|
||||||
|
$text .= $frm->option($name, $type.'__'.$key."__".$k);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'userclass':
|
||||||
|
$classes = e107::getUserClass()->uc_required_class_list($val['parm']);
|
||||||
|
foreach($classes as $k=>$name)
|
||||||
|
{
|
||||||
|
$text .= $frm->option($name, $type. '__'.$key."__".$k);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'method':
|
||||||
|
$method = $key;
|
||||||
|
$list = $this->$method('',$type);
|
||||||
|
foreach($list as $k=>$name)
|
||||||
|
{
|
||||||
|
$text .= $frm->option($name, $type.'__'.$key."__".$k);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$text .= $frm->optgroup_close()."\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= "</select>";
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1720,8 +1897,8 @@ class e_model_interface
|
|||||||
|
|
||||||
$amount = 20; // do we hardcode or let the plugin developer decide.. OR - a pref in admin?
|
$amount = 20; // do we hardcode or let the plugin developer decide.. OR - a pref in admin?
|
||||||
$from = vartrue($_GET['frm']) ? $_GET['frm'] : 0; //TODO sanitize?.
|
$from = vartrue($_GET['frm']) ? $_GET['frm'] : 0; //TODO sanitize?.
|
||||||
|
$text = $this->renderFilter();
|
||||||
$text = "<form method='post' action='".e_SELF."?mode=create'>
|
$text .= "<form method='post' action='".e_SELF."'>
|
||||||
<fieldset id='core-".$this->table."-list'>
|
<fieldset id='core-".$this->table."-list'>
|
||||||
<legend class='e-hideme'>".$this->pluginTitle."</legend>
|
<legend class='e-hideme'>".$this->pluginTitle."</legend>
|
||||||
<table cellpadding='0' cellspacing='0' class='adminlist'>".
|
<table cellpadding='0' cellspacing='0' class='adminlist'>".
|
||||||
@@ -1743,29 +1920,27 @@ class e_model_interface
|
|||||||
|
|
||||||
$sql->db_Select_gen($query);
|
$sql->db_Select_gen($query);
|
||||||
$row = $sql->db_getList('ALL', FALSE, FALSE);
|
$row = $sql->db_getList('ALL', FALSE, FALSE);
|
||||||
|
|
||||||
foreach($row as $field)
|
foreach($row as $field)
|
||||||
{
|
{
|
||||||
$text .= "<tr>\n";
|
$text .= $frm->trow($this, $field);
|
||||||
foreach($this->fields as $key=>$att)
|
|
||||||
{
|
|
||||||
$class = vartrue($this->fields[$key]['thclass']) ? "class='".$this->fields[$key]['thclass']."'" : "";
|
|
||||||
$text .= (in_array($key,$this->fieldpref) || $att['forced']==TRUE) ? "\t<td ".$class.">".$this->renderValue($key,$field)."</td>\n" : "";
|
|
||||||
}
|
|
||||||
$text .= "</tr>\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$text .= "
|
$text .= "
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>";
|
||||||
|
|
||||||
|
$text .= $this->renderBatch();
|
||||||
|
|
||||||
|
$text .= "
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
|
|
||||||
//TODO Auto next/prev
|
$parms = $total.",".$amount.",".$from.",".e_SELF.'?action='.$this->mode.'&frm=[FROM]';
|
||||||
$parms = $total.",".$amount.",".$from.",".e_SELF.'?action='.$this->mode.'&frm=[FROM]';
|
$text .= $tp->parseTemplate("{NEXTPREV={$parms}}");
|
||||||
$text .= $tp->parseTemplate("{NEXTPREV={$parms}}");
|
|
||||||
|
|
||||||
$ns->tablerender($this->pluginTitle." :: ".$this->adminMenu['list']['caption'], $mes->render().$text);
|
$ns->tablerender($this->pluginTitle." :: ".$this->adminMenu['list']['caption'], $mes->render().$text);
|
||||||
}
|
}
|
||||||
@@ -1949,7 +2124,7 @@ class e_model_interface
|
|||||||
* @param object $row
|
* @param object $row
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
function renderValue($key,$row)
|
function renderValue($key,$row) // NO LONGER REQUIRED. use $frm->trow();
|
||||||
{
|
{
|
||||||
$att = $this->fields[$key];
|
$att = $this->fields[$key];
|
||||||
//TODO add checkbox.
|
//TODO add checkbox.
|
||||||
@@ -1964,9 +2139,9 @@ class e_model_interface
|
|||||||
if($key == "options")
|
if($key == "options")
|
||||||
{
|
{
|
||||||
$id = $this->primary;
|
$id = $this->primary;
|
||||||
$text = "<input type='image' class='action edit' name='edit[{$row[$id]}]' src='".ADMIN_EDIT_ICON_PATH."' title='".LAN_EDIT."' />";
|
// $text = "<input type='image' class='action edit' name='edit[{$row[$id]}]' src='".ADMIN_EDIT_ICON_PATH."' title='".LAN_EDIT."' />";
|
||||||
$text .= "<input type='image' class='action delete' name='delete[{$row[$id]}]' src='".ADMIN_DELETE_ICON_PATH."' title='".LAN_DELETE." [ ID: {$row[$id]} ]' />";
|
// $text .= "<input type='image' class='action delete' name='delete[{$row[$id]}]' src='".ADMIN_DELETE_ICON_PATH."' title='".LAN_DELETE." [ ID: {$row[$id]} ]' />";
|
||||||
return $text;
|
// return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($att['type'])
|
switch($att['type'])
|
||||||
@@ -2052,10 +2227,10 @@ class e_model_interface
|
|||||||
* @param object $action
|
* @param object $action
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
function show_options($action)
|
function show_options()
|
||||||
{
|
{
|
||||||
|
|
||||||
$action = varset($_GET['mode'],'list');
|
$action = $this->mode;
|
||||||
|
|
||||||
foreach($this->adminMenu as $key=>$val)
|
foreach($this->adminMenu as $key=>$val)
|
||||||
{
|
{
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
* e107 Release Plugin
|
* e107 Release Plugin
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/release/admin_config.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_plugins/release/admin_config.php,v $
|
||||||
* $Revision: 1.7 $
|
* $Revision: 1.8 $
|
||||||
* $Date: 2009-10-23 04:25:19 $
|
* $Date: 2009-10-26 07:26:53 $
|
||||||
* $Author: e107coders $
|
* $Author: e107coders $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -23,20 +23,25 @@ class releasePlugin extends e_model_interface
|
|||||||
{
|
{
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$this->pluginTitle = "e107 Release";
|
||||||
|
|
||||||
|
$this->table = "release";
|
||||||
|
|
||||||
$this->fields = array(
|
$this->fields = array(
|
||||||
|
'checkboxes' => array('title'=> '', 'type' => '', 'width'=>'5%', 'thclass' =>'center', 'forced'=> TRUE, 'class'=>'center'),
|
||||||
'release_id' => array('title'=> ID, 'width'=>'5%', 'forced'=> TRUE, 'primary'=>TRUE),
|
'release_id' => array('title'=> ID, 'type' => '', 'width'=>'5%', 'thclass' => '', 'forced'=> TRUE, 'primary'=>TRUE),
|
||||||
'release_type' => array('title'=> 'type', 'type' => 'method', 'width'=>'auto'),
|
'release_type' => array('title'=> 'Type', 'type' => 'method', 'width'=>'auto', 'thclass' => '', 'batch' => TRUE, 'filter'=>TRUE),
|
||||||
'release_folder' => array('title'=> 'folder', 'type' => 'text', 'width' => 'auto'), // User name
|
'release_folder' => array('title'=> 'Folder', 'type' => 'text', 'width' => 'auto', 'thclass' => ''),
|
||||||
'release_name' => array('title'=> 'name', 'type' => 'text', 'width' => 'auto'),
|
'release_name' => array('title'=> 'Name', 'type' => 'text', 'width' => 'auto', 'thclass' => ''),
|
||||||
'release_version' => array('title'=> 'version', 'type' => 'text', 'width' => 'auto'),
|
'release_version' => array('title'=> 'Version', 'type' => 'text', 'width' => 'auto', 'thclass' => ''),
|
||||||
'release_author' => array('title'=> LAN_AUTHOR, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left'),
|
'release_author' => array('title'=> LAN_AUTHOR, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left'),
|
||||||
'release_authorURL' => array('title'=> LAN_AUTHOR.'URL', 'type' => 'url', 'width' => 'auto', 'thclass' => 'left'),
|
'release_authorURL' => array('title'=> LAN_AUTHOR.'URL', 'type' => 'url', 'width' => 'auto', 'thclass' => 'left'),
|
||||||
'release_date' => array('title'=> LAN_DATE, 'type' => 'text', 'width' => 'auto'),
|
'release_date' => array('title'=> LAN_DATE, 'type' => 'text', 'width' => 'auto', 'thclass' => ''),
|
||||||
'release_compatibility' => array('title'=> 'compatib', 'type' => 'text', 'width' => '10%', 'thclass' => 'center' ),
|
'release_compatibility' => array('title'=> 'compatib', 'type' => 'text', 'width' => '10%', 'thclass' => 'center' ),
|
||||||
'release_url' => array('title'=> 'URL', 'type' => 'url', 'width' => '10%', 'thclass' => 'center' ),
|
'release_url' => array('title'=> 'URL', 'type' => 'userclass', 'width' => '10%', 'thclass' => 'center', 'batch' => TRUE, 'filter'=>TRUE),
|
||||||
'options' => array('title'=> LAN_OPTIONS, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last')
|
'options' => array('title'=> LAN_OPTIONS, 'type' => '', 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced'=>TRUE)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->prefs = array( //TODO add option for core or plugin pref.
|
$this->prefs = array( //TODO add option for core or plugin pref.
|
||||||
@@ -45,13 +50,10 @@ class releasePlugin extends e_model_interface
|
|||||||
'pref_folder' => array('title'=> 'folder', 'type' => 'boolean'),
|
'pref_folder' => array('title'=> 'folder', 'type' => 'boolean'),
|
||||||
'pref_name' => array('title'=> 'name', 'type' => 'text')
|
'pref_name' => array('title'=> 'name', 'type' => 'text')
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->listQry = "SELECT * FROM #release"; // without any Order or Limit.
|
$this->listQry = "SELECT * FROM #release"; // without any Order or Limit.
|
||||||
$this->editQry = "SELECT * FROM #release WHERE release_id = {ID}";
|
$this->editQry = "SELECT * FROM #release WHERE release_id = {ID}";
|
||||||
$this->table = "release";
|
|
||||||
$this->primary = "release_id";
|
|
||||||
$this->pluginTitle = "e107 Release";
|
|
||||||
|
|
||||||
$this->adminMenu = array(
|
$this->adminMenu = array(
|
||||||
'list' => array('caption'=>'Release List', 'perm'=>'0'),
|
'list' => array('caption'=>'Release List', 'perm'=>'0'),
|
||||||
'create' => array('caption'=>LAN_CREATE."/".LAN_EDIT, 'perm'=>'0'),
|
'create' => array('caption'=>LAN_CREATE."/".LAN_EDIT, 'perm'=>'0'),
|
||||||
@@ -61,11 +63,23 @@ class releasePlugin extends e_model_interface
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Custom View/Form-Element method. ie. Naming should match field/key with type=method.
|
// Custom View/Form-Element method. ie. Naming should match field/key with type=method.
|
||||||
function release_type($curVal)
|
|
||||||
|
|
||||||
|
function release_type($curVal,$mode) // not really necessary since we can use 'dropdown' - but just an example of a custom function.
|
||||||
{
|
{
|
||||||
if($this->mode == 'list')
|
if($mode == 'list')
|
||||||
{
|
{
|
||||||
return $curVal;
|
return $curVal.' (custom!)';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($mode == 'batch') // Custom Batch List for release_type
|
||||||
|
{
|
||||||
|
return array('theme'=>"Theme","plugin"=>'Plugin');
|
||||||
|
}
|
||||||
|
|
||||||
|
if($mode == 'filter') // Custom Filter List for release_type
|
||||||
|
{
|
||||||
|
return array('theme'=>"Theme","plugin"=>'Plugin');
|
||||||
}
|
}
|
||||||
|
|
||||||
$types = array("theme","plugin");
|
$types = array("theme","plugin");
|
||||||
@@ -96,7 +110,28 @@ require_once(e_ADMIN."footer.php");
|
|||||||
function admin_config_adminmenu() //TODO move this into e_model_interface
|
function admin_config_adminmenu() //TODO move this into e_model_interface
|
||||||
{
|
{
|
||||||
global $rp;
|
global $rp;
|
||||||
$rp->show_options($action);
|
$rp->show_options();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function headerjs() // needed for the checkboxes - how can we remove the need to duplicate this code?
|
||||||
|
{
|
||||||
|
require_once (e_HANDLER.'js_helper.php');
|
||||||
|
$ret = "
|
||||||
|
<script type='text/javascript'>
|
||||||
|
if(typeof e107Admin == 'undefined') var e107Admin = {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OnLoad Init Control
|
||||||
|
*/
|
||||||
|
e107Admin.initRules = {
|
||||||
|
'Helper': true,
|
||||||
|
'AdminMenu': false
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<script type='text/javascript' src='".e_FILE_ABS."jslib/core/admin.js'></script>
|
||||||
|
";
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
?>
|
?>
|
Reference in New Issue
Block a user