1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-18 05:09:05 +01:00

More fields with inline editing enabled.

This commit is contained in:
Cameron 2014-02-01 09:37:15 -08:00
parent d5231b3d8c
commit e9a5fd4b98
3 changed files with 47 additions and 11 deletions

View File

@ -655,7 +655,7 @@ class media_admin_ui extends e_admin_ui
'checkboxes' => array('title'=> '', 'type' => null, 'data'=> null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
'media_id' => array('title'=> LAN_ID, 'type' => 'number', 'data'=> 'int', 'width' =>'5%', 'forced'=> TRUE, 'nolist'=>TRUE),
'media_url' => array('title'=> 'Preview', 'type' => 'image', 'data'=> 'str', 'thclass' => 'center', 'class'=>'center', 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','readonly'=>TRUE, 'writeParms'=>'thumb=180&thumb_urlraw=0&thumb_aw=180', 'width' => '110px'),
'media_category' => array('title'=> LAN_CATEGORY, 'type' => 'comma', 'data'=> 'str', 'width' => 'auto', 'filter' => true, 'batch' => true),
'media_category' => array('title'=> LAN_CATEGORY, 'type' => 'comma', 'inline'=>false, 'data'=> 'str', 'width' => 'auto', 'filter' => true, 'batch' => true, 'class'=>'left'),
// Upload should be managed completely separately via upload-handler.
// 'media_upload' => array('title'=> "Upload File", 'type' => 'upload', 'data'=> false, 'readParms' => 'hidden', 'writeParms' => 'disable_button=1', 'width' => '10%', 'nolist' => true),

View File

@ -99,7 +99,7 @@ class news_cat_ui extends e_admin_ui
'category_icon' => array('title'=> LAN_ICON, 'type' => 'icon', 'data' => 'str', 'width' => '100px', 'thclass' => 'center', 'class'=>'center', 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','readonly'=>FALSE, 'batch' => FALSE, 'filter'=>FALSE),
'category_name' => array('title'=> LAN_TITLE, 'type' => 'text', 'inline'=>true, 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE, 'validate' => true, 'inline' => true),
'category_meta_description' => array('title'=> LAN_DESCRIPTION, 'type' => 'textarea', 'width' => 'auto', 'thclass' => 'left','readParms' => 'expand=...&truncate=150&bb=1', 'readonly'=>FALSE),
'category_meta_description' => array('title'=> LAN_DESCRIPTION, 'type' => 'textarea', 'inline'=>true, 'width' => 'auto', 'thclass' => 'left','readParms' => 'expand=...&truncate=150&bb=1', 'readonly'=>FALSE),
'category_meta_keywords' => array('title'=> LAN_KEYWORDS, 'type' => 'tags', 'inline'=>true, 'width' => 'auto', 'thclass' => 'left', 'readonly'=>FALSE),
'category_sef' => array('title'=> LAN_SEFURL, 'type' => 'text', 'inline'=>true, 'width' => 'auto', 'readonly'=>FALSE), // Display name
'category_manager' => array('title'=> "Manage Permissions",'type' => 'userclass', 'inline'=>true, 'width' => 'auto', 'data' => 'int','batch'=>TRUE, 'filter'=>TRUE),
@ -372,7 +372,7 @@ class news_admin_ui extends e_admin_ui
'news_meta_keywords' => array('title' => LAN_KEYWORDS, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
'news_meta_description' => array('title' => LAN_DESCRIPTION,'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
'news_sef' => array('title' => LAN_SEFURL, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
'news_sef' => array('title' => LAN_SEFURL, 'type' => 'text', 'inline'=>true, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
'user_name' => array('title' => LAN_AUTHOR, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'noedit' => true),
'news_datestamp' => array('title' => LAN_NEWS_32, 'type' => 'datestamp', 'data' => 'int', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'parms' => 'mask=%A %d %B %Y', 'filter'=>true),
'news_category' => array('title' => NWSLAN_6, 'type' => 'dropdown', 'data' => 'int', 'inline'=>true, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'batch'=>true, 'filter'=>true),
@ -380,8 +380,8 @@ class news_admin_ui extends e_admin_ui
'news_start' => array('title' => "Start", 'type' => 'datestamp', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'parms' => 'mask=%A %d %B %Y'),
'news_end' => array('title' => "End", 'type' => 'datestamp', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'parms' => 'mask=%A %d %B %Y'),
'news_class' => array('title' => LAN_VISIBILITY, 'type' => 'userclasses', 'inline'=>true, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'batch'=>true, 'filter'=>true),
'news_render_type' => array('title' => LAN_TEMPLATE, 'type' => 'comma', 'width' => 'auto', 'thclass' => 'center', 'class' => null, 'nosort' => false, 'batch'=>true, 'filter'=>true),
'news_class' => array('title' => LAN_VISIBILITY, 'type' => 'userclasses', 'inline'=>true, 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'batch'=>true, 'filter'=>true),
'news_render_type' => array('title' => LAN_TEMPLATE, 'type' => 'comma', 'inline'=>false, 'width' => 'auto', 'thclass' => 'center', 'class' => null, 'nosort' => false, 'batch'=>true, 'filter'=>true),
'news_sticky' => array('title' => LAN_NEWS_28, 'type' => 'boolean', 'data' => 'int' , 'width' => 'auto', 'thclass' => 'center', 'class' => 'center', 'nosort' => false, 'batch'=>true, 'filter'=>true),
'news_allow_comments' => array('title' => NWSLAN_15, 'type' => 'boolean', 'data' => 'int', 'width' => 'auto', 'thclass' => 'center', 'class' => 'center', 'nosort' => false,'batch'=>true, 'filter'=>true,'readParms'=>'reverse=1','writeParms'=>'reverse=1'),
'news_comment_total' => array('title' => LAN_NEWS_60, 'type' => 'number', 'width' => '10%', 'thclass' => '', 'class' => null, 'nosort' => false),

View File

@ -2410,6 +2410,30 @@ class e_form
return '';
}
/**
* Create an Inline Edit link.
* @param $dbField : field being edited //TODO allow for an array of all data here.
* @param $pid : primary ID of the row being edited.
* @param $fieldName - Description of the field name (caption)
* @param $curVal : existing value of in the field
* @param $linkText : existing value displayed
* @param $type text|textarea|select|date|checklist
* @param $array : array data used in dropdowns etc.
*/
private function renderInline($dbField, $pid, $fieldName, $curVal, $linkText, $type='text', $array=null)
{
$source = str_replace('"',"'",json_encode($array, JSON_FORCE_OBJECT)); // SecretR - force object, fix number of bugs
$mode = preg_replace('/[^\w]/', '', vartrue($_GET['mode'], ''));
$text = "<a class='e-tip e-editable editable-click' data-name='".$dbField."' ";
$text .= (is_array($array)) ? "data-source=\"".$source."\" " : "";
$text .= " title=\"".LAN_EDIT." ".$fieldName."\" data-type='".$type."' data-value=\"{$curVal}\" data-pk='".$pid."' data-url='".e_SELF."?mode={$mode}&amp;action=inline&amp;id={$pid}&amp;ajax_used=1' href='#'>".$linkText."</a>";
return $text;
}
/**
* Render Field Value
* @param string $field field name
@ -2558,7 +2582,7 @@ class e_form
$attributes['writeParms']['raw'] = true;
$tmp = $this->renderElement($field, '', $attributes);
// Inline Editing. //FIXME!
// Inline Editing. //@SecretR - please FIXME!
if(!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) // avoid bad markup, better solution coming up
{
$mode = preg_replace('/[^\w]/', '', vartrue($_GET['mode'], ''));
@ -2614,12 +2638,15 @@ class e_form
$value = ($value ? vartrue($parms['pre']).defset($value, $value).vartrue($parms['post']) : '');
// Inline Editing.
// Inline Editing with 'comma' @SecretR - please FIXME - empty values added. @see news 'render type' or 'media-manager' category for test examples.
if(!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) // avoid bad markup, better solution coming up
{
$mode = preg_replace('/[^\w]/', '', vartrue($_GET['mode'], ''));
// SecretR - force object, fix number of bugs
$source = str_replace('"',"'",json_encode($wparms, JSON_FORCE_OBJECT));
$value = "<a class='e-tip e-editable editable-click' data-name='".$field."' data-value='{$_value}' data-source=\"".$source."\" title=\"".LAN_EDIT." ".$attributes['title']."\" data-type='select' data-pk='".$id."' data-url='".e_SELF."?mode=&amp;action=inline&amp;id={$id}&amp;ajax_used=1' href='#'>".$value."</a>";
{
$xtype = ($attributes['type'] == 'dropdown') ? 'select' : 'checklist';
// $value = "<a class='e-tip e-editable editable-click' data-name='".$field."' data-value='{$_value}' data-source=\"".$source."\" title=\"".LAN_EDIT." ".$attributes['title']."\" data-type='".$xtype."' data-pk='".$id."' data-url='".e_SELF."?mode=&amp;action=inline&amp;id={$id}&amp;ajax_used=1' href='#'>".$value."</a>";
$value = $this->renderInline($field, $id, $title, $_value, $value, $xtype, $wparms);
}
// return ;
@ -2691,6 +2718,14 @@ class e_form
case 'bbarea':
case 'textarea':
if($attributes['type'] == 'textarea' && !vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) // avoid bad markup, better solution coming up
{
return $this->renderInline($field,$id,$attributes['title'],$value,substr($value,0,50)."...",'textarea'); //FIXME.
}
$expand = '...';
$toexpand = false;
if($attributes['type'] == 'bbarea' && !isset($parms['bb'])) $parms['bb'] = true; //force bb parsing for bbareas
@ -2731,6 +2766,7 @@ class e_form
}
break;
case 'icon':