mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 08:34:42 +01:00
- fixed image map was empty created when not loged in (now directories are used and not $GLOBALS['egw_info']['apps'])
- fixed not working vfs-image-dir - deleteing image-maps when: + apps get installed, updated or removed + admin >> register hooks + admin >> site configuration: vfs-image-dir get changed - fixed not displayed validation errors (thought there were no validation) in admin >> site config --> you need to register hooks, in order to get the admin >> site configuration validation hook ;-)
This commit is contained in:
parent
5d83c036e0
commit
54bf7a3d2d
@ -142,6 +142,8 @@ class admin_prefs_sidebox_hooks
|
||||
}
|
||||
$GLOBALS['egw']->hooks->register_all_hooks();
|
||||
|
||||
common::delete_image_map();
|
||||
|
||||
if (method_exists($GLOBALS['egw'],'invalidate_session_cache')) // egw object in setup is limited
|
||||
{
|
||||
$GLOBALS['egw']->invalidate_session_cache(); // in case with cache the egw_info array in the session
|
||||
|
38
admin/inc/hook_config_validate.inc.php
Normal file
38
admin/inc/hook_config_validate.inc.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* EGroupware administration
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @package setup
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
Set a global flag to indicate this file was found by setup/config.php.
|
||||
config.php will unset it after parsing the form values.
|
||||
*/
|
||||
$GLOBALS['egw_info']['server']['found_validation_hook'] = True;
|
||||
|
||||
/**
|
||||
* Check VFS dir exists and delete image map to recreate it, if vfs-image-dir changes
|
||||
*
|
||||
* @param string
|
||||
*/
|
||||
function vfs_image_dir($vfs_image_dir)
|
||||
{
|
||||
//error_log(__FUNCTION__.'() vfs_image_dir='.array2string($vfs_image_dir).' was '.array2string($GLOBALS['egw_info']['server']['vfs_image_dir']));
|
||||
if (!empty($vfs_image_dir))
|
||||
{
|
||||
if (!egw_vfs::file_exists($vfs_image_dir) || !egw_vfs::is_dir($vfs_image_dir))
|
||||
{
|
||||
$GLOBALS['config_error'] = lang('VFS directory "%1" NOT found!',$vfs_image_dir);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ($vfs_image_dir != (string)$GLOBALS['egw_info']['server']['vfs_image_dir'])
|
||||
{
|
||||
common::delete_image_map();
|
||||
}
|
||||
}
|
@ -34,7 +34,7 @@ $setup_info['admin']['hooks'] = array(
|
||||
'acl_manager',
|
||||
'add_def_pref',
|
||||
'after_navbar',
|
||||
'config',
|
||||
'config_validate',
|
||||
'deleteaccount',
|
||||
'view_user' => 'admin.uiaccounts.edit_view_user_hook',
|
||||
'edit_user' => 'admin.uiaccounts.edit_view_user_hook',
|
||||
|
@ -1,4 +1,6 @@
|
||||
<!-- $Id$ -->
|
||||
<!-- BEGIN header -->
|
||||
<p style="text-align: center; color: red; font-weight: bold;">{error}</p>
|
||||
<form method="POST" action="{action_url}">
|
||||
<table align="center" width="85%" callspacing="0" style="{ border: 1px solid #000000; }">
|
||||
<tr class="th">
|
||||
|
@ -847,8 +847,10 @@ class common
|
||||
$img_types = array('png','jpg','gif','ico');
|
||||
}
|
||||
$map = array();
|
||||
foreach($GLOBALS['egw_info']['apps'] as $app => $data)
|
||||
foreach(scandir(EGW_SERVER_ROOT) as $app)
|
||||
{
|
||||
if ($app[0] == '.' || !is_dir(EGW_SERVER_ROOT.'/'.$app) || !file_exists(EGW_SERVER_ROOT.'/'.$app.'/templates')) continue;
|
||||
|
||||
$app_map =& $map[$app];
|
||||
$app_map = array();
|
||||
$imagedirs = array();
|
||||
@ -884,20 +886,37 @@ class common
|
||||
{
|
||||
foreach(egw_vfs::find($dir) as $img)
|
||||
{
|
||||
if ($img[0] == '.' || !in_array($ext = self::get_extension($img, $name), $img_types) || empty($name)) continue;
|
||||
if (!in_array($ext = self::get_extension($img, $name), $img_types) || empty($name)) continue;
|
||||
|
||||
if (!isset($app_map[$name]) || array_search($ext, $img_types) < array_search(self::get_extension($app_map[$name]), $img_types))
|
||||
{
|
||||
$app_map[$name] = egw_vfs::download_url($dir.'/'.$img);
|
||||
$app_map[$name] = egw_vfs::download_url($img);
|
||||
}
|
||||
}
|
||||
}
|
||||
//error_log(__METHOD__."('$template_set') took ".(microtime(true)-$starttime).' secs');
|
||||
egw_cache::setInstance(__CLASS__, 'image_map_'.$template_set, $map, 86400); // cache for one day
|
||||
|
||||
//echo "<p>template_set=".array2string($template_set)."</p>\n"; _debug_array($map);
|
||||
return $map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete image map cache for ALL template sets
|
||||
*/
|
||||
public static function delete_image_map()
|
||||
{
|
||||
$templates = array('idots', 'jerryr', 'jdots');
|
||||
if (($template_set = $GLOBALS['egw_info']['user']['preferences']['common']['template_set']) && !in_array($template_set, $templates))
|
||||
{
|
||||
$templates[] = $template_set;
|
||||
}
|
||||
error_log(__METHOD__."() for templates ".array2string($templates));
|
||||
foreach($templates as $template_set)
|
||||
{
|
||||
egw_cache::unsetInstance(__CLASS__, 'image_map_'.$template_set);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get extension (and optional basename without extension) of a given path
|
||||
*
|
||||
|
@ -60,6 +60,9 @@ class setup_process
|
||||
function init_process()
|
||||
{
|
||||
$GLOBALS['egw_setup']->oProc = new schema_proc();
|
||||
|
||||
// delete image-map, in case new apps get installed, or existing ones updated
|
||||
common::delete_image_map();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user