在owa2007里发新邮件,弹出来的选人界面是公司开发的通讯录选人界面,但由于版本的原因,导致曾经选择的收件人不能带入到通讯录选人界面,第二次选人后会将前一次选择的人员覆盖掉,经过研究解决了该问题,下面是解决方法:
1、改造owa里的uglobal.js里的shwAB方法
这个方法是在每次点击收件人、抄送、密件抄送时调用,在调用后会弹出通讯录选人界面,功能是将每次选择的人员的数据保存到写邮件界面的window对象里,以便下次再传进选人界面,分了收件人、抄送、密件抄送三中类型,每个用一个数组保存,分别是arrSelectedContact_To、arrSelectedContact_Cc、arrSelectedContact_Bcc,代码如下:
function shwAB(sTgt,sA){
var oP=new Object();
oP.sTo=divTo.innerHTML;
oP.sCc=divCc.innerHTML;
oP.sBcc=divBcc.innerHTML;
oP.sTgt=sTgt;
oP.objMessage = {};
switch (sTgt) {
case 'divTo':
oP.arrSelectedContact = window.arrSelectedContact_To;
break;
case 'divCc':
oP.arrSelectedContact = window.arrSelectedContact_Cc;
break;
case 'divBcc':
oP.arrSelectedContact = window.arrSelectedContact_Bcc;
break;
}
oP.objMessage.addRecipients = function(n, mailList) {
switch (n)
{
case 1:
oP.sType = 'To';
oP.sTo = mailList;
break;
case 2:
oP.sType = 'Cc';
oP.sCc = mailList;
break;
case 3:
oP.sType = 'Bcc';
oP.sBcc = mailList;
break;
}
}
oP.objMessage.checkNames = function(n) {
}
//shwDlg("AddressBook",a_iABW,a_iABH,DLG_MOD|DLG_CTR|DLG_RSZ,oP,"&a="+sA);
//setRwHtml(divTo,oP.sTo);
//setRwHtml(divCc,oP.sCc);
//setRwHtml(divBcc,oP.sBcc);
var url = '/owa/ContactForOWA/Contact/SelectUser.htm';
url = '/OWAContact/Contact/ContactQuerySelectForOWA.aspx';
//url = 'http://contact.shrcoa.gov.cn/Contact/ContactQuerySelectForOWA.aspx';
var vRetval = window.showModalDialog(url, oP, "dialogHeight:"+a_iABH+"px;dialogWidth:"+a_iABW+"px;status:no;resizable:no;help:no;");
if (oP != null && oP.arrSelectedContact != null) {
switch (sTgt) {
case 'divTo':
window.arrSelectedContact_To = oP.arrSelectedContact;
break;
case 'divCc':
window.arrSelectedContact_Cc = oP.arrSelectedContact;
break;
case 'divBcc':
window.arrSelectedContact_Bcc = oP.arrSelectedContact;
break;
}
}
if (oP.sType == 'To')
setRwHtml(divTo, oP.sTo);
else if (oP.sType == 'Cc')
setRwHtml(divCc, oP.sCc);
else if (oP.sType == 'Bcc');
setRwHtml(divBcc, oP.sBcc);
revtRSpn();
if(0<oP.sBcc.length)
shwBcc(1);
rslvNms(OP_ANR); //实现检查姓名
}
var oP=new Object();
oP.sTo=divTo.innerHTML;
oP.sCc=divCc.innerHTML;
oP.sBcc=divBcc.innerHTML;
oP.sTgt=sTgt;
oP.objMessage = {};
switch (sTgt) {
case 'divTo':
oP.arrSelectedContact = window.arrSelectedContact_To;
break;
case 'divCc':
oP.arrSelectedContact = window.arrSelectedContact_Cc;
break;
case 'divBcc':
oP.arrSelectedContact = window.arrSelectedContact_Bcc;
break;
}
oP.objMessage.addRecipients = function(n, mailList) {
switch (n)
{
case 1:
oP.sType = 'To';
oP.sTo = mailList;
break;
case 2:
oP.sType = 'Cc';
oP.sCc = mailList;
break;
case 3:
oP.sType = 'Bcc';
oP.sBcc = mailList;
break;
}
}
oP.objMessage.checkNames = function(n) {
}
//shwDlg("AddressBook",a_iABW,a_iABH,DLG_MOD|DLG_CTR|DLG_RSZ,oP,"&a="+sA);
//setRwHtml(divTo,oP.sTo);
//setRwHtml(divCc,oP.sCc);
//setRwHtml(divBcc,oP.sBcc);
var url = '/owa/ContactForOWA/Contact/SelectUser.htm';
url = '/OWAContact/Contact/ContactQuerySelectForOWA.aspx';
//url = 'http://contact.shrcoa.gov.cn/Contact/ContactQuerySelectForOWA.aspx';
var vRetval = window.showModalDialog(url, oP, "dialogHeight:"+a_iABH+"px;dialogWidth:"+a_iABW+"px;status:no;resizable:no;help:no;");
if (oP != null && oP.arrSelectedContact != null) {
switch (sTgt) {
case 'divTo':
window.arrSelectedContact_To = oP.arrSelectedContact;
break;
case 'divCc':
window.arrSelectedContact_Cc = oP.arrSelectedContact;
break;
case 'divBcc':
window.arrSelectedContact_Bcc = oP.arrSelectedContact;
break;
}
}
if (oP.sType == 'To')
setRwHtml(divTo, oP.sTo);
else if (oP.sType == 'Cc')
setRwHtml(divCc, oP.sCc);
else if (oP.sType == 'Bcc');
setRwHtml(divBcc, oP.sBcc);
revtRSpn();
if(0<oP.sBcc.length)
shwBcc(1);
rslvNms(OP_ANR); //实现检查姓名
}
2、选人界面传入进来的前一次选择的收件人及类别(收件人、抄送、密件抄送),显示在选人界面里,表示这些是上次所选择的,页面时ContactSelect.ascx:
function window.onload()
{
window.setTimeout(sizeDialog,1);
var arr = window.dialogArguments;
if( arr != null && arr.arrSelectedContact)
{
for( i = 0 ; i < arr.arrSelectedContact.length ; i ++ ){
selectContact( arr.arrSelectedContact[i] ) ;
}
}
}
3、选人后对话框关闭时,将本次所选人员(可能包括上次所选人员)赋值给对话框参数,供写邮件页面处理:
{
window.setTimeout(sizeDialog,1);
var arr = window.dialogArguments;
if( arr != null && arr.arrSelectedContact)
{
for( i = 0 ; i < arr.arrSelectedContact.length ; i ++ ){
selectContact( arr.arrSelectedContact[i] ) ;
}
}
}
通讯录选人界面ContactQuerySelectForOWA.aspx
function addRec(which) {
if (window.dialogArguments == null)
return;
var objMessage = window.dialogArguments["objMessage"];
if (objMessage == null)
return;
var arr = Contact_GetSelectedContacts();
var mailList = "";
for (i = 0; i < arr.length; i++) {
if (mailList != "") mailList += ";";
mailList += arr[i].FullName + "[smtp:" + arr[i].Email1 + "]";
}
if (window.dialogArguments && arrContact) {
window.dialogArguments.arrSelectedContact = arrContact;
}
......
}
function addRec(which) {
if (window.dialogArguments == null)
return;
var objMessage = window.dialogArguments["objMessage"];
if (objMessage == null)
return;
var arr = Contact_GetSelectedContacts();
var mailList = "";
for (i = 0; i < arr.length; i++) {
if (mailList != "") mailList += ";";
mailList += arr[i].FullName + "[smtp:" + arr[i].Email1 + "]";
}
if (window.dialogArguments && arrContact) {
window.dialogArguments.arrSelectedContact = arrContact;
}
......
}