use (mobile) template specific url on client-side to load sub-templates

This commit is contained in:
Ralf Becker 2016-03-16 11:27:49 +00:00
parent e4dd2e8ff2
commit b60994f1f2
2 changed files with 23 additions and 1 deletions

View File

@ -7,7 +7,7 @@
* @subpackage api * @subpackage api
* @link http://www.egroupware.org * @link http://www.egroupware.org
* @author Ralf Becker <RalfBecker@outdoor-training.de> * @author Ralf Becker <RalfBecker@outdoor-training.de>
* @copyright 2002-11 by RalfBecker@outdoor-training.de * @copyright 2002-16 by RalfBecker@outdoor-training.de
* @version $Id$ * @version $Id$
*/ */
@ -249,6 +249,20 @@ class etemplate_widget_template extends etemplate_widget
} }
$params[0] = $old_cname; $params[0] = $old_cname;
} }
/**
* Fill type options in self::$request->sel_options to be used on the client
*
* @param string $cname
* @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont'
*/
public function beforeSendToClient($cname, array $expand=null)
{
//error_log(__METHOD__."('$cname') this->id=$this->id, this->type=$this->type, this->attrs=".array2string($this->attrs));
$form_name = self::form_name($cname, $this->id, $expand);
self::setElementAttribute($form_name, 'url', self::rel2url($this->rel_path));
}
} }
/* /*

View File

@ -83,6 +83,14 @@ var et2_template = (function(){ "use strict"; return et2_DOMWidget.extend(
// Deferred object so we can load via AJAX // Deferred object so we can load via AJAX
this.loading = jQuery.Deferred(); this.loading = jQuery.Deferred();
// run transformAttributes now, to get server-side modifications (url!)
if (_attrs.template)
{
this.id = _attrs.template;
this.transformAttributes(_attrs);
this.options = et2_cloneObject(_attrs);
_attrs = {};
}
if (this.id != "" || this.options.template) if (this.id != "" || this.options.template)
{ {
var parts = (this.options.template || this.id).split('?'); var parts = (this.options.template || this.id).split('?');