1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 04:40:44 +02:00

Plugin Builder refinements and admin-ui 'template' added to banlist and rss for later use.

This commit is contained in:
Cameron
2012-12-06 21:41:53 -08:00
parent 29f23c05ea
commit a874b87a7f
5 changed files with 189 additions and 9 deletions

View File

@@ -45,7 +45,15 @@ require_once(e_HANDLER.'iphandler_class.php'); // This is probably already load
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
/*
// XXX THIS IS SET UP FOR LATER USE.
class banlist_admin extends e_admin_dispatcher
{
@@ -109,11 +117,11 @@ class banlist_ui extends e_admin_ui
protected = array(
'pref_type' => array('title'=> 'type', 'type'=>'text', 'data' => 'string', 'validate' => true),
'pref_folder' => array('title'=> 'folder', 'type' => 'boolean', 'data' => 'integer'),
'pref_name' => array('title'=> 'name', 'type' => 'text', 'data' => 'string', 'validate' => 'regex', 'rule' => '#^[\w]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')
);
// protected $pref = array(
// 'pref_type' => array('title'=> 'type', 'type'=>'text', 'data' => 'string', 'validate' => true),
// 'pref_folder' => array('title'=> 'folder', 'type' => 'boolean', 'data' => 'integer'),
// 'pref_name' => array('title'=> 'name', 'type' => 'text', 'data' => 'string', 'validate' => 'regex', 'rule' => '#^[\w]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')
// );
// optional
@@ -187,7 +195,7 @@ class banlist_form_ui extends e_admin_form_ui
}
/*
new banlist_admin();
require_once(e_ADMIN."auth.php");
@@ -198,6 +206,16 @@ exit;
*/
$e_sub_cat = 'banlist';
require_once('auth.php');
$frm = e107::getForm();

View File

@@ -1917,6 +1917,8 @@ TEMPLATE;
break;
case 'text':
case 'mediumtext':
case 'longtext':
$array = array(
'textarea' => "Text Area",
'bbarea' => "Rich-Text Area",
@@ -2005,6 +2007,7 @@ TEMPLATE;
case 'total':
case 'order':
case 'limit':
$ret['title'] = 'LAN_ORDER';
$ret['type'] = 'number';
$ret['batch'] = false;

View File

@@ -744,8 +744,8 @@ class db_verify
{
$mes = e107::getMessage();
$regex = "/`?([\w]*)`?\s*?(".implode("|",$this->fieldTypes)."|".implode("|",$this->fieldTypeNum).")\s?(?:\([\s]?([0-9,]*)[\s]?\))?[\s]?(unsigned)?[\s]?.*?(?:(NOT NULL|NULL))?[\s]*(auto_increment|default .*)?[\s]?(?:PRIMARY KEY)?[\s]*?,?\s*?\n/im";
$regex = "/^ *?`?([\w]*)`?\s*?(".implode("|",$this->fieldTypes)."|".implode("|",$this->fieldTypeNum).")\s?(?:\([\s]?([0-9,]*)[\s]?\))?[\s]?(unsigned)?[\s]?.*?(?:(NOT NULL|NULL))?[\s]*(auto_increment|default [\w'.-]*)?[\s]?(?:PRIMARY KEY)?[\s]*?,?\s*?\n/im";
// $regex = "/`?([\w]*)`?\s*?(".implode("|",$this->fieldTypes)."|".implode("|",$this->fieldTypeNum).")\s?(?:\([\s]?([0-9,]*)[\s]?\))?[\s]?(unsigned)?[\s]?.*?(?:(NOT NULL|NULL))?[\s]*(auto_increment|default .*)?[\s]?(?:PRIMARY KEY)?[\s]*?,?\s*?\n/im";
$regex = "/^\s*?`?([\w]*)`?\s*?(".implode("|",$this->fieldTypes)."|".implode("|",$this->fieldTypeNum).")\s?(?:\([\s]?([0-9,]*)[\s]?\))?[\s]?(unsigned)?[\s]?.*?(?:(NOT NULL|NULL))?[\s]*(auto_increment|default [\w'.-]*)?[\s]?(?:PRIMARY KEY)?[\s]*?,?\s*?\n/im";
// echo $regex."<br /><br />";
@@ -757,6 +757,8 @@ class db_verify
//$regex = "/^\s*?`?([\w]*)`?\s*?(date|time|timestamp|datetime|year|text|bit|tinyint|smallint|mediumint|integer|int|bigint|real|double|float|decimal|numeric|varchar|char|binary|varbinary|enum|set)\s?(?:\([\s]?([0-9,]*)[\s]?\))?[\s]?(unsigned)?[\s]*?(?:(NOT NULL|NULL))?[\s]*?(auto_increment|default [\w'.-]*)?[\s]?(?:PRIMARY KEY)?[\s]*?,?\n/i";
// echo "reg=".$regex;
preg_match_all($regex,$data,$m);
$ret = array();

View File

@@ -1126,6 +1126,9 @@ class themeHandler
$mes->add("Default Layout: ".$deflayout, E_MESSAGE_SUCCESS);
$mes->add("Custom Pages: ".implode(" ",$customPages), E_MESSAGE_SUCCESS);
$med = e107::getMedia();
$med->import('_common_image', e_THEME.$name, "^.*?logo.*?(\.png|\.jpeg|\.jpg|\.JPG|\.GIF|\.PNG)$");
$this->theme_adminlog('01', $name.', style.css');
return TRUE;
}

View File

@@ -30,7 +30,161 @@ if(!getperms("P") || !e107::isInstalled('rss_menu'))
exit;
}
include_lan(e_PLUGIN."rss_menu/languages/".e_LANGUAGE."_admin_rss_menu.php");
// XXX THIS IS SET UP FOR LATER USE.
class rss_admin extends e_admin_dispatcher
{
protected $modes = array(
'main' => array(
'controller' => 'rss_ui',
'path' => null,
'ui' => 'rss_form_ui',
'uipath' => null
),
);
protected $adminMenu = array(
'main/list' => array('caption'=> LAN_MANAGE, 'perm' => 'P'),
'main/create' => array('caption'=> LAN_CREATE, 'perm' => 'P'),
/*
'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => 'P'),
'main/custom' => array('caption'=> 'Custom Page', 'perm' => 'P')
*/
);
protected $adminMenuAliases = array(
'main/edit' => 'main/list'
);
protected $menuTitle = 'RSS';
}
class rss_ui extends e_admin_ui
{
protected $pluginTitle = 'RSS';
protected $pluginName = 'myplugin';
protected $table = 'rss';
protected $pid = 'rss_id';
protected $perPage = 10;
protected $fields = array ( 'checkboxes' => array ( 'title' => '', 'type' => '', 'data' => '', 'width' => '5%', 'thclass' => 'center', 'forced' => '1', 'class' => 'center', 'toggle' => 'e-multiselect', ),
'rss_id' => array ( 'title' => 'LAN_ID', 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'rss_name' => array ( 'title' => 'LAN_TITLE', 'type' => 'text', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'rss_url' => array ( 'title' => 'LAN_URL', 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'help' => '.{Type}.{Topic id}', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'rss_topicid' => array ( 'title' => 'Topic id', 'type' => 'text', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'rss_path' => array ( 'title' => 'Path', 'type' => 'text', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'rss_text' => array ( 'title' => 'Text', 'type' => 'textarea', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'rss_datestamp' => array ( 'title' => 'LAN_DATESTAMP', 'type' => 'datestamp', 'data' => 'int', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'rss_class' => array ( 'title' => 'LAN_VISIBILITY', 'type' => 'method', 'data' => 'int', 'width' => 'auto', 'batch' => true, 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'rss_limit' => array ( 'title' => 'Limit', 'type' => 'number', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'options' => array ( 'title' => 'LAN_OPTIONS', 'type' => null, 'data' => '', 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced' => '1', ),
);
protected $fieldpref = array('checkboxes', 'rss_name','rss_url', 'rss_topicid', 'rss_path', 'rss_class', 'options');
/*
protected = array(
'pref_type' => array('title'=> 'type', 'type'=>'text', 'data' => 'string', 'validate' => true),
'pref_folder' => array('title'=> 'folder', 'type' => 'boolean', 'data' => 'integer'),
'pref_name' => array('title'=> 'name', 'type' => 'text', 'data' => 'string', 'validate' => 'regex', 'rule' => '#^[\w]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')
);
// optional
public function init()
{
}
public function customPage()
{
$ns = e107::getRender();
$text = 'Hello World!';
$ns->tablerender('Hello',$text);
}
*/
}
class rss_form_ui extends e_admin_form_ui
{
// Custom Method/Function
function rss_class($curVal,$mode)
{
$frm = e107::getForm();
$array = array(RSS_LAN_ADMIN_21,RSS_LAN_ADMIN_22,RSS_LAN_ADMIN_23);
switch($mode)
{
case 'read': // List Page
return vartrue($array[$curVal]);
break;
case 'write': // Edit Page
return $frm->selectbox('rss_class',$array, $curVal);
break;
case 'filter':
case 'batch':
return $array;
break;
}
}
}
/*
new rss_admin();
require_once(e_ADMIN."auth.php");
e107::getAdminUI()->runPage();
require_once(e_ADMIN."footer.php");
exit;
*/
require_once(e_ADMIN."auth.php");
$imagedir = e_IMAGE."admin_images/";