r77468 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77467‎ | r77468 | r77469 >
Date:10:33, 30 November 2010
Author:neilk
Status:deferred (Comments)
Tags:
Comment:
hidden category for stats purposes
Modified paths:
  • /trunk/extensions/UploadWizard/resources/combined.js (modified) (history)
  • /trunk/extensions/UploadWizard/resources/combined.min.js (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizard.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/combined.js
@@ -11305,6 +11305,9 @@
1130611306 .find( 'input' )
1130711307 .mwCoolCats( { buttontext: gM( 'mwe-upwiz-categories-add' ) } );
1130811308
 11309+ // add hidden category for stats purposes
 11310+ $categoriesDiv.find( 'ul.cat-list' ).append( $j( '<li style="display: none;"><a class="cat">Uploaded with UploadWizard</a></li>' ) );
 11311+
1130911312 };
1131011313
1131111314 mw.UploadWizardDetails.prototype = {
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js
@@ -920,6 +920,9 @@
921921 .find( 'input' )
922922 .mwCoolCats( { buttontext: gM( 'mwe-upwiz-categories-add' ) } );
923923
 924+ // add hidden category for stats purposes
 925+ $categoriesDiv.find( 'ul.cat-list' ).append( $j( '<li style="display: none;"><a class="cat">Uploaded with UploadWizard</a></li>' ) );
 926+
924927 };
925928
926929 mw.UploadWizardDetails.prototype = {
Index: trunk/extensions/UploadWizard/resources/combined.min.js
@@ -11305,6 +11305,9 @@
1130611306 .find('input')
1130711307 .mwCoolCats({buttontext:gM('mwe-upwiz-categories-add')});
1130811308
 11309+
 11310+$categoriesDiv.find('ul.cat-list').append($j('<li style="display: none;"><a class="cat">Uploaded with UploadWizard</a></li>'));
 11311+
1130911312 };
1131011313
1131111314 mw.UploadWizardDetails.prototype={

Comments

#Comment by Catrope (talk | contribs)   18:41, 2 December 2010

This category should be configurable in a $wg var, because 1) hardcoded things like these are generally nasty and 2) non-English wikis will want to use a different name.

#Comment by MZMcBride (talk | contribs)   20:31, 2 December 2010

A $wg variable for localization? Seems like something the MediaWiki namespace would be used for.

#Comment by NeilK (talk | contribs)   23:57, 2 December 2010

I don't think localization matters here. This is a category for internal tracking purposes only, so we can see how the tool is being used (or not used). It probably isn't even permanent. Also see my other comment to MZMcBride in this thread.

#Comment by MZMcBride (talk | contribs)   03:05, 3 December 2010

Is this extension really only intended to be used by Wikimedia?

#Comment by NeilK (talk | contribs)   04:47, 3 December 2010

Nice try.

#Comment by Bryan (talk | contribs)   08:42, 3 December 2010

I think that MZ means that by hardcoding this category, you are making this extension less useful for non-Wikimedia users.

#Comment by NeilK (talk | contribs)   11:01, 3 December 2010

MZ and I understand each other.

#Comment by MZMcBride (talk | contribs)   20:30, 2 December 2010

I'm confused about this revision. MediaWiki already has a concept of "hidden categories." This revision seems to implement the addition of a CSS-hidden <li> element, but doesn't actually update the database tables? This seems hackish and weird. If this is just to have a marker of some kind on the page, a CSS id or class seems much more sane.

#Comment by Catrope (talk | contribs)   22:21, 2 December 2010

I think the category list it adds to is the one in the final stage of the upload wizard, where the user adds categories to the image.

As for putting this in the MW namespace, good point. A message would make even more sense. I still think this feature should be disableable though.

#Comment by NeilK (talk | contribs)   23:56, 2 December 2010

Here's why I did this: Guillaume, literally on his way to catch a plane, asked me to figure out some way to add all uploads to the hidden category Uploaded_by_UploadWizard. And then I remembered just before final deploy. I spent ten minutes hacking this up. So yeah, it's hackish and weird.

Here's how it works: the jquery.mwCoolCats.js widget creates little HTML elements to represent selected categories. At form submit time, those elements are collected into [[Category:]] templates and added to the submitted wikitext.

This line of code injects a hidden HTML element, so that it will be picked up at form submit time, and then since it's a hidden category already, MediaWiki does the usual thing.

So there you go. I regard this as a temporary hack. It's also bad because you have to know exactly how mwCoolCats works to inject an HTML element like this. Maybe the jquery.mwCoolCats.js extension should accept some sort of configuration that adds a hidden category.

#Comment by NeilK (talk | contribs)   23:59, 2 December 2010

s/_by_/_with_/g;

#Comment by Nikerabbit (talk | contribs)   09:37, 3 December 2010

What's the hurry? :)

#Comment by NeilK (talk | contribs)   10:55, 3 December 2010

This is a grant-funded project, and the grant ended Nov 30. We needed to get what we had in front of more people.

That said, the WMF agreed to give us more bug squashing time even though the project is nominally over.

#Comment by Bryan (talk | contribs)   08:45, 3 December 2010

What we really need is a way to indicate how an image was uploaded, and for certain kinds of uploads (upload-by-url) also the source. That said, I think the current solution is fine as temporary measure, if the category was localizable via the MediaWiki namespace or as $wg. I prefer the latter.

#Comment by NeilK (talk | contribs)   01:08, 5 February 2011

complaints addressed in r81550. Hidden categories such as Uploaded_by_UploadWizard are now based on config, not hardcoded.

Status & tagging log