Changeset 12626
- Timestamp:
- 02/22/08 15:17:54 (11 months ago)
- Files:
-
- 1 modified
-
util/branches/dev/jsdoc/jsdoc.module (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
util/branches/dev/jsdoc/jsdoc.module
r12625 r12626 168 168 if ($op == 'list') { 169 169 $block[0]['info'] = t('JavaScript Documentation Search'); 170 $block[1]['info'] = t('JavaScript Namespace List'); 170 171 return $block; 171 172 } 172 else if ($op == 'view') { 173 $block['subject'] = 'Search'; 174 $block['content'] = drupal_get_form('_jsdoc_block_search'); 175 return $block; 173 elseif ($op == 'view') { 174 if ($delta == 0) { 175 $block['subject'] = 'Search'; 176 $block['content'] = preg_replace('%ignore.*endignore%s', theme('jsdoc_search', 'search'), drupal_get_form('_jsdoc_block_search')); 177 return $block; 178 } 179 elseif ($delta == 1) { 180 $namespaces = unserialize(cache_get('jsdoc_namespaces', 'cache')->data); 181 $block['subject'] = 'Objects'; 182 $block['content'] = theme('jsdoc_namespaces', $namespaces); 183 return $block; 184 } 176 185 } 177 186 } … … 181 190 if (module_exists('search')) { 182 191 return array( 192 'ignore' => array( 193 '#value' => 'ignore' 194 ), 183 195 'search' => array( 184 '#value' => theme('jsdoc_search', 'search') 196 '#type' => 'textfield' 197 ), 198 'go' => array( 199 '#type' => 'submit', 200 '#value' => 'Go' 201 ), 202 'endignore' => array( 203 '#value' => 'endignore' 185 204 ) 186 205 ); … … 403 422 _jsdoc_init(); 404 423 405 $ignores = array();406 $query = db_query("SELECT parent.title FROM {jsdoc_variable_hierarchy} AS jvh JOIN {node} AS child ON (child.vid = jvh.vid) JOIN {jsdoc_objects} AS jschild ON (jschild.vid = jvh.nid) JOIN {node} AS parent ON (parent.vid = jvh.parent_vid) WHERE jvh.type NOT IN ('cascading', 'normal', 'alias') AND (parent.title LIKE 'dojo.%' OR parent.title LIKE 'dojox.%' OR parent.title LIKE 'dijit.%') AND jschild.private = 0 AND jschild.private_parent = 0 GROUP BY BINARY parent.title ORDER BY parent.title");407 while ($result = db_fetch_object($query)) {408 $ignores[] = $result->title;409 }410 424 $namespaces = array(); 411 $query = db_query("SELECT parent.title FROM {jsdoc_variable_hierarchy} AS jvh JOIN {node} AS child ON (child.vid = jvh.vid) JOIN {jsdoc_objects} AS jschild ON (jschild.vid = jvh.nid) JOIN {node} AS parent ON (parent.vid = jvh.parent_vid) WHERE jvh.type = 'normal' AND (parent.title LIKE 'dojo.%' OR parent.title LIKE 'dojox.%' OR parent.title LIKE 'dijit.%') AND jschild.private = 0 AND jschild.private_parent = 0 GROUP BY BINARY parent.title ORDER BY parent.title"); 412 while ($result = db_fetch_object($query)) { 413 $found = false; 414 foreach ($ignores as $ignore) { 415 if (strpos($ignore, $result->title . '.') === 0 || $ignore == $result->title) { 416 $found = true; 417 break; 425 foreach (jsdoc_projects() as $project) { 426 $query = db_query("SELECT n.title, jo.type AS jsdoc_type, jo.initialized AS jsdoc_intialized FROM {jsdoc_objects} jo JOIN {node} n ON (n.vid = jo.vid) WHERE jo.private = 0 AND jo.private_parent = 0 AND (n.title = '%s' OR n.title LIKE '%s.%%') AND (jo.type = 'Object' OR (jo.type = 'Function' AND jo.initialized = 1)) GROUP BY BINARY n.title ORDER BY n.title", $project->title, $project->title); 427 while ($result = db_fetch_object($query)) { 428 if (jsdoc_is_namespace($result)) { 429 $namespaces[] = $result->title; 418 430 } 419 }420 if (!$found) {421 $namespaces[] = $result->title;422 431 } 423 432 } … … 1558 1567 1559 1568 if (jsdoc_get_type($node) == 'Object' || jsdoc_is_initialized($node)) { 1560 $query = db_query("SELECT 1 FROM node n JOIN jsdoc_objects jo ON (jo.vid = n.vid) WHERE jo.type = 'Function' AND n.title LIKE '%s' AND n.title NOT LIKE '%.toString' LIMIT 1", $node->title . '.%');1569 $query = db_query("SELECT 1 FROM node n JOIN jsdoc_objects jo ON (jo.vid = n.vid) WHERE jo.type = 'Function' AND jo.private = 0 AND jo.private_parent = 0 AND n.title LIKE '%s' AND n.title NOT LIKE '%.toString' LIMIT 1", $node->title . '.%'); 1561 1570 if (db_num_rows($query)) { 1562 1571 $namespace = true; … … 3799 3808 3800 3809 function theme_jsdoc_search($name) { 3801 return '<div class="form-item"><input class="form-text" name="' . $name . '" /> <input class="form-submit" type="submit" value="Go" /></div>'; 3802 } 3810 return '<div class="form-item"><input class="form-text" name="' . $name . '" /> <input class="form-submit" type="submit" name="op" value="Go" /></div>'; 3811 } 3812 3813 function theme_jsdoc_namespaces($namespaces) { 3814 $output = '<ul>'; 3815 foreach ($namespaces as $namespace) { 3816 $output .= "<li>$namespace</li>"; 3817 } 3818 $output .= '</ul>'; 3819 return $output; 3820 }