You are here

function finder_ui_check_lock in Finder 7.2

Check if Finder is locked for editing.

Also does the unlock message.

Parameters

$finder: The finder.

Return value

TRUE or FALSE.

5 calls to finder_ui_check_lock()
finder_ui_element_delete_form in modules/finder_ui/includes/element.inc
Finder UI element delete form.
finder_ui_element_delete_page in modules/finder_ui/includes/element.inc
Finder UI element delete page.
finder_ui_element_page in modules/finder_ui/includes/element.inc
Finder UI element page.
finder_ui_form in modules/finder_ui/includes/finder.inc
Form handler callback for finder_ui plugin.
finder_ui_form_submit in modules/finder_ui/includes/finder.inc
Form submit callback for finder_ui plugin.

File

modules/finder_ui/includes/common.inc, line 235
common.inc

Code

function finder_ui_check_lock(&$finder) {
  $lock = ctools_object_cache_test('finder', $finder->name);
  if (!empty($lock)) {
    if (isset($_GET['breaklock']) && $_GET['breaklock'] == $lock->uid) {
      ctools_object_cache_clear_all('finder', $finder->name);
      drupal_goto($_GET['q']);
    }
    else {
      drupal_set_message(t('This finder is being edited by user !user, and is therefore locked from saving by others. This lock is !age old. Click here to <a href="!break">break this lock</a>.', array(
        '!user' => theme('username', array(
          'account' => user_load($lock->uid),
        )),
        '!age' => format_interval(REQUEST_TIME - $lock->updated),
        '!break' => '?breaklock=' . $lock->uid,
      )), 'warning', FALSE);
      return FALSE;
    }
  }
  return TRUE;
}