1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
| <?php
if( !defined( "MEDIAWIKI" ) )
{
die();
}
$wgExtensionCredits['other'][] = array(
'name' => "addtag", // Name of extension - string
'description' => "Enhance the functionality to add image markup", // Description of what the extension does - string
'descriptionmsg' => "", // Same as above but name of a message, for i18n - string, added in 1.12.0
'version' => 1, // Version number of extension - number or string
'author' => "kln", // The extension author's name - string
'url' => "", // URL of extension (usually instructions) - string
);
$wgExtensionFunctions[] = "wfAddtagLink";
function wfAddtagLink()
{
global $wgHooks, $wgAjaxExportList, $wgUseAjax;
if (!$wgUseAjax) {
die();
}
$wgHooks['EditPage::showEditForm:fields'][] = "wfAddtagPanel";
$wgAjaxExportList[] = "wfFindtagList";
}
function wfAddtagPanel( &$p, &$out )
{
$htmlFile = "extensions/addtag/lamia.html";
$fh = fopen($htmlFile, 'r');
$theTable = fread($fh, filesize($htmlFile));
fclose($fh);
$out -> addScript( "<script type=\"text/javascript\" src=\"extensions/addtag/final.js\"></script>\n");
$out -> addHTML( "<link rel=\"stylesheet\" type=\"text/css\" href=\"extensions/addtag/addImageLink.css\" />" );
$out -> addHTML( "<a href=\"javascript:showHide()\"><img src=\"extensions/addtag/addtag.png\" alt=\"addtag\"/></a><br />" );
$out -> addHTML( "<div id=\"aILDivtag\">" );
$out -> addHTML( $theTable );
$out -> addHTML( "</div>" );
$out -> addScript( "<script type=\"text/javascript\">hookEvent(\"load\", showHide);</script>\n" );
return true;
}
function wfFindtagList()
{
$response = new AjaxResponse();
global $wgServer;
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'discipline', array('iddiscipline'),
array('libellediscipline') );
while ( $row = $dbr->fetchRow( $res ) ) {
$wgOut->addHTML ("<option value=".$row->iddiscipline.">".$row->libellediscipline."</option>");
}
$dbr->freeResult( $res );
}
?> |
Partager