diff --git a/config/config.inc.php b/config/config.inc.php index d4c40981..808b89c2 100644 --- a/config/config.inc.php +++ b/config/config.inc.php @@ -6,5 +6,5 @@ $currentPath = getcwd(); chdir(dirname(__FILE__) . '/../../../../../'); include_once('include/ConfigUtils.php'); -include_once('config/modules/OSSMail.php'); +$config = \App\Config::module('OSSMail'); chdir($currentPath); diff --git a/plugins/ical_attachments/ical_attachments.php b/plugins/ical_attachments/ical_attachments.php deleted file mode 100644 index bd1c6aa7..00000000 --- a/plugins/ical_attachments/ical_attachments.php +++ /dev/null @@ -1,86 +0,0 @@ -action == 'show' || $rcmail->action == 'preview') { - $this->add_hook('message_load', array($this, 'message_load')); - $this->add_hook('template_object_messageattachments', array($this, 'html_output')); - } - } - - /** - * Check message bodies and attachments for ical - */ - function message_load($p) - { - $this->message = $p['object']; - - // handle attachments vcard attachments - foreach ((array) $this->message->attachments as $attachment) { - if ($this->is_ics($attachment)) { - $this->ics_parts[] = array('part' => $attachment->mime_id, 'uid' => $this->message->uid); - } - } - // the same with message bodies - foreach ((array) $this->message->parts as $part) { - if ($this->is_ics($part)) { - $this->ics_parts[] = array('part' => $attachment->mime_id, 'uid' => $this->message->uid); - $this->ics_bodies[] = $part->mime_id; - } - } - if ($this->ics_parts) - $this->add_texts('localization'); - } - - /** - * This callback function adds a box below the message content - * if there is a vcard attachment available - */ - function html_output($p) - { - $attach_script = false; - - foreach ($this->ics_parts as $part) { - $icscontent = $this->message->get_part_content($part['part'], null, true); - $file_name = $part['uid']; - $file = '../../../cache/import/' . $file_name . '.ics'; - file_put_contents($file, $icscontent); - - // add box below message body - $p['content'] .= html::p(array('class' => 'icalattachments'), html::a(array( - 'href' => "javascript:void", - 'onclick' => "return rcmail.command('yetiforce.importICS',$file_name,this,event)", - 'title' => $this->gettext('addicalinvitemsg'), - ), html::span(null, rcube::Q($this->gettext('addicalinvitemsg'))) - ) - ); - $attach_script = true; - } - if ($attach_script) { - $this->include_stylesheet($this->local_skin_path() . '/style.css'); - } - return $p; - } - - function is_ics($part) - { - //return ( $part->mimetype == 'application/ics' || $part->mimetype == 'text/calendar' ); - return ( $part->mimetype == 'application/ics' ); - } -} diff --git a/plugins/ical_attachments/localization/ar.inc b/plugins/ical_attachments/localization/ar.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/ar.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/ar_SA.inc b/plugins/ical_attachments/localization/ar_SA.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/ar_SA.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/az_AZ.inc b/plugins/ical_attachments/localization/az_AZ.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/az_AZ.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/be_BE.inc b/plugins/ical_attachments/localization/be_BE.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/be_BE.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/bg_BG.inc b/plugins/ical_attachments/localization/bg_BG.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/bg_BG.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/bs_BA.inc b/plugins/ical_attachments/localization/bs_BA.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/bs_BA.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/ca_ES.inc b/plugins/ical_attachments/localization/ca_ES.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/ca_ES.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/cs_CZ.inc b/plugins/ical_attachments/localization/cs_CZ.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/cs_CZ.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/cy_GB.inc b/plugins/ical_attachments/localization/cy_GB.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/cy_GB.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/da_DK.inc b/plugins/ical_attachments/localization/da_DK.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/da_DK.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/de_CH.inc b/plugins/ical_attachments/localization/de_CH.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/de_CH.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/de_DE.inc b/plugins/ical_attachments/localization/de_DE.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/de_DE.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/el_GR.inc b/plugins/ical_attachments/localization/el_GR.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/el_GR.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/en_CA.inc b/plugins/ical_attachments/localization/en_CA.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/en_CA.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/en_GB.inc b/plugins/ical_attachments/localization/en_GB.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/en_GB.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/en_US.inc b/plugins/ical_attachments/localization/en_US.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/en_US.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/eo.inc b/plugins/ical_attachments/localization/eo.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/eo.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/es_419.inc b/plugins/ical_attachments/localization/es_419.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/es_419.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/es_AR.inc b/plugins/ical_attachments/localization/es_AR.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/es_AR.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/es_ES.inc b/plugins/ical_attachments/localization/es_ES.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/es_ES.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/et_EE.inc b/plugins/ical_attachments/localization/et_EE.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/et_EE.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/eu_ES.inc b/plugins/ical_attachments/localization/eu_ES.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/eu_ES.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/fa_IR.inc b/plugins/ical_attachments/localization/fa_IR.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/fa_IR.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/fi_FI.inc b/plugins/ical_attachments/localization/fi_FI.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/fi_FI.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/fo_FO.inc b/plugins/ical_attachments/localization/fo_FO.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/fo_FO.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/fr_FR.inc b/plugins/ical_attachments/localization/fr_FR.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/fr_FR.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/gl_ES.inc b/plugins/ical_attachments/localization/gl_ES.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/gl_ES.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/he_IL.inc b/plugins/ical_attachments/localization/he_IL.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/he_IL.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/hr_HR.inc b/plugins/ical_attachments/localization/hr_HR.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/hr_HR.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/hu_HU.inc b/plugins/ical_attachments/localization/hu_HU.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/hu_HU.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/hy_AM.inc b/plugins/ical_attachments/localization/hy_AM.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/hy_AM.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/id_ID.inc b/plugins/ical_attachments/localization/id_ID.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/id_ID.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/it_IT.inc b/plugins/ical_attachments/localization/it_IT.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/it_IT.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/ja_JP.inc b/plugins/ical_attachments/localization/ja_JP.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/ja_JP.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/km_KH.inc b/plugins/ical_attachments/localization/km_KH.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/km_KH.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/ko_KR.inc b/plugins/ical_attachments/localization/ko_KR.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/ko_KR.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/lb_LU.inc b/plugins/ical_attachments/localization/lb_LU.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/lb_LU.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/lt_LT.inc b/plugins/ical_attachments/localization/lt_LT.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/lt_LT.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/lv_LV.inc b/plugins/ical_attachments/localization/lv_LV.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/lv_LV.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/ml_IN.inc b/plugins/ical_attachments/localization/ml_IN.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/ml_IN.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/mr_IN.inc b/plugins/ical_attachments/localization/mr_IN.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/mr_IN.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/nb_NO.inc b/plugins/ical_attachments/localization/nb_NO.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/nb_NO.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/nl_NL.inc b/plugins/ical_attachments/localization/nl_NL.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/nl_NL.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/nn_NO.inc b/plugins/ical_attachments/localization/nn_NO.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/nn_NO.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/pl_PL.inc b/plugins/ical_attachments/localization/pl_PL.inc deleted file mode 100644 index 8ff8fa57..00000000 --- a/plugins/ical_attachments/localization/pl_PL.inc +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/pt_BR.inc b/plugins/ical_attachments/localization/pt_BR.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/pt_BR.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/pt_PT.inc b/plugins/ical_attachments/localization/pt_PT.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/pt_PT.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/ro_RO.inc b/plugins/ical_attachments/localization/ro_RO.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/ro_RO.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/ru_RU.inc b/plugins/ical_attachments/localization/ru_RU.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/ru_RU.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/si_LK.inc b/plugins/ical_attachments/localization/si_LK.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/si_LK.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/sk_SK.inc b/plugins/ical_attachments/localization/sk_SK.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/sk_SK.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/sl_SI.inc b/plugins/ical_attachments/localization/sl_SI.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/sl_SI.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/sr_CS.inc b/plugins/ical_attachments/localization/sr_CS.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/sr_CS.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/sv_SE.inc b/plugins/ical_attachments/localization/sv_SE.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/sv_SE.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/tr_TR.inc b/plugins/ical_attachments/localization/tr_TR.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/tr_TR.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/uk_UA.inc b/plugins/ical_attachments/localization/uk_UA.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/uk_UA.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/vi_VN.inc b/plugins/ical_attachments/localization/vi_VN.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/vi_VN.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/zh_CN.inc b/plugins/ical_attachments/localization/zh_CN.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/zh_CN.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/localization/zh_TW.inc b/plugins/ical_attachments/localization/zh_TW.inc deleted file mode 100644 index 390ade57..00000000 --- a/plugins/ical_attachments/localization/zh_TW.inc +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/plugins/ical_attachments/skins/larry/ical_add_invite.png b/plugins/ical_attachments/skins/larry/ical_add_invite.png deleted file mode 100644 index 5b902455..00000000 Binary files a/plugins/ical_attachments/skins/larry/ical_add_invite.png and /dev/null differ diff --git a/plugins/ical_attachments/skins/larry/style.css b/plugins/ical_attachments/skins/larry/style.css deleted file mode 100644 index 1bb34e3c..00000000 --- a/plugins/ical_attachments/skins/larry/style.css +++ /dev/null @@ -1,18 +0,0 @@ -p.icalattachments { - width: auto; - background: #f9f9f9; - border: 1px solid #d3d3d3; - border-radius:4px; - -moz-border-radius: 4px; - -webkit-border-radius: 4px; - border-radius: 4px; - box-shadow: 0 0 2px #ccc; - -o-box-shadow: 0 0 2px #ccc; - -webkit-box-shadow: 0 0 2px #ccc; - -moz-box-shadow: 0 0 2px #ccc; -} -p.icalattachments a { - display: block; - background: url(ical_add_invite.png) 8px 5px no-repeat; - padding: 1.0em 0.5em 0.7em 46px; -} \ No newline at end of file diff --git a/plugins/ical_attachments/skins/larry/style.min.css b/plugins/ical_attachments/skins/larry/style.min.css deleted file mode 100644 index bad47463..00000000 --- a/plugins/ical_attachments/skins/larry/style.min.css +++ /dev/null @@ -1 +0,0 @@ -p.icalattachments{width:auto;background:#f9f9f9;border:1px solid #d3d3d3;border-radius:4px;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;box-shadow:0 0 2px #ccc;-o-box-shadow:0 0 2px #ccc;-webkit-box-shadow:0 0 2px #ccc;-moz-box-shadow:0 0 2px #ccc}p.icalattachments a{display:block;background:url(ical_add_invite.png) 8px 5px no-repeat;padding:1.0em .5em .7em 46px} diff --git a/plugins/identity_smtp/LICENSE b/plugins/identity_smtp/LICENSE new file mode 100644 index 00000000..85406d54 --- /dev/null +++ b/plugins/identity_smtp/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014 + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/plugins/identity_smtp/identity_smtp.js b/plugins/identity_smtp/identity_smtp.js index e2f92d57..22a09dab 100644 --- a/plugins/identity_smtp/identity_smtp.js +++ b/plugins/identity_smtp/identity_smtp.js @@ -17,6 +17,6 @@ function identity_smtp_toggle_standard_server() { if (checkbox.is(':checked')) { $('.identity_smtp_form').prop('disabled', true); } else { - $('.identity_smtp_form').removeProp('disabled'); + $('.identity_smtp_form').prop('disabled', false); } } diff --git a/plugins/identity_smtp/identity_smtp.php b/plugins/identity_smtp/identity_smtp.php index 65e45a1c..cc75f774 100644 --- a/plugins/identity_smtp/identity_smtp.php +++ b/plugins/identity_smtp/identity_smtp.php @@ -15,191 +15,242 @@ class identity_smtp extends rcube_plugin { - public $task = 'mail|settings'; - private $from_identity; - - function init() - { - $this->include_script('identity_smtp.js'); - $this->add_texts('localization/', true); - - $this->add_hook('message_outgoing_headers', array($this, 'messageOutgoingHeaders')); - $this->add_hook('smtp_connect', array($this, 'smtpWillConnect')); - $this->add_hook('identity_form', array($this, 'identityFormWillBeDisplayed')); - $this->add_hook('identity_create', array($this, 'identityWasCreated')); - $this->add_hook('identity_update', array($this, 'identityWasUpdated')); - $this->add_hook('identity_delete', array($this, 'identityWasDeleted')); - $this->add_hook('template_object_identityform', array($this, 'template_object_identityform')); - } - - function smtpLog($message) - { - write_log("identity_smtp_plugin", $message); - } - - function saveSmtpSettings($args) - { - $identities = rcmail::get_instance()->config->get('identity_smtp'); - $id = intval($args['id']); - - if (!isset($identities)) - { - $identities = array(); - } - - $smtp_standard = get_input_value('_smtp_standard', RCUBE_INPUT_POST); - - $password = get_input_value('_smtp_pass', RCUBE_INPUT_POST); - - if ($password != $identities[$id]['smtp_pass']) { - $password = rcmail::get_instance()->encrypt($password); - } - - $smtpSettingsRecord = array( - 'smtp_standard' => isset($smtp_standard), - 'smtp_server' => get_input_value('_smtp_server', RCUBE_INPUT_POST), - 'smtp_port' => get_input_value('_smtp_port', RCUBE_INPUT_POST), - 'smtp_user' => get_input_value('_smtp_user', RCUBE_INPUT_POST), - 'smtp_pass' => $password - ); - - unset($identities[$id]); - $identities += array( $id => $smtpSettingsRecord ); - - rcmail::get_instance()->user->save_prefs(array('identity_smtp' => $identities)); - } - - function loadSmtpSettings($args) - { - $smtpSettings = rcmail::get_instance()->config->get('identity_smtp'); - $id = intval($args['identity_id']); - $smtpSettingsRecord = array( - 'smtp_standard' => $smtpSettings[$id]['smtp_standard'], - 'smtp_server' => $smtpSettings[$id]['smtp_server'], - 'smtp_port' => $smtpSettings[$id]['smtp_port'], - 'smtp_user' => $smtpSettings[$id]['smtp_user'], - 'smtp_pass' => $smtpSettings[$id]['smtp_pass'] - ); - - if (is_null($smtpSettingsRecord['smtp_standard'])) { - $smtpSettingsRecord['smtp_standard'] = true; - } - - return $smtpSettingsRecord; - } - - function identityFormWillBeDisplayed($args) - { - $form = $args['form']; - $record = $args['record']; - - # Load the stored smtp settings - $smtpSettingsRecord = $this->loadSmtpSettings($record); - - if (!isset($record['identity_id'])) - { - # FIX ME - $smtpSettingsForm = array('smtpSettings' => array( - 'name' => $this->gettext('smtp_settings_header'), - 'content' => array( - 'text' => array('label' => $this->gettext('smtp_settings_not_available'), 'value' => ' ') - ) - )); - } else { - $smtpSettingsForm = array('smtpSettings' => array( - 'name' => $this->gettext('smtp_settings_header'), - 'content' => array( - 'smtp_standard' => array('type' => 'checkbox', - 'label' => $this->gettext('use_default_smtp_server'), - 'onclick' => 'identity_smtp_toggle_standard_server()' - ), - 'smtp_server' => array('type' => 'text', - 'label' => $this->gettext('smtp_server'), - 'class' => 'identity_smtp_form'), - 'smtp_port' => array('type' => 'text', - 'label' => $this->gettext('smtp_port'), - 'class' => 'identity_smtp_form'), - 'smtp_user' => array('type' => 'text', - 'label' => $this->gettext('smtp_user'), - 'class' => 'identity_smtp_form'), - 'smtp_pass' => array('type' => 'password', - 'label' => $this->gettext('smtp_pass'), - 'class' => 'identity_smtp_form') - ) - )); - if ($smtpSettingsRecord['smtp_standard'] || is_null($smtpSettingsRecord['smtp_standard'])) { - foreach ($smtpSettingsForm['smtpSettings']['content'] as &$input) { - if ($input['type'] != 'checkbox') { - $input['disabled'] = 'disabled'; - } - } - } - } - - $form = $form + $smtpSettingsForm; - $record = $record + $smtpSettingsRecord; - - $OUTPUT = array('form' => $form, - 'record' => $record); - return $OUTPUT; - } - - # This function is called when a new identity is created. We want to use the default smtp server here - function identityWasCreated($args) - { - $this->saveSmtpSettings($args); - return $args; - } - - # This function is called when the users saves a changed identity. It is responsible for saving the smtp settings - function identityWasUpdated($args) - { - $this->saveSmtpSettings($args); - return $args; - } - - function identityWasDeleted($args) - { - $smtpSettings = rcmail::get_instance()->config->get('identity_smtp'); - $id = $args['id']; - unset($smtpSettings[$id]); - rcmail::get_instance()->user->save_prefs(array('identity_smtp' => $smtpSettings)); - - # Return false to not abort the deletion of the identity - return false; - } - - function messageOutgoingHeaders($args) - { - $identities = rcmail::get_instance()->user->list_identities(); - foreach ($identities as $idx => $ident) { - if ($identities[$idx]['email'] == $args['headers']['X-Sender']) { - $this->from_identity = $identities[$idx]['identity_id']; - } - } - - return $args; - } - - # This function is called when an email is sent and it should pull the correct smtp settings for the used identity and insert them - function smtpWillConnect($args) - { - $smtpSettings = $this->loadSmtpSettings(array('identity_id' => $this->from_identity)); - if (!$smtpSettings['smtp_standard'] && !is_null($smtpSettings['smtp_standard'])) { - $args['smtp_server'] = $smtpSettings['smtp_server']; - $args['smtp_port'] = $smtpSettings['smtp_port']; - $args['smtp_user'] = $smtpSettings['smtp_user']; - $args['smtp_pass'] = rcmail::get_instance()->decrypt($smtpSettings['smtp_pass']); - } - return $args; - } - - # Ugly hack to make the password field a password field... - # FIX ME: Open a bug at trac.roundcube.net - function template_object_identityform($args) - { - $args['content'] = preg_replace('##', '' , $args['content']); - return $args; - } + public $task = 'mail|settings'; + private $from_identity; + + function init() + { + $this->include_script('identity_smtp.js'); + $this->add_texts('localization/', true); + + $this->add_hook('message_before_send', array( + $this, + 'messageBeforeSend' + )); + $this->add_hook('smtp_connect', array( + $this, + 'smtpWillConnect' + )); + $this->add_hook('identity_form', array( + $this, + 'identityFormWillBeDisplayed' + )); + $this->add_hook('identity_create', array( + $this, + 'identityWasCreated' + )); + $this->add_hook('identity_update', array( + $this, + 'identityWasUpdated' + )); + $this->add_hook('identity_delete', array( + $this, + 'identityWasDeleted' + )); + } + + function smtpLog($message) + { + rcube::write_log("identity_smtp_plugin", $message); + } + + function saveSmtpSettings($args) + { + $identities = rcmail::get_instance()->config->get('identity_smtp'); + $id = intval($args['id']); + + if (!isset($identities)) { + $identities = array(); + } + + $smtp_standard = rcube_utils::get_input_value('_smtp_standard', rcube_utils::INPUT_POST); + + $password = rcube_utils::get_input_value('_smtp_pass', rcube_utils::INPUT_POST, true); + $password2 = rcube_utils::get_input_value('_smtp_pass2', rcube_utils::INPUT_POST, true); + + if ($password != $password2) { + $args['abort'] = true; + $args['result'] = false; + $args['message'] = $this->gettext('smtp_passwords_mismatch'); + return $args; + } + + if ($password != $identities[$id]['smtp_pass']) { + $password = rcmail::get_instance()->encrypt($password); + } + + $smtpSettingsRecord = array( + 'smtp_standard' => isset($smtp_standard), + 'smtp_server' => rcube_utils::get_input_value('_smtp_server', rcube_utils::INPUT_POST), + 'smtp_port' => rcube_utils::get_input_value('_smtp_port', rcube_utils::INPUT_POST), + 'smtp_user' => rcube_utils::get_input_value('_smtp_user', rcube_utils::INPUT_POST), + 'smtp_pass' => $password + ); + + unset($identities[$id]); + $identities += array( + $id => $smtpSettingsRecord + ); + rcmail::get_instance()->user->save_prefs(array( + 'identity_smtp' => $identities + )); + + return $args; + } + + function loadSmtpSettings($args) + { + $smtpSettings = rcmail::get_instance()->config->get('identity_smtp'); + $id = intval($args['identity_id']); + $smtpSettingsRecord = array( + 'smtp_standard' => $smtpSettings[$id]['smtp_standard'], + 'smtp_server' => $smtpSettings[$id]['smtp_server'], + 'smtp_port' => $smtpSettings[$id]['smtp_port'], + 'smtp_user' => $smtpSettings[$id]['smtp_user'], + 'smtp_pass' => $smtpSettings[$id]['smtp_pass'], + 'smtp_pass2' => $smtpSettings[$id]['smtp_pass'] + ); + + if (is_null($smtpSettingsRecord['smtp_standard'])) { + $smtpSettingsRecord['smtp_standard'] = true; + } + + return $smtpSettingsRecord; + } + + function identityFormWillBeDisplayed($args) + { + $form = $args['form']; + $record = $args['record']; + + // Load the stored smtp settings + $smtpSettingsRecord = $this->loadSmtpSettings($record); + + if (!isset($record['identity_id'])) { + // FIX ME + $smtpSettingsForm = array( + 'smtpSettings' => array( + 'name' => $this->gettext('smtp_settings_header'), + 'content' => array( + 'text' => array( + 'label' => $this->gettext('smtp_settings_not_available'), + 'value' => ' ' + ) + ) + ) + ); + } else { + $smtpSettingsForm = array( + 'smtpSettings' => array( + 'name' => $this->gettext('smtp_settings_header'), + 'content' => array( + 'smtp_standard' => array( + 'type' => 'checkbox', + 'label' => $this->gettext('use_default_smtp_server'), + 'onclick' => 'identity_smtp_toggle_standard_server()' + ), + 'smtp_server' => array( + 'type' => 'text', + 'label' => $this->gettext('smtp_server'), + 'class' => 'identity_smtp_form', + 'size' => 40 + ), + 'smtp_port' => array( + 'type' => 'text', + 'label' => $this->gettext('smtp_port'), + 'class' => 'identity_smtp_form' + ), + 'smtp_user' => array( + 'type' => 'text', + 'label' => $this->gettext('smtp_user'), + 'class' => 'identity_smtp_form', + 'size' => 40 + ), + 'smtp_pass' => array( + 'type' => 'password', + 'label' => $this->gettext('smtp_pass'), + 'class' => 'identity_smtp_form', + 'size' => 40 + ), + 'smtp_pass2' => array( + 'type' => 'password', + 'label' => $this->gettext('smtp_pass2'), + 'class' => 'identity_smtp_form', + 'placeholder' => 'test', + 'size' => 40 + ) + ) + ) + ); + if ($smtpSettingsRecord['smtp_standard'] || is_null($smtpSettingsRecord['smtp_standard'])) { + foreach ($smtpSettingsForm['smtpSettings']['content'] as &$input) { + if ($input['type'] != 'checkbox') { + $input['disabled'] = 'disabled'; + } + } + } + } + $form = $form + $smtpSettingsForm; + $record = $record + $smtpSettingsRecord; + + $OUTPUT = array( + 'form' => $form, + 'record' => $record + ); + return $OUTPUT; + } + + // This function is called when a new identity is created. We want to use the default smtp server here + function identityWasCreated($args) + { + $args = $this->saveSmtpSettings($args); + return $args; + } + + // This function is called when the users saves a changed identity. It is responsible for saving the smtp settings + function identityWasUpdated($args) + { + $args = $this->saveSmtpSettings($args); + return $args; + } + + function identityWasDeleted($args) + { + $smtpSettings = rcmail::get_instance()->config->get('identity_smtp'); + $id = $args['id']; + unset($smtpSettings[$id]); + rcmail::get_instance()->user->save_prefs(array( + 'identity_smtp' => $smtpSettings + )); + + // Return false to not abort the deletion of the identity + return false; + } + + function messageBeforeSend($args) + { + $identities = rcmail::get_instance()->user->list_identities(); + foreach ($identities as $idx => $ident) { + if ($identities[$idx]['email'] == $args['from']) { + $this->from_identity = $identities[$idx]['identity_id']; + } + } + return $args; + } + + // This function is called when an email is sent and it should pull the correct smtp settings for the used identity and insert them + function smtpWillConnect($args) + { + $smtpSettings = $this->loadSmtpSettings(array( + 'identity_id' => $this->from_identity + )); + if (!$smtpSettings['smtp_standard'] && !is_null($smtpSettings['smtp_standard'])) { + $args['smtp_server'] = $smtpSettings['smtp_server']; + $args['smtp_port'] = $smtpSettings['smtp_port']; + $args['smtp_user'] = $smtpSettings['smtp_user']; + $args['smtp_pass'] = rcmail::get_instance()->decrypt($smtpSettings['smtp_pass']); + } + return $args; + } } ?> diff --git a/plugins/identity_smtp/localization/ca_ES.inc b/plugins/identity_smtp/localization/ca_ES.inc new file mode 100644 index 00000000..8532bbc7 --- /dev/null +++ b/plugins/identity_smtp/localization/ca_ES.inc @@ -0,0 +1,14 @@ + diff --git a/plugins/identity_smtp/localization/de_DE.inc b/plugins/identity_smtp/localization/de_DE.inc index d68bc876..047c6335 100644 --- a/plugins/identity_smtp/localization/de_DE.inc +++ b/plugins/identity_smtp/localization/de_DE.inc @@ -3,10 +3,12 @@ $labels = array(); $labels['smtp_settings_header'] = 'SMTP Einstellungen'; $labels['use_default_smtp_server'] = 'Den voreingestellten SMTP Server verwenden'; -$labels['smtp_server'] = 'Server IP/Hostname'; +$labels['smtp_server'] = 'Server IP/Hostname. (Für Verschlüsselung Präfix ssl:// oder tls:// nutzen)'; $labels['smtp_port'] = 'Server Port'; $labels['smtp_user'] = 'Benutzername'; $labels['smtp_pass'] = 'Passwort'; +$labels['smtp_pass2'] = 'Passwort wiederholen'; $labels['smtp_settings_not_available'] = 'Bitte erst speichern, bevor die SMTP Einstellungen vorgenommen werden können.'; +$labels['smtp_passwords_mismatch'] = 'Die eingegebenen Passworte stimmen nicht überein.'; ?> diff --git a/plugins/identity_smtp/localization/en_US.inc b/plugins/identity_smtp/localization/en_US.inc index 72796ba1..31de63e4 100644 --- a/plugins/identity_smtp/localization/en_US.inc +++ b/plugins/identity_smtp/localization/en_US.inc @@ -3,10 +3,12 @@ $labels = array(); $labels['smtp_settings_header'] = 'SMTP Settings'; $labels['use_default_smtp_server'] = 'Use the default SMTP server'; -$labels['smtp_server'] = 'Server IP/Hostname'; +$labels['smtp_server'] = 'Server IP/Hostname (For encryption use prefix ssl:// or tls://)'; $labels['smtp_port'] = 'Server Port'; $labels['smtp_user'] = 'Username'; $labels['smtp_pass'] = 'Password'; +$labels['smtp_pass2'] = 'Repeat Password'; $labels['smtp_settings_not_available'] = 'Please save first to edit the SMTP settings.'; +$labels['smtp_passwords_mismatch'] = 'The passwords do not match.'; ?> diff --git a/plugins/identity_smtp/localization/es_ES.inc b/plugins/identity_smtp/localization/es_ES.inc new file mode 100644 index 00000000..a1a08d4a --- /dev/null +++ b/plugins/identity_smtp/localization/es_ES.inc @@ -0,0 +1,14 @@ + diff --git a/plugins/identity_smtp/localization/fr_FR.inc b/plugins/identity_smtp/localization/fr_FR.inc new file mode 100644 index 00000000..5f270e47 --- /dev/null +++ b/plugins/identity_smtp/localization/fr_FR.inc @@ -0,0 +1,14 @@ + diff --git a/plugins/identity_smtp/localization/ja_JP.inc b/plugins/identity_smtp/localization/ja_JP.inc new file mode 100644 index 00000000..7150e843 --- /dev/null +++ b/plugins/identity_smtp/localization/ja_JP.inc @@ -0,0 +1,14 @@ + diff --git a/plugins/yetiforce/colResizable.min.js b/plugins/yetiforce/colResizable.min.js new file mode 100644 index 00000000..d0a98704 --- /dev/null +++ b/plugins/yetiforce/colResizable.min.js @@ -0,0 +1,4 @@ +'use strict'; + +(function($){var S,d=$(document),h=$("head"),drag=null,tables={},count=0,I=parseInt,M=Math,ie=0 .JColResizer{table-layout:fixed;} .JColResizer > tbody > tr > td, .JColResizer > tbody > tr > th{overflow:hidden;padding-left:0!important; padding-right:0!important;} .JCLRgrips{ height:0px; position:relative;} .JCLRgrip{margin-left:-5px; position:absolute; z-index:5; } .JCLRgrip .JColResizer{position:absolute;background-color:red;filter:alpha(opacity=1);opacity:0;width:10px;height:100%;cursor: e-resize;top:0px} .JCLRLastGrip{position:absolute; width:1px; } .JCLRgripDrag{ border-left:1px dotted black;\t} .JCLRFlex{width:auto!important;} .JCLRgrip.JCLRdisabledGrip .JColResizer{cursor:default; display:none;}");var init=function(tb,options){var t=$(tb);if(t.opt=options,t.mode=options.resizeMode,t.dc=t.opt.disabledColumns,t.opt.disable)return destroy(t);var id=t.id=t.attr("id")||"JColResizer"+count++;t.p=t.opt.postbackSafe,t.is("table")&&(!tables[id]||t.opt.partialRefresh)&&("e-resize"!==t.opt.hoverCursor&&h.append(""),t.addClass("JColResizer").attr("id",id).before("
"),t.g=[],t.c=[],t.w=t.width(),t.gc=t.prev(),t.f=t.opt.fixed,options.marginLeft&&t.gc.css("marginLeft",options.marginLeft),options.marginRight&&t.gc.css("marginRight",options.marginRight),t.cs=I(ie?tb.cellSpacing||tb.currentStyle.borderSpacing:t.css("border-spacing"))||2,t.b=I(ie?tb.border||tb.currentStyle.borderLeftWidth:t.css("border-left-width"))||1,tables[id]=t,createGrips(t));},destroy=function(t){var id=t.attr("id"),t=tables[id];t&&t.is("table")&&(t.removeClass("JColResizer JCLRFlex").gc.remove(),delete tables[id]);},createGrips=function(t){var th=t.find(">thead>tr:first>th,>thead>tr:first>td");th.length||(th=t.find(">tbody>tr:first>th,>tr:first>th,>tbody>tr:first>td, >tr:first>td")),th=th.filter(":visible"),t.cg=t.find("col"),t.ln=th.length,t.p&&S&&S[t.id]&&memento(t,th),th.each(function(i){var c=$(this),dc=-1!=t.dc.indexOf(i),g=$(t.gc.append("
")[0].lastChild);g.append(dc?"":t.opt.gripInnerHtml).append("
"),i==t.ln-1&&(g.addClass("JCLRLastGrip"),t.f&&g.html("")),g.bind("touchstart mousedown",onGripMouseDown),dc?g.addClass("JCLRdisabledGrip"):g.removeClass("JCLRdisabledGrip").bind("touchstart mousedown",onGripMouseDown),g.t=t,g.i=i,g.c=c,c.w=c.width(),t.g.push(g),t.c.push(c),c.width(c.w).removeAttr("width"),g.data("JColResizer",{i:i,t:t.attr("id"),last:i==t.ln-1});}),t.cg.removeAttr("width"),t.find("td, th").not(th).not("table th, table td").each(function(){$(this).removeAttr("width");}),t.f||t.removeAttr("width").addClass("JCLRFlex"),syncGrips(t);},memento=function(t,th){var w,tw,m=0,i=0,aux=[];if(th){if(t.cg.removeAttr("width"),t.opt.flush)return void(S[t.id]="");for(w=S[t.id].split(";"),tw=w[t.ln+1],!t.f&&tw&&(t.width(tw*=1),t.opt.overflow&&(t.css("min-width",tw+"px"),t.w=tw));i*{cursor:"+t.opt.dragCursor+"!important}"),g.addClass(t.opt.draggingClass),drag=g,t.c[o.i].l)for(var c,i=0;i0;\n\tvar S;\n\ttry{S = sessionStorage;}catch(e){}\t//Firefox crashes when executed as local file system\n\t\n\t//append required CSS rules \n h.append(\"\");\n\n\t\n\t/**\n\t * Function to allow column resizing for table objects. It is the starting point to apply the plugin.\n\t * @param {DOM node} tb - reference to the DOM table object to be enhanced\n\t * @param {Object} options\t- some customization values\n\t */\n\tvar init = function( tb, options){\t\n\t\tvar t = $(tb);\t\t\t\t //the table object is wrapped\n t.opt = options; //each table has its own options available at anytime\n t.mode = options.resizeMode; //shortcuts\n t.dc = t.opt.disabledColumns;\n\t\tif(t.opt.disable) return destroy(t);\t\t\t\t//the user is asking to destroy a previously colResized table\n\t\tvar\tid = t.id = t.attr(ID) || SIGNATURE+count++;\t//its id is obtained, if null new one is generated\t\t\n\t\tt.p = t.opt.postbackSafe; \t\t\t\t\t\t\t//short-cut to detect postback safe \t\t\n\t\tif(!t.is(\"table\") || tables[id] && !t.opt.partialRefresh) return; \t\t//if the object is not a table or if it was already processed then it is ignored.\n\t\tif (t.opt.hoverCursor !== 'e-resize') h.append(\"\"); //if hoverCursor has been set, append the style\n\t\tt.addClass(SIGNATURE).attr(ID, id).before('
');\t//the grips container object is added. Signature class forces table rendering in fixed-layout mode to prevent column's min-width\n\t\tt.g = []; t.c = []; t.w = t.width(); t.gc = t.prev(); t.f=t.opt.fixed;\t//t.c and t.g are arrays of columns and grips respectively\t\t\t\t\n\t\tif(options.marginLeft) t.gc.css(\"marginLeft\", options.marginLeft); \t//if the table contains margins, it must be specified\n\t\tif(options.marginRight) t.gc.css(\"marginRight\", options.marginRight); \t//since there is no (direct) way to obtain margin values in its original units (%, em, ...)\n\t\tt.cs = I(ie? tb.cellSpacing || tb.currentStyle.borderSpacing :t.css('border-spacing'))||2;\t//table cellspacing (not even jQuery is fully cross-browser)\n\t\tt.b = I(ie? tb.border || tb.currentStyle.borderLeftWidth :t.css('border-left-width'))||1;\t//outer border width (again cross-browser issues)\n\t\t// if(!(tb.style.width || tb.width)) t.width(t.width()); //I am not an IE fan at all, but it is a pity that only IE has the currentStyle attribute working as expected. For this reason I can not check easily if the table has an explicit width or if it is rendered as \"auto\"\n\t\ttables[id] = t; \t//the table object is stored using its id as key\t\n\t\tcreateGrips(t);\t\t//grips are created \n\t\n\t};\n\n\n\t/**\n\t * This function allows to remove any enhancements performed by this plugin on a previously processed table.\n\t * @param {jQuery ref} t - table object\n\t */\n\tvar destroy = function(t){\n\t\tvar id=t.attr(ID), t=tables[id];\t\t//its table object is found\n\t\tif(!t||!t.is(\"table\")) return;\t\t\t//if none, then it wasn't processed\t \n\t\tt.removeClass(SIGNATURE+\" \"+FLEX).gc.remove();\t//class and grips are removed\n\t\tdelete tables[id];\t\t\t\t\t\t//clean up data\n\t};\n\n\n\t/**\n\t * Function to create all the grips associated with the table given by parameters \n\t * @param {jQuery ref} t - table object\n\t */\n\tvar createGrips = function(t){\t\n\t\n var th = t.find(\">thead>tr:first>th,>thead>tr:first>td\"); //table headers are obtained\n\t\tif(!th.length) th = t.find(\">tbody>tr:first>th,>tr:first>th,>tbody>tr:first>td, >tr:first>td\");\t //but headers can also be included in different ways\n\t\tth = th.filter(\":visible\");\t\t\t\t\t//filter invisible columns\n\t\tt.cg = t.find(\"col\"); \t\t\t\t\t\t//a table can also contain a colgroup with col elements\t\t\n\t\tt.ln = th.length;\t\t\t\t\t\t\t//table length is stored\t\n\t\tif(t.p && S && S[t.id])memento(t,th);\t\t//if 'postbackSafe' is enabled and there is data for the current table, its coloumn layout is restored\n\t\tth.each(function(i){\t\t\t\t\t\t//iterate through the table column headers\t\t\t\n\t\t\tvar c = $(this); \t\t\t\t\t\t//jquery wrap for the current column\t\t\n var dc = t.dc.indexOf(i)!=-1; //is this a disabled column?\n\t\t\tvar g = $(t.gc.append('
')[0].lastChild); //add the visual node to be used as grip\n g.append(dc ? \"\": t.opt.gripInnerHtml).append('
');\n if(i == t.ln-1){ //if the current grip is the las one \n g.addClass(\"JCLRLastGrip\"); //add a different css class to stlye it in a different way if needed\n if(t.f) g.html(\"\"); //if the table resizing mode is set to fixed, the last grip is removed since table with can not change\n }\n g.bind('touchstart mousedown', onGripMouseDown); //bind the mousedown event to start dragging \n \n if (!dc){ \n //if normal column bind the mousedown event to start dragging, if disabled then apply its css class\n g.removeClass('JCLRdisabledGrip').bind('touchstart mousedown', onGripMouseDown); \n }else{\n g.addClass('JCLRdisabledGrip'); \n }\n\n\t\t\tg.t = t; g.i = i; g.c = c;\tc.w =c.width();\t\t//some values are stored in the grip's node data as shortcut\n\t\t\tt.g.push(g); t.c.push(c);\t\t\t\t\t\t//the current grip and column are added to its table object\n\t\t\tc.width(c.w).removeAttr(\"width\");\t\t\t\t//the width of the column is converted into pixel-based measurements\n\t\t\tg.data(SIGNATURE, {i:i, t:t.attr(ID), last: i == t.ln-1});\t //grip index and its table name are stored in the HTML \t\t\t\t\t\t\t\t\t\t\t\t\n\t\t}); \t\n\t\tt.cg.removeAttr(\"width\");\t//remove the width attribute from elements in the colgroup \n\n\t\tt.find('td, th').not(th).not('table th, table td').each(function(){ \n\t\t\t$(this).removeAttr('width');\t//the width attribute is removed from all table cells which are not nested in other tables and dont belong to the header\n\t\t});\t\t\n if(!t.f){\n t.removeAttr('width').addClass(FLEX); //if not fixed, let the table grow as needed\n }\n syncGrips(t); \t\t\t\t//the grips are positioned according to the current table layout\t\t\t\n //there is a small problem, some cells in the table could contain dimension values interfering with the \n //width value set by this plugin. Those values are removed\n\t\t\n\t};\n\t\n \n\t/**\n\t * Function to allow the persistence of columns dimensions after a browser postback. It is based in\n\t * the HTML5 sessionStorage object, which can be emulated for older browsers using sessionstorage.js\n\t * @param {jQuery ref} t - table object\n\t * @param {jQuery ref} th - reference to the first row elements (only set in deserialization)\n\t */\n\tvar memento = function(t, th){ \n\t\tvar w,m=0,i=0,aux =[],tw;\n\t\tif(th){\t\t\t\t\t\t\t\t\t\t//in deserialization mode (after a postback)\n\t\t\tt.cg.removeAttr(\"width\");\n\t\t\tif(t.opt.flush){ S[t.id] =\"\"; return;} \t//if flush is activated, stored data is removed\n\t\t\tw = S[t.id].split(\";\");\t\t\t\t\t//column widths is obtained\n\t\t\ttw = w[t.ln+1];\n if(!t.f && tw){\t\t\t\t\t\t\t//if not fixed and table width data available its size is restored\n t.width(tw*=1);\n if(t.opt.overflow) {\t\t\t\t//if overfolw flag is set, restore table width also as table min-width\n t.css('min-width', tw + PX);\n t.w = tw;\n }\n }\n\t\t\tfor(;i*{cursor:\"+ t.opt.dragCursor +\"!important}\"); \t//change the mouse cursor\n\t\tg.addClass(t.opt.draggingClass); \t//add the dragging class (to allow some visual feedback)\t\t\t\t\n\t\tdrag = g;\t\t\t\t\t\t\t//the current grip is stored as the current dragging object\n\t\tif(t.c[o.i].l) for(var i=0,c; i { instance.setSelectEvent((responseData, e) => { - let emails = []; - if (typeof e.target !== 'undefined' && $(e.target).data('type') === 'email') { - emails.push($(e.target).text()); - } else { - $.each(responseData, function (id, fields) { - $.each(fields, function (key, row) { - if (row.type === 'email') { - emails.push(row.value); - return false; - } + getEmailAddresses(responseData, e, module).done((emails) => { + if (emails.length) { + let value = $('#' + mailField).val(); + if (value != '' && value.charAt(value.length - 1) != ',') { + value = value + ','; + } + $('#' + mailField).val(value + emails.join(',')); + } else { + window.crm.Vtiger_Helper_Js.showPnotify({ + text: window.crm.app.vtranslate('NoFindEmailInRecord'), + animation: 'show' }); - }); - } - if (emails.length === 0) { - window.crm.Vtiger_Helper_Js.showPnotify({ - text: window.crm.app.vtranslate('NoFindEmailInRecord'), - animation: 'show' - }); - } else { - let value = $('#' + mailField).val(); - if (value != '' && value.charAt(value.length - 1) != ',') { - value = value + ','; } - $('#' + mailField).val(value + emails.join(',')); - } + }); }); }); }); + + function getEmailAddresses(responseData, e, module) { + let aDeferred = $.Deferred(), + emails = []; + if (typeof e.target !== 'undefined' && ($(e.target).data('type') === 'email' || $(e.target).data('type') === 'multiEmail')) { + emails.push($(e.target).text()); + aDeferred.resolve(emails); + } else { + let i = 0; + for (let id in responseData) { + window.crm.app.getRecordDetails({ + record: id, + module: module, + fieldType: ['email', 'multiEmail'] + }).done((data) => { + i++; + emails.push(getFirstEmailAddress(data.result.data)); + if (i === Object.keys(responseData).length) { //last iteration + aDeferred.resolve(emails); + } + }); + } + } + return aDeferred.promise(); + } + + function getFirstEmailAddress(mailObj) { + let emails = []; + for (let key in mailObj) { + if (mailObj[key]) { + if (window.crm.app.isJsonString(mailObj[key])) { + let multiEmail = JSON.parse(mailObj[key]); + for (let i in multiEmail) { + emails.push(multiEmail[i].e); + } + break; + } else { + emails.push(mailObj[key]); + break; + } + } + } + return emails; + } + //Loading list of modules with templates mail if (rcmail.env.isPermittedMailTemplates) { jQuery.ajax({ @@ -96,7 +130,10 @@ window.rcmail && rcmail.addEventListener('init', function (evt) { $.each(data, function (index, value) { jQuery('#vtmodulemenulink').removeClass('disabled'); jQuery('#tplmenulink').removeClass('disabled'); - tmp.push({name: value.moduleName, label: value.moduleName}); + tmp.push({ + name: value.moduleName, + label: value.moduleName + }); jQuery('#tplmenu #texttplsmenu').append('
  • ' + value.name + '
  • '); }); diff --git a/plugins/yetiforce/compose.min.js b/plugins/yetiforce/compose.min.js new file mode 100644 index 00000000..2f72170b --- /dev/null +++ b/plugins/yetiforce/compose.min.js @@ -0,0 +1,10 @@ +'use strict'; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { + return typeof obj; +} : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; +}; + +window.rcmail&&rcmail.addEventListener('init',function(){function getEmailAddresses(responseData,e,module){var aDeferred=$.Deferred(),emails=[];return 'undefined'!=typeof e.target&&('email'===$(e.target).data('type')||'multiEmail'===$(e.target).data('type'))?(emails.push($(e.target).text()),aDeferred.resolve(emails)):function(){var i=0;for(var id in responseData)window.crm.app.getRecordDetails({record:id,module:module,fieldType:['email','multiEmail']}).done(function(data){i++,emails.push(getFirstEmailAddress(data.result.data)),i===Object.keys(responseData).length&&aDeferred.resolve(emails);});}(),aDeferred.promise()}function getFirstEmailAddress(mailObj){var emails=[];for(var key in mailObj)if(mailObj[key])if(window.crm.app.isJsonString(mailObj[key])){var multiEmail=JSON.parse(mailObj[key]);for(var i in multiEmail)emails.push(multiEmail[i].e);break}else{emails.push(mailObj[key]);break}return emails}var crm=window.crm=getCrmWindow(),crmPath=rcmail.env.site_URL+'index.php?';rcmail.env.compose_commands.push('yetiforce.addFilesToMail'),rcmail.env.compose_commands.push('yetiforce.addFilesFromCRM'),rcmail.register_command('yetiforce.addFilesToMail',function(data){var ts=new Date().getTime(),frame=rcmail.async_upload_form_frame('rcmupload'+ts);data._uploadid=ts,jQuery.ajax({url:'?_task=mail&_action=plugin.yetiforce.addFilesToMail&_id='+rcmail.env.compose_id,type:'POST',data:data,success:function success(data){var doc=frame[0],body=$(doc);body.html(data);}});},!0),rcmail.register_command('yetiforce.addFilesFromCRM',function(){!1!=crm&&window.crm.app.showRecordsList({module:'Documents',src_module:'Documents',multi_select:!0,additionalInformations:!0},function(modal,instance){instance.setSelectEvent(function(responseData){rcmail.command('yetiforce.addFilesToMail',{ids:Object.keys(responseData),_uploadid:new Date().getTime()});});});},!0),$('#composeheaders #yt_adress_buttons .button').click(function(){var mailField=$(this).attr('data-input'),module=$(this).attr('data-module');window.crm.app.showRecordsList({module:module,src_module:'OSSMail',multi_select:!0,additionalInformations:!0},function(modal,instance){instance.setSelectEvent(function(responseData,e){getEmailAddresses(responseData,e,module).done(function(emails){if(emails.length){var value=$('#'+mailField).val();''!=value&&','!=value.charAt(value.length-1)&&(value+=','),$('#'+mailField).val(value+emails.join(','));}else window.crm.Vtiger_Helper_Js.showPnotify({text:window.crm.app.vtranslate('NoFindEmailInRecord'),animation:'show'});});});});}),rcmail.env.isPermittedMailTemplates&&jQuery.ajax({type:'Get',url:'?_task=mail&_action=plugin.yetiforce.getEmailTemplates&_id='+rcmail.env.compose_id,async:!1,success:function success(data){var modules=[],tmp=[];data=JSON.parse(data),$.each(data,function(index,value){jQuery('#vtmodulemenulink').removeClass('disabled'),jQuery('#tplmenulink').removeClass('disabled'),tmp.push({name:value.moduleName,label:value.moduleName}),jQuery('#tplmenu #texttplsmenu').append('
  • '+value.name+'
  • ');}),$.each(tmp,function(index,value){-1==jQuery.inArray(value.name,modules)&&(jQuery('#vtmodulemenu .toolbarmenu').append('
  • '+value.label+'
  • '),modules.push(value.name));});}}),jQuery('#vtmodulemenu li a').on('click',function(){var selectModule=jQuery(this).data('module');selectModule==null?jQuery('#tplmenu li').show():(jQuery('#tplmenu li.'+selectModule).show(),jQuery('#tplmenu li').not('.'+selectModule).hide());}),rcmail.env.crmModule!=null&&jQuery('#vtmodulemenu li.'+rcmail.env.crmModule+' a').trigger('click'),jQuery('#tplmenu li a').on('click',function(){var id=jQuery(this).data('tplid'),recordId=rcmail.env.crmRecord,module=rcmail.env.crmModule,view=rcmail.env.crmView;if('List'==view){var chElement=jQuery(crm.document).find('.listViewEntriesCheckBox')[0];recordId=jQuery(chElement).val();}jQuery.ajax({type:'Get',url:'?_task=mail&_action=plugin.yetiforce.getConntentEmailTemplate&_id='+rcmail.env.compose_id,data:{id:id,record_id:recordId,select_module:module},success:function success(data){data=JSON.parse(data);var oldSubject=jQuery('[name="_subject"]').val(),html=jQuery('
    ').html(data.content).html();if(jQuery('[name="_subject"]').val(oldSubject+' '+data.subject),window.tinyMCE&&(ed=tinyMCE.get(rcmail.env.composebody))){var oldBody=tinyMCE.activeEditor.getContent();tinymce.activeEditor.setContent(html+oldBody);}else{var oldBody=jQuery('#composebody').val();jQuery('#composebody').val(html+oldBody);}'undefined'!=typeof data.attachments&&null!==data.attachments&&rcmail.command('yetiforce.addFilesToMail',data.attachments);}});});});function getCrmWindow(){if(null!==opener)return opener.parent;return !('object'!=_typeof(parent.app))&&parent} +//# sourceMappingURL=compose.min.js.map diff --git a/plugins/yetiforce/compose.min.js.map b/plugins/yetiforce/compose.min.js.map new file mode 100644 index 00000000..cbd2bbd9 --- /dev/null +++ b/plugins/yetiforce/compose.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"compose.min.js","sources":["compose.js"],"sourcesContent":["/* {[The file is published on the basis of MIT License]} */\n\nwindow.rcmail && rcmail.addEventListener('init', function (evt) {\n\n\tvar crm = window.crm = getCrmWindow();\n\tvar crmPath = rcmail.env.site_URL + 'index.php?';\n\n\trcmail.env.compose_commands.push('yetiforce.addFilesToMail');\n\trcmail.env.compose_commands.push('yetiforce.addFilesFromCRM');\n\n\t// Document selection\n\trcmail.register_command('yetiforce.addFilesToMail', function (data) {\n\t\tvar ts = new Date().getTime(),\n\t\t\tframe_name = 'rcmupload' + ts,\n\t\t\tframe = rcmail.async_upload_form_frame(frame_name);\n\t\tdata._uploadid = ts;\n\t\tjQuery.ajax({\n\t\t\turl: \"?_task=mail&_action=plugin.yetiforce.addFilesToMail&_id=\" + rcmail.env.compose_id,\n\t\t\ttype: \"POST\",\n\t\t\tdata: data,\n\t\t\tsuccess: function (data) {\n\t\t\t\tvar doc = frame[0];\n\t\t\t\tvar body = $(doc);\n\t\t\t\tbody.html(data);\n\t\t\t}\n\t\t});\n\t}, true);\n\n\t// Add a document to an email crm\n\trcmail.register_command('yetiforce.addFilesFromCRM', function (data) {\n\t\tif (crm != false) {\n\t\t\twindow.crm.app.showRecordsList({\n\t\t\t\tmodule: 'Documents',\n\t\t\t\tsrc_module: 'Documents',\n\t\t\t\tmulti_select: true,\n\t\t\t\tadditionalInformations: true\n\t\t\t}, (modal, instance) => {\n\t\t\t\tinstance.setSelectEvent((responseData) => {\n\t\t\t\t\trcmail.command('yetiforce.addFilesToMail', {\n\t\t\t\t\t\tids: Object.keys(responseData),\n\t\t\t\t\t\t_uploadid: new Date().getTime()\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\t}, true);\n\t// Selection of email with popup\n\t$('#composeheaders #yt_adress_buttons .button').click(function () {\n\t\tvar mailField = $(this).attr('data-input');\n\t\tvar module = $(this).attr('data-module');\n\t\twindow.crm.app.showRecordsList({\n\t\t\tmodule: module,\n\t\t\tsrc_module: 'OSSMail',\n\t\t\tmulti_select: true,\n\t\t\tadditionalInformations: true\n\t\t}, (modal, instance) => {\n\t\t\tinstance.setSelectEvent((responseData, e) => {\n\t\t\t\tgetEmailAddresses(responseData, e, module).done((emails) => {\n\t\t\t\t\tif (emails.length) {\n\t\t\t\t\t\tlet value = $('#' + mailField).val();\n\t\t\t\t\t\tif (value != '' && value.charAt(value.length - 1) != ',') {\n\t\t\t\t\t\t\tvalue = value + ',';\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$('#' + mailField).val(value + emails.join(','));\n\t\t\t\t\t} else {\n\t\t\t\t\t\twindow.crm.Vtiger_Helper_Js.showPnotify({\n\t\t\t\t\t\t\ttext: window.crm.app.vtranslate('NoFindEmailInRecord'),\n\t\t\t\t\t\t\tanimation: 'show'\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n\n\tfunction getEmailAddresses(responseData, e, module) {\n\t\tlet aDeferred = $.Deferred(),\n\t\t\temails = [];\n\t\tif (typeof e.target !== 'undefined' && ($(e.target).data('type') === 'email' || $(e.target).data('type') === 'multiEmail')) {\n\t\t\temails.push($(e.target).text());\n\t\t\taDeferred.resolve(emails);\n\t\t} else {\n\t\t\tlet i = 0;\n\t\t\tfor (let id in responseData) {\n\t\t\t\twindow.crm.app.getRecordDetails({\n\t\t\t\t\trecord: id,\n\t\t\t\t\tmodule: module,\n\t\t\t\t\tfieldType: ['email', 'multiEmail']\n\t\t\t\t}).done((data) => {\n\t\t\t\t\ti++;\n\t\t\t\t\temails.push(getFirstEmailAddress(data.result.data));\n\t\t\t\t\tif (i === Object.keys(responseData).length) { //last iteration\n\t\t\t\t\t\taDeferred.resolve(emails);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn aDeferred.promise();\n\t}\n\n\tfunction getFirstEmailAddress(mailObj) {\n\t\tlet emails = [];\n\t\tfor (let key in mailObj) {\n\t\t\tif (mailObj[key]) {\n\t\t\t\tif (window.crm.app.isJsonString(mailObj[key])) {\n\t\t\t\t\tlet multiEmail = JSON.parse(mailObj[key]);\n\t\t\t\t\tfor (let i in multiEmail) {\n\t\t\t\t\t\temails.push(multiEmail[i].e);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\temails.push(mailObj[key]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn emails;\n\t}\n\n\t//Loading list of modules with templates mail\n\tif (rcmail.env.isPermittedMailTemplates) {\n\t\tjQuery.ajax({\n\t\t\ttype: 'Get',\n\t\t\turl: \"?_task=mail&_action=plugin.yetiforce.getEmailTemplates&_id=\" + rcmail.env.compose_id,\n\t\t\tasync: false,\n\t\t\tsuccess: function (data) {\n\t\t\t\tvar modules = [];\n\t\t\t\tvar tmp = [];\n\t\t\t\tdata = JSON.parse(data);\n\t\t\t\t$.each(data, function (index, value) {\n\t\t\t\t\tjQuery('#vtmodulemenulink').removeClass('disabled');\n\t\t\t\t\tjQuery('#tplmenulink').removeClass('disabled');\n\t\t\t\t\ttmp.push({\n\t\t\t\t\t\tname: value.moduleName,\n\t\t\t\t\t\tlabel: value.moduleName\n\t\t\t\t\t});\n\t\t\t\t\tjQuery('#tplmenu #texttplsmenu').append('
  • ' + value.name + '
  • ');\n\t\t\t\t});\n\n\t\t\t\t$.each(tmp, function (index, value) {\n\t\t\t\t\tif (jQuery.inArray(value.name, modules) == -1) {\n\t\t\t\t\t\tjQuery('#vtmodulemenu .toolbarmenu').append('
  • ' + value.label + '
  • ');\n\t\t\t\t\t\tmodules.push(value.name);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t}\n\t\t});\n\t}\n\t// Limit the list of templates\n\tjQuery('#vtmodulemenu li a').on('click', function () {\n\t\tvar selectModule = jQuery(this).data('module');\n\t\tif (selectModule == undefined) {\n\t\t\tjQuery('#tplmenu li').show();\n\t\t} else {\n\t\t\tjQuery('#tplmenu li.' + selectModule).show();\n\t\t\tjQuery('#tplmenu li').not(\".\" + selectModule).hide();\n\t\t}\n\t});\n\n\tif (rcmail.env.crmModule != undefined) {\n\t\tjQuery('#vtmodulemenu li.' + rcmail.env.crmModule + ' a').trigger(\"click\");\n\t}\n\n\t// Loading a template mail\n\tjQuery('#tplmenu li a').on('click', function () {\n\t\tvar id = jQuery(this).data('tplid');\n\t\tvar recordId = rcmail.env.crmRecord,\n\t\t\tmodule = rcmail.env.crmModule,\n\t\t\tview = rcmail.env.crmView;\n\t\tif (view == 'List') {\n\t\t\tvar chElement = jQuery(crm.document).find('.listViewEntriesCheckBox')[0];\n\t\t\trecordId = jQuery(chElement).val();\n\t\t}\n\t\tjQuery.ajax({\n\t\t\ttype: 'Get',\n\t\t\turl: \"?_task=mail&_action=plugin.yetiforce.getConntentEmailTemplate&_id=\" + rcmail.env.compose_id,\n\t\t\tdata: {\n\t\t\t\tid: id,\n\t\t\t\trecord_id: recordId,\n\t\t\t\tselect_module: module\n\t\t\t},\n\t\t\tsuccess: function (data) {\n\t\t\t\tdata = JSON.parse(data);\n\t\t\t\tvar oldSubject = jQuery('[name=\"_subject\"]').val();\n\t\t\t\tvar html = jQuery(\"
    \").html(data.content).html();\n\t\t\t\tjQuery('[name=\"_subject\"]').val(oldSubject + ' ' + data.subject);\n\t\t\t\tif (window.tinyMCE && (ed = tinyMCE.get(rcmail.env.composebody))) {\n\t\t\t\t\tvar oldBody = tinyMCE.activeEditor.getContent();\n\t\t\t\t\ttinymce.activeEditor.setContent(html + oldBody);\n\t\t\t\t} else {\n\t\t\t\t\tvar oldBody = jQuery('#composebody').val();\n\t\t\t\t\tjQuery('#composebody').val(html + oldBody);\n\t\t\t\t}\n\t\t\t\tif (typeof data.attachments !== 'undefined' && data.attachments !== null) {\n\t\t\t\t\trcmail.command('yetiforce.addFilesToMail', data.attachments);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t});\n});\n\nfunction getCrmWindow() {\n\tif (opener !== null) {\n\t\treturn opener.parent;\n\t} else if (typeof parent.app == \"object\") {\n\t\treturn parent;\n\t}\n\treturn false;\n}\n"],"names":["window","rcmail","addEventListener","responseData","e","module","$","Deferred","emails","target","data","push","text","aDeferred","resolve","crm","app","getRecordDetails","record","id","fieldType","done","i","getFirstEmailAddress","result","Object","keys","length","promise","mailObj","key","isJsonString","JSON","parse","multiEmail","getCrmWindow","crmPath","env","site_URL","compose_commands","register_command","getTime","frame","async_upload_form_frame","ts","_uploadid","jQuery","ajax","url","compose_id","type","success","body","doc","html","showRecordsList","src_module","multi_select","additionalInformations","modal","instance","setSelectEvent","command","ids","click","attr","getEmailAddresses","mailField","val","charAt","value","join","Vtiger_Helper_Js","showPnotify","vtranslate","animation","isPermittedMailTemplates","async","tmp","each","index","removeClass","name","moduleName","label","append","inArray","modules","on","selectModule","show","not","hide","crmModule","trigger","recordId","crmRecord","view","crmView","document","find","chElement","record_id","select_module","content","oldSubject","subject","tinyMCE","ed","get","composebody","activeEditor","getContent","tinymce","setContent","oldBody","attachments","parent"],"mappings":";;;;;;;;AAEAA,OAAOC,MAAP,EAAiBA,OAAOC,gBAAP,CAAwB,MAAxB,CAAgC,UAAe,CAyE/D,0BAAA,CAA2BC,YAA3B,CAAyCC,CAAzC,CAA4CC,MAA5C,CAAoD,CACnD,cAAgBC,EAAEC,QAAF,EAAhB,CACCC,OAA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xD,CACA,CAAI1G,OAAO2G,OAAP,GAAmBC,GAAKD,QAAQE,GAAR,CAAY5G,OAAOoC,GAAP,CAAWyE,WAAvB,CAAxB,CAAJ,CAAkE,CACjE,YAAcH,QAAQI,YAAR,CAAqBC,UAArB,EAAd,CACAC,QAAQF,YAAR,CAAqBG,UAArB,CAAgC5D,KAAO6D,OAAvC,EACA,CAHD,IAGO,CACN,YAAcrE,OAAO,cAAP,EAAuBsB,GAAvB,EAAd,CACAtB,OAAO,cAAP,EAAuBsB,GAAvB,CAA2Bd,KAAO6D,OAAlC,EACA,CAC+B,WAA5B,cAAYC,WAAZ,EAAgE,IAArB,QAAKA,WAZ5B,EAavBnH,OAAO6D,OAAP,CAAe,0BAAf,CAA2CpD,KAAK0G,WAAhD,EAED,CAvBU,CAAZ,EAyBA,CAlCD,EAmCA,CAtMgB,EAwMjB,qBAAA,EAAwB,CACvB,GAAe,IAAX,SAAJ,CACC,cAAcC,MAAd,CAFsB,SAGS,QAArB,UAAOA,OAAOrG,GAAd,CAHY,GAIfqG,MAGR"} \ No newline at end of file diff --git a/plugins/yetiforce/list.js b/plugins/yetiforce/list.js deleted file mode 100644 index bdfd01a6..00000000 --- a/plugins/yetiforce/list.js +++ /dev/null @@ -1,42 +0,0 @@ -/* {[The file is published on the basis of MIT License]} */ -window.rcmail && rcmail.addEventListener('listupdate', function (evt) { - //window.crm = getCrmWindow(); - rcmail.register_command('yetiforce.importICS', function (ics, element, e) { - - }, true); - var container = $('#messagelistcontainer'); - var headerFixed = container.find('.records-table.messagelist.sortheader.fixedheader.fixedcopy'); - var messageList = container.find('#messagelist'); - /* - var columnsWidth = window.crm.app.moduleCacheGet('widthColumns'); - if (columnsWidth != null) { - messageList.find('th,td').each(function (index) { - $(this).width(columnsWidth[index]); - }); - headerFixed.find('th,td').each(function (index) { - $(this).width(columnsWidth[index]); - }); - } - */ - /* - headerFixed.colResizable({ - onResize: function (e) { - resizeContentTable(headerFixed, messageList, e); - }, - resizeMode:'fit' - }); - */ -}); - -function resizeContentTable(headerFixed, messageList, e) -{ - var column_widths = []; - headerFixed.find('thead th,thead td').each(function (index) { - column_widths[index] = $(this).width(); - }); - messageList.find('th,td').each(function (index) { - $(this).width(column_widths[index]); - }); - window.crm.app.moduleCacheSet('widthColumns', column_widths); - $(window).scroll(); -} diff --git a/plugins/yetiforce/list.min.js b/plugins/yetiforce/list.min.js deleted file mode 100644 index e774fa8c..00000000 --- a/plugins/yetiforce/list.min.js +++ /dev/null @@ -1,2 +0,0 @@ - -window.rcmail&&rcmail.addEventListener("listupdate",function(b){rcmail.register_command("yetiforce.importICS",function(f,g,h){},true);var a=$("#messagelistcontainer");var c=a.find(".records-table.messagelist.sortheader.fixedheader.fixedcopy");var d=a.find("#messagelist")});function resizeContentTable(a,b,c){var d=[];a.find("thead th,thead td").each(function(e){d[e]=$(this).width()});b.find("th,td").each(function(e){$(this).width(d[e])});window.crm.app.moduleCacheSet("widthColumns",d);$(window).scroll()}; \ No newline at end of file diff --git a/plugins/yetiforce/list.min.js.map b/plugins/yetiforce/list.min.js.map new file mode 100644 index 00000000..512e2784 --- /dev/null +++ b/plugins/yetiforce/list.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"list.min.js","sources":["list.js"],"sourcesContent":["/* {[The file is published on the basis of MIT License]} */\nwindow.rcmail && rcmail.addEventListener('listupdate', function (evt) {\n\t//window.crm = getCrmWindow();\n\trcmail.register_command('yetiforce.importICS', function (ics, element, e) {\n\n\t}, true);\n\tvar container = $('#messagelistcontainer');\n\tvar headerFixed = container.find('.records-table.messagelist.sortheader.fixedheader.fixedcopy');\n\tvar messageList = container.find('#messagelist');\n\t/*\n\t var columnsWidth = window.crm.app.moduleCacheGet('widthColumns');\n\t if (columnsWidth != null) {\n\t messageList.find('th,td').each(function (index) {\n\t $(this).width(columnsWidth[index]);\n\t });\n\t headerFixed.find('th,td').each(function (index) {\n\t $(this).width(columnsWidth[index]);\n\t });\n\t }\n\t */\n\t/*\n\t headerFixed.colResizable({\n\t onResize: function (e) {\n\t resizeContentTable(headerFixed, messageList, e);\n\t },\n\t resizeMode:'fit'\n\t });\n\t */\n});\n\nfunction resizeContentTable(headerFixed, messageList, e)\n{\n\tvar column_widths = [];\n\theaderFixed.find('thead th,thead td').each(function (index) {\n\t\tcolumn_widths[index] = $(this).width();\n\t});\n\tmessageList.find('th,td').each(function (index) {\n\t\t$(this).width(column_widths[index]);\n\t});\n\twindow.crm.app.moduleCacheSet('widthColumns', column_widths);\n\t$(window).scroll();\n}\n"],"names":["window","rcmail","addEventListener","register_command","$","headerFixed","container","find","messageList"],"mappings":";;AACAA,OAAOC,MAAP,EAAiBA,OAAOC,gBAAP,CAAwB,YAAxB,CAAsC,UAAe,CAErED,OAAOE,gBAAP,CAAwB,qBAAxB,CAA+C,UAA2B,EAA1E,IAFqE,eAKrDC,EAAE,uBAAF,CALqD,CAMjEC,YAAcC,UAAUC,IAAV,CAAe,6DAAf,CANmD,CAOjEC,YAAcF,UAAUC,IAAV,CAAe,cAAf,EAoBlB,CA3BgB,EA6BjB"} \ No newline at end of file diff --git a/plugins/yetiforce/preview.css b/plugins/yetiforce/preview.css index f4345966..ac52a232 100644 --- a/plugins/yetiforce/preview.css +++ b/plugins/yetiforce/preview.css @@ -70,10 +70,18 @@ display: none; } +.d-none { + display: none; +} + .mr-5px { margin-right: 5px; } +.mr-3px { + margin-right: 3px; +} + .ml-5px { margin-left: 5px; } @@ -87,46 +95,156 @@ flex-wrap: wrap; } +.flex-nowrap { + display: flex; + flex-wrap: nowrap; +} + .rowRelatedRecord { - padding: 2px; + background: #bbdde8; + margin-left: 3px; + border: 1px #c1c1c1 solid; } .action-bar__head__container { display: flex; flex-wrap: nowrap; + width: fit-content; + margin-right: 5px; } -.action-bar__data a { +.action-bar__head a { text-decoration: none; color: #000; - font-size: 14px; - line-height: 14px -} - -.action-bar__header { - font-size: 14px; - min-width: 90px; } .action-bar__head { - background-color: #4a5364; - height: 20px; color: #fff; - padding: 2px; + padding: 0 2px 4px; + display: flex; + flex-wrap: wrap; +} + +.action-bar__head > * { + margin-top: 4px; } .action-bar__col { + background-color: #4a5364; width: 100%; } -@media only screen and (min-width: 600px) { - #ytActionBarContent .action-bar__col { - width: 50%; - } +.action-bar__select { + margin-left: 3px; +} + +.action-bar__select:required:invalid { + color: gray; +} + +.action-bar__select optgroup { + color: black; +} + +button, select, .rowRelatedRecord { + border-radius: .25rem; + padding: 0.1rem 0.2rem; +} + +button, select { + cursor: pointer; +} + +.rowActions { + display: inline-flex; + align-items: center; +} + +.rowActions button { + padding: 0.005rem 0.2rem; + margin-left: 5px; +} + +button { + display: inline-block; + background-color: #f8f9fa; + border-color: #f8f9fa; + font-weight: 400; + text-align: center; + white-space: nowrap; + vertical-align: middle; + user-select: none; + border: 1px solid transparent; + padding: 0.2rem 0.3rem; + border-radius: 0.25rem; + transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; } -@media only screen and (min-width: 1200px) { - #ytActionBarContent .action-bar__col { - width: 25%; - } +button:hover { + color: #212529; + background-color: #e2e6ea; + border-color: #dae0e5; } + +.c-ical { + margin: 2px; +} + +.c-ical__event { + background: #fffdfd; + margin: 2px 0; + border: 1px solid #dedede; + margin: 3px auto; + border-radius: 6px; +} + +.c-ical__wrapper { + margin: 3px; +} + +.c-ical__card { + width: fit-content; + height: fit-content; + background: white; + border: 1px solid #d0d0d0; + border-radius: 6px; + color: #c51818; + padding: 0 2px 2px; + margin: 2px; + text-align: center; +} + +.c-ical__card__day { + font-size: 15px; + margin: 0 auto; + width: fit-content; + color: black; +} + +.c-ical__card__year { + font-size: 9px; + color: #888888 +} + +.c-ical__card__time { + font-size: 18px; + margin: auto 5px; +} + +.c-ical__card__arrow { + margin: auto 5px; +} + +.c-ical__subject { + margin: 0 auto; + text-align: center; + background: #4a5364; + color: white; + border-top-left-radius: 6px; + border-top-right-radius: 6px; + padding-bottom: 2px; +} + +.mr-1 { + margin-right: 0.25rem; +} \ No newline at end of file diff --git a/plugins/yetiforce/preview.js b/plugins/yetiforce/preview.js index bde82cf7..acdafce2 100644 --- a/plugins/yetiforce/preview.js +++ b/plugins/yetiforce/preview.js @@ -3,23 +3,20 @@ window.rcmail && rcmail.addEventListener('init', function (evt) { window.crm = getCrmWindow(); loadActionBar(); rcmail.env.message_commands.push('yetiforce.importICS'); - rcmail.register_command('yetiforce.importICS', function (ics, element, e) { - window.crm.AppConnector.request({ - async: true, - dataType: 'json', - data: { - module: 'Calendar', - action: 'ImportICS', - ics: ics + rcmail.register_command('yetiforce.importICS', function (part, type) { + jQuery.ajax({ + type: 'POST', + url: "./?_task=mail&_action=plugin.yetiforce.importIcs&_mbox=" + urlencode(rcmail.env.mailbox) + '&_uid=' + urlencode(rcmail.env.uid) + '&_part=' + part + '&_type=' + type, + async: false, + success: function (data) { + data = JSON.parse(data); + window.crm.Vtiger_Helper_Js.showPnotify({ + text: data['message'], + type: 'info', + animation: 'show' + }); } - }).done(function (response) { - window.crm.Vtiger_Helper_Js.showPnotify({ - text: response['result'], - type: 'info', - animation: 'show' - }); - $(element).closest('.icalattachments').remove(); - }) + }); }, true); } ); @@ -73,11 +70,9 @@ function registerImportMail(content) { window.crm.AppConnector.request({ module: 'OSSMail', action: 'ImportMail', - params: { - uid: rcmail.env.uid, - folder: rcmail.env.mailbox, - rcId: rcmail.env.user_id - } + uid: rcmail.env.uid, + folder: rcmail.env.mailbox, + rcId: rcmail.env.user_id }).done(function (data) { loadActionBar(); window.crm.Vtiger_Helper_Js.showPnotify({ @@ -103,6 +98,9 @@ function registerSelectRecord(content) { }; if ($(this).data('type') == 0) { var module = $(this).closest('.js-head-container').find('.module').val(); + if (module === null) { + return; + } } else { var module = $(this).data('module'); relParams.crmid = $(this).closest('.rowRelatedRecord').data('id'); @@ -131,7 +129,10 @@ function registerAddRecord(content) { var id = content.find('#mailActionBarID').val(); content.find('button.addRecord').click(function (e) { var col = $(e.currentTarget).closest('.js-head-container'); - showQuickCreateForm(col.find('.module').val(), id); + let selectValue = col.find('.module').val(); + if (selectValue !== null) { + showQuickCreateForm(selectValue, id); + } }); } diff --git a/plugins/yetiforce/preview.min.css b/plugins/yetiforce/preview.min.css index f4345966..320569ba 100644 --- a/plugins/yetiforce/preview.min.css +++ b/plugins/yetiforce/preview.min.css @@ -1,132 +1 @@ -.pull-right { - float: right !important -} - -#ytActionBarContent select { - padding: 0 -} - -#ytActionBarContent .row:before { - display: table; - content: " " -} - -#ytActionBarContent .row:after { - clear: both; - display: table; - content: " " -} - -#ytActionBarContent .ytHeader { - position: relative; - border-bottom: 1px solid #dfdfdf; -} - -#ytActionBarContent .rowReletedRecord .rowActions { - display: none -} - -#ytActionBarContent .rowReletedRecord:hover .rowActions { - display: block -} - -#ytActionBarContent .noRecords { - background: #70a8cb; - text-align: center; - color: #fff; - padding: 2px 0 -} - -#ytActionBarContent .noRecords a.importMail { - color: #ecf6ff; - cursor: pointer; - font-weight: 800 -} - -#ytActionBarContent .rowReletedRecord { - margin: 3px 0 6px 0 -} - -#ytActionBarContent .rowReletedRecord { - margin: 3px 0 6px 0 -} - -#ytActionBarContent .pull-right button { - line-height: 10px; - margin-left: 3px; - padding: 0 6px; - height: 14px -} - -#ytActionBarContent .relatedModuleIcon { - margin-right: 5px -} - -#messageheader.previewheader { - padding: 0 0 3px 30px; -} - -.rcmaddcontact { - display: none; -} - -.mr-5px { - margin-right: 5px; -} - -.ml-5px { - margin-left: 5px; -} - -.w-100 { - width: 100%; -} - -.flex-wrap { - display: flex; - flex-wrap: wrap; -} - -.rowRelatedRecord { - padding: 2px; -} - -.action-bar__head__container { - display: flex; - flex-wrap: nowrap; -} - -.action-bar__data a { - text-decoration: none; - color: #000; - font-size: 14px; - line-height: 14px -} - -.action-bar__header { - font-size: 14px; - min-width: 90px; -} - -.action-bar__head { - background-color: #4a5364; - height: 20px; - color: #fff; - padding: 2px; -} - -.action-bar__col { - width: 100%; -} - -@media only screen and (min-width: 600px) { - #ytActionBarContent .action-bar__col { - width: 50%; - } -} - -@media only screen and (min-width: 1200px) { - #ytActionBarContent .action-bar__col { - width: 25%; - } -} +.pull-right{float:right !important}#ytActionBarContent select{padding:0}#ytActionBarContent .row:before{display:table;content:" "}#ytActionBarContent .row:after{clear:both;display:table;content:" "}#ytActionBarContent .ytHeader{position:relative;border-bottom:1px solid #dfdfdf}#ytActionBarContent .rowReletedRecord .rowActions{display:none}#ytActionBarContent .rowReletedRecord:hover .rowActions{display:block}#ytActionBarContent .noRecords{background:#70a8cb;text-align:center;color:#fff;padding:2px 0}#ytActionBarContent .noRecords a.importMail{color:#ecf6ff;cursor:pointer;font-weight:800}#ytActionBarContent .rowReletedRecord{margin:3px 0 6px 0}#ytActionBarContent .rowReletedRecord{margin:3px 0 6px 0}#ytActionBarContent .pull-right button{line-height:10px;margin-left:3px;padding:0 6px;height:14px}#ytActionBarContent .relatedModuleIcon{margin-right:5px}#messageheader.previewheader{padding:0 0 3px 30px}.rcmaddcontact{display:none}.d-none{display:none}.mr-5px{margin-right:5px}.mr-3px{margin-right:3px}.ml-5px{margin-left:5px}.w-100{width:100%}.flex-wrap{display:flex;flex-wrap:wrap}.flex-nowrap{display:flex;flex-wrap:nowrap}.rowRelatedRecord{background:#bbdde8;margin-left:3px;border:1px #c1c1c1 solid}.action-bar__head__container{display:flex;flex-wrap:nowrap;width:fit-content;margin-right:5px}.action-bar__head a{text-decoration:none;color:#000}.action-bar__head{color:#fff;padding:0 2px 4px;display:flex;flex-wrap:wrap}.action-bar__head>*{margin-top:4px}.action-bar__col{background-color:#4a5364;width:100%}.action-bar__select{margin-left:3px}.action-bar__select:required:invalid{color:gray}.action-bar__select optgroup{color:black}button,select,.rowRelatedRecord{border-radius:.25rem;padding:.1rem .2rem}button,select{cursor:pointer}.rowActions{display:inline-flex;align-items:center}.rowActions button{padding:.005rem .2rem;margin-left:5px}button{display:inline-block;background-color:#f8f9fa;border-color:#f8f9fa;font-weight:400;text-align:center;white-space:nowrap;vertical-align:middle;user-select:none;border:1px solid transparent;padding:.2rem .3rem;border-radius:.25rem;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}button:hover{color:#212529;background-color:#e2e6ea;border-color:#dae0e5}.c-ical{margin:2px}.c-ical__event{background:#fffdfd;margin:2px 0;border:1px solid #dedede;margin:3px auto;border-radius:6px}.c-ical__wrapper{margin:3px}.c-ical__card{width:fit-content;height:fit-content;background:white;border:1px solid #d0d0d0;border-radius:6px;color:#c51818;padding:0 2px 2px;margin:2px;text-align:center}.c-ical__card__day{font-size:15px;margin:0 auto;width:fit-content;color:black}.c-ical__card__year{font-size:9px;color:#888}.c-ical__card__time{font-size:18px;margin:auto 5px}.c-ical__card__arrow{margin:auto 5px}.c-ical__subject{margin:0 auto;text-align:center;background:#4a5364;color:white;border-top-left-radius:6px;border-top-right-radius:6px;padding-bottom:2px}.mr-1{margin-right:.25rem} \ No newline at end of file diff --git a/plugins/yetiforce/preview.min.js b/plugins/yetiforce/preview.min.js index 4a223e5b..3efcfbc8 100644 --- a/plugins/yetiforce/preview.min.js +++ b/plugins/yetiforce/preview.min.js @@ -1 +1,10 @@ -window.rcmail&&rcmail.addEventListener("init",function(evt){window.crm=getCrmWindow();loadActionBar();rcmail.env.message_commands.push("yetiforce.importICS");rcmail.register_command("yetiforce.importICS",function(ics,element,e){window.crm.AppConnector.request({async:true,dataType:"json",data:{module:"Calendar",action:"ImportICS",ics:ics}}).then(function(response){window.crm.Vtiger_Helper_Js.showPnotify({text:response["result"],type:"info",animation:"show"});$(element).closest(".icalattachments").remove()})},true)});function loadActionBar(){var content=$("#ytActionBarContent");var params={module:"OSSMail",view:"MailActionBar",uid:rcmail.env.uid,folder:rcmail.env.mailbox,rcId:rcmail.env.user_id};window.crm.AppConnector.request(params).then(function(response){content.find(".ytHeader").html(response);$("#messagecontent").css("top",content.outerHeight()+$("#messageheader").outerHeight()+"px");registerEvents(content)})}function registerEvents(content){registerAddRecord(content);registerAddReletedRecord(content);registerSelectRecord(content);registerRemoveRecord(content);registerImportMail(content);var block=content.find(".ytHeader .data");content.find(".hideBtn").click(function(){var button=$(this);var icon=button.find(".glyphicon");if(button.data("type")=="0"){button.data("type","1");icon.removeClass("glyphicon-chevron-up").addClass("glyphicon-chevron-down")}else{button.data("type","0");icon.removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron-up")}block.toggle();$(window).trigger("resize")})}function registerImportMail(content){content.find(".importMail").click(function(e){window.crm.Vtiger_Helper_Js.showPnotify({text:window.crm.app.vtranslate("StartedDownloadingEmail"),type:"info"});window.crm.AppConnector.request({module:"OSSMail",action:"ImportMail",params:{uid:rcmail.env.uid,folder:rcmail.env.mailbox,rcId:rcmail.env.user_id}}).then(function(data){loadActionBar();window.crm.Vtiger_Helper_Js.showPnotify({text:window.crm.app.vtranslate("AddFindEmailInRecord"),type:"success"})})})}function registerRemoveRecord(content){content.find("button.removeRecord").click(function(e){var row=$(e.currentTarget).closest(".rowRelatedRecord");removeRecord(row.data("id"))})}function registerSelectRecord(content){let id=content.find("#mailActionBarID").val();content.find("button.selectRecord").click(function(e){let relParams={mailId:id};if($(this).data("type")==0){var module=$(this).closest(".col").find(".module").val()}else{var module=$(this).data("module");relParams.crmid=$(this).closest(".rowRelatedRecord").data("id");relParams.mod=$(this).closest(".rowRelatedRecord").data("module");relParams.newModule=module}showPopup({module:module,src_module:"OSSMailView",src_record:id},relParams)})}function registerAddReletedRecord(content){var id=content.find("#mailActionBarID").val();content.find("button.addRelatedRecord").click(function(e){var targetElement=$(e.currentTarget);var row=targetElement.closest(".rowRelatedRecord");var params={sourceModule:row.data("module")};showQuickCreateForm(targetElement.data("module"),row.data("id"),params)})}function registerAddRecord(content){var id=content.find("#mailActionBarID").val();content.find("button.addRecord").click(function(e){var col=$(e.currentTarget).closest(".col");showQuickCreateForm(col.find(".module").val(),id)})}function removeRecord(crmid){var id=$("#mailActionBarID").val();var params={};params.data={module:"OSSMail",action:"ExecuteActions",mode:"removeRelated",params:{mailId:id,crmid:crmid}};params.async=false;params.dataType="json";window.crm.AppConnector.request(params).then(function(data){var response=data["result"];if(response["success"]){var notifyParams={text:response["data"],type:"info",animation:"show"}}else{var notifyParams={text:response["data"],animation:"show"}}window.crm.Vtiger_Helper_Js.showPnotify(notifyParams);loadActionBar()})}function showPopup(params,actionsParams){actionsParams["newModule"]=params["module"];window.crm.app.showRecordsList(params,(modal,instance)=>{instance.setSelectEvent((responseData,e)=>{actionsParams["newCrmId"]=responseData.id;window.crm.AppConnector.request({async:false,dataType:"json",data:{module:"OSSMail",action:"ExecuteActions",mode:"addRelated",params:actionsParams}}).then(function(data){let response=data["result"];if(response["success"]){var notifyParams={text:response["data"],type:"info",animation:"show"}}else{var notifyParams={text:response["data"],animation:"show"}}window.crm.Vtiger_Helper_Js.showPnotify(notifyParams);loadActionBar()})})})}function showQuickCreateForm(moduleName,record,params){var content=$("#ytActionBarContent");if(params==undefined){var params={}}var relatedParams={};if(params["sourceModule"]){var sourceModule=params["sourceModule"]}else{var sourceModule="OSSMailView"}var postShown=function(data){var index,queryParam,queryParamComponents;$('').appendTo(data);$('').appendTo(data);$('').appendTo(data)};var ids={link:"modulesLevel0",process:"modulesLevel1",subprocess:"modulesLevel2",linkextend:"modulesLevel3"};for(var i in ids){var element=content.find("#"+ids[i]);var value=element.length?JSON.parse(element.val()):[];if($.inArray(sourceModule,value)>=0){relatedParams[i]=record}}if(moduleName=="Leads"){relatedParams["company"]=rcmail.env.fromName}if(moduleName=="Leads"||moduleName=="Contacts"){relatedParams["lastname"]=rcmail.env.fromName}if(moduleName=="Project"){relatedParams["projectname"]=rcmail.env.subject}if(moduleName=="HelpDesk"){relatedParams["ticket_title"]=rcmail.env.subject}if(moduleName=="Products"){relatedParams["productname"]=rcmail.env.subject}if(moduleName=="Services"){relatedParams["servicename"]=rcmail.env.subject}relatedParams["email"]=rcmail.env.fromMail;relatedParams["email1"]=rcmail.env.fromMail;relatedParams["description"]=$("#messagebody").text();var postQuickCreate=function(data){loadActionBar()};relatedParams["sourceModule"]=sourceModule;relatedParams["sourceRecord"]=record;relatedParams["relationOperation"]=true;var quickCreateParams={callbackFunction:postQuickCreate,callbackPostShown:postShown,data:relatedParams,noCache:true};var headerInstance=new window.crm.Vtiger_Header_Js;headerInstance.quickCreateModule(moduleName,quickCreateParams)}function getCrmWindow(){if(opener!==null){return opener.parent}else if(typeof parent.app=="object"){return parent}else if(typeof parent.parent.app=="object"){return parent.parent}return false} \ No newline at end of file +'use strict'; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { + return typeof obj; +} : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; +}; + +window.rcmail&&rcmail.addEventListener('init',function(){window.crm=getCrmWindow(),loadActionBar(),rcmail.env.message_commands.push('yetiforce.importICS'),rcmail.register_command('yetiforce.importICS',function(part,type){jQuery.ajax({type:'POST',url:'./?_task=mail&_action=plugin.yetiforce.importIcs&_mbox='+urlencode(rcmail.env.mailbox)+'&_uid='+urlencode(rcmail.env.uid)+'&_part='+part+'&_type='+type,async:!1,success:function success(data){data=JSON.parse(data),window.crm.Vtiger_Helper_Js.showPnotify({text:data.message,type:'info',animation:'show'});}});},!0);});function loadActionBar(){var content=$('#ytActionBarContent'),params={module:'OSSMail',view:'MailActionBar',uid:rcmail.env.uid,folder:rcmail.env.mailbox,rcId:rcmail.env.user_id};window.crm.AppConnector.request(params).done(function(response){content.find('.ytHeader').html(response),$('#messagecontent').css('top',content.outerHeight()+$('#messageheader').outerHeight()+'px'),registerEvents(content);});}function registerEvents(content){registerAddRecord(content),registerAddReletedRecord(content),registerSelectRecord(content),registerRemoveRecord(content),registerImportMail(content);var block=content.find('.ytHeader .js-data');content.find('.hideBtn').click(function(){var button=$(this),icon=button.find('.glyphicon');'0'==button.data('type')?(button.data('type','1'),icon.removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down')):(button.data('type','0'),icon.removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up')),block.toggle(),$(window).trigger('resize');});}function registerImportMail(content){content.find('.importMail').click(function(){window.crm.Vtiger_Helper_Js.showPnotify({text:window.crm.app.vtranslate('StartedDownloadingEmail'),type:'info'}),window.crm.AppConnector.request({module:'OSSMail',action:'ImportMail',uid:rcmail.env.uid,folder:rcmail.env.mailbox,rcId:rcmail.env.user_id}).done(function(){loadActionBar(),window.crm.Vtiger_Helper_Js.showPnotify({text:window.crm.app.vtranslate('AddFindEmailInRecord'),type:'success'});});});}function registerRemoveRecord(content){content.find('button.removeRecord').click(function(e){var row=$(e.currentTarget).closest('.rowRelatedRecord');removeRecord(row.data('id'));});}function registerSelectRecord(content){var id=content.find('#mailActionBarID').val();content.find('button.selectRecord').click(function(){var relParams={mailId:id};if(0==$(this).data('type')){var module=$(this).closest('.js-head-container').find('.module').val();if(null===module)return}else{var module=$(this).data('module');relParams.crmid=$(this).closest('.rowRelatedRecord').data('id'),relParams.mod=$(this).closest('.rowRelatedRecord').data('module'),relParams.newModule=module;}showPopup({module:module,src_module:'OSSMailView',src_record:id},relParams);});}function registerAddReletedRecord(content){content.find('#mailActionBarID').val();content.find('button.addRelatedRecord').click(function(e){var targetElement=$(e.currentTarget),row=targetElement.closest('.rowRelatedRecord'),params={sourceModule:row.data('module')};showQuickCreateForm(targetElement.data('module'),row.data('id'),params);});}function registerAddRecord(content){var id=content.find('#mailActionBarID').val();content.find('button.addRecord').click(function(e){var col=$(e.currentTarget).closest('.js-head-container'),selectValue=col.find('.module').val();null!==selectValue&&showQuickCreateForm(selectValue,id);});}function removeRecord(crmid){var id=$('#mailActionBarID').val(),params={};params.data={module:'OSSMail',action:'ExecuteActions',mode:'removeRelated',params:{mailId:id,crmid:crmid}},params.async=!1,params.dataType='json',window.crm.AppConnector.request(params).done(function(data){var response=data.result;if(response.success)var notifyParams={text:response.data,type:'info',animation:'show'};else var notifyParams={text:response.data,animation:'show'};window.crm.Vtiger_Helper_Js.showPnotify(notifyParams),loadActionBar();});}function showPopup(params,actionsParams){actionsParams.newModule=params.module,window.crm.app.showRecordsList(params,function(modal,instance){instance.setSelectEvent(function(responseData){actionsParams.newCrmId=responseData.id,window.crm.AppConnector.request({async:!1,dataType:'json',data:{module:'OSSMail',action:'ExecuteActions',mode:'addRelated',params:actionsParams}}).done(function(data){var response=data.result;if(response.success)var notifyParams={text:response.data,type:'info',animation:'show'};else var notifyParams={text:response.data,animation:'show'};window.crm.Vtiger_Helper_Js.showPnotify(notifyParams),loadActionBar();});});});}function showQuickCreateForm(moduleName,record,params){var content=$('#ytActionBarContent');var relatedParams={};if(false)var sourceModule=params.sourceModule;else var sourceModule='OSSMailView';var postShown=function(data){$('').appendTo(data),$('').appendTo(data),$('').appendTo(data);},ids={link:'modulesLevel0',process:'modulesLevel1',subprocess:'modulesLevel2',linkextend:'modulesLevel3'};for(var i in ids){var element=content.find('#'+ids[i]),value=element.length?JSON.parse(element.val()):[];0<=$.inArray(sourceModule,value)&&(relatedParams[i]=record);}'Leads'==moduleName&&(relatedParams.company=rcmail.env.fromName),('Leads'==moduleName||'Contacts'==moduleName)&&(relatedParams.lastname=rcmail.env.fromName),'Project'==moduleName&&(relatedParams.projectname=rcmail.env.subject),'HelpDesk'==moduleName&&(relatedParams.ticket_title=rcmail.env.subject),'Products'==moduleName&&(relatedParams.productname=rcmail.env.subject),'Services'==moduleName&&(relatedParams.servicename=rcmail.env.subject),relatedParams.email=rcmail.env.fromMail,relatedParams.email1=rcmail.env.fromMail,relatedParams.description=$('#messagebody').text();relatedParams.sourceModule=sourceModule,relatedParams.sourceRecord=record,relatedParams.relationOperation=!0;var headerInstance=new window.crm.Vtiger_Header_Js;headerInstance.quickCreateModule(moduleName,{callbackFunction:function postQuickCreate(){loadActionBar();},callbackPostShown:postShown,data:relatedParams,noCache:!0});}function getCrmWindow(){if(null!==opener&&'object'==opener.parent.CONFIG)return opener.parent;return 'object'==_typeof(parent.CONFIG)?parent:'object'==_typeof(parent.parent.CONFIG)?parent.parent:!('object'!=_typeof(opener.crm.CONFIG))&&opener.crm} +//# sourceMappingURL=preview.min.js.map diff --git a/plugins/yetiforce/preview.min.js.map b/plugins/yetiforce/preview.min.js.map new file mode 100644 index 00000000..28175f24 --- /dev/null +++ b/plugins/yetiforce/preview.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"preview.min.js","sources":["preview.js"],"sourcesContent":["/* {[The file is published on the basis of MIT License]} */\nwindow.rcmail && rcmail.addEventListener('init', function (evt) {\n\t\twindow.crm = getCrmWindow();\n\t\tloadActionBar();\n\t\trcmail.env.message_commands.push('yetiforce.importICS');\n\t\trcmail.register_command('yetiforce.importICS', function (part, type) {\n\t\t\tjQuery.ajax({\n\t\t\t\ttype: 'POST',\n\t\t\t\turl: \"./?_task=mail&_action=plugin.yetiforce.importIcs&_mbox=\" + urlencode(rcmail.env.mailbox) + '&_uid=' + urlencode(rcmail.env.uid) + '&_part=' + part + '&_type=' + type,\n\t\t\t\tasync: false,\n\t\t\t\tsuccess: function (data) {\n\t\t\t\t\tdata = JSON.parse(data);\n\t\t\t\t\twindow.crm.Vtiger_Helper_Js.showPnotify({\n\t\t\t\t\t\ttext: data['message'],\n\t\t\t\t\t\ttype: 'info',\n\t\t\t\t\t\tanimation: 'show'\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t}, true);\n\t}\n);\n\nfunction loadActionBar() {\n\tvar content = $('#ytActionBarContent');\n\tvar params = {\n\t\tmodule: 'OSSMail',\n\t\tview: 'MailActionBar',\n\t\tuid: rcmail.env.uid,\n\t\tfolder: rcmail.env.mailbox,\n\t\trcId: rcmail.env.user_id\n\t};\n\twindow.crm.AppConnector.request(params).done(function (response) {\n\t\tcontent.find('.ytHeader').html(response);\n\t\t$('#messagecontent').css('top', (content.outerHeight() + $('#messageheader').outerHeight()) + 'px');\n\t\tregisterEvents(content);\n\t});\n}\n\nfunction registerEvents(content) {\n\tregisterAddRecord(content);\n\tregisterAddReletedRecord(content);\n\tregisterSelectRecord(content);\n\tregisterRemoveRecord(content);\n\tregisterImportMail(content);\n\n\tvar block = content.find('.ytHeader .js-data');\n\tcontent.find('.hideBtn').click(function () {\n\t\tvar button = $(this);\n\t\tvar icon = button.find('.glyphicon');\n\n\t\tif (button.data('type') == '0') {\n\t\t\tbutton.data('type', '1');\n\t\t\ticon.removeClass(\"glyphicon-chevron-up\").addClass(\"glyphicon-chevron-down\");\n\t\t} else {\n\t\t\tbutton.data('type', '0');\n\t\t\ticon.removeClass(\"glyphicon-chevron-down\").addClass(\"glyphicon-chevron-up\");\n\t\t}\n\t\tblock.toggle();\n\t\t$(window).trigger(\"resize\");\n\t});\n}\n\nfunction registerImportMail(content) {\n\tcontent.find('.importMail').click(function (e) {\n\t\twindow.crm.Vtiger_Helper_Js.showPnotify({\n\t\t\ttext: window.crm.app.vtranslate('StartedDownloadingEmail'),\n\t\t\ttype: 'info'\n\t\t});\n\t\twindow.crm.AppConnector.request({\n\t\t\tmodule: 'OSSMail',\n\t\t\taction: 'ImportMail',\n\t\t\tuid: rcmail.env.uid,\n\t\t\tfolder: rcmail.env.mailbox,\n\t\t\trcId: rcmail.env.user_id\n\t\t}).done(function (data) {\n\t\t\tloadActionBar();\n\t\t\twindow.crm.Vtiger_Helper_Js.showPnotify({\n\t\t\t\ttext: window.crm.app.vtranslate('AddFindEmailInRecord'),\n\t\t\t\ttype: 'success'\n\t\t\t});\n\t\t})\n\t});\n}\n\nfunction registerRemoveRecord(content) {\n\tcontent.find('button.removeRecord').click(function (e) {\n\t\tvar row = $(e.currentTarget).closest('.rowRelatedRecord');\n\t\tremoveRecord(row.data('id'));\n\t});\n}\n\nfunction registerSelectRecord(content) {\n\tlet id = content.find('#mailActionBarID').val();\n\tcontent.find('button.selectRecord').click(function (e) {\n\t\tlet relParams = {\n\t\t\tmailId: id\n\t\t};\n\t\tif ($(this).data('type') == 0) {\n\t\t\tvar module = $(this).closest('.js-head-container').find('.module').val();\n\t\t\tif (module === null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else {\n\t\t\tvar module = $(this).data('module');\n\t\t\trelParams.crmid = $(this).closest('.rowRelatedRecord').data('id');\n\t\t\trelParams.mod = $(this).closest('.rowRelatedRecord').data('module');\n\t\t\trelParams.newModule = module;\n\t\t}\n\t\tshowPopup({\n\t\t\tmodule: module,\n\t\t\tsrc_module: 'OSSMailView',\n\t\t\tsrc_record: id,\n\t\t}, relParams);\n\t});\n}\n\nfunction registerAddReletedRecord(content) {\n\tvar id = content.find('#mailActionBarID').val();\n\tcontent.find('button.addRelatedRecord').click(function (e) {\n\t\tvar targetElement = $(e.currentTarget);\n\t\tvar row = targetElement.closest('.rowRelatedRecord');\n\t\tvar params = {sourceModule: row.data('module')};\n\t\tshowQuickCreateForm(targetElement.data('module'), row.data('id'), params);\n\t});\n}\n\nfunction registerAddRecord(content) {\n\tvar id = content.find('#mailActionBarID').val();\n\tcontent.find('button.addRecord').click(function (e) {\n\t\tvar col = $(e.currentTarget).closest('.js-head-container');\n\t\tlet selectValue = col.find('.module').val();\n\t\tif (selectValue !== null) {\n\t\t\tshowQuickCreateForm(selectValue, id);\n\t\t}\n\t});\n}\n\nfunction removeRecord(crmid) {\n\tvar id = $('#mailActionBarID').val();\n\tvar params = {}\n\tparams.data = {\n\t\tmodule: 'OSSMail',\n\t\taction: 'ExecuteActions',\n\t\tmode: 'removeRelated',\n\t\tparams: {\n\t\t\tmailId: id,\n\t\t\tcrmid: crmid\n\t\t}\n\t}\n\tparams.async = false;\n\tparams.dataType = 'json';\n\twindow.crm.AppConnector.request(params).done(function (data) {\n\t\tvar response = data['result'];\n\t\tif (response['success']) {\n\t\t\tvar notifyParams = {\n\t\t\t\ttext: response['data'],\n\t\t\t\ttype: 'info',\n\t\t\t\tanimation: 'show'\n\t\t\t};\n\t\t} else {\n\t\t\tvar notifyParams = {\n\t\t\t\ttext: response['data'],\n\t\t\t\tanimation: 'show'\n\t\t\t};\n\t\t}\n\t\twindow.crm.Vtiger_Helper_Js.showPnotify(notifyParams);\n\t\tloadActionBar();\n\t});\n}\n\nfunction showPopup(params, actionsParams) {\n\tactionsParams['newModule'] = params['module'];\n\twindow.crm.app.showRecordsList(params, (modal, instance) => {\n\t\tinstance.setSelectEvent((responseData, e) => {\n\t\t\tactionsParams['newCrmId'] = responseData.id;\n\t\t\twindow.crm.AppConnector.request({\n\t\t\t\tasync: false,\n\t\t\t\tdataType: 'json',\n\t\t\t\tdata: {\n\t\t\t\t\tmodule: 'OSSMail',\n\t\t\t\t\taction: 'ExecuteActions',\n\t\t\t\t\tmode: 'addRelated',\n\t\t\t\t\tparams: actionsParams\n\t\t\t\t}\n\t\t\t}).done(function (data) {\n\t\t\t\tlet response = data['result'];\n\t\t\t\tif (response['success']) {\n\t\t\t\t\tvar notifyParams = {\n\t\t\t\t\t\ttext: response['data'],\n\t\t\t\t\t\ttype: 'info',\n\t\t\t\t\t\tanimation: 'show'\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tvar notifyParams = {\n\t\t\t\t\t\ttext: response['data'],\n\t\t\t\t\t\tanimation: 'show'\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\twindow.crm.Vtiger_Helper_Js.showPnotify(notifyParams);\n\t\t\t\tloadActionBar();\n\t\t\t});\n\t\t});\n\t});\n}\n\nfunction showQuickCreateForm(moduleName, record, params) {\n\tvar content = $('#ytActionBarContent');\n\tif (params == undefined) {\n\t\tvar params = {};\n\t}\n\tvar relatedParams = {};\n\tif (params['sourceModule']) {\n\t\tvar sourceModule = params['sourceModule'];\n\t} else {\n\t\tvar sourceModule = 'OSSMailView';\n\t}\n\tvar postShown = function (data) {\n\t\tvar index, queryParam, queryParamComponents;\n\t\t$('').appendTo(data);\n\t\t$('').appendTo(data);\n\t\t$('').appendTo(data);\n\t}\n\tvar ids = {\n\t\tlink: 'modulesLevel0',\n\t\tprocess: 'modulesLevel1',\n\t\tsubprocess: 'modulesLevel2',\n\t\tlinkextend: 'modulesLevel3'\n\t};\n\tfor (var i in ids) {\n\t\tvar element = content.find('#' + ids[i]);\n\t\tvar value = element.length ? JSON.parse(element.val()) : [];\n\t\tif ($.inArray(sourceModule, value) >= 0) {\n\t\t\trelatedParams[i] = record;\n\t\t}\n\t}\n\tif (moduleName == 'Leads') {\n\t\trelatedParams['company'] = rcmail.env.fromName;\n\t}\n\tif (moduleName == 'Leads' || moduleName == 'Contacts') {\n\t\trelatedParams['lastname'] = rcmail.env.fromName;\n\t}\n\tif (moduleName == 'Project') {\n\t\trelatedParams['projectname'] = rcmail.env.subject;\n\t}\n\tif (moduleName == 'HelpDesk') {\n\t\trelatedParams['ticket_title'] = rcmail.env.subject;\n\t}\n\tif (moduleName == 'Products') {\n\t\trelatedParams['productname'] = rcmail.env.subject;\n\t}\n\tif (moduleName == 'Services') {\n\t\trelatedParams['servicename'] = rcmail.env.subject;\n\t}\n\trelatedParams['email'] = rcmail.env.fromMail;\n\trelatedParams['email1'] = rcmail.env.fromMail;\n\trelatedParams['description'] = $('#messagebody').text();\n\t//relatedParams['related_to'] = record;\n\tvar postQuickCreate = function (data) {\n\t\tloadActionBar();\n\t}\n\trelatedParams['sourceModule'] = sourceModule;\n\trelatedParams['sourceRecord'] = record;\n\trelatedParams['relationOperation'] = true;\n\tvar quickCreateParams = {\n\t\tcallbackFunction: postQuickCreate,\n\t\tcallbackPostShown: postShown,\n\t\tdata: relatedParams,\n\t\tnoCache: true\n\t};\n\tvar headerInstance = new window.crm.Vtiger_Header_Js();\n\theaderInstance.quickCreateModule(moduleName, quickCreateParams);\n}\n\nfunction getCrmWindow() {\n\tif (opener !== null && opener.parent.CONFIG == \"object\") {\n\t\treturn opener.parent;\n\t} else if (typeof parent.CONFIG == \"object\") {\n\t\treturn parent;\n\t} else if (typeof parent.parent.CONFIG == \"object\") {\n\t\treturn parent.parent;\n\t} else if (typeof opener.crm.CONFIG == \"object\") {\n\t\treturn opener.crm;\n\t}\n\treturn false;\n}\n"],"names":["window","rcmail","addEventListener","crm","getCrmWindow","loadActionBar","env","message_commands","push","register_command","part","type","jQuery","ajax","url","urlencode","mailbox","uid","async","success","data","JSON","parse","Vtiger_Helper_Js","showPnotify","text","animation","$","params","module","view","folder","rcId","user_id","AppConnector","request","done","response","content","find","html","css","outerHeight","registerEvents","registerAddRecord","registerAddReletedRecord","registerSelectRecord","registerRemoveRecord","registerImportMail","click","icon","button","removeClass","addClass","block","toggle","trigger","app","vtranslate","action","e","currentTarget","closest","removeRecord","row","val","mailId","id","relParams","crmid","mod","newModule","showPopup","src_module","src_record","targetElement","sourceModule","showQuickCreateForm","selectValue","col","mode","dataType","notifyParams","actionsParams","showRecordsList","modal","instance","setSelectEvent","responseData","moduleName","record","appendTo","ids","link","process","subprocess","linkextend","i","value","element","length","inArray","relatedParams","fromName","subject","fromMail","Vtiger_Header_Js","headerInstance","quickCreateModule","callbackFunction","callbackPostShown","postShown","noCache","parent","CONFIG","opener"],"mappings":";;;;;;;;AACAA,OAAOC,MAAP,EAAiBA,OAAOC,gBAAP,CAAwB,MAAxB,CAAgC,UAAe,CAC9DF,OAAOG,GAAP,CAAaC,cADiD,CAE9DC,eAF8D,CAG9DJ,OAAOK,GAAP,CAAWC,gBAAX,CAA4BC,IAA5B,CAAiC,qBAAjC,CAH8D,CAI9DP,OAAOQ,gBAAP,CAAwB,qBAAxB,CAA+C,SAAUC,IAAV,CAAgBC,IAAhB,CAAsB,CACpEC,OAAOC,IAAP,CAAY,CACXF,KAAM,MADK,CAEXG,IAAK,0DAA4DC,UAAUd,OAAOK,GAAP,CAAWU,OAArB,CAA5D,CAA4F,QAA5F,CAAuGD,UAAUd,OAAOK,GAAP,CAAWW,GAArB,CAAvG,CAAmI,SAAnI,CAA+IP,IAA/I,CAAsJ,SAAtJ,CAAkKC,IAF5J,CAGXO,QAHW,CAIXC,QAAS,iBAAUC,IAAV,CAAgB,CACxBA,KAAOC,KAAKC,KAAL,CAAWF,IAAX,CADiB,CAExBpB,OAAOG,GAAP,CAAWoB,gBAAX,CAA4BC,WAA5B,CAAwC,CACvCC,KAAML,YADiC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B,iBAPqB,wBAAA,EAAgB,CACrCxG,gBACA,CAIuB,CAEvByG,kBAAmBC,SAFI,CAGvB3F,KAAMkF,aAHiB,CAIvBU,UAJuB,CAOxB,EACA,CAED,qBAAA,EAAwB,CACvB,GAAe,IAAX,WAA2C,QAAxB,SAAOC,MAAP,CAAcC,MAArC,CACC,cAAcD,MAAd,CAFsB,OAGY,QAAxB,UAAOA,OAAOC,MAAd,CAHY,CAIfD,MAJe,CAKmB,QAA/B,UAAOA,OAAOA,MAAP,CAAcC,MAArB,CALY,CAMfD,OAAOA,MANQ,GAOgB,QAA5B,UAAOE,OAAOhH,GAAP,CAAW+G,MAAlB,CAPY,GAQfC,OAAOhH,GAGf"} \ No newline at end of file diff --git a/plugins/yetiforce/yetiforce.php b/plugins/yetiforce/yetiforce.php index 2296ca66..df94a6b4 100644 --- a/plugins/yetiforce/yetiforce.php +++ b/plugins/yetiforce/yetiforce.php @@ -12,6 +12,14 @@ class yetiforce extends rcube_plugin private $autologin; private $currentUser; private $viewData = []; + /** + * @var array + */ + private $message = []; + /** + * @var array + */ + private $icsParts = []; public function init() { @@ -23,8 +31,10 @@ public function init() $this->register_action('plugin.yetiforce.addFilesToMail', [$this, 'addFilesToMail']); $this->register_action('plugin.yetiforce.getEmailTemplates', [$this, 'getEmailTemplates']); $this->register_action('plugin.yetiforce.getConntentEmailTemplate', [$this, 'getConntentEmailTemplate']); + $this->register_action('plugin.yetiforce.importIcs', [$this, 'importIcs']); $this->rc->output->set_env('site_URL', $this->rc->config->get('site_URL')); - $this->include_stylesheet($this->rc->config->get('public_URL') . 'layouts/resources/icons/userIcons.css'); + $this->include_stylesheet('../../../../../layouts/resources/icons/userIcons.css'); + $this->add_texts('localization/', false); $currentPath = getcwd(); chdir($this->rc->config->get('root_directory')); @@ -40,7 +50,6 @@ public function init() $this->viewData['compose']['composeAddressModules'] = $composeAddressModules; $this->rc->output->set_env('isPermittedMailTemplates', \App\Privilege::isPermitted('EmailTemplates')); - $this->add_texts('localization/', false); $this->include_script('compose.js'); $this->add_hook('message_compose_body', [$this, 'messageComposeBody']); @@ -61,15 +70,14 @@ public function init() } if ($this->rc->action === 'preview' || $this->rc->action === 'show') { $this->include_script('preview.js'); - $this->include_stylesheet($this->rc->config->get('public_URL') . 'libraries/fontawesome-web/css/fontawesome-all.css'); + $this->include_stylesheet('../../../../../libraries/@fortawesome/fontawesome-free/css/all.css'); $this->include_stylesheet('preview.css'); $this->add_hook('message_load', [$this, 'messageLoad']); + $this->add_hook('template_object_messageattachments', [$this, 'appendIcsPreview']); } if (empty($this->rc->action)) { //$this->add_hook('preferences_save', array($this, 'prefsSave')); - $this->include_script('colResizable.js'); - $this->include_script('list.js'); } chdir($currentPath); } @@ -182,6 +190,7 @@ public function messageLoad($args) } $this->rc->output->set_env('fromName', $fromName); $this->rc->output->set_env('fromMail', $fromMail); + $this->setIcsData($args); } public function messageComposeHead($args) @@ -609,6 +618,7 @@ protected function loadCurrentUser() require 'include/main/WebUI.php'; $this->currentUser = \App\User::getUserModel($_SESSION['crm']['id']); App\User::setCurrentUserId($_SESSION['crm']['id']); + \App\Language::setTemporaryLanguage($this->currentUser->getDetail('language')); return true; } @@ -665,4 +675,170 @@ public function getConntentEmailTemplate() chdir($currentPath); exit; } + + /** + * Set ics data. + * + * @param array $args + */ + public function setIcsData(array $args) + { + $this->message = $args['object']; + foreach ((array) $this->message->attachments as $attachment) { + if ($attachment->mimetype === 'application/ics' || $attachment->mimetype === 'text/calendar') { + $this->icsParts[] = ['part' => $attachment->mime_id, 'uid' => $this->message->uid, 'type' => 'attachments']; + } + } + foreach ((array) $this->message->parts as $part) { + if ($part->mimetype === 'application/ics' || $part->mimetype === 'text/calendar') { + $this->icsParts[] = ['part' => $part->mime_id, 'uid' => $this->message->uid, 'type' => 'parts']; + } + } + } + + /** + * Append ical preview in attachments' area. + * + * @param array $args + * + * @return mixed + */ + public function appendIcsPreview($args) + { + $ics = []; + $currentPath = getcwd(); + chdir($this->rc->config->get('root_directory')); + $this->loadCurrentUser(); + $counterBtn = $counterList = []; + foreach ($this->icsParts as $icsPart) { + $icsContent = $this->message->get_part_content($icsPart['part'], null, true); + $calendar = \App\Integrations\Dav\Calendar::loadFromContent($icsContent); + foreach ($calendar->getRecordInstance() as $key => $recordModel) { + if (!isset($ics[$key])) { + $ics[$key] = [$recordModel, $icsPart]; + if (isset($counterBtn[$icsPart['part']])) { + $counterBtn[$icsPart['part']]++; + } else { + $counterBtn[$icsPart['part']] = 1; + } + } + } + } + $showPart = []; + $translationMod = 'Calendar'; + $showMore = false; + foreach ($ics as $data) { + $evTemplate = '
    '; + [$record, $icsPart] = $data; + $fields = ''; + if (!$record->isEmpty('date_start')) { + $dateStart = $record->getDisplayValue('date_start'); + $dateStartLabel = \App\Language::translate('LBL_START'); + $fields .= "
    $dateStartLabel: $dateStart
    "; + } + if (!$record->isEmpty('due_date')) { + $dueDate = $record->getDisplayValue('due_date'); + $dueDateLabel = \App\Language::translate('LBL_END'); + $fields .= "
    $dueDateLabel: $dueDate
    "; + } + if ($location = $record->getDisplayValue('location', false, false, 100)) { + $locationLabel = \App\Language::translate('Location', $translationMod); + $fields .= "
    $locationLabel: $location
    "; + } + if ($status = $record->getDisplayValue('activitystatus')) { + $statusLabel = \App\Language::translate('LBL_STATUS', $translationMod); + $fields .= "
    $statusLabel: $status
    "; + } + if ($type = $record->getDisplayValue('activitytype')) { + $typeLabel = \App\Language::translate('Activity Type', $translationMod); + $fields .= "
    $typeLabel: $type
    "; + } + if ($allday = $record->getDisplayValue('allday')) { + $alldayLabel = \App\Language::translate('All day', $translationMod); + $fields .= "
    $alldayLabel: $allday
    "; + } + if ($visibility = $record->getDisplayValue('visibility')) { + $visibilityLabel = \App\Language::translate('Visibility', $translationMod); + $fields .= "
    $visibilityLabel: $visibility
    "; + } + if ($priority = $record->getDisplayValue('taskpriority')) { + $label = \App\Language::translate('Priority', $translationMod); + $fields .= "
    $label: $priority
    "; + } + if ($state = $record->getDisplayValue('state')) { + $label = \App\Language::translate('LBL_STATE', $translationMod); + $fields .= "
    $label: $state
    "; + } + if ($description = $record->getDisplayValue('description', false, false, 100)) { + $descriptionLabel = \App\Language::translate('Description', $translationMod); + $fields .= "
    $descriptionLabel: $description
    "; + } + $evTemplate .= "
    +

    {$record->getDisplayValue('subject')}

    +
    + $fields +
    +
    "; + $evTemplate .= '
    '; + if (!isset($showPart[$icsPart['part']]) && \App\Privilege::isPermitted('Calendar', 'CreateView')) { + $showPart[$icsPart['part']] = $icsPart['part']; + $title = \App\Language::translate('LBL_ADD_TO_MY_CALENDAR', 'OSSMail'); + $counterText = empty($counterBtn[$icsPart['part']]) ? '' : ($counterBtn[$icsPart['part']] > 1 ? " ({$counterBtn[$icsPart['part']]})" : ''); + $args['content'] .= + html::p(['class' => ''], + html::a([ + 'href' => 'javascript:void', + 'class' => 'button', + 'onclick' => "return rcmail.command('yetiforce.importICS',{$icsPart['part']},'{$icsPart['type']}')", + 'title' => $title, + ], html::span(null, "{$title}{$counterText}")) + ) . html::div(null, $evTemplate); + } elseif ($counterList[$icsPart['part']] < 4) { + $args['content'] .= html::div(null, $evTemplate); + } else { + $showMore = true; + } + if (isset($counterList[$icsPart['part']])) { + $counterList[$icsPart['part']]++; + } else { + $counterList[$icsPart['part']] = 1; + } + } + if ($showMore) { + $args['content'] .= html::div(null, '...'); + } + chdir($currentPath); + return $args; + } + + public function importIcs() + { + if (\App\Privilege::isPermitted('Calendar', 'CreateView')) { + $uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_GPC); + $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_GPC); + $mime_id = rcube_utils::get_input_value('_part', rcube_utils::INPUT_GPC); + $status = 0; + if ($uid && $mbox && $mime_id) { + $currentPath = getcwd(); + chdir($this->rc->config->get('root_directory')); + $this->loadCurrentUser(); + $message = new rcube_message($uid, $mbox); + $calendar = \App\Integrations\Dav\Calendar::loadFromContent($message->get_part_body($mime_id)); + foreach ($calendar->getRecordInstance() as $key => $recordModel) { + $recordModel->set('assigned_user_id', $this->currentUser->getId()); + $recordModel->save(); + if ($recordModel->getId()) { + $status++; + } + } + chdir($currentPath); + } + $message = ['message' => $status ? \App\Language::translateArgs('LBL_FILE_HAS_BEEN_IMPORTED', 'OSSMail', $status) : \App\Language::translate('LBL_ERROR_OCCURRED_DURING_IMPORT', 'OSSMail'), + ]; + } else { + $message = ['message' => \App\Language::translate('LBL_PERMISSION_DENIED')]; + } + echo App\Json::encode($message); + exit; + } } diff --git a/skins/yetiforce/templates/message.html b/skins/yetiforce/templates/message.html index 312b79b0..649d2109 100644 --- a/skins/yetiforce/templates/message.html +++ b/skins/yetiforce/templates/message.html @@ -76,7 +76,7 @@

    :

    - +
    diff --git a/skins/yetiforce/templates/messagepreview.html b/skins/yetiforce/templates/messagepreview.html index 7b5ec6db..83f62313 100644 --- a/skins/yetiforce/templates/messagepreview.html +++ b/skins/yetiforce/templates/messagepreview.html @@ -44,16 +44,16 @@

    < - + - +
    - + diff --git a/skins/yetiforce/yetiforce.css b/skins/yetiforce/yetiforce.css index 9e92f895..81a41a5e 100644 --- a/skins/yetiforce/yetiforce.css +++ b/skins/yetiforce/yetiforce.css @@ -192,10 +192,6 @@ table.messagelist.fixedcopy { flex-wrap: wrap; } -.rowRelatedRecord { - padding: 2px; -} - .action-bar__head__container { column-width: 310px; } @@ -203,18 +199,15 @@ table.messagelist.fixedcopy { .action-bar__data a { text-decoration: none; color: #000; - font-size: 14px; line-height: 14px } .action-bar__header { - font-size: 14px; - min-width: 90px; + font-size: 13px; } .action-bar__head { background-color: #4a5364; - height: 20px; color: #fff; padding: 2px; } diff --git a/skins/yetiforce/yetiforce.min.css b/skins/yetiforce/yetiforce.min.css index 9e92f895..8bacb074 100644 --- a/skins/yetiforce/yetiforce.min.css +++ b/skins/yetiforce/yetiforce.min.css @@ -1,220 +1 @@ -/** The file is published on the basis of YetiForce Public License that can be found in the following directory: licenses/License.html */ -#footer { - position: absolute; - left: 10px; - right: 10px; - bottom: 0px; - text-align: center; - color: #000; -} - -#footer a { - color: #000; - text-decoration: none; -} - -#footer a:hover { - text-decoration: underline; -} - -#footer #taskbar a { - padding: 0; - height: 20px; - background: none; -} - -#footer #taskbar a span.button-inner { - zoom: 0.8; -} - -#footer #taskbar .tooltip { - top: -16px; - display: none; -} - -#footer #taskbar a:hover .tooltip { - right: -10px; - display: block; -} - -#footer #taskbar .tooltip:after { - top: 18px; - right: 15px; - -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)"; - -webkit-transform: rotate(180deg); - -ms-transform: rotate(180deg); - transform: rotate(180deg); -} - -#taskbar .button-inner { - top: 0px; -} - -#footer #taskbar { - padding-right: 0; -} - -#footer .topleft, #footer .username { - padding-top: 3px; -} - -#mainscreen { - top: 10px !important; - left: 5px; - right: 5px; -} - -body { - background: #dadada; -} - -#yt_adress_buttons { - margin-top: 3px; - top: 0px !important; -} - -#yt_adress_buttons .button { - cursor: pointer; - color: #000; - font-weight: bold; -} - -.verticalPanel #mailview-bottom, -.verticalPanel #mailview-top { - height: 100% !important; - top: 0px !important; -} - -@media only screen and (max-width: 1040px) { - .col-4 { - float: left; - width: 100% !important; - } - - .head { - height: auto !important; - padding-bottom: 2px; - } - - .relatedName { - font-size: 12px; - } -} - -table.messagelist.fixedcopy { - position: absolute !important; -} - -.chevronBtnCube { - position: absolute; - z-index: 1; -} - -.chevronBtnCube .hideBtn { - padding-left: 2px; - padding-right: 2px; -} - -#mailpreviewtogglebtn { - position: absolute; - top: 6px; - right: 10px; -} - -.mailpreviewtoggle { - display: inline-block; - text-decoration: none; - padding: 1px 3px; - width: 16px; - height: 14px; - vertical-align: middle; - font-weight: bold; - background: #d8d8d8; - background: -moz-linear-gradient(top, #d8d8d8 0, #bababa 100%); - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #d8d8d8), color-stop(100%, #bababa)); - background: -o-linear-gradient(top, #d8d8d8 0, #bababa 100%); - background: -ms-linear-gradient(top, #d8d8d8 0, #bababa 100%); - background: linear-gradient(to bottom, #d8d8d8 0, #bababa 100%); - box-shadow: 0 1px 1px 0 #999; - -webkit-box-shadow: 0 1px 1px 0 #999; - margin: 0 2px; - color: #525252; - text-shadow: 0 1px 1px #fff; - border: 1px solid #e6e6e6; - border-radius: 4px; -} - -.mailpreviewtoggle .inner { - width: 16px; - height: 13px; - display: inline-block; - background: url(images/buttons.png?v=51d4.15699) no-repeat; -} - -.mailpreviewtoggle.verticalBtn .inner { - background-position: -6px -226px; -} - -.mailpreviewtoggle.verticalBtn.enabled .inner { - background-position: -28px -226px; -} - -.mailpreviewtoggle.horizontalBtn .inner { - background-position: -7px -241px; -} - -.mailpreviewtoggle.horizontalBtn.enabled .inner { - background-position: -28px -242px; -} - -#composeview-right { - left: 0; -} - -.action-bar { - background: #ecf6ff; -} - -.mr-5px { - margin-right: 5px; -} - -.ml-5px { - margin-left: 5px; -} - -.w-100 { - width: 100%; -} - -.flex-wrap { - display: flex; - flex-wrap: wrap; -} - -.rowRelatedRecord { - padding: 2px; -} - -.action-bar__head__container { - column-width: 310px; -} - -.action-bar__data a { - text-decoration: none; - color: #000; - font-size: 14px; - line-height: 14px -} - -.action-bar__header { - font-size: 14px; - min-width: 90px; -} - -.action-bar__head { - background-color: #4a5364; - height: 20px; - color: #fff; - padding: 2px; -} +#footer{position:absolute;left:10px;right:10px;bottom:0;text-align:center;color:#000}#footer a{color:#000;text-decoration:none}#footer a:hover{text-decoration:underline}#footer #taskbar a{padding:0;height:20px;background:0}#footer #taskbar a span.button-inner{zoom:.8}#footer #taskbar .tooltip{top:-16px;display:none}#footer #taskbar a:hover .tooltip{right:-10px;display:block}#footer #taskbar .tooltip:after{top:18px;right:15px;-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}#taskbar .button-inner{top:0}#footer #taskbar{padding-right:0}#footer .topleft,#footer .username{padding-top:3px}#mainscreen{top:10px !important;left:5px;right:5px}body{background:#dadada}#yt_adress_buttons{margin-top:3px;top:0 !important}#yt_adress_buttons .button{cursor:pointer;color:#000;font-weight:bold}.verticalPanel #mailview-bottom,.verticalPanel #mailview-top{height:100% !important;top:0 !important}@media only screen and (max-width:1040px){.col-4{float:left;width:100% !important}.head{height:auto !important;padding-bottom:2px}.relatedName{font-size:12px}}table.messagelist.fixedcopy{position:absolute !important}.chevronBtnCube{position:absolute;z-index:1}.chevronBtnCube .hideBtn{padding-left:2px;padding-right:2px}#mailpreviewtogglebtn{position:absolute;top:6px;right:10px}.mailpreviewtoggle{display:inline-block;text-decoration:none;padding:1px 3px;width:16px;height:14px;vertical-align:middle;font-weight:bold;background:#d8d8d8;background:-moz-linear-gradient(top,#d8d8d8 0,#bababa 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0,#d8d8d8),color-stop(100%,#bababa));background:-o-linear-gradient(top,#d8d8d8 0,#bababa 100%);background:-ms-linear-gradient(top,#d8d8d8 0,#bababa 100%);background:linear-gradient(to bottom,#d8d8d8 0,#bababa 100%);box-shadow:0 1px 1px 0 #999;-webkit-box-shadow:0 1px 1px 0 #999;margin:0 2px;color:#525252;text-shadow:0 1px 1px #fff;border:1px solid #e6e6e6;border-radius:4px}.mailpreviewtoggle .inner{width:16px;height:13px;display:inline-block;background:url(images/buttons.png?v=51d4.15699) no-repeat}.mailpreviewtoggle.verticalBtn .inner{background-position:-6px -226px}.mailpreviewtoggle.verticalBtn.enabled .inner{background-position:-28px -226px}.mailpreviewtoggle.horizontalBtn .inner{background-position:-7px -241px}.mailpreviewtoggle.horizontalBtn.enabled .inner{background-position:-28px -242px}#composeview-right{left:0}.action-bar{background:#ecf6ff}.mr-5px{margin-right:5px}.ml-5px{margin-left:5px}.w-100{width:100%}.flex-wrap{display:flex;flex-wrap:wrap}.action-bar__head__container{column-width:310px}.action-bar__data a{text-decoration:none;color:#000;line-height:14px}.action-bar__header{font-size:13px}.action-bar__head{background-color:#4a5364;color:#fff;padding:2px} \ No newline at end of file diff --git a/version.php b/version.php index b9b49dfe..7624355d 100644 --- a/version.php +++ b/version.php @@ -1,5 +1,5 @@ '2018.08.22', - 'version' => '0.0.54' + 'patch' => '2019.02.06', + 'version' => '0.0.66' ];