You are here

function workspace_node_status_json_switch in Workspace 7

Function to switch status of dnsman node using json.

1 string reference to 'workspace_node_status_json_switch'
workspace_menu in ./workspace.module
Implements hook_menu().

File

./workspace.module, line 866
Presents a user-centric view of content.

Code

function workspace_node_status_json_switch() {
  $nid = check_plain($_GET['value']);
  if ($nid) {
    $node = node_load($nid);
    if ($node->status) {

      // deactivate
      $status = 0;
    }
    else {

      // activate
      $status = 1;
    }
    $node->status = $status;
    node_save($node);
    $item['status'] = $status ? 'active' : 'inactive';
    $item['id'] = $nid;
    drupal_json_output($item);
  }
  exit;
}