1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

Public Uploads page enabled and admin-ui template added.

This commit is contained in:
Cameron
2012-12-10 18:40:44 -08:00
parent 6e9ccdb59e
commit c65b549af7
3 changed files with 153 additions and 7 deletions

View File

@@ -30,9 +30,155 @@ if (!getperms('V'))
exit; exit;
} }
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE); e107::lan('core','upload','admin');
$e_sub_cat = 'upload'; $e_sub_cat = 'upload';
// Generated e107 Plugin Admin Area
class upload_admin extends e_admin_dispatcher
{
protected $modes = array(
'main' => array(
'controller' => 'upload_ui',
'path' => null,
'ui' => 'upload_form_ui',
'uipath' => null
),
);
protected $adminMenu = array(
'main/list' => array('caption'=> LAN_MANAGE, 'perm' => 'V'),
// 'main/create' => array('caption'=> LAN_CREATE, 'perm' => 'V'),
/*
'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 = 'myplugin';
}
class upload_ui extends e_admin_ui
{
protected $pluginTitle = 'upload';
protected $pluginName = 'myplugin';
protected $table = 'upload';
protected $pid = 'upload_id';
protected $perPage = 10;
protected $fields = array ( 'checkboxes' => array ( 'title' => '', 'type' => '', 'data' => '', 'width' => '5%', 'thclass' => 'center', 'forced' => '1', 'class' => 'center', 'toggle' => 'e-multiselect', ),
'upload_id' => array ( 'title' => 'LAN_ID', 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'upload_name' => array ( 'title' => 'LAN_TITLE', 'type' => 'text', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'upload_poster' => array ( 'title' => 'Poster', 'type' => 'user', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'upload_email' => array ( 'title' => 'Email', 'type' => 'text', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'upload_website' => array ( 'title' => 'LAN_URL', 'type' => 'url', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'upload_datestamp' => array ( 'title' => 'LAN_DATESTAMP', 'type' => 'datestamp', 'data' => 'int', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'upload_version' => array ( 'title' => 'Version', 'type' => 'text', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'upload_file' => array ( 'title' => 'File', 'type' => 'text', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'upload_ss' => array ( 'title' => 'Ss', 'type' => 'text', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'upload_description' => array ( 'title' => 'LAN_DESCRIPTION', 'type' => 'textarea', 'data' => 'str', 'width' => '40%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'upload_demo' => array ( 'title' => 'Demo', 'type' => 'url', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'upload_filesize' => array ( 'title' => 'Filesize', 'type' => 'hidden', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'upload_active' => array ( 'title' => 'Active', 'type' => 'boolean', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'upload_category' => array ( 'title' => 'LAN_CATEGORY', 'type' => 'dropdown', 'data' => 'int', 'width' => 'auto', 'batch' => true, 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'options' => array ( 'title' => 'Options', 'type' => '', 'data' => '', 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced' => '1', ),
);
protected $fieldpref = array('checkboxes', 'upload_datestamp', 'upload_name', 'upload_category', '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 upload_form_ui extends e_admin_form_ui
{
}
new upload_admin();
require_once(e_ADMIN."auth.php");
e107::getAdminUI()->runPage();
require_once(e_ADMIN."footer.php");
exit;
$action = 'list'; // Default action $action = 'list'; // Default action

View File

@@ -675,7 +675,7 @@ class e_navigation
20 => array(e_ADMIN.'search.php', ADLAN_142, ADLAN_143, 'X', 1, E_16_SEARCH, E_32_SEARCH), 20 => array(e_ADMIN.'search.php', ADLAN_142, ADLAN_143, 'X', 1, E_16_SEARCH, E_32_SEARCH),
21 => array(e_ADMIN.'admin_log.php', ADLAN_155, ADLAN_156, 'S', 4, E_16_ADMINLOG, E_32_ADMINLOG), 21 => array(e_ADMIN.'admin_log.php', ADLAN_155, ADLAN_156, 'S', 4, E_16_ADMINLOG, E_32_ADMINLOG),
22 => array(e_ADMIN.'theme.php', ADLAN_140, ADLAN_141, '1', 5, E_16_THEMEMANAGER, E_32_THEMEMANAGER), 22 => array(e_ADMIN.'theme.php', ADLAN_140, ADLAN_141, '1', 5, E_16_THEMEMANAGER, E_32_THEMEMANAGER),
// 23 => array(e_ADMIN.'upload.php', ADLAN_72, ADLAN_73, 'V', 3, E_16_UPLOADS, E_32_UPLOADS), 23 => array(e_ADMIN.'upload.php', ADLAN_72, ADLAN_73, 'V', 3, E_16_UPLOADS, E_32_UPLOADS),
24 => array(e_ADMIN.'users.php', ADLAN_36, ADLAN_37, '4|U0|U1|U2|U3', 2, E_16_USER, E_32_USER), 24 => array(e_ADMIN.'users.php', ADLAN_36, ADLAN_37, '4|U0|U1|U2|U3', 2, E_16_USER, E_32_USER),
25 => array(e_ADMIN.'userclass2.php', ADLAN_38, ADLAN_39, '4', 2, E_16_USERCLASS, E_32_USERCLASS), 25 => array(e_ADMIN.'userclass2.php', ADLAN_38, ADLAN_39, '4', 2, E_16_USERCLASS, E_32_USERCLASS),
26 => array(e_ADMIN.'language.php', ADLAN_132, ADLAN_133, '0', 1, E_16_LANGUAGE, E_32_LANGUAGE), 26 => array(e_ADMIN.'language.php', ADLAN_132, ADLAN_133, '0', 1, E_16_LANGUAGE, E_32_LANGUAGE),

View File

@@ -149,12 +149,12 @@ class faq_main_ui extends e_admin_ui
protected $pluginTitle = 'FAQs'; protected $pluginTitle = 'FAQs';
protected $pluginName = 'faqs'; protected $pluginName = 'faqs';
protected $table = "faqs"; protected $table = "faqs";
protected $tableJoin = array(
'u.user' => array('leftField' => 'faq_author', 'rightField' => 'user_id', 'fields' => 'user_id,user_loginname,user_name')
);
// without any Order or Limit. // without any Order or Limit.
//protected $listQry = "SELECT * FROM #faqs";
//FIXME JOIN should occur automatically. We have all the data necessary to build the query.
// ie. faq_author is a 'user' field.
protected $listQry = "SELECT f.*, u.* FROM #faqs AS f LEFT JOIN #user AS u ON f.faq_author = u.user_id "; // Should not be necessary.
protected $editQry = "SELECT * FROM #faqs WHERE faq_id = {ID}"; protected $editQry = "SELECT * FROM #faqs WHERE faq_id = {ID}";