mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
drag and drop ordering of items.
This commit is contained in:
parent
629f7db1ab
commit
37687fd212
@ -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>
|
||||
|
@ -650,6 +650,10 @@ class e_form
|
||||
function select_open($name, $options = array())
|
||||
{
|
||||
$options = $this->format_options('select', $name, $options);
|
||||
if($options['multiple'])
|
||||
{
|
||||
$options['class'] .= ' e-multiselect';
|
||||
}
|
||||
return "<select name='{$name}'".$this->get_attributes($options, $name).">";
|
||||
}
|
||||
|
||||
@ -1298,7 +1302,7 @@ class e_form
|
||||
if($cnt)
|
||||
{
|
||||
return '
|
||||
<tr'.$trclass.' id="'.$fieldvalues[$pid].'">
|
||||
<tr'.$trclass.' id="row-'.$fieldvalues[$pid].'">
|
||||
'.$ret.'
|
||||
</tr>
|
||||
';
|
||||
@ -1328,7 +1332,7 @@ class e_form
|
||||
switch($field) // special fields
|
||||
{
|
||||
case 'options':
|
||||
|
||||
|
||||
if($attributes['type']=='method') // Allow override with 'options' function.
|
||||
{
|
||||
$attributes['mode'] = "read";
|
||||
@ -1353,12 +1357,17 @@ class e_form
|
||||
$query['action'] = 'edit';
|
||||
$query['id'] = $id;
|
||||
|
||||
|
||||
|
||||
//$edit_query = array('mode' => varset($query['mode']), 'action' => varset($query['action']), 'id' => $id);
|
||||
$query = http_build_query($query);
|
||||
|
||||
$value = "<a href='".e_SELF."?{$query}' title='".LAN_EDIT."'><img class='icon action edit list' src='".ADMIN_EDIT_ICON_PATH."' alt='".LAN_EDIT."' /></a>";
|
||||
|
||||
$value = "";
|
||||
|
||||
if(vartrue($parms['sort']))//FIXME use a global variable such as $fieldpref
|
||||
{
|
||||
$value .= "<a class='e-sort' style='cursor:move' href='".e_SELF."?".(e_QUERY ? e_QUERY."&ajax_used=1" : "ajax_used=1")."' title='Re-order'><img class='icon action S16' src='".ADMIN_SORT_ICON_PATH."' alt='' title='Re-Order' /></a> ";
|
||||
}
|
||||
|
||||
$value .= "<a href='".e_SELF."?{$query}' title='".LAN_EDIT."'><img class='icon action edit list' src='".ADMIN_EDIT_ICON_PATH."' alt='".LAN_EDIT."' /></a>";
|
||||
|
||||
$delcls = vartrue($attributes['noConfirm']) ? ' no-confirm' : '';
|
||||
if(varset($parms['deleteClass']))
|
||||
@ -1571,7 +1580,7 @@ class e_form
|
||||
{
|
||||
$value[] = $this->_uc->uc_get_classname($cid);
|
||||
}
|
||||
$value = implode(vartrue($parms['separator']), $value);
|
||||
$value = implode(vartrue($parms['separator'],"<br />"), $value);
|
||||
break;
|
||||
|
||||
/*case 'user_name':
|
||||
@ -1866,10 +1875,11 @@ class e_form
|
||||
|
||||
case 'userclass':
|
||||
case 'userclasses':
|
||||
$uc_options = vartrue($parms['classlist'], 'public,guest,nobody,member,classes,admin,main'); // defaults to 'public,guest,nobody,member,classes' (userclass handler)
|
||||
$uc_options = vartrue($parms['classlist'], 'public,guest,nobody,member,admin,main,classes'); // defaults to 'public,guest,nobody,member,classes' (userclass handler)
|
||||
unset($parms['classlist']);
|
||||
$method = $attributes['type'] == 'userclass' ? 'uc_select' : 'uc_checkbox';
|
||||
return $this->$method($key, $value, $uc_options, vartrue($parms['__options'], array()));
|
||||
$method = ($attributes['type'] == 'userclass') ? 'uc_select' : 'uc_select';
|
||||
if($atrributes['type'] == 'userclasses'){ $parms['multiple'] = true; }
|
||||
return $this->$method($key, $value, $uc_options, vartrue($parms, array()));
|
||||
break;
|
||||
|
||||
/*case 'user_name':
|
||||
|
@ -284,7 +284,7 @@ class e_media
|
||||
}
|
||||
if($cat)
|
||||
{
|
||||
$inc[] = "media_category = '".$cat."' ";
|
||||
$inc[] = "media_category REGEXP '(^|,)(".$cat.")(,|$)' "; // for multiple category field.
|
||||
}
|
||||
// TODO check the category is valid.
|
||||
|
||||
@ -391,7 +391,7 @@ class e_media
|
||||
if($cat !='_icon')
|
||||
{
|
||||
$cat = ($cat) ? $cat."+" : ""; // the '+' loads category '_common' as well as the chosen category.
|
||||
$images = $this->getImages($cat,0,23);
|
||||
$images = $this->getImages($cat,0,21);
|
||||
$class = "media-select-image";
|
||||
$w = 120;
|
||||
$h = 100;
|
||||
@ -429,7 +429,7 @@ class e_media
|
||||
parent.document.getElementById('".$prevId."').src = '".e_IMAGE_ABS."generic/blank.gif';
|
||||
return false;";
|
||||
|
||||
$text .= "<a class='{$class} media-select-none e-dialog-close' style='vertical-align:middle;display:block;float:left;' href='#' onclick=\"{$onclick_clear}\" >
|
||||
$text .= "<a class='{$class} media-select-none e-dialog-close' data-src='{$im['media_url']}' style='vertical-align:middle;display:block;float:left;' href='#' onclick=\"{$onclick_clear}\" >
|
||||
<div style='text-align:center;position: relative; top: 30%'>No image</div>
|
||||
</a>";
|
||||
}
|
||||
@ -448,25 +448,32 @@ class e_media
|
||||
$onclicki = "parent.document.getElementById('{$tagid}').value = '{$im['media_url']}';
|
||||
parent.document.getElementById('".$prevId."').src = '{$realPath}';
|
||||
return false;";
|
||||
$onclicki = "";
|
||||
$class .= " e-media-select e-dialog-close";
|
||||
}
|
||||
else // TinyMce and other applications.
|
||||
else // TinyMce and textarea bbcode
|
||||
{
|
||||
//TODO Add a preview window
|
||||
$onclicki = "document.getElementById('src').value = '{$im['media_url']}';
|
||||
document.getElementById('preview').src = '{$realPath}';
|
||||
updateBB();
|
||||
|
||||
return false;";
|
||||
$class .= " e-media-select";
|
||||
$onclicki = "";
|
||||
|
||||
}
|
||||
|
||||
$img_url = ($cat !='_icon') ? e107::getParser()->thumbUrl($im['media_url'], $att) : $media_path;
|
||||
|
||||
$text .= "<a class='{$class} e-dialog-close' title=\"".$diz."\" style='float:left' href='#' onclick=\"{$onclicki}\" >";
|
||||
$text .= "<a class='{$class} ' data-src='{$media_path}' data-target='{$tagid}' data-path='{$im['media_url']}' data-preview='{$realPath}' title=\"".$diz."\" style='float:left' href='#' onclick=\"{$onclicki}\" >";
|
||||
$text .= "<img src='".$img_url."' alt=\"".$im['media_title']."\" />";
|
||||
$text .= "</a>\n\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
$text .= "<div style='clear:both'><!-- --></div>";
|
||||
$mes = e107::getMessage();
|
||||
$mes->addDebug("Target: {$tagid}");
|
||||
$text .= "</div>";
|
||||
|
||||
return $text;
|
||||
@ -554,7 +561,7 @@ class e_media
|
||||
{
|
||||
if($this->logging == false) return;
|
||||
$insert = "\n".$message;
|
||||
file_put_contents(e_UPLOAD."upload.log",$insert,FILE_APPEND | LOCK_EX);
|
||||
file_put_contents(e_LOG."mediaUpload.log",$insert,FILE_APPEND | LOCK_EX);
|
||||
}
|
||||
|
||||
|
||||
|
BIN
e107_images/admin_images/sort_16.png
Normal file
BIN
e107_images/admin_images/sort_16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 870 B |
BIN
e107_images/admin_images/sort_32.png
Normal file
BIN
e107_images/admin_images/sort_32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
@ -23,6 +23,8 @@ if (!getperms("P"))
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
class faq_admin extends e_admin_dispatcher
|
||||
{
|
||||
|
||||
@ -63,7 +65,9 @@ class faq_cat_ui extends e_admin_ui
|
||||
protected $pluginName = 'plugin';
|
||||
protected $table = "faqs_info";
|
||||
protected $pid = "faq_info_id";
|
||||
protected $perPage = 0; //no limit
|
||||
protected $perPage = 5; //no limit
|
||||
protected $listOrder = 'faq_info_order ASC';
|
||||
|
||||
// protected $listQry = "SELECT * FROM #faq_info"; // without any Order or Limit.
|
||||
// protected $editQry = "SELECT * FROM #faq_info WHERE faq_info_id = {ID}";
|
||||
|
||||
@ -76,9 +80,30 @@ class faq_cat_ui extends e_admin_ui
|
||||
'faq_info_parent' => array('title'=> LAN_CATEGORY, 'type' => 'text', 'width' => '5%'),
|
||||
'faq_info_class' => array('title'=> LAN_VISIBILITY, 'type' => 'userclass', 'width' => 'auto', 'data' => 'int'),
|
||||
'faq_info_order' => array('title'=> LAN_ORDER, 'type' => 'text', 'width' => '5%', 'thclass' => 'left' ),
|
||||
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'forced'=>TRUE, 'thclass' => 'center last', 'class' => 'center')
|
||||
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'forced'=>TRUE, 'thclass' => 'center last', 'class' => 'center','readParms'=>'sort=1')
|
||||
);
|
||||
|
||||
public function init()
|
||||
{
|
||||
if(e_AJAX_REQUEST) // ajax link sorting.
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
$c=0;
|
||||
if(isset($_POST['all']))
|
||||
{
|
||||
foreach($_POST['all'] as $id)
|
||||
{
|
||||
$sql->db_Update("faqs_info","faq_info_order = ".intval($c)." WHERE faq_info_id = ".intval($id));
|
||||
$c++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Get FAQ Category data
|
||||
*
|
||||
@ -131,11 +156,12 @@ class faq_main_ui extends e_admin_ui
|
||||
// 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}";
|
||||
|
||||
protected $pid = "faq_id";
|
||||
protected $perPage = 10;
|
||||
protected $batchDelete = true;
|
||||
protected $pid = "faq_id";
|
||||
protected $perPage = 10;
|
||||
protected $batchDelete = true;
|
||||
protected $listOrder = 'faq_order ASC';
|
||||
|
||||
//TODO - finish 'user' type, set 'data' to all editable fields, set 'noedit' for all non-editable fields
|
||||
protected $fields = array(
|
||||
@ -149,11 +175,11 @@ class faq_main_ui extends e_admin_ui
|
||||
'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_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)
|
||||
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center')
|
||||
'faq_order' => array('title'=> "Order", 'type' => 'number', 'data'=> 'int','width' => '5%', 'thclass' => 'center','nolist' => true ),
|
||||
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center','readParms'=>'sort=1')
|
||||
);
|
||||
|
||||
// protected $fieldpref = array('checkboxes', 'comment_id', 'comment_item_id', 'comment_author_id', 'comment_author_name', 'comment_subject', 'comment_comment', 'comment_type', 'options');
|
||||
protected $fieldpref = array('checkboxes', 'faq_question', 'faq_answer', 'faq_parent', 'faq_datestamp', 'options');
|
||||
|
||||
|
||||
// optional, if $pluginName == 'core', core prefs will be used, else e107::getPluginConfig($pluginName);
|
||||
@ -162,6 +188,34 @@ class faq_main_ui extends e_admin_ui
|
||||
'submit_question' => array('title'=> 'Allow submitting of Questions by:', 'type'=>'userclass'),
|
||||
'classic_look' => array('title'=> 'Use Classic Layout', 'type'=>'boolean')
|
||||
);
|
||||
|
||||
public function init()
|
||||
{
|
||||
if(e_AJAX_REQUEST) // ajax link sorting.
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
$c= ($_GET['from']) ? intval($_GET['from']) : 0;
|
||||
$updated = array();
|
||||
foreach($_POST['all'] as $row)
|
||||
{
|
||||
|
||||
list($tmp,$id) = explode("-",$row);
|
||||
if($sql->db_Update("faqs","faq_order = ".intval($c)." WHERE faq_id = ".intval($id)))
|
||||
{
|
||||
$updated[] = $id;
|
||||
}
|
||||
$c++;
|
||||
}
|
||||
|
||||
// echo "Updated ".implode(",",$updated);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* FAQ categories
|
||||
|
@ -110,6 +110,8 @@ e107::js('core', 'plupload/plupload.full.js', 'jquery', 2);
|
||||
e107::css('core', 'plupload/jquery.plupload.queue/css/jquery.plupload.queue.css', 'jquery');
|
||||
e107::js('core', 'plupload/jquery.plupload.queue/jquery.plupload.queue.js', 'jquery', 2);
|
||||
|
||||
e107::css('core', 'chosen/chosen.css', 'jquery');
|
||||
e107::js('core', 'chosen/chosen.jquery.min.js', 'jquery', 2);
|
||||
//
|
||||
|
||||
|
||||
@ -150,6 +152,9 @@ e107::js('inline','
|
||||
$( ".e-tabs" ).tabs();
|
||||
});
|
||||
|
||||
$(".e-multiselect").chosen();
|
||||
|
||||
|
||||
// Decorate
|
||||
$(".adminlist tr:even").addClass("even");
|
||||
$(".adminlist tr:odd").addClass("odd");
|
||||
@ -240,9 +245,12 @@ e107::js('inline','
|
||||
|
||||
// Sorting
|
||||
var fixHelper = function(e, ui) {
|
||||
ui.closest("tr").switchClass( "odd", "highlight-odd", 0 );
|
||||
ui.closest("tr").switchClass( "even", "highlight-even", 0 );
|
||||
ui.children().each(function() {
|
||||
$(this).width($(this).width());
|
||||
$(this).addClass("e-moving");
|
||||
// $(this).closest("tr").switchClass( "odd", "highlight-odd", 0 );
|
||||
// $(this).closest("tr").switchClass( "even", "highlight-even", 0 );
|
||||
});
|
||||
return ui;
|
||||
};
|
||||
@ -251,19 +259,37 @@ e107::js('inline','
|
||||
helper: fixHelper,
|
||||
cursor: "move",
|
||||
opacity: 0.9,
|
||||
handle: ".e-sort",
|
||||
distance: 20,
|
||||
containment: "parent",
|
||||
update: function(event, ui) {
|
||||
stop: function(e,ui) {
|
||||
var allItems = $(this).sortable("toArray");
|
||||
var newSortValue = allItems.indexOf( $(ui.item).attr("id") );
|
||||
// alert($(ui.item).attr("id") + " was moved to index " + newSortValue);
|
||||
$(".highlight-even").switchClass( "highlight-even", "even", 600 );
|
||||
$(".highlight-odd").switchClass( "highlight-odd", "odd", 600 );
|
||||
},
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "links.php?ajax_used=1",
|
||||
data: { name: "hi", location: "Boston" }
|
||||
}).done(function( msg ) {
|
||||
update: function(event, ui) {
|
||||
var allItems = $(this).sortable("toArray");
|
||||
// console.log(allItems);
|
||||
var neworder = allItems.indexOf( $(ui.item).attr("id") );
|
||||
var linkid = $(ui.item).attr("id");
|
||||
// $("td").removeClass("e-moving","slow");
|
||||
|
||||
var script = $(".e-sort:first").attr("href");
|
||||
// alert(script);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: script,
|
||||
data: { all: allItems, linkid: linkid, neworder: neworder }
|
||||
// data: { linkid: linkid, neworder: neworder }
|
||||
}).done(function( msg ) {
|
||||
|
||||
alert( "Data Saved: " + msg );
|
||||
});
|
||||
// alert("Posted: "+allItems+" Updated: "+ msg );
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}).disableSelection();
|
||||
|
||||
@ -305,70 +331,14 @@ e107::js('inline','
|
||||
});
|
||||
|
||||
|
||||
// Upload Handling
|
||||
|
||||
|
||||
$(".e-dialog-close").click(function () {
|
||||
parent.$.colorbox.close()
|
||||
});
|
||||
|
||||
|
||||
$(function() {
|
||||
var path = $("#uploader").attr("rel");
|
||||
|
||||
$("#uploader").pluploadQueue({
|
||||
// General settings
|
||||
runtimes : "html5,html4",
|
||||
url : path,
|
||||
max_file_size : "10mb",
|
||||
chunk_size : "1mb",
|
||||
unique_names : false,
|
||||
|
||||
// Resize images on clientside if we can
|
||||
resize : {width : 320, height : 240, quality : 90},
|
||||
|
||||
// Specify what files to browse for
|
||||
filters : [
|
||||
{title : "Image files", extensions : "jpg,gif,png"},
|
||||
{title : "Zip files", extensions : "zip,gz"}
|
||||
]
|
||||
,
|
||||
// Error reporting etc
|
||||
preinit: attachError,
|
||||
setup: attachCallbacks
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Attach widget callbacks
|
||||
function attachError(Uploader) {
|
||||
Uploader.bind("FileUploaded", function(up, file, response) {
|
||||
var data = $.parseJSON(response.response);
|
||||
console.log("[FileUploaded] Response - " + response.response);
|
||||
|
||||
if (data.error == 1) {
|
||||
up.trigger("Error", {message: "\'" + data.message + "\'", file: file});
|
||||
console.log("[Error] " + file.id + " : " + data.message);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function attachCallbacks(Uploader) {
|
||||
Uploader.bind("Init", function(up) {
|
||||
up.settings.multipart_params = {
|
||||
"upload_type" : $("#uploadQueue").attr("data-uploadType"),
|
||||
"xref_id" : $("#uploadQueue").attr("data-xrefID"),
|
||||
"image_category" : $("#uploadQueue").attr("data-imageCategory")
|
||||
};
|
||||
});
|
||||
|
||||
Uploader.bind("UploadComplete", function(up, files) {
|
||||
console.log("[UploadComplete]");
|
||||
|
||||
$(".plupload_buttons").css("display", "inline");
|
||||
$(".plupload_upload_status").css("display", "inline");
|
||||
$(".plupload_start").addClass("plupload_disabled");
|
||||
alert("it worked");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -399,8 +369,11 @@ e107::js('inline','
|
||||
|
||||
','jquery');
|
||||
|
||||
e107::js("core","plupload/customUpload.js","jquery",3);
|
||||
e107::js("core","core/mediaManager.js","jquery",3);
|
||||
|
||||
e107::css('inline',"
|
||||
.e-moving { background-color:yellow; }
|
||||
.e-moving { background-color:silver; }
|
||||
tr.highlight-even { background-color:silver; }
|
||||
tr.highlight-odd { background-color:silver; }
|
||||
legend { display: none; }
|
||||
|
@ -833,3 +833,4 @@ a.media-select-icon { text-align:center; vertical-align:middle; margin:1px; bo
|
||||
a.media-select-icon:hover { border:1px solid red; }
|
||||
.media-select-container { padding:10px; }
|
||||
.media-select-none { text-decoration:none; }
|
||||
.media-select-active { border: 2px solid silver; }
|
||||
|
@ -59,5 +59,11 @@
|
||||
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_ABS."admin_images/up_16.png");
|
||||
|
||||
define("ADMIN_EXECUTE_ICON", "<img class='icon action S16' src='".e_IMAGE_ABS."admin_images/execute_16.png' alt='' title='".LAN_DELETE."' />");
|
||||
define("ADMIN_EXECUTE_ICON", "<img class='icon action S16' src='".e_IMAGE_ABS."admin_images/execute_16.png' alt='' title='Run' />");//TODO LAN
|
||||
define("ADMIN_EXECUTE_ICON_PATH", e_IMAGE."admin_images/execute_16.png");
|
||||
|
||||
define("ADMIN_SORT_ICON", "<img class='icon action S16' src='".e_IMAGE_ABS."admin_images/sort_16.png' alt='' title='Sort' />"); //TODO LAN
|
||||
define("ADMIN_SORT_ICON_PATH", e_IMAGE."admin_images/sort_16.png");
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user