'. t("Provides attributes support for Storm") .'

'; break; } return $output; } function stormattribute_perm() { return array( 'Storm attribute: access', 'Storm attribute: add', 'Storm attribute: edit', 'Storm attribute: delete', ); } function stormattribute_menu($may_cache) { $items = array(); if (!$may_cache) { if (arg(0)=='storm' && arg(1)=='attributes') { require_once(drupal_get_path('module', 'stormattribute') .'/stormattribute.admin.inc'); require_once(drupal_get_path('module', 'stormattribute') .'/stormattribute.theme.inc'); } $items[] = array( 'path' => 'storm/attributes', 'title' => t('Attributes'), 'description' => t('Storm Attributes'), 'callback' => 'stormattribute_list', 'access' => user_access('Storm attribute: access'), 'type' => MENU_NORMAL_ITEM); $items[] = array( 'path' => 'storm/attributes/add', 'title' => t('Add a new attribute'), 'description' => t('Storm Attributes'), 'callback' => 'drupal_get_form', 'callback arguments' => array('stormattribute_add'), 'access' => user_access('Storm attribute: add'), 'type' => MENU_CALLBACK); $items[] = array( 'path' => 'storm/attributes/edit', 'title' => t('Edit an attribute'), 'description' => t('Storm Attributes'), 'callback' => 'drupal_get_form', 'callback arguments' => array('stormattribute_edit', arg(3)), 'access' => user_access('Storm attribute: edit'), 'type' => MENU_CALLBACK); $items[] = array( 'path' => 'storm/attributes/delete', 'title' => t('Delete an attribute'), 'description' => t('Storm Attributes'), 'callback' => 'drupal_get_form', 'callback arguments' => array('stormattribute_delete', arg(3)), 'access' => user_access('Storm attribute: delete'), 'type' => MENU_CALLBACK); $items[] = array( 'path' => 'storm/attributes/domain/autocomplete', 'title' => t('List of attributes'), 'description' => t('Storm Attributes'), 'callback' => '_stormattribute_domain_autocomplete', 'callback arguments' => array(arg(4)), 'access' => user_access('Storm attribute: access'), 'type' => MENU_CALLBACK); } return $items; } function stormattribute_access($op, $item=NULL, $account=NULL) { global $user; if (!$account) $account = $user; if ($op == 'create') { return user_access('Storm attribute: add'); } if ($op == 'delete') { if (user_access('Storm attribute: delete')) { return TRUE; } } if ($op == 'update') { if (user_access('Storm attribute: edit')) { return TRUE; } } return FALSE; } function stormattribute_attributes_bydomain($domain) { static $attributes_cache = array(); $attributes = array(); if (array_key_exists($domain, $attributes_cache)) return $attributes_cache[$domain]; $s = "SELECT * FROM {stormattribute} WHERE LOWER(domain) LIKE LOWER('%s') ORDER BY weight, avalue"; $r = db_query($s, $domain); while ($attribute = db_fetch_array($r)) { $akey = $attribute['akey']; $avalue = $attribute['avalue']; $attributes[$akey] = $avalue; } $attributes_cache[$domain] = $attributes; return $attributes; } function stormattribute_value($domain, $key) { $attributes = stormattribute_attributes_bydomain($domain); if (array_key_exists($key, $attributes)) return $attributes[$key]; return $key; }