I wrote about CategorySuggest a couple of weeks ago, but wasn’t able to try it then since MYSTlore’s MediaWiki was still on the 1.8 branch, whereas this extension requires at least 1.10.
Another feature was requested that would have required a newer MediaWiki though, so I took the plunge and fortunately didn’t run into too many issues. Thus, CategorySuggest is now running on MYSTlore; kudos for Andreas for writing it.
However, I wasn’t happy with all of it. Here’s a few things I have changed. Obviously, most of them are subjective, and you may well prefer the original variant, or something different altogether.
First, MYSTlore’s charset is UTF-8 – as is, for instance, Wikipedia’s, so chances are your MediaWiki installation might use that as well. However, the suggestions are currently sent with no charset specified at all, and most browsers therefore assume it to be ISO 8859-1, or something different. This works fine in most cases, but obviously breaks with category names that aren’t so simple (in our case, “Untìl Uru shards”; note the deceptively near-invisible accent grave over the i in “Untìl”). So our first change is thus:
--- CategorySuggest_/CategorySuggestSuggest.php 2007-09-27 11:58:42.000000000 +0200
+++ CategorySuggestSuggest.php 2007-10-21 17:01:34.000000000 +0200
@@ -7,6 +7,8 @@
*
*/
+header('Content-Type: text/html; charset=utf-8');
+
//CONFIGURE WITH YOUR LOCAL CREDENTIALS
mysql_connect("localhost", "USERNAME", "PASSWORD");
mysql_select_db("DBNAME");
Second, I changed i18n/CategorySuggest.i18n.php to be a little friendlier, and provide a link to a project article on categories, like so:
--- CategorySuggest_/i18n/CategorySuggest.i18n.php 2007-09-27 11:27:42.000000000 +0200
+++ CategorySuggest/i18n/CategorySuggest.i18n.php 2007-10-21 15:34:08.000000000 +0200
@@ -9,8 +9,8 @@
*
*/
-$messages['categorysuggest-title'] = 'CATEGORY ASSIGNMENT';
-$messages['categorysuggest-subtitle'] = 'Please enter the name of a category for this article.';
+$messages['categorysuggest-title'] = 'Assign Categories';
+$messages['categorysuggest-subtitle'] = 'Enter names of categories for this article; cf. MYSTlore:Categories.';
$messages['categorysuggest-boxlabel'] = 'Categories:';
$messages['categorysuggest-taglabel'] = 'Popular Categories:';
?>
Naturally, linking to MYSTlore: won’t do you any good, and the /wiki/ piece of the URL might not work in your case either. (However, I believe you can use the Project: namespace and have it automatically point to your project name.)
Thirdly, for those among us who care about semantic HTML, the markup output can be improved significantly. As a bonus, it’s actually also more readable and – in my very humble opinion – prettier.
--- CategorySuggest_/CategorySuggestFunctions.php 2007-09-27 11:30:32.000000000 +0200
+++ CategorySuggest/CategorySuggestFunctions.php 2007-10-21 15:39:28.000000000 +0200
@@ -50,13 +50,13 @@
$arrExistingCats = $m_pageCats;
#ADD INPUT BOX FOR USERS TO ENTER CATEGORIES
- $m_pageObj->$m_place .= "<div id='categoryselectmaster'\"><b>" .wfMsg( 'categorysuggest-title' )."</b><br>\n";
- $m_pageObj->$m_place .= wfMsg( 'categorysuggest-subtitle' ). "<br>\n" .wfMsg( 'categorysuggest-boxlabel' );
+ $m_pageObj->$m_place .= "<fieldset><legend>" .wfMsg( 'categorysuggest-title' )."</legend>\n";
+ $m_pageObj->$m_place .= "<p>".wfMsg( 'categorysuggest-subtitle' ). "</p>\n<label for='txtSelectedCategories'>" .wfMsg( 'categorysuggest-boxlabel' )."</label>";
$m_pageObj->$m_place .= "<input onkeyup='sendRequest(this.value);' autocomplete='off' type='text' name='txtSelectedCategories' id='txtSelectedCategories' maxlength='200' size='105' value='".str_replace("_"," ",implode(";", $arrExistingCats))."'/>\n";
- $m_pageObj->$m_place .= '<br><div id="searchResults"></div>';
+ $m_pageObj->$m_place .= '<div id="searchResults"></div>';
//End DIV
- $m_pageObj->$m_place .= "<br></div><br>\n"; //category select master
+ $m_pageObj->$m_place .= "</fieldset>\n"; //category select master
return true;
}
brs are removed entirely, and we use fieldset, legend, label and p instead of the far more generic div and b. We leave the div where something more suitable probably doesn’t exist.
Finally, I’ve tweaked the CategorySuggest.css file a lot. Among the changes is an addition of the box-shadow (currently WebKit-only) and border-radius (currently Gecko- and WebKit-only) properties:
-webkit-box-shadow: 0 2px 3px black;
box-shadow: 0 2px 3px black;
-moz-border-radius-bottomleft: 4px;
-webkit-border-bottom-left-radius: 4px;
-khtml-border-bottom-left-radius: 4px;
border-bottom-left-radius: 4px;
-moz-border-radius-bottomright: 4px;
-webkit-border-bottom-right-radius: 4px;
-khtml-border-bottom-right-radius: 4px;
border-bottom-right-radius: 4px;
I’ve also made a lot of changes to the chosen colors and all, but nothing too unusual or surprising. The result still isn’t going to win any beauty contest, but I’m very happy with it for now.
