mirror of
https://github.com/e107inc/e107.git
synced 2025-08-19 12:51:52 +02:00
drag and drop ordering of items.
This commit is contained in:
@@ -205,7 +205,7 @@ class media_form_ui extends e_admin_form_ui
|
||||
|
||||
function media_category($curVal,$mode) // not really necessary since we can use 'dropdown' - but just an example of a custom function.
|
||||
{
|
||||
|
||||
$curVal = explode(",",$curVal);
|
||||
if($mode == 'read')
|
||||
{
|
||||
return $this->getController()->getMediaCategory($curVal);
|
||||
@@ -223,11 +223,12 @@ class media_form_ui extends e_admin_form_ui
|
||||
}
|
||||
|
||||
|
||||
$text = "<select class='tbox>' name='media_category' >";
|
||||
$text = "<select class='tbox e-multiselect' name='media_category[]' multiple='multiple'>";
|
||||
$cats = $this->getController()->getMediaCategory();
|
||||
|
||||
foreach($cats as $key => $val)
|
||||
{
|
||||
$selected = ($curVal == $key) ? "selected='selected'" : "";
|
||||
$selected = (in_array($key,$curVal)) ? "selected='selected'" : "";
|
||||
$text .= "<option value='{$key}' {$selected}>".$val."</option>\n";
|
||||
}
|
||||
$text .= "</select>";
|
||||
@@ -263,7 +264,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, 'writeParams' => 'path={e_MEDIA}', 'width' => '110px'),
|
||||
'media_category' => array('title'=> LAN_CATEGORY, 'type' => 'method', 'data'=> 'str', 'width' => 'auto', 'filter' => true, 'batch' => true,),
|
||||
'media_category' => array('title'=> LAN_CATEGORY, 'type' => 'method', 'data'=> 'str', 'width' => 'auto', 'filter' => true, 'batch' => true,'writeParms'=>'multiple=1'),
|
||||
|
||||
// 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),
|
||||
@@ -461,7 +462,7 @@ class media_admin_ui extends e_admin_ui
|
||||
$this->fields['media_url']['noedit'] = TRUE;
|
||||
$this->fields['media_userclass']['noedit'] = TRUE;
|
||||
|
||||
//$text .= $this->uploadPage(); // To test upload script with plupload
|
||||
// $text .= $this->uploadPage(); // To test upload script with plupload
|
||||
$text .= $this->CreatePage(); // comment me out to test plupload
|
||||
|
||||
$text .= "
|
||||
@@ -537,7 +538,7 @@ class media_admin_ui extends e_admin_ui
|
||||
|
||||
$text .= "<div style='text-align:right;padding:5px'>
|
||||
|
||||
<button type='submit' class='submit' name='save_image' value='Save' onclick=\"saveBB();\" >
|
||||
<button type='submit' class='submit e-dialog-save e-dialog-close' data-target='".$this->getQuery('tagid')."' name='save_image' value='Save' onclick=\"saveBB();\" >
|
||||
<span>Save</span>
|
||||
</button>
|
||||
<button type='submit' class='submit' name='cancel_image' value='Cancel' onclick=\"parent.e107Widgets.DialogManagerDefault.getWindow('e-dialog').close();\" >
|
||||
@@ -545,7 +546,7 @@ class media_admin_ui extends e_admin_ui
|
||||
</button>
|
||||
</div>";
|
||||
|
||||
|
||||
|
||||
e107::getJs()->footerInline("
|
||||
|
||||
|
||||
@@ -673,6 +674,9 @@ 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
|
||||
$new_data['media_category'] = implode(",",$new_data['media_category']);
|
||||
print_a($new_data);
|
||||
return $new_data;
|
||||
return $this->observeUploaded($new_data);
|
||||
}
|
||||
|
||||
@@ -750,7 +754,7 @@ class media_admin_ui extends e_admin_ui
|
||||
}
|
||||
else // Update Only ?
|
||||
{
|
||||
|
||||
|
||||
$img_data = $this->mediaData($new_data['media_url']);
|
||||
|
||||
|
||||
@@ -1091,6 +1095,16 @@ class media_admin_ui extends e_admin_ui
|
||||
|
||||
public function getMediaCategory($id = false)
|
||||
{
|
||||
if(is_array($id))
|
||||
{
|
||||
$text = "";
|
||||
foreach($id as $val)
|
||||
{
|
||||
$text .= (isset($this->cats[$val]) ? "<span class='nowrap'>".$this->cats[$val]."</span><br />" : '');
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
if($id) return (isset($this->cats[$id]) ? $this->cats[$id] : 0);
|
||||
return $this->cats;
|
||||
}
|
||||
|
@@ -29,11 +29,7 @@ if (!getperms("I"))
|
||||
|
||||
e107::coreLan('links', true);
|
||||
|
||||
if(e_AJAX_REQUEST) // ajax link sorting.
|
||||
{
|
||||
print_a($_POST);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
class links_admin extends e_admin_dispatcher
|
||||
@@ -73,7 +69,8 @@ class links_admin_ui extends e_admin_ui
|
||||
protected $batchDelete = true;
|
||||
protected $batchCopy = true;
|
||||
protected $listOrder = 'link_order ASC';
|
||||
protected $listSorting = true;
|
||||
protected $listSorting = true; // TODO - should enable the 'sort' icon in the 'options' column.
|
||||
|
||||
|
||||
public $current_parent = 0;
|
||||
public $sublink_data = null;
|
||||
@@ -89,14 +86,14 @@ class links_admin_ui extends e_admin_ui
|
||||
'link_class' => array('title'=> LAN_USERCLASS, 'type' => 'userclass', 'writeParms' => 'classlist=public,guest,nobody,member,classes,admin,main', 'batch'=>true, 'filter'=>true, 'width' => 'auto'),
|
||||
'link_description' => array('title'=> LCLAN_17, 'type' => 'bbarea', 'method'=>'tinymce_plugins', 'width' => 'auto'),
|
||||
'link_category' => array('title'=> LCLAN_12, 'type' => 'dropdown', 'batch'=>true, 'filter'=>true, 'width' => 'auto'),
|
||||
'link_order' => array('title'=> LAN_ORDER, 'type' => 'text', 'width' => 'auto'),
|
||||
'link_order' => array('title'=> LAN_ORDER, 'type' => 'number', 'width' => 'auto', 'nolist'=>true),
|
||||
'link_open' => array('title'=> LCLAN_19, 'type' => 'dropdown', 'width' => 'auto', 'batch'=>true, 'filter'=>true, 'thclass' => 'left first'),
|
||||
'link_function' => array('title'=> 'Function', 'type' => 'method', 'data'=>'str', 'width' => 'auto', 'thclass' => 'left first'),
|
||||
|
||||
'options' => array('title'=> LAN_OPTIONS, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class'=>'center')
|
||||
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class'=>'center','readParms'=>'sort=1') // quick workaround
|
||||
);
|
||||
|
||||
protected $fieldpref = array('checkboxes','link_id','link_name','link_sefurl','link_class','link_order','options');
|
||||
protected $fieldpref = array('checkboxes','link_id','link_name','link_sefurl','link_class','options');
|
||||
|
||||
protected $prefs = array(
|
||||
'linkpage_screentip' => array('title'=>LCLAN_78, 'type'=>'boolean', 'help'=>LCLAN_79),
|
||||
@@ -131,6 +128,26 @@ class links_admin_ui extends e_admin_ui
|
||||
4 => LCLAN_24, // 4 = miniwindow 600x400
|
||||
5 => LINKLAN_1 // 5 = miniwindow 800x600
|
||||
);
|
||||
|
||||
|
||||
if(e_AJAX_REQUEST) // ajax link sorting.
|
||||
{
|
||||
|
||||
$c= ($_GET['from']) ? intval($_GET['from']) : 0;
|
||||
if(isset($_POST['all']))
|
||||
{
|
||||
foreach($_POST['all'] as $row)
|
||||
{
|
||||
list($tmp,$id) = explode("-",$row);
|
||||
$sql->db_Update("links","link_order = ".intval($c)." WHERE link_id = ".intval($id));
|
||||
$c++;
|
||||
}
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function handleListLinkParentBatch($selected, $value)
|
||||
@@ -599,6 +616,8 @@ class links_admin_form_ui extends e_admin_form_ui
|
||||
return $this->linkFunctions;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@@ -298,7 +298,7 @@ class news_admin_ui extends e_admin_ui
|
||||
protected $fields = array(
|
||||
'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_thumbnail' => array('title' => NWSLAN_67, 'type' => 'image', 'width' => '110px', 'thclass' => 'center', 'class' => "center", 'nosort' => false, 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','writeParams' => 'path={e_MEDIA}','readonly'=>false),
|
||||
'news_thumbnail' => array('title' => NWSLAN_67, 'type' => 'image', 'width' => '110px', 'thclass' => 'center', 'class' => "center", 'nosort' => false, 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','readonly'=>false),
|
||||
'news_title' => array('title' => NWSLAN_40, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
||||
'news_summary' => array('title' => LAN_NEWS_27, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false),
|
||||
|
||||
@@ -312,7 +312,7 @@ 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' => NWSLAN_22, 'type' => 'userclass', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'batch'=>true, 'filter'=>true),
|
||||
'news_class' => array('title' => NWSLAN_22, 'type' => 'userclasses', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'batch'=>true, 'filter'=>true),
|
||||
'news_render_type' => array('title' => LAN_NEWS_49, 'type' => 'dropdown', 'data' => 'int', 'width' => 'auto', 'thclass' => 'center', 'class' => null, 'nosort' => false, 'batch'=>true, 'filter'=>true),
|
||||
'news_sticky' => array('title' => LAN_NEWS_28, 'type' => 'boolean', 'width' => 'auto', 'thclass' => 'center', 'class' => 'center', 'nosort' => false, 'batch'=>true, 'filter'=>true),
|
||||
'news_allow_comments' => array('title' => NWSLAN_15, 'type' => 'boolean', 'width' => 'auto', 'thclass' => 'center', 'class' => 'center', 'nosort' => false),
|
||||
@@ -2166,7 +2166,7 @@ class admin_newspost
|
||||
<tr>
|
||||
<td class='label'>".NWSLAN_22.":</td>
|
||||
<td class='control'>
|
||||
".$frm->uc_checkbox('news_userclass', $_POST['news_class'], 'nobody,public,guest,member,admin,classes,language', 'description=1')."
|
||||
".$frm->uc_select('news_userclass[]', $_POST['news_class'], 'nobody,public,guest,member,admin,classes,language', 'description=1&multiple=1')."
|
||||
<div class='field-help'>
|
||||
".NWSLAN_84."
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user