| 1 |
<?php |
<?php |
| 2 |
// $Id: stormattribute.admin.inc,v 1.5.4.1 2008/08/11 08:48:29 robertogerola Exp $ |
// $Id: stormattribute.admin.inc,v 1.5.4.2 2008/08/25 09:04:44 robertogerola Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 13 |
|
|
| 14 |
$header = array( |
$header = array( |
| 15 |
array( |
array( |
| 16 |
'data' => t('Domain'), |
'data' => storm_t('Domain'), |
| 17 |
'field' => 'domain', |
'field' => 'domain', |
| 18 |
'sort' => 'asc', |
'sort' => 'asc', |
| 19 |
), |
), |
| 20 |
array( |
array( |
| 21 |
'data' => t('Key'), |
'data' => storm_t('Key'), |
| 22 |
'field' => 'akey', |
'field' => 'akey', |
| 23 |
), |
), |
| 24 |
array( |
array( |
| 25 |
'data' => t('Value'), |
'data' => storm_t('Value'), |
| 26 |
'field' => 'avalue', |
'field' => 'avalue', |
| 27 |
'sort' => '', |
'sort' => '', |
| 28 |
), |
), |
| 78 |
|
|
| 79 |
$form['filter'] = array( |
$form['filter'] = array( |
| 80 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 81 |
'#title' => t('Filter'), |
'#title' => storm_t('Filter'), |
| 82 |
'#collapsible' => TRUE, |
'#collapsible' => TRUE, |
| 83 |
'#collapsed' => TRUE, |
'#collapsed' => TRUE, |
| 84 |
); |
); |
| 90 |
|
|
| 91 |
$form['filter']['group1']['domain'] = array( |
$form['filter']['group1']['domain'] = array( |
| 92 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 93 |
'#title' => t('Domain'), |
'#title' => storm_t('Domain'), |
| 94 |
'#default_value' => $domain, |
'#default_value' => $domain, |
| 95 |
'#size' => 30, |
'#size' => 30, |
| 96 |
'#autocomplete_path' => 'storm/attributes/domain/autocomplete', |
'#autocomplete_path' => 'storm/attributes/domain/autocomplete', |
| 98 |
|
|
| 99 |
$form['filter']['group1']['akey'] = array( |
$form['filter']['group1']['akey'] = array( |
| 100 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 101 |
'#title' => t('Key'), |
'#title' => storm_t('Key'), |
| 102 |
'#default_value' => $akey, |
'#default_value' => $akey, |
| 103 |
'#size' => 20, |
'#size' => 20, |
| 104 |
); |
); |
| 105 |
|
|
| 106 |
$form['filter']['group1']['avalue'] = array( |
$form['filter']['group1']['avalue'] = array( |
| 107 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 108 |
'#title' => t('Value'), |
'#title' => storm_t('Value'), |
| 109 |
'#default_value' => $avalue, |
'#default_value' => $avalue, |
| 110 |
'#size' => 20, |
'#size' => 20, |
| 111 |
); |
); |
| 117 |
|
|
| 118 |
$form['filter']['group2']['submit'] = array( |
$form['filter']['group2']['submit'] = array( |
| 119 |
'#type' => 'submit', |
'#type' => 'submit', |
| 120 |
'#value' => t('Filter'), |
'#value' => storm_t('Filter'), |
| 121 |
'#submit' => array('stormattribute_list_filter_filter'), |
'#submit' => array('stormattribute_list_filter_filter'), |
| 122 |
); |
); |
| 123 |
|
|
| 124 |
$form['filter']['group2']['reset'] = array( |
$form['filter']['group2']['reset'] = array( |
| 125 |
'#type' => 'submit', |
'#type' => 'submit', |
| 126 |
'#value' => t('Reset'), |
'#value' => storm_t('Reset'), |
| 127 |
'#submit' => array('stormattribute_list_filter_reset'), |
'#submit' => array('stormattribute_list_filter_reset'), |
| 128 |
); |
); |
| 129 |
|
|
| 130 |
$form['filter']['group2']['itemsperpage'] = array( |
$form['filter']['group2']['itemsperpage'] = array( |
| 131 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 132 |
'#title' => t('Items'), |
'#title' => storm_t('Items'), |
| 133 |
'#size' => 10, |
'#size' => 10, |
| 134 |
'#default_value' => $itemsperpage, |
'#default_value' => $itemsperpage, |
| 135 |
'#prefix' => '<div class="container-inline">', |
'#prefix' => '<div class="container-inline">', |
| 204 |
$title = $a->domain .' : '. $a->avalue; |
$title = $a->domain .' : '. $a->avalue; |
| 205 |
|
|
| 206 |
return confirm_form($form, |
return confirm_form($form, |
| 207 |
t('Are you sure you want to delete the attribute %title?', array('%title' => $title)), |
storm_t('Are you sure you want to delete the attribute %title?', array('%title' => $title)), |
| 208 |
'storm/attributes/edit/'. $aid, |
'storm/attributes/edit/'. $aid, |
| 209 |
t('This action cannot be undone.'), |
storm_t('This action cannot be undone.'), |
| 210 |
t('Delete'), t('Cancel')); |
storm_t('Delete'), storm_t('Cancel')); |
| 211 |
} |
} |
| 212 |
|
|
| 213 |
function stormattribute_delete_submit($form, &$form_state) { |
function stormattribute_delete_submit($form, &$form_state) { |
| 235 |
|
|
| 236 |
$form['domain'] = array( |
$form['domain'] = array( |
| 237 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 238 |
'#title' => t('Domain'), |
'#title' => storm_t('Domain'), |
| 239 |
'#required' => TRUE, |
'#required' => TRUE, |
| 240 |
'#default_value' => $attribute->domain, |
'#default_value' => $attribute->domain, |
| 241 |
'#autocomplete_path' => 'storm/attributes/domain/autocomplete', |
'#autocomplete_path' => 'storm/attributes/domain/autocomplete', |
| 244 |
|
|
| 245 |
$form['akey'] = array( |
$form['akey'] = array( |
| 246 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 247 |
'#title' => t('Key'), |
'#title' => storm_t('Key'), |
| 248 |
'#required' => TRUE, |
'#required' => TRUE, |
| 249 |
'#default_value' => $attribute->akey, |
'#default_value' => $attribute->akey, |
| 250 |
'#weight' => -9 |
'#weight' => -9 |
| 252 |
|
|
| 253 |
$form['avalue'] = array( |
$form['avalue'] = array( |
| 254 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 255 |
'#title' => t('Value'), |
'#title' => storm_t('Value'), |
| 256 |
'#required' => TRUE, |
'#required' => TRUE, |
| 257 |
'#default_value' => $attribute->avalue, |
'#default_value' => $attribute->avalue, |
| 258 |
'#weight' => -8 |
'#weight' => -8 |
| 260 |
|
|
| 261 |
$form['weight'] = array( |
$form['weight'] = array( |
| 262 |
'#type' => 'weight', |
'#type' => 'weight', |
| 263 |
'#title' => t('Weight'), |
'#title' => storm_t('Weight'), |
| 264 |
'#default_value' => $attribute->weight, |
'#default_value' => $attribute->weight, |
| 265 |
'#weight' => -7 |
'#weight' => -7 |
| 266 |
); |
); |
| 267 |
|
|
| 268 |
$form['save'] = array( |
$form['save'] = array( |
| 269 |
'#type' => 'submit', |
'#type' => 'submit', |
| 270 |
'#value' => t('Save') |
'#value' => storm_t('Save') |
| 271 |
); |
); |
| 272 |
|
|
| 273 |
if ($attribute->aid) { |
if ($attribute->aid) { |
| 274 |
$form['delete'] = array( |
$form['delete'] = array( |
| 275 |
'#type' => 'submit', |
'#type' => 'submit', |
| 276 |
'#value' => t('Delete'), |
'#value' => storm_t('Delete'), |
| 277 |
'#submit' => array('stormattribute_form_delete'), |
'#submit' => array('stormattribute_form_delete'), |
| 278 |
); |
); |
| 279 |
} |
} |
| 280 |
$form['cancel'] = array( |
$form['cancel'] = array( |
| 281 |
'#type' => 'submit', |
'#type' => 'submit', |
| 282 |
'#value' => t('Cancel'), |
'#value' => storm_t('Cancel'), |
| 283 |
'#submit' => array('stormattribute_cancel_submit'), |
'#submit' => array('stormattribute_cancel_submit'), |
| 284 |
); |
); |
| 285 |
|
|