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

Diff of /contributions/modules/storm/storm.module

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

revision 1.10.4.9, Mon Aug 25 09:04:44 2008 UTC revision 1.10.4.10, Mon Sep 1 08:50:20 2008 UTC
# Line 1  Line 1 
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
# Line 10  function storm_help($path, $arg) { Line 10  function storm_help($path, $arg) {
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    
# Line 30  function storm_menu() { Line 30  function storm_menu() {
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'),
# Line 73  function storm_theme() { Line 73  function storm_theme() {
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    
# Line 90  function storm_admin_settings() { Line 94  function storm_admin_settings() {
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,
# Line 106  function storm_admin_settings() { Line 110  function storm_admin_settings() {
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);
# Line 197  function storm_datetime_expand($element) Line 201  function storm_datetime_expand($element)
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    
# Line 276  function storm_icon_add($path, $item, $p Line 280  function storm_icon_add($path, $item, $p
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()) {
# Line 284  function storm_icon_edit($path, $item, $ Line 288  function storm_icon_edit($path, $item, $
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()) {
# Line 292  function storm_icon_delete($path, $item, Line 296  function storm_icon_delete($path, $item,
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()) {
# Line 514  function storm_db_rewrite_sql($query, $p Line 518  function storm_db_rewrite_sql($query, $p
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    

Legend:
Removed from v.1.10.4.9  
changed lines
  Added in v.1.10.4.10

  ViewVC Help
Powered by ViewVC 1.1.2