Revision history for SpectreMoo
Revision [23392]
Last edited on 2016-05-20 07:38:48 by SpectreMoo [Replaces old-style internal links with new pipe-split links.]Additions:
SimpleTables isn't in 1.1.6.4 (looks like it's targetted for 1.1.7), this version will be ported to [[http://wush.net/trac/wikka/browser/trunk/formatters/wakka.php?rev=761 | rev 761]] of the wikka formatter.
Deletions:
Additions:
Lately (as of early 2009) I've done a lot of work with our internal wiki to make it more usable within our company. Some of the changes I've made include page categorization including search, Ajax-y menus (used for categories, among other things), and use of script.aculo.us. Unfortunately our internal version is now significantly different from the main dev branch and we have several tool / library dependencies which make posting the changes back here difficult. I intend to post some of the more straightforward ones in the next few months. (We have a googlebox in-house which we use for search, and I'm using ""ExtJS"" for our Ajax stuff.)
I hope that in the next year or two (regardless of today's date!) we'll see functional, robust WYSIWYG editors for wikis which will make them even more accessible to common folk, and that will be a good day -- especially for users supporting wiki use in a corporate environment such as myself.
I hope that in the next year or two (regardless of today's date!) we'll see functional, robust WYSIWYG editors for wikis which will make them even more accessible to common folk, and that will be a good day -- especially for users supporting wiki use in a corporate environment such as myself.
Deletions:
Additions:
static $table_count = 0; # near line 148 of rev 761 wakka.php, in the static declarations
Deletions:
Additions:
One of the things users in my intranet have wanted to do is export tables to .csv files. We're based on the 1.1.6.2 code line with older simple tables (the version sans formatting) added. Because I've got a personal wiki which uses a build of 1.1.6.4, I'll try to put this together for the more modern version of SimpleTables as well.
SimpleTables isn't in 1.1.6.4 (looks like it's targetted for 1.1.7), this version will be ported to [[http://wush.net/trac/wikka/browser/trunk/formatters/wakka.php?rev=761 rev 761]] of the wikka formatter.
SimpleTables isn't in 1.1.6.4 (looks like it's targetted for 1.1.7), this version will be ported to [[http://wush.net/trac/wikka/browser/trunk/formatters/wakka.php?rev=761 rev 761]] of the wikka formatter.
Deletions:
Additions:
I hope that in the next year or two we'll see functional, robust WYSIWYG editors for wikis which will make them even more accessible to common folk, and that will be a good day -- especially for users supporting wiki use in a corporate environment such as myself.
Deletions:
I anticipate that in the next year or two we'll see functional, robust WYSIWYG editors for wikis which will make them even more accessible to common folk, and that will be a good day -- especially for users supporting wiki use in a corporate environment such as myself.
Additions:
=====Grab Table as .csv File=====
One of the things users in my intranet have wanted to do is export tables to .csv files. We're based on the 1.1.6.2 code line with older simple tables (the version sans formatting) added. Because I've got a personal wiki which uses a build of 1.1.6.4, I'll try to put this together for the more modern version of simple tables as well. (For instance, each handler / formatter gets its own directory under 1.1.6.4, I believe.)
Here's how it works: Tables are formatted as normal, only we add a "Grab" button to each when we close a table. Each table in a page is assigned a unique number, so when the Grab action submits to the grabtable formatter, we know which table to convert and send as a .csv file. This method is easier than trying to adapt grabcode wholesale, as grabbing each cell's contents and urlencoding them proved... well, very, very difficult.
To start, you need to add a page handler, which I've called grabtable.php:
/**
* Download a table as a csv file.
*
* When called by a grab button, forces the download of the associated table.
*
* @package Handlers
* @name grabtable
* @author SpectreMoo
* @version 0.1
* @since 1.1.6.3
*/
// i18n strings
define('ERROR_NO_CODE', 'Sorry, there is no table to download.');
// defaults
define('DEFAULT_FILENAME', 'table.csv'); # default name for code blocks
define('FILE_EXTENSION', '.csv'); # extension appended to code block name
if (!function_exists("getTableCSV"))
{
function getTableCSV ($text, $tablenumber)
//echo "\ntext: ".$text.", number: ".$tablenumber;
preg_match_all('/\n(\n\|\|[^\n]+)+/', $text, $tables);
$table = $tables[0][$tablenumber];
// Strip out table formating, make it CSV
$csv = preg_replace ("/^\n*\|\|/", "", $table);
$csv = preg_replace ("/s*\n\|\|/", "\n", $csv);
$csv = preg_replace ("/\|\|\s*\n/", "\n", $csv);
$csv = preg_replace ("/\|\|\s*$/", "", $csv);
$csv = preg_replace ("/\|\|/", ",", $csv);
// Remove common wikka formatting
$csv = preg_replace ("/@@|##|\*\*|__/", "", $csv); # Add any others your users might use
return $csv;
}
// initialize variables
$table = '';
$filename = '';
// check if grabtable is allowed
if ($this->GetConfigValue('grabtable_button') == 1) {
//get URL parameters
$table = getTableCSV ($this->page['body'], $_POST['tablenumber']);
// TODO: use central regex library for filename validation
$filename = (isset($_POST['filename']) && preg_match('/\w[-.\w]*/', $_POST['filename']))? urldecode($_POST['filename']).FILE_EXTENSION : DEFAULT_FILENAME;
//set HTTP headers
header('Content-type: text/plain');
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT'); //TODO: check for consistency with server time format
header('Content-Length: '.strlen($table));
header('Content-Description: '.$filename.' Download Data');
header('Pragma: no-cache');
header('Content-Disposition: attachment; filename="'.$filename.'"');
//print code block
echo $table;
} else
{
echo ERROR_NO_CODE;
}
Anyone familiar with grabcode.php will see the obvious similarities to the above code, I adapted that handler for my needs. I didn't break the getTableCSV function apart into a formatter; this inline style works and I'm not sure it makes sense to separate the two functions.
Next, add the following Wakka.class.php after the grabcode block (search for """// grabcode page handler"""):
%%(php)
// grabtable page handler
elseif ($this->method == "grabtable")
print($this->Method($this->method));
%%
Modifying the wakka page formatter is a bit trickier, add the following:
%%(php)
static $table_count = 0; # near line 47, in the static declarations
%%
%%(php)# This block replaces the existing block in the $trigger_table == 1 section:
else if ($thing != "")
$trigger_table = 0;
$output = '';
// display grab button if option is set in the config file
if ($wakka->config['grabtable_button'] == '1')
$output .= $wakka->FormOpen("grabtable");
// build form
$output .= '<input type="submit" class="grabcode" name="save" value="'.GRABCODE_BUTTON_VALUE.'" title="'.rtrim(sprintf(GRABCODE_BUTTON_TITLE, $valid_filename)).'" />';
$output .= '<input type="hidden" name="filename" value="'.urlencode($valid_filename).'" />';
$output .= '<input type="hidden" name="tablenumber" value="'.($table_count++).'" />';
$output .= $wakka->FormClose();
return "</table>\n".$output.wakka2callback($things);
%%
wikka.config.php gets:
%%(php) "grabtable_button" => "1",%%
The same can be added to wikka.php. Also modify the following line in wikka.php:
%%(php)if (!preg_match("/(xml|raw|mm|grabcode|grabtable)$/", $method))%%
...and you should now be able to download table.csv files for tables in the same way you'd grab code to codesnippet.txt.
Consider this beta for now, especially given the fact I'm working on a modified 1.1.6.2 version of Wikka. I'll post this to a separate page once I've ported it to 1.1.6.4.
Suggestions, comments, and questions are appreciated!
One of the things users in my intranet have wanted to do is export tables to .csv files. We're based on the 1.1.6.2 code line with older simple tables (the version sans formatting) added. Because I've got a personal wiki which uses a build of 1.1.6.4, I'll try to put this together for the more modern version of simple tables as well. (For instance, each handler / formatter gets its own directory under 1.1.6.4, I believe.)
Here's how it works: Tables are formatted as normal, only we add a "Grab" button to each when we close a table. Each table in a page is assigned a unique number, so when the Grab action submits to the grabtable formatter, we know which table to convert and send as a .csv file. This method is easier than trying to adapt grabcode wholesale, as grabbing each cell's contents and urlencoding them proved... well, very, very difficult.
To start, you need to add a page handler, which I've called grabtable.php:
/**
* Download a table as a csv file.
*
* When called by a grab button, forces the download of the associated table.
*
* @package Handlers
* @name grabtable
* @author SpectreMoo
* @version 0.1
* @since 1.1.6.3
*/
// i18n strings
define('ERROR_NO_CODE', 'Sorry, there is no table to download.');
// defaults
define('DEFAULT_FILENAME', 'table.csv'); # default name for code blocks
define('FILE_EXTENSION', '.csv'); # extension appended to code block name
if (!function_exists("getTableCSV"))
{
function getTableCSV ($text, $tablenumber)
//echo "\ntext: ".$text.", number: ".$tablenumber;
preg_match_all('/\n(\n\|\|[^\n]+)+/', $text, $tables);
$table = $tables[0][$tablenumber];
// Strip out table formating, make it CSV
$csv = preg_replace ("/^\n*\|\|/", "", $table);
$csv = preg_replace ("/s*\n\|\|/", "\n", $csv);
$csv = preg_replace ("/\|\|\s*\n/", "\n", $csv);
$csv = preg_replace ("/\|\|\s*$/", "", $csv);
$csv = preg_replace ("/\|\|/", ",", $csv);
// Remove common wikka formatting
$csv = preg_replace ("/@@|##|\*\*|__/", "", $csv); # Add any others your users might use
return $csv;
}
// initialize variables
$table = '';
$filename = '';
// check if grabtable is allowed
if ($this->GetConfigValue('grabtable_button') == 1) {
//get URL parameters
$table = getTableCSV ($this->page['body'], $_POST['tablenumber']);
// TODO: use central regex library for filename validation
$filename = (isset($_POST['filename']) && preg_match('/\w[-.\w]*/', $_POST['filename']))? urldecode($_POST['filename']).FILE_EXTENSION : DEFAULT_FILENAME;
//set HTTP headers
header('Content-type: text/plain');
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT'); //TODO: check for consistency with server time format
header('Content-Length: '.strlen($table));
header('Content-Description: '.$filename.' Download Data');
header('Pragma: no-cache');
header('Content-Disposition: attachment; filename="'.$filename.'"');
//print code block
echo $table;
} else
{
echo ERROR_NO_CODE;
}
Anyone familiar with grabcode.php will see the obvious similarities to the above code, I adapted that handler for my needs. I didn't break the getTableCSV function apart into a formatter; this inline style works and I'm not sure it makes sense to separate the two functions.
Next, add the following Wakka.class.php after the grabcode block (search for """// grabcode page handler"""):
%%(php)
// grabtable page handler
elseif ($this->method == "grabtable")
print($this->Method($this->method));
%%
Modifying the wakka page formatter is a bit trickier, add the following:
%%(php)
static $table_count = 0; # near line 47, in the static declarations
%%
%%(php)# This block replaces the existing block in the $trigger_table == 1 section:
else if ($thing != "")
$trigger_table = 0;
$output = '';
// display grab button if option is set in the config file
if ($wakka->config['grabtable_button'] == '1')
$output .= $wakka->FormOpen("grabtable");
// build form
$output .= '<input type="submit" class="grabcode" name="save" value="'.GRABCODE_BUTTON_VALUE.'" title="'.rtrim(sprintf(GRABCODE_BUTTON_TITLE, $valid_filename)).'" />';
$output .= '<input type="hidden" name="filename" value="'.urlencode($valid_filename).'" />';
$output .= '<input type="hidden" name="tablenumber" value="'.($table_count++).'" />';
$output .= $wakka->FormClose();
return "</table>\n".$output.wakka2callback($things);
%%
wikka.config.php gets:
%%(php) "grabtable_button" => "1",%%
The same can be added to wikka.php. Also modify the following line in wikka.php:
%%(php)if (!preg_match("/(xml|raw|mm|grabcode|grabtable)$/", $method))%%
...and you should now be able to download table.csv files for tables in the same way you'd grab code to codesnippet.txt.
Consider this beta for now, especially given the fact I'm working on a modified 1.1.6.2 version of Wikka. I'll post this to a separate page once I've ported it to 1.1.6.4.
Suggestions, comments, and questions are appreciated!
Revision [18785]
Edited on 2008-01-28 00:12:36 by SpectreMoo [Modified links pointing to docs server]No Differences
Additions:
~-Biologically inspired computing (Genetic Programming, Neural Nets, etc.)
~-Astronomy; mostly reading, I'm no amateur astronomer
~-Physics
>>I've installed Wikka to augment our company intranet, and in the process I've made a number of both superficial and functional changes to the code. Many of the changes I've made work only within my company intranet environment (auto-linking of java class names to our javadocs, for instance), but I've tried to post general changes here -- for instance, the SpellcheckHack.
The biggest request I have from my users these days is better table markup to display structured information; right now we're using double-quote escaped HTML. There's been some work done on better tables here, but I'm also investigating migrating another wiki engine's (maybe media wiki's) table markup to Wikka. I'll post here it if I can make it happen.
I anticipate that in the next year or two we'll see functional, robust WYSIWYG editors for wikis which will make them even more accessible to common folk, and that will be a good day -- especially for users supporting wiki use in a corporate environment such as myself.
Thank you for a great wiki engine!
~-Astronomy; mostly reading, I'm no amateur astronomer
~-Physics
>>I've installed Wikka to augment our company intranet, and in the process I've made a number of both superficial and functional changes to the code. Many of the changes I've made work only within my company intranet environment (auto-linking of java class names to our javadocs, for instance), but I've tried to post general changes here -- for instance, the SpellcheckHack.
The biggest request I have from my users these days is better table markup to display structured information; right now we're using double-quote escaped HTML. There's been some work done on better tables here, but I'm also investigating migrating another wiki engine's (maybe media wiki's) table markup to Wikka. I'll post here it if I can make it happen.
I anticipate that in the next year or two we'll see functional, robust WYSIWYG editors for wikis which will make them even more accessible to common folk, and that will be a good day -- especially for users supporting wiki use in a corporate environment such as myself.
Thank you for a great wiki engine!
Deletions:
Astronomy; mostly reading, I'm no amateur astronomer
Physics
>>I've installed Wikka to augment our company intranet, and in the process I've made a number of both superficial and functional changes to the code which I plan on posting here when I get the chance.
The biggest enhancement request I've got so far is page anchors; other wikis typically impement them as Wikka Action type things, but ideally each header (e.g., ""===Foo==="") would become an automatic page anchor. I've implemented markup to add anchors (using {# and #} around an anchor name) which //works//, but adding it to the headers shouldn't be too difficult. I've already got the $wikka->Link method modified to accept anchor targets in the links.
(Then again, I see now that DotMG has already contributed an AnchorAction... so much for my work! <grin>)
(Ah ha! TableofcontentsAction has copious amounts of information as well.)
I'm going to post some of the hacks I've created here, maybe others will find them useful. Many of the hacks I've written work only within my company intranet environment (auto-linking of java class names to our javadocs, for instance), but anything that's more generally applicable I'll try to post here.
PHP isn't my first language (Java is), but with Wikka's structure, that's not an issue; it's quite easy to modify and expand.
Thank you!
Additions:
Moved spellchecking to SpellcheckHack.
Deletions:
I find having a spellchecker on the wiki quite useful; here's how I added one:
**Steps**
~- Download and install GNU ASpell and an ASpell dictionary from http://aspell.net/ if it isn't already installed (e.g., you're running Windows).
~- Download and unpack spellerpages from http://spellerpages.sourceforge.net/ -- put these files in wiki/3rdparty/plugins/speller.
~- Make the following changes to the spellerpages files:
~- In spellChecker.js:
%%
// this.popUpUrl = '/speller/spellchecker.html';
// this.spellCheckScript = '/speller/server-scripts/spellchecker.php';
%%
~...to...
%%
this.popUpUrl = [YOUR HARD-CODED PATH TO SPELLCHECKER.HTML]";
// For Example: this.popUpUrl = "http://www.notadomain.net/wiki/3rdparty/plugins/speller/spellchecker.html";
this.spellCheckScript = './server-scripts/spellchecker.php'; // note the '.'
%%
~and:
%%
if( evalText ) {
this.controlWin.evaluatedText.value = evalText;
ww.setFocus( this.currentTextIndex, this.currentWordIndex );
this._getSuggestions( this.currentTextIndex, this.currentWordIndex );
%%
~...becomes...
%%
if( evalText ) {
// changes to prevent WikiWords from being checked:
if (evalText.match(/[A-ZÄÖÜ]+[a-zßäöü]+[A-Z0-9ÄÖÜ][A-Za-z0-9ÄÖÜßäöü]*/) == null)
this.controlWin.evaluatedText.value = evalText;
ww.setFocus( this.currentTextIndex, this.currentWordIndex );
this._getSuggestions( this.currentTextIndex, this.currentWordIndex );
else
this.currentWordIndex++;
this._spellcheck();
}
%%
~- In speller/server-scripts/spellchecker.php:
%%
$spellercss = '/speller/spellerStyle.css';
$word_win_src = '/speller/wordWindow.js';
$textinputs = $_POST['textinputs']; # array
$aspell_prog = 'aspell';
%%
~...becomes...
%%
$wiki_path = "/wiki/3rdparty/plugins";
$spellercss = $wiki_path.'/speller/spellerStyle.css';
$word_win_src = spellercss = $wiki_path.'/speller/wordWindow.js';
$word_win_src = $wiki_path.'/speller/wordWindow.js';
$textinputs = $_POST['textinputs']; # array
$aspell_prog = 'aspell'; // fine for *nix systems?
# $aspell_prog = '"[PATCH TO ASPELL EXECUTABLE]"'; // required for Windows, replaces previous line
%%
~- Make this change around line 108 of wiki/3rdparty/plugins/wikiedit/wikiedit2.js:
%%
this.addButton(" ");
this.addButton("spell","Check Spelling","","document.getElementById('" + this.id + "')._owner.spellcheck");
%%
~...and this at the end of the file, after the closing brace: (line 645 or so):
%%
WikiEdit.prototype.spellcheck = function ()
{
var speller = new spellChecker();
speller.checkTextAreas();
}
%%
~- Finally change wiki/handlers/page/edit.php:
%%
line 142:
'<script language="JavaScript" src="3rdparty/plugins/speller/spellChecker.js"></script>'."\n".
%%
You need to provide your own "spell" icon to put in 3rdparty/plugins/wikiedit/images -- I used someone's copy of a standard MS application spellcheck action. For testing, you can use any of the included icons, for instance "createtable".
There's probably a way to clean up the wiki paths to use the Wikka config variables, but for me the hard coded paths worked fine.
Revision [10220]
Edited on 2005-07-25 16:56:47 by SpectreMoo [Final set of spellchecker installation changes]Additions:
I find having a spellchecker on the wiki quite useful; here's how I added one:
~- Download and install GNU ASpell and an ASpell dictionary from http://aspell.net/ if it isn't already installed (e.g., you're running Windows).
~- Download and unpack spellerpages from http://spellerpages.sourceforge.net/ -- put these files in wiki/3rdparty/plugins/speller.
~- Make the following changes to the spellerpages files:
~...to...
this.spellCheckScript = './server-scripts/spellchecker.php'; // note the '.'
~and:
$aspell_prog = 'aspell'; // fine for *nix systems?
# $aspell_prog = '"[PATCH TO ASPELL EXECUTABLE]"'; // required for Windows, replaces previous line
line 142:
You need to provide your own "spell" icon to put in 3rdparty/plugins/wikiedit/images -- I used someone's copy of a standard MS application spellcheck action. For testing, you can use any of the included icons, for instance "createtable".
There's probably a way to clean up the wiki paths to use the Wikka config variables, but for me the hard coded paths worked fine.
~- Download and install GNU ASpell and an ASpell dictionary from http://aspell.net/ if it isn't already installed (e.g., you're running Windows).
~- Download and unpack spellerpages from http://spellerpages.sourceforge.net/ -- put these files in wiki/3rdparty/plugins/speller.
~- Make the following changes to the spellerpages files:
~...to...
this.spellCheckScript = './server-scripts/spellchecker.php'; // note the '.'
~and:
$aspell_prog = 'aspell'; // fine for *nix systems?
# $aspell_prog = '"[PATCH TO ASPELL EXECUTABLE]"'; // required for Windows, replaces previous line
line 142:
You need to provide your own "spell" icon to put in 3rdparty/plugins/wikiedit/images -- I used someone's copy of a standard MS application spellcheck action. For testing, you can use any of the included icons, for instance "createtable".
There's probably a way to clean up the wiki paths to use the Wikka config variables, but for me the hard coded paths worked fine.
Deletions:
~- Download and install GNU ASpell and an ASpell dictionary from http://aspell.net/
~- Download and unpack spellerpages from http://spellerpages.sourceforge.net/ -- put these files in wiki/3rdparty/plugins/speller
~- In the speller files, make the following changes:
this.spellCheckScript = './server-scripts/spellchecker.php';
~and
# $aspell_prog = 'aspell'; // fine for *nix systems?
$aspell_prog = '"[PATCH TO ASPELL EXECUTABLE]"'; // required for Windows
line 143:
You need to provide your own "spell" icon to put in 3rdparty/plugins/wikiedit/images -- I used someone's copy of a standard MS application spellcheck action.
As mentioned above, I can't guarantee that these steps work as presented just yet, but I wanted to get them here before they disappeared. Once I've confirmed that the process works on an "out of the box" wikka install I'll update this page and get rid of all the disclaimers.
Additions:
~- Finally change wiki/handlers/page/edit.php:
line 143:
line 143:
Deletions:
line 195:
Additions:
$spellercss = $wiki_path.'/speller/spellerStyle.css';
$word_win_src = spellercss = $wiki_path.'/speller/wordWindow.js';
# $aspell_prog = 'aspell'; // fine for *nix systems?
$aspell_prog = '"[PATCH TO ASPELL EXECUTABLE]"'; // required for Windows
~- Make this change around line 108 of wiki/3rdparty/plugins/wikiedit/wikiedit2.js:
$word_win_src = spellercss = $wiki_path.'/speller/wordWindow.js';
# $aspell_prog = 'aspell'; // fine for *nix systems?
$aspell_prog = '"[PATCH TO ASPELL EXECUTABLE]"'; // required for Windows
~- Make this change around line 108 of wiki/3rdparty/plugins/wikiedit/wikiedit2.js:
Deletions:
$word_win_src = spellercss = $wiki_path.'/speller/wordWindow.js'spellerStyle.css';
# $aspell_prog = 'aspell';
$aspell_prog = '"[PATCH TO ASPELL EXECUTABLE]"';
~- Make this change around line 108 of wikiedit2.js:
Additions:
~- Download and unpack spellerpages from http://spellerpages.sourceforge.net/ -- put these files in wiki/3rdparty/plugins/speller
// this.popUpUrl = '/speller/spellchecker.html';
// this.popUpUrl = '/speller/spellchecker.html';
Deletions:
// this.popUpUrl = './speller/spellchecker.html';
Revision [10154]
Edited on 2005-07-20 01:16:06 by SpectreMoo [Added first draft of Spellchecking how-to]Additions:
>>I've installed Wikka to augment our company intranet, and in the process I've made a number of both superficial and functional changes to the code which I plan on posting here when I get the chance.
====Fortune Action====
====Spellchecking wiki pages====
**I haven't tested this in a "vanilla" wikka installation yet**, but I do have it running on my company's intranet wikka wiki, and I find it quite useful.
**Steps**
~- Download and install GNU ASpell and an ASpell dictionary from http://aspell.net/
~- Download and unpack spellerpages from http://spellerpages.sourceforge.net/ -- put these files in wiki/t3rdparty/plugins/speller
~- In the speller files, make the following changes:
~- In spellChecker.js:
%%
// this.popUpUrl = './speller/spellchecker.html';
this.popUpUrl = [YOUR HARD-CODED PATH TO SPELLCHECKER.HTML]";
// For Example: this.popUpUrl = "http://www.notadomain.net/wiki/3rdparty/plugins/speller/spellchecker.html";
// this.spellCheckScript = '/speller/server-scripts/spellchecker.php';
this.spellCheckScript = './server-scripts/spellchecker.php';
%%
~and
%%
if( evalText ) {
this.controlWin.evaluatedText.value = evalText;
ww.setFocus( this.currentTextIndex, this.currentWordIndex );
this._getSuggestions( this.currentTextIndex, this.currentWordIndex );
%%
~...becomes...
%%
if( evalText ) {
// changes to prevent WikiWords from being checked:
if (evalText.match(/[A-ZÄÖÜ]+[a-zßäöü]+[A-Z0-9ÄÖÜ][A-Za-z0-9ÄÖÜßäöü]*/) == null)
this.controlWin.evaluatedText.value = evalText;
ww.setFocus( this.currentTextIndex, this.currentWordIndex );
this._getSuggestions( this.currentTextIndex, this.currentWordIndex );
else
this.currentWordIndex++;
this._spellcheck();
}
%%
~- In speller/server-scripts/spellchecker.php:
%%
$spellercss = '/speller/spellerStyle.css';
$word_win_src = '/speller/wordWindow.js';
$textinputs = $_POST['textinputs']; # array
$aspell_prog = 'aspell';
%%
~...becomes...
%%
$wiki_path = "/wiki/3rdparty/plugins";
// $spellercss = '/speller/spellerStyle.css';
$word_win_src = spellercss = $wiki_path.'/speller/wordWindow.js'spellerStyle.css';
$word_win_src = $wiki_path.'/speller/wordWindow.js';
$textinputs = $_POST['textinputs']; # array
# $aspell_prog = 'aspell';
$aspell_prog = '"[PATCH TO ASPELL EXECUTABLE]"';
%%
~- Make this change around line 108 of wikiedit2.js:
%%
this.addButton(" ");
this.addButton("spell","Check Spelling","","document.getElementById('" + this.id + "')._owner.spellcheck");
%%
~...and this at the end of the file, after the closing brace: (line 645 or so):
%%
WikiEdit.prototype.spellcheck = function ()
{
var speller = new spellChecker();
speller.checkTextAreas();
}
%%
~- Finally change edit.php:
%%
line 195:
'<script language="JavaScript" src="3rdparty/plugins/speller/spellChecker.js"></script>'."\n".
%%
You need to provide your own "spell" icon to put in 3rdparty/plugins/wikiedit/images -- I used someone's copy of a standard MS application spellcheck action.
As mentioned above, I can't guarantee that these steps work as presented just yet, but I wanted to get them here before they disappeared. Once I've confirmed that the process works on an "out of the box" wikka install I'll update this page and get rid of all the disclaimers.
====Fortune Action====
====Spellchecking wiki pages====
**I haven't tested this in a "vanilla" wikka installation yet**, but I do have it running on my company's intranet wikka wiki, and I find it quite useful.
**Steps**
~- Download and install GNU ASpell and an ASpell dictionary from http://aspell.net/
~- Download and unpack spellerpages from http://spellerpages.sourceforge.net/ -- put these files in wiki/t3rdparty/plugins/speller
~- In the speller files, make the following changes:
~- In spellChecker.js:
%%
// this.popUpUrl = './speller/spellchecker.html';
this.popUpUrl = [YOUR HARD-CODED PATH TO SPELLCHECKER.HTML]";
// For Example: this.popUpUrl = "http://www.notadomain.net/wiki/3rdparty/plugins/speller/spellchecker.html";
// this.spellCheckScript = '/speller/server-scripts/spellchecker.php';
this.spellCheckScript = './server-scripts/spellchecker.php';
%%
~and
%%
if( evalText ) {
this.controlWin.evaluatedText.value = evalText;
ww.setFocus( this.currentTextIndex, this.currentWordIndex );
this._getSuggestions( this.currentTextIndex, this.currentWordIndex );
%%
~...becomes...
%%
if( evalText ) {
// changes to prevent WikiWords from being checked:
if (evalText.match(/[A-ZÄÖÜ]+[a-zßäöü]+[A-Z0-9ÄÖÜ][A-Za-z0-9ÄÖÜßäöü]*/) == null)
this.controlWin.evaluatedText.value = evalText;
ww.setFocus( this.currentTextIndex, this.currentWordIndex );
this._getSuggestions( this.currentTextIndex, this.currentWordIndex );
else
this.currentWordIndex++;
this._spellcheck();
}
%%
~- In speller/server-scripts/spellchecker.php:
%%
$spellercss = '/speller/spellerStyle.css';
$word_win_src = '/speller/wordWindow.js';
$textinputs = $_POST['textinputs']; # array
$aspell_prog = 'aspell';
%%
~...becomes...
%%
$wiki_path = "/wiki/3rdparty/plugins";
// $spellercss = '/speller/spellerStyle.css';
$word_win_src = spellercss = $wiki_path.'/speller/wordWindow.js'spellerStyle.css';
$word_win_src = $wiki_path.'/speller/wordWindow.js';
$textinputs = $_POST['textinputs']; # array
# $aspell_prog = 'aspell';
$aspell_prog = '"[PATCH TO ASPELL EXECUTABLE]"';
%%
~- Make this change around line 108 of wikiedit2.js:
%%
this.addButton(" ");
this.addButton("spell","Check Spelling","","document.getElementById('" + this.id + "')._owner.spellcheck");
%%
~...and this at the end of the file, after the closing brace: (line 645 or so):
%%
WikiEdit.prototype.spellcheck = function ()
{
var speller = new spellChecker();
speller.checkTextAreas();
}
%%
~- Finally change edit.php:
%%
line 195:
'<script language="JavaScript" src="3rdparty/plugins/speller/spellChecker.js"></script>'."\n".
%%
You need to provide your own "spell" icon to put in 3rdparty/plugins/wikiedit/images -- I used someone's copy of a standard MS application spellcheck action.
As mentioned above, I can't guarantee that these steps work as presented just yet, but I wanted to get them here before they disappeared. Once I've confirmed that the process works on an "out of the box" wikka install I'll update this page and get rid of all the disclaimers.
Deletions:
I've installed Wikka to augment our company intranet, and in the process I've made a number of both superficial and functional changes to the code which I plan on posting here when I get the chance.
$lines = file ($location);
Additions:
>>//Wikka's only one year old? It feels so much more mature! Congratulations!//
I've installed Wikka to augment our company intranet, and in the process I've made a number of both superficial and functional changes to the code which I plan on posting here when I get the chance.
I'm going to post some of the hacks I've created here, maybe others will find them useful. Many of the hacks I've written work only within my company intranet environment (auto-linking of java class names to our javadocs, for instance), but anything that's more generally applicable I'll try to post here.
First off: the latest iteration of my ""{{fortune}}"" action:
%%(php)<?php
$location = "SOME DEFAULT"; // for example: http://www.textfiles.com/humor/TAGLINES/random.txt
if (!$vars["location"])
{
$lines = file ($location);
}
else
{
$location = $vars["location"];
if ("http" == substr ($location, 0, 4))
{
$lines = file ($location);
}
else if ($this->IsWikiName ($location))
{
if (!$this->ExistsPage ($location))
{
echo "<em>The specified page does not exist.</em>";
return;
}
$page = $this->LoadPage ($location);
if ($page)
{
$line = 0;
$pagelines = explode ("\n", $page["body"]);
for ($i = 0; $i < count ($pagelines); $i++)
{
if (preg_match ("/[ ~]*-(.*)/",$pagelines[$i],$matches))
{
$lines[$line++] = $matches[1];
}
}
}
}
}
echo $lines[array_rand ($lines)];
?>%%
To use, save as fortune.php in the actions directory.
Usage: ""{{fortune location="URL|WikiPage"}}""
~- URLs need to point to one line quotes which end in newlines, as in the example URL included in the source.
~- Wiki pages are parsed for lines starting with a bullet point (""~-"" and its variants), which I've used as a source of random wiki tips.
I've installed Wikka to augment our company intranet, and in the process I've made a number of both superficial and functional changes to the code which I plan on posting here when I get the chance.
I'm going to post some of the hacks I've created here, maybe others will find them useful. Many of the hacks I've written work only within my company intranet environment (auto-linking of java class names to our javadocs, for instance), but anything that's more generally applicable I'll try to post here.
First off: the latest iteration of my ""{{fortune}}"" action:
%%(php)<?php
$location = "SOME DEFAULT"; // for example: http://www.textfiles.com/humor/TAGLINES/random.txt
if (!$vars["location"])
{
$lines = file ($location);
}
else
{
$location = $vars["location"];
if ("http" == substr ($location, 0, 4))
{
$lines = file ($location);
}
else if ($this->IsWikiName ($location))
{
if (!$this->ExistsPage ($location))
{
echo "<em>The specified page does not exist.</em>";
return;
}
$page = $this->LoadPage ($location);
if ($page)
{
$line = 0;
$pagelines = explode ("\n", $page["body"]);
for ($i = 0; $i < count ($pagelines); $i++)
{
if (preg_match ("/[ ~]*-(.*)/",$pagelines[$i],$matches))
{
$lines[$line++] = $matches[1];
}
}
}
}
}
echo $lines[array_rand ($lines)];
?>%%
To use, save as fortune.php in the actions directory.
Usage: ""{{fortune location="URL|WikiPage"}}""
~- URLs need to point to one line quotes which end in newlines, as in the example URL included in the source.
~- Wiki pages are parsed for lines starting with a bullet point (""~-"" and its variants), which I've used as a source of random wiki tips.
Deletions:
Additions:
PHP isn't my first language (Java is), but with Wikka's structure, that's not an issue; it's quite easy to modify and expand.
Deletions:
Additions:
----
CategoryUsers
CategoryUsers
Additions:
(Ah ha! TableofcontentsAction has copious amounts of information as well.)
Additions:
PHP isn't my first language, but with Wikka's structure, that's not an issue; it's quite easy to modify and expand.
Deletions:
Additions:
(Then again, I see now that DotMG has already contributed an AnchorAction... so much for my work! <grin>)