Removed obsolete complete parameter.
[fa-stable.git] / admin / inst_module.php
index 3571b6929aac329a32439c299ac883e50329e4fa..844244b737099e1abc3b46c925a1860f9c9b4be4 100644 (file)
@@ -13,7 +13,7 @@ $page_security = 'SA_CREATEMODULES';
 $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");
@@ -92,7 +92,7 @@ function handle_submit()
                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;
        }
@@ -101,7 +101,7 @@ function handle_submit()
        $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';
@@ -171,32 +171,16 @@ function handle_delete()
        $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;
 }
 
@@ -204,9 +188,7 @@ function handle_delete()
 
 function display_extensions()
 {
-       global $table_style, $tabs;
-
-       start_table($table_style);
+       start_table(TABLESTYLE);
        $th = array(_("Name"),_("Tab"), _("Link text"), _("Folder"), _("Filename"), 
                _("Access extensions"),"", "");
        table_header($th);
@@ -220,7 +202,8 @@ function display_extensions()
                $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']);
@@ -244,9 +227,7 @@ function display_extensions()
 
 function company_extensions($id)
 {
-       global $table_style, $tabs;
-
-       start_table($table_style);
+       start_table(TABLESTYLE);
        
        $th = array(_("Name"),_("Tab"), _("Link text"), _("Active"));
        
@@ -269,7 +250,8 @@ function company_extensions($id)
        {
                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, 
@@ -285,12 +267,12 @@ function company_extensions($id)
 
 function display_ext_edit($selected_id)
 {
-       global $table_style2, $Mode;
+       global $Mode;
 
 
        $extensions = get_company_extensions();
 
-       start_table($table_style2);
+       start_table(TABLESTYLE2);
 
        if ($selected_id != -1 && $extensions[$selected_id]['type'] == 'plugin')
        {
@@ -310,14 +292,14 @@ function display_ext_edit($selected_id)
        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');
 
-       label_row(_("Module File"), "<input name='uploadfile' type='file'>");
-       label_row(_("Access Levels Extensions"), "<input name='uploadfile3' type='file'>");
-       label_row(_("SQL File"), "<input name='uploadfile2' type='file'>");
+       file_row(_("Module File"), 'uploadfile');
+       file_row(_("Access Levels Extensions"), 'uploadfile3');
+       file_row(_("SQL File"), 'uploadfile2');
 
        end_table(0);
        display_note(_("Select your module PHP file from your local harddisk."), 0, 1);
@@ -362,7 +344,7 @@ if (list_updated('extset'))
        $Ajax->activate('_page_body');
 
 echo "<center>" . _('Extensions:') . "&nbsp;&nbsp;";
-extset_list('extset', null, true);
+echo extset_list('extset', null, true);
 echo "</center><br>";
 
 $set = get_post('extset', -1);