| 1 |
<?php |
<?php |
| 2 |
// $Id: storm.module,v 1.10.4.8 2008/08/01 08:15:09 robertogerola Exp $ |
// $Id: storm.module,v 1.10.4.9 2008/08/25 09:04:44 robertogerola Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 10 |
|
|
| 11 |
switch ($path) { |
switch ($path) { |
| 12 |
case "admin/help#storm": |
case "admin/help#storm": |
| 13 |
$output = '<p>'. t("Provides a complete project management environment") .'</p>'; |
$output = '<p>'. storm_t("Provides a complete project management environment") .'</p>'; |
| 14 |
break; |
break; |
| 15 |
} |
} |
| 16 |
|
|
| 30 |
$items = array(); |
$items = array(); |
| 31 |
|
|
| 32 |
$items['storm'] = array( |
$items['storm'] = array( |
| 33 |
'title' => t('Storm'), |
'title' => storm_t('Storm'), |
| 34 |
'description' => t('SpeedTech Organizer and Resource Manager'), |
'description' => storm_t('SpeedTech Organizer and Resource Manager'), |
| 35 |
'page callback' => 'storm_storm', |
'page callback' => 'storm_storm', |
| 36 |
'access arguments' => array('Storm: access'), |
'access arguments' => array('Storm: access'), |
| 37 |
'parent' => '', |
'parent' => '', |
| 38 |
'type' => MENU_NORMAL_ITEM); |
'type' => MENU_NORMAL_ITEM); |
| 39 |
|
|
| 40 |
$items['admin/storm'] = array( |
$items['admin/storm'] = array( |
| 41 |
'title' => t('Storm'), |
'title' => storm_t('Storm'), |
| 42 |
'description' => t('SpeedTech Organizer and Resource Manager'), |
'description' => storm_t('SpeedTech Organizer and Resource Manager'), |
| 43 |
'page callback' => 'drupal_get_form', |
'page callback' => 'drupal_get_form', |
| 44 |
'page arguments' => array('storm_admin_settings'), |
'page arguments' => array('storm_admin_settings'), |
| 45 |
'access arguments' => array('access administration pages'), |
'access arguments' => array('access administration pages'), |
| 73 |
'file' => 'storm.theme.inc', |
'file' => 'storm.theme.inc', |
| 74 |
'arguments' => array('label', 'value'), |
'arguments' => array('label', 'value'), |
| 75 |
), |
), |
| 76 |
|
'storm_texts' => array( |
| 77 |
|
'file' => 'storm.theme.inc', |
| 78 |
|
'arguments' => array(), |
| 79 |
|
), |
| 80 |
); |
); |
| 81 |
} |
} |
| 82 |
|
|
| 94 |
|
|
| 95 |
$form['storm_icons_dir'] = array( |
$form['storm_icons_dir'] = array( |
| 96 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 97 |
'#title' => t('Icons directory'), |
'#title' => storm_t('Icons directory'), |
| 98 |
'#default_value' => variable_get('storm_icons_path', drupal_get_path('module', 'storm') .'/icons'), |
'#default_value' => variable_get('storm_icons_path', drupal_get_path('module', 'storm') .'/icons'), |
| 99 |
'#description' => t("The directory that contains the Storm's icons"), |
'#description' => storm_t("The directory that contains the Storm's icons"), |
| 100 |
'#weight' => -11, |
'#weight' => -11, |
| 101 |
); |
); |
| 102 |
|
|
| 103 |
$form['stormreports'] = array( |
$form['stormreports'] = array( |
| 104 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 105 |
'#title' => t('Reports'), |
'#title' => storm_t('Reports'), |
| 106 |
'#collapsed' => false, |
'#collapsed' => false, |
| 107 |
'#collapsible' => true, |
'#collapsible' => true, |
| 108 |
'#weight' => -10, |
'#weight' => -10, |
| 110 |
|
|
| 111 |
$form['stormreports']['storm_report_header'] = array( |
$form['stormreports']['storm_report_header'] = array( |
| 112 |
'#type' => 'textarea', |
'#type' => 'textarea', |
| 113 |
'#title' => t('Report header'), |
'#title' => storm_t('Report header'), |
| 114 |
'#default_value' => variable_get('storm_report_header', ''), |
'#default_value' => variable_get('storm_report_header', ''), |
| 115 |
'#description' => t('The header that will appear on the reports'), |
'#description' => storm_t('The header that will appear on the reports'), |
| 116 |
); |
); |
| 117 |
|
|
| 118 |
return system_settings_form($form); |
return system_settings_form($form); |
| 201 |
|
|
| 202 |
function storm_datetime_validate($form) { |
function storm_datetime_validate($form) { |
| 203 |
if (!checkdate($form['#value']['month'], $form['#value']['day'], $form['#value']['year'])) { |
if (!checkdate($form['#value']['month'], $form['#value']['day'], $form['#value']['year'])) { |
| 204 |
form_error($form, t('The specified date is invalid.')); |
form_error($form, storm_t('The specified date is invalid.')); |
| 205 |
} |
} |
| 206 |
} |
} |
| 207 |
|
|
| 280 |
$type = $item->type; |
$type = $item->type; |
| 281 |
$af = $type .'_access'; |
$af = $type .'_access'; |
| 282 |
if (!$af('create', $item, $user)) return ''; |
if (!$af('create', $item, $user)) return ''; |
| 283 |
return storm_icon_l('application_add', $path, t('Add'), '', $params); |
return storm_icon_l('application_add', $path, storm_t('Add'), '', $params); |
| 284 |
} |
} |
| 285 |
|
|
| 286 |
function storm_icon_edit($path, $item, $params=array()) { |
function storm_icon_edit($path, $item, $params=array()) { |
| 288 |
$type = $item->type; |
$type = $item->type; |
| 289 |
$af = $type .'_access'; |
$af = $type .'_access'; |
| 290 |
if (!$af('update', $item, $user)) return ''; |
if (!$af('update', $item, $user)) return ''; |
| 291 |
return storm_icon_l('application_edit', $path, t('Edit'), '', $params); |
return storm_icon_l('application_edit', $path, storm_t('Edit'), '', $params); |
| 292 |
} |
} |
| 293 |
|
|
| 294 |
function storm_icon_delete($path, $item, $params=array()) { |
function storm_icon_delete($path, $item, $params=array()) { |
| 296 |
$type = $item->type; |
$type = $item->type; |
| 297 |
$af = $type .'_access'; |
$af = $type .'_access'; |
| 298 |
if (!$af('delete', $item, $user)) return ''; |
if (!$af('delete', $item, $user)) return ''; |
| 299 |
return storm_icon_l('application_delete', $path, t('Delete'), '', $params); |
return storm_icon_l('application_delete', $path, storm_t('Delete'), '', $params); |
| 300 |
} |
} |
| 301 |
|
|
| 302 |
function storm_icon_l($icon, $path, $title, $permission='', $params=array(), $attributes=array()) { |
function storm_icon_l($icon, $path, $title, $permission='', $params=array(), $attributes=array()) { |
| 518 |
return $return; |
return $return; |
| 519 |
} |
} |
| 520 |
} |
} |
| 521 |
|
|
| 522 |
|
function storm_t($text, $domain='default', $args = array(), $langcode = NULL) { |
| 523 |
|
static $items; |
| 524 |
|
if (!$items) { |
| 525 |
|
$items = theme('storm_texts'); |
| 526 |
|
} |
| 527 |
|
if (is_array($items)) { |
| 528 |
|
if (array_key_exists($domain, $items) && array_key_exists($text, $items[$domain])) { |
| 529 |
|
return t($items[$domain][$text], $args, $langcode); |
| 530 |
|
} |
| 531 |
|
else if (array_key_exists('default', $items) && array_key_exists($text, $items['default'])) { |
| 532 |
|
return t($items['default'][$text], $args, $langcode); |
| 533 |
|
} |
| 534 |
|
else { |
| 535 |
|
return t($text, $args, $langcode); |
| 536 |
|
} |
| 537 |
|
} |
| 538 |
|
else { |
| 539 |
|
return t($text, $args, $langcode); |
| 540 |
|
} |
| 541 |
|
} |
| 542 |
|
|