From 64282d25730f320738098d78bb06796088105529 Mon Sep 17 00:00:00 2001 From: Mariusz Krzaczkowski Date: Wed, 6 Dec 2017 12:40:53 +0100 Subject: [PATCH] Improved mail bar for new field --- plugins/yetiforce/preview.css | 6 +++--- plugins/yetiforce/preview.js | 3 +-- plugins/yetiforce/preview.min.css | 2 +- plugins/yetiforce/preview.min.js | 2 +- version.php | 4 ++-- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/plugins/yetiforce/preview.css b/plugins/yetiforce/preview.css index 1a6f451d..6d5f82d9 100644 --- a/plugins/yetiforce/preview.css +++ b/plugins/yetiforce/preview.css @@ -7,8 +7,8 @@ #ytActionBarContent .col{ padding-left: 4px; } -#ytActionBarContent .col-4{ - width: 33.33333333%; +#ytActionBarContent .col-3{ + width: 25%; min-height: 1px; float: left; position: relative; @@ -63,7 +63,7 @@ line-height: 11px; margin-left: 3px; padding: 0px 6px; - height: 18px; + height: 14px; } #ytActionBarContent .pull-right button .glyphicon{ top: 0; diff --git a/plugins/yetiforce/preview.js b/plugins/yetiforce/preview.js index 59e51ce5..c7df04cf 100644 --- a/plugins/yetiforce/preview.js +++ b/plugins/yetiforce/preview.js @@ -223,7 +223,7 @@ function showQuickCreateForm(moduleName, record, params) { $('').appendTo(data); $('').appendTo(data); } - var ids = {link: 'modulesLevel0', process: 'modulesLevel1', subprocess: 'modulesLevel2'}; + 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()) : []; @@ -256,7 +256,6 @@ function showQuickCreateForm(moduleName, record, params) { var postQuickCreate = function (data) { loadActionBar(); } - relatedParams['sourceModule'] = sourceModule; relatedParams['sourceRecord'] = record; relatedParams['relationOperation'] = true; diff --git a/plugins/yetiforce/preview.min.css b/plugins/yetiforce/preview.min.css index eb6d2b18..26f5c168 100644 --- a/plugins/yetiforce/preview.min.css +++ b/plugins/yetiforce/preview.min.css @@ -1,2 +1,2 @@ -.pull-right{float:right!important}#ytActionBarContent select{padding:0}#ytActionBarContent .col{padding-left:4px}#ytActionBarContent .col-4{width:33.33333333%;min-height:1px;float:left;position:relative}#ytActionBarContent .row:before{display:table;content:" "}#ytActionBarContent .row:after{clear:both;display:table;content:" "}#ytActionBarContent .ytHeader{position:relative;border-bottom:1px solid #69a3cb}#ytActionBarContent .head{color:#fff;background-color:#4979aa;height:20px;padding-top:2px}#ytActionBarContent .data{color:#000;background:#ecf6ff}#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:11px;margin-left:3px;padding:0 6px;height:18px}#ytActionBarContent .pull-right button .glyphicon{top:0}#ytActionBarContent .data a{text-decoration:none;color:#000;font-size:14px;line-height:14px}#ytActionBarContent .relatedModuleIcon{margin-right:5px} \ No newline at end of file +.pull-right{float:right!important}#ytActionBarContent select{padding:0}#ytActionBarContent .col{padding-left:4px}#ytActionBarContent .col-3{width:25%;min-height:1px;float:left;position:relative}#ytActionBarContent .row:before{display:table;content:" "}#ytActionBarContent .row:after{clear:both;display:table;content:" "}#ytActionBarContent .ytHeader{position:relative;border-bottom:1px solid #69a3cb}#ytActionBarContent .head{color:#fff;background-color:#4979aa;height:20px;padding-top:2px}#ytActionBarContent .data{color:#000;background:#ecf6ff}#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:11px;margin-left:3px;padding:0 6px;height:14px}#ytActionBarContent .pull-right button .glyphicon{top:0}#ytActionBarContent .data a{text-decoration:none;color:#000;font-size:14px;line-height:14px}#ytActionBarContent .relatedModuleIcon{margin-right:5px} \ No newline at end of file diff --git a/plugins/yetiforce/preview.min.js b/plugins/yetiforce/preview.min.js index 96a8d000..5755568b 100644 --- a/plugins/yetiforce/preview.min.js +++ b/plugins/yetiforce/preview.min.js @@ -1,2 +1,2 @@ -window.rcmail&&rcmail.addEventListener("init",function(a){window.crm=getCrmWindow();loadActionBar();rcmail.env.message_commands.push("yetiforce.importICS");rcmail.register_command("yetiforce.importICS",function(b,c,d){window.crm.AppConnector.request({async:true,dataType:"json",data:{module:"Calendar",action:"ImportICS",ics:b}}).then(function(e){window.crm.Vtiger_Helper_Js.showPnotify({text:e.result,type:"info",animation:"show"});$(c).closest(".icalattachments").remove()})},true)});function loadActionBar(){var a=$("#ytActionBarContent");var b={module:"OSSMail",view:"MailActionBar",uid:rcmail.env.uid,folder:rcmail.env.mailbox,rcId:rcmail.env.user_id};window.crm.AppConnector.request(b).then(function(c){a.find(".ytHeader").html(c);$("#messagecontent").css("top",(a.outerHeight()+$("#messageheader").outerHeight())+"px");registerEvents(a)})}function registerEvents(a){registerAddRecord(a);registerAddReletedRecord(a);registerSelectRecord(a);registerRemoveRecord(a);registerImportMail(a);var b=a.find(".ytHeader .data");a.find(".hideBtn").click(function(){var c=$(this);var d=c.find(".glyphicon");if(c.data("type")=="0"){c.data("type","1");d.removeClass("glyphicon-chevron-up").addClass("glyphicon-chevron-down")}else{c.data("type","0");d.removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron-up")}b.toggle();$(window).trigger("resize")})}function registerImportMail(a){a.find(".importMail").click(function(b){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(c){loadActionBar();window.crm.Vtiger_Helper_Js.showPnotify({text:window.crm.app.vtranslate("AddFindEmailInRecord"),type:"success"})})})}function registerRemoveRecord(a){a.find("button.removeRecord").click(function(b){var c=$(b.currentTarget).closest(".rowRelatedRecord");removeRecord(c.data("id"))})}function registerSelectRecord(a){var b=a.find("#mailActionBarID").val();a.find("button.selectRecord").click(function(f){var d=jQuery('input[name="tempField"]');var h={mailId:b};if($(this).data("type")==0){var c=$(this).closest(".col").find(".module").val()}else{var c=$(this).data("module");h.crmid=$(this).closest(".rowRelatedRecord").data("id");h.mod=$(this).closest(".rowRelatedRecord").data("module");h.newModule=c}var g={module:c,src_module:c,src_field:"tempField",src_record:"",url:rcmail.env.site_URL+"index.php?"};showPopup(g,d,h)})}function registerAddReletedRecord(a){var b=a.find("#mailActionBarID").val();a.find("button.addRelatedRecord").click(function(d){var c=$(d.currentTarget);var g=c.closest(".rowRelatedRecord");var f={sourceModule:g.data("module")};showQuickCreateForm(c.data("module"),g.data("id"),f)})}function registerAddRecord(a){var b=a.find("#mailActionBarID").val();a.find("button.addRecord").click(function(d){var c=$(d.currentTarget).closest(".col");showQuickCreateForm(c.find(".module").val(),b)})}function removeRecord(a){var c=$("#mailActionBarID").val();var b={};b.data={module:"OSSMail",action:"ExecuteActions",mode:"removeRelated",params:{mailId:c,crmid:a}};b.async=false;b.dataType="json";window.crm.AppConnector.request(b).then(function(f){var e=f.result;if(e.success){var d={text:e.data,type:"info",animation:"show"}}else{var d={text:e.data,animation:"show"}}window.crm.Vtiger_Helper_Js.showPnotify(d);loadActionBar()})}function showPopup(e,c,d){d.newModule=e.module;var a=jQuery.Event(window.crm.Vtiger_Edit_Js.preReferencePopUpOpenEvent);c.trigger(a);var b={};show(e,function(g){var f=JSON.parse(g);for(var i in f){var g={name:f[i].name,id:i};c.val(g.id)}d.newCrmId=g.id;var h={};h.data={module:"OSSMail",action:"ExecuteActions",mode:"addRelated",params:d};h.async=false;h.dataType="json";window.crm.AppConnector.request(h).then(function(l){var k=l.result;if(k.success){var j={text:k.data,type:"info",animation:"show"}}else{var j={text:k.data,animation:"show"}}window.crm.Vtiger_Helper_Js.showPnotify(j);loadActionBar()})})}function showQuickCreateForm(b,h,d){var k=$("#ytActionBarContent");if(d==undefined){var d={}}var e={};if(d.sourceModule){var j=d.sourceModule}else{var j="OSSMailView"}var o=function(q){var i,p,r;$('').appendTo(q);$('').appendTo(q);$('').appendTo(q)};var a={link:"modulesLevel0",process:"modulesLevel1",subprocess:"modulesLevel2"};for(var g in a){var f=k.find("#"+a[g]);var n=f.length?JSON.parse(f.val()):[];if($.inArray(j,n)>=0){e[g]=h}}if(b=="Leads"){e.company=rcmail.env.fromName}if(b=="Leads"||b=="Contacts"){e.lastname=rcmail.env.fromName}if(b=="Project"){e.projectname=rcmail.env.subject}if(b=="HelpDesk"){e.ticket_title=rcmail.env.subject}if(b=="Products"){e.productname=rcmail.env.subject}if(b=="Services"){e.servicename=rcmail.env.subject}e.email=rcmail.env.fromMail;e.email1=rcmail.env.fromMail;e.description=$("#messagebody").text();var m=function(i){loadActionBar()};e.sourceModule=j;e.sourceRecord=h;e.relationOperation=true;var c={callbackFunction:m,callbackPostShown:o,data:e,noCache:true};var l=new window.crm.Vtiger_Header_Js();l.quickCreateModule(b,c)}function show(c,d,i,f,b){var h=window.crm.Vtiger_Popup_Js.getInstance();if(typeof c=="undefined"){c={}}if(typeof c=="object"&&(typeof c.view=="undefined")){c.view="Popup"}if(typeof f=="undefined"){f="postSelection"+Math.floor(Math.random()*10000)}if(typeof i=="undefined"){i="test"}if(typeof c=="object"){c.triggerEventName=f}else{c+="&triggerEventName="+f}var e=(typeof c=="string")?c:window.crm.jQuery.param(c);var a=c.url+e;var g=window.crm.window.open(a,i,"width=800,height=650,resizable=0,scrollbars=1");if(typeof h.destroy=="function"){h.destroy()}window.crm.jQuery.initWindowMsg();if(typeof d!="undefined"){h.retrieveSelectedRecords(d,f)}if(typeof b=="function"){window.crm.jQuery.windowMsg("Vtiger.OnPopupWindowLoad.Event",function(j){b(j)})}return g}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 +window.rcmail&&rcmail.addEventListener("init",function(a){window.crm=getCrmWindow();loadActionBar();rcmail.env.message_commands.push("yetiforce.importICS");rcmail.register_command("yetiforce.importICS",function(b,c,d){window.crm.AppConnector.request({async:true,dataType:"json",data:{module:"Calendar",action:"ImportICS",ics:b}}).then(function(e){window.crm.Vtiger_Helper_Js.showPnotify({text:e.result,type:"info",animation:"show"});$(c).closest(".icalattachments").remove()})},true)});function loadActionBar(){var a=$("#ytActionBarContent");var b={module:"OSSMail",view:"MailActionBar",uid:rcmail.env.uid,folder:rcmail.env.mailbox,rcId:rcmail.env.user_id};window.crm.AppConnector.request(b).then(function(c){a.find(".ytHeader").html(c);$("#messagecontent").css("top",(a.outerHeight()+$("#messageheader").outerHeight())+"px");registerEvents(a)})}function registerEvents(a){registerAddRecord(a);registerAddReletedRecord(a);registerSelectRecord(a);registerRemoveRecord(a);registerImportMail(a);var b=a.find(".ytHeader .data");a.find(".hideBtn").click(function(){var c=$(this);var d=c.find(".glyphicon");if(c.data("type")=="0"){c.data("type","1");d.removeClass("glyphicon-chevron-up").addClass("glyphicon-chevron-down")}else{c.data("type","0");d.removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron-up")}b.toggle();$(window).trigger("resize")})}function registerImportMail(a){a.find(".importMail").click(function(b){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(c){loadActionBar();window.crm.Vtiger_Helper_Js.showPnotify({text:window.crm.app.vtranslate("AddFindEmailInRecord"),type:"success"})})})}function registerRemoveRecord(a){a.find("button.removeRecord").click(function(b){var c=$(b.currentTarget).closest(".rowRelatedRecord");removeRecord(c.data("id"))})}function registerSelectRecord(a){var b=a.find("#mailActionBarID").val();a.find("button.selectRecord").click(function(f){var d=jQuery('input[name="tempField"]');var h={mailId:b};if($(this).data("type")==0){var c=$(this).closest(".col").find(".module").val()}else{var c=$(this).data("module");h.crmid=$(this).closest(".rowRelatedRecord").data("id");h.mod=$(this).closest(".rowRelatedRecord").data("module");h.newModule=c}var g={module:c,src_module:c,src_field:"tempField",src_record:"",url:rcmail.env.site_URL+"index.php?"};showPopup(g,d,h)})}function registerAddReletedRecord(a){var b=a.find("#mailActionBarID").val();a.find("button.addRelatedRecord").click(function(d){var c=$(d.currentTarget);var g=c.closest(".rowRelatedRecord");var f={sourceModule:g.data("module")};showQuickCreateForm(c.data("module"),g.data("id"),f)})}function registerAddRecord(a){var b=a.find("#mailActionBarID").val();a.find("button.addRecord").click(function(d){var c=$(d.currentTarget).closest(".col");showQuickCreateForm(c.find(".module").val(),b)})}function removeRecord(a){var c=$("#mailActionBarID").val();var b={};b.data={module:"OSSMail",action:"ExecuteActions",mode:"removeRelated",params:{mailId:c,crmid:a}};b.async=false;b.dataType="json";window.crm.AppConnector.request(b).then(function(f){var e=f.result;if(e.success){var d={text:e.data,type:"info",animation:"show"}}else{var d={text:e.data,animation:"show"}}window.crm.Vtiger_Helper_Js.showPnotify(d);loadActionBar()})}function showPopup(e,c,d){d.newModule=e.module;var a=jQuery.Event(window.crm.Vtiger_Edit_Js.preReferencePopUpOpenEvent);c.trigger(a);var b={};show(e,function(g){var f=JSON.parse(g);for(var i in f){var g={name:f[i].name,id:i};c.val(g.id)}d.newCrmId=g.id;var h={};h.data={module:"OSSMail",action:"ExecuteActions",mode:"addRelated",params:d};h.async=false;h.dataType="json";window.crm.AppConnector.request(h).then(function(l){var k=l.result;if(k.success){var j={text:k.data,type:"info",animation:"show"}}else{var j={text:k.data,animation:"show"}}window.crm.Vtiger_Helper_Js.showPnotify(j);loadActionBar()})})}function showQuickCreateForm(b,h,d){var k=$("#ytActionBarContent");if(d==undefined){var d={}}var e={};if(d.sourceModule){var j=d.sourceModule}else{var j="OSSMailView"}var o=function(q){var i,p,r;$('').appendTo(q);$('').appendTo(q);$('').appendTo(q)};var a={link:"modulesLevel0",process:"modulesLevel1",subprocess:"modulesLevel2",linkextend:"modulesLevel3"};for(var g in a){var f=k.find("#"+a[g]);var n=f.length?JSON.parse(f.val()):[];if($.inArray(j,n)>=0){e[g]=h}}if(b=="Leads"){e.company=rcmail.env.fromName}if(b=="Leads"||b=="Contacts"){e.lastname=rcmail.env.fromName}if(b=="Project"){e.projectname=rcmail.env.subject}if(b=="HelpDesk"){e.ticket_title=rcmail.env.subject}if(b=="Products"){e.productname=rcmail.env.subject}if(b=="Services"){e.servicename=rcmail.env.subject}e.email=rcmail.env.fromMail;e.email1=rcmail.env.fromMail;e.description=$("#messagebody").text();var m=function(i){loadActionBar()};e.sourceModule=j;e.sourceRecord=h;e.relationOperation=true;var c={callbackFunction:m,callbackPostShown:o,data:e,noCache:true};var l=new window.crm.Vtiger_Header_Js();l.quickCreateModule(b,c)}function show(c,d,i,f,b){var h=window.crm.Vtiger_Popup_Js.getInstance();if(typeof c=="undefined"){c={}}if(typeof c=="object"&&(typeof c.view=="undefined")){c.view="Popup"}if(typeof f=="undefined"){f="postSelection"+Math.floor(Math.random()*10000)}if(typeof i=="undefined"){i="test"}if(typeof c=="object"){c.triggerEventName=f}else{c+="&triggerEventName="+f}var e=(typeof c=="string")?c:window.crm.jQuery.param(c);var a=c.url+e;var g=window.crm.window.open(a,i,"width=800,height=650,resizable=0,scrollbars=1");if(typeof h.destroy=="function"){h.destroy()}window.crm.jQuery.initWindowMsg();if(typeof d!="undefined"){h.retrieveSelectedRecords(d,f)}if(typeof b=="function"){window.crm.jQuery.windowMsg("Vtiger.OnPopupWindowLoad.Event",function(j){b(j)})}return g}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 diff --git a/version.php b/version.php index 15a605c4..cda1251f 100644 --- a/version.php +++ b/version.php @@ -1,5 +1,5 @@ '2017.11.09', - 'version' => '0.0.36' + 'patch' => '2017.12.06', + 'version' => '0.0.37' ];