| 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 |
| 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', |
| 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(), |
| 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', |
| 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', |
| 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)); |
| 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 |
); |
); |
| 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')", |
| 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); |
| 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 |
} |
} |
| 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); |