? storm--841690-1.patch
? storm--842624-1.patch
? storm--842624-2.patch
? storm--842624-3.patch
? storm--842624-4.patch
? storm--842624-5.patch
? storm--842624-6.patch
? storm--842624-7.patch
? storm--842624-8.patch
? storm.module-updates.patch
? storm.test.patch
Index: storm.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/storm/storm.module,v
retrieving revision 1.34
diff -u -p -r1.34 storm.module
--- storm.module	30 Jun 2010 16:42:49 -0000	1.34
+++ storm.module	1 Jul 2010 21:39:55 -0000
@@ -103,7 +103,7 @@ function storm_theme() {
   return array(
     'storm_form_group' => array(
       'file'      => 'storm.theme.inc',
-      'arguments' => array('header', 'form'),
+      'arguments' => array('form'),
     ),
     'datetime' => array(
       'file'      => 'storm.theme.inc',
@@ -720,7 +720,7 @@ function storm_icon($icon, $title) {
 
   if (variable_get('storm_icons_display', TRUE) == TRUE) {
     $available = cache_get('storm:icons');
-    if ($available == 0) {
+    if ($available == FALSE) {
       // Cache miss
       $available = storm_icon_recache();
     }
Index: stormattribute/stormattribute.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/storm/stormattribute/stormattribute.admin.inc,v
retrieving revision 1.10
diff -u -p -r1.10 stormattribute.admin.inc
--- stormattribute/stormattribute.admin.inc	30 Jun 2010 16:51:07 -0000	1.10
+++ stormattribute/stormattribute.admin.inc	1 Jul 2010 21:39:57 -0000
@@ -39,47 +39,40 @@ function stormattribute_list() {
     ),
   );
 
-  $s = "SELECT * FROM {stormattribute}";
+  $itemsperpage = isset($_SESSION['stormattribute_list_filter']) ? $_SESSION['stormattribute_list_filter']['itemsperpage'] : variable_get('storm_default_items_per_page', 10);
+
+  $s = db_query('stormattribute')->extend('PagerDefault')->limit($itemsperpage)->extend('TableSort')->orderByHeader($header);
+
   $where = array();
   $args = array();
   $filterfields = array();
 
-  if ($_SESSION['stormattribute_list_filter']['domain']) {
-    $where[] = "domain='%s'";
-    $args[] = $_SESSION['stormattribute_list_filter']['domain'];
+  if (isset($_SESSION['stormattribute_list_filter']) && $_SESSION['stormattribute_list_filter']['domain']) {
+    $s->condition('domain', $_SESSION['stormattribute_list_filter']['domain']);
     $filterfields[] = t('Domain');
   }
 
-  if ($_SESSION['stormattribute_list_filter']['akey']) {
+  if (isset($_SESSION['stormattribute_list_filter']) && $_SESSION['stormattribute_list_filter']['akey']) {
     $where[] = "LOWER(akey) LIKE LOWER('%s')";
     $args[] = $_SESSION['stormattribute_list_filter']['akey'];
     $filterfields[] = t('Key');
   }
 
-  if ($_SESSION['stormattribute_list_filter']['avalue']) {
+  if (isset($_SESSION['stormattribute_list_filter']) && $_SESSION['stormattribute_list_filter']['avalue']) {
     $where[] = "LOWER(avalue) LIKE LOWER('%s')";
     $args[] = $_SESSION['stormattribute_list_filter']['avalue'];
     $filterfields[] = t('Value');
   }
 
   if (isset($_SESSION['stormattribute_list_filter']['isactive']) && ($_SESSION['stormattribute_list_filter']['isactive'] != '-')) {
-    $where[] = "isactive = %d";
-    $args[] = $_SESSION['stormattribute_list_filter']['isactive'];
+    $s->condition('isactive', $_SESSION['stormattribute_list_filter']['isactive']);
     $filterfields[] = t('Active');
   }
   
   if (isset($_SESSION['stormattribute_list_filter']['isdefault']) && ($_SESSION['stormattribute_list_filter']['isdefault'] != '-')) {
-    $where[] = "isdefault = %d";
-    $args[] = $_SESSION['stormattribute_list_filter']['isdefault'];
+    $s->condition('isdefault', $_SESSION['stormattribute_list_filter']['isdefault']);
     $filterfields[] = t('Default');
   }
-  
-  $itemsperpage = $_SESSION['stormattribute_list_filter']['itemsperpage'];
-  if (!$itemsperpage) {
-    $itemsperpage = variable_get('storm_default_items_per_page', 10);
-  }
-
-  $tablesort = tablesort_sql($header);
 
   if (count($filterfields) == 0) {
     $filterdesc = t('Not filtered');
@@ -91,12 +84,13 @@ function stormattribute_list() {
   
   $o = drupal_get_form('stormattribute_list_filter', $filterdesc);
   
-  $s = db_rewrite_sql($s, 'stormattribute', 'aid');
-  $s = storm_rewrite_sql($s, $where) . $tablesort;
-  $r = pager_query($s, $itemsperpage, 0, NULL, $args);
+  $s->addTag('node_access');
+  //$s = storm_rewrite_sql($s, $where) . $tablesort;
+  $result = $s->execute();
+  //$r = pager_query($s, $itemsperpage, 0, NULL, $args);
 
   $attributes = array();
-  while ($attribute = db_fetch_object($r)) {
+  foreach ($result as $attribute) {
     $attributes[] = $attribute;
   }
 
@@ -189,11 +183,11 @@ function stormattribute_list_submit($for
 }
 
 function stormattribute_list_filter(&$form_state, $filterdesc = 'Filter') {
-  $domain = $_SESSION['stormattribute_list_filter']['domain'];
-  $akey = $_SESSION['stormattribute_list_filter']['akey'];
-  $avalue = $_SESSION['stormattribute_list_filter']['avalue'];
-  $isactive = $_SESSION['stormattribute_list_filter']['isactive'];
-  $isdefault = $_SESSION['stormattribute_list_filter']['isdefault'];
+  $domain = isset($_SESSION['stormattribute_list_filter'] ? $_SESSION['stormattribute_list_filter']['domain'] : '';
+  $akey = isset($_SESSION['stormattribute_list_filter'] ? $_SESSION['stormattribute_list_filter']['akey'] : '';
+  $avalue = isset($_SESSION['stormattribute_list_filter'] ? $_SESSION['stormattribute_list_filter']['avalue'] : '';
+  $isactive = isset($_SESSION['stormattribute_list_filter'] ? $_SESSION['stormattribute_list_filter']['isactive'] : 1;
+  $isdefault = isset($_SESSION['stormattribute_list_filter'] ? $_SESSION['stormattribute_list_filter']['isdefault'] : 0;
 
   $itemsperpage = $_SESSION['stormattribute_list_filter']['itemsperpage'];
   if (!$itemsperpage) {
@@ -399,13 +393,13 @@ function stormattribute_form($attribute 
       $attribute->domain = $_GET['domain'];
     }
 
-    if ($_SESSION['stormattribute_list_filter']['domain'] && !$attribute->domain) {
+    if (isset($_SESSION['stormattribute_list_filter']) && $_SESSION['stormattribute_list_filter']['domain'] && !$attribute->domain) {
       $attribute->domain = $_SESSION['stormattribute_list_filter']['domain'];
     }
   }
 
   $form = array();
-  if ($attribute->aid) {
+  if (isset($attribute->aid) && $attribute->aid) {
     $form['aid'] = array(
       '#type' => 'value',
       '#value' => $attribute->aid,
@@ -414,41 +408,41 @@ function stormattribute_form($attribute 
 
   $form['group1'] = array(
     '#type' => 'markup',
-    '#theme' => 'storm_form_group',
+    //'#theme' => 'storm_form_group',
   );
 
   $form['group1']['domain'] = array(
     '#type' => 'textfield',
     '#title' => t('Domain'),
     '#required' => TRUE,
-    '#default_value' => $attribute->domain,
+    '#default_value' => isset($attribute->domain) ? $attribute->domain : '',
     '#autocomplete_path' => 'storm/attributes/domain/autocomplete',
     '#size' => 40,
   );
 
   $domains = array();
   $r = db_query("SELECT DISTINCT(domain) d FROM {stormattribute} ORDER BY domain");
-  while($i=db_fetch_object($r)) {
+  while($i = $r->fetchObject()) {
     $domains[$i->d] = $i->d;
   }
   $form['group1']['parent_domain'] = array(
     '#type' => 'select',
     '#title' => t('Parent domain'),
     '#required' => FALSE,
-    '#default_value' => $attribute->parent_domain,
+    '#default_value' => isset($attribute->parent_domain) ? $attribute->parent_domain : '',
     '#options' => array(''=>'-') + $domains,
   );
 
   $form['group2'] = array(
     '#type' => 'markup',
-    '#theme' => 'storm_form_group',
+    //'#theme' => 'storm_form_group',
   );
 
   $form['group2']['akey'] = array(
     '#type' => 'textfield',
     '#title' => t('Key'),
     '#required' => TRUE,
-    '#default_value' => $attribute->akey,
+    '#default_value' => isset($attribute->akey) ? $attribute->akey : '',
     '#size' => 25,
     '#maxlength' => 20,
   );
@@ -457,31 +451,31 @@ function stormattribute_form($attribute 
     '#type' => 'textfield',
     '#title' => t('Value'),
     '#required' => TRUE,
-    '#default_value' => $attribute->avalue,
+    '#default_value' => isset($attribute->avalue) ? $attribute->avalue : '',
     '#size' => 25,
   );
 
   $form['group2']['weight'] = array(
     '#type' => 'weight',
     '#title' => t('Weight'),
-    '#default_value' => $attribute->weight,
+    '#default_value' => isset($attribute->weight) ? $attribute->weight : 0,
   );
 
   $form['group3'] = array(
     '#type' => 'markup',
-    '#theme' => 'storm_form_group',
+    //'#theme' => 'storm_form_group',
   );
 
   $form['group3']['isactive'] = array(
     '#type' => 'checkbox',
     '#title' => t('Active'),
-    '#default_value' => $attribute->isactive,
+    '#default_value' => isset($attribute->isactive) ? $attribute->isactive : 1,
   );
 
   $form['group3']['isdefault'] = array(
     '#type' => 'checkbox',
     '#title' => t('Default'),
-    '#default_value' => $attribute->isdefault,
+    '#default_value' => isset($attribute->isdefault) ? $attribute->isdefault : 0,
   );
 
   $form['save'] = array(
@@ -489,7 +483,7 @@ function stormattribute_form($attribute 
     '#value' => t('Save')
   );
 
-  if ($attribute->aid) {
+  if (isset($attribute->aid) && $attribute->aid) {
     $form['delete'] = array(
       '#type' => 'submit',
       '#value' => t('Delete'),
