mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 13:17:24 +02:00
Admin-ui: readParm['url'] added and other url fixes.
This commit is contained in:
@@ -4238,7 +4238,7 @@ class e_admin_controller_ui extends e_admin_controller
|
|||||||
|
|
||||||
e107::getDb()->gen($sql);
|
e107::getDb()->gen($sql);
|
||||||
|
|
||||||
$qry = "SELECT *, getTreeSort(".$pid.") as _treesort, getDepth(".$pid.") as _depth FROM `#".$table."` ";
|
$qry = "SELECT SQL_CALC_FOUND_ROWS *, getTreeSort(".$pid.") as _treesort, getDepth(".$pid.") as _depth FROM `#".$table."` ";
|
||||||
|
|
||||||
if($orderby === true)
|
if($orderby === true)
|
||||||
{
|
{
|
||||||
|
@@ -4008,6 +4008,67 @@ class e_form
|
|||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a value should be linked and wrap in <a> tag if required.
|
||||||
|
* @todo global pref for the target option?
|
||||||
|
* @param mixed $value
|
||||||
|
* @param array $parms
|
||||||
|
* @param $id
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function renderLink($value, $parms, $id=null)
|
||||||
|
{
|
||||||
|
if(empty($parms['link']) && empty($parms['url']))
|
||||||
|
{
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
$dialog = vartrue($parms['target']) =='dialog' ? " e-modal" : ""; // iframe
|
||||||
|
$ext = vartrue($parms['target']) =='blank' ? " rel='external' " : ""; // new window
|
||||||
|
$modal = vartrue($parms['target']) =='modal' ? " data-toggle='modal' data-cache='false' data-target='#uiModal' " : "";
|
||||||
|
|
||||||
|
|
||||||
|
if(!empty($parms['url'])) // ie. use e_url.php
|
||||||
|
{
|
||||||
|
$plugin = $this->getController()->getPluginName();
|
||||||
|
$data = $this->getController()->getListModel()->getData();
|
||||||
|
$link = e107::url($plugin,$parms['url'],$data);
|
||||||
|
}
|
||||||
|
else // old way.
|
||||||
|
{
|
||||||
|
$tp = e107::getParser();
|
||||||
|
|
||||||
|
$link = str_replace('[id]',$id,$parms['link']);
|
||||||
|
$link = $tp->replaceConstants($link); // SEF URL is not important since we're in admin.
|
||||||
|
|
||||||
|
|
||||||
|
if($parms['link'] === 'sef' && $this->getController()->getListModel())
|
||||||
|
{
|
||||||
|
$model = $this->getController()->getListModel();
|
||||||
|
|
||||||
|
if(!$model->getUrl())
|
||||||
|
{
|
||||||
|
$model->setUrl($this->getController()->getUrl());
|
||||||
|
}
|
||||||
|
// assemble the url
|
||||||
|
$link = $model->url(null);
|
||||||
|
}
|
||||||
|
elseif(!empty($data[$parms['link']])) // support for a field-name as the link. eg. link_url.
|
||||||
|
{
|
||||||
|
$data = $this->getController()->getListModel()->getData();
|
||||||
|
$link = $tp->replaceConstants(vartrue($data[$parms['link']]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// in case something goes wrong...
|
||||||
|
if($link)
|
||||||
|
{
|
||||||
|
return "<a class='e-tip{$dialog}' {$ext} href='".$link."' {$modal} title='".LAN_EFORM_010."' >".$value."</a>";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4048,6 +4109,9 @@ class e_form
|
|||||||
$attributes['type'] = $parms['type'];
|
$attributes['type'] = $parms['type'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->renderValueTrigger($field, $value, $parms, $id);
|
$this->renderValueTrigger($field, $value, $parms, $id);
|
||||||
|
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
@@ -4166,11 +4230,16 @@ class e_form
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) // avoid bad markup, better solution coming up
|
if(empty($attributes['noedit']) && !empty($parms['editable']) && empty($parms['link'])) // avoid bad markup, better solution coming up
|
||||||
{
|
{
|
||||||
$mode = preg_replace('/[^\w]/', '', vartrue($_GET['mode'], ''));
|
$mode = preg_replace('/[^\w]/', '', vartrue($_GET['mode'], ''));
|
||||||
$value = "<a class='e-tip e-editable editable-click' data-name='".$field."' title=\"".LAN_EDIT." ".$attributes['title']."\" data-type='text' data-pk='".$id."' data-url='".e_SELF."?mode={$mode}&action=inline&id={$id}&ajax_used=1' href='#'>".$value."</a>";
|
$value = "<a class='e-tip e-editable editable-click' data-name='".$field."' title=\"".LAN_EDIT." ".$attributes['title']."\" data-type='text' data-pk='".$id."' data-url='".e_SELF."?mode={$mode}&action=inline&id={$id}&ajax_used=1' href='#'>".$value."</a>";
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$value = $this->renderLink($value,$parms,$id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$value = vartrue($parms['pre']).$value.vartrue($parms['post']);
|
$value = vartrue($parms['pre']).$value.vartrue($parms['post']);
|
||||||
// else same
|
// else same
|
||||||
@@ -4317,19 +4386,22 @@ class e_form
|
|||||||
$value = defset($value, $value);
|
$value = defset($value, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(vartrue($parms['truncate']))
|
if(!empty($parms['truncate']))
|
||||||
{
|
{
|
||||||
$value = $tp->text_truncate($value, $parms['truncate'], '...');
|
$value = $tp->text_truncate($value, $parms['truncate'], '...');
|
||||||
}
|
}
|
||||||
elseif(vartrue($parms['htmltruncate']))
|
elseif(!empty($parms['htmltruncate']))
|
||||||
{
|
{
|
||||||
$value = $tp->html_truncate($value, $parms['htmltruncate'], '...');
|
$value = $tp->html_truncate($value, $parms['htmltruncate'], '...');
|
||||||
}
|
}
|
||||||
if(vartrue($parms['wrap']))
|
if(!empty($parms['wrap']))
|
||||||
{
|
{
|
||||||
$value = $tp->htmlwrap($value, (int) $parms['wrap'], varset($parms['wrapChar'], ' '));
|
$value = $tp->htmlwrap($value, (int) $parms['wrap'], varset($parms['wrapChar'], ' '));
|
||||||
}
|
}
|
||||||
if(vartrue($parms['link']) && $id/* && is_numeric($id)*/)
|
|
||||||
|
$value = $this->renderLink($value,$parms,$id);
|
||||||
|
/*
|
||||||
|
if(!empty($parms['link']) && $id)
|
||||||
{
|
{
|
||||||
$link = str_replace('[id]', $id, $parms['link']);
|
$link = str_replace('[id]', $id, $parms['link']);
|
||||||
$link = $tp->replaceConstants($link); // SEF URL is not important since we're in admin.
|
$link = $tp->replaceConstants($link); // SEF URL is not important since we're in admin.
|
||||||
@@ -4338,9 +4410,7 @@ class e_form
|
|||||||
$ext = vartrue($parms['target']) == 'blank' ? " rel='external' " : ""; // new window
|
$ext = vartrue($parms['target']) == 'blank' ? " rel='external' " : ""; // new window
|
||||||
$modal = vartrue($parms['target']) == 'modal' ? " data-toggle='modal' data-cache='false' data-target='#uiModal' " : "";
|
$modal = vartrue($parms['target']) == 'modal' ? " data-toggle='modal' data-cache='false' data-target='#uiModal' " : "";
|
||||||
|
|
||||||
if($parms['link'] == 'sef' && $this->getController()
|
if($parms['link'] == 'sef' && $this->getController()->getListModel())
|
||||||
->getListModel()
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
$model = $this->getController()->getListModel();
|
$model = $this->getController()->getListModel();
|
||||||
// copy url config
|
// copy url config
|
||||||
@@ -4351,6 +4421,7 @@ class e_form
|
|||||||
// assemble the url
|
// assemble the url
|
||||||
$link = $model->url();
|
$link = $model->url();
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif(vartrue($data[$parms['link']])) // support for a field-name as the link. eg. link_url.
|
elseif(vartrue($data[$parms['link']])) // support for a field-name as the link. eg. link_url.
|
||||||
{
|
{
|
||||||
$link = $tp->replaceConstants(vartrue($data[$parms['link']]));
|
$link = $tp->replaceConstants(vartrue($data[$parms['link']]));
|
||||||
@@ -4361,7 +4432,7 @@ class e_form
|
|||||||
{
|
{
|
||||||
$value = "<a class='e-tip{$dialog}' {$ext} href='" . $link . "' {$modal} title='".LAN_EFORM_010."' >" . $value . "</a>";
|
$value = "<a class='e-tip{$dialog}' {$ext} href='" . $link . "' {$modal} title='".LAN_EFORM_010."' >" . $value . "</a>";
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if(empty($value))
|
if(empty($value))
|
||||||
{
|
{
|
||||||
@@ -4417,7 +4488,11 @@ class e_form
|
|||||||
{
|
{
|
||||||
$value = $tp->htmlwrap($value, (int)$parms['wrap'], varset($parms['wrapChar'], ' '));
|
$value = $tp->htmlwrap($value, (int)$parms['wrap'], varset($parms['wrapChar'], ' '));
|
||||||
}
|
}
|
||||||
if(vartrue($parms['link']) && $id/* && is_numeric($id)*/)
|
|
||||||
|
$value = $this->renderLink($value,$parms,$id);
|
||||||
|
|
||||||
|
/*
|
||||||
|
if(vartrue($parms['link']) && $id)
|
||||||
{
|
{
|
||||||
$link = str_replace('[id]',$id,$parms['link']);
|
$link = str_replace('[id]',$id,$parms['link']);
|
||||||
$link = $tp->replaceConstants($link); // SEF URL is not important since we're in admin.
|
$link = $tp->replaceConstants($link); // SEF URL is not important since we're in admin.
|
||||||
@@ -4441,7 +4516,7 @@ class e_form
|
|||||||
|
|
||||||
// in case something goes wrong...
|
// in case something goes wrong...
|
||||||
if($link) $value = "<a class='e-tip{$dialog}' {$ext} href='".$link."' {$modal} title='".LAN_EFORM_010."' >".$value."</a>";
|
if($link) $value = "<a class='e-tip{$dialog}' {$ext} href='".$link."' {$modal} title='".LAN_EFORM_010."' >".$value."</a>";
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if(empty($value))
|
if(empty($value))
|
||||||
{
|
{
|
||||||
@@ -4993,6 +5068,7 @@ class e_form
|
|||||||
//TODO - order
|
//TODO - order
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
$value = $this->renderLink($value,$parms,$id);
|
||||||
//unknown type
|
//unknown type
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -126,11 +126,11 @@ class plugin_download_admin extends e_admin_dispatcher
|
|||||||
|
|
||||||
class download_cat_ui extends e_admin_ui
|
class download_cat_ui extends e_admin_ui
|
||||||
{
|
{
|
||||||
protected $pluginTitle = LAN_PLUGIN_DOWNLOAD_NAME;
|
protected $pluginTitle = LAN_PLUGIN_DOWNLOAD_NAME;
|
||||||
protected $pluginName = 'download';
|
protected $pluginName = 'download';
|
||||||
protected $table = "download_category";
|
protected $table = "download_category";
|
||||||
protected $pid = "download_category_id";
|
protected $pid = "download_category_id";
|
||||||
protected $perPage = 0; //no limit
|
protected $perPage = 0; //no limit
|
||||||
|
|
||||||
protected $batchCopy = true;
|
protected $batchCopy = true;
|
||||||
|
|
||||||
@@ -138,14 +138,17 @@ class download_cat_ui extends e_admin_ui
|
|||||||
protected $sortField = 'download_category_order';
|
protected $sortField = 'download_category_order';
|
||||||
protected $sortParent = 'download_category_parent';
|
protected $sortParent = 'download_category_parent';
|
||||||
protected $treePrefix = 'download_category_name';
|
protected $treePrefix = 'download_category_name';
|
||||||
// protected $orderStep = 1000;
|
// protected $orderStep = // automatic
|
||||||
// protected $listOrder = null; // automatic
|
// protected $listOrder = // automatic
|
||||||
|
|
||||||
|
//legacy URL scheme
|
||||||
|
protected $url = array('route'=>'download/list/category', 'vars' => array('id' => 'download_category_id', 'name' => 'download_category_sef'), 'name' => 'download_category_name', 'description' => ''); // 'link' only needed if profile not provided.
|
||||||
|
|
||||||
|
|
||||||
protected $fields = array(
|
protected $fields = array(
|
||||||
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
|
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
|
||||||
'download_category_icon' => array('title'=> LAN_ICON, 'type' => 'method', 'width' => '5%', 'thclass' => 'center','class'=>'center','writeParms'=>'glyphs=1' ),
|
'download_category_icon' => array('title'=> LAN_ICON, 'type' => 'method', 'width' => '5%', 'thclass' => 'center','class'=>'center','writeParms'=>'glyphs=1' ),
|
||||||
'download_category_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'forced'=> TRUE),
|
'download_category_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'forced'=> TRUE, 'readParms'=>'link=sef&target=blank'),
|
||||||
'download_category_name' => array('title'=> LAN_TITLE, 'type' => 'text', 'data'=>'str', 'inline' => true, 'width' => 'auto', 'thclass' => 'left', 'writeParms'=>'size=xxlarge'),
|
'download_category_name' => array('title'=> LAN_TITLE, 'type' => 'text', 'data'=>'str', 'inline' => true, 'width' => 'auto', 'thclass' => 'left', 'writeParms'=>'size=xxlarge'),
|
||||||
'download_category_sef' => array('title'=> LAN_SEFURL, 'type' => 'text', 'data'=>'str', 'inline' => true, 'width' => 'auto', 'thclass' => 'left', 'writeParms'=>'size=xxlarge'),
|
'download_category_sef' => array('title'=> LAN_SEFURL, 'type' => 'text', 'data'=>'str', 'inline' => true, 'width' => 'auto', 'thclass' => 'left', 'writeParms'=>'size=xxlarge'),
|
||||||
|
|
||||||
@@ -307,7 +310,7 @@ class download_main_admin_ui extends e_admin_ui
|
|||||||
'download_name' => array('title'=> LAN_TITLE, 'type' => 'text', 'data' => 'str', 'inline'=>true, 'width' => 'auto', 'thclass' => ''),
|
'download_name' => array('title'=> LAN_TITLE, 'type' => 'text', 'data' => 'str', 'inline'=>true, 'width' => 'auto', 'thclass' => ''),
|
||||||
'download_url' => array('title'=> DOWLAN_13, 'type' => 'url', 'data' => 'str', 'width'=>'auto', 'thclass' => '', 'batch' => TRUE, 'filter'=>TRUE),
|
'download_url' => array('title'=> DOWLAN_13, 'type' => 'url', 'data' => 'str', 'width'=>'auto', 'thclass' => '', 'batch' => TRUE, 'filter'=>TRUE),
|
||||||
'download_sef' => array('title'=> LAN_SEFURL, 'type' => 'text', 'inline'=>true, 'data' => 'str', 'width'=>'auto', 'thclass' => '', 'batch' => TRUE, 'filter'=>TRUE, 'writeParms'=>'sef=download_name'),
|
'download_sef' => array('title'=> LAN_SEFURL, 'type' => 'text', 'inline'=>true, 'data' => 'str', 'width'=>'auto', 'thclass' => '', 'batch' => TRUE, 'filter'=>TRUE, 'writeParms'=>'sef=download_name'),
|
||||||
'download_keywords' => array('title'=> LAN_KEYWORDS, 'type' => 'tags', 'inline'=>true, 'data' => 'str', 'width'=>'auto', 'thclass' => ''),
|
'download_keywords' => array('title'=> LAN_KEYWORDS, 'type' => 'tags', 'inline'=>true, 'data' => 'str', 'width'=>'auto', 'thclass' => ''),
|
||||||
|
|
||||||
'download_author' => array('title'=> LAN_AUTHOR, 'type' => 'user', 'data' => 'str', 'width' => 'auto', 'thclass' => 'left'),
|
'download_author' => array('title'=> LAN_AUTHOR, 'type' => 'user', 'data' => 'str', 'width' => 'auto', 'thclass' => 'left'),
|
||||||
'download_author_email' => array('title'=> DOWLAN_16, 'type' => 'email', 'data' => 'str', 'width' => 'auto', 'thclass' => 'left'),
|
'download_author_email' => array('title'=> DOWLAN_16, 'type' => 'email', 'data' => 'str', 'width' => 'auto', 'thclass' => 'left'),
|
||||||
|
@@ -1555,9 +1555,9 @@ td img.thumbnail { margin-bottom:0 }
|
|||||||
/* Parent/Child Indicator */
|
/* Parent/Child Indicator */
|
||||||
.treeprefix {margin-right:4px}
|
.treeprefix {margin-right:4px}
|
||||||
.treeprefix.level-2 { margin-left:10px }
|
.treeprefix.level-2 { margin-left:10px }
|
||||||
.treeprefix.level-3 { margin-left:30px }
|
.treeprefix.level-3 { margin-left:35px }
|
||||||
.treeprefix.level-4 { margin-left:50px }
|
.treeprefix.level-4 { margin-left:60px }
|
||||||
.treeprefix.level-5 { margin-left:70px }
|
.treeprefix.level-5 { margin-left:85px }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user