From db774ece2b36756e8e45676c912029045769c3a7 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 24 Oct 2015 11:07:22 +0000 Subject: [PATCH] fix intro offer was not translated and now shown in idots template, also changed wording a little and added German translation --- etemplate/js/et2_widget_dialog.js | 8 ++-- phpgwapi/js/framework/fw_base.js | 55 +++++----------------------- phpgwapi/js/jsapi/egw.js | 33 ++++++++++++++++- phpgwapi/js/jsapi/egw_preferences.js | 12 +++--- phpgwapi/lang/egw_de.lang | 5 +++ phpgwapi/lang/egw_en.lang | 5 +++ 6 files changed, 62 insertions(+), 56 deletions(-) diff --git a/etemplate/js/et2_widget_dialog.js b/etemplate/js/et2_widget_dialog.js index fbd8379d4a..93093bebe3 100644 --- a/etemplate/js/et2_widget_dialog.js +++ b/etemplate/js/et2_widget_dialog.js @@ -503,7 +503,7 @@ jQuery.extend(et2_dialog, // create a dummy parent with a correct reference to an application specific egw object var parent = new et2_widget(); // if egw object is passed in because called from et2, just use it - if (typeof _egw_or_appname == 'object') + if (typeof _egw_or_appname != 'string') { parent._egw = _egw_or_appname; } @@ -543,10 +543,10 @@ jQuery.extend(et2_dialog, value: _value }, parent); }, - + /** * Show an alert message with OK button - * + * * @param {String} _message Message to be place in the dialog. * @param {String} _title Text in the top bar of the dialog. * @param integer _type One of the message constants. This defines the style of the message. @@ -562,7 +562,7 @@ jQuery.extend(et2_dialog, dialog_type: _type || et2_dialog.INFORMATION_MESSAGE }, parent); }, - + /** * Show a prompt dialog * diff --git a/phpgwapi/js/framework/fw_base.js b/phpgwapi/js/framework/fw_base.js index b952d2bdfd..d7988a376e 100644 --- a/phpgwapi/js/framework/fw_base.js +++ b/phpgwapi/js/framework/fw_base.js @@ -57,35 +57,6 @@ var fw_base = Class.extend({ // Override the egw_getAppName function window.egw_getAppName = this.egw_getAppName; - - - // Open tutorial popup with an introduction video about egroupware - // the popup can be discarded for the next time show if user - // select "Never" or can select "Later" and the introduction - // dialog will show upon the next session refresh - if (!egw.preference('egw_tutorial_noautoload', 'common') - && !parseInt(document.getElementById('egw_script_id').getAttribute('data-framework-reload'))) - { - var buttons = [ - {text:"Show", id:"show", default:"true"}, - {text:"Later", id:"later"}, - {text:"Never", id:"never"} - ]; - et2_dialog.show_dialog(function (_button_id) - { - if (_button_id == "show" ) - { - egw.open_link(egw.link('/index.php', 'menuaction=home.home_tutorial_ui.popup&tuid=introduction-'+egw.preference('lang')+'-0-a'),'_blank','960x580'); - } - else if(_button_id == "never") - { - egw.set_preference('common', 'egw_tutorial_noautoload',true); - } - }, - egw.lang('We would like to introduce you to EGroupware by showing a short introduction video.'), - egw.lang('Introduction'), - {}, buttons, et2_dialog.QUESTION_MESSAGE, undefined, egw); - } }, /** @@ -203,7 +174,7 @@ var fw_base = Class.extend({ else if (_app.browser != null && // check if app has its own linkHandler !(this.applications[_app.appName].app_refresh) && - _app.browser.iframe == null && _url == _app.browser.currentLocation + _app.browser.iframe == null && _url == _app.browser.currentLocation // links with load may needs to be reloaded e.g. admin applications global cats && !(_app.browser.currentLocation.match(/&load=[^&]+/g) && _app == 'admin')) { @@ -570,23 +541,17 @@ var fw_base = Class.extend({ { var _app = null; - //Read the menuaction parts from the url and check whether the first part - //of the url contains a valid app name - var matches = _url.match(/menuaction=([a-z0-9_-]+)\./i); - if (matches && (_app = this.getApplicationByName(matches[1]))) + // Check the menuaction parts from the url + var matches = _url.match(/menuaction=([a-z0-9_-]+)\./i) || + // Check the url for a scheme of "/app/something.php" + _url.match(/\/([^\/]+)\/[^\/]+\.php/i); + if (matches) { - return _app; + // check if this is a regular app-name + _app = this.getApplicationByName(matches[1]); } - //Check the url for a scheme of "/app/something.php" and check this one for a valid app - //name - var matches = _url.match(/\/([^\/]+)\/[^\/]+\.php/i); - if (matches && (_app = this.getApplicationByName(matches[1]))) - { - return _app; - } - - return null; + return _app; }, /** @@ -1005,7 +970,7 @@ var fw_base = Class.extend({ appWindow.focus(); // et2 available, let its widgets prepare - var deferred = [] + var deferred = []; var et2_list = []; $j('.et2_container',this.activeApp.tab.contDiv).each(function() { var et2 = etemplate2.getById(this.id); diff --git a/phpgwapi/js/jsapi/egw.js b/phpgwapi/js/jsapi/egw.js index 7b5345b276..8b18d995a4 100644 --- a/phpgwapi/js/jsapi/egw.js +++ b/phpgwapi/js/jsapi/egw.js @@ -241,11 +241,11 @@ // to take padding/margin into account var delta_width = w.width - ($et2.outerWidth(true) + ($main_div.outerWidth(true) - $main_div.width())); var delta_height = w.height - ($et2.outerHeight(true) + ($main_div.outerHeight(true) - $main_div.height())); - + // Don't let the window gets horizental scrollbar var scrollWidth = document.body.scrollWidth - document.body.clientWidth; if (scrollWidth > 0 && scrollWidth + egw_getWindowOuterWidth() < screen.availWidth) delta_width = -scrollWidth; - + if (delta_height && egw_getWindowOuterHeight() >= egw.availHeight()) { delta_height = 0; @@ -312,6 +312,35 @@ { window.scrollTo(0, 1); } + // Open tutorial popup with an introduction video about egroupware + if (window.framework === window.top.framework && typeof et2_dialog != 'undefined' && + !egw.preference('egw_tutorial_noautoload', 'common') && + !parseInt(document.getElementById('egw_script_id').getAttribute('data-framework-reload'))) + { + // we need to wait until common translations are loaded + egw.langRequireApp(window, 'common', function() + { + var buttons = [ + {text:egw.lang("Show now"), id:"show", image: "check", default:"true"}, + {text:egw.lang("Show next login"), id:"later", image: "right"}, + {text:egw.lang("No thanks"), id:"never", image: "cancel"} + ]; + et2_dialog.show_dialog(function (_button_id) + { + if (_button_id == "show" ) + { + egw.open_link(egw.link('/index.php', 'menuaction=home.home_tutorial_ui.popup&tuid=introduction-'+egw.preference('lang')+'-0-a'),'_blank','960x580'); + } + if(_button_id != "later") + { + egw.set_preference('common', 'egw_tutorial_noautoload',true); + } + }, + egw.lang('We would like to introduce you to EGroupware by showing a short introduction video.'), + egw.lang('Introduction'), + {}, buttons, et2_dialog.QUESTION_MESSAGE, undefined, egw(window)); + }, this); + } }); }); diff --git a/phpgwapi/js/jsapi/egw_preferences.js b/phpgwapi/js/jsapi/egw_preferences.js index 36c2332c3b..61d5178882 100644 --- a/phpgwapi/js/jsapi/egw_preferences.js +++ b/phpgwapi/js/jsapi/egw_preferences.js @@ -55,18 +55,20 @@ egw.extend('preferences', egw.MODULE_GLOBAL, function() { * * @param {string} _name name of the preference, eg. 'dateformat', or '*' to get all the application's preferences * @param {string} _app default 'common' - * @return string preference value - * @todo add a callback to query it asynchron + * @param {function} _callback optional callback, if preference needs loading first + * @param {object} _context context for callback + * @return string|bool preference value or false, if callback given and preference not yet loaded */ - preference: function(_name, _app) + preference: function(_name, _app, _callback, _context) { if (typeof _app == 'undefined') _app = 'common'; if (typeof prefs[_app] == 'undefined') { - var request = this.json('home.egw_framework.ajax_get_preference.template', [_app]); - request.sendRequest(false, 'GET'); // use synchronous (cachable) GET request + var request = this.json('home.egw_framework.ajax_get_preference.template', [_app], _callback, _context); + request.sendRequest(typeof _callback == 'function', 'GET'); // use synchronous (cachable) GET request if (typeof prefs[_app] == 'undefined') prefs[_app] = {}; + if (typeof _callback == 'function') return false; } if (_name == "*") return typeof prefs[_app] ==='object' ? jQuery.extend({},prefs[_app]) : prefs[_app]; diff --git a/phpgwapi/lang/egw_de.lang b/phpgwapi/lang/egw_de.lang index 2fced1bd79..934b0f6cc5 100644 --- a/phpgwapi/lang/egw_de.lang +++ b/phpgwapi/lang/egw_de.lang @@ -426,6 +426,7 @@ insert in dokument common de In Dokument einfügen insert row after common de Zeile danach einfügen insert row before common de Zeile davor einfügen international common de International +introduction common de Einführung invalid filename common de Ungültiger Dateiname invalid ip address common de Ungültige IP Adresse invalid password common de Ungültiges Passwort @@ -574,6 +575,7 @@ no history for this record common de Keine Historie für diesen Datensatz no key for recipient: common de Keinen Schlüssel für Empfänger: no savant2 template directories were found in: common de Kein Savant2 Vorlagen Verzeichnis gefunden in: no subject common de Kein Betreff +no thanks common de Nein danke none common de Keine none of %1 common de keines von %1 norfolk island common de NORFOLK INSELN @@ -781,6 +783,8 @@ show in sidebox common de In Seitenmenü anzeigen show log of following device groupdav de Zeige Log des folgenden Geräts show logo's on the desktop. common de Logos auf der Arbeitsfläche anzeigen. show menu common de Menü anzeigen +show next login common de Beim nächsten Anmelden +show now common de Jetzt anzeigen show page generation time common de Zeit zum Erstellen der Seite anzeigen show page generation time on the bottom of the page? common de Zeit zum Erstellen der Seite in der Fußzeile anzeigen show page generation time? common de Erstellungszeit der Seite anzeigen? @@ -912,6 +916,7 @@ virgin islands, british common de VIRGIN ISLANDS, BRITISH virgin islands, u.s. common de VIRGIN ISLANDS, U.S. wallis and futuna common de WALLIS AND FUTUNA was not able to delete the backup key because %1 common de Es war nicht möglich das Backup-Schlüssel zu löschen weil... +we would like to introduce you to egroupware by showing a short introduction video. common de Wir möchten Ihnen EGroupware mit einem kurzen Einführungsvideo vorstellen. wednesday common de Mittwoch welcome common de Willkommen western european common de Westeuropäisch diff --git a/phpgwapi/lang/egw_en.lang b/phpgwapi/lang/egw_en.lang index 5d865d1468..d463006e63 100644 --- a/phpgwapi/lang/egw_en.lang +++ b/phpgwapi/lang/egw_en.lang @@ -426,6 +426,7 @@ insert in dokument common en Insert in document insert row after common en Insert row after insert row before common en Insert row before international common en International +introduction common en Introduction invalid filename common en Invalid file name. invalid ip address common en Invalid IP address. invalid password common en Invalid password. @@ -574,6 +575,7 @@ no history for this record common en No history for this record no key for recipient: common en No key for recipient: no savant2 template directories were found in: common en No Savant2 template directories were found in: no subject common en No subject +no thanks common en No thanks none common en None none of %1 common en none of %1 norfolk island common en NORFOLK ISLAND @@ -781,6 +783,8 @@ show in sidebox common en Show in side menu show log of following device groupdav en Show log of following device show logo's on the desktop. common en Show logo on the desktop. show menu common en Show menu +show next login common en Show next login +show now common en Show now show page generation time common en Show page generation time show page generation time on the bottom of the page? common en Show page generation time on the bottom of the page. show page generation time? common en Show page generation time @@ -912,6 +916,7 @@ virgin islands, british common en VIRGIN ISLANDS, BRITISH virgin islands, u.s. common en VIRGIN ISLANDS, U.S. wallis and futuna common en WALLIS AND FUTUNA was not able to delete the backup key because %1 common en Was not able to delete the backup key because %1 +we would like to introduce you to egroupware by showing a short introduction video. common en We would like to introduce you to EGroupware by showing a short introduction video. wednesday common en Wednesday welcome common en Welcome western european common en Western european