2006-06-15 21:34:10 +02:00
|
|
|
/*
|
|
|
|
Copyright (C) 2005 SKYRIX Software AG
|
|
|
|
|
|
|
|
This file is part of OpenGroupware.org.
|
|
|
|
|
|
|
|
OGo is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU Lesser General Public License as published by the
|
|
|
|
Free Software Foundation; either version 2, or (at your option) any
|
|
|
|
later version.
|
|
|
|
|
|
|
|
OGo is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
|
|
License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with OGo; see the file COPYING. If not, write to the
|
|
|
|
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
function unescapeCallbackParameter(s) {
|
|
|
|
if(!s || s.length == 0)
|
|
|
|
return s;
|
|
|
|
s = s.replace(/'/g, "'");
|
|
|
|
s = s.replace(/"/g, '"');
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
function copyContact(type, email, uid, sn,
|
|
|
|
cn, givenName, telephoneNumber, facsimileTelephoneNumber,
|
|
|
|
mobile, postalAddress, homePostalAddress,
|
|
|
|
departmentNumber, l)
|
|
|
|
{
|
|
|
|
// var type = arguments[0];
|
|
|
|
// var email = arguments[1];
|
|
|
|
// var uid = arguments[2];
|
|
|
|
// var sn = arguments[3];
|
|
|
|
// var givenName = arguments[4];
|
|
|
|
// var telephoneNumber = arguments[5];
|
|
|
|
// var facsimileTelephoneNumber = arguments[6];
|
|
|
|
// var mobile = arguments[7];
|
|
|
|
// var postalAddress = arguments[8];
|
|
|
|
// var homePostalAddress = arguments[9];
|
|
|
|
// var departmentNumber = arguments[10];
|
|
|
|
// var l = arguments[11];
|
|
|
|
var e;
|
|
|
|
e = document.getElementById('cn');
|
|
|
|
e.setAttribute('value', unescapeCallbackParameter(cn));
|
|
|
|
e = document.getElementById('email');
|
|
|
|
e.setAttribute('value', email);
|
|
|
|
e = document.getElementById('sn');
|
|
|
|
e.setAttribute('value', unescapeCallbackParameter(sn));
|
|
|
|
e = document.getElementById('givenName');
|
|
|
|
e.setAttribute('value', unescapeCallbackParameter(givenName));
|
|
|
|
e = document.getElementById('telephoneNumber');
|
|
|
|
e.setAttribute('value', telephoneNumber);
|
|
|
|
e = document.getElementById('facsimileTelephoneNumber');
|
|
|
|
e.setAttribute('value', facsimileTelephoneNumber);
|
|
|
|
e = document.getElementById('mobile');
|
|
|
|
e.setAttribute('value', mobile);
|
|
|
|
e = document.getElementById('postalAddress');
|
|
|
|
e.setAttribute('value', unescapeCallbackParameter(postalAddress));
|
|
|
|
e = document.getElementById('homePostalAddress');
|
|
|
|
e.setAttribute('value', unescapeCallbackParameter(homePostalAddress));
|
|
|
|
e = document.getElementById('departmentNumber');
|
|
|
|
e.setAttribute('value', unescapeCallbackParameter(departmentNumber));
|
|
|
|
e = document.getElementById('l');
|
|
|
|
e.setAttribute('value', unescapeCallbackParameter(l));
|
|
|
|
};
|
|
|
|
|
|
|
|
function validateContactEditor() {
|
|
|
|
var e;
|
|
|
|
|
|
|
|
e = document.getElementById('email');
|
|
|
|
if (e.value.length == 0)
|
|
|
|
return true;
|
|
|
|
if (uixEmailRegex.test(e.value) != true)
|
|
|
|
return confirm(labels.invalidemailwarn);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2006-09-16 00:27:59 +02:00
|
|
|
|
|
|
|
function submitContact(thisForm) {
|
|
|
|
var action = document.getElementById('jsaction');
|
|
|
|
action.setAttribute("name", "save:method");
|
|
|
|
action.setAttribute("value", "save");
|
|
|
|
|
|
|
|
window.opener.log ("form: " + thisForm);
|
|
|
|
|
|
|
|
window.opener.log ("validating...");
|
|
|
|
if (validateContactEditor()) {
|
|
|
|
window.opener.log ("submitting");
|
|
|
|
thisForm.submit();
|
|
|
|
window.opener.log ("setting timeout...");
|
|
|
|
window.opener.setTimeout('refreshAppointments();', 200);
|
|
|
|
window.opener.log ("we close...");
|
|
|
|
window.close();
|
|
|
|
window.opener.log ("closed");
|
|
|
|
}
|
|
|
|
}
|