diff --git a/src/messenger/webim/js/compiled/chat/model_views/controls/history.js b/src/messenger/webim/js/compiled/chat/model_views/controls/history.js index d6851438..1e64696e 100644 --- a/src/messenger/webim/js/compiled/chat/model_views/controls/history.js +++ b/src/messenger/webim/js/compiled/chat/model_views/controls/history.js @@ -5,4 +5,4 @@ Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -(function(b,d,e){b.Views.HistoryControl=b.Views.Control.extend({template:d.templates.history_control,events:e.extend({},b.Views.Control.prototype.events,{click:"showHistory"}),showHistory:function(){var c=b.Objects.Models.user,a=this.model.get("link");c.get("isAgent")&&a&&(c=this.$el.find(".control-config").eq(0).data("win-params"),a=a.replace("&","&","g"),a=window.open(a,"UserHistory",c),null!==a&&(a.focus(),a.opener=window))}})})(Mibew,Handlebars,_); +(function(b,c,e){b.Views.HistoryControl=b.Views.Control.extend({template:c.templates.history_control,events:e.extend({},b.Views.Control.prototype.events,{click:"showHistory"}),showHistory:function(){var d=b.Objects.Models.user,c=b.Objects.Models.page,a=this.model.get("link");d.get("isAgent")&&a&&(d=c.get("historyWindowParams"),a=a.replace("&","&","g"),a=window.open(a,"UserHistory",d),null!==a&&(a.focus(),a.opener=window))}})})(Mibew,Handlebars,_); diff --git a/src/messenger/webim/js/compiled/chat/model_views/controls/send_mail.js b/src/messenger/webim/js/compiled/chat/model_views/controls/send_mail.js index 7cc9e7e8..8019db8f 100644 --- a/src/messenger/webim/js/compiled/chat/model_views/controls/send_mail.js +++ b/src/messenger/webim/js/compiled/chat/model_views/controls/send_mail.js @@ -5,4 +5,4 @@ Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ -(function(b,c,e){b.Views.SendMailControl=b.Views.Control.extend({template:c.templates.send_mail_control,events:e.extend({},b.Views.Control.prototype.events,{click:"sendMail"}),sendMail:function(){var a=this.model.get("link");if(a){var c=this.$el.find(".control-config").eq(0).data("win-params"),d=b.Objects.Models.page.get("style"),a=a.replace(/\&\;/g,"&")+(d?"&style="+d:""),a=window.open(a,"ForwardMail",c);null!==a&&(a.focus(),a.opener=window)}}})})(Mibew,Handlebars,_); +(function(b,e,f){b.Views.SendMailControl=b.Views.Control.extend({template:e.templates.send_mail_control,events:f.extend({},b.Views.Control.prototype.events,{click:"sendMail"}),sendMail:function(){var a=this.model.get("link"),c=b.Objects.Models.page;if(a){var c=c.get("mailWindowParams"),d=b.Objects.Models.page.get("style"),a=a.replace(/\&\;/g,"&")+(d?"&style="+d:""),a=window.open(a,"ForwardMail",c);null!==a&&(a.focus(),a.opener=window)}}})})(Mibew,Handlebars,_); diff --git a/src/messenger/webim/js/compiled/chat_app.js b/src/messenger/webim/js/compiled/chat_app.js index f455649b..bcbbdb76 100644 --- a/src/messenger/webim/js/compiled/chat_app.js +++ b/src/messenger/webim/js/compiled/chat_app.js @@ -29,12 +29,12 @@ this.add(e)},updateFunctionBuilder:function(){var a=b.Objects.Models.thread,c=b. (function(a,b,c){a.Views.Status=b.Marionette.ItemView.extend({template:c.templates.status,className:"status",modelEvents:{change:"render"},onBeforeRender:function(){this.model.get("visible")?this.$el.show():this.$el.hide()}})})(Mibew,Backbone,Handlebars); (function(a,b,c){a.Views.Avatar=b.Marionette.ItemView.extend({template:c.templates.avatar,className:"avatar",modelEvents:{change:"render"}})})(Mibew,Backbone,Handlebars); (function(a,c,d){a.Views.CloseControl=a.Views.Control.extend({template:c.templates.close_control,events:d.extend({},a.Views.Control.prototype.events,{click:"close"}),close:function(){var b=a.Localization.get("chat.close.confirmation");(!1===b||confirm(b))&&this.model.closeThread()}})})(Mibew,Handlebars,_); -(function(b,d,e){b.Views.HistoryControl=b.Views.Control.extend({template:d.templates.history_control,events:e.extend({},b.Views.Control.prototype.events,{click:"showHistory"}),showHistory:function(){var c=b.Objects.Models.user,a=this.model.get("link");c.get("isAgent")&&a&&(c=this.$el.find(".control-config").eq(0).data("win-params"),a=a.replace("&","&","g"),a=window.open(a,"UserHistory",c),null!==a&&(a.focus(),a.opener=window))}})})(Mibew,Handlebars,_); +(function(b,c,e){b.Views.HistoryControl=b.Views.Control.extend({template:c.templates.history_control,events:e.extend({},b.Views.Control.prototype.events,{click:"showHistory"}),showHistory:function(){var d=b.Objects.Models.user,c=b.Objects.Models.page,a=this.model.get("link");d.get("isAgent")&&a&&(d=c.get("historyWindowParams"),a=a.replace("&","&","g"),a=window.open(a,"UserHistory",d),null!==a&&(a.focus(),a.opener=window))}})})(Mibew,Handlebars,_); (function(a,d,e){a.Views.RedirectControl=a.Views.Control.extend({template:d.templates.redirect_control,events:e.extend({},a.Views.Control.prototype.events,{click:"redirect"}),initialize:function(){a.Objects.Models.user.on("change",this.render,this)},serializeData:function(){var b=this.model.toJSON();b.user=a.Objects.Models.user.toJSON();return b},redirect:function(){var b=a.Objects.Models.user;if(b.get("isAgent")&&b.get("canPost")&&(b=this.model.get("link"))){var c=a.Objects.Models.page.get("style"); window.location.href=b.replace(/\&\;/g,"&")+(c?"&style="+c:"")}}})})(Mibew,Handlebars,_); (function(a,b,c){a.Views.RefreshControl=a.Views.Control.extend({template:b.templates.refresh_control,events:c.extend({},a.Views.Control.prototype.events,{click:"refresh"}),refresh:function(){this.model.refresh()}})})(Mibew,Handlebars,_); (function(a,d,e){a.Views.SecureModeControl=a.Views.Control.extend({template:d.templates.secure_mode_control,events:e.extend({},a.Views.Control.prototype.events,{click:"secure"}),secure:function(){var b=this.model.get("link");if(b){var c=a.Objects.Models.page.get("style");window.location.href=b.replace(/\&\;/g,"&")+(c?"&style="+c:"")}}})})(Mibew,Handlebars,_); -(function(b,c,e){b.Views.SendMailControl=b.Views.Control.extend({template:c.templates.send_mail_control,events:e.extend({},b.Views.Control.prototype.events,{click:"sendMail"}),sendMail:function(){var a=this.model.get("link");if(a){var c=this.$el.find(".control-config").eq(0).data("win-params"),d=b.Objects.Models.page.get("style"),a=a.replace(/\&\;/g,"&")+(d?"&style="+d:""),a=window.open(a,"ForwardMail",c);null!==a&&(a.focus(),a.opener=window)}}})})(Mibew,Handlebars,_); +(function(b,e,f){b.Views.SendMailControl=b.Views.Control.extend({template:e.templates.send_mail_control,events:f.extend({},b.Views.Control.prototype.events,{click:"sendMail"}),sendMail:function(){var a=this.model.get("link"),c=b.Objects.Models.page;if(a){var c=c.get("mailWindowParams"),d=b.Objects.Models.page.get("style"),a=a.replace(/\&\;/g,"&")+(d?"&style="+d:""),a=window.open(a,"ForwardMail",c);null!==a&&(a.focus(),a.opener=window)}}})})(Mibew,Handlebars,_); (function(a,b,c){a.Views.SoundControl=a.Views.Control.extend({template:b.templates.sound_control,events:c.extend({},a.Views.Control.prototype.events,{click:"toggle"}),toggle:function(){this.model.set({enabled:!this.model.get("enabled")})}})})(Mibew,Handlebars,_); (function(b,c,d){b.Views.UserNameControl=b.Views.Control.extend({template:c.templates.user_name_control,events:d.extend({},b.Views.Control.prototype.events,{"click .user-name-control-set":"changeName","click .user-name-control-change":"showNameInput","keydown #user-name-control-input":"inputKeyDown"}),ui:{nameInput:"#user-name-control-input"},initialize:function(){b.Objects.Models.user.on("change:name",this.hideNameInput,this);this.nameInput=b.Objects.Models.user.get("defaultName")},serializeData:function(){var a= this.model.toJSON();a.user=b.Objects.Models.user.toJSON();a.nameInput=this.nameInput;return a},inputKeyDown:function(a){a=a.which;(13==a||10==a)&&this.changeName()},hideNameInput:function(){this.nameInput=!1;this.render()},showNameInput:function(){this.nameInput=!0;this.render()},changeName:function(){var a=this.ui.nameInput.val();this.model.changeName(a)}})})(Mibew,Handlebars,_); diff --git a/src/messenger/webim/js/source/chat/model_views/controls/history.js b/src/messenger/webim/js/source/chat/model_views/controls/history.js index 9ddf5b7a..b0f5c9a2 100644 --- a/src/messenger/webim/js/source/chat/model_views/controls/history.js +++ b/src/messenger/webim/js/source/chat/model_views/controls/history.js @@ -39,13 +39,10 @@ */ showHistory: function() { var user = Mibew.Objects.Models.user; + var page = Mibew.Objects.Models.page; var link = this.model.get('link'); if (user.get('isAgent') && link) { - // TODO: Create wiki docs for it - var winParams = this.$el - .find('.control-config') - .eq(0) - .data('win-params'); + var winParams = page.get('historyWindowParams'); // TODO: Kill & at the server side link = link.replace('&', '&', 'g'); diff --git a/src/messenger/webim/js/source/chat/model_views/controls/send_mail.js b/src/messenger/webim/js/source/chat/model_views/controls/send_mail.js index eb3f21f4..11c2ae4b 100644 --- a/src/messenger/webim/js/source/chat/model_views/controls/send_mail.js +++ b/src/messenger/webim/js/source/chat/model_views/controls/send_mail.js @@ -38,13 +38,10 @@ * Load and display send mail window */ sendMail: function() { - var link = this.model.get('link') + var link = this.model.get('link'); + var page = Mibew.Objects.Models.page; if (link) { - // TODO: Create wiki docs for it - var winParams = this.$el - .find('.control-config') - .eq(0) - .data('win-params'); + var winParams = page.get('mailWindowParams'); var style = Mibew.Objects.Models.page.get('style'); diff --git a/src/messenger/webim/libs/chat.php b/src/messenger/webim/libs/chat.php index 09d2705e..66f16768 100644 --- a/src/messenger/webim/libs/chat.php +++ b/src/messenger/webim/libs/chat.php @@ -267,6 +267,15 @@ function setup_chatview_for_user($thread, $level) $page['neediframesrc'] = needsFramesrc(); $page['frequency'] = Settings::get('updatefrequency_chat'); + + // Load dialogs style options + $style_config = get_dialogs_style_config(getchatstyle()); + $page['chatStyles.chatWindowParams'] = $style_config['chat']['window_params']; + $page['chatStyles.mailWindowParams'] = $style_config['mail']['window_params']; + + // Load core style options + $style_config = get_core_style_config(); + $page['coreStyles.historyWindowParams'] = $style_config['history']['window_params']; } function setup_chatview_for_operator($thread, $operator) @@ -334,6 +343,15 @@ function setup_chatview_for_operator($thread, $operator) $page['namePostfix'] = ""; $page['frequency'] = Settings::get('updatefrequency_chat'); + + // Load dialogs style options + $style_config = get_dialogs_style_config(getchatstyle()); + $page['chatStyles.chatWindowParams'] = $style_config['chat']['window_params']; + $page['chatStyles.mailWindowParams'] = $style_config['mail']['window_params']; + + // Load core style options + $style_config = get_core_style_config(); + $page['coreStyles.historyWindowParams'] = $style_config['history']['window_params']; } function ban_for_addr($addr) diff --git a/src/messenger/webim/libs/common/configurations.php b/src/messenger/webim/libs/common/configurations.php new file mode 100644 index 00000000..c0d0a89e --- /dev/null +++ b/src/messenger/webim/libs/common/configurations.php @@ -0,0 +1,82 @@ + array( + 'window_params' => '' + ) + ); + + return $config; +} + +/** + * Load configuration array for dialogs style + * + * @param string $style Style name + * @return array Configuration array + */ +function get_dialogs_style_config($style) { + // Get root dir of mibew messanger + $base_path = realpath(dirname(__FILE__) . '/../../'); + + // Load config + $config = read_config_file($base_path.'/styles/dialogs/'.$style.'/config.ini'); + + // Set default values + $config = ($config === false) ? array() : $config; + $config += array( + 'chat' => array( + 'window_params' => '' + ), + 'mail' => array( + 'window_params' => '' + ) + ); + + return $config; +} + +?> \ No newline at end of file diff --git a/src/messenger/webim/libs/init.php b/src/messenger/webim/libs/init.php index 37f6bf76..61f645db 100644 --- a/src/messenger/webim/libs/init.php +++ b/src/messenger/webim/libs/init.php @@ -29,6 +29,7 @@ require_once(dirname(__FILE__) . '/classes/plugin_manager.php'); require_once(dirname(__FILE__) . '/classes/plugin.php'); // Include common libs +require_once(dirname(__FILE__) . '/common/configurations.php'); require_once(dirname(__FILE__) . '/common/constants.php'); require_once(dirname(__FILE__) . '/common/csrf.php'); require_once(dirname(__FILE__) . '/common/datetime.php'); diff --git a/src/messenger/webim/styles/dialogs/silver/chat.css b/src/messenger/webim/styles/dialogs/silver/chat.css index 649759cf..86d33492 100644 --- a/src/messenger/webim/styles/dialogs/silver/chat.css +++ b/src/messenger/webim/styles/dialogs/silver/chat.css @@ -105,9 +105,6 @@ img { cursor: pointer; float: right; } -.control-config { - display: none; -} .tpl-image { width: 16px; height: 16px; diff --git a/src/messenger/webim/styles/dialogs/silver/config.ini b/src/messenger/webim/styles/dialogs/silver/config.ini new file mode 100644 index 00000000..f8a255e8 --- /dev/null +++ b/src/messenger/webim/styles/dialogs/silver/config.ini @@ -0,0 +1,10 @@ +; This file determines some dialog styles options +; Comments starts with ';' + +[chat] +; window_param use as param string in JavaScript window.open method +window_params = "toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width=640,height=480,resizable=1" + +[mail] +; window_param use as param string in JavaScript window.open method +window_params = "toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width=603,height=254,resizable=0" \ No newline at end of file diff --git a/src/messenger/webim/styles/dialogs/silver/handlebars_templates/history_control.handlebars b/src/messenger/webim/styles/dialogs/silver/handlebars_templates/history_control.handlebars index 8ff29829..ee01aa8d 100644 --- a/src/messenger/webim/styles/dialogs/silver/handlebars_templates/history_control.handlebars +++ b/src/messenger/webim/styles/dialogs/silver/handlebars_templates/history_control.handlebars @@ -1,3 +1 @@ -
-{{! Use div with ".control-config" class and its data-* attributes to pass data to the JavaScript app}} - \ No newline at end of file + \ No newline at end of file diff --git a/src/messenger/webim/styles/dialogs/silver/handlebars_templates/send_mail_control.handlebars b/src/messenger/webim/styles/dialogs/silver/handlebars_templates/send_mail_control.handlebars index d7e199c3..ad823d5d 100644 --- a/src/messenger/webim/styles/dialogs/silver/handlebars_templates/send_mail_control.handlebars +++ b/src/messenger/webim/styles/dialogs/silver/handlebars_templates/send_mail_control.handlebars @@ -1,3 +1 @@ - -{{! Use div with ".control-config" class and its data-* attributes to pass data to the JavaScript app}} - \ No newline at end of file + \ No newline at end of file diff --git a/src/messenger/webim/styles/dialogs/silver/js/compiled/templates.js b/src/messenger/webim/styles/dialogs/silver/js/compiled/templates.js index b1667243..a725ca24 100644 --- a/src/messenger/webim/styles/dialogs/silver/js/compiled/templates.js +++ b/src/messenger/webim/styles/dialogs/silver/js/compiled/templates.js @@ -1 +1 @@ -(function(){var a=Handlebars.template,b=Handlebars.templates=Handlebars.templates||{};b.sound_control=a(function(a,b,c,d,e){function j(a,b){var d="",e,f;return d+='\n \n',d}function k(a,b){var d="",e,f;return d+='\n \n',d}c=c||a.helpers;var f,g=c.helperMissing,h=this.escapeExpression,i=this;return f=b.enabled,f=c["if"].call(b,f,{hash:{},inverse:i.program(3,k,e),fn:i.program(1,j,e)}),f||f===0?f:""}),b.user_name_control=a(function(a,b,c,d,e){function k(a,b){var d="",e,f;d+='\n ',f=c.L10n,e=f?f.call(a,"chat.client.name",{hash:{}}):i.call(a,"L10n","chat.client.name",{hash:{}}),d+=h(e)+"\n ",e=a.nameInput,e=c["if"].call(a,e,{hash:{},inverse:j.program(4,m,b),fn:j.program(2,l,b)});if(e||e===0)d+=e;return d+="\n",d}function l(a,b){var d="",e,f;return d+='\n \n \n ',d}function m(a,b){var d="",e,f;return d+='\n ',e=a.user,e=e==null||e===!1?e:e.name,e=typeof e===g?e():e,d+=h(e)+'\n \n ',d}function n(a,b){var d="",e,f;return d+="\n",f=c.L10n,e=f?f.call(a,"chat.client.name",{hash:{}}):i.call(a,"L10n","chat.client.name",{hash:{}}),d+=h(e)+" ",e=a.user,e=e==null||e===!1?e:e.name,e=typeof e===g?e():e,d+=h(e)+"\n",d}c=c||a.helpers;var f,g="function",h=this.escapeExpression,i=c.helperMissing,j=this;return f=b.user,f=f==null||f===!1?f:f.canChangeName,f=c["if"].call(b,f,{hash:{},inverse:j.program(6,n,e),fn:j.program(1,k,e)}),f||f===0?f:""}),b.status=a(function(a,b,c,d,e){c=c||a.helpers;var f,g,h="function",i=this.escapeExpression;return g=c.title,g?f=g.call(b,{hash:{}}):(f=b.title,f=typeof f===h?f():f),i(f)}),b.status_typing=a(function(a,b,c,d,e){c=c||a.helpers;var f,g,h=c.helperMissing,i=this.escapeExpression;return g=c.L10n,f=g?g.call(b,"typing.remote",{hash:{}}):h.call(b,"L10n","typing.remote",{hash:{}}),i(f)}),b.status_message=a(function(a,b,c,d,e){c=c||a.helpers;var f,g,h="function",i=this.escapeExpression;return g=c.message,g?f=g.call(b,{hash:{}}):(f=b.message,f=typeof f===h?f():f),i(f)}),b.sound=a(function(a,b,c,d,e){function j(a,b){var d="",e,f;return d+='\n\n',d}c=c||a.helpers;var f,g="function",h=this.escapeExpression,i=this;return f=b.file,f=c["if"].call(b,f,{hash:{},inverse:i.noop,fn:i.program(1,j,e)}),f||f===0?f:""}),b.close_control=a(function(a,b,c,d,e){c=c||a.helpers;var f="",g,h,i=c.helperMissing,j=this.escapeExpression;return f+='',f}),b.avatar=a(function(a,b,c,d,e){function j(a,b){var d="",e,f;return d+='',d}function k(a,b){return''}c=c||a.helpers;var f,g="function",h=this.escapeExpression,i=this;return f=b.imageLink,f=c["if"].call(b,f,{hash:{},inverse:i.program(3,k,e),fn:i.program(1,j,e)}),f||f===0?f:""}),b.refresh_control=a(function(a,b,c,d,e){c=c||a.helpers;var f="",g,h,i=c.helperMissing,j=this.escapeExpression;return f+='',f}),b.history_control=a(function(a,b,c,d,e){c=c||a.helpers;var f="",g,h,i=c.helperMissing,j=this.escapeExpression;return f+='\n',f+='\n',f}),b.send_mail_control=a(function(a,b,c,d,e){c=c||a.helpers;var f="",g,h,i=c.helperMissing,j=this.escapeExpression;return f+='\n',f+='\n',f}),b.secure_mode_control=a(function(a,b,c,d,e){return c=c||a.helpers,''}),b.redirect_control=a(function(a,b,c,d,e){function j(a,b){var d="",e,f;return d+='\n\n',d}c=c||a.helpers;var f,g=c.helperMissing,h=this.escapeExpression,i=this;return f=b.user,f=f==null||f===!1?f:f.canPost,f=c["if"].call(b,f,{hash:{},inverse:i.noop,fn:i.program(1,j,e)}),f||f===0?f:""}),b.message_form=a(function(a,b,c,d,e){function l(a,b){return'\n