/[drupal]/contributions/modules/filebrowser_extensions/filebrowser_demo.inc
ViewVC logotype

Contents of /contributions/modules/filebrowser_extensions/filebrowser_demo.inc

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


Revision 1.1 - (show annotations) (download) (as text)
Mon Aug 28 22:10:22 2006 UTC (3 years, 3 months ago) by dman
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-4-7
File MIME type: text/x-php
As requested, this is becoming a sub-project of its own
1
2 <?php
3 function filebrowser_demo(){
4
5 $form["subfolder"] = array(
6 '#type' => 'textfield',
7 '#title' => t("Subdir"),
8 '#autocomplete_path' => 'filebrowser/autocomplete',
9 );
10
11 $cols = array(
12 'expander' => 'AJAX callback trigger to expand directories',
13 'name' => 'linked filename, directorys linked to callback (sortable)',
14 'file' => 'linked filename, directories NOT linked (use when embedding)',
15 'icon' => 'linked icon',
16 'age' => 'formatted duration (sortable)',
17 'size' => 'formatted size (sortable)',
18 'type' => 'suffix (sortable)',
19 'info' => 'from the description file',
20 );
21 $form['cols'] = array(
22 '#type' => 'checkboxes',
23 '#title' => t('Columns to show'),
24 '#options' => $cols,
25 );
26
27 $contexts = array(
28 url('filebrowser') => 'Original filebrowser. Sortable Table',
29 url('filebrowser_lite') => 'Minimal file list',
30 url('filebrowser_raw') => 'Table without surrounding Drupal page, useable by Ajax or RPCs',
31 url('filebrowser_list') => 'Present files in formatted list',
32 url('filebrowser_list_raw') => 'List without surrounding Drupal page',
33 );
34 $form['context'] = array(
35 '#type' => 'radios',
36 '#title' => t('Flavour of filebrowser page'),
37 '#options' => $contexts,
38 '#default_value' => 'filebrowser',
39 );
40
41 $form['recursive'] = array(
42 '#type' => 'checkbox',
43 '#title' => t('recursive'),
44 '#return_value' => 'recursive',
45 );
46
47 $form['go'] = array(
48 '#type' => 'submit',
49 '#value' => t('Go'),
50 '#attributes' => array(
51 'onclick' => "var form = this.form; for (var i=0; i < form.elements.length; i++) { var e = form.elements[i];if(e.name=='edit[context]') if(e.checked) {form.action = e.value + '/' + form.elements['edit[subfolder]'].value }}"
52 )
53 );
54
55 $form['#type'] = 'fieldset';
56 $form['#title'] = 'Demo of different ways to invoke filebrowser';
57 $form = array(
58 '#method' => 'GET',
59 '#id' => 'demoform',
60 'group' => $form,
61 );
62
63 return (drupal_get_form('demo',$form));
64 }
65 ?>

  ViewVC Help
Powered by ViewVC 1.1.2