| 1 |
<?php |
<?php |
| 2 |
// $Id: css_injector.admin.inc,v 1.1.2.4 2008/01/28 01:26:09 eaton Exp $ |
// $Id: css_injector.admin.inc,v 1.1.2.5 2008/07/30 18:06:15 add1sun Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* Page callback for CSS Injector's main admin page. |
* Page callback for CSS Injector's main admin page. |
| 9 |
$path = drupal_get_path('module', 'css_injector') .'/'; |
$path = drupal_get_path('module', 'css_injector') .'/'; |
| 10 |
$form = array(); |
$form = array(); |
| 11 |
$form['#tree'] = TRUE; |
$form['#tree'] = TRUE; |
| 12 |
foreach($rules as $rule) { |
foreach ($rules as $rule) { |
| 13 |
$form['rules'][$rule['crid']]['#rule'] = $rule; |
$form['rules'][$rule['crid']]['#rule'] = $rule; |
| 14 |
$form['rules'][$rule['crid']]['edit'] = array( |
$form['rules'][$rule['crid']]['edit'] = array( |
| 15 |
'#type' => 'image_button', |
'#type' => 'image_button', |
| 55 |
$headers = array(t('Title'), t('File path'), t('Actions')); |
$headers = array(t('Title'), t('File path'), t('Actions')); |
| 56 |
$rows = array(); |
$rows = array(); |
| 57 |
if (!empty($form['rules'])) { |
if (!empty($form['rules'])) { |
| 58 |
foreach(element_children($form['rules']) as $crid) { |
foreach (element_children($form['rules']) as $crid) { |
| 59 |
$row = array(); |
$row = array(); |
| 60 |
$rule = $form['rules'][$crid]['#rule']; |
$rule = $form['rules'][$crid]['#rule']; |
| 61 |
$row[] = check_plain($rule['title']); |
$row[] = check_plain($rule['title']); |
| 81 |
} |
} |
| 82 |
$rows[] = $row; |
$rows[] = $row; |
| 83 |
|
|
|
$output = '<p>'. t("Use CSS injection rules to add small snippets of CSS to the page output when specific criteria are met. For example, a simple rule could change the page background color at night or float a particular div to the right on node editing pages.") .'</p>'; |
|
| 84 |
$output .= theme('table', $headers, $rows); |
$output .= theme('table', $headers, $rows); |
| 85 |
$output .= drupal_render($form); |
$output .= drupal_render($form); |
| 86 |
return $output; |
return $output; |
| 229 |
|
|
| 230 |
|
|
| 231 |
/** |
/** |
| 232 |
* Menu callback -- ask for confirmation of rule deletion |
* Menu callback -- ask for confirmation of rule deletion. |
| 233 |
*/ |
*/ |
| 234 |
function css_injector_delete_confirm(&$form_state, $crid) { |
function css_injector_delete_confirm(&$form_state, $crid) { |
| 235 |
$form['crid'] = array( |
$form['crid'] = array( |
| 248 |
} |
} |
| 249 |
|
|
| 250 |
/** |
/** |
| 251 |
* Execute node deletion |
* Execute node deletion. |
| 252 |
*/ |
*/ |
| 253 |
function css_injector_delete_confirm_submit($form, &$form_state) { |
function css_injector_delete_confirm_submit($form, &$form_state) { |
| 254 |
if ($form_state['values']['confirm']) { |
if ($form_state['values']['confirm']) { |