mirror of
https://github.com/e107inc/e107.git
synced 2025-08-30 01:30:32 +02:00
- Featurebox batch copy feature added (example implementation - page administration), plugin upgrade required
- Lost admin UI messages issue solved - Featurebox list items view now sortable
This commit is contained in:
@@ -77,13 +77,46 @@ class fb_category_ui extends e_admin_ui
|
||||
'fb_category_parms' => array('title'=> 'Parameters (optional)', 'type' => 'textarea', 'data' => 'str', 'width' => 'auto', 'thclass' => 'left', 'class' => 'left','writeParms' => 'expand=Advanced&help=Optional Javascript Parameters (format subject to change)'),
|
||||
|
||||
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'forced'=>TRUE, 'thclass' => 'center last', 'class' => 'center')
|
||||
);
|
||||
);
|
||||
|
||||
public function init()
|
||||
{
|
||||
### Prevent modification of the 'unassigned' system category
|
||||
if($this->getAction() == 'edit')
|
||||
{
|
||||
$this->getModel()->load((int) $this->getId());
|
||||
|
||||
// FIXME lan
|
||||
if($this->getModel()->get('fb_category_template') === 'unassigned')
|
||||
{
|
||||
e107::getMessage()->addError("<strong>".FBLAN_INSTALL_03."</strong> is system category and can't be modified.", 'default', true);
|
||||
$this->redirect('list');
|
||||
}
|
||||
}
|
||||
elseif($this->getAction() == 'inline')
|
||||
{
|
||||
$this->getModel()->load((int) $this->getId());
|
||||
if($this->getModel()->get('fb_category_template') === 'unassigned')
|
||||
{
|
||||
$protocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0');
|
||||
header($protocol.': 403 Forbidden', true, 403);
|
||||
echo "'".FBLAN_INSTALL_03."' is system category and can't be modified.";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent deletion of categories in use
|
||||
*/
|
||||
public function beforeDelete($data, $id)
|
||||
{
|
||||
// FIXME lan
|
||||
if($data['fb_category_template'] === 'unassigned')
|
||||
{
|
||||
$this->getTreeModel()->addMessageError("<strong>".FBLAN_INSTALL_03."</strong> is system category and can't be deleted.");
|
||||
return false;
|
||||
}
|
||||
if (e107::getDb()->db_Count('featurebox', '(*)', 'fb_category='.intval($id)))
|
||||
{
|
||||
$this->getTreeModel()->addMessageWarning("Can't delete <strong>{$data['fb_category_title']}</strong> - category is in use!");
|
||||
@@ -105,7 +138,7 @@ class fb_category_ui extends e_admin_ui
|
||||
if(!varset($new_data['fb_category_template']))
|
||||
{
|
||||
$new_data['fb_category_template'] = 'default';
|
||||
}
|
||||
}var_dump($new_data);
|
||||
return $new_data;
|
||||
}
|
||||
|
||||
@@ -168,7 +201,10 @@ class fb_main_ui extends e_admin_ui
|
||||
protected $pid = "fb_id";
|
||||
protected $perPage = 10;
|
||||
protected $batchDelete = true;
|
||||
protected $batchCopy = true;
|
||||
protected $batchCopy = true;
|
||||
protected $sortField = 'fb_order';
|
||||
protected $orderStep = 1;
|
||||
protected $listOrder = 'fb_order asc';
|
||||
|
||||
protected $fields = array(
|
||||
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center first', 'class'=>'center'),
|
||||
@@ -183,7 +219,7 @@ class fb_main_ui extends e_admin_ui
|
||||
'fb_imageurl' => array('title'=> "Image Link", 'type' => 'url', 'width' => 'auto'),
|
||||
'fb_class' => array('title'=> LAN_VISIBILITY, 'type' => 'userclass', 'data' => 'int', 'inline'=>true, 'width' => 'auto', 'filter' => true, 'batch' => true), // User id
|
||||
'fb_order' => array('title'=> LAN_ORDER, 'type' => 'number', 'data'=> 'int','width' => '5%' ),
|
||||
'options' => array('title'=> LAN_OPTIONS, 'type' => null, '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')
|
||||
);
|
||||
|
||||
protected $fieldpref = array('checkboxes', 'fb_id', 'fb_category', 'fb_title', 'fb_template', 'fb_class', 'fb_order', 'options');
|
||||
|
@@ -33,13 +33,21 @@ class featurebox_setup
|
||||
|
||||
$query = array();
|
||||
$query['fb_category_id'] = 0;
|
||||
$query['fb_category_title'] = 'General';
|
||||
$query['fb_category_title'] = FBLAN_INSTALL_04;
|
||||
$query['fb_category_template'] = 'default';
|
||||
$query['fb_category_random'] = 0;
|
||||
$query['fb_category_class'] = e_UC_PUBLIC;
|
||||
$query['fb_category_limit'] = 1;
|
||||
$inserted = e107::getDb()->db_Insert('featurebox_category', $query);
|
||||
$status = $inserted ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
|
||||
|
||||
$query['fb_category_id'] = 0;
|
||||
$query['fb_category_title'] = FBLAN_INSTALL_03;
|
||||
$query['fb_category_template'] = 'unassigned';
|
||||
$query['fb_category_random'] = 0;
|
||||
$query['fb_category_class'] = e_UC_NOBODY;
|
||||
$query['fb_category_limit'] = 0;
|
||||
$inserted1 = e107::getDb()->db_Insert('featurebox_category', $query);
|
||||
$status = $inserted && $inserted1 ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
|
||||
$mes->add(FBLAN_INSTALL_01, $status);
|
||||
|
||||
if($inserted)
|
||||
@@ -75,11 +83,28 @@ class featurebox_setup
|
||||
{
|
||||
// print_a($var);
|
||||
}
|
||||
|
||||
*/
|
||||
function upgrade_post($var)
|
||||
{
|
||||
// $sql = e107::getDb();
|
||||
$sql = e107::getDb();
|
||||
$currentVersion = $var->current_plug['plugin_version'];
|
||||
//$newVersion = $var->plug_vars['@attributes']['version'];
|
||||
if($currentVersion == '1.0')
|
||||
{
|
||||
$query = array();
|
||||
$query['fb_category_id'] = 0;
|
||||
$query['fb_category_title'] = FBLAN_INSTALL_03;
|
||||
$query['fb_category_template'] = 'unassigned';
|
||||
$query['fb_category_random'] = 0;
|
||||
$query['fb_category_class'] = e_UC_NOBODY;
|
||||
$query['fb_category_limit'] = 0;
|
||||
$inserted = $sql->db_Insert('featurebox_category', $query);
|
||||
$status = $inserted ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
|
||||
e107::getMessage()->add(FBLAN_INSTALL_01, $status);
|
||||
if($sql->getLastErrorNumber())
|
||||
{
|
||||
e107::getMessage()->addDebug($sql->getLastErrorText().'<br /><pre>'.$sql->getLastQuery().'</pre>');
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
?>
|
@@ -14,7 +14,5 @@ define("LAN_PLUGIN_FEATUREBOX_BATCH", "Create Featurebox Item");
|
||||
// Install/uninstall messages
|
||||
define('FBLAN_INSTALL_01', 'Adding Default category table data.'); //XXX Use Generic
|
||||
define('FBLAN_INSTALL_02', 'Adding Default table data.'); //XXX Use Generic
|
||||
|
||||
|
||||
|
||||
?>
|
||||
define('FBLAN_INSTALL_03', 'Unassigned');
|
||||
define('FBLAN_INSTALL_04', 'General');
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: plugin.xml,v 1.9 2009-12-08 17:21:31 secretr Exp $ -->
|
||||
<e107Plugin name="Featurebox" lan="LAN_PLUGIN_FEATUREBOX_NAME" version="1.0" date="2012-08-01" compatibility="2.0" installRequired="true">
|
||||
<e107Plugin name="Featurebox" lan="LAN_PLUGIN_FEATUREBOX_NAME" version="1.1" date="2012-08-01" compatibility="2.0" installRequired="true">
|
||||
<author name="e107 Inc." url="http://e107.org" />
|
||||
<description lan="LAN_PLUGIN_FEATUREBOX_DESCRIPTION">Displays an animated area on the top of your page with news-items and other content you would like to feature.</description>
|
||||
<category>content</category>
|
||||
|
Reference in New Issue
Block a user