buildcontactlists.html.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * The build contact lists view file of my module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
  6. * @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Fei Chen<chenfei@cnezsoft.com>
  8. * @package my
  9. * @version $Id$
  10. * @link https://www.zentao.net
  11. */
  12. ?>
  13. <?php
  14. if($contactLists)
  15. {
  16. echo html::select('contactListMenu', array('' => '') + $contactLists, '', "class='form-control chosen' data-placeholder={$lang->my->contactHolder} $attr onchange=\"setMailto('$dropdownName', this.value)\"");
  17. }
  18. else
  19. {
  20. if($showManage == 'yes')
  21. {
  22. $width = isonlybody() ? 'data-width=100%' : '';
  23. echo '<span class="input-group-btn">';
  24. echo '<a title="' . $lang->user->contacts->manage . '" href="' . $this->createLink('my', 'managecontacts', "listID=0&mode=old") . "\" target='_blank' data-icon='cog' data-title='{$lang->user->contacts->manage}' class='btn btn-icon' $width><i class='icon icon-cog'></i></a>";
  25. echo '</span>';
  26. echo '<span class="input-group-btn">';
  27. echo '<button type="button" title="' . $lang->refresh . '" class="btn btn-icon"' . "onclick=\"ajaxGetContacts(this, '$dropdownName')\"" . '><i class="icon icon-refresh"></i></button>';
  28. echo '</span>';
  29. }
  30. }
  31. ?>
  32. <style>
  33. #contactListMenu_chosen {width: 100px !important;}
  34. #contactListMenu + .chosen-container {min-width: 100px;}
  35. td > <?php echo "#" . $dropdownName;?> + .chosen-container .chosen-choices {border-radius: 2px 2px 0 0;}
  36. td > <?php echo "#" . $dropdownName;?> + .chosen-container + #contactListMenu + .chosen-container > .chosen-single {border-radius: 0 0 2px 2px; border-top-width: 0; padding-top: 6px;}
  37. #contactListMenu + .chosen-container.chosen-container-active > .chosen-single {border-top-width: 1px !important; padding-top: 5px !important;}
  38. </style>
  39. <script>
  40. /**
  41. * Ajax get contacts.
  42. *
  43. * @param object $obj
  44. * @param string $dropdownName mailto|whitelist
  45. * @access public
  46. * @return void
  47. */
  48. function ajaxGetContacts(obj, dropdownName)
  49. {
  50. if(typeof(dropdownName) == 'undefined') dropdownName = 'mailto';
  51. link = createLink('user', 'ajaxGetOldContactList', 'dropdownName=' + dropdownName);
  52. $.get(link, function(contacts)
  53. {
  54. if(!contacts) return false;
  55. $inputgroup = $(obj).closest('.input-group');
  56. $inputgroup.find('.input-group-btn').remove();
  57. $inputgroup.append(contacts);
  58. $inputgroup.find('select:last').chosen().fixInputGroup();
  59. });
  60. }
  61. </script>