Extension talk:Nimbus
Add topicUTF8 with Nimbus work strangy
[edit]I just enabled Nimbus on my site and made test page at http://wiki.picassomap.com/index.php/Nim The test page has two separate tests and each provide me different result... the same
- flash=1 mode
- UTF8 character rendered well in both test.
BUT when I click the category name... wrong encoded URI is being sending to server. Can anyone give me some comments?
- flash=0 mode
- no problem as well in display BUT when I click one of category name... correct encoded character is being sending without required prefix Category:xxxx
- I found the reason by myself and after modify couple of code in Nimbus.php... it works for me in my homepage - Gmdduf 2011.10.28
Which swfobject.js
[edit]Downloading the swfobject2.2.zip package shows 2 swfobject.js files:
One is in swfobject/ (~12k) and the other in swfobject/src/ (~28k), which one to use?
(Btw, the wp-cumulus.1.23.zip also contains swfobject.js)
Also do the files need to be set to a certain permission? chmod 644?
Thanks for the awesome looking extension --SomaticJourney 11:46, 8 February 2010 (UTC)
- You should not need the src (source) of this flash to function, but it may be useful if you wish to modify the flash pattern (elliptical pattern instead of circular, etc). Those changes would require a flash editor.
- If you've installed cumulus, you already have what you need. Just add the Nimbus.php to you extensions/Nimbus directory, comment-out Cumulus and add Nimbus to your LocalSettings.php file (they won't work together, but Nimbus can replace Cumulus), i.e.:
# require_once("$IP/extensions/Cumulus/Cumulus.php"); require_once("$IP/extensions/Nimbus/Nimbus.php");
- -Don't forget to turn-on the flash on your wiki page:
<tagcloud> flash=1 </tagcloud>
- These files are read & executed, I'd set permissions to 755. --MSmaga
- Thanks for the speedy reply. FYI, I didn't have Cumulus installed prior to Nimbus. I also went back and re-uploaded swfobject.js (not the source) and set permissions to 755. Made sure flash=1 was set and.... still no joy.
Example on my wiki :( --SomaticJourney- Same problem by me. Flash doesn't work. I've also tried with the two files located on your server (http://wiki.gis.com/wiki/extensions/Nimbus/swfobject.js and http://wiki.gis.com/wiki/extensions/Nimbus/tagcloud.swf). Maybe there is a problem in the PHP code provided on the extension page? --Laurent 18:07, 8 February 2010 (UTC)
- Also same problem at my Mediawiki installation (15.1). The cloud works but there is no flash. Any ideas? The example on the demo page looks terrific!!! --MKeyler 08:50, 9 February 2010 (UTC)
- By the way: I fixed a typo in line 144 of the Nimbus.php file: the "S" was missing. old: ENT_QUOTE; new: ENT_QUOTES --MKeyler 14:42, 9 February 2010 (UTC)
- Having the same problem on my site any ideas? Jake4d 04:38, 10 February 2010 (UTC) (using v14.0)
- Same problem by me. Flash doesn't work. I've also tried with the two files located on your server (http://wiki.gis.com/wiki/extensions/Nimbus/swfobject.js and http://wiki.gis.com/wiki/extensions/Nimbus/tagcloud.swf). Maybe there is a problem in the PHP code provided on the extension page? --Laurent 18:07, 8 February 2010 (UTC)
- Thanks for the speedy reply. FYI, I didn't have Cumulus installed prior to Nimbus. I also went back and re-uploaded swfobject.js (not the source) and set permissions to 755. Made sure flash=1 was set and.... still no joy.
Thanks for fixing the typo! I fixed a problem having to do with non-Category files, another having to do with apostrophes in the Category name, and (re-)discovered that UTF8 characters do not display. See here --MSmaga
- Great. It's getting better every day. But at my MediaWiki installation (15.1) the Flash does not kick in. Any ideas why? --MKeyler 14:51, 10 February 2010 (UTC)
- There have been upgrades to the linked swfobject.js and tagcoud.swf files, which may have broken this. I can send you working copies of these files if you email me. --MSmaga
- The path (in Nimbus.php) to the Nimbus directory and it's contents assume that you have your wiki setup in the following structure: "wiki/extensions/Nimbus/". My setup is "mediawiki/extensions/Nimbus". I needed to change that in 3 locations within Nimbus.php. That was an issue that was coming up for me. --SomaticJourney 00:37, 11 February 2010 (UTC)
- Thanks for the feedback. I've updated the code to include $wgScriptPath to apply user's "wiki" directory. --MSmaga 00:54, 11 February 2010 (UTC)
- Thank you SomaticJourney for filing this problem. It was the same with my installations. Now the code looks pretty good! The only thing is that Flash is still not working. So dear Msmaga: yes, I would appreciate an email with the 2 flash files. The ones I downloaded do definitely not work :-( Great job by the way!!!--MKeyler 07:18, 11 February 2010 (UTC)
- Cheers. This is a beautiful extension. I'm glad to give feedback. --SomaticJourney 07:57, 12 February 2010 (UTC)
- Hey Msmaga, is there any way you could email me the working files? Or add them to the extension page? I am still unable to get the flash to work (using v1.14.0)Jake4d 22:59, 26 February 2010 (UTC)
- Never mind, it works after changing permissions to 755. Jake4d 00:21, 27 February 2010 (UTC)
- Msmaga, perhaps just offer the non-broken swfobject.js tagcloud.swf on the Nimbus, it will save you a lot of queries. I got a mate of mine recently to install, and he came back to me with the same problems as I had. Most current version of the .js and .swf clouds break the extension. --SomaticJourney 23:45, 6 March 2010 (UTC)
UTF8 Characters do not display
[edit]The UTF-8 problem has to do with pre-loading of font images in the flash file, and of course having limited space for this. I donât maintain the flash part, but if you need additional characters, instructions for this are at http://www.roytanck.com/2008/08/04/how-to-add-more-characters-to-wp-cumulus/ --MSmaga
Problem with special characters
[edit]- After some testing I found this problem: you have to delete all categories with special characters like "&" in them eg. "category: Test & more" to get the flash running. Otherwise the picture is just blank. Does anyone have ideas to solve this? Thank you --MKeyler 15:00, 23 February 2010 (UTC)
- When using the "&" character in category pages the flash does not show at all. Is there a way to maybe block these pages? --SmartK 08:55, 23 March 2010 (UTC)
Problem with https sites
[edit]I had to change the Nimbus.php file so that the category links in the flash would work. Just a hint for all those who run it with https instead of http... --MKeyler 15:05, 23 February 2010 (UTC)
- original line:
$currentRowP = "<a href='http://{$_SERVER['SERVER_NAME']}$scriptPath/index.php?title=$titleP' style='$textSizeP' color='$color' hicolor='$hicolor'>{$title->getText()}</a>";
- new line:
$currentRowP = "<a href='https://{$_SERVER['SERVER_NAME']}$scriptPath/index.php?title=$titleP' style='$textSizeP' color='$color' hicolor='$hicolor'>{$title->getText()}</a>";
- -Now auto-detecting http: or https: MSmaga 18:28, 23 February 2010 (UTC)
- Thank you MSmaga for the fast help. But I'm sorry to say: It does not detect https yet. The Flash still links me to a http site which is not available of course :-( --MKeyler 08:13, 24 February 2010 (UTC)
- Any news on this? --SmartK 08:54, 23 March 2010 (UTC)
- Thank you MSmaga for the fast help. But I'm sorry to say: It does not detect https yet. The Flash still links me to a http site which is not available of course :-( --MKeyler 08:13, 24 February 2010 (UTC)
Change Flash background color?
[edit]Any ideas how? --SomaticJourney 00:39, 7 March 2010 (UTC)
- You can create a DIV tag with what color you prefer
ie:
<div style="background-color: #660033;width:330px;height230px;">
<tagcloud class="nimbus" style="background: transparent; padding:0; border:0;">
flash=1
flash_width=330
flash_height=230
increase_factor=150
</tagcloud>
</div>
--George Alexandru DudÄu 18:00, 13 March 2010 (UTC)
- Thanks! --SomaticJourney 21:45, 14 March 2010 (UTC)
Feature Request
[edit]I really love this extension, but I have more categories I want to exclude on my wiki Debatrix than I want to include. Would it be possible to replace the 'Exclude' option with an 'include only' option? --Jake4d 18:13, 5 May 2010 (UTC)
Patch to manage exclude list correctly
[edit]I have category with space in display name, but in the table, the name is sotred with _ instead of space. At line 105 (in the loop on excluded category), $exclude_conditition is defined. At line 106, there is a test on end of loop to add ",".
Between those 2 lines, I add :
if (strpos(trim( $excluded_categories[$i]) , " ")Â !== false) $exclude_condition = $exclude_condition . "," . "\"" . str_replace(' ', '_', trim($excluded_categories[$i]) ) . "\"";
This add the category replacing space by _ to exclude_condition.
Exclude by Patterns
[edit]If you need to filter many categories using patterns (for example, ever category starting with PROsomething) you can add this piece of code inside extensions/Nimbus/Nimbus.php:
$pattern_exclude = getMediaWikiVar( $input, 'pattern_exclude' );
/*
* Exclition by pattern.
*/
if(strlen($pattern_exclude)) {
$pattern_exclude = str_replace('*', '%', $pattern_exclude);
$pattern_exclude = explode(',', $pattern_exclude);
foreach($pattern_exclude as $pat) {
$pat = trim($pat);
if(strlen($pat)) {
$exclude_condition.= (strlen($exclude_condition) ? ' AND ':'WHERE ');
$exclude_condition.= "$cloudColumn NOT LIKE \"$pat\"";
}
}
}
Where: you can add it after this:
$exclude_condition = '';
if ( strlen( $exclude ) > 0 ) {
$excluded_categories = explode( ",", $exclude );
if ( count( $excluded_categories ) > 0 ) {
$exclude_condition = " WHERE $cloudColumn NOT IN (";
for ( $i = 0; $i < count( $excluded_categories ); $i++ ) {
$exclude_condition = $exclude_condition . "\"" . trim( $excluded_categories[$i] ) . "\"";
if ( $i < count( $excluded_categories ) - 1 ) {
$exclude_condition = $exclude_condition . ",";
}
}
$exclude_condition = $exclude_condition . ")";
}
}
How to use it: this modification adds the keyword pattern_exclude and it works like exclude, allowing patterns using asterisks and persent simbols (Note: think in MySQL).
<tagcloud style="background: transparent; padding:0; border:0;">
flash=1
pattern_exclude = PRO*, *fake*
</tagcloud>
Nimbus at Sidebar
[edit]If you wish to add a Nimbus cloud at the sidebar, you may add this code at the end of Nimbus.php (before php closing tag):
// Hook to modify the sidebar
$wgNimbusInSidebar = false;
$wgHooks['SkinBuildSidebar'][] = 'NimbusInSidebar';
function NimbusInSidebar($skin, &$bar) {
global $wgNimbusInSidebar;
global $wgParser;
global $wgScriptPath;
if(!$wgNimbusInSidebar) {
return $bar;
} else {
$revInput = Revision::newFromTitle(Title::makeTitle(null, 'Nimbus:Input'));
$revParams = Revision::newFromTitle(Title::makeTitle(null, 'Nimbus:Params'));
if($revInput) {
$input = $revInput->getText();
$params = array();
if($revParams) {
$text = $revParams->getText();
$text = explode("\n", $text);
foreach($text as $t) {
$t = trim($t);
if($t) {
$aux = explode('=', $t);
$params[trim($aux[0])] = trim($aux[1]);
}
}
}
$bar['nimbus'] = renderTagCloud($input, $params, $wgParser);
return true;
} else {
$bar['nimbus'] = array(
'nimbus' => "<p>There are no configuration pages:<ul>\n".
"<li><b><a href=\"".Title::makeTitle(null, 'Nimbus:Input')->escapeFullURL()."\">Nimbus:Input</a></b></li>\n".
"<li><a href=\"".Title::makeTitle(null, 'Nimbus:Params')->escapeFullURL()."\">Nimbus:Params</a></li>\n".
"</ul></p>\n");
return $bar;
}
}
}
- --Daemonraco 18:42, 27 August 2010 (UTC) Adding a simple modification for MediaWiki:Sidebar
After it, you need to create 2 new pages:
- Nimbus:Input: This page will contains the same data that is enter between tags <tagcloud> and </tagcloud>.
- Nimbus:Params: This other page will contains the same data that is enter as attributes inside tag <tagcloud>.
Examples
[edit]Nimbus:Input page:
flash=1 flash_width=150 flash_height=150 increase_factor=150 mcolor=0x000000 hicolor=0xa60000
Nimbus:Params page:
style=background:transparent;padding:0;border:0;
This configuration generates something like:
<tagcloud style="background:transparent;padding:0;border:0;"> flash=1 flash_width=150 flash_height=150 increase_factor=150 mcolor=0x000000 hicolor=0xa60000 </tagcloud>
Enable/Disable
[edit]By default, this code is disable, if you want to activate it, add:
$wgNimbusInSidebar = true;
After this line in LocalSettings.php:
require_once("$IP/extensions/Nimbus/Nimbus.php");
--Daemonraco 17:04, 26 August 2010 (UTC)
- Could you link an example site that has nimbus cloud in sidebar for me to see?Jake4d 17:40, 25 September 2010 (UTC)
- I'm sorry, but the only example I have is in a private MW in my work server, also I'm sorry for giving you an answer after a year --Daemonraco 01:37, 18 August 2011 (UTC)
- Could you link an example site that has nimbus cloud in sidebar for me to see?Jake4d 17:40, 25 September 2010 (UTC)
Incompatibility ?
[edit]I got this error message:
"headers already sent by (output started at /homez.406/rcrjzdrx/www/extensions/Nimbus/Nimbus.php:292) in /homez.406/rcrjzdrx/www/includes/WebResponse.php on line 16"
Don't know what it means (I know almost nothing about PHP)
Parse error
[edit]I am getting the following error: Parse error: parse error, unexpected '(', expecting '}' in /home/username/Nimbus/Nimbus.php on line 169
I've copied and pasted, and verified code to extension listing.
Any thoughts?
I escaped the curly brackets and solved my issues from >{$title->getText()}< to >\{$title->getText()\}<
Problem with links of non-flash cloud.
[edit]When I use nimbus without the flash option, the links don't go to categories, they go to article page titles. How do I fix this? Thank you. 67.169.112.14 04:34, 3 June 2011 (UTC)
Nimbus.php renderTagCloud function: I changed
$title = Title::makeTitle('NS_' , $tags[$i][0] );
to
$title = Title::makeTitle(NS_CATEGORY , $tags[$i][0] );
Then both non-flash and flash links goes to categories. --BrightGenie 13:21, 22 December 2011 (UTC)
Problem with tables with prefix
[edit]My tables in db has prefix "w_" and when I click on the categories in the cloud, only the name of the category is treated as page name. But in fact it should open the page "Category:<category name>". I try to add the prefix in the page names in Nimbus.php but fail with error. Is there any update considering prefix in db tables? Thank you.
The problem with the additional fields
[edit]The problem with the additional fields before and after the Category Cloud.
MediaWiki | 1.17.0 (r94642) |
PHP | 5.3.6-6~dotdeb.0 (apache2handler) |
MySQL | 5.0.51a-24+lenny5 |
Thank you. --Tuxinfox 03:51, 1 September 2011 (UTC)
Is this solved? I have the same problem...
Can Anyone help me please... I do not know how to remove these additional fields... Thanks in advance. Werz
These fields are caused by the object being padded by a pre tag. I am attempting right now to figure this one out myself and hope to have a possible solution soon. I don't see anything in the code that causes it, so it must be from when MW includes it into the page. Admittedly, I'm new to MW, but learning fast. I haven't seen many author replies lately, so I'm rewriting most of the code. I've got it working with the latest version (1.17) of the wiki and the parameters work correctly now. I know some folks have been saying it's returning all categories and ignoring parameters passed to it (though I broke the params inside the opening tag for now). I could always post the results when I'm done, but I'm hoping msmaga might give us an update if anything is being worked on. I might be able to send him my code, which is much easier to extend and includes the pattern_exclude option above. I'll update this with my finding soon on the evil pre boxes. -Aiden 28 Sept 2011
Ok, as I figured. The pre tags are added by mediawiki, since it is wrapping the script tags with pre. The best way to fix this is something like wrap the tagcloud in another div with class tagcloud and then modify your stylesheet for div.tagcloud>pre to have padding:0; line-height:0; border: 0; and the dotted areas are history. This also gives you freedom to do things like reposition and float the object. -Aiden 29 Sept 2011
Hi Aiden, thanks! That works for me... Werz1975 07 Oct 2011
Thanks! --Tuxinfox 22:42, 23 October 2011 (UTC)
The root cause for the additional <pre> fields is bad source code formatting with leading white spaces.
Explananation see http://jimbojw.com/wiki/index.php?title=Raw_HTML_Output_from_a_Parser_Extension#Whitespace_and_list_processing
When
$output = " <script type=\"text/javascript\" src=\"$scriptPath/extensions/Nimbus/swfobject.js\"></script> <div id=\"flashcontent\"><div class=\"" . implode( ' ', $cloudClasses ) . "\" style=\"{$cloudStyle}\"> ...
is changed to
$output = "<script type=\"text/javascript\" src=\"$scriptPath/extensions/Nimbus/swfobject.js\"></script>" . "<div id=\"flashcontent\"><div class=\"" . implode( ' ', $cloudClasses ) . "\" style=\"{$cloudStyle}\">" . ...
(string concatenation with each line) there are no additional fields in the rendering output.
phphax -- March, 9th 2012
Feature Request
[edit]The way is is now the extension pulls up every category and gives the option to exclude specific categories when you call it. I was wondering if it would be possible to reverse the default behavior so you had to add categories to be included in the tag cloud?
My reason for this is that I am using it on a very messy wiki with thousands of categories; most of which I do not want to appear in the tag cloud. It would be better for me to list the ones I want to display. Jake4d 08:15, 5 September 2011 (UTC)
Yup, I'm working on this one myself right now. I'm adding an include_only tag that can take single or wildcards and modifiying exclude to work the same way. The overall guts of the system is easy to figure out, so might take me a few days (fingers crossed). Aiden 28 Sept 2011
Status of the extension
[edit]Mark, I've pretty much rewritten the whole extension, except for the non-flash links and the actual SQL calls. I've added include_only and exclude tags that support exact matches and wildcards. I've currently got it running on mw1.17 with swfobject 1.4 and I've optimized some of the code a bit (like the variable loading). So, should I replace your existing code window on the main page? I don't want to usurp your authorship. If I don't hear anything from anyone in a short while, I'll post the updated code here on the discussion, or should I just fork my own extension? Not sure, as I'm pretty new to the wiki extension scene. -Aiden 29 Sept 2011
- Yes, you can fork it.
- You don't usurp it as long as you still credit credit original authors. --Dereckson (talk) 05:42, 15 January 2013 (UTC)
Any news ?
Some flash tagclouds on same page
[edit]If we have some flash clouds on one page (for example at sidebar and at the page) then we can see only one flash tagcloud and other (others) will be text(non-flash). But we want all in flash mode. So we need to edit nimbus.php function renderTagCloud: All we need to do is just put random part to div id "flashcontent". I created variable rnd. Then add it in div id and put to so.write() method call.
if ($flash) {
$rnd = rand();
$output = "
<script type=\"text/javascript\" src=\"$scriptPath/extensions/Nimbus/swfobject.js\"></script>
<div id=\"flashcontent$rnd\"><div class=\"" . implode( ' ', $cloudClasses ) . "\" style=\"{$cloudStyle}\">
$linksNoFlash</div></div>
<script type=\"text/javascript\">
var so = new SWFObject(\"$scriptPath/extensions/Nimbus/tagcloud.swf\", \"tagcloud\", \"$flash_width\", \"$flash_height\", \"7\", \"#ffffff\");
// uncomment next line to enable transparency
so.addParam(\"wmode\", \"transparent\");
so.addVariable(\"tcolor\", \"0x333333\");
so.addVariable(\"mode\", \"tags\");
so.addVariable(\"distr\", \"true\");
so.addVariable(\"tspeed\", \"$speed\");
so.addVariable(\"tagcloud\", \"<tags>$links</tags>\");
so.write(\"flashcontent$rnd\");
</script>
";
}