steffen: server/kolab-horde-fbview/kolab-horde-fbview/fbview/kronolith/templates/contacts contacts.inc, NONE, 1.1 javascript.inc, NONE, 1.1

cvs at intevation.de cvs at intevation.de
Mon Oct 31 12:43:24 CET 2005


Author: steffen

Update of /kolabrepository/server/kolab-horde-fbview/kolab-horde-fbview/fbview/kronolith/templates/contacts
In directory doto:/tmp/cvs-serv18388/kolab-horde-fbview/kolab-horde-fbview/fbview/kronolith/templates/contacts

Added Files:
	contacts.inc javascript.inc 
Log Message:
Fbview in separate package

--- NEW FILE: contacts.inc ---
<?php echo Help::javascript(); ?>
<form method="post" name="contacts" onsubmit="passAddresses();" action="contacts.php?nocache=<?php echo md5(mt_rand()) ?>">
<?php Util::pformInput() ?>
<table border="0" align="center" cellpadding="0" cellspacing="1">
<tr height="25">
  <td class="header">
    <b><?php echo _("Contact List") ?></b>
  </td>
</tr>

<tr>
  <td>
<table border="0" width="100%" cellpadding="0">
<tr>
  <td class="light" align="left" nowrap="nowrap"><b><?php echo _("Find") ?></b>
    <input value="<?php echo $search ?>" name="search" tabindex="<?php echo $tabindex++ ?>" style="width:150px"></td>
<?php if (count($source_list) > 1): ?>
    <td class="light" align="left" nowrap="nowrap"><b><?php echo _("from") ?></b>
    <select name="source" tabindex="<?php echo $tabindex++ ?>">
    <?php foreach ($source_list as $key => $select): ?>
    <option value="<?php echo $key ?>"<?php if ($key == $source) echo ' selected="selected"' ?>><?php echo htmlspecialchars($select) ?></option>
    <?php endforeach; ?>
    </select></td>
<?php else: ?>
    <td class="light"><input name="source" type="hidden" value="<?php echo key($source_list) ?>" /></td>
<?php endif; ?>
    <td class="light" align="left" nowrap="nowrap"><input type="submit" class="button" value="<?php echo _("Search") ?>" />
  </td>
</tr>
</table>

<tr>
  <td>
<table border="0" width="100%" cellpadding="0">
<tr>
  <td width="45%"><select name="search_results" multiple="multiple" size="10" width="200" onchange="document.contacts.search_results[0].selected=false" ondblclick="addAddress()">
    <option value=""><?php echo _("* Please select address(es) *") ?></option>
    <?php foreach ($addresses as $addr): ?>
      <?php if ($display == 'email'): ?>
        <option value="<?php echo rawurlencode($addr['name']) ?>"><?php echo $addr['email'] ?></option>
      <?php else: ?>
        <option value="<?php echo rawurlencode($addr['email']) ?>"><?php echo $addr['name'] ?></option>
      <?php endif; ?>
    <?php endforeach; ?>
    </select>
  </td>
  <td width="10%" valign="top">
    <input type="button" class="button" style="width:60px" onclick="addAddress();" value="<?php echo _("Add") . " >>" ?>" /><br /> <br />
  <td width="45%" colspan="2">
    <select name="selected_addresses" multiple="multiple" size="10" width="200" onchange="document.contacts.selected_addresses[0].selected=false">
      <option value=""><?php echo _("* Add these by clicking Add *") ?></option>
    <?php foreach ($selected_addresses as $value => $text): ?>
      <option value="<?php echo $value ?>"><?php echo $text ?></option>
    <?php endforeach; ?>
    </select>
  </td>
</tr>
<tr>
  <td nowrap="nowrap" align="left" class="light">
    <b><?php echo _("Display") ?></b>
    <select name="display" onchange="changeDisplay();">
      <option value="name"<?php echo $display == "name" ? " selected=\"selected\"" : "" ?>><?php echo _("Name") ?></option>
      <option value="email"<?php echo $display == "email" ? " selected=\"selected\"" : "" ?>><?php echo _("Email Address") ?></option>
    </select>
  </td>
  <td> </td>
  <td colspan="2">
    <input type="button" class="button" onclick="removeAddress()" value="<?php echo _("Delete") ?>" />
    <input type="button" class="button" onclick="saClear();" value="<?php echo _("Reset") ?>" />
  </td>
</tr>
</table>
  </td>
</tr>

<!-- Buttons Row -->
<tr>
  <td class="header" align="right">
    <input type="button" class="button" onclick="updateMessage();" value="<?php echo _("Add") ?>" />
    <input type="button" class="button" onclick="window.close();" value="<?php echo _("Cancel") ?>" />
<?php if ($conf['user']['online_help'] && $browser->hasFeature('javascript')): ?>
    <input type="button" class="button" onclick="<?php echo Help::listLink('kronolith', 'invite-addressbook'); ?>" value="<?php echo _("Help") ?>" />
<?php endif; ?>
  </td>
</tr>
<!-- End Buttons Row -->

</table>

--- NEW FILE: javascript.inc ---
<script language="JavaScript" type="text/javascript">
<!--

var display = "<?php echo (!empty($display) ? $display : 'name') ?>";

function changeDisplay()
{
    var listDisplay = window.document.contacts.display;

    if (listDisplay.options[listDisplay.selectedIndex].value != display) {
        display = listDisplay.options[listDisplay.selectedIndex].value;

        s = window.document.contacts.search_results;
        for(var i = 0; i < s.length; i++) {
            var temp = s.options[i].value;
            if (temp == "") { continue; }

            s.options[i].value = escape(s.options[i].text);
            s.options[i].text = unescape(temp);
        }

        d = window.document.contacts.selected_addresses;
        for(var i = 0; i < d.length; i++) {
            var temp = d.options[i].value;
            if (temp == "") { continue; }

            d.options[i].value = escape(d.options[i].text);
            d.options[i].text = unescape(temp);
        }
    }
}

function passAddresses()
{
    var list = window.document.contacts.selected_addresses;
    var action = "";

    for (var i = 0; i < list.length; i++) {
        var item = list.options[i];
        if (item.value == "") { continue; }
        action += '<?php echo ini_get('arg_separator.output') ?>sa' + i + '=' + escape(item.value + "|" + item.text);
    }
    if (window.document.contacts.action.indexOf("?") < 0) {
        action = window.document.contacts.action + "?" + action.substring(1, action.length);
    } else {
        action = window.document.contacts.action + "<?php echo ini_get('arg_separator.output') ?>" + action;
    }
    window.document.contacts.action = action;
}

function addAddress()
{
    var s = window.document.contacts.search_results;
    var d = window.document.contacts.selected_addresses;

    if (s.selectedIndex < 0) {
        alert('<?php echo addslashes(_("You must select an address first.")) ?>');
        return false;
    } else {
        for (var i = 0; i < s.length; i++) {
            var item = s.options[i];
            if (item.value == "") { continue; }
            if (item.selected) {
                d.options[d.length] = new Option(item.text, item.value);
            }
        }
    }
}

function updateMessage()
{
    if (parent.opener.closed) {
        alert('<?php echo addslashes(_("The Edit Attendees screen is no longer present. Exiting.")) ?>');
        this.close();
        return;
    }

    if (!parent.opener.document.attendeesForm) {
        alert('<?php echo addslashes(_("You can only use this form from the Edit Attendees screen.")) ?>');
        this.close();
        return;
    }

    var list = window.document.contacts.selected_addresses;
    var field = parent.opener.document.attendeesForm.newAttendees;
    for (var i = 0; i < list.length; i++) {
        if (list.options[i].value == '') {
            continue;
        }
        if (display == 'name') {
            var address = unescape(list.options[i].value);
        } else {
            var address = list.options[i].text;
        }

        if (field.value) {
            field.value = field.value + ', ' + address;
        } else {
            field.value = address;
        }
    }
    this.close();
}

function saClear()
{
    window.document.contacts.selected_addresses.length = 1;
}

function removeAddress()
{
    var list = window.document.contacts.selected_addresses;
    for (var i = list.length - 1; i > 0; i--) {
        if (list.options[i].selected) {
            list.options[i] = null;
        }
    }
}
//-->
</script>





More information about the commits mailing list