2 /**********************************************************************
3 Copyright (C) FrontAccounting, LLC.
4 Released under the terms of the GNU General Public License, GPL,
5 as published by the Free Software Foundation, either version 3
6 of the License, or (at your option) any later version.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
12 $page_security = 'SA_CREATEMODULES';
14 include_once($path_to_root . "/includes/session.inc");
16 include_once($path_to_root."/includes/packages.inc");
17 include_once($path_to_root . "/admin/db/maintenance_db.inc");
18 include_once($path_to_root . "/includes/ui.inc");
20 if ($SysPrefs->use_popup_windows) {
21 $js = get_js_open_window(900, 500);
23 page(_($help_context = "Install Themes"), false, false, '', $js);
25 //---------------------------------------------------------------------------------------------
27 if (($id = find_submit('Delete', false)) && isset($installed_extensions[$id])
28 && clean_user_themes($installed_extensions[$id]['package']))
30 $extensions = get_company_extensions();
31 $theme = $extensions[$id]['package'];
32 $path = $extensions[$id]['path'];
34 if (uninstall_package($theme)) {
35 $dirname = $path_to_root.'/'.$path;
36 flush_dir($dirname, true);
38 unset($extensions[$id]);
39 if (update_extensions($extensions)) {
40 display_notification(_("Selected theme has been successfully deleted"));
41 meta_forward($_SERVER['PHP_SELF']);
46 if ($id = find_submit('Update', false))
47 install_extension($id);
49 //---------------------------------------------------------------------------------------------
53 start_table(TABLESTYLE);
55 $th = array(_("Theme"), _("Installed"), _("Available"), "", "");
58 $mods = get_themes_list();
61 display_note(_("No optional theme is currently available."));
66 foreach($mods as $pkg_name => $ext)
68 $available = @$ext['available'];
69 $installed = @$ext['version'];
70 $id = @$ext['local_id'];
72 alt_table_row_color($k);
74 label_cell($available ? get_package_view_str($pkg_name, $ext['name']) : $ext['name']);
76 label_cell($id === null ? _("None") :
77 ($available && $installed ? $installed : _("Unknown")));
78 label_cell($available ? $available : _("None"));
80 if ($available && check_pkg_upgrade($installed, $available)) // outdated or not installed theme in repo
81 button_cell('Update'.$pkg_name, $installed ? _("Update") : _("Install"),
82 _('Upload and install latest extension package'), ICON_DOWN, 'process');
87 delete_button_cell('Delete'.$id, _('Delete'));
88 submit_js_confirm('Delete'.$id,
89 sprintf(_("You are about to remove package \'%s\'.\nDo you want to continue ?"),
101 //---------------------------------------------------------------------------------------------