Author: ralfbecker
New Revision: 54909
URL: http://svn.stylite.de/viewvc/egroupware?rev=54909&view=rev
Log:
server-side adds now urls for extra tabs incl. cache-buster, so we dont rely on app-code to add it
Modified:
trunk/admin/inc/class.admin_account.inc.php
trunk/etemplate/ (props changed)
trunk/etemplate/inc/class.etemplate_new.inc.php
trunk/etemplate/inc/class.etemplate_widget_tabbox.inc.php
trunk/etemplate/inc/class.etemplate_widget_template.inc.php
trunk/etemplate/js/et2_widget_tabs.js
trunk/etemplate/js/et2_widget_template.js
— trunk/admin/inc/class.admin_account.inc.php (original)
+++ trunk/admin/inc/class.admin_account.inc.php Wed Feb 3 16:20:50 2016
@@ -101,7 +101,7 @@
$readonlys[‘account_passwd’] = $readonlys[‘account_passwd2’] = true;
}
return array(
-
'name' => 'admin.account',
'prepend' => true,
'label' => 'Account',
'data' => $account,
Propchange: trunk/etemplate/
— svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb 3 16:20:50 2016
@@ -1,1 +1,1 @@
-/branches/14.2/etemplate:52426,52645-52646,52823
+/branches/14.2/etemplate:52426,52645-52646,52823,54046,54053
— trunk/etemplate/inc/class.etemplate_new.inc.php (original)
+++ trunk/etemplate/inc/class.etemplate_new.inc.php Wed Feb 3 16:20:50 2016
@@ -7,7 +7,7 @@
@@ -109,19 +109,24 @@
$content
);
-
foreach(isset($extras[0]) ? $extras : array($extras) as $extra)
-
{
-
if ($extra['data'] && is_array($extra['data']))
-
{
$content = array_merge($content, $extra['data']);
}
-
if ($extra['preserve'] && is_array($extra['preserve']))
-
{
$preserv = array_merge($preserv, $extra['preserve']);
}
-
if ($extra['readonlys'] && is_array($extra['readonlys']))
-
{
$readonlys = array_merge($readonlys, $extra['readonlys']);
}
}
@@ -306,13 +311,13 @@
* Process via Ajax submitted content
*
* @param string $etemplate_exec_id
-
-
@param array $_content
-
@param boolean $no_validation
-
@throws egw_exception_wrong_parameter
*/
@@ -337,7 +342,7 @@
$expand = array(
‘cont’ => &self::$request->content,
);
-
$template->run('validate', array('', $expand, $content, &$validated), true); // $respect_disabled=true: do NOT validate disabled widgets and children
-
$template->run('validate', array('', $expand, $_content, &$validated), true); // $respect_disabled=true: do NOT validate disabled widgets and children
if ($no_validation)
{
@@ -345,7 +350,7 @@
}
elseif (self::validation_errors(self::$request->ignore_validation))
{
@@ -353,50 +358,41 @@
// tell request call to remove request, if it is not modified eg. by call to exec in callback
self::$request->remove_if_not_modified();
-
$hook_data = $GLOBALS['egw']->hooks->process(
-
array(
-
'hook_location' => 'etemplate2_before_process',
-
'location_name' => $template->id) +
-
self::complete_array_merge(self::$request->preserv, $validated)
-
);
-
-
foreach($hook_data as $extras) {
-
foreach($GLOBALS['egw']->hooks->process(array(
-
'hook_location' => 'etemplate2_before_process',
-
'location_name' => $template->id,
-
) + self::complete_array_merge(self::$request->preserv, $validated)) as $extras)
-
{
if (!$extras) continue;
-
foreach(isset($extras[0]) ? $extras : array($extras) as $extra)
-
{
-
if ($extra['data'] && is_array($extra['data']))
-
{
$validated = array_merge($validated, $extra['data']);
}
}
}
-
unset($hook_data);
//error_log(__METHOD__."(,".array2string($content).')');
//error_log(' validated='.array2string($validated));
$content = ExecMethod(self::$request->method, self::complete_array_merge(self::$request->preserv, $validated));
-
$tcontent = array();
-
-
if( is_array($content) ) {
-
$tcontent = $content;
-
}
-
else {
-
$tcontent = self::complete_array_merge(
-
self::$request->preserv,
-
$validated
-
);
-
}
-
$tcontent = is_array($content) ? $content :
-
self::complete_array_merge(self::$request->preserv, $validated);
$hook_data = $GLOBALS['egw']->hooks->process(
array(
'hook_location' => 'etemplate2_after_process',
@@ -472,13 +468,6 @@
return ExecMethod(self::$request->method, self::complete_array_merge(self::$request->preserv, $validated));
}
- /**
-
- Path of template relative to EGW_SERVER_ROOT
-
-
- */
- public $rel_path;
- public $name;
public $template_set;
public $version;
@@ -494,7 +483,7 @@
- Reads an eTemplate from filesystem or DB (not yet supported)
-
-
@param string $name name of the eTemplate or array with the values for all keys
-
-
@param string $template_set=null default try template-set from user and if not found “default”
-
-
@param string $template_set =null default try template-set from user and if not found “default”
-
@param string $lang language, ‘’ loads the pref. lang of the user, ‘default’ loads the default one ‘’ in the db
-
@param int $group id of the (primary) group of the user or 0 for none, not used at the moment !!!
-
@param string $version version of the eTemplate
@@ -505,13 +494,13 @@
*/
public function read($name,$template_set=null,$lang=‘default’,$group=0,$version=’’,$load_via=’’)
{
-
unset($lang); unset($group); // not used, but in old signature
$this->rel_path = self::relPath($this->name=$name, $this->template_set=$template_set,
$this->version=$version, $this->laod_via = $load_via);
@@ -580,7 +569,7 @@
* disables all cells with name == $name
*
* @param sting $name cell-name
-
-
@param boolean $disabled=true disable or enable a cell, default true=disable
-
-
@param boolean $disabled =true disable or enable a cell, default true=disable
-
@return reference to attribute
-
@deprecated use disableElement($name, $disabled=true)
/
@@ -626,7 +615,7 @@
/*
- Debug callback just outputting content
-
-
-
@param array $content=null
-
-
@param array $content =null
*/
public function debug(array $content=null)
{
@@ -658,8 +647,8 @@
- Format a number according to user prefs with decimal and thousands separator (later only for readonly)
-
-
@param int|float|string $number
-
-
@param int $num_decimal_places=2
-
-
@param boolean $readonly=true
-
-
@param int $num_decimal_places =2
-
-
@param boolean $readonly =true
-
@return string
*/
static public function number_format($number,$num_decimal_places=2,$readonly=true)
— trunk/etemplate/inc/class.etemplate_widget_tabbox.inc.php (original)
+++ trunk/etemplate/inc/class.etemplate_widget_tabbox.inc.php Wed Feb 3 16:20:50 2016
@@ -34,12 +34,11 @@
* content. This prevents running the method on disabled tabs.
*
* @param string $method_name
-
-
@param array $params=array(’’) parameter(s) first parameter has to be the cname, second $expand!
-
-
@param boolean $respect_disabled=false false (default): ignore disabled, true: method is NOT run for disabled widgets AND their children
-
-
@param array $params =array(’’) parameter(s) first parameter has to be the cname, second $expand!
-
-
@param boolean $respect_disabled =false false (default): ignore disabled, true: method is NOT run for disabled widgets AND their children
*/
public function run($method_name, $params=array(’’), $respect_disabled=false)
{
@@ -51,11 +50,14 @@
$this->children[1]->children = array();
}
-
$this->tabs = array();
foreach($this->attrs['tabs'] as $tab)
{
$template= clone etemplate_widget_template::instance($tab['template']);
if($tab['id']) $template->attrs['content'] = $tab['id'];
$this->children[1]->children[] = $template;
-
$tab['url'] = etemplate_widget_template::rel2url($template->rel_path);
-
$this->tabs[] = $tab;
unset($template);
}
}
@@ -67,8 +69,8 @@
{
foreach($this->children[1]->children as $tab)
{
-
$parts = explode('.',$tab->template ? $tab->template : $tab->id);
-
$ro_id = array_pop($parts);
if($readonlys[$ro_id])
{
$tab->attrs['disabled'] = $readonlys[$ro_id];
@@ -78,6 +80,23 @@
// Tabs are set up now, continue as normal
parent::run($method_name, $params, $respect_disabled);
-
}
-
-
/**
-
- Implemented to send tab-urls incl. cache-buster and mobile template switch to client-side
-
-
- They are send as tab_urls object via modifications.
-
-
-
*/
-
public function beforeSendToClient($cname)
-
{
-
$form_name = self::form_name($cname, $this->id);
-
-
if (!empty($this->tabs))
-
{
-
self::setElementAttribute($form_name, 'tabs', $this->tabs);
-
}
}
/**
— trunk/etemplate/inc/class.etemplate_widget_template.inc.php (original)
+++ trunk/etemplate/inc/class.etemplate_widget_template.inc.php Wed Feb 3 16:20:50 2016
@@ -36,6 +36,13 @@
protected static $cache = array();
/**
-
- Path of template relative to EGW_SERVER_ROOT
-
-
- */
- public $rel_path;
-
- /**
- Get instance of template specified by name, template(-set) and version
-
-
@param string $_name
@@ -47,6 +54,11 @@
*/
public static function instance($_name, $template_set=null, $version=’’, $load_via=’’)
{
-
if (html::$ua_mobile)
-
{
-
$template_set = "mobile";
-
}
-
//$start = microtime(true);
list($name) = explode('?', $_name); // remove optional cache-buster
if (isset(self::$cache[$name]) || !($path = self::relPath($name, $template_set, $version)))
@@ -96,6 +108,7 @@
if ($reader->nodeType == XMLReader::ELEMENT && $reader->name == ‘template’)
{
$template = new etemplate_widget_template($reader);
— trunk/etemplate/js/et2_widget_tabs.js (original)
+++ trunk/etemplate/js/et2_widget_tabs.js Wed Feb 3 16:20:50 2016
@@ -63,7 +63,7 @@
// Create the outer tabbox container
this.container = $j(document.createElement(“div”))
.addClass(“et2_tabbox”);
@@ -212,7 +212,7 @@
{
var tab = this.options.tabs[i];
var tab_id = tab.id || tab.template;
@@ -359,9 +359,9 @@
entry.contentDiv.appendTo(entry.flagDiv);
}
}
— trunk/etemplate/js/et2_widget_template.js (original)
+++ trunk/etemplate/js/et2_widget_template.js Wed Feb 3 16:20:50 2016
@@ -55,6 +55,11 @@
“name”: “Content index”,
“default”: et2_no_init,
“description”: “Used for passing in specific content to the template other than what it would get by ID.”
@@ -102,16 +107,20 @@
if(!xml)
{
// Ask server
-
var splitted = template_name.split('.');
-
// use template base url from initial template, to continue using webdav, if that was loaded via webdav
-
var path = this.getRoot()._inst.template_base_url + splitted.shift() + "/templates/default/" +
-
splitted.join('.')+ ".xet" + (cache_buster ? '?download='+cache_buster :
-
// if server did not give a cache-buster, fall back to current time
-
'?download='+(new Date).valueOf());
-
var url = this.options.url;
-
if (!this.options.url)
-
{
-
var splitted = template_name.split('.');
-
// use template base url from initial template, to continue using webdav, if that was loaded via webdav
-
url = this.getRoot()._inst.template_base_url + splitted.shift() + "/templates/default/" +
-
splitted.join('.')+ ".xet" + (cache_buster ? '?download='+cache_buster : '');
-
}
-
// if server did not give a cache-buster, fall back to current time
-
if (url.indexOf('?') == -1) url += '?download='+(new Date).valueOf();
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs