Index: trunk/extensions/FreqPatternTagCloud/FreqPatternTagCloud.body.php |
— | — | @@ -130,7 +130,6 @@ |
131 | 131 | $dbr = wfGetDB( DB_SLAVE ); |
132 | 132 | |
133 | 133 | // Get possible attribute values |
134 | | - // @todo FIXME: ugly + SQL INJECTION POINT! |
135 | 134 | $res = $dbr->query( |
136 | 135 | "(SELECT DISTINCT vals.smw_title AS val, atts.smw_title AS att |
137 | 136 | FROM ".$dbr->tableName("smw_ids")." vals, ".$dbr->tableName("smw_ids")." atts, ".$dbr->tableName("smw_rels2")." rels |
— | — | @@ -140,10 +139,10 @@ |
141 | 140 | AND atts.smw_namespace = 102 |
142 | 141 | AND LENGTH(vals.smw_iw) = 0 |
143 | 142 | AND LENGTH(atts.smw_iw) = 0 |
144 | | - AND vals.smw_title LIKE '%".mysql_real_escape_string($currentSearchValue)."%' |
145 | | - ORDER BY vals.smw_title |
146 | | - LIMIT 20) UNION ( |
147 | | - SELECT smw_title AS val, '".wfMsg("fptc-categoryname")."' AS att |
| 143 | + AND vals.smw_title LIKE '%".mysql_real_escape_string($currentSearchValue)."%' |
| 144 | + ORDER BY vals.smw_title |
| 145 | + LIMIT 20) UNION ( |
| 146 | + SELECT smw_title AS val, '".mysql_real_escape_string(wfMsg("fptc-categoryname"))."' AS att |
148 | 147 | FROM ".$dbr->tableName("smw_ids")." |
149 | 148 | WHERE smw_title LIKE '%".mysql_real_escape_string($currentSearchValue)."%' |
150 | 149 | AND smw_namespace = 14 |
— | — | @@ -252,7 +251,7 @@ |
253 | 252 | <li class="browse"> |
254 | 253 | <a href="#browse">' . wfMsg( 'fptc-context-menu-browse' ) . '</a> |
255 | 254 | </li> |
256 | | - <li class="suggestions separator"> |
| 255 | + <li class="fptc_suggestions separator"> |
257 | 256 | ' . wfMsg( 'fptc-context-menu-similar-tags' ) . ' |
258 | 257 | </li> |
259 | 258 | </ul>' |
Index: trunk/extensions/FreqPatternTagCloud/FreqPatternTagCloud.php |
— | — | @@ -70,7 +70,8 @@ |
71 | 71 | // @todo FIXME: this should use ResourceLoader and the appropriate core |
72 | 72 | // functions instead of using its own jQuery etc. |
73 | 73 | $wgOut->addExtensionStyle( $wgScriptPath.'/extensions/FreqPatternTagCloud/stylesheets/jquery/ui-lightness/jquery-ui-1.8.custom.css' ); |
74 | | - $wgOut->addScriptFile( $wgScriptPath . '/extensions/FreqPatternTagCloud/javascripts/jquery-1.4.2.min.js' ); |
| 74 | + #$wgOut->addScriptFile( $wgScriptPath . '/extensions/FreqPatternTagCloud/javascripts/jquery-1.4.2.min.js' ); |
| 75 | + $wgOut->addScriptFile( $wgScriptPath . '/extensions/FreqPatternTagCloud/javascripts/jquery.parseJSON.js' ); |
75 | 76 | $wgOut->addScriptFile( $wgScriptPath . '/extensions/FreqPatternTagCloud/javascripts/jquery-ui-1.8.custom.min.js' ); |
76 | 77 | |
77 | 78 | if ( $wgFreqPatternTagCloudSearchBarModification ) { |
Index: trunk/extensions/FreqPatternTagCloud/includes/computation/FrequentPatternApriori.php |
— | — | @@ -17,6 +17,10 @@ |
18 | 18 | $numTransactions = count($transactions); |
19 | 19 | $allFrequentItemsets = array(); |
20 | 20 | |
| 21 | + if ($numTransactions == 0) { |
| 22 | + return array(); |
| 23 | + } |
| 24 | + else { |
21 | 25 | // Get all 1-frequent itemsets |
22 | 26 | foreach ($items as $item) { |
23 | 27 | $freq = 0; |
— | — | @@ -65,6 +69,7 @@ |
66 | 70 | } |
67 | 71 | |
68 | 72 | return $allFrequentItemsets; |
| 73 | + } |
69 | 74 | } |
70 | 75 | |
71 | 76 | |
Index: trunk/extensions/FreqPatternTagCloud/javascripts/main.js |
— | — | @@ -16,31 +16,32 @@ |
17 | 17 | |
18 | 18 | // Relocate |
19 | 19 | var pageName = RegExp.$1; |
20 | | - window.location = window.location.href.replace(new RegExp(pageName + ".*"), pageName + "/" + $("#fptc_attributeName").val()); |
| 20 | + window.location = window.location.href.replace(new RegExp(pageName + ".*"), pageName + "/" + $j("#fptc_attributeName").val()); |
21 | 21 | }; |
22 | 22 | |
23 | | -$().ready(function() { |
| 23 | + |
| 24 | +$j().ready(function() { |
24 | 25 | // Process form when key "return" is pressed |
25 | | - $("#fptc_attributeName").keypress(function(e) { |
| 26 | + $j("#fptc_attributeName").keypress(function(e) { |
26 | 27 | if(e.which == 13){ |
27 | 28 | fptc_relocate(); |
28 | 29 | } |
29 | 30 | }); |
30 | 31 | |
31 | | - var attribute = $("#fptc_attributeName").val(); |
| 32 | + var attribute = $j("#fptc_attributeName").val(); |
32 | 33 | |
33 | 34 | // Context menu for tag cloud |
34 | | - $(".fptc_tag a").contextMenu({ |
| 35 | + $j(".fptc_tag a").contextMenu({ |
35 | 36 | menu: "fptc_contextMenu", |
36 | 37 | onOpen: function(el) { |
37 | 38 | // Indicate loading |
38 | | - $("#fptc_contextMenu li").slice(2).remove(); |
39 | | - $("#fptc_contextMenu").append('<li class="loading"></li>'); |
| 39 | + $j("#fptc_contextMenu li").slice(2).remove(); |
| 40 | + $j("#fptc_contextMenu").append('<li class="loading"></li>'); |
40 | 41 | |
41 | 42 | // Replace contents when done with loading |
42 | 43 | sajax_do_call("FreqPatternTagCloud::getSuggestions", [attribute, el.text()], function(data) { |
43 | 44 | // Process return data |
44 | | - $("#fptc_contextMenu .loading").replaceWith(data.responseText); |
| 45 | + $j("#fptc_contextMenu .loading").replaceWith(data.responseText); |
45 | 46 | }); |
46 | 47 | } |
47 | 48 | }, function(action, el, pos, menu) { |
— | — | @@ -52,7 +53,7 @@ |
53 | 54 | }); |
54 | 55 | |
55 | 56 | // Autosuggestion for input field |
56 | | - $("#fptc_attributeName").autocomplete({ |
| 57 | + $j("#fptc_attributeName").autocomplete({ |
57 | 58 | delay: 0, |
58 | 59 | source: function(currentValue, callbackForResults) { |
59 | 60 | sajax_do_call("FreqPatternTagCloud::getAttributeSuggestions", [currentValue.term], function(data) { |
Index: trunk/extensions/FreqPatternTagCloud/javascripts/search.js |
— | — | @@ -7,12 +7,12 @@ |
8 | 8 | * @version 1.0 |
9 | 9 | */ |
10 | 10 | |
11 | | - $().ready(function() { |
| 11 | + $j().ready(function() { |
12 | 12 | // Autosuggestion for search input field using frequent pattern techniques |
13 | | - $.widget( "custom.autocomplete_search", $.ui.autocomplete, { |
| 13 | + $j.widget( "custom.autocomplete_search", $j.ui.autocomplete, { |
14 | 14 | _renderMenu: function( ul, items ) { |
15 | 15 | var self = this, currentCategory = ""; |
16 | | - $.each( items, function( index, item ) { |
| 16 | + $j.each( items, function( index, item ) { |
17 | 17 | if ( item.category != currentCategory ) { |
18 | 18 | // Value changed |
19 | 19 | ul.append('<li class="fptc_search_category">' + item.category + "</li>" ); |
— | — | @@ -22,7 +22,7 @@ |
23 | 23 | }); |
24 | 24 | } |
25 | 25 | }); |
26 | | - $("#searchInput, #searchText").autocomplete_search({ |
| 26 | + $j("#searchInput, #searchText").autocomplete_search({ |
27 | 27 | delay: 0, |
28 | 28 | source: function(currentValue, callbackForResults) { |
29 | 29 | sajax_do_call("FreqPatternTagCloud::getSearchSuggestions", [currentValue.term], function(data) { |
Index: trunk/extensions/FreqPatternTagCloud/javascripts/jquery.contextMenu.js |
— | — | @@ -1,3 +1,5 @@ |
| 2 | +jQuery( document ).ready( function( $ ) { |
| 3 | + |
2 | 4 | // jQuery Context Menu Plugin |
3 | 5 | // |
4 | 6 | // Version 1.01 |
— | — | @@ -212,4 +214,6 @@ |
213 | 215 | } |
214 | 216 | |
215 | 217 | }); |
216 | | -})(jQuery); |
\ No newline at end of file |
| 218 | +})(jQuery); |
| 219 | + |
| 220 | +}); |
Index: trunk/extensions/FreqPatternTagCloud/javascripts/jquery-ui-1.8.custom.min.js |
— | — | @@ -1,4 +1,4 @@ |
2 | | -/*! |
| 2 | + /*! |
3 | 3 | * jQuery UI 1.8 |
4 | 4 | * |
5 | 5 | * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) |
— | — | @@ -401,4 +401,4 @@ |
402 | 402 | * Depends: |
403 | 403 | * jquery.effects.core.js |
404 | 404 | */ |
405 | | -(function(a){a.effects.transfer=function(b){return this.queue(function(){var f=a(this),h=a(b.options.to),e=h.offset(),g={top:e.top,left:e.left,height:h.innerHeight(),width:h.innerWidth()},d=f.offset(),c=a('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(b.options.className).css({top:d.top,left:d.left,height:f.innerHeight(),width:f.innerWidth(),position:"absolute"}).animate(g,b.duration,b.options.easing,function(){c.remove();(b.callback&&b.callback.apply(f[0],arguments));f.dequeue()})})}})(jQuery);; |
\ No newline at end of file |
| 405 | +(function(a){a.effects.transfer=function(b){return this.queue(function(){var f=a(this),h=a(b.options.to),e=h.offset(),g={top:e.top,left:e.left,height:h.innerHeight(),width:h.innerWidth()},d=f.offset(),c=a('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(b.options.className).css({top:d.top,left:d.left,height:f.innerHeight(),width:f.innerWidth(),position:"absolute"}).animate(g,b.duration,b.options.easing,function(){c.remove();(b.callback&&b.callback.apply(f[0],arguments));f.dequeue()})})}})(jQuery);; |
Index: trunk/extensions/FreqPatternTagCloud/stylesheets/main.css |
— | — | @@ -22,7 +22,7 @@ |
23 | 23 | |
24 | 24 | #fptc_contextMenu .loading, |
25 | 25 | #fptc_contextMenu .no_entries, |
26 | | -#fptc_contextMenu .suggestions |
| 26 | +#fptc_contextMenu .fptc_suggestions |
27 | 27 | { |
28 | 28 | text-decoration: none; |
29 | 29 | display: block; |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | background-image: url("../images/loading.gif"); |
42 | 42 | } |
43 | 43 | |
44 | | -#fptc_contextMenu .suggestions |
| 44 | +#fptc_contextMenu .fptc_suggestions |
45 | 45 | { |
46 | 46 | font-weight: bold; |
47 | 47 | } |
\ No newline at end of file |