PageRenderTime 2ms CodeModel.GetById 31ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

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

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