r93878 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93877‎ | r93878 | r93879 >
Date:10:44, 4 August 2011
Author:devayon
Status:deferred
Tags:
Comment:
adding modal window for sorting options
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/libs/jquery-ui/jquery-ui.min.dialog.js (added) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php
@@ -140,7 +140,7 @@
141141 * @global OutputPage $wgOut
142142 * @global boolean $smwgJQueryIncluded
143143 */
144 - private function enableJQuery() {
 144+ protected function enableJQuery() {
145145 global $wgOut, $smwgJQueryIncluded;
146146 if ( !$smwgJQueryIncluded ) {
147147 $realFunction = array( 'OutputPage', 'includeJQuery' );
@@ -160,7 +160,7 @@
161161 * @global string $smwgScriptPath
162162 * @global boolean $smwgJQueryUIIncluded
163163 */
164 - private function enableJQueryUI() {
 164+ protected function enableJQueryUI() {
165165 global $wgOut, $smwgScriptPath, $smwgJQueryUIIncluded;
166166
167167 $wgOut->addExtensionStyle( "$smwgScriptPath/skins/jquery-ui/base/jquery.ui.all.css" );
@@ -186,7 +186,7 @@
187187 * Adds common JS and CSS required for Autocompletion.
188188 * @global OutputPage $wgOut
189189 */
190 - private function addAutocompletionJavascriptAndCSS() {
 190+ protected function addAutocompletionJavascriptAndCSS() {
191191 global $wgOut;
192192 if ( $this->autocompleteenabled == false ) {
193193 $this->enableJQueryUI();
Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php
@@ -66,7 +66,7 @@
6767 // Main query and printouts.
6868 $result .= '<p><strong>' . wfMsg( 'smw_ask_queryhead' ) . "</strong></p>\n";
6969 $result .= '<p>' . $this->getQueryFormBox() . '</p>';
70 - //sorting and prinouts
 70+ // sorting and prinouts
7171 $result .= $this->getPoSortFormBox();
7272 // show|hide additional options and querying help
7373 $result .= '<br><span id="show_additional_options" style="display:inline;"><a href="#addtional" rel="nofollow" onclick="' .
@@ -83,7 +83,7 @@
8484 // additional options
8585 $result .= '<div id="additional_options" style="display:none">';
8686
87 - $result .= "<br><br>" . $this->getFormatSelectBox( 'broadtable' );
 87+ $result .= $this->getFormatSelectBox( 'broadtable' );
8888
8989 if ( $this->uiCore->getQueryString() != '' ) // hide #ask if there isnt any query defined
9090 $result .= $this->getAskEmbedBox();
@@ -98,7 +98,237 @@
9999 }
100100
101101 /**
102 - * Compatibility method to get the skin; MW 1.18 introduces a getSkin method
 102+ * Generates the forms elements(s) for choosing printouts and sorting
 103+ * options. Use its complement processPoSortFormBox() to decode data
 104+ * sent by these elements.
 105+ *
 106+ * Overrides method from SMWQueryUI (modal window added)
 107+ *
 108+ * @return string
 109+ */
 110+ protected function getPoSortFormBox( $enableAutocomplete = SMWQueryUI::ENABLE_AUTO_SUGGEST ) {
 111+ global $smwgQSortingSupport, $wgRequest, $wgOut, $smwgScriptPath;
 112+
 113+ if ( !$smwgQSortingSupport ) return '';
 114+ $this->enableJQueryUI();
 115+ $wgOut->addScriptFile( "$smwgScriptPath/libs/jquery-ui/jquery-ui.min.dialog.js" );
 116+
 117+ $result = '';
 118+ $num_sort_values = 0;
 119+ // START: create form elements already submitted earlier via form
 120+ // attempting to load parameters from $wgRequest
 121+ $property_values = $wgRequest->getArray( 'property' );
 122+ $order_values = $wgRequest->getArray( 'order' );
 123+ $display_values = $wgRequest->getArray( 'display' );
 124+ if ( is_array( $property_values ) ) {
 125+ // removing empty values
 126+ foreach ( $property_values as $key => $property_value ) {
 127+ $property_values[$key] = trim( $property_value );
 128+ if ( $property_value == '' ) {
 129+ unset( $property_values[$key] );
 130+ }
 131+ }
 132+ } else {
 133+ /*
 134+ * Printouts and sorting were set via another widget/form/source, so
 135+ * create elements by fetching data from $uiCore. The exact ordering
 136+ * of Ui elements might not be preserved, if the above block were to
 137+ * be removed. This is a bit of a hack, converting all strings to
 138+ * lowercase to simplify searching procedure and using in_array.
 139+ */
 140+
 141+ $po = explode( '?', $this->getPOStrings() );
 142+ reset( $po );
 143+ foreach ( $po as $key => $value ) {
 144+ $po[$key] = strtolower( trim( $value ) );
 145+ if ( $po[$key] == '' ) {
 146+ unset ( $po[$key] );
 147+ }
 148+ }
 149+
 150+ $params = $this->uiCore->getParameters();
 151+ if ( array_key_exists( 'sort', $params ) && array_key_exists( 'order', $params ) ) {
 152+ $property_values = explode( ',', strtolower( $params['sort'] ) );
 153+ $order_values = explode( ',', $params['order'] );
 154+ reset( $property_values );
 155+ reset( $order_values );
 156+ } else {
 157+ $order_values = array(); // do not even show one sort input here
 158+ $property_values = array();
 159+ }
 160+
 161+ foreach ( $po as $po_key => $po_value ) {
 162+ if ( !in_array( $po_value, $property_values ) ) {
 163+ $property_values[] = $po_value;
 164+ }
 165+ }
 166+ $display_values = array();
 167+ reset( $property_values );
 168+ foreach ( $property_values as $property_key => $property_value ) {
 169+ if ( in_array( $property_value, $po ) ) {
 170+ $display_values[$property_key] = "yes";
 171+ }
 172+ }
 173+ }
 174+ $num_sort_values = count( $property_values );
 175+ foreach ( $property_values as $i => $property_value ) {
 176+ $result .= Html::openElement( 'div', array( 'id' => "sort_div_$i" ) ) . wfMsg( 'smw_qui_property' );
 177+ $result .= Html::input( 'property[' . $i . ']', $property_value, 'text', array( 'size' => '35' ) ) . "\n";
 178+ $result .= html::openElement( 'select', array( 'name' => "order[$i]" ) );
 179+ if ( !is_array( $order_values ) or !array_key_exists( $i, $order_values ) or $order_values[$i] == 'NONE' ) {
 180+ $result .= '<option selected value="NONE">' . wfMsg( 'smw_qui_nosort' ) . "</option>\n";
 181+ } else {
 182+ $result .= '<option value="NONE">' . wfMsg( 'smw_qui_nosort' ) . "</option>\n";
 183+ }
 184+ if ( is_array( $order_values ) and array_key_exists( $i, $order_values ) and $order_values[$i] == 'ASC' ) {
 185+ $result .= '<option selected value="ASC">' . wfMsg( 'smw_qui_ascorder' ) . "</option>\n";
 186+ } else {
 187+ $result .= '<option value="ASC">' . wfMsg( 'smw_qui_ascorder' ) . "</option>\n";
 188+ }
 189+ if ( is_array( $order_values ) and array_key_exists( $i, $order_values ) and $order_values[$i] == 'DESC' ) {
 190+ $result .= '<option selected value="DESC">' . wfMsg( 'smw_qui_descorder' ) . "</option>\n";
 191+ } else {
 192+ $result .= '<option value="DESC">' . wfMsg( 'smw_qui_descorder' ) . "</option>\n";
 193+ }
 194+ $result .= "</select> \n";
 195+ if ( is_array( $display_values ) and array_key_exists( $i, $display_values ) ) {
 196+ $result .= '<input type="checkbox" checked name="display[' . $i . ']" value="yes">' . wfMsg( 'smw_qui_shownresults' ) . "\n";
 197+ } else {
 198+ $result .= '<input type="checkbox" name="display[' . $i . ']" value="yes">' . wfMsg( 'smw_qui_shownresults' ) . "\n";
 199+ }
 200+ $result .= '[<a href="javascript:removePOInstance(\'sort_div_' . $i . '\')">' . wfMsg( 'smw_qui_delete' ) . '</a>]' . "\n";
 201+ $result .= "</div> \n";
 202+ }
 203+ // END: create form elements already submitted earlier via form
 204+
 205+ // create hidden form elements to be cloned later
 206+ $hidden = '<div id="sorting_starter" style="display: none">' . wfMsg( 'smw_qui_property' ) .
 207+ ' <input type="text" size="35" name="property_num" />';
 208+ $hidden .= ' <select name="order_num">';
 209+ $hidden .= ' <option value="NONE">' . wfMsg( 'smw_qui_nosort' ) . '</option>';
 210+ $hidden .= ' <option value="ASC">' . wfMsg( 'smw_qui_ascorder' ) . '</option>';
 211+ $hidden .= ' <option value="DESC">' . wfMsg( 'smw_qui_descorder' ) . '</option></select>';
 212+ $hidden .= '<input type="checkbox" checked name="display_num" value="yes">' . wfMsg( 'smw_qui_shownresults' );
 213+ $hidden .= '</div>';
 214+
 215+ $dialogbox = '<div id="dialog"><form>' .
 216+ '<input type="checkbox" checked id="dialog-show-results" >' . wfMsg( 'smw_qui_shownresults' ) . '<fieldset id="show-result-box">' .
 217+ '<br>Label:<input id="sort-label"><br> still under construction </fieldset>' . //TODO; remove
 218+ '<br><select id ="dialog-order">' .
 219+ '<option value="NONE">' . wfMsg( 'smw_qui_nosort' ) . '</option>' .
 220+ '<option value="ASC">' . wfMsg( 'smw_qui_ascorder' ) . '</option>' .
 221+ '<option value="DESC">' . wfMsg( 'smw_qui_descorder' ) . '</option>' .
 222+ '</select>' . '</form></div>';
 223+
 224+ $result .= '<div id="sorting_main"></div>' . "\n";
 225+ $result .= '[<a href="javascript:addPOInstance(\'sorting_starter\', \'sorting_main\')">' . wfMsg( 'smw_qui_addnprop' ) . '</a>]' . "\n";
 226+
 227+ // Javascript code for handling adding and removing the "sort" inputs
 228+ $delete_msg = wfMsg( 'smw_qui_delete' );
 229+
 230+ if ( $enableAutocomplete == SMWQueryUI::ENABLE_AUTO_SUGGEST ) {
 231+ $this->addAutocompletionJavascriptAndCSS();
 232+ }
 233+ $javascript_text = <<<EOT
 234+<script type="text/javascript">
 235+// code for handling adding and removing the "sort" inputs
 236+
 237+jQuery(function(){
 238+ jQuery('$hidden').appendTo(document.body);
 239+ jQuery('$dialogbox').appendTo(document.body);
 240+ jQuery('#dialog').dialog({
 241+ autoOpen: false,
 242+ modal: true
 243+ });
 244+});
 245+jQuery(document).ready(function(){
 246+ jQuery('#sort-more').click(function(){jQuery('#dialog').dialog("open");});
 247+ jQuery('#dialog-show-results').click(function(){
 248+ if(jQuery('#dialog-show-results')[0].checked){
 249+ //alert("hello");
 250+ jQuery('#show-result-box').show('blind');
 251+ } else {
 252+ jQuery('#show-result-box').hide('blind');
 253+ }
 254+ });
 255+});
 256+function smw_makeDialog(prop_id){
 257+ \$j('#sort-label')[0].value=\$j('#property'+prop_id)[0].value;
 258+ \$j('#dialog').dialog('open');
 259+}
 260+
 261+var num_elements = {$num_sort_values};
 262+
 263+function addPOInstance(starter_div_id, main_div_id) {
 264+ var starter_div = document.getElementById(starter_div_id);
 265+ var main_div = document.getElementById(main_div_id);
 266+
 267+ //Create the new instance
 268+ var new_div = starter_div.cloneNode(true);
 269+ var div_id = 'sort_div_' + num_elements;
 270+ new_div.className = 'multipleTemplate';
 271+ new_div.id = div_id;
 272+ new_div.style.display = 'block';
 273+
 274+ var children = new_div.getElementsByTagName('*');
 275+ var x;
 276+ for (x = 0; x < children.length; x++) {
 277+ if (children[x].name){
 278+ children[x].id = children[x].name.replace(/_num/, ''+num_elements);
 279+ children[x].name = children[x].name.replace(/_num/, '[' + num_elements + ']');
 280+ }
 281+ }
 282+
 283+ //Create 'more' link
 284+ var more_button =document.createElement('span');
 285+ more_button.innerHTML = ' <a class="smwq-more" href="javascript:smw_makeDialog(\'' + num_elements + '\')">more</a> '; //TODO: i18n
 286+ new_div.appendChild(more_button);
 287+ //Create 'delete' link
 288+ var remove_button = document.createElement('span');
 289+ remove_button.innerHTML = '[<a class="smwq-remove" href="javascript:removePOInstance(\'sort_div_' + num_elements + '\')">{$delete_msg}</a>]';
 290+ new_div.appendChild(remove_button);
 291+
 292+ //Add the new instance
 293+ main_div.appendChild(new_div);
 294+EOT;
 295+ if ( $enableAutocomplete == SMWQueryUI::ENABLE_AUTO_SUGGEST ) {
 296+ $javascript_text .= <<<EOT
 297+ //add autocomplete
 298+ jQuery('[name*="property"]').autocomplete({
 299+ minLength: 2,
 300+ source: function(request, response) {
 301+ url=wgScriptPath+'/api.php?action=opensearch&limit=10&namespace='+wgNamespaceIds['property']+'&format=jsonfm';
 302+
 303+ jQuery.getJSON(url, 'search='+request.term, function(data){
 304+ //remove the namespace prefix 'Property:' from returned data
 305+ for(i=0;i<data[1].length;i++) data[1][i]=data[1][i].substr(data[1][i].indexOf(':')+1);
 306+ response(data[1]);
 307+ });
 308+ }
 309+ });
 310+EOT;
 311+ }
 312+ $javascript_text .= <<<EOT
 313+ num_elements++;
 314+
 315+}
 316+
 317+function removePOInstance(div_id) {
 318+ var olddiv = document.getElementById(div_id);
 319+ var parent = olddiv.parentNode;
 320+ parent.removeChild(olddiv);
 321+}
 322+</script>
 323+
 324+EOT;
 325+
 326+ $wgOut->addScript( $javascript_text );
 327+ return $result;
 328+ }
 329+
 330+
 331+ /**
 332+ * Compatibility method to get the skin; MW 1.18 introduces a getSkin method
103333 * in SpecialPage.
104334 *
105335 * @since 1.6
Index: trunk/extensions/SemanticMediaWiki/libs/jquery-ui/jquery-ui.min.dialog.js
@@ -0,0 +1,41 @@
 2+/*
 3+ * jQuery UI Dialog 1.8.14
 4+ *
 5+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 6+ * Dual licensed under the MIT or GPL Version 2 licenses.
 7+ * http://jquery.org/license
 8+ *
 9+ * http://docs.jquery.com/UI/Dialog
 10+ *
 11+ * Depends:
 12+ * jquery.ui.core.js
 13+ * jquery.ui.widget.js
 14+ * jquery.ui.button.js
 15+ * jquery.ui.draggable.js
 16+ * jquery.ui.mouse.js
 17+ * jquery.ui.position.js
 18+ * jquery.ui.resizable.js
 19+ */
 20+(function(c,l){var m={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},n={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true},o=c.attrFn||{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true,click:true};c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,
 21+position:{my:"center",at:"center",collision:"fit",using:function(a){var b=c(this).css(a).offset().top;b<0&&c(this).css("top",a.top-b)}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string")this.originalTitle="";this.options.title=this.options.title||this.originalTitle;var a=this,b=a.options,d=b.title||"&#160;",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("<div></div>")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+
 22+b.dialogClass).css({zIndex:b.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(i){if(b.closeOnEscape&&i.keyCode&&i.keyCode===c.ui.keyCode.ESCAPE){a.close(i);i.preventDefault()}}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(i){a.moveToTop(false,i)});a.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g);var f=(a.uiDialogTitlebar=c("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),
 23+h=c('<a href="#"></a>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){h.addClass("ui-state-hover")},function(){h.removeClass("ui-state-hover")}).focus(function(){h.addClass("ui-state-focus")}).blur(function(){h.removeClass("ui-state-focus")}).click(function(i){a.close(i);return false}).appendTo(f);(a.uiDialogTitlebarCloseText=c("<span></span>")).addClass("ui-icon ui-icon-closethick").text(b.closeText).appendTo(h);c("<span></span>").addClass("ui-dialog-title").attr("id",
 24+e).html(d).prependTo(f);if(c.isFunction(b.beforeclose)&&!c.isFunction(b.beforeClose))b.beforeClose=b.beforeclose;f.find("*").add(f).disableSelection();b.draggable&&c.fn.draggable&&a._makeDraggable();b.resizable&&c.fn.resizable&&a._makeResizable();a._createButtons(b.buttons);a._isOpen=false;c.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy();a.uiDialog.hide();a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");
 25+a.uiDialog.remove();a.originalTitle&&a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(a){var b=this,d,e;if(false!==b._trigger("beforeClose",a)){b.overlay&&b.overlay.destroy();b.uiDialog.unbind("keypress.ui-dialog");b._isOpen=false;if(b.options.hide)b.uiDialog.hide(b.options.hide,function(){b._trigger("close",a)});else{b.uiDialog.hide();b._trigger("close",a)}c.ui.dialog.overlay.resize();if(b.options.modal){d=0;c(".ui-dialog").each(function(){if(this!==
 26+b.uiDialog[0]){e=c(this).css("z-index");isNaN(e)||(d=Math.max(d,e))}});c.ui.dialog.maxZ=d}return b}},isOpen:function(){return this._isOpen},moveToTop:function(a,b){var d=this,e=d.options;if(e.modal&&!a||!e.stack&&!e.modal)return d._trigger("focus",b);if(e.zIndex>c.ui.dialog.maxZ)c.ui.dialog.maxZ=e.zIndex;if(d.overlay){c.ui.dialog.maxZ+=1;d.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=c.ui.dialog.maxZ)}a={scrollTop:d.element.attr("scrollTop"),scrollLeft:d.element.attr("scrollLeft")};c.ui.dialog.maxZ+=
 27+1;d.uiDialog.css("z-index",c.ui.dialog.maxZ);d.element.attr(a);d._trigger("focus",b);return d},open:function(){if(!this._isOpen){var a=this,b=a.options,d=a.uiDialog;a.overlay=b.modal?new c.ui.dialog.overlay(a):null;a._size();a._position(b.position);d.show(b.show);a.moveToTop(true);b.modal&&d.bind("keypress.ui-dialog",function(e){if(e.keyCode===c.ui.keyCode.TAB){var g=c(":tabbable",this),f=g.filter(":first");g=g.filter(":last");if(e.target===g[0]&&!e.shiftKey){f.focus(1);return false}else if(e.target===
 28+f[0]&&e.shiftKey){g.focus(1);return false}}});c(a.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus();a._isOpen=true;a._trigger("open");return a}},_createButtons:function(a){var b=this,d=false,e=c("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=c("<div></div>").addClass("ui-dialog-buttonset").appendTo(e);b.uiDialog.find(".ui-dialog-buttonpane").remove();typeof a==="object"&&a!==null&&c.each(a,
 29+function(){return!(d=true)});if(d){c.each(a,function(f,h){h=c.isFunction(h)?{click:h,text:f}:h;var i=c('<button type="button"></button>').click(function(){h.click.apply(b.element[0],arguments)}).appendTo(g);c.each(h,function(j,k){if(j!=="click")j in o?i[j](k):i.attr(j,k)});c.fn.button&&i.button()});e.appendTo(b.uiDialog)}},_makeDraggable:function(){function a(f){return{position:f.position,offset:f.offset}}var b=this,d=b.options,e=c(document),g;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",
 30+handle:".ui-dialog-titlebar",containment:"document",start:function(f,h){g=d.height==="auto"?"auto":c(this).height();c(this).height(c(this).height()).addClass("ui-dialog-dragging");b._trigger("dragStart",f,a(h))},drag:function(f,h){b._trigger("drag",f,a(h))},stop:function(f,h){d.position=[h.position.left-e.scrollLeft(),h.position.top-e.scrollTop()];c(this).removeClass("ui-dialog-dragging").height(g);b._trigger("dragStop",f,a(h));c.ui.dialog.overlay.resize()}})},_makeResizable:function(a){function b(f){return{originalPosition:f.originalPosition,
 31+originalSize:f.originalSize,position:f.position,size:f.size}}a=a===l?this.options.resizable:a;var d=this,e=d.options,g=d.uiDialog.css("position");a=typeof a==="string"?a:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:a,start:function(f,h){c(this).addClass("ui-dialog-resizing");d._trigger("resizeStart",f,b(h))},resize:function(f,h){d._trigger("resize",
 32+f,b(h))},stop:function(f,h){c(this).removeClass("ui-dialog-resizing");e.height=c(this).height();e.width=c(this).width();d._trigger("resizeStop",f,b(h));c.ui.dialog.overlay.resize()}}).css("position",g).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(a){var b=[],d=[0,0],e;if(a){if(typeof a==="string"||typeof a==="object"&&"0"in a){b=a.split?a.split(" "):
 33+[a[0],a[1]];if(b.length===1)b[1]=b[0];c.each(["left","top"],function(g,f){if(+b[g]===b[g]){d[g]=b[g];b[g]=f}});a={my:b.join(" "),at:b.join(" "),offset:d.join(" ")}}a=c.extend({},c.ui.dialog.prototype.options.position,a)}else a=c.ui.dialog.prototype.options.position;(e=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.css({top:0,left:0}).position(c.extend({of:window},a));e||this.uiDialog.hide()},_setOptions:function(a){var b=this,d={},e=false;c.each(a,function(g,f){b._setOption(g,f);
 34+if(g in m)e=true;if(g in n)d[g]=f});e&&this._size();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",d)},_setOption:function(a,b){var d=this,e=d.uiDialog;switch(a){case "beforeclose":a="beforeClose";break;case "buttons":d._createButtons(b);break;case "closeText":d.uiDialogTitlebarCloseText.text(""+b);break;case "dialogClass":e.removeClass(d.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b);break;case "disabled":b?e.addClass("ui-dialog-disabled"):
 35+e.removeClass("ui-dialog-disabled");break;case "draggable":var g=e.is(":data(draggable)");g&&!b&&e.draggable("destroy");!g&&b&&d._makeDraggable();break;case "position":d._position(b);break;case "resizable":(g=e.is(":data(resizable)"))&&!b&&e.resizable("destroy");g&&typeof b==="string"&&e.resizable("option","handles",b);!g&&b!==false&&d._makeResizable(b);break;case "title":c(".ui-dialog-title",d.uiDialogTitlebar).html(""+(b||"&#160;"));break}c.Widget.prototype._setOption.apply(d,arguments)},_size:function(){var a=
 36+this.options,b,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});if(a.minWidth>a.width)a.width=a.minWidth;b=this.uiDialog.css({height:"auto",width:a.width}).height();d=Math.max(0,a.minHeight-b);if(a.height==="auto")if(c.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();a=this.element.css("height","auto").height();e||this.uiDialog.hide();this.element.height(Math.max(a,d))}else this.element.height(Math.max(a.height-
 37+b,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}});c.extend(c.ui.dialog,{version:"1.8.14",uuid:0,maxZ:0,getTitleId:function(a){a=a.attr("id");if(!a){this.uuid+=1;a=this.uuid}return"ui-dialog-title-"+a},overlay:function(a){this.$el=c.ui.dialog.overlay.create(a)}});c.extend(c.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),
 38+create:function(a){if(this.instances.length===0){setTimeout(function(){c.ui.dialog.overlay.instances.length&&c(document).bind(c.ui.dialog.overlay.events,function(d){if(c(d.target).zIndex()<c.ui.dialog.overlay.maxZ)return false})},1);c(document).bind("keydown.dialog-overlay",function(d){if(a.options.closeOnEscape&&d.keyCode&&d.keyCode===c.ui.keyCode.ESCAPE){a.close(d);d.preventDefault()}});c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)}var b=(this.oldInstances.pop()||c("<div></div>").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),
 39+height:this.height()});c.fn.bgiframe&&b.bgiframe();this.instances.push(b);return b},destroy:function(a){var b=c.inArray(a,this.instances);b!=-1&&this.oldInstances.push(this.instances.splice(b,1)[0]);this.instances.length===0&&c([document,window]).unbind(".dialog-overlay");a.remove();var d=0;c.each(this.instances,function(){d=Math.max(d,this.css("z-index"))});this.maxZ=d},height:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);
 40+b=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return a<b?c(window).height()+"px":a+"px"}else return c(document).height()+"px"},width:function(){var a,b;if(c.browser.msie){a=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);b=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);return a<b?c(window).width()+"px":a+"px"}else return c(document).width()+"px"},resize:function(){var a=c([]);c.each(c.ui.dialog.overlay.instances,function(){a=
 41+a.add(this)});a.css({width:0,height:0}).css({width:c.ui.dialog.overlay.width(),height:c.ui.dialog.overlay.height()})}});c.extend(c.ui.dialog.overlay.prototype,{destroy:function(){c.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);
 42+;
Property changes on: trunk/extensions/SemanticMediaWiki/libs/jquery-ui/jquery-ui.min.dialog.js
___________________________________________________________________
Added: svn:eol-style
143 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r93962follow-up r93878 (also renamed a JS file added in r93878)devayon12:15, 5 August 2011
r93967Follow-up: r93878devayon13:27, 5 August 2011
r93969Follow-up: r93878devayon13:57, 5 August 2011
r94055follow-up:r93878 (stable)devayon11:26, 8 August 2011