Index: branches/js2-work/phase3/js/mwEmbed/modules/TimedText/mw.TimedText.js |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | * timed text search & seek interface ( version 2 ) |
10 | 10 | * |
11 | 11 | * @author: Michael Dale |
12 | | - * |
| 12 | + * |
13 | 13 | * Some code borrowed from: http://www.annodex.net/~silvia/itext/elephant_no_skin_v2.html |
14 | 14 | * ( Licensed under: MPL 1.1/GPL 2.0/LGPL 2.1 ) |
15 | 15 | * Contributor(s): |
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.RemoteSearchDriver.js |
— | — | @@ -1971,88 +1971,18 @@ |
1972 | 1972 | var _this = this; |
1973 | 1973 | mw.log( "showImportUI:: update:" + _this.canonicalFileNS + ':' + |
1974 | 1974 | resource.target_resource_title ); |
1975 | | - |
1976 | | - // setup the resource description from resource description: |
1977 | | - // FIXME: i18n, namespace |
1978 | | - var desc = '{{Information ' + "\n"; |
1979 | | - |
1980 | | - if ( resource.desc ) { |
1981 | | - desc += '|Description= ' + resource.desc + "\n"; |
1982 | | - } else { |
1983 | | - desc += '|Description= ' + gM( 'mwe-missing_desc_see_source', resource.link ) + "\n"; |
1984 | | - } |
1985 | | - |
1986 | | - // Output search specific info |
1987 | | - desc += '|Source=' + resource.pSobj.getImportResourceDescWiki( resource ) + "\n"; |
1988 | | - |
1989 | | - if ( resource.author ) |
1990 | | - desc += '|Author=' + resource.author + "\n"; |
1991 | | - |
1992 | | - if ( resource.date ) |
1993 | | - desc += '|Date=' + resource.date + "\n"; |
1994 | | - |
1995 | | - // Add the Permission info: |
1996 | | - desc += '|Permission=' + resource.pSobj.getPermissionWikiTag( resource ) + "\n"; |
1997 | | - |
1998 | | - if ( resource.other_versions ) |
1999 | | - desc += '|other_versions=' + resource.other_versions + "\n"; |
2000 | | - |
2001 | | - desc += '}}'; |
2002 | | - |
2003 | | - // Get any extra categories or helpful links |
2004 | | - desc += resource.pSobj.getExtraResourceDescWiki( resource ); |
2005 | | - |
2006 | | - |
2007 | | - $j( '#rsd_resource_import' ).remove();// remove any old resource imports |
2008 | | - |
2009 | | - // Show user dialog to import the resource |
| 1975 | + |
| 1976 | + var description = _this.getTemplateDescription( resource ); |
| 1977 | + |
| 1978 | + |
| 1979 | + // Remove any old resource imports |
| 1980 | + $j( '#rsd_resource_import' ).remove(); |
| 1981 | + |
| 1982 | + // Update the interface |
2010 | 1983 | $j( _this.target_container ).append( |
2011 | | - '<div id="rsd_resource_import" ' + |
2012 | | - 'class="ui-widget-content" ' + |
2013 | | - 'style="position:absolute;top:0px;left:0px;right:0px;bottom:0px;z-index:5">' + |
2014 | | - '<h3 style="color:red;padding:5px;">' + |
2015 | | - gM( 'mwe-resource-needs-import', [resource.title, _this.upload_api_name] ) + |
2016 | | - '</h3>' + |
2017 | | - '<div id="rsd_preview_import_container" ' + |
2018 | | - 'style="position:absolute;width:49%;bottom:0px;left:5px;' + |
2019 | | - 'overflow:auto;top:30px;">' + |
| 1984 | + _this.getResourceImportInterface( resource , description ) |
| 1985 | + ); |
2020 | 1986 | |
2021 | | - // Get embedHTML with small thumb: |
2022 | | - resource.pSobj.getEmbedHTML( resource, { |
2023 | | - 'id': _this.target_container + '_rsd_pv_vid', |
2024 | | - 'max_height': '220', |
2025 | | - 'only_poster': true |
2026 | | - } ) + |
2027 | | - |
2028 | | - '<br style="clear both"/>' + |
2029 | | - '<strong>' + gM( 'mwe-resource_page_desc' ) + '</strong>' + |
2030 | | - '<div id="rsd_import_desc" style="display:inline;">' + |
2031 | | - mw.loading_spinner( 'position:absolute;top:5px;left:5px' ) + |
2032 | | - '</div>' + |
2033 | | - '</div>' + |
2034 | | - '<div id="rds_edit_import_container" ' + |
2035 | | - 'style="position:absolute; ' + |
2036 | | - 'left:50%;bottom:0px;top:30px;right:0px;overflow:auto;">' + |
2037 | | - '<strong>' + gM( 'mwe-local_resource_title' ) + '</strong>' + |
2038 | | - '<br/>' + |
2039 | | - '<input id="rsd_filename" type="text" size="30" value="' + resource.target_resource_title + '" />' + |
2040 | | - '<br/>' + |
2041 | | - '<strong>' + gM( 'mwe-edit_resource_desc' ) + '</strong>' + |
2042 | | - '<textarea id="rsd_import_text" ' + |
2043 | | - 'style="width:90%;" rows="8" cols="50">' + |
2044 | | - desc + |
2045 | | - '</textarea>' + |
2046 | | - '<br/>' + |
2047 | | - '<input type="checkbox" value="true" id="wpWatchthis" ' + |
2048 | | - 'name="wpWatchthis" tabindex="7" />' + |
2049 | | - '<label for="wpWatchthis">' + gM( 'mwe-watch_this_page' ) + '</label> ' + |
2050 | | - '<br/><br/><br/>' + |
2051 | | - $j.btnHtml( gM( 'mwe-update_preview' ), 'rsd_import_apreview', 'refresh' ) + |
2052 | | - ' ' + |
2053 | | - '</div>' + |
2054 | | - // Output the rendered and non-rendered version of description for easy switching: |
2055 | | - '</div>' ); |
2056 | | - |
2057 | 1987 | var buttonPaneSelector = _this.target_container + '~ .ui-dialog-buttonpane'; |
2058 | 1988 | $j( buttonPaneSelector ).html ( |
2059 | 1989 | // Add the buttons to the bottom: |
— | — | @@ -2069,7 +1999,7 @@ |
2070 | 2000 | |
2071 | 2001 | // Load the preview text: |
2072 | 2002 | _this.parse( |
2073 | | - desc, _this.canonicalFileNS + ':' + resource.target_resource_title, |
| 2003 | + description, _this.canonicalFileNS + ':' + resource.target_resource_title, |
2074 | 2004 | function( descHtml ) { |
2075 | 2005 | $j( '#rsd_import_desc' ).html( descHtml ); |
2076 | 2006 | } |
— | — | @@ -2083,7 +2013,7 @@ |
2084 | 2014 | $j( '#rsd_import_desc' ).html( mw.loading_spinner() ); |
2085 | 2015 | // load the preview text: |
2086 | 2016 | _this.parse( |
2087 | | - $j( '#rsd_import_text' ).val(), |
| 2017 | + $j( '#wpUploadDescription' ).val(), |
2088 | 2018 | _this.canonicalFileNS + ':' + resource.target_resource_title, |
2089 | 2019 | function( o ) { |
2090 | 2020 | mw.log( 'got updated preview: ' ); |
— | — | @@ -2114,7 +2044,180 @@ |
2115 | 2045 | } ); |
2116 | 2046 | } ); |
2117 | 2047 | }, |
| 2048 | + |
| 2049 | + /** |
| 2050 | + * Get the resource Import interface |
| 2051 | + */ |
| 2052 | + getResourceImportInterface: function( resource, description ){ |
| 2053 | + var _this = this; |
| 2054 | + var $rsdResourceImport = $j('<div />') |
| 2055 | + .attr( 'id', 'rsd_resource_import' ) |
| 2056 | + .addClass( 'ui-widget-content' ) |
| 2057 | + .css( { |
| 2058 | + 'position' : 'absolute', |
| 2059 | + 'top' : '0px', |
| 2060 | + 'left' : '0px', |
| 2061 | + 'right' : '0px', |
| 2062 | + 'bottom' : '0px', |
| 2063 | + 'z-index' : '5' |
| 2064 | + } ); |
| 2065 | + |
| 2066 | + var $rsdPreviewContainer = $j( '<div />') |
| 2067 | + .attr( 'id', 'rsd_preview_import_container' ) |
| 2068 | + .css( { |
| 2069 | + 'position' : 'absolute', |
| 2070 | + 'width' : '49%', |
| 2071 | + 'bottom' : '0px', |
| 2072 | + 'left' : '5px', |
| 2073 | + 'overflow' : 'auto', |
| 2074 | + 'top' : '30px' |
| 2075 | + } ) |
| 2076 | + .append( |
| 2077 | + // Get embedHTML with small thumb: |
| 2078 | + resource.pSobj.getEmbedHTML( resource, { |
| 2079 | + 'id': _this.target_container + '_rsd_pv_vid', |
| 2080 | + 'max_height': '220', |
| 2081 | + 'only_poster': true |
| 2082 | + } ) |
| 2083 | + ) |
| 2084 | + .append( |
| 2085 | + $j('<br />') |
| 2086 | + .css( 'clear', 'both' ), |
| 2087 | + $j( '<span />' ) |
| 2088 | + .css( { 'font-weight' : 'bold' } ) |
| 2089 | + .text( gM( 'mwe-resource_page_desc' ) ), |
| 2090 | + $j( '<div />' ) |
| 2091 | + .attr( 'id', 'rsd_import_desc' ) |
| 2092 | + .css( 'display', 'inline' ) |
| 2093 | + .loadingSpinner() |
| 2094 | + ) |
| 2095 | + |
| 2096 | + var $importResourceTitle = $j( '<h3 />' ) |
| 2097 | + .css( { |
| 2098 | + 'color' : 'red', |
| 2099 | + 'padding' : '5px' |
| 2100 | + } ) |
| 2101 | + .text( |
| 2102 | + gM( 'mwe-resource-needs-import', [resource.title, _this.upload_api_name] ) |
| 2103 | + ); |
| 2104 | + |
| 2105 | + var $importTitle = $j( '<span />' ) |
| 2106 | + .css( { 'font-weight' : 'bold' } ) |
| 2107 | + .text( gM( 'mwe-local_resource_title' ) ); |
| 2108 | + |
| 2109 | + var $importDestFile = $j( '<input />' ) |
| 2110 | + .attr( { |
| 2111 | + 'id' : 'wpDestFile', |
| 2112 | + 'type' : 'text', |
| 2113 | + 'size' : '30', |
| 2114 | + } ) |
| 2115 | + .val ( resource.target_resource_title ); |
| 2116 | + |
| 2117 | + var $importUploadDescription = $j('<div />') |
| 2118 | + .append( |
| 2119 | + $j( '<span />' ) |
| 2120 | + .css( { 'font-weight' : 'bold' } ) |
| 2121 | + .text( gM( 'mwe-edit_resource_desc' ) ), |
| 2122 | + $j( '<textarea />' ) |
| 2123 | + .attr( { |
| 2124 | + 'id' : 'wpUploadDescription', |
| 2125 | + 'rows' : 8, |
| 2126 | + 'cols' : 50 |
| 2127 | + }) |
| 2128 | + .css( { |
| 2129 | + 'width': '90%', |
| 2130 | + } ) |
| 2131 | + .text( description ), |
| 2132 | + $j( '<input />' ) |
| 2133 | + .attr( { |
| 2134 | + 'type' : 'checkbox', |
| 2135 | + 'id' : 'wpWatchthis', |
| 2136 | + 'name' : 'wpWatchthis', |
| 2137 | + 'tabindex' : '7' |
| 2138 | + } ) |
| 2139 | + ); |
| 2140 | + |
| 2141 | + var $editImportContainer = $j( '<div />' ) |
| 2142 | + .css( { |
| 2143 | + 'position' : 'absolute', |
| 2144 | + 'left' : '50%', |
| 2145 | + 'bottom' : '0px', |
| 2146 | + 'top' : '30px', |
| 2147 | + 'right' : '0px', |
| 2148 | + 'overflow' : 'auto' |
| 2149 | + }) |
| 2150 | + .append( |
| 2151 | + $importTitle, |
| 2152 | + $j( '<br />' ), |
| 2153 | + |
| 2154 | + $importDestFile, |
| 2155 | + $j( '<br />' ), |
| 2156 | + |
| 2157 | + $importUploadDescription, |
| 2158 | + $j( '<br />' ), |
| 2159 | + |
| 2160 | + // Add the watchlist button |
| 2161 | + $j( '<label />' ) |
| 2162 | + .attr( { |
| 2163 | + 'for' : 'wpWatchthis' |
| 2164 | + } ) |
| 2165 | + .text( |
| 2166 | + gM( 'mwe-watch_this_page' ) |
| 2167 | + ), |
| 2168 | + $j( '<br />' ), |
| 2169 | + |
| 2170 | + // Add the update preview button: |
| 2171 | + $j( '<br />' ), |
| 2172 | + $j('<span />').append( |
| 2173 | + $j.btnHtml( gM( 'mwe-update_preview' ), 'rsd_import_apreview', 'refresh' ) |
| 2174 | + ) |
| 2175 | + ); |
| 2176 | + |
| 2177 | + $rsdResourceImport.append( |
| 2178 | + $importResourceTitle, |
| 2179 | + $rsdPreviewContainer, |
| 2180 | + $editImportContainer |
| 2181 | + ) |
| 2182 | + return $rsdResourceImport; |
| 2183 | + }, |
| 2184 | + |
| 2185 | + /** |
| 2186 | + * Get Template Description wikitext |
| 2187 | + * @pram {Object} resource Resource source for description |
| 2188 | + */ |
| 2189 | + getTemplateDescription: function( resource ){ |
| 2190 | + // setup the resource description from resource description: |
| 2191 | + // FIXME: i18n, namespace |
| 2192 | + var description = '{{Information ' + "\n"; |
2118 | 2193 | |
| 2194 | + if ( resource.desc ) { |
| 2195 | + description += '|Description= ' + resource.desc + "\n"; |
| 2196 | + } else { |
| 2197 | + description += '|Description= ' + gM( 'mwe-missing_desc_see_source', resource.link ) + "\n"; |
| 2198 | + } |
| 2199 | + |
| 2200 | + // Output search specific info |
| 2201 | + description += '|Source=' + resource.pSobj.getImportResourceDescWiki( resource ) + "\n"; |
| 2202 | + |
| 2203 | + if ( resource.author ) |
| 2204 | + description += '|Author=' + resource.author + "\n"; |
| 2205 | + |
| 2206 | + if ( resource.date ) |
| 2207 | + description += '|Date=' + resource.date + "\n"; |
| 2208 | + |
| 2209 | + // Add the Permission info: |
| 2210 | + description += '|Permission=' + resource.pSobj.getPermissionWikiTag( resource ) + "\n"; |
| 2211 | + |
| 2212 | + if ( resource.other_versions ) |
| 2213 | + description += '|other_versions=' + resource.other_versions + "\n"; |
| 2214 | + |
| 2215 | + description += '}}'; |
| 2216 | + |
| 2217 | + // Get any extra categories or helpful links |
| 2218 | + description += resource.pSobj.getExtraResourceDescWiki( resource ); |
| 2219 | + return description; |
| 2220 | + }, |
| 2221 | + |
2119 | 2222 | /** |
2120 | 2223 | * Sets up the proxy for the remote inserts |
2121 | 2224 | * |
— | — | @@ -2226,8 +2329,8 @@ |
2227 | 2330 | mw.closeLoaderDialog(); |
2228 | 2331 | uploader.doHttpUpload( { |
2229 | 2332 | 'url' : resource.src, |
2230 | | - 'filename' : $j( '#rsd_filename' ).val(), |
2231 | | - 'comment' : $j( '#rsd_import_text' ).val() |
| 2333 | + 'filename' : $j( '#wpDestFile' ).val(), |
| 2334 | + 'comment' : $j( '#wpUploadDescription' ).val() |
2232 | 2335 | } ); |
2233 | 2336 | } ); |
2234 | 2337 | } |
— | — | @@ -2312,16 +2415,15 @@ |
2313 | 2416 | .children( '.preview_close' ) |
2314 | 2417 | .click( function() { |
2315 | 2418 | $j( '#rsd_preview_display' ).remove(); |
2316 | | - // restore title: |
| 2419 | + // Restore title: |
2317 | 2420 | $j( _this.target_container ).dialog( 'option', 'title', origTitle ); |
2318 | | - // restore buttons (from the clipEdit object::) |
| 2421 | + // Restore buttons (from the clipEdit object::) |
2319 | 2422 | _this.clipEdit.updateInsertControlActions(); |
2320 | 2423 | } ); |
2321 | 2424 | |
2322 | 2425 | // Get the preview wikitext |
2323 | 2426 | var embed_code = _this.getEmbedCode( resource ); |
2324 | | - //var pos = $j( _this.target_textbox ).getCaretPosition(); |
2325 | | - var pos = 0; |
| 2427 | + var pos = $j( _this.target_textbox ).textSelection( 'getCaretPosition' ); |
2326 | 2428 | var editWikiText = $j( _this.target_textbox ).val(); |
2327 | 2429 | var parseText = editWikiText.substr(0, pos) + embed_code + editWikiText.substr( pos ); |
2328 | 2430 | _this.parse( |
— | — | @@ -2350,7 +2452,7 @@ |
2351 | 2453 | */ |
2352 | 2454 | getEmbedCode: function( resource ) { |
2353 | 2455 | if ( this.import_url_mode == 'remote_link' ) { |
2354 | | - return resource.pSobj.getEmbedHTML( resource, {'insert_description': true } ); |
| 2456 | + return resource.pSobj.getEmbedHTML( resource, { 'insert_description': true } ); |
2355 | 2457 | } else { |
2356 | 2458 | return resource.pSobj.getEmbedWikiCode( resource ); |
2357 | 2459 | } |
Index: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | 'skinName' : 'mvpcf', |
42 | 42 | |
43 | 43 | // Default jquery ui skin name |
44 | | - 'jui_skin' : 'redmond', |
| 44 | + 'jQueryUISkin' : 'redmond', |
45 | 45 | |
46 | 46 | /** |
47 | 47 | * If jQuery / mwEmbed should be loaded. |
— | — | @@ -2233,7 +2233,7 @@ |
2234 | 2234 | if ( !window['$j'] ) { |
2235 | 2235 | window['$j'] = jQuery.noConflict(); |
2236 | 2236 | } |
2237 | | - mw.setConfig( 'jquery_skin_path', mw.getMwEmbedPath() + 'jquery/jquery.ui/themes/' + mw.getConfig( 'jui_skin' ) + '/' ); |
| 2237 | + mw.setConfig( 'jquery_skin_path', mw.getMwEmbedPath() + 'jquery/jquery.ui/themes/' + mw.getConfig( 'jQueryUISkin' ) + '/' ); |
2238 | 2238 | |
2239 | 2239 | // Only load jquery ui theme sheet if ui-widget does not exist. |
2240 | 2240 | if( ! mw.styleRuleExists( 'ui-widget' ) ){ |