$path_to_root="..";
include_once($path_to_root . "/includes/session.inc");
-page(_("Install/Activate extensions"));
+page(_($help_context = "Install/Activate extensions"));
include_once($path_to_root . "/includes/date_functions.inc");
include_once($path_to_root . "/admin/db/company_db.inc");
return false;
$id = $selected_id==-1 ? $next_extension_id : $selected_id;
- if ($extensions[$id]['type'] != 'plugin') {
+ if ($selected_id != -1 && $extensions[$id]['type'] != 'plugin') {
display_error(_('Module installation support is not implemented yet. You have to do it manually.'));
return;
}
$extensions[$id]['name'] = $_POST['name'];
$extensions[$id]['path'] = $_POST['path'];
$extensions[$id]['title'] = $_POST['title'];
- $extensions[$id]['active'] = $_POST['active'];
+ $extensions[$id]['active'] = check_value('active');
// Currently we support only plugin extensions here.
$extensions[$id]['type'] = 'plugin';
$extensions = get_company_extensions();
$id = $selected_id;
- $removed_ext = $extensions[$id];
-
- unset($extensions[$id]);
- $mods = array_values($extensions);
- $extensions = $mods;
-
- unset($extensions[$id]);
-
- update_extensions($extensions);
$filename = $path_to_root
. ($extensions[$id]['type']=='plugin' ? "/modules/": '/')
. $extensions[$id]['path'];
- if ($h = opendir($filename))
- {
- while (($file = readdir($h)) !== false)
- {
- if (is_file("$filename/$file"))
- unlink("$filename/$file");
- }
- closedir($h);
- }
+ flush_dir($filename);
rmdir($filename);
-
- display_notification(_("Selected extension has been successfully deleted"));
+ unset($extensions[$id]);
+ if (update_extensions($extensions))
+ display_notification(_("Selected extension has been successfully deleted"));
return true;
}
function display_extensions()
{
- global $table_style, $tabs;
+ global $table_style;
start_table($table_style);
$th = array(_("Name"),_("Tab"), _("Link text"), _("Folder"), _("Filename"),
$is_mod = $mod['type'] == 'module';
alt_table_row_color($k);
label_cell($mod['name']);
- label_cell( $is_mod ? $mod['title'] : $tabs[$mod['tab']]);
+ label_cell( $is_mod ?
+ $mod['title'] : access_string($_SESSION['App']->applications[$mod['tab']]->name, true));
$ttl = access_string($mod['title']);
label_cell($ttl[0]);
label_cell($mod['path']);
function company_extensions($id)
{
- global $table_style, $tabs;
+ global $table_style;
start_table($table_style);
{
alt_table_row_color($k);
label_cell($mod['name']);
- label_cell($mod['type'] == 'module' ? $mod['title'] : $tabs[$mod['tab']]);
+ label_cell( $mod['type'] == 'module' ?
+ $mod['title'] : access_string($_SESSION['App']->applications[$mod['tab']]->name, true));
$ttl = access_string($mod['title']);
label_cell($ttl[0]);
check_cells(null, 'Active'.$i, @$mod['active'] ? 1:0,
text_row_ex(_("Name"), 'name', 30);
text_row_ex(_("Folder"), 'path', 20);
- tab_list_row(_("Menu Tab"), 'tab', null);
+ tab_list_row(_("Menu Tab"), 'tab', null, true);
text_row_ex(_("Menu Link Text"), 'title', 30);
record_status_list_row(_("Default status"), 'active');