/[drupal]/contributions/modules/swftools/onepixelout/onepixelout.admin.inc
ViewVC logotype

Contents of /contributions/modules/swftools/onepixelout/onepixelout.admin.inc

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


Revision 1.3 - (show annotations) (download) (as text)
Thu Oct 2 21:16:41 2008 UTC (13 months, 3 weeks ago) by stuartgreenfield
Branch: MAIN
CVS Tags: DRUPAL-6--2-5, DRUPAL-6--2-4, DRUPAL-6--2-3, DRUPAL-6--2-2, DRUPAL-6--2-1, DRUPAL-6--2-0, HEAD
Branch point for: DRUPAL-6--2, DRUPAL-6--3
Changes since 1.2: +7 -3 lines
File MIME type: text/x-php
HEAD out of sync with DRUPAL-6-1.
1 <?php
2 // $Id: onepixelout.admin.inc,v 1.2 2008/09/07 19:42:15 stuartgreenfield Exp $
3
4 function onepixelout_admin_form() {
5
6 $saved = _onepixelout_settings();
7
8 $form = array();
9
10 $form['onepixelout_mediaplayer']['autostart'] = array(
11 '#type' => 'select',
12 '#options' => array('yes' => 'yes', 'no' => 'no'),
13 '#default_value' => $saved['autostart'],
14 '#title' => t('Autostart'),
15 '#description' => t('Automatically start playing the MP3. (<em>autostart</em>)'),
16 );
17
18 $form['onepixelout_mediaplayer']['loop'] = array(
19 '#type' => 'select',
20 '#options' => array('yes' => 'yes', 'no' => 'no'),
21 '#default_value' => $saved['loop'],
22 '#title' => t('Loop'),
23 '#description' => t('Loop the sound file back to the beginning when done. (<em>loop</em>)'),
24 );
25
26 $form['onepixelout_mediaplayer']['map'] = array(
27 '#value' => '<img src="http://www.1pixelout.net/wp-content/plugins/audio-player/map.gif" alt="Player Map" />',
28 );
29
30 unset($saved['loop']);
31 unset($saved['autostart']);
32
33 foreach ($saved AS $key => $color) {
34 $form['onepixelout_mediaplayer'][$key] = array(
35 '#type' => 'textfield',
36 '#default_value' => $color,
37 '#size' => 8,
38 '#maxlength' => 8,
39 '#title' => t($key .' color'),
40 '#description' => t('Hexadecimal color of the format 0xRRGGBB'),
41 );
42 }
43
44 $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration') );
45 $form['reset'] = array('#type' => 'submit', '#value' => t('Reset to defaults') );
46 $form['#theme'] = 'system_settings_form';
47
48 return $form;
49 }
50
51 /*
52 * Called by onepixelout_admin_form_submit()
53 */
54 function onepixelout_admin_form_submit($form, &$form_state) {
55
56 $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
57
58 if ($op == t('Reset to defaults')) {
59 variable_del('swftools_'. ONEPIXELOUT);
60 drupal_set_message(t('The configuration options have been reset to their default values.'));
61 } else {
62 // Exclude unnecessary elements.
63 unset($form_state['values']['submit'], $form_state['values']['reset'], $form_state['values']['form_id'], $form_state['values']['op'], $form_state['values']['form_token'], $form_state['values']['form_build_id']);
64 // Store values
65 variable_set('swftools_'. ONEPIXELOUT, $form_state['values']);
66 drupal_set_message(t('The configuration options have been saved.'));
67 }
68
69 // Clear all caches
70 drupal_flush_all_caches();
71
72 }

  ViewVC Help
Powered by ViewVC 1.1.2