mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
admin UI: more improvements and bugfixes
This commit is contained in:
parent
10effc2232
commit
1ad5400d0b
@ -9,9 +9,9 @@
|
||||
* Image Administration Area
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_admin/image.php,v $
|
||||
* $Revision: 1.36 $
|
||||
* $Date: 2009-11-18 10:16:50 $
|
||||
* $Author: e107coders $
|
||||
* $Revision: 1.37 $
|
||||
* $Date: 2009-11-18 14:46:28 $
|
||||
* $Author: secretr $
|
||||
*
|
||||
*/
|
||||
require_once("../class2.php");
|
||||
@ -232,20 +232,20 @@ class media_admin_ui extends e_admin_ui
|
||||
|
||||
protected $fields = array(
|
||||
'checkboxes' => array('title'=> '', 'type' => null, 'data'=> null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
|
||||
'media_id' => array('title'=> LAN_ID, 'type' => 'int', 'data'=> 'int', 'width' =>'5%', 'forced'=> TRUE),
|
||||
'media_id' => array('title'=> LAN_ID, 'type' => 'number', 'data'=> 'int', 'width' =>'5%', 'forced'=> TRUE),
|
||||
'media_url' => array('title'=> 'Preview', 'type' => 'image', 'data'=> 'str', 'thclass' => 'center', 'class'=>'center', 'readParms'=>'thumb=100', 'width' => 'auto','readonly'=>TRUE),
|
||||
|
||||
// 'media_preview' => array('title'=> "Preview", 'type' => 'image', 'data'=> null, 'width' => '10%'),
|
||||
'media_upload' => array('title'=> "Upload File", 'type' => 'upload', 'data'=> null, 'readParm' => 'hidden', 'width' => '10%'),
|
||||
'media_upload' => array('title'=> "Upload File", 'type' => 'upload', 'data'=> false, 'readParm' => 'hidden', 'width' => '10%', 'nolist' => true),
|
||||
'media_name' => array('title'=> LAN_TITLE, 'type' => 'text', 'data'=> 'str', 'width' => '5%'),
|
||||
'media_caption' => array('title'=> "Caption", 'type' => 'text', 'data'=> 'str', 'width' => '5%'),
|
||||
'media_description' => array('title'=> LAN_DESCRIPTION, 'type' => 'textarea', 'data'=> 'str', 'width' => 'auto', 'thclass' => 'left first'),
|
||||
'media_description' => array('title'=> LAN_DESCRIPTION, 'type' => 'bbarea', 'data'=> 'str', 'width' => 'auto', 'thclass' => 'left first', 'readParms' => 'truncate=100', 'writeParms' => 'counter=0'),
|
||||
'media_category' => array('title'=> LAN_CATEGORY, 'type' => 'method', 'data'=> 'str', 'width' => '30%', 'filter' => true, 'batch' => true,),
|
||||
'media_type' => array('title'=> "Mime Type", 'type' => 'text', 'data'=> 'str', 'width' => '5%', 'noedit'=>TRUE),
|
||||
// 'media_author' => array('title'=> LAN_AUTHOR, 'type' => 'user', 'data'=> 'int'),
|
||||
'media_author' => array('title'=> LAN_USER, 'type' => 'user', 'data'=> 'int', 'width' => 'auto', 'thclass' => 'center', 'class'=>'center', 'filter' => true, 'batch' => true, 'noedit'=>TRUE ),
|
||||
'media_datestamp' => array('title'=> LAN_DATESTAMP, 'type' => 'datestamp', 'data'=> 'int', 'width' => 'auto', 'noedit'=>TRUE), // User date
|
||||
'media_size' => array('title'=> "Size", 'type' => 'int', 'data'=> 'int', 'width' => 'auto', 'noedit'=>TRUE),
|
||||
'media_size' => array('title'=> "Size", 'type' => 'number', 'data'=> 'int', 'width' => 'auto', 'noedit'=>TRUE),
|
||||
'media_dimensions' => array('title'=> "Dimensions", 'type' => 'text', 'data'=> 'str', 'width' => '5%', 'noedit'=>TRUE),
|
||||
'media_userclass' => array('title'=> LAN_USERCLASS, 'type' => 'userclass', 'data'=> 'str', 'width' => '10%', 'thclass' => 'center','filter'=>TRUE,'batch'=>TRUE ),
|
||||
'media_tags' => array('title'=> "Tags/Keywords", 'type' => 'text', 'data'=> 'str', 'width' => '10%', 'filter'=>TRUE,'batch'=>TRUE ),
|
||||
@ -255,7 +255,7 @@ class media_admin_ui extends e_admin_ui
|
||||
);
|
||||
|
||||
protected $mimePaths = array(
|
||||
"text" => 'files',
|
||||
'text' => 'files',
|
||||
'multipart' => 'files',
|
||||
'application' => 'files',
|
||||
'audio' => 'audio',
|
||||
@ -288,8 +288,8 @@ class media_admin_ui extends e_admin_ui
|
||||
{
|
||||
// return data to be merged with posted model data
|
||||
$this->getRequest()->setPosted('media_upload', null);
|
||||
$dataFields = $this->getModel()->getDataFields();
|
||||
unset($dataFields['media_upload']);
|
||||
//$dataFields = $this->getModel()->getDataFields();
|
||||
//unset($dataFields['media_upload']);
|
||||
$this->getModel()->setDataFields($dataFields);
|
||||
return $this->observeUploaded($new_data);
|
||||
}
|
||||
@ -301,13 +301,13 @@ class media_admin_ui extends e_admin_ui
|
||||
public function beforeUpdate($new_data, $old_data, $id)
|
||||
{
|
||||
// return data to be merged with posted model data
|
||||
return $this->observeUploaded();
|
||||
return $this->observeUploaded($new_data);
|
||||
}
|
||||
|
||||
|
||||
// XXX - strict mysql error on Create without UPLOAD!
|
||||
function observeUploaded($new_data)
|
||||
{
|
||||
$mes = e107::getMessage();
|
||||
|
||||
$pref['upload_storagetype'] = "1";
|
||||
require_once(e_HANDLER."upload_handler.php"); //TODO - still not a class!
|
||||
|
||||
@ -339,6 +339,8 @@ class media_admin_ui extends e_admin_ui
|
||||
'media_tags' => ''
|
||||
);
|
||||
|
||||
//TODO - media_dimensions
|
||||
|
||||
if(!varset($new_data['media_name']))
|
||||
{
|
||||
$upload_data['media_name'] = $upload['name'];
|
||||
@ -353,7 +355,7 @@ class media_admin_ui extends e_admin_ui
|
||||
};
|
||||
return $upload_data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function beforeDelete($data, $id) // call before 'delete' is executed. - return false to prevent delete execution (e.g. some dependencies check)
|
||||
@ -1181,18 +1183,18 @@ function del_pref_val()
|
||||
*
|
||||
* @return string JS source
|
||||
*/
|
||||
function headerjs()
|
||||
{
|
||||
require_once(e_HANDLER.'js_helper.php');
|
||||
//FIXME - how exactly to auto-call JS lan? This and more should be solved in Stage II.
|
||||
$ret = "
|
||||
<script type='text/javascript'>
|
||||
//add required core lan - delete confirm message
|
||||
(".e_jshelper::toString(LAN_JSCONFIRM).").addModLan('core', 'delete_confirm');
|
||||
</script>
|
||||
<script type='text/javascript' src='".e_FILE_ABS."jslib/core/admin.js'></script>
|
||||
";
|
||||
|
||||
return $ret;
|
||||
}
|
||||
//function headerjs()
|
||||
//{
|
||||
// require_once(e_HANDLER.'js_helper.php');
|
||||
// //FIXME - how exactly to auto-call JS lan? This and more should be solved in Stage II.
|
||||
// $ret = "
|
||||
// <script type='text/javascript'>
|
||||
// //add required core lan - delete confirm message
|
||||
// (".e_jshelper::toString(LAN_JSCONFIRM).").addModLan('core', 'delete_confirm');
|
||||
// </script>
|
||||
// <script type='text/javascript' src='".e_FILE_ABS."jslib/core/admin.js'></script>
|
||||
// ";
|
||||
//
|
||||
// return $ret;
|
||||
//}
|
||||
?>
|
@ -9,8 +9,8 @@
|
||||
* Administration UI handlers, admin helper functions
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/admin_handler.php,v $
|
||||
* $Revision: 1.32 $
|
||||
* $Date: 2009-11-18 09:32:31 $
|
||||
* $Revision: 1.33 $
|
||||
* $Date: 2009-11-18 14:46:27 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
|
||||
@ -2117,19 +2117,43 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
* @param string $field
|
||||
* @param string $key attribute name
|
||||
* @param mixed $value default value if not set, default is null
|
||||
* @return mixed FIXME
|
||||
* @return e_admin_controller_ui
|
||||
*/
|
||||
public function setFieldAttr($field, $key = null, $default = null)
|
||||
public function setFieldAttr($field, $key = null, $value = null)
|
||||
{
|
||||
if(isset($this->fields[$field]))
|
||||
// add field array
|
||||
if(is_array($field))
|
||||
{
|
||||
if(null !== $key)
|
||||
foreach ($field as $f => $atts)
|
||||
{
|
||||
return isset($this->fields[$field][$key]) ? $this->fields[$field][$key] : $default;
|
||||
$this->setFieldAttr($f, $atts);
|
||||
}
|
||||
return $this->fields[$field];
|
||||
return $this;
|
||||
}
|
||||
return $default;
|
||||
// remove a field
|
||||
if(null === $key)
|
||||
{
|
||||
unset($this->fields[$field]);
|
||||
return $this;
|
||||
}
|
||||
// add to attribute array of a field
|
||||
if(is_array($key))
|
||||
{
|
||||
foreach ($key as $k => $att)
|
||||
{
|
||||
$this->setFieldAttr($field, $k, $att);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
// remove attribute from field attribute set
|
||||
if(null === $value && $key != 'type')
|
||||
{
|
||||
unset($this->fields[$field][$key]);
|
||||
return $this;
|
||||
}
|
||||
// set attribute value
|
||||
$this->fields[$field][$key] = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2552,7 +2576,7 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
* @param string $type current action type - edit, create, list or user defined
|
||||
* @return void
|
||||
*/
|
||||
protected function toData(&$data, $type)
|
||||
protected function toData(&$data, $type = '')
|
||||
{
|
||||
}
|
||||
|
||||
@ -2597,11 +2621,13 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
*/
|
||||
protected function renderAjaxFilterResponse($listQry = '')
|
||||
{
|
||||
$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
|
||||
|
||||
$ret = '<ul>';
|
||||
$ret .= '<li>'.$srch.'<span class="informal warning"> (typed)</span></li>'; // fix Enter - search for typed word only
|
||||
|
||||
$reswords = array();
|
||||
if(trim($srch) !== '')
|
||||
{
|
||||
@ -2637,6 +2663,7 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
}
|
||||
}
|
||||
|
||||
$ret .= '<li><span class="informal warning"> clear filter </span></li>'; // clear filter option
|
||||
$ret .= '</ul>';
|
||||
return $ret;
|
||||
}
|
||||
@ -2881,6 +2908,8 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
$data = $this->$callbackBefore($_posted, $old_data, $model->getId());
|
||||
if(false === $data)
|
||||
{
|
||||
// we don't wanna loose posted data
|
||||
$model->setPostedData($_posted, null, false, false);
|
||||
return false;
|
||||
}
|
||||
if($data && is_array($data))
|
||||
@ -3394,7 +3423,7 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
$this->dataFields = array();
|
||||
foreach ($this->fields as $key => $att)
|
||||
{
|
||||
if((null !== $att['type'] && !vartrue($att['noedit'])) || vartrue($att['forceSave']))
|
||||
if((false !== varset($att['data']) && null !== $att['type'] && !vartrue($att['noedit'])) || vartrue($att['forceSave']))
|
||||
{
|
||||
$this->dataFields[$key] = vartrue($att['data'], 'str');
|
||||
}
|
||||
|
@ -9,9 +9,9 @@
|
||||
* Form Handler
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $
|
||||
* $Revision: 1.84 $
|
||||
* $Date: 2009-11-18 07:16:42 $
|
||||
* $Author: e107coders $
|
||||
* $Revision: 1.85 $
|
||||
* $Date: 2009-11-18 14:46:25 $
|
||||
* $Author: secretr $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -1064,9 +1064,10 @@ class e_form
|
||||
if($attributes['type'] == 'bbarea' && !isset($parms['bb'])) $parms['bb'] = true; //force bb parsing for bbareas
|
||||
$elid = trim(str_replace('_', '-', $field)).'-'.$id;
|
||||
if(!vartrue($parms['noparse'])) $value = $tp->toHTML($value, (vartrue($parms['bb']) ? true : false), vartrue($parms['parse']));
|
||||
if(vartrue($parms['expand']))
|
||||
if(vartrue($parms['expand']) || vartrue($parms['truncate']) || vartrue($parms['htmltruncate']))
|
||||
{
|
||||
$expand = ' <a href="#'.$elid.'-expand" class="e-show-if-js e-expandit">'.defset($parms['expand'], $parms['expand'])."</a>";
|
||||
$ttl = vartrue($parms['expand'], ' ...');
|
||||
$expand = ' <a href="#'.$elid.'-expand" class="e-show-if-js e-expandit">'.defset($ttl, $ttl)."</a>";
|
||||
}
|
||||
|
||||
$oldval = $value;
|
||||
|
@ -9,8 +9,8 @@
|
||||
* e107 Base Model
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $
|
||||
* $Revision: 1.41 $
|
||||
* $Date: 2009-11-18 09:32:31 $
|
||||
* $Revision: 1.42 $
|
||||
* $Date: 2009-11-18 14:46:27 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
|
||||
@ -2003,7 +2003,7 @@ class e_tree_model extends e_model
|
||||
*/
|
||||
function getTree($force = false)
|
||||
{
|
||||
return $this->get('__tree');
|
||||
return $this->get('__tree', array());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user