r69217 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69216‎ | r69217 | r69218 >
Date:20:39, 9 July 2010
Author:neilk
Status:deferred
Tags:
Comment:
adding tagging plugin by Byrne Reese (will modify heavily for categories)
Modified paths:
  • /trunk/extensions/UploadWizard/UploadWizard.i18n.php (modified) (history)
  • /trunk/extensions/UploadWizard/js/jquery/plugins/jquery.autoSuggest.js (added) (history)
  • /trunk/extensions/UploadWizard/js/jquery/plugins/jquery.tags.js (added) (history)
  • /trunk/extensions/UploadWizard/js/mw.UploadWizard.js (modified) (history)
  • /trunk/extensions/UploadWizard/loader.js (modified) (history)
  • /trunk/extensions/UploadWizard/styles/jquery.autoSuggest.css (added) (history)
  • /trunk/extensions/UploadWizard/styles/jquery.tags.css (added) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/loader.js
@@ -20,6 +20,7 @@
2121 "mw.ApiUploadHandler" : "js/mw.ApiUploadHandler.js",
2222 "mw.DestinationChecker" : "js/mw.DestinationChecker.js",
2323
 24+
2425 "mw.MockUploadHandler" : "js/mw.MockUploadHandler.js",
2526
2627 "$j.fn.tipsy" : "js/jquery/plugins/jquery.tipsy.js",
@@ -30,7 +31,11 @@
3132 "$j.fn.validate" : "js/jquery/plugins/jquery.validate.js",
3233
3334 "$j.fn.arrowSteps" : "js/jquery/plugins/jquery.arrowSteps.js",
34 - "mw.style.arrowSteps" : "styles/jquery.arrowSteps.css"
 35+
 36+ "$j.fn.tags" : "js/jquery/plugins/jquery.tags.js",
 37+
 38+ "mw.style.arrowSteps" : "styles/jquery.arrowSteps.css",
 39+ "mw.style.tags" : "styles/jquery.tags.css"
3540 });
3641
3742 //Set a variable for the base upload interface for easy inclution
@@ -69,8 +74,10 @@
7075 '$j.fn.morphCrossfade',
7176 '$j.fn.validate',
7277 '$j.fn.arrowSteps',
 78+ '$j.fn.tags',
7379 'mw.style.arrowSteps',
74 - 'mw.style.autocomplete'
 80+ 'mw.style.autocomplete',
 81+ 'mw.style.tags'
7582 ],
7683 [
7784 'mw.LanguageUpWiz',
Index: trunk/extensions/UploadWizard/styles/jquery.autoSuggest.css
@@ -0,0 +1,218 @@
 2+/* AutoSuggest CSS - Version 1.2 */
 3+
 4+ul.as-selections {
 5+ list-style-type: none;
 6+ list-style-image: none;
 7+ border-top: 1px solid #888;
 8+ border-bottom: 1px solid #b6b6b6;
 9+ border-left: 1px solid #aaa;
 10+ border-right: 1px solid #aaa;
 11+ padding: 4px 0 4px 4px;
 12+ margin: 0;
 13+ overflow: auto;
 14+ background-color: #fff;
 15+ box-shadow:inset 0 1px 2px #888;
 16+ -webkit-box-shadow:inset 0 1px 2px #888;
 17+ -moz-box-shadow:inset 0 1px 2px #888;
 18+}
 19+
 20+ul.as-selections.loading {
 21+ background-color: #eee;
 22+}
 23+
 24+ul.as-selections li {
 25+ float: left;
 26+ margin: 1px 4px 1px 0;
 27+}
 28+
 29+ul.as-selections li.as-selection-item {
 30+ color: #2b3840;
 31+ font-size: 13px;
 32+ font-family: "Lucida Grande", arial, sans-serif;
 33+ text-shadow: 0 1px 1px #fff;
 34+ background-color: #ddeefe;
 35+ background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#ddeefe), to(#bfe0f1));
 36+ border: 1px solid #acc3ec;
 37+ border-top-color: #c0d9e9;
 38+ padding: 2px 7px 2px 10px;
 39+ border-radius: 12px;
 40+ -webkit-border-radius: 12px;
 41+ -moz-border-radius: 12px;
 42+ box-shadow: 0 1px 1px #e4edf2;
 43+ -webkit-box-shadow: 0 1px 1px #e4edf2;
 44+ -moz-box-shadow: 0 1px 1px #e4edf2;
 45+}
 46+
 47+ul.as-selections li.as-selection-item:last-child {
 48+ margin-left: 30px;
 49+}
 50+
 51+ul.as-selections li.as-selection-item a.as-close {
 52+ float: right;
 53+ margin: 1px 0 0 7px;
 54+ padding: 0 2px;
 55+ cursor: pointer;
 56+ color: #5491be;
 57+ font-family: "Helvetica", helvetica, arial, sans-serif;
 58+ font-size: 14px;
 59+ font-weight: bold;
 60+ text-shadow: 0 1px 1px #fff;
 61+ -webkit-transition: color .1s ease-in;
 62+}
 63+
 64+ul.as-selections li.as-selection-item.blur {
 65+ color: #666666;
 66+ background-color: #f4f4f4;
 67+ background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#f4f4f4), to(#d5d5d5));
 68+ border-color: #bbb;
 69+ border-top-color: #ccc;
 70+ box-shadow: 0 1px 1px #e9e9e9;
 71+ -webkit-box-shadow: 0 1px 1px #e9e9e9;
 72+ -moz-box-shadow: 0 1px 1px #e9e9e9;
 73+}
 74+
 75+ul.as-selections li.as-selection-item.blur a.as-close {
 76+ color: #999;
 77+}
 78+
 79+ul.as-selections li:hover.as-selection-item {
 80+ color: #2b3840;
 81+ background-color: #bbd4f1;
 82+ background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#bbd4f1), to(#a3c2e5));
 83+ border-color: #6da0e0;
 84+ border-top-color: #8bb7ed;
 85+}
 86+
 87+ul.as-selections li:hover.as-selection-item a.as-close {
 88+ color: #4d70b0;
 89+}
 90+
 91+ul.as-selections li.as-selection-item.selected {
 92+ border-color: #1f30e4;
 93+}
 94+
 95+ul.as-selections li.as-selection-item a:hover.as-close {
 96+ color: #1b3c65;
 97+}
 98+
 99+ul.as-selections li.as-selection-item a:active.as-close {
 100+ color: #4d70b0;
 101+}
 102+
 103+ul.as-selections li.as-original {
 104+ margin-left: 0;
 105+}
 106+
 107+ul.as-selections li.as-original input {
 108+ border: none;
 109+ outline: none;
 110+ font-size: 13px;
 111+ width: 120px;
 112+ height: 18px;
 113+ padding-top: 3px;
 114+}
 115+
 116+ul.as-list {
 117+ position: absolute;
 118+ list-style-type: none;
 119+ margin: 2px 0 0 0;
 120+ padding: 0;
 121+ font-size: 14px;
 122+ color: #000;
 123+ font-family: "Lucida Grande", arial, sans-serif;
 124+ background-color: #fff;
 125+ background-color: rgba(255,255,255,0.95);
 126+ z-index: 2;
 127+ box-shadow: 0 2px 12px #222;
 128+ -webkit-box-shadow: 0 2px 12px #222;
 129+ -moz-box-shadow: 0 2px 12px #222;
 130+ border-radius: 5px;
 131+ -webkit-border-radius: 5px;
 132+ -moz-border-radius: 5px;
 133+}
 134+
 135+li.as-result-item, li.as-message {
 136+ margin: 0 0 0 0;
 137+ padding: 5px 12px;
 138+ background-color: transparent;
 139+ border: 1px solid #fff;
 140+ border-bottom: 1px solid #ddd;
 141+ cursor: pointer;
 142+ border-radius: 5px;
 143+ -webkit-border-radius: 5px;
 144+ -moz-border-radius: 5px;
 145+}
 146+
 147+li:first-child.as-result-item {
 148+ margin: 0;
 149+}
 150+
 151+li.as-message {
 152+ margin: 0;
 153+ cursor: default;
 154+}
 155+
 156+li.as-result-item.active {
 157+ background-color: #3668d9;
 158+ background-image: -webkit-gradient(linear, 0% 0%, 0% 64%, from(rgb(110, 129, 245)), to(rgb(62, 82, 242)));
 159+ border-color: #3342e8;
 160+ color: #fff;
 161+ text-shadow: 0 1px 2px #122042;
 162+}
 163+
 164+li.as-result-item em {
 165+ font-style: normal;
 166+ background: #444;
 167+ padding: 0 2px;
 168+ color: #fff;
 169+}
 170+
 171+li.as-result-item.active em {
 172+ background: #253f7a;
 173+ color: #fff;
 174+}
 175+
 176+/* Webkit Hacks */
 177+@media screen and (-webkit-min-device-pixel-ratio:0) {
 178+ ul.as-selections {
 179+ border-top-width: 2px;
 180+ }
 181+ ul.as-selections li.as-selection-item {
 182+ padding-top: 3px;
 183+ padding-bottom: 3px;
 184+ }
 185+ ul.as-selections li.as-selection-item a.as-close {
 186+ margin-top: -1px;
 187+ }
 188+ ul.as-selections li.as-original input {
 189+ height: 19px;
 190+ }
 191+}
 192+
 193+/* Opera Hacks */
 194+@media all and (-webkit-min-device-pixel-ratio:10000), not all and (-webkit-min-device-pixel-ratio:0) {
 195+ ul.as-list {
 196+ border: 1px solid #888;
 197+ }
 198+ ul.as-selections li.as-selection-item a.as-close {
 199+ margin-left: 4px;
 200+ margin-top: 0;
 201+ }
 202+}
 203+
 204+/* IE Hacks */
 205+ul.as-list {
 206+ border: 1px solid #888\9;
 207+}
 208+ul.as-selections li.as-selection-item a.as-close {
 209+ margin-left: 4px\9;
 210+ margin-top: 0\9;
 211+}
 212+
 213+/* Firefox 3.0 Hacks */
 214+ul.as-list, x:-moz-any-link, x:default {
 215+ border: 1px solid #888;
 216+}
 217+BODY:first-of-type ul.as-list, x:-moz-any-link, x:default { /* Target FF 3.5+ */
 218+ border: none;
 219+}
Property changes on: trunk/extensions/UploadWizard/styles/jquery.autoSuggest.css
___________________________________________________________________
Added: svn:eol-style
1220 + native
Index: trunk/extensions/UploadWizard/styles/jquery.tags.css
@@ -0,0 +1,58 @@
 2+.tag-widget {
 3+ clear: both;
 4+ position: relative;
 5+}
 6+.tag-widget ul {
 7+ list-style: none;
 8+ padding-left: 0;
 9+ margin-top: 0;
 10+}
 11+.tag-widget li {
 12+ float: left;
 13+ margin-right: 10px;
 14+ padding: 3px;
 15+}
 16+.tag-widget li a {
 17+ text-decoration: none;
 18+}
 19+.tag-widget li:hover a {
 20+ text-decoration: none;
 21+ color: white;
 22+}
 23+.tag-widget li {
 24+ background-color: #fff;
 25+ border-radius: 4px;
 26+ -moz-border-radius: 4px;
 27+ -webkit-border-radius: 4px;
 28+ border-top: 1px solid #fff;
 29+ border: 1px solid #fff;
 30+ color: black;
 31+ font-size: 12px;
 32+
 33+}
 34+.tag-widget li:hover {
 35+ background-color: #444;
 36+ border-radius: 4px;
 37+ -moz-border-radius: 4px;
 38+ -webkit-border-radius: 4px;
 39+ border-top: 1px solid #111;
 40+ border: 1px solid #222;
 41+ color:white;
 42+}
 43+
 44+
 45+/* Utilities */
 46+.pkg:after, #content-inner:after {
 47+ content: " ";
 48+ display: block;
 49+ visibility: hidden;
 50+ clear: both;
 51+ height: 0.1px;
 52+ font-size: 0.1em;
 53+ line-height: 0;
 54+}
 55+.pkg, #content-inner { display: inline-block; }
 56+/* no ie mac \*/
 57+* html .pkg, * html #content-inner { height: 1%; }
 58+.pkg, #content-inner { display: block; }
 59+/* */
Property changes on: trunk/extensions/UploadWizard/styles/jquery.tags.css
___________________________________________________________________
Added: svn:eol-style
160 + native
Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php
@@ -148,7 +148,8 @@
149149 'mwe-upwiz-license-cc-zero' => 'Creative Commons CC0 Waiver',
150150 'mwe-upwiz-license-gfdl' => 'GNU Free Documentation License',
151151 /* this is just for testing, we are not going to privilege the US and A */
152 - 'mwe-upwiz-license-pd-us' => 'Public Domain (US)'
 152+ 'mwe-upwiz-license-pd-us' => 'Public Domain (US)',
 153+ 'mwe-upwiz-categories' => 'Categories'
153154 );
154155
155156 /** Message documentation (Message documentation)
Index: trunk/extensions/UploadWizard/js/jquery/plugins/jquery.autoSuggest.js
@@ -0,0 +1,368 @@
 2+ /*
 3+ * AutoSuggest
 4+ * Copyright 2009-2010 Drew Wilson
 5+ * www.drewwilson.com
 6+ * code.drewwilson.com/entry/autosuggest-jquery-plugin
 7+ *
 8+ * Version 1.4 - Updated: Mar. 23, 2010
 9+ *
 10+ * This Plug-In will auto-complete or auto-suggest completed search queries
 11+ * for you as you type. You can add multiple selections and remove them on
 12+ * the fly. It supports keybord navigation (UP + DOWN + RETURN), as well
 13+ * as multiple AutoSuggest fields on the same page.
 14+ *
 15+ * Inspied by the Autocomplete plugin by: J�rn Zaefferer
 16+ * and the Facelist plugin by: Ian Tearle (iantearle.com)
 17+ *
 18+ * This AutoSuggest jQuery plug-in is dual licensed under the MIT and GPL licenses:
 19+ * http://www.opensource.org/licenses/mit-license.php
 20+ * http://www.gnu.org/licenses/gpl.html
 21+ */
 22+
 23+(function($){
 24+ $.fn.autoSuggest = function(data, options) {
 25+ var defaults = {
 26+ asHtmlID: false,
 27+ startText: "Enter Name Here",
 28+ emptyText: "No Results Found",
 29+ preFill: {},
 30+ limitText: "No More Selections Are Allowed",
 31+ selectedItemProp: "value", //name of object property
 32+ selectedValuesProp: "value", //name of object property
 33+ searchObjProps: "value", //comma separated list of object property names
 34+ queryParam: "q",
 35+ retrieveLimit: false, //number for 'limit' param on ajax request
 36+ extraParams: "",
 37+ matchCase: false,
 38+ minChars: 1,
 39+ keyDelay: 400,
 40+ resultsHighlight: true,
 41+ neverSubmit: false,
 42+ selectionLimit: false,
 43+ showResultList: true,
 44+ start: function(){},
 45+ selectionClick: function(elem){},
 46+ selectionAdded: function(elem){},
 47+ selectionRemoved: function(elem){ elem.remove(); },
 48+ formatList: false, //callback function
 49+ beforeRetrieve: function(string){ return string; },
 50+ retrieveComplete: function(data){ return data; },
 51+ resultClick: function(data){},
 52+ resultsComplete: function(){}
 53+ };
 54+ var opts = $.extend(defaults, options);
 55+
 56+ var d_type = "object";
 57+ var d_count = 0;
 58+ if(typeof data == "string") {
 59+ d_type = "string";
 60+ var req_string = data;
 61+ } else {
 62+ var org_data = data;
 63+ for (k in data) if (data.hasOwnProperty(k)) d_count++;
 64+ }
 65+ if((d_type == "object" && d_count > 0) || d_type == "string"){
 66+ return this.each(function(x){
 67+ if(!opts.asHtmlID){
 68+ x = x+""+Math.floor(Math.random()*100); //this ensures there will be unique IDs on the page if autoSuggest() is called multiple times
 69+ var x_id = "as-input-"+x;
 70+ } else {
 71+ x = opts.asHtmlID;
 72+ var x_id = x;
 73+ }
 74+ opts.start.call(this);
 75+ var input = $(this);
 76+ input.attr("autocomplete","off").addClass("as-input").attr("id",x_id).val(opts.startText);
 77+ var input_focus = false;
 78+
 79+ // Setup basic elements and render them to the DOM
 80+ input.wrap('<ul class="as-selections" id="as-selections-'+x+'"></ul>').wrap('<li class="as-original" id="as-original-'+x+'"></li>');
 81+ var selections_holder = $("#as-selections-"+x);
 82+ var org_li = $("#as-original-"+x);
 83+ var results_holder = $('<div class="as-results" id="as-results-'+x+'"></div>').hide();
 84+ var results_ul = $('<ul class="as-list"></ul>');
 85+ var values_input = $('<input type="hidden" class="as-values" name="as_values_'+x+'" id="as-values-'+x+'" />');
 86+ var prefill_value = "";
 87+ if(typeof opts.preFill == "string"){
 88+ var vals = opts.preFill.split(",");
 89+ for(var i=0; i < vals.length; i++){
 90+ var v_data = {};
 91+ v_data[opts.selectedValuesProp] = vals[i];
 92+ if(vals[i] != ""){
 93+ add_selected_item(v_data, "000"+i);
 94+ }
 95+ }
 96+ prefill_value = opts.preFill;
 97+ } else {
 98+ prefill_value = "";
 99+ var prefill_count = 0;
 100+ for (k in opts.preFill) if (opts.preFill.hasOwnProperty(k)) prefill_count++;
 101+ if(prefill_count > 0){
 102+ for(var i=0; i < prefill_count; i++){
 103+ var new_v = opts.preFill[i][opts.selectedValuesProp];
 104+ if(new_v == undefined){ new_v = ""; }
 105+ prefill_value = prefill_value+new_v+",";
 106+ if(new_v != ""){
 107+ add_selected_item(opts.preFill[i], "000"+i);
 108+ }
 109+ }
 110+ }
 111+ }
 112+ if(prefill_value != ""){
 113+ input.val("");
 114+ var lastChar = prefill_value.substring(prefill_value.length-1);
 115+ if(lastChar != ","){ prefill_value = prefill_value+","; }
 116+ values_input.val(","+prefill_value);
 117+ $("li.as-selection-item", selections_holder).addClass("blur").removeClass("selected");
 118+ }
 119+ input.after(values_input);
 120+ selections_holder.click(function(){
 121+ input_focus = true;
 122+ input.focus();
 123+ }).mousedown(function(){ input_focus = false; }).after(results_holder);
 124+
 125+ var timeout = null;
 126+ var prev = "";
 127+ var totalSelections = 0;
 128+ var tab_press = false;
 129+
 130+ // Handle input field events
 131+ input.focus(function(){
 132+ if($(this).val() == opts.startText && values_input.val() == ""){
 133+ $(this).val("");
 134+ } else if(input_focus){
 135+ $("li.as-selection-item", selections_holder).removeClass("blur");
 136+ if($(this).val() != ""){
 137+ results_ul.css("width",selections_holder.outerWidth());
 138+ results_holder.show();
 139+ }
 140+ }
 141+ input_focus = true;
 142+ return true;
 143+ }).blur(function(){
 144+ if($(this).val() == "" && values_input.val() == "" && prefill_value == ""){
 145+ $(this).val(opts.startText);
 146+ } else if(input_focus){
 147+ $("li.as-selection-item", selections_holder).addClass("blur").removeClass("selected");
 148+ results_holder.hide();
 149+ }
 150+ }).keydown(function(e) {
 151+ // track last key pressed
 152+ lastKeyPressCode = e.keyCode;
 153+ first_focus = false;
 154+ switch(e.keyCode) {
 155+ case 38: // up
 156+ e.preventDefault();
 157+ moveSelection("up");
 158+ break;
 159+ case 40: // down
 160+ e.preventDefault();
 161+ moveSelection("down");
 162+ break;
 163+ case 8: // delete
 164+ if(input.val() == ""){
 165+ var last = values_input.val().split(",");
 166+ last = last[last.length - 2];
 167+ selections_holder.children().not(org_li.prev()).removeClass("selected");
 168+ if(org_li.prev().hasClass("selected")){
 169+ values_input.val(values_input.val().replace(","+last+",",","));
 170+ opts.selectionRemoved.call(this, org_li.prev());
 171+ } else {
 172+ opts.selectionClick.call(this, org_li.prev());
 173+ org_li.prev().addClass("selected");
 174+ }
 175+ }
 176+ if(input.val().length == 1){
 177+ results_holder.hide();
 178+ prev = "";
 179+ }
 180+ if($(":visible",results_holder).length > 0){
 181+ if (timeout){ clearTimeout(timeout); }
 182+ timeout = setTimeout(function(){ keyChange(); }, opts.keyDelay);
 183+ }
 184+ break;
 185+ case 9: case 188: // tab or comma
 186+ tab_press = true;
 187+ var i_input = input.val().replace(/(,)/g, "");
 188+ if(i_input != "" && values_input.val().search(","+i_input+",") < 0 && i_input.length >= opts.minChars){
 189+ e.preventDefault();
 190+ var n_data = {};
 191+ n_data[opts.selectedItemProp] = i_input;
 192+ n_data[opts.selectedValuesProp] = i_input;
 193+ var lis = $("li", selections_holder).length;
 194+ add_selected_item(n_data, "00"+(lis+1));
 195+ input.val("");
 196+ }
 197+ case 13: // return
 198+ tab_press = false;
 199+ var active = $("li.active:first", results_holder);
 200+ if(active.length > 0){
 201+ active.click();
 202+ results_holder.hide();
 203+ }
 204+ if(opts.neverSubmit || active.length > 0){
 205+ e.preventDefault();
 206+ }
 207+ break;
 208+ default:
 209+ if(opts.showResultList){
 210+ if(opts.selectionLimit && $("li.as-selection-item", selections_holder).length >= opts.selectionLimit){
 211+ results_ul.html('<li class="as-message">'+opts.limitText+'</li>');
 212+ results_holder.show();
 213+ } else {
 214+ if (timeout){ clearTimeout(timeout); }
 215+ timeout = setTimeout(function(){ keyChange(); }, opts.keyDelay);
 216+ }
 217+ }
 218+ break;
 219+ }
 220+ });
 221+
 222+ function keyChange() {
 223+ // ignore if the following keys are pressed: [del] [shift] [capslock]
 224+ if( lastKeyPressCode == 46 || (lastKeyPressCode > 8 && lastKeyPressCode < 32) ){ return results_holder.hide(); }
 225+ var string = input.val().replace(/[\\]+|[\/]+/g,"");
 226+ if (string == prev) return;
 227+ prev = string;
 228+ if (string.length >= opts.minChars) {
 229+ selections_holder.addClass("loading");
 230+ if(d_type == "string"){
 231+ var limit = "";
 232+ if(opts.retrieveLimit){
 233+ limit = "&limit="+encodeURIComponent(opts.retrieveLimit);
 234+ }
 235+ if(opts.beforeRetrieve){
 236+ string = opts.beforeRetrieve.call(this, string);
 237+ }
 238+ $.getJSON(req_string+"?"+opts.queryParam+"="+encodeURIComponent(string)+limit+opts.extraParams, function(data){
 239+ d_count = 0;
 240+ var new_data = opts.retrieveComplete.call(this, data);
 241+ for (k in new_data) if (new_data.hasOwnProperty(k)) d_count++;
 242+ processData(new_data, string);
 243+ });
 244+ } else {
 245+ if(opts.beforeRetrieve){
 246+ string = opts.beforeRetrieve.call(this, string);
 247+ }
 248+ processData(org_data, string);
 249+ }
 250+ } else {
 251+ selections_holder.removeClass("loading");
 252+ results_holder.hide();
 253+ }
 254+ }
 255+ var num_count = 0;
 256+ function processData(data, query){
 257+ if (!opts.matchCase){ query = query.toLowerCase(); }
 258+ var matchCount = 0;
 259+ results_holder.html(results_ul.html("")).hide();
 260+ for(var i=0;i<d_count;i++){
 261+ var num = i;
 262+ num_count++;
 263+ var forward = false;
 264+ if(opts.searchObjProps == "value") {
 265+ var str = data[num].value;
 266+ } else {
 267+ var str = "";
 268+ var names = opts.searchObjProps.split(",");
 269+ for(var y=0;y<names.length;y++){
 270+ var name = $.trim(names[y]);
 271+ str = str+data[num][name]+" ";
 272+ }
 273+ }
 274+ if(str){
 275+ if (!opts.matchCase){ str = str.toLowerCase(); }
 276+ if(str.search(query) != -1 && values_input.val().search(","+data[num][opts.selectedValuesProp]+",") == -1){
 277+ forward = true;
 278+ }
 279+ }
 280+ if(forward){
 281+ var formatted = $('<li class="as-result-item" id="as-result-item-'+num+'"></li>').click(function(){
 282+ var raw_data = $(this).data("data");
 283+ var number = raw_data.num;
 284+ if($("#as-selection-"+number, selections_holder).length <= 0 && !tab_press){
 285+ var data = raw_data.attributes;
 286+ input.val("").focus();
 287+ prev = "";
 288+ add_selected_item(data, number);
 289+ opts.resultClick.call(this, raw_data);
 290+ results_holder.hide();
 291+ }
 292+ tab_press = false;
 293+ }).mousedown(function(){ input_focus = false; }).mouseover(function(){
 294+ $("li", results_ul).removeClass("active");
 295+ $(this).addClass("active");
 296+ }).data("data",{attributes: data[num], num: num_count});
 297+ var this_data = $.extend({},data[num]);
 298+ if (!opts.matchCase){
 299+ var regx = new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + query + ")(?![^<>]*>)(?![^&;]+;)", "gi");
 300+ } else {
 301+ var regx = new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + query + ")(?![^<>]*>)(?![^&;]+;)", "g");
 302+ }
 303+
 304+ if(opts.resultsHighlight){
 305+ this_data[opts.selectedItemProp] = this_data[opts.selectedItemProp].replace(regx,"<em>$1</em>");
 306+ }
 307+ if(!opts.formatList){
 308+ formatted = formatted.html(this_data[opts.selectedItemProp]);
 309+ } else {
 310+ formatted = opts.formatList.call(this, this_data, formatted);
 311+ }
 312+ results_ul.append(formatted);
 313+ delete this_data;
 314+ matchCount++;
 315+ if(opts.retrieveLimit && opts.retrieveLimit == matchCount ){ break; }
 316+ }
 317+ }
 318+ selections_holder.removeClass("loading");
 319+ if(matchCount <= 0){
 320+ results_ul.html('<li class="as-message">'+opts.emptyText+'</li>');
 321+ }
 322+ results_ul.css("width", selections_holder.outerWidth());
 323+ results_holder.show();
 324+ opts.resultsComplete.call(this);
 325+ }
 326+
 327+ function add_selected_item(data, num){
 328+ values_input.val(values_input.val()+data[opts.selectedValuesProp]+",");
 329+ var item = $('<li class="as-selection-item" id="as-selection-'+num+'"></li>').click(function(){
 330+ opts.selectionClick.call(this, $(this));
 331+ selections_holder.children().removeClass("selected");
 332+ $(this).addClass("selected");
 333+ }).mousedown(function(){ input_focus = false; });
 334+ var close = $('<a class="as-close">&times;</a>').click(function(){
 335+ values_input.val(values_input.val().replace(","+data[opts.selectedValuesProp]+",",","));
 336+ opts.selectionRemoved.call(this, item);
 337+ input_focus = true;
 338+ input.focus();
 339+ return false;
 340+ });
 341+ org_li.before(item.html(data[opts.selectedItemProp]).prepend(close));
 342+ opts.selectionAdded.call(this, org_li.prev());
 343+ }
 344+
 345+ function moveSelection(direction){
 346+ if($(":visible",results_holder).length > 0){
 347+ var lis = $("li", results_holder);
 348+ if(direction == "down"){
 349+ var start = lis.eq(0);
 350+ } else {
 351+ var start = lis.filter(":last");
 352+ }
 353+ var active = $("li.active:first", results_holder);
 354+ if(active.length > 0){
 355+ if(direction == "down"){
 356+ start = active.next();
 357+ } else {
 358+ start = active.prev();
 359+ }
 360+ }
 361+ lis.removeClass("active");
 362+ start.addClass("active");
 363+ }
 364+ }
 365+
 366+ });
 367+ }
 368+ }
 369+})(jQuery);
\ No newline at end of file
Property changes on: trunk/extensions/UploadWizard/js/jquery/plugins/jquery.autoSuggest.js
___________________________________________________________________
Added: svn:eol-style
1370 + native
Index: trunk/extensions/UploadWizard/js/jquery/plugins/jquery.tags.js
@@ -0,0 +1,123 @@
 2+RegExp.escape = (function() {
 3+ var specials = [
 4+ '/', '.', '*', '+', '?', '|',
 5+ '(', ')', '[', ']', '{', '}', '\\'
 6+ ];
 7+
 8+ sRE = new RegExp(
 9+ '(\\' + specials.join('|\\') + ')', 'g'
 10+ );
 11+
 12+ return function(text) {
 13+ return text.replace(sRE, '\\$1');
 14+ }
 15+})();
 16+(function($){
 17+ $.fn.tags = function(options) {
 18+ var defaults = {
 19+ showform: false,
 20+ formlabel: 'Add tag(s):',
 21+ buttontext: 'Add',
 22+ listlabel: 'Tags:',
 23+ deletetext: 'x',
 24+ delimitter: ',',
 25+ linkformat: '',
 26+ //submitstyle: 'string',
 27+ /* Events and Callbacks */
 28+ addtag: function(e){ },
 29+ removetag: function(e){ }
 30+ };
 31+ var tagList = Array();
 32+ var self;
 33+ var orig;
 34+ var origname;
 35+ var settings = $.extend( {}, defaults, options);
 36+ return this.each( function() {
 37+ orig = $(this);
 38+ $(this).wrap('<div class="tag-widget"></div>');
 39+ $(this).parent().append('<button>'+settings.buttontext+'</button>');
 40+ $(this).find('button').click( function(e) {
 41+ _processInput();
 42+ e.preventDefault();
 43+ return false;
 44+ });
 45+ $(this).parent().append('<ul class="tag-list pkg"></ul>');
 46+ $(this).parent().append( $(this).clone().attr('type','hidden').removeAttr('class').val('') );
 47+ $(this).parents('form').submit( function() {
 48+ _processInput();
 49+ });
 50+ $(this).parents('form').keydown( function(e) {
 51+ if(e.keyCode == 13) {
 52+ e.preventDefault();
 53+ return false;
 54+ }
 55+ });
 56+ origname = $(this).attr('name');
 57+ $(this).removeAttr('name');
 58+ $(this).keyup(function(e) {
 59+ if(e.keyCode == 13) {
 60+ e.stopPropagation();
 61+ e.preventDefault();
 62+ _processInput();
 63+ }
 64+ });
 65+ obj = $(this).parent(); // set to the tag-widget class we just wrapped
 66+ self = obj;
 67+ _processInput();
 68+ });
 69+ function _split( str ) {
 70+ var delim = RegExp.escape(settings.delimitter);
 71+ var delim_scan = new RegExp('^((([\'"])(.*?)\\3|.*?)(' + delim + '\\s*|$))', '');
 72+ str = str.replace(/(^\s+|\s+$)/g, '');
 73+ var tags = [];
 74+ while (str.length && str.match(delim_scan)) {
 75+ str = str.substr(RegExp.$1.length);
 76+ orig.val(str);
 77+ var tag = RegExp.$4 ? RegExp.$4 : RegExp.$2;
 78+ tag = tag.replace(/(^\s+|\s+$)/g, '');
 79+ tag = tag.replace(/\s+/g, ' ');
 80+ if (tag != '') tags.push(tag);
 81+ }
 82+ return tags;
 83+ };
 84+ function _processInput() {
 85+ var newtags = _split( self.find('input').val() );
 86+ for(i = 0; i < newtags.length; i++) {
 87+ _insertTag( newtags[i] );
 88+ };
 89+ self.find('ul li a.delete').click( function() {
 90+ var tag = $(this).parent().find('a.tag').html();
 91+ $(this).parent().remove();
 92+ _removeTag( tag );
 93+ });
 94+ };
 95+ function _removeTag( tag ) {
 96+ var str = '';
 97+ for (var i=0;i < tagList.length;i++) {
 98+ if (tagList[i] == tag) {
 99+ tagList.splice(i,1);
 100+ i--;
 101+ } else {
 102+ if (str != '') { str = str + settings.delimitter; }
 103+ str = str + tagList[i];
 104+ }
 105+ }
 106+ self.find('input[name='+origname+']').val( str );
 107+
 108+ };
 109+ function _insertTag( tag ) {
 110+ if ( _containsTag( tag ) ) { return; }
 111+ var tag_esc = escape(tag).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27').replace(/ /g,'+');
 112+ self.find('ul').append('<li class="tag"><a class="tag" href="'+settings.linkformat + tag_esc+'">'+tag+'</a> <a href="javascript:void(0)" class="delete">'+settings.deletetext+'</a></li>');
 113+ tagList.push(tag);
 114+ var v = self.find('input[name='+origname+']').val();
 115+ if (v != '') { v = v + settings.delimitter; }
 116+ self.find('input[name='+origname+']').val( v + tag );
 117+ };
 118+ function _containsTag( tag ) {
 119+ for (var i = 0; i < tagList.length; i++) {
 120+ if (tag == tagList[i]) { return 1; }
 121+ }
 122+ return 0;
 123+ };
 124+ }})(jQuery);
Property changes on: trunk/extensions/UploadWizard/js/jquery/plugins/jquery.tags.js
___________________________________________________________________
Added: svn:eol-style
1125 + native
Index: trunk/extensions/UploadWizard/js/mw.UploadWizard.js
@@ -1144,10 +1144,22 @@
11451145 $j( '<legend class="mwe-legend">' ).append( gM( 'mwe-upwiz-copyright-info' ) ),
11461146 _this.deedDiv
11471147 );
 1148+
 1149+ var $categoriesDiv = $j('<div class="mwe-upwiz-details-fieldname-input ui-helper-clearfix">'
 1150+ + '<div class="mwe-upwiz-details-fieldname"></div>'
 1151+ + '<div class="mwe-upwiz-details-input"></div>'
 1152+ + '</div>' );
 1153+ $categoriesDiv.find( '.mwe-upwiz-details-fieldname' ).append( gM( 'mwe-upwiz-categories' ) );
 1154+ var categoriesId = 'categories' + _this.upload.index;
 1155+ $categoriesDiv.find( '.mwe-upwiz-details-input' )
 1156+ .append( $j( '<input/>' ).attr( { id: categoriesId,
 1157+ name: categoriesId,
 1158+ type: 'text' } )
 1159+ );
11481160
1149 - moreDetailsDiv = $j('<div class="mwe-more-details"></div>');
 1161+ var moreDetailsDiv = $j('<div class="mwe-more-details"></div>');
11501162
1151 - moreDetailsCtrlDiv = $j( '<div class="mwe-upwiz-details-more-options"></div>' );
 1163+ var moreDetailsCtrlDiv = $j( '<div class="mwe-upwiz-details-more-options"></div>' );
11521164
11531165 var dateInputId = "dateInput" + ( _this.upload.index ).toString();
11541166 var dateDisplayInputId = "dateDisplayInput" + ( _this.upload.index ).toString();
@@ -1192,6 +1204,7 @@
11931205 descriptionAdderDiv,
11941206 titleContainerDiv,
11951207 _this.copyrightInfoFieldset,
 1208+ $categoriesDiv,
11961209 moreDetailsCtrlDiv,
11971210 moreDetailsDiv
11981211 );
@@ -1242,6 +1255,8 @@
12431256 $j( containerDiv ).append( _this.div );
12441257
12451258
 1259+ $categoriesDiv.find( '.mwe-upwiz-details-input' ).find( 'input' ).tags();
 1260+
12461261 };
12471262
12481263 mw.UploadWizardDetails.prototype = {
@@ -2315,6 +2330,8 @@
23162331
23172332 upload.deedPreview = new mw.UploadWizardDeedPreview( upload );
23182333
 2334+ // XXX do we really need to do this now? some things will even change after step 2.
 2335+ // legacy.
23192336 // set up details
23202337 upload.details = new mw.UploadWizardDetails( upload, $j( '#mwe-upwiz-macro-files' ) );
23212338 },

Status & tagging log