- Timestamp:
- 03/04/2010 01:03:17 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/omcollab_zhongzhen2/wiki/extensions/Help/Help_Guide.php
r1396 r1399 15 15 16 16 function showHelpGuide($editPage) { 17 global $wgOut, $wgParser, $wgHelpExtentionTitle; 18 $section_text = ''; // temp variable for operation 19 $matches = array(); // temp variable for operation 20 $real_text = array(); // Section content variable 21 $temp = ''; $index = 1; 22 23 // If your site has not included jquery.js file in other parts, Please make below code works. 24 //$wgOut->addHTML("<script type='text/javascript' src='extensions/Help/jquery.js'></script>"); 25 26 // Add css file to Edit page 27 $wgOut->addHTML("<link rel='stylesheet' type='text/css' href='extensions/Help/HelpExtention.css' />"); 28 $wgOut->addHTML("<script type='text/javascript' src='extensions/Help/tabmenu.js'></script>"); 29 30 // Add javascript to Edit page 31 $wgOut->addHTML("<script> 32 function changeIcon(obj) { 33 var source = obj.src; 34 if (source.search('button_help') > -1) { 35 obj.src = 'extensions/Help/images/button_hide.gif'; 36 $('#shadow').css('display', 'block'); 37 $('#wpTextbox1').css('width', '60%'); 38 } 39 else { 40 obj.src = 'extensions/Help/images/button_help.gif'; 41 $('#shadow').css('display', 'none'); 42 $('#wpTextbox1').css('width', '92%'); 43 } 17 global $wgOut, $wgParser, $wgHelpExtentionTitle; 18 $section_text = ''; // temp variable for operation 19 $matches = array(); // temp variable for operation 20 $real_text = array(); // Section content variable 21 $temp = ''; $index = 1; 22 23 // If your site has not included jquery.js file in other parts, Please make below code works. 24 //$wgOut->addHTML("<script type='text/javascript' src='extensions/Help/jquery.js'></script>"); 25 26 // Add css file to Edit page 27 $wgOut->addHTML("<link rel='stylesheet' type='text/css' href='extensions/Help/HelpExtention.css' />"); 28 $wgOut->addHTML("<script type='text/javascript' src='extensions/Help/tabmenu.js'></script>"); 29 30 // Add javascript to Edit page 31 $wgOut->addHTML("<script> 32 function changeIcon(obj) { 33 var source = obj.src; 34 if (source.search('button_help') > -1) { 35 obj.src = 'extensions/Help/images/button_hide.gif'; 36 $('#shadow').css('display', 'block'); 37 $('#wpTextbox1').css('width', '60%'); 44 38 } 45 </script>"); 46 47 // Help content - Help article title 48 $wgOut->parserOptions()->setEditSection(false); // Hide edit link 49 $title = Title::newFromText($wgHelpExtentionTitle); // get title object from Localsettings.php 50 $article = new Article($title); // get article object 51 52 $section_text = $article->getSection($article->getContent(), $index); // get first section 53 // Repeat to get all sections and make help content 54 $html = '<ul class="help_menu_ul">'; 55 while ($section_text != ''): 56 preg_match( "/^(=+)(.+)\\1/mi", $section_text, $matches ); // For get section title 57 if ( !empty( $matches[2] ) ) { 58 //Get section title and make tab by using the title 59 $section_title = $wgParser->stripSectionName(trim($matches[2])); 60 if ($index == 1) 61 $html .= '<li class="tab_active" tindex="' . $index . '">' . $section_title . '</li>'; 62 else 63 $html .= '<li class="tab_normal" tindex="' . $index . '">' . $section_title . '</li>'; 64 65 //Get section content 66 $real_text[$index] = $wgOut->parse(trim(str_replace($matches[0], '', $section_text))); 67 } 68 // Get next section 69 $section_text = $article->getSection($article->getContent(), ++$index); 70 endwhile; 71 $html .= '</ul>'; 72 73 //Generate help content div tags 74 for ($i=1; $i<=count($real_text); $i++) 75 $html .= '<div id="helpcontent' . $i . '" class="help_content">' . $real_text[$i] . '</div>'; 76 77 // Finally Insert Help button and Help content area into Edit page 78 79 //Help content area 80 $editPage->editFormTextBeforeContent .= '<div id="shadow"><div id="helpArea">' . $html . '</div></div>'; 81 // Help button 82 $editPage->editFormTextBeforeContent .= '<div class="button_class"><img src="extensions/Help/images/button_hide.gif" style="cursor: pointer;" onclick="changeIcon(this)"/></div>'; 39 else { 40 obj.src = 'extensions/Help/images/button_help.gif'; 41 $('#shadow').css('display', 'none'); 42 $('#wpTextbox1').css('width', '92%'); 43 } 44 } 45 </script>"); 46 47 // Help content - Help article title 48 $wgOut->parserOptions()->setEditSection(false); // Hide edit link 49 $title = Title::newFromText($wgHelpExtentionTitle); // get title object from Localsettings.php 50 $article = new Article($title); // get article object 51 52 $section_text = $article->getSection($article->getContent(), $index); // get first section 53 // Repeat to get all sections and make help content 54 $html = '<ul class="help_menu_ul">'; 55 while ($section_text != ''): 56 preg_match( "/^(=+)(.+)\\1/mi", $section_text, $matches ); // For get section title 57 if ( !empty( $matches[2] ) ) { 58 //Get section title and make tab by using the title 59 $section_title = $wgParser->stripSectionName(trim($matches[2])); 60 if ($index == 1) 61 $html .= '<li class="tab_active" tindex="' . $index . '">' . $section_title . '</li>'; 62 else 63 $html .= '<li class="tab_normal" tindex="' . $index . '">' . $section_title . '</li>'; 64 65 //Get section content 66 $real_text[$index] = $wgOut->parse(trim(str_replace($matches[0], '', $section_text))); 67 } 68 // Get next section 69 $section_text = $article->getSection($article->getContent(), ++$index); 70 endwhile; 71 $html .= '</ul>'; 72 73 //Generate help content div tags 74 for ($i=1; $i<=count($real_text); $i++) 75 $html .= '<div id="helpcontent' . $i . '" class="help_content">' . $real_text[$i] . '</div>'; 76 77 // Finally Insert Help button and Help content area into Edit page 78 79 //Help content area 80 $editPage->editFormTextBeforeContent .= '<div id="shadow"><div id="helpArea">' . $html . '</div></div>'; 81 // Help button 82 $editPage->editFormTextBeforeContent .= '<div class="button_class"><img src="extensions/Help/images/button_hide.gif" style="cursor: pointer;" onclick="changeIcon(this)"/></div>'; 83 83 84 return true;84 return true; 85 85 } 86 86 ?>
Note: See TracChangeset
for help on using the changeset viewer.
