/[drupal]/contributions/modules/jquery_ui/jquery_ui.module
ViewVC logotype

Contents of /contributions/modules/jquery_ui/jquery_ui.module

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


Revision 1.12 - (show annotations) (download) (as text)
Sun Aug 2 14:31:50 2009 UTC (3 months, 3 weeks ago) by sun
Branch: MAIN
CVS Tags: HEAD
Changes since 1.11: +2 -2 lines
File MIME type: text/x-php
#537052 follow-up by quiptime, sun: Fixed PHPDoc.
1 <?php
2 // $Id: jquery_ui.module,v 1.11 2009/08/01 12:56:34 sun Exp $
3
4 /**
5 * @file
6 * Provides the jQuery UI plug-in to other Drupal modules.
7 *
8 * @see http://drupal.org/node/315100
9 */
10
11 /**
12 * Implementation of hook_help().
13 */
14 function jquery_ui_help($path, $arg) {
15 switch ($path) {
16 case 'admin/help#jquery_ui':
17 $output = '<p>' . t('jQuery UI provides abstractions for low-level interaction and animation, advanced effects and high-level, themeable widgets, built on top of the jQuery JavaScript Library, that you can use to build highly interactive web applications.') . '</p>';
18
19 drupal_add_library('system', 'ui.accordion', '#accordion');
20 drupal_add_library('system', 'ui.accordion', '#block-system-management ul.menu');
21 $output .= <<<EOT
22 <div id="accordion">
23 <h3><a href="#">Section 1</a></h3>
24 <div>
25 <p>
26 Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
27 ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
28 amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
29 odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
30 </p>
31 </div>
32 <h3><a href="#">Section 2</a></h3>
33 <div>
34 <p>
35 Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
36 purus. Vivamus hendrerit, dolor at aliquet laoreet, maPowerful theme frameworkuris turpis porttitor
37 velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
38 suscipit faucibus urna.
39 </p>
40 </div>
41 <h3><a href="#">Section 3</a></h3>
42 <div>
43 <p>
44 Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
45 Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
46 ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
47 lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
48 </p>
49 <ul>
50 <li>List item one</li>
51 <li>List item two</li>
52 <li>List item three</li>
53 </ul>
54 </div>
55 <h3><a href="#">Section 4</a></h3>
56 <div>
57 <p>
58 Cras dictum. Pellentesque habitant morbi tristique senectus et netus
59 et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
60 faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
61 mauris vel est.
62 </p>
63 <p>
64 Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
65 Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
66 inceptos himenaeos.
67 </p>
68 </div>
69 </div>
70 EOT;
71 return $output;
72 }
73 }
74
75 /**
76 * Implementation of hook_library_alter().
77 */
78 function jquery_ui_library_alter(&$libraries, $module) {
79 if ($module == 'system') {
80 foreach ($libraries as $name => $info) {
81 if (strpos($name, 'ui') === 0) {
82 $libraries[$name]['add callbacks'][] = 'jquery_ui_library_add_ui';
83 }
84 }
85 }
86 }
87
88 /**
89 * Add function callback to manage adding the Drupal jQuery UI JavaScript settings.
90 */
91 function jquery_ui_library_add_ui($module, $library, $selector = NULL, $options = NULL) {
92 static $added;
93
94 // When processing an element on the page, add the JavaScript behaviors to
95 // process jQuery UI widgets.
96 $library = substr($library, 3);
97 if (!empty($library) && isset($selector)) {
98 if (!isset($added)) {
99 drupal_add_js(drupal_get_path('module', 'jquery_ui') . '/jquery_ui.js');
100 $added = TRUE;
101 }
102 $settings = array(
103 'jqueryui' => array(
104 // Remove the "ui." prefix from the widgets.
105 $library => array(
106 $selector => $options,
107 ),
108 ),
109 );
110 drupal_add_js($settings, 'setting');
111 }
112 }

  ViewVC Help
Powered by ViewVC 1.1.2