Unofficial IMP 2.2.3 patches (for personal group sending)
hhoffman@r-u-i.com
hhoffman@r-u-i.com
Tue, 20 Feb 2001 12:40:52 -0800 (PST)
---------------------- multipart/mixed attachment
Hey All,
Sometime ago I said I would post the patches that would allow personal group
usage in IMP 2.2.3. It's finally done. This is my first real contribution so
please go easy on me. Also, I'm not a programmer, so if you can think of a
better, more legible, etc. way of doing this I would love to here. The file
attached is from the IMP directory in .../imp/templates/contacts/ and
essentially does the group insert the same way that pine does. Please feel free
to contact me with any questions.
Since I'm leaving my company please email to the list or to moebius@ip-
solutions.net.
Thanks,
Harry
// Insert normal warnings::
// While this probably won't blow up your system if it doesn't work I take no
// blame for it :-)
// Please make a copy of your javascript.inc before replacing it with this one.
---------------------------------
Harry Hoffman
Manager Information Technology
Restaurants Unlimited, Inc.
206.634.3082 x. 270
---------------------------------
---------------------- multipart/mixed attachment
<script language="JavaScript1.2">
<!-- /{webroot}/horde/imp/templates/contacts/javascript.inc
var Addresses = new Array (
<?php
if (is_array($addresses)) {
for ($i = 0; $i < sizeof($addresses); $i++) {
if ($i > 0) { echo ' , '; }
echo '"' . addslashes($addresses[$i][0]) . '"';
}
echo "\n";
}
?>
)
function ClearSelection() {
window.document.addressbook.new_address.value = "";
window.document.addressbook.new_nickname.value = "";
window.document.addressbook.new_fullname.value = "";
}
function AlertMissingParent() {
alert('<?php echo addslashes($lang->alert_no_compose) ?>');
}
function insert_addr() {
var prefix = "";
var t_parent = typeof parent.opener;
var t_compose = typeof parent.opener.document.compose;
if (t_compose != "undefined") {
if (parent.opener.document.compose.to.value) {
if (window.document.addressbook.new_address.value) {
prefix = ", ";
}
}
if (window.document.addressbook.new_address.value) {
addop = " <";
addclo = ">";
} else {
addop = "";
addclo = "";
}
var pattern = /;/ig;
var toValue = window.document.addressbook.new_address.value;
var newToValue = toValue.replace(pattern,",");
//parent.opener.document.compose.to.value = parent.opener.document.compose.to.value + prefix + window.document.addressbook.new_address.value;
parent.opener.document.compose.to.value = parent.opener.document.compose.to.value + prefix + newToValue;
} else {
AlertMissingParent();
}
}
function insert_addr_cc() {
var prefix = "";
var t_parent = typeof parent.opener;
var t_compose = typeof parent.opener.document.compose;
if ( t_compose != "undefined" ) {
if ( parent.opener.document.compose.cc.value ) {
if ( window.document.addressbook.new_address.value ) {
prefix = ", ";
}
}
if ( window.document.addressbook.new_address.value ) {
addop = " <";
addclo = ">";
} else {
addop = "";
addclo = "";
}
var pattern = /;/ig;
var ccValue = window.document.addressbook.new_address.value;
var newCcValue = ccValue.replace(pattern,",");
parent.opener.document.compose.cc.value = parent.opener.document.compose.cc.value + prefix + newCcValue;
} else {
AlertMissingParent();
}
}
function insert_addr_bcc() {
var prefix = "";
var t_parent = typeof parent.opener;
var t_compose = typeof parent.opener.document.compose;
if ( t_compose != "undefined" ) {
if ( parent.opener.document.compose.bcc.value ) {
if ( window.document.addressbook.new_address.value ) {
prefix = ", ";
}
}
if ( window.document.addressbook.new_address.value ) {
addop = " <";
addclo = ">";
} else {
addop = "";
addclo = "";
}
var pattern = /;/ig;
var bccValue = window.document.addressbook.new_address.value;
var newBccValue = bccValue.replace(pattern,",");
parent.opener.document.compose.bcc.value = parent.opener.document.compose.bcc.value + prefix + newBccValue
} else {
AlertMissingParent();
}
}
var Nicknames = new Array (
<?php
if (is_array($addresses)) {
for ($i = 0; $i < count($addresses); $i++) {
if ($i > 0) { echo ' , '; }
echo '"' . addslashes($addresses[$i][1]) . '"';
}
echo "\n";
}
?>
)
var Fullnames = new Array (
<?php
if (is_array($addresses)) {
for ($i = 0; $i < count($addresses); $i++) {
if ($i > 0) { echo ' , '; }
echo '"' . addslashes($addresses[$i][2]) . '"';
}
echo "\n";
}
?>
)
function setFields_ins () {
document.addressbook.new_address.value = Addresses[document.addressbook.old_address.selectedIndex];
document.addressbook.new_nickname.value = Nicknames[document.addressbook.old_address.selectedIndex];
document.addressbook.new_fullname.value = Fullnames[document.addressbook.old_address.selectedIndex];
}
function ClearAttr() {
while (document.ldap_form.attr_type.options.length > 0) {
document.ldap_form.attr_type.options[0] = null;
}
}
function ClearOptions() {
while (document.ldap_form.ldap_options.options.length > 0) {
document.ldap_form.ldap_options.options[0] = null;
}
}
function AddOption(attr) {
if (attr == "uid") {
var uid = new Option("<?php echo $lang->uid; ?>", uid, defaultSelected=0, selected=0);
document.ldap_form.attr_type.options[document.ldap_form.attr_type.options.length] = new Option("<?php echo $lang->uid; ?>");
}
else if (attr == "mail") {
var mail = new Option("<?php echo $lang->mail; ?>", mail, defaultSelected=0, selected=0);
document.ldap_form.attr_type.options[document.ldap_form.attr_type.options.length] = new Option("<?php echo $lang->mail; ?>");
}
else if (attr == "sn") {
var sn = new Option("<?php echo $lang->sn; ?>", sn, defaultSelected=0, selected=0);
document.ldap_form.attr_type.options[document.ldap_form.attr_type.options.length] = new Option("<?php echo $lang->sn; ?>");
}
else if (attr == "givenname") {
var givenname = new Option("<?php echo $lang->givenname; ?>", givenname, defaultSelected=0, selected=0);
document.ldap_form.attr_type.options[document.ldap_form.attr_type.options.length] = new Option("<?php echo $lang->givenname; ?>");
}
else if (attr == "ou") {
var ou = new Option("<?php echo $lang->ou; ?>", ou, defaultSelected=0, selected=0);
document.ldap_form.attr_type.options[document.ldap_form.attr_type.options.length] = new Option("<?php echo $lang->ou; ?>");
}
else if (attr == "cn") {
var cn = new Option("<?php echo $lang->cn; ?>", cn, defaultSelected=1, selected=1);
document.ldap_form.attr_type.options[document.ldap_form.attr_type.options.length] = new Option("<?php echo $lang->cn; ?>");
}
else if (attr == "begins") {
var begins = new Option("<?php echo $lang->begins; ?>", begins, defaultSelected=0, selected=0);
document.ldap_form.ldap_options.options[document.ldap_form.ldap_options.options.length] = new Option("<?php echo $lang->begins; ?>");
}
else if (attr == "contains") {
var contains = new Option("<?php echo $lang->contains; ?>", contains, defaultSelected=0, selected=0);
document.ldap_form.ldap_options.options[document.ldap_form.ldap_options.options.length] = new Option("<?php echo $lang->contains; ?>");
}
else if (attr == "ends") {
var ends = new Option("<?php echo $lang->ends; ?>", ends, defaultSelected=0, selected=0);
document.ldap_form.ldap_options.options[document.ldap_form.ldap_options.options.length] = new Option("<?php echo $lang->ends; ?>");
}
else if (attr == "is_strict") {
var is_strict = new Option("<?php echo $lang->is_strict; ?>", is_strict, defaultSelected=0, selected=0);
document.ldap_form.ldap_options.options[document.ldap_form.ldap_options.options.length] = new Option("<?php echo $lang->is_strict; ?>");
}
else if (attr == "is") {
var is = new Option("<?php echo $lang->is; ?>", is, defaultSelected=1, selected=1);
document.ldap_form.ldap_options.options[document.ldap_form.ldap_options.options.length] = new Option("<?php echo $lang->is; ?>");
}
else if (attr == "sounds") {
var sounds = new Option("<?php echo $lang->sounds; ?>", sounds, defaultSelected=0, selected=0);
document.ldap_form.ldap_options.options[document.ldap_form.ldap_options.options.length] = new Option("<?php echo $lang->sounds; ?>");
}
}
function StandardOptions () {
<?php
$i = 0;
if (isset($LDAPServers) && is_array($LDAPServers)) {
reset($LDAPServers);
while (list($key, $lserver) = each($LDAPServers)) {
$options = explode(',', $lserver->options);
if ($i == 0) echo "if (document.ldap_form.ldap_serv.options[$i].selected) {\n";
else echo "else if (document.ldap_form.ldap_serv.options[$i].selected) {\n";
echo " ClearOptions();\n";
for ($j = 0; $j < count($options); $j++)
echo " AddOption(\"$options[$j]\");\n";
echo "}\n\n";
$i++;
}
}
?>
}
function UpdateSelect () {
<?php
if (isset($LDAPServers) && is_array($LDAPServers)) {
$i = 0;
reset($LDAPServers);
while (list($key, $lserver) = each($LDAPServers)) {
$options = explode(',', $lserver->attribs);
if ($i == 0) echo "if (document.ldap_form.ldap_serv.options[$i].selected) {\n";
else echo "else if (document.ldap_form.ldap_serv.options[$i].selected) {\n";
echo " ClearAttr();\n";
for ($j = 0; $j < count($options); $j++)
echo " AddOption(\"$options[$j]\");\n";
echo "}\n\n";
$i++;
}
}
?>
StandardOptions();
}
function UpdateOptions() {
StandardOptions();
for (i=0; i < 6; i++) {
if (document.ldap_form.attr_type.options[i]) {
if (document.ldap_form.attr_type.options[i].selected) {
attr = document.ldap_form.attr_type.options[i].text;
if (attr == "<?php echo $lang->mail; ?>") {
if (document.ldap_form.ldap_serv.options[0].selected ) {
ClearOptions();
AddOption("is_strict");
}
if (document.ldap_form.ldap_serv.options[1].selected ) {
ClearOptions();
AddOption("is_strict");
}
if (document.ldap_form.ldap_serv.options[2].selected ) {
ClearOptions();
AddOption("is_strict");
}
}
if (attr == "<?php echo $lang->sn; ?>") {
if (document.ldap_form.ldap_serv.options[1].selected ) {
ClearOptions();
AddOption("is_strict");
}
}
}
}
}
document.ldap_form.ldap_options.options[0].selected = true;
}
//-->
</script>
---------------------- multipart/mixed attachment--