1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-16 18:42:01 +02:00

Notes on future e_upload.php added.

This commit is contained in:
Cameron 2015-02-07 01:42:44 -08:00
parent 0f79de35b1
commit bbd28e5572
2 changed files with 28 additions and 11 deletions

View File

@ -66,27 +66,27 @@ class upload_ui extends e_admin_ui
{
protected $pluginTitle = 'Upload';
protected $pluginName = 'myplugin';
protected $pluginName = 'core';
protected $table = 'upload';
protected $pid = 'upload_id';
protected $perPage = 10;
protected $fields = array (
'checkboxes' => array ( 'title' => '', 'type' => null, 'width' => '5%', 'thclass' => 'center', 'forced' => true, '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' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', 'validate' => true, 'inline' => true),
'upload_id' => array ( 'title' => LAN_ID, 'data' => 'int', 'width' => '5%', '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_name' => array ( 'title' => LAN_TITLE, 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', 'validate' => true, 'inline' => true),
'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' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'upload_website' => array ( 'title' => 'LAN_URL', 'type' => 'url', 'data' => 'str', '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_website' => array ( 'title' => LAN_URL, 'type' => 'url', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'upload_version' => array ( 'title' => 'Version', 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'upload_file' => array ( 'title' => 'File', 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', 'validate' => true ),
'upload_ss' => array ( 'title' => 'Ss', 'type' => 'text', 'data' => 'str', '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_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' => 'str', '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' => 'Status', 'type' => 'method', 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => array('singleOption' => true), 'class' => 'center', 'thclass' => 'center', 'batch' => true),
'upload_category' => array ( 'title' => 'LAN_CATEGORY', 'type' => 'dropdown', 'data' => 'int', 'width' => 'auto', 'batch' => true, 'filter' => true, 'help' => '', 'readParms' => array(), 'writeParms' => array(), 'class' => 'left', 'thclass' => 'left', 'validate' => true ),
'upload_category' => array ( 'title' => LAN_CATEGORY, 'type' => 'dropdown', 'data' => 'int', 'width' => 'auto', 'batch' => true, 'filter' => true, 'help' => '', 'readParms' => array(), 'writeParms' => array(), 'class' => 'left', 'thclass' => 'left', 'validate' => true ),
'options' => array ( 'title' => 'Options', 'type' => '', 'data' => '', 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced' => '1', ),
);
@ -130,6 +130,7 @@ class upload_ui extends e_admin_ui
}
}
private function addSubcategories($parent_id, &$cats, $subIndex, $label)
{
if(isset($subIndex[$parent_id]))
@ -177,10 +178,11 @@ class upload_ui extends e_admin_ui
*/
public function beforeUpdate($new_data, $old_data, $id)
{
if($new_data['upload_active'] && !e107::isInstalled('download'))
{
$this->getModel()->addValidationError('Download plugin is not installed - activation not possible.'); // TODO lan
$new_data['upload_active'] = 0;
$new_data['upload_active'] = 0;
return $new_data;
}
}
@ -190,7 +192,8 @@ class upload_ui extends e_admin_ui
*/
public function afterUpdate($new_data, $old_data, $id)
{
$did = $this->move2download($new_data);
$did = $this->move2download($new_data); //TODO Move this to e_upload.php .. method 'insert()';
$isSession = vartrue($_POST['__after_submit_action']) && !isset($_POST['e__execute_batch']) != 'edit' ? true : false;
if($did)
{
@ -304,7 +307,21 @@ class upload_form_ui extends e_admin_form_ui
break;
case 'batch':
return $this->option('Accept', 'upload_active', false, array('other' => 'style="padding-left: 15px"'));
//TODO move all 'downloads' specific code into e_upload.php .
/*
$pref = e107::pref('core', 'e_upload_list');
foreach($pref as $k=>$v)
{
$def = 'LAN_PLUGIN_'.strtoupper($v).'_NAME';
$text = $this->option('Send to '.defset($def,$v), 'send_to_'.$k, false, array('other' => 'style="padding-left: 15px"'));
}
*/
$text = $this->option('Accept', 'upload_active', false, array('other' => 'style="padding-left: 15px"'));
return $text; // $this->option('Accept', 'upload_active', false, array('other' => 'style="padding-left: 15px"'));
break;
}
}

View File

@ -51,13 +51,13 @@ class e107plugin
// 'e_userinfo', @deprecated @see e_user
'e_tagwords',
'e_url', // simple mod-rewrite.
'e_mailout',
'e_sitelink', // sitelinks generator.
'e_tohtml',
'e_featurebox',
'e_related',
'e_rss',
'e_upload',
'e_user'
);