From 14e6ceecb6030fef934b1e07cfd27723ca28f2c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20St=C3=B6ckel?= Date: Fri, 2 Mar 2012 10:44:56 +0000 Subject: [PATCH] Integrated application specifig egw api into etemplate2 code --- etemplate/js/et2_core_common.js | 4 ++ etemplate/js/et2_core_widget.js | 55 +++++++++++++--------- etemplate/js/et2_extension_customfields.js | 2 +- etemplate/js/et2_extension_nextmatch.js | 24 +++++----- etemplate/js/et2_widget_date.js | 30 ++++++------ etemplate/js/et2_widget_file.js | 2 +- etemplate/js/et2_widget_image.js | 6 +-- etemplate/js/et2_widget_link.js | 44 ++++++++--------- etemplate/js/et2_widget_progress.js | 2 +- etemplate/js/et2_widget_tabs.js | 2 +- etemplate/js/et2_widget_template.js | 9 +++- etemplate/js/et2_widget_url.js | 16 +++---- etemplate/js/etemplate2.js | 3 ++ 13 files changed, 110 insertions(+), 89 deletions(-) diff --git a/etemplate/js/et2_core_common.js b/etemplate/js/et2_core_common.js index e9ea9e54e3..61052f4427 100644 --- a/etemplate/js/et2_core_common.js +++ b/etemplate/js/et2_core_common.js @@ -138,6 +138,10 @@ function et2_form_name(_cname,_name) */ function et2_js_pseudo_funcs(_val, _cname) { + + // TODO: Call et2 specific egw instance + // Move this function to the API! + if (_val.indexOf('egw::link(') != -1) { _val = _val.replace(/egw::link\(/g,'egw.link('); diff --git a/etemplate/js/et2_core_widget.js b/etemplate/js/et2_core_widget.js index 7374239248..eedccd1a44 100644 --- a/etemplate/js/et2_core_widget.js +++ b/etemplate/js/et2_core_widget.js @@ -551,7 +551,9 @@ var et2_widget = Class.extend({ { if (this.attributes[key].translate === true || (this.attributes[key].translate === "!no_lang" && !_attrs["no_lang"])) - _attrs[key] = egw.lang(_attrs[key]); + { + _attrs[key] = this.egw().lang(_attrs[key]); + } } } }, @@ -671,6 +673,35 @@ var et2_widget = Class.extend({ return true; }, + /** + * The egw function returns the instance of the client side api belonging + * to this widget tree. The api instance can be set in the "container" + * widget using the setApiInstance function. + */ + egw: function() { + // The _egw property is not set + if (typeof this._egw === 'undefined') + { + if (this._parent != null) + { + return this._parent.egw(); + } + + // Return the global egw instance if none is given + return egw('phpgwapi'); + } + + return this._egw; + }, + + /** + * Sets the client side api instance. It can be retrieved by the widget tree + * by using the "egw()" function. + */ + setApiInstance: function(_egw) { + this._egw = _egw; + }, + /** * Sets all array manager objects - this function can be used to set the * root array managers of the container object. @@ -791,28 +822,6 @@ var et2_widget = Class.extend({ return null; }, - /** - * Returns the application for the template the widget is in. - * If a sub-template is used, this may be different from the current app. - */ - getTemplateApp: function() { - if(this._template_application) - { - return this._template_application; - } - else if(this._type == 'template' && this.id) - { - var parts = this.id.split(".",2); - return parts[0]; - } else if (this.getParent()) { - this._template_application = this.getParent().getTemplateApp(); - return this._template_application; - } - var app = egw.getAppName() == 'egroupware' ? 'phpgwapi' : egw.getAppName(); - //console.warn("Unable to find template application, using %s", app); - return app; - }, - /** * Returns the path into the data array. By default, array manager takes care of * this, but some extensions need to override this diff --git a/etemplate/js/et2_extension_customfields.js b/etemplate/js/et2_extension_customfields.js index e672d0bee4..d31dd9a077 100644 --- a/etemplate/js/et2_extension_customfields.js +++ b/etemplate/js/et2_extension_customfields.js @@ -103,7 +103,7 @@ var et2_customfields_list = et2_DOMWidget.extend([et2_IDetachedDOM], { if(global_data.fields) this.options.fields = global_data.fields; // For checking app entries - var apps = egw.link_app_list(); + var apps = this.egw().link_app_list(); // Create the table rows for(var field_name in this.options.customfields) diff --git a/etemplate/js/et2_extension_nextmatch.js b/etemplate/js/et2_extension_nextmatch.js index 1e0935bcd4..c436191fbd 100644 --- a/etemplate/js/et2_extension_nextmatch.js +++ b/etemplate/js/et2_extension_nextmatch.js @@ -326,7 +326,7 @@ var et2_nextmatch = et2_DOMWidget.extend(et2_IResizeable, { var list = et2_csvSplit(this.options.settings.columnselection_pref, 2, "."); var app = list[0]; // 'nextmatch-' prefix is there in preference name, but not in setting, so add it in - var pref = egw.preference("nextmatch-"+this.options.settings.columnselection_pref, list[0]); + var pref = this.egw().preference("nextmatch-"+this.options.settings.columnselection_pref, list[0]); if(pref) { negated = (pref[0] == "!"); @@ -339,7 +339,7 @@ var et2_nextmatch = et2_DOMWidget.extend(et2_IResizeable, { var size = {}; if(this.options.settings.columnselection_pref && app) { - size = egw.preference("nextmatch-"+this.options.settings.columnselection_pref+"-size", app); + size = this.egw().preference("nextmatch-"+this.options.settings.columnselection_pref+"-size", app); } if(!size) size = {}; @@ -387,7 +387,7 @@ var et2_nextmatch = et2_DOMWidget.extend(et2_IResizeable, { }, /** - * Take current column display settings and store them in egw.preferences + * Take current column display settings and store them in this.egw().preferences * for next time */ _updateUserPreferences: function() { @@ -426,10 +426,10 @@ var et2_nextmatch = et2_DOMWidget.extend(et2_IResizeable, { // Save visible columns // 'nextmatch-' prefix is there in preference name, but not in setting, so add it in - egw.set_preference(app, "nextmatch-"+this.options.settings.columnselection_pref, colDisplay.join(",")); + this.egw().set_preference(app, "nextmatch-"+this.options.settings.columnselection_pref, colDisplay.join(",")); // Save adjusted column sizes - egw.set_preference(app, "nextmatch-"+this.options.settings.columnselection_pref+"-size", colSize); + this.egw().set_preference(app, "nextmatch-"+this.options.settings.columnselection_pref+"-size", colSize); // Update query value, so data source can use visible columns to exclude expensive sub-queries var oldCols = this.activeFilters.selectcols ? this.activeFilters.selectcols : []; @@ -564,10 +564,10 @@ var et2_nextmatch = et2_DOMWidget.extend(et2_IResizeable, { var defaultCheck = et2_createWidget("checkbox", {}, this); defaultCheck.set_id('as_default'); - defaultCheck.set_label(egw.lang("As default")); + defaultCheck.set_label(this.egw().lang("As default")); var okButton = et2_createWidget("buttononly", {}, this); - okButton.set_label(egw.lang("ok")); + okButton.set_label(this.egw().lang("ok")); okButton.onclick = function() { // Update visibility var visibility = {}; @@ -621,21 +621,21 @@ var et2_nextmatch = et2_DOMWidget.extend(et2_IResizeable, { }; var cancelButton = et2_createWidget("buttononly", {}, this); - cancelButton.set_label(egw.lang("cancel")); + cancelButton.set_label(this.egw().lang("cancel")); cancelButton.onclick = function() { self.selectPopup.toggle(); } this.selectPopup = jQuery(document.createElement("fieldset")) .addClass("colselection ui-dialog") - .append(""+egw.lang("Select columns")+"") + .append(""+this.egw().lang("Select columns")+"") .append(select.getDOMNode()) .append(okButton.getDOMNode()) .append(cancelButton.getDOMNode()) .appendTo(this.div); // Add default checkbox for admins - var apps = egw.user('apps'); + var apps = this.egw().user('apps'); if(apps['admin']) { this.selectPopup.append(defaultCheck.getSurroundings().getDOMNode(defaultCheck.getDOMNode())) @@ -856,14 +856,14 @@ var et2_nextmatch_header_bar = Class.extend(et2_INextmatchHeader, { var definition = settings.csv_fields; if(settings.csv_fields === true) { - definition = egw.preference('nextmatch-export-definition', this.nextmatch.getTemplateApp()); + definition = egw.preference('nextmatch-export-definition', this.nextmatch.egw().getAppName()); } var button = et2_createWidget("buttononly", {"label": "Export", image:"phpgwapi/filesave"}, this.nextmatch); jQuery(button.getDOMNode()).appendTo(this.filters).css("float", "right") .click(this.nextmatch, function(event) { egw_openWindowCentered2( egw.link('/index.php', { 'menuaction': 'importexport.importexport_export_ui.export_dialog', - 'appname': event.data.getTemplateApp(), + 'appname': event.data.egw().getAppName(), 'definition': definition }), '_blank', 850, 440, 'yes'); }); diff --git a/etemplate/js/et2_widget_date.js b/etemplate/js/et2_widget_date.js index c62a4384d3..c97a902e73 100644 --- a/etemplate/js/et2_widget_date.js +++ b/etemplate/js/et2_widget_date.js @@ -66,7 +66,7 @@ var et2_date = et2_inputWidget.extend({ this.span.append(this.input_date).append(this.button); // Icon could be done in CSS file - var button_image = egw.image('datepopup','phpgwapi'); + var button_image = this.egw().image('datepopup','phpgwapi'); if(button_image) { this.button.css("background-image","url("+button_image+")"); @@ -77,7 +77,7 @@ var et2_date = et2_inputWidget.extend({ node.addClass("et2_date"); var _this = this; - var dateformat = egw.preference("dateformat"); + var dateformat = this.egw().preference("dateformat"); if (!dateformat) dateformat = "Y-m-d"; dateformat = dateformat.replace("Y","%Y").replace("d","%d").replace("m","%m").replace("M", "%b"); @@ -87,7 +87,7 @@ var et2_date = et2_inputWidget.extend({ showsTime: false, onUpdate: function(_value) {_this.set_value(_value)}, daFormat: dateformat, - firstDay: egw.preference("weekdaystarts","calendar") + firstDay: this.egw().preference("weekdaystarts","calendar") }; window.setTimeout(function() { Calendar.setup(setup); @@ -127,7 +127,7 @@ var et2_date = et2_inputWidget.extend({ }, _make_time_selects: function (node) { - var timeformat = egw.preference("timeformat"); + var timeformat = this.egw().preference("timeformat"); this.input_hours = $j(document.createElement("select")); for(var i = 0; i < 24; i++) { @@ -250,7 +250,7 @@ var et2_date = et2_inputWidget.extend({ if(this.input_date) { - this.input_date.val(date(egw.preference('dateformat'), this.date)); + this.input_date.val(date(this.egw().preference('dateformat'), this.date)); } if(this.input_time) { @@ -339,9 +339,9 @@ var et2_date_duration = et2_date.extend({ // Get translations this.time_formats = { - "d": this.options.short_labels ? egw.lang("m") : egw.lang("Days"), - "h": this.options.short_labels ? egw.lang("h") : egw.lang("Hours"), - "m": this.options.short_labels ? egw.lang("m") : egw.lang("Minutes") + "d": this.options.short_labels ? this.egw().lang("m") : this.egw().lang("Days"), + "h": this.options.short_labels ? this.egw().lang("h") : this.egw().lang("Hours"), + "m": this.options.short_labels ? this.egw().lang("m") : this.egw().lang("Minutes") }, this.createInputWidget(); }, @@ -468,7 +468,7 @@ var et2_date_duration = et2_date.extend({ // use decimal separator from user prefs var sep = '.'; - var format = egw.preference('number_format'); + var format = this.egw().preference('number_format'); if (format && (sep = format[0]) && sep != '.') { _value = _value.replace('.',sep); @@ -617,14 +617,14 @@ var et2_date_ro = et2_valueWidget.extend([et2_IDetachedDOM], { switch(this._type) { case "date": - display = date(egw.preference('dateformat'), this.date); + display = date(this.egw().preference('dateformat'), this.date); break; case "date-timeonly": - display = date(egw.preference('timeformat') == '24' ? 'H:i' : 'g:i a', this.date); + display = date(this.egw().preference('timeformat') == '24' ? 'H:i' : 'g:i a', this.date); break; case "date-time": - display = date(egw.preference('dateformat') + " " + - (egw.preference('timeformat') == '24' ? 'H:i' : 'g:i a'), this.date); + display = date(this.egw().preference('dateformat') + " " + + (this.egw().preference('timeformat') == '24' ? 'H:i' : 'g:i a'), this.date); break; case "date-since": var unit2label = { @@ -652,7 +652,7 @@ var et2_date_ro = et2_valueWidget.extend([et2_IDetachedDOM], { var unit_s = unit2s[unit]; if (diff >= unit_s || unit == 's') { - display = Math.round(diff/unit_s,1)+' '+egw.lang(unit2label[unit]); + display = Math.round(diff/unit_s,1)+' '+this.egw().lang(unit2label[unit]); break; } } @@ -712,7 +712,7 @@ var et2_date_timeonly_ro = et2_date_ro.extend({ } }, set_value: function(_value) { - if(egw.preference("timeformat") == "12" && _value.indexOf(":") > 0) { + if(this.egw().preference("timeformat") == "12" && _value.indexOf(":") > 0) { var parts = _value.split(":"); if(parts[0] >= 12) { this.span.text((parts[0] == "12" ? "12" : parseInt(parts[0])-12)+":"+parts[1]+" pm"); diff --git a/etemplate/js/et2_widget_file.js b/etemplate/js/et2_widget_file.js index 1783e2b1b9..24ed39ad26 100644 --- a/etemplate/js/et2_widget_file.js +++ b/etemplate/js/et2_widget_file.js @@ -179,7 +179,7 @@ var et2_file = et2_inputWidget.extend({ if(this.input[0].files[index]) { var file = this.input[0].files[index]; if(file.size > this.options.max_file_size) { - error = egw.lang("File too large"); + error = this.egw().lang("File too large"); } } if(this.progress) diff --git a/etemplate/js/et2_widget_image.js b/etemplate/js/et2_widget_image.js index 2dd6f26ec9..1086731fdc 100644 --- a/etemplate/js/et2_widget_image.js +++ b/etemplate/js/et2_widget_image.js @@ -82,7 +82,7 @@ var et2_image = et2_baseWidget.extend([et2_IDetachedDOM], { { if(this.options.href) { - egw.call_link(this.options.href, this.options.extra_link_target, this.options.extra_link_popup); + this.egw().call_link(this.options.href, this.options.extra_link_target, this.options.extra_link_popup); } }, @@ -122,7 +122,7 @@ var et2_image = et2_baseWidget.extend([et2_IDetachedDOM], { } this.options.src = _value; - var app = this.getTemplateApp(); + var app = this.egw().getAppName(); // Handle app/image if(_value.indexOf("/") > 0 && _value.indexOf("/") == _value.lastIndexOf("/")) { @@ -131,7 +131,7 @@ var et2_image = et2_baseWidget.extend([et2_IDetachedDOM], { _value = split[1]; } // Get application to use from template ID - var src = egw.image(_value, app); + var src = this.egw().image(_value, app); if(src) { this.image.attr("src", src).show(); diff --git a/etemplate/js/et2_widget_link.js b/etemplate/js/et2_widget_link.js index fdd12ccbe6..71c1eae6fb 100644 --- a/etemplate/js/et2_widget_link.js +++ b/etemplate/js/et2_widget_link.js @@ -108,7 +108,7 @@ var et2_link_to = et2_inputWidget.extend({ // One common link button this.link_button = $j(document.createElement("button")) - .text(egw.lang(this.options.link_label)) + .text(this.egw().lang(this.options.link_label)) .appendTo(this.div).hide() .click(this, this.createLink); @@ -123,7 +123,7 @@ var et2_link_to = et2_inputWidget.extend({ this.comment = $j(document.createElement("input")) .css("display", "block").css("width","89%") .appendTo(this.div).hide(); - et2_link_entry.prototype.set_blur(egw.lang("Comment..."),this.comment); + et2_link_entry.prototype.set_blur(this.egw().lang("Comment..."),this.comment); // Need a div for file upload widget this.file_div = $j(document.createElement("div")).appendTo(this.div); @@ -139,7 +139,7 @@ var et2_link_to = et2_inputWidget.extend({ // Link-to var link_entry_attrs = { id: this.id + '_link_entry', - blur: this.options.search_label ? this.options.search_label : egw.lang('Search...'), + blur: this.options.search_label ? this.options.search_label : this.egw().lang('Search...'), query: function() { self.link_button.hide(); self.comment.hide(); return true;}, select: function() {self.link_button.show(); self.comment.show(); return true;} } @@ -172,7 +172,7 @@ var et2_link_to = et2_inputWidget.extend({ this.file_upload.progress.children().each(function() { var comment = jQuery(document.createElement("input")) .appendTo(this).hide(); - self.link_entry.set_blur(egw.lang("Comment..."),comment); + self.link_entry.set_blur(this.egw().lang("Comment..."),comment); var comment_icon = jQuery(document.createElement("span")) .appendTo(this) @@ -273,9 +273,9 @@ var et2_link_apps = et2_selectbox.extend({ // Limit to one app if(this.options.application) { - select_options[_attrs.application] = egw.lang(_attrs.application); + select_options[_attrs.application] = this.egw().lang(_attrs.application); } else { - select_options = egw.link_app_list('query'); + select_options = this.egw().link_app_list('query'); // Check whether the options entry was found, if not read it from the // content array. @@ -383,7 +383,7 @@ var et2_link_entry = et2_valueWidget.extend({ .focus(function(){if(!self.options.application) {self.app_select.show();}}) .appendTo(this.div); - this.set_blur(this.options.blur ? this.options.blur : egw.lang("search"), this.search); + this.set_blur(this.options.blur ? this.options.blur : this.egw().lang("search"), this.search); // Autocomplete this.search.autocomplete({ @@ -415,12 +415,12 @@ var et2_link_entry = et2_valueWidget.extend({ var apps = et2_csvSplit(_attrs["application"], null, ","); for(var i = 0; i < apps.length; i++) { - _attrs["select_options"][apps[i]] = egw.lang(apps[i]); + _attrs["select_options"][apps[i]] = this.egw().lang(apps[i]); } } else { - _attrs["select_options"] = egw.link_app_list('query'); + _attrs["select_options"] = this.egw().link_app_list('query'); } // Check whether the options entry was found, if not read it from the @@ -475,14 +475,14 @@ var et2_link_entry = et2_valueWidget.extend({ return; } if(!_value.title) { - var title = egw.link_title(_value.app, _value.id); + var title = this.egw().link_title(_value.app, _value.id); if(title != null) { _value.title = title; } else { // Title will be fetched from server and then set - var title = egw.link_title(_value.app, _value.id, function(title) {this.val(title+"");}, this.search); + var title = this.egw().link_title(_value.app, _value.id, function(title) {this.val(title+"");}, this.search); } } this.value = _value; @@ -664,7 +664,7 @@ var et2_link = et2_valueWidget.extend([et2_IDetachedDOM], { } if(!_value.title) { var self = this; - var title = egw.link_title(_value.app, _value.id, function(title) {self.set_title(self.link[0], title);}, this); + var title = this.egw().link_title(_value.app, _value.id, function(title) {self.set_title(self.link[0], title);}, this); if(title != null) { _value.title = title; } @@ -676,7 +676,7 @@ var et2_link = et2_valueWidget.extend([et2_IDetachedDOM], { } this.set_title(this.link, _value.title); this.link.unbind() - .click( function(){egw.open(_value.id, _value.app, "edit", _value.extra);}); + .click( function(){this.egw().open(_value.id, _value.app, "edit", _value.extra);}); }, /** @@ -802,26 +802,26 @@ var et2_link_string = et2_valueWidget.extend([et2_IDetachedDOM], { { _value.only_app = this.options.only_app; } - egw.jsonq('etemplate.etemplate_widget_link.ajax_link_list', [_value], this.set_value, this); + this.egw().jsonq('etemplate.etemplate_widget_link.ajax_link_list', [_value], this.set_value, this); return; }, _add_link: function(_link_data) { if(!_link_data.title) { // No callback yet, need something to do with it - var title = egw.link_title(_link_data.app, _link_data.id); + var title = this.egw().link_title(_link_data.app, _link_data.id); // Need to set it to something, or call to text() will return current value if(title == null || title == false) _link_data.title = ""; } var link = $j(document.createElement("li")) .appendTo(this.list) .addClass("et2_link") - .click( function(){egw.open(_link_data.id, _link_data.app, "edit", _link_data.extra);}); + .click( function(){this.egw().open(_link_data.id, _link_data.app, "edit", _link_data.extra);}); if(_link_data.title) link.text(_link_data.title); // Now that link is created, get title from server & update if(!_link_data.title) { - egw.link_title(_link_data.app, _link_data.id, function(title) {this.text(title);}, link); + this.egw().link_title(_link_data.app, _link_data.id, function(title) {this.text(title);}, link); } }, @@ -901,7 +901,7 @@ var et2_link_list = et2_link_string.extend({ $j(document.createElement("td")) .appendTo(row) .addClass(columns[i]) - .click( function(){egw.open(_link_data.id, _link_data.app, "edit", _link_data.extra);}) + .click( function(){this.egw().open(_link_data.id, _link_data.app, "edit", _link_data.extra);}) .text(_link_data[columns[i]]); } @@ -947,18 +947,18 @@ var et2_link_add = et2_inputWidget.extend({ init: function() { this._super.apply(this, arguments); - this.div = jQuery(document.createElement("div")).text(egw.lang("Add new")); + this.div = jQuery(document.createElement("div")).text(this.egw().lang("Add new")); this.setDOMNode(this.div[0]); }, doLoadingFinished: function() { this._super.apply(this, arguments); this.app_select = et2_createWidget("link-apps", this.options ,this); this.div.append(this.app_select.getDOMNode()); - this.button = et2_createWidget("button", {label: egw.lang("add")}, this); - this.button.set_label(egw.lang("add")); + this.button = et2_createWidget("button", {label: this.egw().lang("add")}, this); + this.button.set_label(this.egw().lang("add")); var self = this; this.button.click = function() { - egw.open(self.options.value.to_app + ":" + self.options.value.to_id, self.app_select.get_value(), 'add'); + this.egw().open(self.options.value.to_app + ":" + self.options.value.to_id, self.app_select.get_value(), 'add'); }; this.div.append(this.button.getDOMNode()); } diff --git a/etemplate/js/et2_widget_progress.js b/etemplate/js/et2_widget_progress.js index 324937907b..30621d993d 100644 --- a/etemplate/js/et2_widget_progress.js +++ b/etemplate/js/et2_widget_progress.js @@ -81,7 +81,7 @@ var et2_progress = et2_valueWidget.extend(et2_IDetachedDOM, if(this.options.href) { - egw.call_link(this.options.href, this.options.extra_link_target, this.options.extra_link_popup); + this.egw().call_link(this.options.href, this.options.extra_link_target, this.options.extra_link_popup); } }, diff --git a/etemplate/js/et2_widget_tabs.js b/etemplate/js/et2_widget_tabs.js index f5fb0f0a03..515847451a 100644 --- a/etemplate/js/et2_widget_tabs.js +++ b/etemplate/js/et2_widget_tabs.js @@ -92,7 +92,7 @@ var et2_tabbox = et2_DOMWidget.extend({ } } tabData.push({ - "label": egw.lang(et2_readAttrWithDefault(node, "label", "Tab")), + "label": this.egw().lang(et2_readAttrWithDefault(node, "label", "Tab")), "widget": null, "contentDiv": null, "flagDiv": null, diff --git a/etemplate/js/et2_widget_template.js b/etemplate/js/et2_widget_template.js index 66c3adb754..ede315af81 100644 --- a/etemplate/js/et2_widget_template.js +++ b/etemplate/js/et2_widget_template.js @@ -67,6 +67,11 @@ var et2_template = et2_DOMWidget.extend({ if (this.id != "") { + // Set the api instance to the first part of the name of the + // template + var splitted = this.id.split('.'); + this.setApiInstance(egw(splitted[0])); + this.createProxy(); } }, @@ -90,13 +95,13 @@ var et2_template = et2_DOMWidget.extend({ // template (done by passing "this" to the clone function) this.proxiedTemplate = tmpl.clone(this); - // Reset the "ignore" flag and manually copy the id + // Reset the id and manually copy the id to the proxied template tmpl.options.id = this.id; this.proxiedTemplate.id = tmpl.id; this.proxiedTemplate.isProxy = true; // Disallow adding any new node to this template - //this.supportedWidgetClasses = []; + this.supportedWidgetClasses = []; } }, diff --git a/etemplate/js/et2_widget_url.js b/etemplate/js/et2_widget_url.js index 8741181974..ba3ff24de3 100644 --- a/etemplate/js/et2_widget_url.js +++ b/etemplate/js/et2_widget_url.js @@ -136,14 +136,14 @@ var et2_url = et2_textbox.extend({ { value = "tel:"+value; } - else if (egw.config("call_link")) + else if (this.egw().config("call_link")) { - var link = egw.config("call_link").replace("%1", value). - replace("%u",egw.user('account_id')).replace("%t",egw.user('account_phone')); + var link = this.egw().config("call_link").replace("%1", value). + replace("%u",this.egw().user('account_id')).replace("%t",this.egw().user('account_phone')); - if(egw.config("call_popup")) + if(this.egw().config("call_popup")) { - var size = egw.config("call_popup").split("x"); + var size = this.egw().config("call_popup").split("x"); value = function() { egw_openWindowCentered(link, false,size[0],size[1]); }; } else // no popup @@ -157,9 +157,9 @@ var et2_url = et2_textbox.extend({ } break; case "url-email": - if(egw.link_registry && egw.link_registry.felamimail) + if(this.egw().link_registry && this.egw().link_registry.felamimail) { - return function() {egw.open("","felamimail","add","send_to="+jQuery.base64Encode(value));}; + return function() {this.egw().open("","felamimail","add","send_to="+jQuery.base64Encode(value));}; } else if(value.indexOf("mailto:") == -1) { @@ -185,7 +185,7 @@ var et2_url = et2_textbox.extend({ case "url": if(value.indexOf("://") == -1) { e.data.set_value("http://"+value); - e.data.showMessage(egw.lang("Protocol is required"), "hint", true); + e.data.showMessage(this.egw().lang("Protocol is required"), "hint", true); } break; } diff --git a/etemplate/js/etemplate2.js b/etemplate/js/etemplate2.js index a7f16d8aac..dfd0265d4b 100644 --- a/etemplate/js/etemplate2.js +++ b/etemplate/js/etemplate2.js @@ -42,6 +42,9 @@ et2_core_xml; et2_core_arrayMgr; et2_core_interfaces; + + // Include the client side api core + egw_core; */ /**