PageRenderTime 50ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/web/concrete/single_pages/dashboard/users/search.php

https://github.com/ayamyau/concrete5
PHP | 676 lines | 535 code | 126 blank | 15 comment | 112 complexity | 041a4c8b91b6c1de94f644f259c63fcd MD5 | raw file
  1. <?
  2. $attribs = UserAttributeKey::getList(true);
  3. $u = new User();
  4. $uh = Loader::helper('concrete/user');
  5. $txt = Loader::helper('text');
  6. $vals = Loader::helper('validation/strings');
  7. $valt = Loader::helper('validation/token');
  8. $valc = Loader::helper('concrete/validation');
  9. $dtt = Loader::helper('form/date_time');
  10. $dh = Loader::helper('date');
  11. $form = Loader::helper('form');
  12. $ih = Loader::helper('concrete/interface');
  13. $av = Loader::helper('concrete/avatar');
  14. if ($_REQUEST['user_created'] == 1) {
  15. $message = t('User created successfully. ');
  16. }
  17. function printAttributeRow($ak, $uo) {
  18. $vo = $uo->getAttributeValueObject($ak);
  19. $value = '';
  20. if (is_object($vo)) {
  21. $value = $vo->getValue('displaySanitized', 'display');
  22. }
  23. if ($value == '') {
  24. $text = '<div class="ccm-attribute-field-none">' . t('None') . '</div>';
  25. } else {
  26. $text = $value;
  27. }
  28. if ($ak->isAttributeKeyEditable()) {
  29. $type = $ak->getAttributeType();
  30. $html = '
  31. <tr class="ccm-attribute-editable-field">
  32. <td style="white-space: nowrap; padding-right: 20px"><strong><a href="javascript:void(0)">' . $ak->getAttributeKeyDisplayHandle() . '</a></strong></td>
  33. <td width="100%" class="ccm-attribute-editable-field-central"><div class="ccm-attribute-editable-field-text">' . $text . '</div>
  34. <form method="post" action="' . View::url('/dashboard/users/search', 'edit_attribute') . '">
  35. <input type="hidden" name="uakID" value="' . $ak->getAttributeKeyID() . '" />
  36. <input type="hidden" name="uID" value="' . $uo->getUserID() . '" />
  37. <input type="hidden" name="task" value="update_extended_attribute" />
  38. <div class="ccm-attribute-editable-field-form ccm-attribute-editable-field-type-' . strtolower($type->getAttributeTypeHandle()) . '">
  39. ' . $ak->render('form', $vo, true) . '
  40. </div>
  41. </form>
  42. </td>
  43. <td class="ccm-attribute-editable-field-save"><a href="javascript:void(0)"><img src="' . ASSETS_URL_IMAGES . '/icons/edit_small.png" width="16" height="16" class="ccm-attribute-editable-field-save-button" /></a>
  44. <a href="javascript:void(0)"><img src="' . ASSETS_URL_IMAGES . '/icons/close.png" width="16" height="16" class="ccm-attribute-editable-field-clear-button" /></a>
  45. <img src="' . ASSETS_URL_IMAGES . '/throbber_white_16.gif" width="16" height="16" class="ccm-attribute-editable-field-loading" />
  46. </td>
  47. </tr>';
  48. } else {
  49. $html = '
  50. <tr>
  51. <th>' . $ak->getAttributeKeyDisplayHandle() . '</th>
  52. <td width="100%" colspan="2">' . $text . '</td>
  53. </tr>';
  54. }
  55. print $html;
  56. }
  57. if (intval($_GET['uID'])) {
  58. $uo = UserInfo::getByID(intval($_GET['uID']));
  59. if (is_object($uo)) {
  60. $uID = intval($_REQUEST['uID']);
  61. if (isset($_GET['task'])) {
  62. if ($uo->getUserID() == USER_SUPER_ID && (!$u->isSuperUser())) {
  63. throw new Exception(t('Only the super user may edit this account.'));
  64. }
  65. }
  66. if ($_GET['task'] == 'activate') {
  67. if( !$valt->validate("user_activate") ){
  68. throw new Exception('Invalid token. Unable to activate user.');
  69. }else{
  70. $uo->activate();
  71. $uo = UserInfo::getByID(intval($_GET['uID']));
  72. $message = t("User activated.");
  73. }
  74. }
  75. if ($_GET['task'] == 'validate_email') {
  76. $uo->markValidated();
  77. $uo = UserInfo::getByID(intval($_GET['uID']));
  78. $message = t("Email marked as valid.");
  79. }
  80. if ($_GET['task'] == 'remove-avatar') {
  81. $av->removeAvatar($uo->getUserID());
  82. $this->controller->redirect('/dashboard/users/search?uID=' . intval($_GET['uID']) . '&task=edit');
  83. }
  84. if ($_GET['task'] == 'deactivate') {
  85. if( !$valt->validate("user_deactivate") ){
  86. throw new Exception('Invalid token. Unable to deactivate user.');
  87. }else{
  88. $uo->deactivate();
  89. $uo = UserInfo::getByID(intval($_GET['uID']));
  90. $message = t("User deactivated.");
  91. }
  92. }
  93. if ($_POST['edit']) {
  94. $username = trim($_POST['uName']);
  95. $username = preg_replace("/\s+/", " ", $username);
  96. $_POST['uName'] = $username;
  97. $password = $_POST['uPassword'];
  98. $passwordConfirm = $_POST['uPasswordConfirm'];
  99. if ($password) {
  100. if ((strlen($password) < USER_PASSWORD_MINIMUM) || (strlen($password) > USER_PASSWORD_MAXIMUM)) {
  101. $error[] = t('A password must be between %s and %s characters',USER_PASSWORD_MINIMUM,USER_PASSWORD_MAXIMUM);
  102. }
  103. }
  104. if (!$vals->email($_POST['uEmail'])) {
  105. $error[] = t('Invalid email address provided.');
  106. } else if (!$valc->isUniqueEmail($_POST['uEmail']) && $uo->getUserEmail() != $_POST['uEmail']) {
  107. $error[] = t("The email address '%s' is already in use. Please choose another.",$_POST['uEmail']);
  108. }
  109. if (USER_REGISTRATION_WITH_EMAIL_ADDRESS == false) {
  110. if (strlen($username) < USER_USERNAME_MINIMUM) {
  111. $error[] = t('A username must be at least %s characters long.',USER_USERNAME_MINIMUM);
  112. }
  113. if (strlen($username) > USER_USERNAME_MAXIMUM) {
  114. $error[] = t('A username cannot be more than %s characters long.',USER_USERNAME_MAXIMUM);
  115. }
  116. /*
  117. if (strlen($username) >= USER_USERNAME_MINIMUM && !$vals->alphanum($username,USER_USERNAME_ALLOW_SPACES)) {
  118. if(USER_USERNAME_ALLOW_SPACES) {
  119. $e->add(t('A username may only contain letters, numbers and spaces.'));
  120. } else {
  121. $e->add(t('A username may only contain letters or numbers.'));
  122. }
  123. }
  124. */
  125. if (strlen($username) >= USER_USERNAME_MINIMUM && !$valc->username($username)) {
  126. if(USER_USERNAME_ALLOW_SPACES) {
  127. $error[] = t('A username may only contain letters, numbers and spaces.');
  128. } else {
  129. $error[] = t('A username may only contain letters or numbers.');
  130. }
  131. }
  132. if (!$valc->isUniqueUsername($username) && $uo->getUserName() != $username) {
  133. $error[] = t("The username '%s' already exists. Please choose another",$username);
  134. }
  135. }
  136. if (strlen($password) >= USER_PASSWORD_MINIMUM && !$valc->password($password)) {
  137. $error[] = t('A password may not contain ", \', >, <, or any spaces.');
  138. }
  139. if ($password) {
  140. if ($password != $passwordConfirm) {
  141. $error[] = t('The two passwords provided do not match.');
  142. }
  143. }
  144. if (!$valt->validate('update_account_' . intval($_GET['uID']) )) {
  145. $error[] = $valt->getErrorMessage();
  146. }
  147. if (!$error) {
  148. // do the registration
  149. $process = $uo->update($_POST);
  150. //$db = Loader::db();
  151. if ($process) {
  152. if ( is_uploaded_file($_FILES['uAvatar']['tmp_name']) ) {
  153. $uHasAvatar = $av->updateUserAvatar($_FILES['uAvatar']['tmp_name'], $uo->getUserID());
  154. }
  155. $uo->updateGroups($_POST['gID']);
  156. $message = t("User updated successfully. ");
  157. if ($password) {
  158. $message .= t("Password changed.");
  159. }
  160. $editComplete = true;
  161. // reload user object
  162. $uo = UserInfo::getByID(intval($_GET['uID']));
  163. } else {
  164. $db = Loader::db();
  165. $error[] = $db->ErrorMsg();
  166. }
  167. }
  168. }
  169. }
  170. }
  171. if (is_object($uo)) {
  172. $gl = new GroupList($uo, true);
  173. if ($_GET['task'] == 'edit' || $_POST['edit'] && !$editComplete) { ?>
  174. <div class="wrapper">
  175. <div class="actions">
  176. <span class="required">*</span> - <?=t('required field')?>
  177. </div>
  178. <?
  179. $uName = ($_POST) ? $_POST['uName'] : $uo->getUserName();
  180. $uEmail = ($_POST) ? $_POST['uEmail'] : $uo->getUserEmail();
  181. ?>
  182. <script>
  183. function editAttrVal(attId,cancel){
  184. if(!cancel){
  185. $('#attUnknownWrap'+attId).css('display','none');
  186. $('#attEditWrap'+attId).css('display','block');
  187. $('#attValChanged'+attId).val(attId);
  188. }else{
  189. $('#attUnknownWrap'+attId).css('display','block');
  190. $('#attEditWrap'+attId).css('display','none');
  191. $('#attValChanged'+attId).val(0);
  192. }
  193. }
  194. </script>
  195. <h1><span><?=t('Edit Account')?></span></h1>
  196. <div class="ccm-dashboard-inner">
  197. <form method="post" enctype="multipart/form-data" id="ccm-user-form" action="<?=$this->url('/dashboard/users/search?uID=' . intval($_GET['uID']) )?>">
  198. <?=$valt->output('update_account_' . intval($_GET['uID']) )?>
  199. <input type="hidden" name="_disableLogin" value="1">
  200. <div style="margin:0px; padding:0px; width:100%; height:auto" >
  201. <table class="entry-form" border="0" cellspacing="1" cellpadding="0">
  202. <tr>
  203. <td colspan="3" class="header"><?=t('Core Information')?></td>
  204. </tr>
  205. <tr>
  206. <td class="subheader"><?=t('Username')?> <span class="required">*</span></td>
  207. <td class="subheader"><?=t('Email Address')?> <span class="required">*</span></td>
  208. <td class="subheader"><?=t('User Avatar')?></td>
  209. </tr>
  210. <tr>
  211. <td><input type="text" name="uName" autocomplete="off" value="<?=$uName?>" style="width: 94%"></td>
  212. <td><input type="text" name="uEmail" autocomplete="off" value="<?=$uEmail?>" style="width: 94%"></td>
  213. <td><input type="file" name="uAvatar" style="width: 94%" /> <input type="hidden" name="uHasAvatar" value="<?=$uo->hasAvatar()?>" />
  214. <? if ($uo->hasAvatar()) { ?>
  215. <input type="button" onclick="location.href='<?=$this->url('/dashboard/users/search?uID=' . intval($uID) . '&task=remove-avatar')?>'" value="<?=t('Remove Avatar')?>" />
  216. <? } ?>
  217. </td>
  218. </tr>
  219. <tr>
  220. <td colspan="3" class="header"><?=t('Change Password')?></td>
  221. </tr>
  222. <tr>
  223. <td class="subheader"><?=t('Password')?></td>
  224. <td class="subheader" colspan="2"><?=t('Password (Confirm)')?></td>
  225. </tr>
  226. <tr>
  227. <td><input type="password" name="uPassword" autocomplete="off" value="" style="width: 94%"></td>
  228. <td><input type="password" name="uPasswordConfirm" autocomplete="off" value="" style="width: 94%"></td>
  229. <td><?=t('(Leave these fields blank to keep the same password)')?></td>
  230. </tr>
  231. <?
  232. $languages = Localization::getAvailableInterfaceLanguages();
  233. if (count($languages) > 0) { ?>
  234. <tr>
  235. <td class="subheader" colspan="3"><?=t('Default Language')?></td>
  236. </tr>
  237. <tr>
  238. <Td colspan="3">
  239. <?
  240. array_unshift($languages, 'en_US');
  241. $locales = array();
  242. Loader::library('3rdparty/Zend/Locale');
  243. $locales[''] = t('** Default');
  244. foreach($languages as $lang) {
  245. $loc = new Zend_Locale($lang);
  246. $locales[$lang] = Zend_Locale::getTranslation($loc->getLanguage(), 'language', ACTIVE_LOCALE);
  247. }
  248. $ux = $uo->getUserObject();
  249. print $form->select('uDefaultLanguage', $locales, $ux->getUserDefaultLanguage());
  250. ?>
  251. </td>
  252. </tr>
  253. <? } ?>
  254. <? if(ENABLE_USER_TIMEZONES) { ?>
  255. <tr>
  256. <td class="subheader" colspan="3"><?=t('Time Zone')?></td>
  257. </tr>
  258. <tr>
  259. <td colspan="3">
  260. <?php
  261. echo $form->select('uTimezone',
  262. $dh->getTimezones(),
  263. ($uo->getUserTimezone()?$uo->getUserTimezone():date_default_timezone_get())
  264. ); ?>
  265. </td>
  266. </tr>
  267. <?php } ?>
  268. <tr>
  269. <td colspan="3" class="header">
  270. <a id="groupSelector" href="<?=REL_DIR_FILES_TOOLS_REQUIRED?>/user_group_selector.php?mode=groups" dialog-title="<?=t('Add Groups')?>" dialog-modal="false" style="float: right"><?=t('Add Group')?></a>
  271. <?=t('Groups')?>
  272. </td>
  273. </tr>
  274. <? $gArray = $gl->getGroupList(); ?>
  275. <tr>
  276. <td colspan="3">
  277. <? foreach ($gArray as $g) { ?>
  278. <input type="checkbox" name="gID[]" value="<?=$g->getGroupID()?>" style="vertical-align: middle" <?
  279. if (is_array($_POST['gID'])) {
  280. if (in_array($g->getGroupID(), $_POST['gID'])) {
  281. echo(' checked ');
  282. }
  283. } else {
  284. if ($g->inGroup()) {
  285. echo(' checked ');
  286. }
  287. }
  288. ?> /> <?=$g->getGroupName()?><br>
  289. <? } ?>
  290. <div id="ccm-additional-groups"></div>
  291. </td>
  292. </tr>
  293. </table>
  294. <input type="hidden" name="edit" value="1" />
  295. <div class="ccm-buttons">
  296. <?=Loader::helper('concrete/interface')->button(t('Back'), $this->url('/dashboard/users/search?uID=' . intval($_GET['uID'])), 'left')?>
  297. <?=Loader::helper('concrete/interface')->submit(t('Update User'))?>
  298. </div>
  299. </form>
  300. <div class="ccm-spacer">&nbsp;</div>
  301. <br/>
  302. <table class="entry-form" border="0" cellspacing="1" cellpadding="0">
  303. <tr>
  304. <td colspan="3" class="header"><?=t('Other Information - Click Field Name to Edit')?></td>
  305. </tr>
  306. <?
  307. $attribs = UserAttributeKey::getEditableList();
  308. foreach($attribs as $ak) {
  309. printAttributeRow($ak, $uo);
  310. } ?>
  311. </table>
  312. </div>
  313. <div class="ccm-spacer">&nbsp;</div>
  314. </div>
  315. <? } else { ?>
  316. <h1><span><?=t('View User')?></span></h1>
  317. <div class="ccm-dashboard-inner">
  318. <div class="actions" >
  319. <? if ($uo->getUserID() != USER_SUPER_ID || $u->isSuperUser()) { ?>
  320. <? print $ih->button(t('Edit User'), $this->url('/dashboard/users/search?uID=' . intval($uID) ) . '&task=edit', 'left');?>
  321. <? if (USER_VALIDATE_EMAIL == true) { ?>
  322. <? if ($uo->isValidated() < 1) { ?>
  323. <? print $ih->button(t('Mark Email as Valid'), $this->url('/dashboard/users/search?uID=' . intval($uID) . '&task=validate_email'), 'left');?>
  324. <? } ?>
  325. <? } ?>
  326. <? if ($uo->getUserID() != USER_SUPER_ID) { ?>
  327. <? if ($uo->isActive()) { ?>
  328. <? print $ih->button(t('Deactivate User'), $this->url('/dashboard/users/search?uID=' . intval($uID) . '&task=deactivate&ccm_token='.$valt->generate('user_deactivate')), 'left');?>
  329. <? } else { ?>
  330. <? print $ih->button(t('Activate User'), $this->url('/dashboard/users/search?uID=' . intval($uID) . '&task=activate&ccm_token='.$valt->generate('user_activate')), 'left');?>
  331. <? } ?>
  332. <? } ?>
  333. <? } ?>
  334. <?
  335. $tp = new TaskPermission();
  336. if ($uo->getUserID() != $u->getUserID()) {
  337. if ($tp->canSudo()) {
  338. $loginAsUserConfirm = t('This will end your current session and sign you in as %s', $uo->getUserName());
  339. print $ih->button_js(t('Sign In as User'), 'loginAsUser()', 'left');?>
  340. <script type="text/javascript">
  341. loginAsUser = function() {
  342. if (confirm('<?=$loginAsUserConfirm?>')) {
  343. location.href = "<?=$this->url('/dashboard/users/search', 'sign_in_as_user', $uo->getUserID(), $valt->generate('sudo'))?>";
  344. }
  345. }
  346. </script>
  347. <? } /*else { ?>
  348. <? print $ih->button_js(t('Sign In as User'), 'alert(\'' . t('You do not have permission to sign in as other users.') . '\')', 'left', 'ccm-button-inactive');?>
  349. <? }*/ ?>
  350. <? } ?>
  351. </div>
  352. <h2><?=t('Required Information')?></h2>
  353. <div style="margin:0px; padding:0px; width:100%; height:auto" >
  354. <table border="0" cellspacing="1" cellpadding="0">
  355. <tr>
  356. <td><?=$av->outputUserAvatar($uo)?></td>
  357. <td><?=$uo->getUserName()?><br/>
  358. <a href="mailto:<?=$uo->getUserEmail()?>"><?=$uo->getUserEmail()?></a><br/>
  359. <?=$uo->getUserDateAdded('user')?>
  360. <?=(ENABLE_USER_TIMEZONES && strlen($uo->getUserTimezone())?"<br />".t('Timezone').": ".$uo->getUserTimezone():"")?>
  361. <? if (USER_VALIDATE_EMAIL) { ?><br/>
  362. <?=t('Full Record')?>: <strong><?= ($uo->isFullRecord()) ? "Yes" : "No" ?></strong>
  363. &nbsp;&nbsp;
  364. <?=t('Email Validated')?>: <strong><?
  365. switch($uo->isValidated()) {
  366. case '-1':
  367. print t('Unknown');
  368. break;
  369. case '0':
  370. print t('No');
  371. break;
  372. case '1':
  373. print t('Yes');
  374. break;
  375. }?>
  376. </strong>
  377. <? } ?></td>
  378. </tr>
  379. </table>
  380. </div>
  381. <?
  382. $attribs = UserAttributeKey::getList(true);
  383. if (count($attribs) > 0) { ?>
  384. <h2><?=t('Other Information')?></h2>
  385. <div style="margin:0px; padding:0px; width:100%; height:auto" >
  386. <table class="entry-form" border="0" cellspacing="1" cellpadding="0">
  387. <?
  388. for ($i = 0; $i < count($attribs); $i = $i + 3) {
  389. $uk = $attribs[$i];
  390. $uk2 = $attribs[$i+1];
  391. $uk3 = $attribs[$i+2];
  392. ?>
  393. <tr>
  394. <td class="subheader" style="width: 33%"><?=$uk->getAttributeKeyDisplayHandle()?></td>
  395. <? if (is_object($uk2)) { ?><td style="width: 33%" class="subheader"><?=$uk2->getAttributeKeyDisplayHandle()?></td><? } else { ?><td style="width: 33%" class="subheader">&nbsp;</td><? } ?>
  396. <? if (is_object($uk3)) { ?><td style="width: 33%"class="subheader"><?=$uk3->getAttributeKeyDisplayHandle()?></td><? } else { ?><td style="width: 33%" class="subheader">&nbsp;</td><? } ?>
  397. </tr>
  398. <tr>
  399. <td><?=$uo->getAttribute($uk->getAttributeKeyHandle(), 'displaySanitized', 'display')?></td>
  400. <? if (is_object($uk2)) { ?><td><?=$uo->getAttribute($uk2->getAttributeKeyHandle(), 'displaySanitized', 'display')?></td><? } else { ?><td style="width: 33%">&nbsp;</td><? } ?>
  401. <? if (is_object($uk3)) { ?><td><?=$uo->getAttribute($uk3->getAttributeKeyHandle(), 'displaySanitized', 'display')?></td><? } else { ?><td>&nbsp;</td><? } ?>
  402. </tr>
  403. <? } ?>
  404. </table>
  405. </div>
  406. <? } ?>
  407. <h2><?=t('Groups')?></h2>
  408. <div style="margin:0px; padding:0px; width:100%; height:auto" >
  409. <table class="entry-form" border="0" cellspacing="1" cellpadding="0">
  410. <tr>
  411. <td colspan="2" class="header"><?=t('Group')?></td>
  412. <td class="header"><?=t('Date Entered')?></td>
  413. </tr>
  414. <? $gArray = $gl->getGroupList(); ?>
  415. <tr>
  416. <td colspan="2">
  417. <? $enteredArray = array(); ?>
  418. <? foreach ($gArray as $g) { ?>
  419. <? if ($g->inGroup()) {
  420. echo($g->getGroupName() . '<br>');
  421. $enteredArray[] = $g->getGroupDateTimeEntered();
  422. } ?>
  423. <? } ?>
  424. </td>
  425. <td>
  426. <? foreach ($enteredArray as $dateTime) {
  427. if ($dateTime != '0000-00-00 00:00:00') {
  428. echo($dateTime . '<br>');
  429. } else {
  430. echo('<br>');
  431. }
  432. } ?>
  433. </td>
  434. </tr>
  435. </table>
  436. </div>
  437. </div>
  438. <h1><span><?=t('Delete User')?></span></h1>
  439. <div class="ccm-dashboard-inner">
  440. <div class="ccm-spacer"></div>
  441. <?
  442. $cu = new User();
  443. $tp = new TaskPermission();
  444. if ($tp->canDeleteUser()) {
  445. $delConfirmJS = t('Are you sure you want to permanently remove this user?');
  446. if ($uo->getUserID() == USER_SUPER_ID) { ?>
  447. <?=t('You may not remove the super user account.')?>
  448. <? } else if (!$tp->canDeleteUser()) { ?>
  449. <?=t('You do not have permission to perform this action.');
  450. } else if ($uo->getUserID() == $cu->getUserID()) {
  451. echo t('You cannot delete your own user account.');
  452. }else{ ?>
  453. <script type="text/javascript">
  454. deleteUser = function() {
  455. if (confirm('<?=$delConfirmJS?>')) {
  456. location.href = "<?=$this->url('/dashboard/users/search', 'delete', $uo->getUserID(), $valt->generate('delete_account'))?>";
  457. }
  458. }
  459. </script>
  460. <? print $ih->button_js(t('Delete User Account'), "deleteUser()", 'left');?>
  461. <? }
  462. } else {
  463. echo t('You do not have permission to perform this action.');
  464. }?>
  465. <div class="ccm-spacer"></div>
  466. </div>
  467. <? } ?>
  468. <script type="text/javascript">
  469. ccm_activateEditableProperties = function() {
  470. $("tr.ccm-attribute-editable-field").each(function() {
  471. var trow = $(this);
  472. $(this).find('a').click(function() {
  473. trow.find('.ccm-attribute-editable-field-text').hide();
  474. trow.find('.ccm-attribute-editable-field-clear-button').hide();
  475. trow.find('.ccm-attribute-editable-field-form').show();
  476. trow.find('.ccm-attribute-editable-field-save-button').show();
  477. });
  478. trow.find('form').submit(function() {
  479. ccm_submitEditableProperty(trow);
  480. return false;
  481. });
  482. trow.find('.ccm-attribute-editable-field-save-button').parent().click(function() {
  483. ccm_submitEditableProperty(trow);
  484. });
  485. trow.find('.ccm-attribute-editable-field-clear-button').parent().unbind();
  486. trow.find('.ccm-attribute-editable-field-clear-button').parent().click(function() {
  487. trow.find('form input[name=task]').val('clear_extended_attribute');
  488. ccm_submitEditableProperty(trow);
  489. return false;
  490. });
  491. });
  492. }
  493. ccm_submitEditableProperty = function(trow) {
  494. trow.find('.ccm-attribute-editable-field-save-button').hide();
  495. trow.find('.ccm-attribute-editable-field-clear-button').hide();
  496. trow.find('.ccm-attribute-editable-field-loading').show();
  497. try {
  498. tinyMCE.triggerSave(true, true);
  499. } catch(e) { }
  500. trow.find('form').ajaxSubmit(function(resp) {
  501. // resp is new HTML to display in the div
  502. trow.find('.ccm-attribute-editable-field-loading').hide();
  503. trow.find('.ccm-attribute-editable-field-save-button').show();
  504. trow.find('.ccm-attribute-editable-field-text').html(resp);
  505. trow.find('.ccm-attribute-editable-field-form').hide();
  506. trow.find('.ccm-attribute-editable-field-save-button').hide();
  507. trow.find('.ccm-attribute-editable-field-text').show();
  508. trow.find('.ccm-attribute-editable-field-clear-button').show();
  509. trow.find('td').show('highlight', {
  510. color: '#FFF9BB'
  511. });
  512. });
  513. }
  514. $(function() {
  515. ccm_activateEditableProperties();
  516. $("#groupSelector").dialog();
  517. ccm_triggerSelectGroup = function(gID, gName) {
  518. var html = '<input type="checkbox" name="gID[]" value="' + gID + '" style="vertical-align: middle" checked /> ' + gName + '<br/>';
  519. $("#ccm-additional-groups").append(html);
  520. }
  521. });
  522. </script>
  523. <?
  524. } else { ?>
  525. <h1><span><?=t('User Search')?></span></h1>
  526. <div class="ccm-dashboard-inner">
  527. <?
  528. $tp = new TaskPermission();
  529. if ($tp->canAccessUserSearch()) {
  530. ?>
  531. <table id="ccm-search-form-table" >
  532. <tr>
  533. <td valign="top" class="ccm-search-form-advanced-col">
  534. <? Loader::element('users/search_form_advanced'); ?>
  535. </td>
  536. <td valign="top" width="100%">
  537. <div id="ccm-search-advanced-results-wrapper">
  538. <div id="ccm-user-search-results">
  539. <? Loader::element('users/search_results', array('users' => $users, 'userList' => $userList, 'pagination' => $pagination)); ?>
  540. </div>
  541. </div>
  542. </td>
  543. </tr>
  544. </table>
  545. <? } else { ?>
  546. <p><?=t('You do not have access to user search. This setting may be changed in the access section of the dashboard settings page.')?></p>
  547. <? } ?>
  548. </div>
  549. <? } ?>