mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 06:38:00 +02:00
Preparation for Feature-box batch option.
This commit is contained in:
@@ -302,11 +302,26 @@ class page_admin_ui extends e_admin_ui
|
|||||||
protected $batchDelete = true;
|
protected $batchDelete = true;
|
||||||
protected $batchCopy = true;
|
protected $batchCopy = true;
|
||||||
protected $batchLink = true;
|
protected $batchLink = true;
|
||||||
|
protected $batchFeaturebox = true;
|
||||||
protected $sortField = 'page_order';
|
protected $sortField = 'page_order';
|
||||||
protected $orderStep = 10;
|
protected $orderStep = 10;
|
||||||
//protected $url = array('profile'=>'page/view', 'name' => 'page_title', 'description' => '', 'link'=>'{e_BASE}page.php?id=[id]'); // 'link' only needed if profile not provided.
|
//protected $url = array('profile'=>'page/view', 'name' => 'page_title', 'description' => '', 'link'=>'{e_BASE}page.php?id=[id]'); // 'link' only needed if profile not provided.
|
||||||
protected $url = array('route'=>'page/view/index', 'vars' => array('id' => 'page_id', 'sef' => 'page_sef'), 'name' => 'page_title', 'description' => ''); // 'link' only needed if profile not provided.
|
protected $url = array('route'=>'page/view/index', 'vars' => array('id' => 'page_id', 'sef' => 'page_sef'), 'name' => 'page_title', 'description' => ''); // 'link' only needed if profile not provided.
|
||||||
protected $tabs = array("Page","Page Options","Menu");
|
protected $tabs = array("Page","Page Options","Menu");
|
||||||
|
protected $featurebox = array('title'=>'page_title', 'text'=>'page_text');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 'fb_title' => array('title'=> LAN_TITLE, 'type' => 'text', 'inline'=>true, 'width' => 'auto', 'thclass' => 'left'),
|
||||||
|
'fb_text' => array('title'=> FBLAN_08, 'type' => 'bbarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=50&bb=1','writeParms'=>'template=admin'),
|
||||||
|
//DEPRECATED 'fb_mode' => array('title'=> FBLAN_12, 'type' => 'dropdown', 'data'=> 'int', 'width' => '5%', 'filter'=>TRUE, 'batch'=>TRUE),
|
||||||
|
//DEPRECATED 'fb_rendertype' => array('title'=> FBLAN_22, 'type' => 'dropdown', 'data'=> 'int', 'width' => 'auto', 'noedit' => TRUE),
|
||||||
|
'fb_template' => array('title'=> LAN_TEMPLATE, 'type' => 'layouts', 'data'=> 'str', 'width' => 'auto', 'writeParms' => 'plugin=featurebox', 'filter' => true, 'batch' => true), // Photo
|
||||||
|
'fb_image' => array('title'=> "Image", 'type' => 'image', 'width' => 'auto', 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60'),
|
||||||
|
'fb_imageurl' => array('title'=> "Image Link", 'type' => 'url', 'width' => 'auto'),
|
||||||
|
'fb_class'
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
// protected $listSorting = true;
|
// protected $listSorting = true;
|
||||||
|
|
||||||
// PAGE LIST/EDIT and MENU EDIT modes.
|
// PAGE LIST/EDIT and MENU EDIT modes.
|
||||||
|
@@ -2368,6 +2368,12 @@ class e_admin_controller_ui extends e_admin_controller
|
|||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
protected $batchLink = false;
|
protected $batchLink = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
protected $batchFeaturebox = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Could be LAN constant (mulit-language support)
|
* Could be LAN constant (mulit-language support)
|
||||||
*
|
*
|
||||||
@@ -2428,6 +2434,13 @@ class e_admin_controller_ui extends e_admin_controller
|
|||||||
return $this->batchLink;
|
return $this->batchLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getBatchFeaturebox()
|
||||||
|
{
|
||||||
|
return $this->batchFeaturebox;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@@ -2465,6 +2478,16 @@ class e_admin_controller_ui extends e_admin_controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Featurebox Copy
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getFeaturebox()
|
||||||
|
{
|
||||||
|
return $this->featurebox;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all field data
|
* Get all field data
|
||||||
* @return array
|
* @return array
|
||||||
@@ -4013,7 +4036,6 @@ class e_admin_ui extends e_admin_controller_ui
|
|||||||
*/
|
*/
|
||||||
protected function handleListUrlBatch($selected)
|
protected function handleListUrlBatch($selected)
|
||||||
{
|
{
|
||||||
// Batch Copy
|
|
||||||
if($this->_add2nav($selected))
|
if($this->_add2nav($selected))
|
||||||
{
|
{
|
||||||
//e107::getMessage()->moveToSession();
|
//e107::getMessage()->moveToSession();
|
||||||
@@ -4022,6 +4044,24 @@ class e_admin_ui extends e_admin_controller_ui
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** TODO
|
||||||
|
* Batch Featurebox Transfer
|
||||||
|
* @param array $selected
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function handleListFeatureboxBatch($selected)
|
||||||
|
{
|
||||||
|
if($this->_add2featurebox($selected))
|
||||||
|
{
|
||||||
|
//e107::getMessage()->moveToSession();
|
||||||
|
//$this->redirect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected function _add2nav($selected)
|
protected function _add2nav($selected)
|
||||||
{
|
{
|
||||||
if(empty($selected)) return false;// TODO warning message
|
if(empty($selected)) return false;// TODO warning message
|
||||||
@@ -4091,6 +4131,89 @@ class e_admin_ui extends e_admin_controller_ui
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected function _add2featurebox($selected)
|
||||||
|
{
|
||||||
|
if(empty($selected)) return false;// TODO warning message
|
||||||
|
|
||||||
|
if(!is_array($selected)) $selected = array($selected);
|
||||||
|
|
||||||
|
$sql = e107::getDb();
|
||||||
|
//$allData = $this->getFeaturebox();
|
||||||
|
$allData = $this->getTreeModel()->featurebox($selected, array('sc' => true), true);
|
||||||
|
|
||||||
|
e107::getMessage()->addDebug('Using Featurebox Info:'.print_a($data,true));
|
||||||
|
|
||||||
|
|
||||||
|
// print_a($allData);
|
||||||
|
echo "EXIT";
|
||||||
|
exit;
|
||||||
|
|
||||||
|
|
||||||
|
$scount = 0;
|
||||||
|
foreach($allData as $id => $data)
|
||||||
|
{
|
||||||
|
$name = $data['name'];
|
||||||
|
$desc = $data['text'];
|
||||||
|
|
||||||
|
$fbArray = array(
|
||||||
|
'fb_title' => varset($data['name']),
|
||||||
|
'fb_text' => varset($data['text']),
|
||||||
|
'fb_image' => varset($data['image']),
|
||||||
|
'fb_imageurl' => varset($data['url']),
|
||||||
|
);
|
||||||
|
|
||||||
|
$res = $sql->insert('featurebox', $fbArray);
|
||||||
|
|
||||||
|
// FIXME lans
|
||||||
|
if($res !== FALSE)
|
||||||
|
{
|
||||||
|
e107::getMessage()->addSuccess('Created Featurebox Item: <b>'.($name ? $name : 'n/a')."</b>");
|
||||||
|
$scount++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if($sql->getLastErrorNumber())
|
||||||
|
{
|
||||||
|
e107::getMessage()->addError('SQL Featurebox Creation Error'); //TODO - Lan
|
||||||
|
e107::getMessage()->addDebug('SQL Featurebox Creation Error #'.$sql->getLastErrorNumber().': '.$sql->getLastErrorText());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e107::getMessage()->addError('Unknown error: <b>'.$name."</b> not added");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if($scount > 0)
|
||||||
|
{
|
||||||
|
e107::getMessage()->addSuccess("<br /><strong>{$scount}</strong> new sitelinks were added but are currently unassigned. You should now modify these links to your liking.<br /><br /><a class='btn btn-small btn-primary' href='".e_ADMIN_ABS."links.php?searchquery=&filter_options=link_category__255'>Modify Links</a>");
|
||||||
|
return $scount;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Batch boolean trigger
|
* Batch boolean trigger
|
||||||
* @param array $selected
|
* @param array $selected
|
||||||
@@ -5058,7 +5181,7 @@ class e_admin_form_ui extends e_form
|
|||||||
'fields' => $controller->getFields(), // see e_admin_ui::$fields
|
'fields' => $controller->getFields(), // see e_admin_ui::$fields
|
||||||
'fieldpref' => $controller->getFieldPref(), // see e_admin_ui::$fieldpref
|
'fieldpref' => $controller->getFieldPref(), // see e_admin_ui::$fieldpref
|
||||||
'table_pre' => '', // markup to be added before opening table element
|
'table_pre' => '', // markup to be added before opening table element
|
||||||
'table_post' => !$tree[$id]->isEmpty() ? $this->renderBatch($controller->getBatchDelete(),$controller->getBatchCopy(),$controller->getBatchLink()) : '',
|
'table_post' => !$tree[$id]->isEmpty() ? $this->renderBatch($controller->getBatchDelete(),$controller->getBatchCopy(),$controller->getBatchLink(),$controller->getBatchFeaturebox()) : '',
|
||||||
'fieldset_pre' => '', // markup to be added before opening fieldset element
|
'fieldset_pre' => '', // markup to be added before opening fieldset element
|
||||||
'fieldset_post' => '', // markup to be added after closing fieldset element
|
'fieldset_post' => '', // markup to be added after closing fieldset element
|
||||||
'perPage' => $controller->getPerPage(), // if 0 - no next/prev navigation
|
'perPage' => $controller->getPerPage(), // if 0 - no next/prev navigation
|
||||||
@@ -5286,7 +5409,7 @@ class e_admin_form_ui extends e_form
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FIXME - use e_form::batchoptions(), nice way of buildig batch dropdown - news administration show_batch_options()
|
// FIXME - use e_form::batchoptions(), nice way of buildig batch dropdown - news administration show_batch_options()
|
||||||
function renderBatch($allow_delete = false,$allow_copy= false, $allow_url=false)
|
function renderBatch($allow_delete = false,$allow_copy= false, $allow_url=false, $allow_featurebox=false)
|
||||||
{
|
{
|
||||||
|
|
||||||
// $allow_copy = TRUE;
|
// $allow_copy = TRUE;
|
||||||
@@ -5308,6 +5431,8 @@ class e_admin_form_ui extends e_form
|
|||||||
".($allow_copy ? $this->option(LAN_COPY, 'copy', false, array('class' => 'ui-batch-option class', 'other' => 'style="padding-left: 15px"')) : '')."
|
".($allow_copy ? $this->option(LAN_COPY, 'copy', false, array('class' => 'ui-batch-option class', 'other' => 'style="padding-left: 15px"')) : '')."
|
||||||
".($allow_delete ? $this->option(LAN_DELETE, 'delete', false, array('class' => 'ui-batch-option class', 'other' => 'style="padding-left: 15px"')) : '')."
|
".($allow_delete ? $this->option(LAN_DELETE, 'delete', false, array('class' => 'ui-batch-option class', 'other' => 'style="padding-left: 15px"')) : '')."
|
||||||
".($allow_url ? $this->option(LAN_UI_BATCH_CREATELINK, 'url', false, array('class' => 'ui-batch-option class', 'other' => 'style="padding-left: 15px"')) : '')."
|
".($allow_url ? $this->option(LAN_UI_BATCH_CREATELINK, 'url', false, array('class' => 'ui-batch-option class', 'other' => 'style="padding-left: 15px"')) : '')."
|
||||||
|
".($allow_featurebox ? $this->option(LAN_UI_BATCH_CREATEFEATUREBOX, 'featurebox', false, array('class' => 'ui-batch-option class', 'other' => 'style="padding-left: 15px"')) : '')."
|
||||||
|
|
||||||
".$this->renderBatchFilter('batch')."
|
".$this->renderBatchFilter('batch')."
|
||||||
".$this->select_close()."
|
".$this->select_close()."
|
||||||
".$this->admin_button('e__execute_batch', 'e__execute_batch', 'batch e-hide-if-js', LAN_GO, array('id' => false))."
|
".$this->admin_button('e__execute_batch', 'e__execute_batch', 'batch e-hide-if-js', LAN_GO, array('id' => false))."
|
||||||
|
@@ -529,6 +529,14 @@ class e_model extends e_object
|
|||||||
*/
|
*/
|
||||||
protected $_url = array();
|
protected $_url = array();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Current Featurebox Profile data
|
||||||
|
* Example: array('title' => 'page_title', 'text' => '');
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $_featurebox = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runtime cache of parsed from {@link _getData()} keys
|
* Runtime cache of parsed from {@link _getData()} keys
|
||||||
*
|
*
|
||||||
@@ -610,6 +618,28 @@ class e_model extends e_object
|
|||||||
return $this->_url;
|
return $this->_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set model Featurebox Profile
|
||||||
|
* @param string $table
|
||||||
|
* @return e_model
|
||||||
|
*/
|
||||||
|
public function setFeaturebox($fb)
|
||||||
|
{
|
||||||
|
// if(!is_array($url)) $url = array('route' => $url);
|
||||||
|
$this->_featurebox = $fb;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Featurebox profile
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getFeaturebox()
|
||||||
|
{
|
||||||
|
return $this->_featurebox;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic URL assembling method
|
* Generic URL assembling method
|
||||||
* @param array $options [optional] see eRouter::assemble() for $options structure
|
* @param array $options [optional] see eRouter::assemble() for $options structure
|
||||||
@@ -656,6 +686,29 @@ class e_model extends e_object
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic Featurebox assembling method
|
||||||
|
* @return mixed URL string or extended array data
|
||||||
|
*/
|
||||||
|
public function featurebox($options = array(), $extended = false)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get data fields array
|
* Get data fields array
|
||||||
* @return array
|
* @return array
|
||||||
@@ -3510,4 +3563,37 @@ class e_admin_tree_model extends e_front_tree_model
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get urls/url data for given nodes
|
||||||
|
*/
|
||||||
|
public function featurebox($ids, $options = array(), $extended = false)
|
||||||
|
{
|
||||||
|
$ret = array();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($ids as $id)
|
||||||
|
{
|
||||||
|
|
||||||
|
// print_a($this->getData());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(!$this->hasNode($id)) continue;
|
||||||
|
|
||||||
|
$model = $this->getNode($id);
|
||||||
|
;
|
||||||
|
print_a($this->getData());
|
||||||
|
|
||||||
|
|
||||||
|
// if($this->getFeaturebox()) $model->setFeaturebox($this->getFeaturebox()); // copy url config data if available
|
||||||
|
// $ret[$id] = $model->featurebox($options, $extended);
|
||||||
|
// print_a($ret);
|
||||||
|
}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user