I'm making my mediawiki-driven senior project for this semester. It is about
creating a thesaurus for bikol languages. I started editing pages and also
importing pages manually. So far, all the changes work. Now, I'm making the core
function of my project-thesaurus. I implemented a string search algorithm in a
php file(but not yet on the special file), which I will be using in the search
function on the SpecailThesaurus.php file. I'm making a special page on the
/includes directory and also on the /extensions directory named
"SpecialThesaurus.php".
Problems:
-How can I set the action attribute in "form" so that it displays all the output
on the page $SERVER['PHP_SELF'];
-How can I enable this script "SpecialThesaurus.php" so that it shows after a
user adds/edit a page?
Thanks. (^_^)
On the /extensions directory, the "SpecialThesaurus.php" includes this code:
---------------
<?php
$wgExtensionFunctions[] = "wfExtensionSpecialThesaurus";
function wfExtensionSpecialThesaurus()
{
global $wgMessageCache;
$wgMessageCache->addMessages(array('thesaurus' => 'WikiBiTs Thesaurus page'));
require_once('includes/SpecialPage.php');
SpecialPage::addPage(new SpecialPage('Thesaurus'));
}
?>
---------------
On the /includes directory, the "SpecialThesaurus.php" includes this code:
---------------
<?php
if( !defined( 'MEDIAWIKI' ) )
die();
$wgExtensionCredits['validextensionclass'][] = array(
'name' => 'Thesaurus for Biko languages',
'author' =>'Kathleen Jane P. Borja',
'url' => 'http://www.mediawiki.org/wiki/User:Kathjane',
'description' => 'This Extension searches for bikol word for a given
literary input (poems, short stories, etc.), tags the searched word with bikol
synonym according to origin (Bikol-Naga, Bikol-Masbate, etc.) and user type
(Student, College Graduate, or Professional). '
);
function wfSpecialThesaurus()
{
$searchboxtext = "Search for Bikol words";
$tagboxtext = "Tag with Bikol Synonym";
global $wgOut;
$result=<<<ENDFORM
<!-- Thesaurus Extension by Borja, Kathleen -->
<table border="0" align="left" width="650" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" align="left" bgcolor="">
<form name="searchbox" action="" method="get" class="searchbox">
Search : <input class="searchboxinput" name="searchkword" type="text"
value="{$searchboxtext}" size="50" />
<input type="submit" name="submitsearch" value="Go" />
<input type="reset" name="cancelsearch" value="Cancel"/><br><br>
Results:<br>
<textarea name="resultarea" cols="60" rows="10"></textarea><br><br>
Tag with: <input type="text" name="tagbox" value={$tagboxtext}" size="50" />
Origin: <select>
<option name="default" />Bicol-Naga
<option name="bicolmasbate" />Bicol-Masbate
<option name="bicolragay" />Bicol-Ragay
<option name="bicollegazpi" />Bicol-Legazpi
<option name="others" />Others
</select>
User Category:
<select>
<option name="student" />Student
<option name="collegegraduate" />College Graduate
<option name="professional" />Professional
<option name="others" />Others
</select><br><br>
<input type="submit" name="saveall" value="Save" />
<input type="reset" name="cancelall" value="Cancel" />
</form>
</td>
</tr>
</table>
<!-- Thesaurus Extension End - -->
ENDFORM;
$wgOut->addHTML($result);
return true;
}
?>
---------------
Hi,
I know configuration variables such as $wgRCLinkDays
(<http://www.mediawiki.org/wiki/Manual:$wgRCLinkDays>) affect
Special:Recentchanges. Do they also affect how many RC edits you can
get out of the API?
e.g. if $wgRCLinkDays is set to 3, and I try and pull RCs from the
last 7 days via the API, will they all be there? Or will I just
silently get 3 days worth?
Are config variables like this accessible via the API? It doesn't seem
to me that they are.
thanks,
Brianna
--
They've just been waiting in a mountain for the right moment:
http://modernthings.org/
Hello!
I run a small site, where only the registered users currently have
access to articles. I'd like to allow anonymous visitors to see the
first and the last paragraph of a page, instead of simply demanding,
they log-in.
Extension-writing seems simple enough, but all of the hooks in the
`*Page Rendering'* section of the list at:
http://www.mediawiki.org/wiki/Manual:Hooks
seem to apply to an article /regardless of the visitor/. The result of
the rendering is then cached and sent to all subsequent visitors... This
means, that if the first user to access a page is a guest, even the
registered users will see the truncated page. And the other way around
-- if the first user is registered, everyone will the full content of
the page rendered just for him...
Short of disabling caching altogether, how can I send an abridged
version to guests without affecting the logged-in users? Thank you!
-mi
Folks,
I'm having some trouble editing a page with the MediaWiki API on 1.13.3.
I have used the following PERL code, which takes a page name and some
content and should add it to my wiki. This works almost flawlessly,
with the exception that instead of the content going to the page
specified in the title, it goes into a page called "Api.php".
sub add_wiki {
my $page = shift;
my $content = shift;
my $ua = LWP::UserAgent->new;
$ua->agent("Aquila bot/0.1");
$ua->credentials(
'wiki.example.com:443',
'Restricted Files',
$wikiuser => $wikipass
);
my %post;
$post{"format"} = "xml";
$post{"title"} = $page;
$post{"text"} = $content;
$post{"section"} = "0";
$post{"token"} = $edittoken;
$post{"action"} = "edit";
my $req = $ua->post($wikiaddurl, ,[ %post ]);
my $data;
if ($req->is_success == 1) {
$data = $req->content;
return("0", $data);
} else {
my $error = $req->status_line;
return("1", $error);
}
}
I have checked and the page name is being passed correctly to the
function. Am I missing something? I have checked the docs that I can
find, including the API documentation on the MediaWiki site but as far
as I can tell, all I need to do is pass title=name for the page name to
use?
Mike.
Hi all,
using the mediawiki API, I can list the pages in a given category. For example:
http://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle…
returns:
<?xml version="1.0"?>
<api>
<query>
<categorymembers>
<cmpageid="22939"ns="0"title="Physics"/>
<cmpageid="24489"ns="0"title="Outline of physics"/>
<cmpageid="1653925"ns="100"title="Portal:Physics"/>
<cmpageid="3445246"ns="0"title="Glossary of classical physics"/>
<cmpageid="22950086"ns="0"title="Britney Spears' Guide to Semiconductor Physics"/>
<cmpageid="2129107"ns="14"title="Category:Fundamental physics concepts"/>
<cmpageid="4769321"ns="0"title="Timeline of fundamental physics discoveries"/>
<cmpageid="694942"ns="14"title="Category:Physicists"/>
<cmpageid="1198"ns="0"title="Acoustics"/>
<cmpageid="1913676"ns="14"title="Category:Applied and interdisciplinary physics"/>
</categorymembers>
</query>
<query-continue>
<categorymemberscmcontinue="Atomic, molecular, and optical physics|"/>
</query-continue>
</api>
I now want to limit my query to only one MW namespace. I have tried to use the cmnamespace parameter. But
http://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle…
returns the same result. How should I use this namespace parameter ?
Pierre
.
My apologies for sending out this e-mail so late.
As of r52190 [1], API maxlag errors (the kind of error you get when
you set &maxlag=2 and the maximum slave lag is higher than two
seconds) return a HTTP 503 status code rather than a 200, for
consistency with index.php (which does the same thing). The text of
the response has not changed:
<api>
<error code="maxlag" info="Waiting for 10.0.6.38: 1 seconds lagged" />
</api>
To trigger a maxlag error, you can set &maxlag=-1 [2].
Be aware that some client libraries may treat the 503 return code
differently, which is why this could be a breaking change.
Roan Kattouw (Catrope)
[1] http://www.mediawiki.org/wiki/Special:Code/MediaWiki/52190
[2] http://en.wikipedia.org/w/api.php?maxlag=-1&action=query
_______________________________________________
Mediawiki-api-announce mailing list
Mediawiki-api-announce(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce
I have a bot (using mwclient 0.6.2) that nightly updates some status
pages on WikiEducator.org. It has suddenly started failing with an
'Edit conflict' but I can edit the page by hand and the script continues
to write to another page. Are there things that would prohibit the API
from writing to a page but still allow editing through the wiki?
MediaWiki 1.14
mwclient 0.6.3 has been released. This version is required for usage
on Wikimedia wikis.
mwclient 0.6.2 will not work on Wikimedia wikis, because the version
detector does not understand the recently introduced 1.16alpha-wmf
version. I committed a temporary hack, which will later probably be
removed in favor of something better.
Mwclient is a Python library that allows easy access to the MediaWiki
API and should be more or less usable on MediaWiki 1.11 or higher and
should graciously fallback when the write api is disbled.
See <http://apps.sourceforge.net/mediawiki/mwclient/> for download links.
Bryan
Hi,
I'm using MediaWiki version 1.15.1 and mwlib 0.11.2 and
Extension:Collection to generate PDF from wiki pages. I set my wiki site
to prevent anonymous reading and editing and configured Extension::LDAP
to authenticate through my Active Directory. The Extension:Collection
has the credentials configured to access MediaWiki API through
authentication. But when mw-render tries to read pages from my wiki, it
receives this message "You need read permission to use this module".
I read something about credentials stripping when using JSON callbacks
(there is a comment in ApiMain.php about this). So, the question is: is
there a way to mw-render read pages from my wiki even with anonymous
reading being blocked?
I don't want to allow anonymous access to my pages, but I really need to
generate PDF's from them.
Thank's for any help.
Best regards,
Fabio Junior Sabai