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

Generic search form element added to form handler. Search and other minor GUI enhancements added to Plugin Manager

This commit is contained in:
Cameron 2013-03-03 23:42:37 -08:00
parent 1d54a0f48b
commit 42c770ed4e
5 changed files with 125 additions and 25 deletions

View File

@ -64,7 +64,7 @@ if(e_AJAX_REQUEST && isset($_GET['src'])) // Ajax
$plugPath = preg_replace("/[^a-z0-9-\._]/", "-", strtolower($dir));
e107::getSingleton('e107plugin')->update_plugins_table('update');
e107::getDb()->db_Select_gen("SELECT plugin_id FROM #plugin WHERE plugin_path = '".$plugPath."' LIMIT 1");
e107::getDb()->gen("SELECT plugin_id FROM #plugin WHERE plugin_path = '".$plugPath."' LIMIT 1");
$row = e107::getDb()->db_Fetch(MYSQL_ASSOC);
$status = e107::getSingleton('e107plugin')->install_plugin($row['plugin_id']);
//unlink(e_UPLOAD.$localfile);
@ -150,19 +150,21 @@ class pluginManager{
"plugin_checkboxes" => array("title" => "", "forced"=>TRUE, "width"=>"3%"),
"plugin_icon" => array("title" => EPL_ADLAN_82, "type"=>"icon", "width" => "5%", "thclass" => "middle center",'class'=>'center', "url" => ""),
"plugin_name" => array("title" => EPL_ADLAN_10, "type"=>"text", "width" => "30", "thclass" => "middle", "url" => ""),
"plugin_name" => array("title" => EPL_ADLAN_10, "type"=>"text", "width" => "20%", "thclass" => "middle", "url" => ""),
"plugin_version" => array("title" => EPL_ADLAN_11, "type"=>"numeric", "width" => "5%", "thclass" => "middle", "url" => ""),
"plugin_date" => array("title" => "Release ".LAN_DATE, "type"=>"text", "width" => "auto", "thclass" => "middle"),
"plugin_date" => array("title" => "Released ", "type"=>"text", "width" => "auto", "thclass" => "middle"),
"plugin_folder" => array("title" => EPL_ADLAN_64, "type"=>"text", "width" => "10%", "thclass" => "middle", "url" => ""),
"plugin_category" => array("title" => LAN_CATEGORY, "type"=>"text", "width" => "15%", "thclass" => "middle", "url" => ""),
"plugin_category" => array("title" => LAN_CATEGORY, "type"=>"text", "width" => "10%", "thclass" => "middle", "url" => ""),
"plugin_author" => array("title" => EPL_ADLAN_12, "type"=>"text", "width" => "auto", "thclass" => "middle", "url" => ""),
"plugin_website" => array("title" => EPL_WEBSITE, "type"=>"url", "width" => "5%", "thclass" => "middle center", "url" => ""),
"plugin_notes" => array("title" => EPL_ADLAN_83, "type"=>"url", "width" => "5%", "thclass" => "middle center", "url" => ""),
"plugin_compatible" => array("title" => EPL_ADLAN_13, "type"=>"text", "width" => "auto", "thclass" => "middle", "url" => ""),
"plugin_description" => array("title" => EPL_ADLAN_14, "type"=>"text", "width" => "auto", "thclass" => "middle center", "url" => ""),
"plugin_compatible" => array("title" => EPL_ADLAN_13, "type"=>"text", "width" => "auto", "thclass" => "middle", "url" => ""),
"plugin_compliant" => array("title" => EPL_ADLAN_81, "type"=>"text", "width" => "5%", "thclass" => "middle center", "url" => ""),
// "plugin_release" => array("title" => EPL_ADLAN_81, "type"=>"text", "width" => "5%", "thclass" => "middle center", "url" => ""),
// "plugin_notes" => array("title" => EPL_ADLAN_83, "type"=>"url", "width" => "5%", "thclass" => "middle center", "url" => ""),
"options" => array("title" => LAN_OPTIONS, 'forced'=>TRUE, "width" => "15%", "thclass" => "middle center last", "url" => ""),
);
@ -291,12 +293,13 @@ class pluginManager{
$xml = e107::getXml();
$mes = e107::getMessage();
$mes->addWarning("This area is experimental and may produce unpredictable results.");
$mes->addWarning("Some older plugins may produce unpredictable results.");
$from = intval(varset($_GET['frm']));
$srch = preg_replace('/[^\w]/','', vartrue($_GET['srch']));
// $file = SITEURLBASE.e_PLUGIN_ABS."release/release.php"; // temporary testing
$file = "http://e107.org/feed?type=plugin&frm=".$from;
$file = "http://e107.org/feed?type=plugin&frm=".$from."&srch=".$srch;
$xml->setOptArrayTags('plugin'); // make sure 'plugin' tag always returns an array
$xdata = $xml->loadXMLfile($file,'advanced');
@ -311,17 +314,20 @@ class pluginManager{
{
$row = $r['@attributes'];
$badge = ($row['compatibility'] > 1.9) ? "<span class='label label-warning'>Made for v2</span>" : '1.x';
$featured = ($row['featured']== 1) ? " <span class='label label-info'>Featured</span>" : '';
$data[] = array(
'plugin_id' => $c,
'plugin_icon' => vartrue($row['icon'],e_IMAGE."admin_images/plugins_32.png"),
'plugin_name' => $row['name'],
'plugin_name' => $row['name'].$featured,
'plugin_folder' => $row['folder'],
'plugin_date' => vartrue($row['date']),
'plugin_category' => vartrue($r['category'][0]),
'plugin_author' => vartrue($row['author']),
'plugin_version' => $row['version'],
'plugin_description' => $tp->text_truncate(vartrue($r['description'][0]),200),
'plugin_compatible' => $badge,
'plugin_website' => vartrue($row['authorUrl']),
'plugin_url' => $row['url'],
@ -334,10 +340,25 @@ class pluginManager{
$fieldList = $this->fields;
unset($fieldList['plugin_checkboxes']);
$text = "
<form action='".e_SELF."?".e_QUERY."' id='core-plugin-list-form' method='get'>
<div>".$frm->search('srch', $srch, 'go', $filterName, $filterArray, $filterVal).$frm->hidden('mode','online')."</div>
</form>
<form action='".e_SELF."?".e_QUERY."' id='core-plugin-list-form' method='post'>
<fieldset id='core-plugin-list'>
<fieldset class='e-filter' id='core-plugin-list'>
<legend class='e-hideme'>".$caption."</legend>
<table class='table adminlist'>
".$frm->colGroup($fieldList,$this->fieldpref).
$frm->thead($fieldList,$this->fieldpref)."
@ -492,7 +513,7 @@ class pluginManager{
$plugin->manage_userclass('remove', $eplug_userclass);
}
$sql->db_Update('plugin', "plugin_installflag=0, plugin_version='{$eplug_version}' WHERE plugin_id='{$this->id}' ");
$sql->update('plugin', "plugin_installflag=0, plugin_version='{$eplug_version}' WHERE plugin_id='{$this->id}' ");
$plugin->manage_search('remove', $eplug_folder);
$plugin->manage_notify('remove', $eplug_folder);
@ -729,7 +750,7 @@ class pluginManager{
$admin_log->log_event('PLUGMAN_02', $eplug_folder, E_LOG_INFORMATIVE, '');
$text .= (isset($eplug_upgrade_done)) ? '<br />'.$eplug_upgrade_done : "<br />".LAN_UPGRADE_SUCCESSFUL;
$sql->db_Update('plugin', "plugin_version ='{$eplug_version}', plugin_addons='{$eplug_addons}' WHERE plugin_id='$this->id' ");
$sql->update('plugin', "plugin_version ='{$eplug_version}', plugin_addons='{$eplug_addons}' WHERE plugin_id='$this->id' ");
$pref['plug_installed'][$plug['plugin_path']] = $eplug_version; // Update the version
e107::getConfig('core')->setPref($pref);
@ -943,7 +964,7 @@ class pluginManager{
$conf_file = e_PLUGIN.$plug['plugin_path'].'/'.$plug_vars['administration']['configFile'];
$conf_title = LAN_CONFIGURE.' '.$tp->toHtml($plug_vars['@attributes']['name'], "", "defs,emotes_off, no_make_clickable");
$plugin_icon = "<a title='{$conf_title}' href='{$conf_file}' >".$plugin_icon."</a>";
$plugin_config_icon = "<a title='{$conf_title}' href='{$conf_file}' >".ADMIN_CONFIGURE_ICON."</a>";
$plugin_config_icon = "<a class='btn' title='{$conf_title}' href='{$conf_file}' >".ADMIN_CONFIGURE_ICON."</a>";
}
$plugEmail = varset($plug_vars['author']['@attributes']['email'],'');
@ -997,14 +1018,15 @@ class pluginManager{
// Plugin options Column --------------
$text .= "<td class='center middle'>".$plugin_config_icon;
$text .= "<td class='options center middle'>
<div class='btn-group'>".$plugin_config_icon;
if ($plug_vars['@attributes']['installRequired'])
{
if ($plug['plugin_installflag'])
{
$text .= ($plug['plugin_installflag'] ? "<a href=\"".e_SELF."?uninstall.{$plug['plugin_id']}\" title='".EPL_ADLAN_1."' >".ADMIN_UNINSTALLPLUGIN_ICON."</a>" : "<a href=\"".e_SELF."?install.{$plug['plugin_id']}\" title='".EPL_ADLAN_0."' >".ADMIN_INSTALLPLUGIN_ICON."</a>");
$text .= ($plug['plugin_installflag'] ? "<a class='btn' href=\"".e_SELF."?uninstall.{$plug['plugin_id']}\" title='".EPL_ADLAN_1."' >".ADMIN_UNINSTALLPLUGIN_ICON."</a>" : "<a class='btn' href=\"".e_SELF."?install.{$plug['plugin_id']}\" title='".EPL_ADLAN_0."' >".ADMIN_INSTALLPLUGIN_ICON."</a>");
// $text .= ($plug['plugin_installflag'] ? "<button type='button' class='delete' value='no-value' onclick=\"location.href='".e_SELF."?uninstall.{$plug['plugin_id']}'\"><span>".EPL_ADLAN_1."</span></button>" : "<button type='button' class='update' value='no-value' onclick=\"location.href='".e_SELF."?install.{$plug['plugin_id']}'\"><span>".EPL_ADLAN_0."</span></button>");
if (PLUGIN_SHOW_REFRESH && !varsettrue($plug_vars['plugin_php']))
@ -1016,7 +1038,7 @@ class pluginManager{
{
// $text .= "<input type='button' class='button' onclick=\"location.href='".e_SELF."?install.{$plug['plugin_id']}'\" title='".EPL_ADLAN_0."' value='".EPL_ADLAN_0."' />";
// $text .= "<button type='button' class='update' value='no-value' onclick=\"location.href='".e_SELF."?install.{$plug['plugin_id']}'\"><span>".EPL_ADLAN_0."</span></button>";
$text .= "<a href=\"".e_SELF."?install.{$plug['plugin_id']}\" title='".EPL_ADLAN_0."' >".ADMIN_INSTALLPLUGIN_ICON."</a>";
$text .= "<a class='btn' href=\"".e_SELF."?install.{$plug['plugin_id']}\" title='".EPL_ADLAN_0."' >".ADMIN_INSTALLPLUGIN_ICON."</a>";
}
}
else
@ -1038,10 +1060,10 @@ class pluginManager{
if ($plug['plugin_version'] != $plug_vars['@attributes']['version'] && $plug['plugin_installflag'])
{
// $text .= "<br /><input type='button' class='button' onclick=\"location.href='".e_SELF."?upgrade.{$plug['plugin_id']}'\" title='".EPL_UPGRADE." to v".$plug_vars['@attributes']['version']."' value='".EPL_UPGRADE."' />";
$text .= "<a href='".e_SELF."?upgrade.{$plug['plugin_id']}' title=\"".EPL_UPGRADE." to v".$plug_vars['@attributes']['version']."\" >".ADMIN_UPGRADEPLUGIN_ICON."</a>";
$text .= "<a class='btn' href='".e_SELF."?upgrade.{$plug['plugin_id']}' title=\"".EPL_UPGRADE." to v".$plug_vars['@attributes']['version']."\" >".ADMIN_UPGRADEPLUGIN_ICON."</a>";
}
$text .="</td>";
$text .="</div></td>";
$text .= "</tr>";
}

View File

@ -957,11 +957,11 @@ class uclass_manager
$this->fields = array(
'userclass_icon' => array('title'=> UCSLAN_68, 'type' => 'icon', 'width' => '5%', 'thclass' => 'center', 'class' => 'center'),
'userclass_id' => array('title'=> LAN_ID, 'type' => 'int', 'width' => '5%', 'thclass' => 'left'),
'userclass_name' => array('title'=> UCSLAN_12, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left'),
'userclass_description' => array('title'=> UCSLAN_13, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left'),
'userclass_name' => array('title'=> UCSLAN_12, 'type' => 'text', 'inline'=>true, 'width' => 'auto', 'thclass' => 'left'),
'userclass_description' => array('title'=> UCSLAN_13, 'type' => 'text', 'inline'=>true, 'width' => 'auto', 'thclass' => 'left'),
'userclass_editclass' => array('title'=> UCSLAN_24, 'type' => 'userclass', 'width' => 'auto', 'thclass' => 'left'),
'userclass_parent' => array('title'=> UCSLAN_35, 'type' => 'userclass', 'width' => 'auto', 'thclass' => 'left'),
'userclass_visibility' => array('title'=> UCSLAN_34, 'type' => 'userclass', 'width' => 'auto', 'thclass' => 'left'),
'userclass_visibility' => array('title'=> UCSLAN_34, 'type' => 'userclass', 'inline'=>true, 'width' => 'auto', 'thclass' => 'left'),
'userclass_type' => array('title'=> UCSLAN_79, 'type' => 'method', 'width' => '10%', 'thclass' => 'left', 'class'=>'left' ),
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'thclass' => 'center last', 'forced'=>TRUE, 'class'=>'center', 'readParms' => array('deleteClass' => e_UC_NOBODY))
);
@ -1088,6 +1088,7 @@ function headerjs()
";
}
//XXX FIXME Rewrite using jQuery selectors.
$script_js .= "
function setGroupStatus(dropdown)
{

View File

@ -1171,6 +1171,81 @@ class e_form
$text .= $this->option_multi($option_array, $selected)."\n".$this->select_close();
return $text;
}
//TODO
/**
* Universal Userclass selector - checkboxes, dropdown, everything.
* @param $name - form element name
* @param $curval - current userclass value(s) as array or comma separated.
* @param $type - 'checkbox', 'dropdown',
* @param options - query string or array. 'options=admin,mainadmin,classes&vetted=1&exclusions=0' etc.
* @return the userclass form element
*/
function userclass($name, $curval, $type, $options)
{
}
/**
* Renders a generic search box. If $filter has values, a filter box will be included with the options provided.
*
*/
function search($name, $searchVal, $submitName, $filterName='', $filterArray=false, $filterVal=false)
{
$text = '<div class="input-append e-search"><i class="icon-search"></i>
'.$this->text($name, $searchVal,20,'class=search-query').'
<button class="btn btn-primary" name="'.$submitName.'" type="submit">'.LAN_GO.'</button>
</div>';
if(is_array($filter))
{
$text .= $this->selectbox($$filterName, $filterArray, $filterVal);
}
// $text .= $this->admin_button($submitName,LAN_SEARCH,'search');
return $text;
/*
$text .=
<select style="display: none;" data-original-title="Filter the results below" name="filter_options" id="filter-options" class="e-tip tbox select filter" title="">
<option value="">Display All</option>
<option value="___reset___">Clear Filter</option>
<optgroup class="optgroup" label="Filter by&nbsp;Category">
<option value="faq_parent__1">General</option>
<option value="faq_parent__2">Misc</option>
<option value="faq_parent__4">Test 3</option>
</optgroup>
</select><div class="btn-group bootstrap-select e-tip tbox select filter"><button id="filter-options" class="btn dropdown-toggle clearfix" data-toggle="dropdown"><span class="filter-option pull-left">Display All</span>&nbsp;<span class="caret"></span></button><ul style="max-height: none; overflow-y: auto;" class="dropdown-menu" role="menu"><li rel="0"><a tabindex="-1" class="">Display All</a></li><li rel="1"><a tabindex="-1" class="">Clear Filter</a></li><li rel="2"><dt class="optgroup-div">Filter by&nbsp;Category</dt><a tabindex="-1" class="opt ">General</a></li><li rel="3"><a tabindex="-1" class="opt ">Misc</a></li><li rel="4"><a tabindex="-1" class="opt ">Test 3</a></li></ul></div>
<div class="e-autocomplete"></div>
<button type="submit" name="etrigger_filter" value="etrigger_filter" id="etrigger-filter" class="btn filter e-hide-if-js btn-primary"><span>Filter</span></button>
<span class="indicator" style="display: none;">
<img src="/e107_2.0/e107_images/generic/loading_16.gif" class="icon action S16" alt="Loading...">
</span>
*/
}
function uc_select($name, $current_value, $uc_options, $select_options = array(), $opt_options = array())
{

View File

@ -1304,7 +1304,7 @@ class user_class_admin extends user_class
$is_open = TRUE;
$tag_name = 'uclass_tree_'.$listnum;
$ret = "<div class='uclass_tree' style='height: 20px'>\n";
$ret = "<div class='uclass_tree' >\n";
foreach ($indent_images as $im)
{

View File

@ -108,6 +108,8 @@ a.brand:hover img {
.nav ul li ul.dropdown-menu a:hover img
{ filter: none; -webkit-filter: grayscale(0%); }
td.options { }
legend { display:none }
.btn { vertical-align: top; }
@ -177,8 +179,8 @@ img.S32:hover {}
.adminlist tr.even { background-color:#f6f6f6; }
.adminlist .col-selection-cont { position: relative; float:right; }
div.e-search input[type='text'] { padding-left:25px }
div.e-search i { margin-right:-20px; margin-left:5px; z-index:100; position:relative; }
/******** SyS Messages / Message text formatting */
.s-message .s-message-title { height: 32px; background: 0 50% no-repeat; padding-left: 42px; line-height: 32px; }