Author: ralfbecker
New Revision: 56030
URL: http://svn.stylite.de/viewvc/egroupware?rev=56030&view=rev
Log:
mv template specific images from “phpgwapi” to “api” and search “api” also on client-side for image, added debug GET parameter to images.php to JSON pretty-print instead of one line javascript
Added:
trunk/egroupware/api/js/jsapi/egw_images.js
- copied, changed from r56021, trunk/egroupware/api/js/jsapi/egw_images.js
Modified:
trunk/egroupware/api/images.php
trunk/egroupware/api/src/Image.php
— trunk/egroupware/api/images.php (original)
+++ trunk/egroupware/api/images.php Thu May 5 11:16:27 2016
@@ -2,7 +2,9 @@
/**
- API: loading available images by application and image-name (without extension)
-
-
- Usage: /egroupware/api/images.php?template=idots
-
-
-
- /egroupware/api/images.php?template=idots
-
include ‘…/header.inc.php’;
-$content = json_encode(Api\Image::map(preg_match(’/^[a-z0-9_-]+$/i’,$_GET[‘template’]) ? $_GET[‘template’] : null, $GET[‘svg’]));
+$content = json_encode(Api\Image::map(preg_match(’/^[a-z0-9-]+$/i’,$_GET[‘template’]) ? $_GET[‘template’] : null, $_GET[‘svg’]),
- JSON_FORCE_OBJECT | // export empty php-arrays as empty objects, not empty arrays
- JSON_UNESCAPED_SLASHES | // do not escape slashes, smaller and better readable
- (!empty($_GET[‘debug’]) ? JSON_PRETTY_PRINT : 0));
// use an etag over the image mapp
$etag = ‘"’.md5($content).’"’;
// headers to allow caching, egw_framework specifies etag on url to force reload, even with Expires header
Api\Session::cache_control(86400); // cache for one day
-Header(‘Content-Type: text/javascript; charset=utf-8’);
+Header(‘Content-Type: ‘.(empty($_GET[‘debug’])?‘text/javascript’:‘application/json’).’; charset=utf-8’);
Header('ETag: '.$etag);
// if servers send a If-None-Match header, response with 304 Not Modified, if etag matches
@@ -43,7 +48,7 @@
exit;
}
-$content = ‘egw.set_images(’.$content.", egw && egw.window !== window);\n";
+if (empty($_GET[‘debug’])) $content = ‘egw.set_images(’.$content.", egw && egw.window !== window);\n";
// we run our own gzip compression, to set a correct Content-Length of the encoded content
if (in_array(‘gzip’, explode(’,’,$_SERVER[‘HTTP_ACCEPT_ENCODING’])) && function_exists(‘gzencode’))
— trunk/egroupware/api/js/jsapi/egw_images.js (original)
+++ trunk/egroupware/api/js/jsapi/egw_images.js Thu May 5 11:16:27 2016
@@ -97,6 +97,11 @@
{
return this.webserverUrl+images[_app][_name];
}
-
tries['api'] = _name;
-
if (typeof images['api'] != 'undefined' && typeof images['api'][_name] == 'string')
-
{
-
return this.webserverUrl+images['api'][_name];
-
}
tries['phpgwapi'] = _name;
if (typeof images['phpgwapi'] != 'undefined' && typeof images['phpgwapi'][_name] == 'string')
{
— trunk/egroupware/api/src/Image.php (original)
+++ trunk/egroupware/api/src/Image.php Thu May 5 11:16:27 2016
@@ -166,7 +166,7 @@
{
$imagedirs[] = ‘/’.$app.’/templates/mobile/images’;
}
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs