Index: trunk/extensions/SemanticWebBrowser/SemanticWebBrowser.php |
— | — | @@ -2,9 +2,77 @@ |
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Main entry point for the Semantic Web Browser extension. |
6 | | - * @author Anna Kantorovitch and Benedikt K�mpgen |
| 6 | + * @author Anna Kantorovitch and Benedikt Kämpgen |
| 7 | + * @file SemanticWebBrowser.php |
| 8 | + * @ingroup SWB |
7 | 9 | */ |
8 | 10 | |
9 | 11 | |
10 | | -require_once dirname( __FILE__ ) . '/../SemanticWebBrowser/SWB_Settings.php'; |
| 12 | +require_once dirname( __FILE__ ) . '/SWB_Settings.php'; |
11 | 13 | |
| 14 | +/** |
| 15 | + * Global functions used for setting up the Semantic WebBrowser extension. |
| 16 | + * |
| 17 | + */ |
| 18 | +// include for toolbox |
| 19 | +global $swbgToolboxBrowseSemWeb, $wgHooks, $wgAutoloadClasses, $swbgIP, |
| 20 | + $wgFooterIcons, $wgExtensionFunctions, $wgSpecialPageGroups, |
| 21 | + $wgExtensionMessagesFiles, $wgExtensionAliasesFiles, $wgSpecialPages, |
| 22 | + $smwgNamespace, $wgServer, $wgAPIModules, $wgExtensionAliasesFiles; |
| 23 | + |
| 24 | +$wgExtensionMessagesFiles['SemanticWebBrowser'] = $swbgIP . 'SemanticWebBrowser.i18n.php'; // register messages (requires MW=>1.11) |
| 25 | + |
| 26 | +// Register special pages aliases file |
| 27 | +$wgExtensionAliasesFiles['SemanticWebBrowser'] = $swbgIP . 'SemanticWebBrowser.alias.php'; |
| 28 | + |
| 29 | +/* |
| 30 | + * create Special Page for Browse Wiki |
| 31 | + */ |
| 32 | +$wgAutoloadClasses['SWBSpecialBrowseWiki'] = $swbgIP . 'specials/SearchTriple/SWB_SpecialBrowseWiki.php'; |
| 33 | +$wgSpecialPages['BrowseWiki'] = 'SWBSpecialBrowseWiki'; |
| 34 | +$wgSpecialPageGroups['BrowseWiki'] = 'smw_group'; |
| 35 | + |
| 36 | +// InfoLink |
| 37 | +$wgAutoloadClasses['SWBInfolink'] = $swbgIP . 'includes/SWB_Infolink.php'; |
| 38 | + |
| 39 | +// Data values |
| 40 | +$wgAutoloadClasses['SWBResolvableUriValue'] = $swbgIP . 'includes/datavalues/SWBResolvableUriValue.php'; |
| 41 | + |
| 42 | +// SWB Search |
| 43 | +$wgAutoloadClasses['SWBSearch'] = $swbgIP . 'includes/SWB_Search.php'; |
| 44 | + |
| 45 | +$wgHooks['smwInitProperties'][] = 'registerPropertyTypes'; |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | +function registerPropertyTypes() { |
| 50 | + // 5 means uri |
| 51 | + SMWDataValueFactory::registerDatatype( "_rur", |
| 52 | + "SWBResolvableUriValue", |
| 53 | + SMWDataItem::TYPE_URI, |
| 54 | + $label = false ); |
| 55 | + |
| 56 | + return true; |
| 57 | +} |
| 58 | + |
| 59 | +/**include in toolbox for show the last article in "Browsing Semantic Web" |
| 60 | + *has the same functionality as 'Browse properties' in the toolbox |
| 61 | +**/ |
| 62 | + |
| 63 | +if ( $swbgToolboxBrowseSemWeb ) { |
| 64 | + $wgHooks['SkinTemplateToolboxEnd'][] = 'swbfShowBrowseSemWeb'; |
| 65 | +} |
| 66 | + |
| 67 | + |
| 68 | + function swbfShowBrowseSemWeb( $skintemplate ) { |
| 69 | + if ( $skintemplate -> data['isarticle'] ) { |
| 70 | + smwfLoadExtensionMessages( 'SemanticWebBrowser' ); |
| 71 | + $browselink = SWBInfolink::newBrowsingLink( wfMsg( 'swb_browse_semantic_web' ), |
| 72 | + $skintemplate->data['titleprefixeddbkey'], false ); |
| 73 | + |
| 74 | + echo '<li id="t-smwbrowselink">' . $browselink->getHTML() . '</li>'; |
| 75 | + |
| 76 | + } |
| 77 | + return true; |
| 78 | + } |
| 79 | + |