Changelog

From Missouri Academy Wiki
Jump to: navigation, search

This is a list of changes made to the moacad wiki source as opposed to normal wikimedia source.

Planned[edit]

  • Make image uploads go to a different server

In Progress[edit]

  • Default picture
  • Fixing post code (something got messed up in the transfer)

Done[edit]

<post>

  • Side bar links
    • Remove 'Community Portal'
    • Add 'The Forum'
    • Add 'All Pages'

<post>

File: $WIKI_ROOT/templates/xhtml_slim.pt 

-70/71?: (whatever the link for community portal was, it's gone now so I dont know what exactly it said..)

=116:   <li id="t-specialpages"><a href="${nav_urls/specialpages/href}"
=117:     i18n:translate="string:specialpages">Special Pages</a></li>
+118:   <li id="t-allpages"><a href="index.php?title=Special:Allpages">All Pages</a></li>
+119:   <li id="t-forum"><a href="/forum">The Forum</a></li>
=120:  </ul>
=121: </div>

</post> </post>


<post>

  • Add an extension for use of a <code> </code> tag to display plain html stuff (for use with forms and such, sorry it doesnt do php).

<post>

File: $WIKI_ROOT/extensions/RenderHtml.php (new file)

      1 <?php
      2 $wgExtensionFunctions[] = "wfRenderHtmlFunction";
      3 
      4 function wfRenderHtmlFunction() {
      5     global $wgParser;
      6     $wgParser->setHook( "code", "RenderHtml" );
      7 }
      8 
      9 function RenderHtml( $input )
     10 {
     11     return $input;
     12 }
     13 ?>
File: $WIKI_ROOT/LocalSettings.php

=93: $wgRightsIcon = "${wgStylePath}/images/gnu-fdl.png";
=94: # $wgRightsCode = "gfdl"; # Not yet used
+95: inlcude("extensions/RenderHtml.php");
=96: ?>
=97: (End of file)

</post> </post>


<post>

  • Add an extension for a <post> </post> tag to be used in discusions. It will put a arrow next to the post to hide/unhide comments, simmilar to the 'advanced' version of the 'Recent changes' page. (working but not yet complete) check out this topic's discussion for an example of how to use.

<post>

File: $WIKI_ROOT/extensions/Post.php (new file)

      1 <?php
      2 $wgExtensionFunctions[] = "wfPostFunctions";
      3 
      4 function wfPostFunctions() {
      5         global $wgParser;
      6         $wgParser->setHook( "post", "RenderPost" );
      7 }
      8 
      9 function parse_post($to_parse) {
     10         global $wgParser, $wgParserCache, $wgUser, $wgTitle;
     11         $parserOutput = new OutputPage;
     12         $parserOutput = $wgParser->parse( $to_parse, $wgTitle, $parserOutput->mParserOptions, $linestart );
     13         $parserOutput->mLanguageLinks += $parserOutput->getLanguageLinks();
     14         $parserOutput->mCategoryLinks += $parserOutput->getCategoryLinks();
     15         return $parserOutput->getText();
     16 }
     17 
     18 function RenderPost( $input )
     19 {
     20         $posts = explode('<post>', $input, 2);
     21         $comments = explode('</post>', $posts[1]);
     22         if ($comments[1] == '') {
     23                 $top = "<div>".parse_post($posts[0])."<span style=\"font-size:10pt; font-style:italic; margin-left:0px;\">No Comments</a></span>";
     24                 $middle = '';
     25                 $bottom = "</div>";
     26         }
     27         else {
     28         global $pn;
     29         $pn++;
     30         $sig = parse_post("--~~~~");
     31         $sig = '';
     32         $post = parse_post($posts[0]);
     33         $top = "
     34                 <div>
     35                         $post
     36                         <span id=\"sc$pn\">$sig
     37                                 <a href=\"javascript:toggleVisibility('ps$pn', 'sc$pn', 'hc$pn')\" style=\"font-size:10pt; font-style:italic; margin-left:0px;\">
     38                                         Show Comments
     39                                 </a>
     40                         </span>
     41                         <span id=\"hc$pn\" style=\"display:none;\">$sig
     42                                 <a href=\"javascript:toggleVisibility('ps$pn', 'sc$pn', 'hc$pn')\" style=\"font-size:10pt; font-style:italic; margin-left:0px;\">
     43                                         Hide Comments
     44                                 </a>
     45                         </span>
     46                         <div id=\"ps$pn\" style=\"display:none; margin-left:25px;\">
     47                 ";
     48 
     49         $middle = parse_post("<post>".$posts[1]);
     50 
     51         $bottom = "\t</div>
     52                 </div>";
     53         }
     54         $output = $top.$middle.$bottom;
     55         return $output;
     56 }
     57 ?>
File: $WIKI_ROOT/LocalSettings.php

=94: # $wgRightsCode = "gfdl"; # Not yet used
=95: include("extensions/RenderHtml.php");
+96: include("extensions/Post.php");
=97: ?>
=98: (End of file)
File: $WIKI_ROOT/includes/Parser.php

(For now here's the updated extractTags function (the old one wouldn't allow there to be tag's within tags))

    153         /* static */ function extractTags($tag, $text, &$content, $uniq_prefix = ""){
    154                 $rnd = $uniq_prefix . '-' . $tag . Parser::getRandomString();
    155                 if ( !$content ) {
    156                         $content = array( );
    157                 }
    158                 $n = 1;
    159                 $stripped = '';
    160 
    161                 if($tag==STRIP_COMMENTS) {
    162                         while ( '' != $text ) {
    163                                 $p = preg_split( '/<!--/i', $text, 2 );
    164                                 $stripped .= $p[0];
    165                                 if ( ( count( $p ) < 2 ) || ( '' == $p[1] ) ) {
    166                                         $text = '';
    167                                 } else {
    168                                         $q = preg_split( '/-->/i', $p[1], 2 );
    169                                         $marker = $rnd . sprintf('%08X', $n++);
    170                                         $content[$marker] = $q[0];
    171                                         $stripped .= $marker;
    172                                         $text = $q[1];
    173                                 }
    174                         }
    175                 }
    176                 else {
    177                         $p = preg_split( "/<\\s*$tag\\s*>/i", $text); // splits everything by start tags
    178                         $stripped .= $p[0]; // takes care of anything before the first tag
    179                         $starts = 1;
    180                         $ends = 0;
    181                         $marker = $rnd . sprintf('%08X', $n++);
    182                         while ( '' != $p[$starts] ) { // loop through tag's finding end's and such
    183                                 $q = preg_split( "/<\\/\\s*$tag\\s*>/i", $p[$starts]);
    184                                 $ends = $ends + count($q) - 1;
    185                                 if ($starts <= $ends) {
    186                                         $cnt = $q[0];
    187                                         for($i = 1; $i < count($q)-1; $i++) {
    188                                                 $cnt .= '</'.$tag.'>';
    189                                                 $cnt .= $q[$i];
    190                                         }
    191                                         $content[$marker] .= $cnt;
    192                                         $stripped .= $marker . $q[count($q)-1];
    193                                         $text = $q[1];
    194                                         $starts++;
    195                                         $marker = $rnd . sprintf('%08X', $n++);
    196                                 }
    197                                 else {
    198                                         $content[$marker] .= $p[$starts].'<'.$tag.'>';
    199                                         $starts++;
    200                                 }
    201                         }
    202                 }
    203 
    204                 /* ##### Begin Old Code #####
    205                 while ( '' != $text ) {
    206                         if($tag==STRIP_COMMENTS) {
    207                                 $p = preg_split( '/<!--/i', $text, 2 );
    208                         } else {
    209                                 $p = preg_split( "/<\\s*$tag\\s*>/i", $text, 2 );
    210                         }
    211                         $stripped .= $p[0];
    212                         if ( ( count( $p ) < 2 ) || ( '' == $p[1] ) ) {
    213                                 $text = '';
    214                         } else {
    215                                 if($tag==STRIP_COMMENTS) {
    216                                         $q = preg_split( '/-->/i', $p[1], 2 );
    217                                 } else {
    218                                         $q = preg_split( "/<\\/\\s*$tag\\s*>/i", $p[1], 2 );
    219                                 }
    220                                 $marker = $rnd . sprintf('%08X', $n++);
    221                                 $content[$marker] = $q[0];
    222                                 $stripped .= $marker;
    223                                 $text = $q[1];
    224                         }
    225                 }
    226                 */
    227                 return $stripped;
    228         }

</post> </post>


<post>

  • Sort the All Pages list vertically rather than horizontally.

<post>

File: $WIKI_ROOT/includes/SpecialAllpages.php

(For now here's the updated indexShowChunk function, I think this is all that I changed, (we'll see when this place get supgraded to 1.4.0))

    108 function indexShowChunk( $from )
    109 {
    110         global $wgOut, $wgUser, $indexMaxperpage, $wgLang;
    111         $sk = $wgUser->getSkin();
    112         $maxPlusOne = $indexMaxperpage + 1;
    113 
    114         $out = "";
    115         $sql = "SELECT cur_title FROM cur WHERE cur_namespace=0 AND cur_title >= '"
    116                 . wfStrencode( $from ) . "' ORDER BY cur_title LIMIT " . $maxPlusOne;
    117         $res = wfQuery( $sql, DB_READ, "indexShowChunk" );
    118 
    119         $n = 1;
    120 
    121         //bufferer all links
    122         while( ($n < $indexMaxperpage) && ($s = wfFetchObject( $res )) ) {
    123                 $t[$n] = Title::makeTitle( 0, $s->cur_title );
    124                 if( $t[$n] ) {
    125                         $ll[$n] = $sk->makeKnownLinkObj( $t[$n] );
    126                 } else {
    127                         $ll[$n] = "[[" . htmlspecialchars( $s->cur_title ) . "]]";
    128                 }
    129                 $n++;
    130         }
    131         $n = count($ll);
    132         //packer
    133 
    134         $cols = 3; //variable number of coloms to display
    135         $sort_vert='true';
    136         $col = 1;
    137         $row = 1;
    138         $c = 1;
    139 
    140         if ($sort_vert == 'true') {
    141                 while ( $c<=$n ) {
    142                         for ($row=1; $row-1 < (($n)/$cols); $row++) {
    143                                 $link[$row][$col] = $ll[$c];
    144                                 $c++;
    145                         }
    146                         $col++;
    147                 }
    148         } else {
    149                 while ($c<=$n) {
    150                         for ($col=1; $col <= $cols; $col++) {
    151                                 $link[$row][$col] = $ll[$c];
    152                                 $c++;
    153                         }
    154                         $row++;
    155                 }
    156         }
    157 
    158         //get ready to output
    159         $row = 1;
    160         $c = 1;
    161         $out = '<table border="0" width="100%">'."\n";
    162 
    163         //output
    164         while ($c<=$n) {
    165                 $out .= '<tr>';
    166                 for ($col=1; ($col<=$cols); $col++) {
    167                         if($link[$row][$col]) {
    168                                 $out .= '<td>'.$link[$row][$col].'</td>';
    169                                 $c++;
    170                         }
    171                         else {
    172                                 $out .= '<td></td>';
    173                                 $c++;
    174                         }
    175                 }
    176                 $out .= "</tr>\n";
    177                 $row++;
    178         }
    179 
    180         $out .= "</table>\n";
    181 
    182         $out2 = "<div style='text-align: right; font-size: smaller; margin-bottom: 1em;'>" .
    183                         $sk->makeKnownLink( $wgLang->specialPage( "Allpages" ),
    184                                 wfMsg ( 'allpages' ) );
    185         if ( ($n == $indexMaxperpage) && ($s = wfFetchObject( $res )) ) {
    186                 $out2 .= " | " . $sk->makeKnownLink(
    187                         $wgLang->specialPage( "Allpages" ),
    188                         wfMsg ( 'nextpage', $s->cur_title ),
    189                         "from=" . urlencode( $s->cur_title ) );
    190         }
    191         $out2 .= "</div>";
    192 
    193         $wgOut->addHtml( $out2 . $out );
    194 }

</post> </post>