18 require_once SQ_INCLUDE_PATH.
'/asset_edit/asset_edit_fns.inc';
62 if ($asset->writeAccess(
'attributes')) {
63 $o->note(translate(
'password_entry_instructions').
'<br />'.$asset->getPasswordRulesDescription());
81 $group_links = $GLOBALS[
'SQ_SYSTEM']->am->getLinks($asset->id, 1,
'user_group', FALSE,
'minor');
83 $group_assetids = Array();
84 foreach ($group_links as $group_link) {
85 $group_assetids[] = $group_link[
'majorid'];
88 $groups_info = $GLOBALS[
'SQ_SYSTEM']->am->getAssetInfo($group_assetids);
110 if (empty($groups)) {
112 echo translate(
'user_cannot_be_restricted');
117 $admin_access = $asset->adminAccess(
'attributes');
120 $conditions = Array(
'' =>
'-- Select Type --') + $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($GLOBALS[
'SQ_SYSTEM']->am->getTypeDescendants(
'condition'),
'name');
124 $restrictions = $asset->attr(
'restrictions');
126 foreach ($groups as $group_assetid => $group) {
127 $o->openSection($group[
'name'].
' (#'.$group_assetid.
')');
131 if (!array_get_index($restrictions, $group_assetid, FALSE)) {
132 echo translate(
'no_membership_conditions', $group[
'name']);
135 This user is part of
this group when...
136 <table
class=
"sq-backend-table" border=
"1">
138 <th> </th>
149 foreach ($restrictions[$group_assetid] as $key => $restriction) {
150 $condition_prefix = $prefix.
'_condition_'.$group_assetid.
'_'.$key;
153 <td><?php echo $key; ?></td>
156 $edit_fns_classname = $restriction[
'name'].
'_edit_fns';
157 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset($restriction[
'name'], TRUE);
160 $match_options = call_user_func(Array($restriction[
'name'],
'getMatchKeywords'), $restriction[
'name']);
161 combo_box($condition_prefix.
'_match', $match_options, FALSE, $restriction[
'match']);
163 echo translate($restriction[
'name'].
'_'.($restriction[
'match'] ?
'true' :
'false'));
166 call_user_func(Array($edit_fns_classname,
'paintEditInterface'), $restriction[
'condition_data'], $o, $condition_prefix, $admin_access, Array());
172 <td><?php check_box($condition_prefix.
'[delete]',
'1'); ?></td>
186 <p>Add
new condition: <?php combo_box($prefix.
'_'.$group_assetid.
'_new_condition', $conditions, FALSE,
''); ?></p>
216 $admin_access = $asset->adminAccess(
'attributes');
217 $restrictions = $asset->attr(
'restrictions');
220 foreach ($groups as $group_assetid => $group) {
223 if (array_get_index($restrictions, $group_assetid, NULL)) {
226 foreach ($restrictions[$group_assetid] as $key => $restriction) {
227 $condition_prefix = $prefix.
'_condition_'.$group_assetid.
'_'.$key;
230 if (isset($_POST[$condition_prefix]) && array_get_index($_POST[$condition_prefix],
'delete', 0)) {
231 unset($restrictions[$group_assetid][$key]);
234 $dir = $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($restriction[
'name'],
'dir');
235 $edit_fns_classname = $restriction[
'name'].
'_edit_fns';
236 require_once SQ_SYSTEM_ROOT.
'/'.$dir.
'/'.$edit_fns_classname.
'.inc';
237 $condition_data = call_user_func(Array($edit_fns_classname,
'processEditInterface'), $o, $condition_prefix);
238 $restrictions[$group_assetid][$key][
'condition_data'] = $condition_data;
239 $restrictions[$group_assetid][$key][
'match'] = array_get_index($_POST, $condition_prefix.
'_match',
'1');
243 if ($new_name = array_get_index($_POST, $prefix.
'_'.$group_assetid.
'_new_condition')) {
244 $restrictions[$group_assetid][] = Array(
'name' => $new_name,
'match' => 1,
'condition_data' => Array());
248 return $asset->setAttrValue(
'restrictions', $restrictions);
265 $write_access = $asset->writeAccess(
'attributes');
267 require SQ_FUDGE_PATH.
'/standards_lists/locales.inc';
268 $current_locale = $asset->attr(
'locale');
271 $standards_lists_locales = array_reverse($standards_lists_locales);
272 $standards_lists_locales[
''] =
'** Use System Default **';
273 $standards_lists_locales = array_reverse($standards_lists_locales);
274 combo_box($prefix.
'_locale', $standards_lists_locales, FALSE, $current_locale);
276 if (isset($standards_lists_locales[$current_locale])) {
277 echo $standards_lists_locales[$current_locale];
278 }
else if ($current_locale ==
'') {
280 echo translate(
'no_locale_set_for_user', $standards_lists_locales[SQ_CONF_DEFAULT_BACKEND_LOCALE]);
282 echo translate(
'unknown_locale', $current_locale);
286 return $write_access;
303 if (!$asset->writeAccess(
'attributes'))
return FALSE;
304 $asset->setAttrValue(
'locale', $_POST[$prefix.
'_locale']);
305 return $asset->saveAttributes();
322 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'user_group');
324 $user_group_edit_fns = $user_group->getEditFns();
326 return $user_group_edit_fns->paintRoles($asset, $o, $prefix);
343 $GLOBALS[
'SQ_SYSTEM']->am->includeAsset(
'user_group');
345 $user_group_edit_fns = $user_group->getEditFns();
347 return $user_group_edit_fns->processRoles($asset, $o, $prefix);
364 $current_locks = $asset->getUserLocks();
366 if ($current_locks === FALSE) {
367 $o->openField(translate(
'current_locks'));
368 echo
'No ability to show active locks in current lock method';
373 $num_locks = count($current_locks);
374 $write_access = $asset->writeAccess(
'attributes');
375 $o->openField(translate(
'current_locks'));
376 echo translate(
'user_held_locks', htmlspecialchars($asset->name, ENT_COMPAT, SQ_CONF_DEFAULT_CHARACTER_SET), $num_locks);
378 <script type=
"text/javascript">
379 function sq_user_held_locks_info()
381 var userLockInfo = document.getElementById(
'sq_user_held_locks_details');
382 var userLockToggle = document.getElementById(
'sq_user_held_locks_toggle');
383 if (userLockInfo.style.display ==
'none') {
384 userLockInfo.style.display =
'block';
385 userLockToggle.innerHTML =
'<?php echo translate('hide_user_held_locks_details
'); ?>';
387 userLockInfo.style.display =
'none';
388 userLockToggle.innerHTML =
'<?php echo translate('show_user_held_locks_details
'); ?>';
394 $restricted_locks = array_slice($current_locks, 0, 100);
395 echo
'<br /><b class="clickable" onclick="sq_user_held_locks_info();" id="sq_user_held_locks_toggle">'.translate(
'show_user_held_locks_details').
'</b><br />';
396 echo
'<div id="sq_user_held_locks_details" style="display:none;">';
397 echo translate(
'showing_first', count($restricted_locks), $num_locks);
398 echo
'<table class="sq-backend-table">';
400 echo
'<td class="sq-backend-table-header">Asset</td>';
401 echo
'<td class="sq-backend-table-header">Screen</td>';
403 foreach ($restricted_locks as $current_lock) {
404 if (isset($current_lock[
'lockid'])) {
406 if (strpos($current_lock[
'lockid'],
'asset') === 0) {
407 $asset_details = explode(
'.', $current_lock[
'lockid']);
408 if (isset($asset_details[1]) && isset($asset_details[2])) {
409 $locked_asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($asset_details[1],
'', TRUE);
410 if (!is_null($locked_asset)) {
412 echo get_asset_tag_line($locked_asset->id);
414 echo ucwords($asset_details[2]);
417 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($locked_asset);
423 $unknown_lock_id = ucwords(str_replace(
'_',
' ', $current_lock[
'lockid']));
425 echo
'<td colspan="2">'.$unknown_lock_id.
'</td>';
430 echo
'</table></div>';
433 $o->openField(translate(
'release_locks'));
434 if (!$write_access) {
436 <script type=
"text/javascript">
439 function onReleaseAllClick() {
440 if (confirm(
'Are you sure you want to release all user locks?')) {
441 set_hidden_field(
"process_form",
"1");
451 submit_button($prefix.
'_release_all_locks',
'Release All Locks',
'return onReleaseAllClick();');
455 'yes' => translate(
'yes'),
456 'no' => translate(
'no'),
458 combo_box($prefix.
'_release_all_locks_dropdown', $options, FALSE,
'no');
460 $o->note(translate(
'release_locks_note'));
480 $admin_access = $asset->adminAccess();
481 if (!$admin_access)
return FALSE;
483 if ((isset($_POST[$prefix.
'_release_all_locks'])) || (isset($_POST[$prefix.
'_release_all_locks_dropdown']) && ($_POST[$prefix.
'_release_all_locks_dropdown'] ==
'yes'))) {
484 $asset->releaseUserLocks();