/[drupal]/contributions/modules/update_status_aggregator/update_status_aggregator.module
ViewVC logotype

Diff of /contributions/modules/update_status_aggregator/update_status_aggregator.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.13.2.3, Fri May 2 19:21:41 2008 UTC revision 1.13.2.4, Tue Oct 21 17:19:09 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: update_status_aggregator.module,v 1.13.2.2 2008/03/28 20:42:57 yrocq Exp $  // $Id: update_status_aggregator.module,v 1.13.2.3 2008/05/02 19:21:41 yrocq Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 99  function update_status_aggregator_views_ Line 99  function update_status_aggregator_views_
99      'handler' => 'views_handler_site',      'handler' => 'views_handler_site',
100      'sortable' => TRUE,      'sortable' => TRUE,
101      ),      ),
102    "status" => array(    "module_status" => array(
103      'name' => t('Update status aggregator status'),      'name' => t('Update status aggregator status'),
104      'help' => t('Update status aggregator status'),      'help' => t('Update status aggregator status'),
105      'handler' => 'views_handler_status',      'handler' => 'views_handler_status',
# Line 107  function update_status_aggregator_views_ Line 107  function update_status_aggregator_views_
107      ),      ),
108      ),      ),
109    'filters' => array(    'filters' => array(
110    'status' => array(    'module_status' => array(
111      'name' => 'update_status_aggregator: Status',      'name' => 'update_status_aggregator: Status',
112      'help' => 'Status of the module',      'help' => 'Status of the module',
113      'operator' => views_handler_operator_eqneq(),      'operator' => views_handler_operator_eqneq(),
# Line 182  function update_status_aggregator_views_ Line 182  function update_status_aggregator_views_
182        ),        ),
183        array(        array(
184          'tablename' => 'update_status_aggregator',          'tablename' => 'update_status_aggregator',
185          'field' => 'status',          'field' => 'module_status',
186          'label' => '',          'label' => '',
187        ),        ),
188      );      );
189      $view->filter = array(      $view->filter = array(
190        array(        array(
191          'tablename' => 'update_status_aggregator',          'tablename' => 'update_status_aggregator',
192          'field' => 'status',          'field' => 'module_status',
193          'operator' => '=',          'operator' => '=',
194          'options' => '',          'options' => '',
195          'value' => '4',          'value' => '4',
# Line 212  function update_status_aggregator_views_ Line 212  function update_status_aggregator_views_
212      $view->exposed_filter = array(      $view->exposed_filter = array(
213        array(        array(
214          'tablename' => 'update_status_aggregator',          'tablename' => 'update_status_aggregator',
215          'field' => 'status',          'field' => 'module_status',
216          'label' => 'Status',          'label' => 'Status',
217          'optional' => '1',          'optional' => '1',
218          'is_default' => '0',          'is_default' => '0',
# Line 294  function update_status_aggregator_node_i Line 294  function update_status_aggregator_node_i
294    
295  function update_status_aggregator_load($node) {  function update_status_aggregator_load($node) {
296    if ($node->type == "update_status_aggregator_module") {    if ($node->type == "update_status_aggregator_module") {
297      return db_fetch_object(db_query('SELECT module, usa.status, n.title AS site, n.nid AS site_id FROM {update_status_aggregator} usa INNER JOIN {node} n ON n.nid = usa.site WHERE usa.vid = %d', $node->vid));      return db_fetch_object(db_query('SELECT module, usa.module_status, n.title AS site, n.nid AS site_id FROM {update_status_aggregator} usa INNER JOIN {node} n ON n.nid = usa.site WHERE usa.vid = %d', $node->vid));
298    }    }
299    elseif ($node->type == "update_status_aggregator_site") {    elseif ($node->type == "update_status_aggregator_site") {
300      return db_fetch_object(db_query('SELECT drupal_key FROM {update_status_aggregator_keys} WHERE vid = %d', $node->vid));      return db_fetch_object(db_query('SELECT drupal_key FROM {update_status_aggregator_keys} WHERE vid = %d', $node->vid));
# Line 321  function update_status_aggregator_view($ Line 321  function update_status_aggregator_view($
321          '#weight' => 2          '#weight' => 2
322          );          );
323        $status = status_int_to_string($node->status);        $status = status_int_to_string($node->status);
324        $node->content['status'] = array(        $node->content['module_status'] = array(
325          '#value' => t("Status") .": ". $status ."<br/>",          '#value' => t("Status") .": ". $status ."<br/>",
326          '#weight' => 2          '#weight' => 2
327          );          );
# Line 346  function update_status_aggregator_view($ Line 346  function update_status_aggregator_view($
346   */   */
347  function update_status_aggregator_insert($node) {  function update_status_aggregator_insert($node) {
348    if ($node->type == "update_status_aggregator_module") {    if ($node->type == "update_status_aggregator_module") {
349      db_query("INSERT INTO {update_status_aggregator} (nid, vid, module, site, status) VALUES (%d, %d, '%s', '%s', %d)",      db_query("INSERT INTO {update_status_aggregator} (nid, vid, module, site, module_status) VALUES (%d, %d, '%s', '%s', %d)",
350        $node->nid, $node->vid, $node->short_name, $node->site, $node->status);        $node->nid, $node->vid, $node->short_name, $node->site, $node->module_status);
351    }    }
352    elseif ($node->type == "update_status_aggregator_site") {    elseif ($node->type == "update_status_aggregator_site") {
353      db_query("INSERT INTO {update_status_aggregator_keys} (nid, vid, drupal_key) VALUES (%d, %d, '%s')",      db_query("INSERT INTO {update_status_aggregator_keys} (nid, vid, drupal_key) VALUES (%d, %d, '%s')",
# Line 365  function update_status_aggregator_update Line 365  function update_status_aggregator_update
365      }      }
366      else {      else {
367        if ($node->type == "update_status_aggregator_module") {        if ($node->type == "update_status_aggregator_module") {
368          db_query("UPDATE {update_status_aggregator} SET module = '%s', site = '%s', status = %d WHERE vid = %d",          db_query("UPDATE {update_status_aggregator} SET module = '%s', site = '%s', module_status = %d WHERE vid = %d",
369            $node->short_name, $node->site, $node->status, $node->vid);            $node->short_name, $node->site, $node->module_status, $node->vid);
370        }        }
371        elseif ($node->type == "update_status_aggregator_site") {        elseif ($node->type == "update_status_aggregator_site") {
372          db_query("UPDATE {update_status_aggregator_keys} SET drupal_key = '%s' WHERE vid = %d", $node->drupal_key, $node->vid);          db_query("UPDATE {update_status_aggregator_keys} SET drupal_key = '%s' WHERE vid = %d", $node->drupal_key, $node->vid);
# Line 418  function update_status_aggregator_form($ Line 418  function update_status_aggregator_form($
418        '#default_value' => $node->site_id,        '#default_value' => $node->site_id,
419        '#required' => TRUE,        '#required' => TRUE,
420      );      );
421      $form['status'] = array(      $form['module_status'] = array(
422        '#type' => 'textfield',        '#type' => 'textfield',
423        '#title' => t('Status'),        '#title' => t('Status'),
424        '#size' => 60,        '#size' => 60,
425        '#maxlength' => 128,        '#maxlength' => 128,
426        '#default_value' => $node->status,        '#default_value' => $node->module_status,
427        '#required' => TRUE,        '#required' => TRUE,
428      );      );
429    }    }
# Line 484  function update_status_aggregator_xml_no Line 484  function update_status_aggregator_xml_no
484    
485        $pre['short_name'] = $module;        $pre['short_name'] = $module;
486        $pre['site'] = $site->nid;        $pre['site'] = $site->nid;
487        $pre['status'] = $status;        $pre['module_status'] = $status;
488    
489        $node = node_submit($pre);        $node = node_submit($pre);
490        node_save($node);        node_save($node);

Legend:
Removed from v.1.13.2.3  
changed lines
  Added in v.1.13.2.4

  ViewVC Help
Powered by ViewVC 1.1.2