X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=admin%2Finst_module.php;h=966a4899e9e73f0ff70000c0876dc84a12314503;hb=ce5f33c17196c1f32e05576da2fd9719db60c596;hp=50d2e3e7184b8a6f37d5149f5d9938653355ed3e;hpb=d1babda7c01b314d35fb89f2d195553b55936532;p=fa-stable.git
diff --git a/admin/inst_module.php b/admin/inst_module.php
index 50d2e3e7..966a4899 100644
--- a/admin/inst_module.php
+++ b/admin/inst_module.php
@@ -42,8 +42,18 @@ function local_extension($id)
'active' => false
);
- if (file_exists($path_to_root.'/modules/'.clean_file_name($id).'/hooks.php')) {
- include_once($path_to_root.'/modules/'.clean_file_name($id).'/hooks.php');
+ $local_module_path = $path_to_root.'/modules/'.clean_file_name($id);
+ $local_config_file = $local_module_path.'/_init/config';
+ $local_hook_file = $local_module_path.'/hooks.php';
+
+ if (file_exists($local_config_file)) {
+ $ctrl = get_control_file($local_config_file);
+ if (key_exists('Name', $ctrl)) $exts[$next_extension_id-1]['name'] = $ctrl['Name'];
+ if (key_exists('Version', $ctrl)) $exts[$next_extension_id-1]['version'] = $ctrl['Version'];
+ }
+ if (file_exists($local_hook_file)) {
+ include_once($local_hook_file);
+
}
$hooks_class = 'hooks_'.$id;
if (class_exists($hooks_class, false)) {
@@ -79,34 +89,21 @@ function handle_delete($id)
}
return true;
}
-//
-// Helper for formating menu tabs/entries to be displayed in extension table
-//
-function fmt_titles($defs)
-{
- if (!$defs) return '';
- foreach($defs as $def) {
- $str[] = access_string($def['title'], true);
- }
- return implode('
', array_values($str));
-}
//---------------------------------------------------------------------------------------------
//
// Display list of all extensions - installed and available from repository
//
-function display_extensions()
+function display_extensions($mods)
{
global $installed_extensions;
div_start('ext_tbl');
start_table(TABLESTYLE);
- $th = array(_("Extension"),_("Modules provided"), _("Options provided"),
- _("Installed"), _("Available"), "", "");
+ $th = array(_("Extension"), _("Installed"), _("Available"), "", "");
table_header($th);
$k = 0;
- $mods = get_extensions_list('extension');
foreach($mods as $pkg_name => $ext)
{
@@ -114,17 +111,12 @@ function display_extensions()
$installed = @$ext['version'];
$id = @$ext['local_id'];
- $entries = fmt_titles(@$ext['entries']);
- $tabs = fmt_titles(@$ext['tabs']);
-
alt_table_row_color($k);
label_cell($available ? get_package_view_str($pkg_name, $ext['name']) : $ext['name']);
- label_cell($tabs);
- label_cell($entries);
label_cell($id === null ? _("None") :
- ($available && $installed ? $installed : _("Unknown")));
+ (($installed && ($installed != '-' || $installed != '')) ? $installed : _("Unknown")));
label_cell($available ? $available : _("Unknown"));
if (!$available && $ext['type'] == 'extension') {// third-party plugin
@@ -165,7 +157,7 @@ function company_extensions($id)
{
start_table(TABLESTYLE);
- $th = array(_("Extension"),_("Modules provided"), _("Options provided"), _("Active"));
+ $th = array(_("Extension"), _("Version"), _("Path"), _("Active"));
$mods = get_company_extensions();
$exts = get_company_extensions($id);
@@ -182,15 +174,14 @@ function company_extensions($id)
foreach($mods as $i => $mod)
{
if ($mod['type'] != 'extension') continue;
- alt_table_row_color($k);
+ alt_table_row_color($k);
label_cell($mod['name']);
- $entries = fmt_titles(@$mod['entries']);
- $tabs = fmt_titles(@$mod['tabs']);
- label_cell($tabs);
- label_cell($entries);
+ label_cell($mod['version']);
+ label_cell($mod['path']);
check_cells(null, 'Active'.$i, @$mod['active'] ? 1:0,
false, false, "align='center'");
+
end_row();
}
@@ -211,18 +202,16 @@ if (get_post('Refresh')) {
$result = true;
foreach($exts as $i => $ext) {
- if ($ext['package'] && ($ext['active'] ^ check_value('Active'.$i))) {
+ if ($ext['package'] && ($ext['active'] ^ check_value('Active'.$i)))
+ {
if (check_value('Active'.$i) && !check_src_ext_version($ext['version']))
{
display_warning(sprintf(_("Package '%s' is incompatible with current application version and cannot be activated.\n")
. _("Check Install/Activate page for newer package version."), $ext['name']));
continue;
}
- if (!$ext['active'])
- $activated = activate_hooks($ext['package'], $comp);
- else
- $activated = hook_invoke($ext['package'], check_value('Active'.$i) ?
- 'activate_extension':'deactivate_extension', $comp, false);
+ $activated = activate_hooks($ext['package'], $comp, !$ext['active']); // change active state
+
if ($activated !== null)
$result &= $activated;
if ($activated || ($activated === null))
@@ -264,8 +253,13 @@ echo extset_list('extset', null, true);
echo "
";
if ($set == -1)
- display_extensions();
-else
+{
+ $mods = get_extensions_list('extension');
+ if (!$mods)
+ display_note(_("No optional extension module is currently available."));
+ else
+ display_extensions($mods);
+} else
company_extensions($set);
//---------------------------------------------------------------------------------------------