[ Index ]
 

Code source de IMP H3 (4.1.5)

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/templates/contacts/ -> contacts.inc (source)

   1  <script type="text/javascript">
   2  
   3  function adjustSize()
   4  {
   5      if (document.getElementById) {
   6          var table = document.getElementById('contactstable');
   7          if (table.offsetWidth &&
   8              table.offsetWidth > 550) {
   9              window.resizeTo(table.offsetWidth, 300);
  10          }
  11      }
  12  }
  13  
  14  var display = "<?php echo (!empty($display) ? $display : "name") ?>";
  15  
  16  function changeDisplay()
  17  {
  18      var listDisplay = document.contacts.display;
  19  
  20      if (listDisplay.options[listDisplay.selectedIndex].value != display) {
  21          display = listDisplay.options[listDisplay.selectedIndex].value;
  22  
  23          s = document.contacts.search_results;
  24          for (var i = 0; i < s.length; i++) {
  25              var temp = s.options[i].value;
  26              if (temp == "") { continue; }
  27  
  28              s.options[i].value = encodeURIComponent(s.options[i].text);
  29              s.options[i].text = decodeURIComponent(temp);
  30          }
  31  
  32          d = document.contacts.selected_addresses;
  33          for (var i = 0; i < d.length; i++) {
  34              var temp = d.options[i].value;
  35              if (temp == "") { continue; }
  36  
  37              d.options[i].value = encodeURIComponent(d.options[i].text);
  38              d.options[i].text = decodeURIComponent(temp);
  39          }
  40      }
  41  }
  42  
  43  function passAddresses()
  44  {
  45      var list = document.contacts.selected_addresses;
  46      var sa = '';
  47  
  48      for (var i = 0; i < list.length; i++) {
  49          var item = list.options[i];
  50          if (item.value == '') {
  51              continue;
  52          }
  53          sa += item.value + '|' + item.text + '|';
  54      }
  55      document.contacts.sa.value = sa;
  56  }
  57  
  58  function sameOption(f, item, itemj)
  59  {
  60      var text = f + ": " + item.text;
  61      var value = f + ": " + item.value;
  62      var textj = itemj.text;
  63      var valuej = itemj.value;
  64  
  65      // Catch exception with NS 7.1
  66      try {
  67          return ((text == textj) || (decodeURIComponent(text) == decodeURIComponent(textj))) &&
  68              ((value == valuej) || (decodeURIComponent(value) == decodeURIComponent(valuej)));
  69      } catch(e) {
  70          return (text == textj && value == valuej);
  71      }
  72  }
  73  
  74  function addAddress(f)
  75  {
  76      var s = document.contacts.search_results;
  77      var d = document.contacts.selected_addresses;
  78  
  79      if (s.selectedIndex < 0) {
  80          alert('<?php echo addslashes(_("You must select an address first.")) ?>');
  81          return false;
  82      } else {
  83          for (var i = 0; i < s.length; i++) {
  84              var item = s.options[i];
  85              if (item.value == "") { continue; }
  86              if (item.selected) {
  87                  for (var j = 0; j < d.length; j++) {
  88                      var itemj = d.options[j];
  89                      if (sameOption(f, item, itemj)) {
  90                          return false;
  91                      }
  92                  }
  93                  d.options[d.length] = new Option(f + ': ' + item.text, f + ': ' + item.value);
  94              }
  95          }
  96      }
  97  }
  98  
  99  function updateMessage()
 100  {
 101      if (parent.opener.closed) {
 102          alert('<?php echo addslashes(_("The message being composed has been closed. Exiting.")) ?>');
 103          this.close();
 104          return;
 105      }
 106  
 107      if (!parent.opener.document.<?php echo $formname ?>) {
 108          alert('<?php echo addslashes(_("This window must be called from a compose window.")) ?>');
 109          this.close();
 110          return;
 111      }
 112  
 113      var list = document.contacts.selected_addresses;
 114      for (var i = 1; i < list.length; i++) {
 115          if (display == "name") {
 116              var address = decodeURIComponent(list.options[i].value);
 117              var fullname = list.options[i].text;
 118          } else {
 119              var address = list.options[i].text;
 120              var fullname = decodeURIComponent(list.options[i].value);
 121          }
 122          var pos = address.indexOf(':');
 123          var f = address.substring(0, pos);
 124          var field = null;
 125  
 126          fullname = fullname.substring(pos + 2, fullname.length);
 127          fullname = fullname.replace(/\\/g, '\\\\');
 128          fullname = fullname.replace(/"/g, '\\"');
 129          if (address.substring(pos + 2, address.length).indexOf(',') > 0) {
 130              address = fullname + ': ' + address.substring(pos + 2, address.length) + ';';
 131          } else {
 132              address = '"' + fullname + '" <' + address.substring(pos + 2, address.length) + '>';
 133          }
 134          if (f == 'to') {
 135              field = parent.opener.document.<?php echo $formname ?>.to;
 136  <?php if (!$to_only): ?>
 137          } else if (f == 'cc') {
 138              field = parent.opener.document.<?php echo $formname ?>.cc;
 139          } else if (f == 'bcc') {
 140              field = parent.opener.document.<?php echo $formname ?>.bcc;
 141  <?php endif; ?>
 142          } else {
 143              continue;
 144          }
 145  
 146          // Only delimit with commas if at least the 2nd entry and not after
 147          // a group address.
 148          if (field.value) {
 149              if (field.value.substr(field.value.length - 1, 1) != ';') {
 150                  field.value = field.value + ',';
 151              }
 152              field.value = field.value + ' ' + address;
 153          } else {
 154              field.value = address;
 155          }
 156      }
 157      this.close();
 158  }
 159  
 160  function removeAddress()
 161  {
 162      var list = document.contacts.selected_addresses;
 163      for (var i = list.length - 1; i > 0; i--) {
 164          if (list.options[i].selected) {
 165              list.options[i] = null;
 166          }
 167      }
 168  }
 169  
 170  </script>
 171  <form method="post" name="contacts" onsubmit="passAddresses();" action="<?php echo Horde::url(Util::addParameter(Horde::applicationUrl('contacts.php'), 'uniq', base_convert(microtime(), 10, 36))) ?>">
 172  <input type="hidden" name="formname" value="<?php echo $formname ?>" />
 173  <input type="hidden" name="searched" value="1" />
 174  <input type="hidden" name="sa" />
 175  <?php Util::pformInput() ?>
 176  
 177  <h1 class="header">
 178    <?php echo _("Address Book") ?>
 179  </h1>
 180  
 181  <div id="contactstable" class="headerbox item">
 182  
 183   <p class="control">
 184     <strong><?php echo _("Find") ?></strong>
 185     <input value="<?php echo htmlspecialchars($search) ?>" name="search" style="width:150px">
 186  
 187  <?php if (count($source_list) > 1): ?>
 188     <strong><?php echo _("from") ?></strong>
 189     <select name="source">
 190     <?php foreach ($source_list as $key => $select): ?>
 191      <option value="<?php echo $key ?>"<?php if ($key == $source) echo ' selected="selected"' ?>><?php echo htmlspecialchars($select) ?></option>
 192     <?php endforeach; ?>
 193     </select>
 194  <?php else: ?>
 195     <input name="source" type="hidden" value="<?php echo key($source_list) ?>" />
 196  <?php endif; ?>
 197     <input type="submit" class="button" value="<?php echo _("Search") ?>" />
 198   </p>
 199  
 200   <table width="100%" cellspacing="2">
 201    <tr>
 202     <td width="33%">
 203      <select name="search_results" multiple="multiple" size="10" style="width:200px" onchange="document.contacts.search_results[0].selected=false"<?php echo $select_event ?>>
 204       <option value=""><?php echo _("* Please select address(es) *") ?></option>
 205  <?php
 206  foreach ($addresses as $addr) {
 207      if (!empty($addr['email'])) {
 208          if ($display == 'email') {
 209  ?>
 210       <option value="<?php echo rawurlencode(String::convertCharset($addr['name'], NLS::getCharset(), 'UTF-8')) ?>"<?php echo $option_event ?>><?php echo $addr['email'] ?></option>
 211  <?php } else { ?>
 212       <option value="<?php echo rawurlencode(String::convertCharset($addr['email'], NLS::getCharset(), 'UTF-8')) ?>"<?php echo $option_event ?>><?php echo $addr['name'] ?></option>
 213  <?php }}} ?>
 214      </select>
 215     </td>
 216     <td width="33%" style="text-align:center">
 217      <input type="button" class="button" style="width:60px" onclick="addAddress('to');" value="<?php echo _("To") . " &gt;&gt;" ?>" /><br />&nbsp;<br />
 218  <?php if (!$to_only): ?>
 219      <input type="button" class="button" style="width:60px" onclick="addAddress('cc');" value="<?php echo _("Cc") . " &gt;&gt;" ?>" /><br />&nbsp;<br />
 220      <input type="button" class="button" style="width:60px" onclick="addAddress('bcc');" value="<?php echo _("Bcc") . " &gt;&gt;" ?>" />
 221     </td>
 222  <?php endif; ?>
 223     <td width="33%">
 224      <select name="selected_addresses" multiple="multiple" size="10" style="width:200px" onchange="document.contacts.selected_addresses[0].selected = false;">
 225       <option value=""><?php echo _("* Add these by clicking OK *") ?></option>
 226  <?php foreach ($selected_addresses as $value => $text): ?>
 227       <option value="<?php echo $value ?>"><?php echo $text ?></option>
 228  <?php endforeach; ?>
 229      </select>
 230     </td>
 231    </tr>
 232    <tr>
 233     <td class="nowrap">
 234      <strong><?php echo _("Display") ?></strong>
 235      <select name="display" onchange="changeDisplay();">
 236       <option value="name"<?php echo $display == 'name' ? ' selected="selected"' : '' ?>><?php echo _("Name") ?></option>
 237       <option value="email"<?php echo $display == 'email' ? ' selected="selected"' : '' ?>><?php echo _("Email Address") ?></option>
 238      </select>
 239     </td>
 240     <td>&nbsp;</td>
 241     <td>
 242      <input type="button" class="button" onclick="removeAddress()" value="<?php echo _("Delete") ?>" />
 243     </td>
 244    </tr>
 245   </table>
 246  
 247  </div>
 248  
 249  <br class="spacer" />
 250  
 251  <div>
 252    <input type="button" class="button" onclick="updateMessage();" value="<?php echo _("OK") ?>" />
 253    <input type="button" class="button" onclick="window.close();" value="<?php echo _("Cancel") ?>" />
 254  </div>
 255  
 256  </form>
 257  <script type="text/javascript">
 258  <!--
 259  adjustSize();
 260  //-->
 261  </script>


Généré le : Thu Nov 29 12:30:07 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics