r53731 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53730‎ | r53731 | r53732 >
Date:22:50, 24 July 2009
Author:dale
Status:deferred
Tags:
Comment:
depreciated mwAddOnloadHook in favor of js2AddOnloadHook naming
minor add Media Wizard updates (bug 19863)
Modified paths:
  • /trunk/phase3/js2/editPage.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/example_usage/Firefogg_ReWriteForm.php (deleted) (history)
  • /trunk/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/baseRemoteSearch.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/metavidSearch.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/mv_embed.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/php/languages/mwEmbed.i18n.php (modified) (history)
  • /trunk/phase3/js2/uploadPage.js (modified) (history)

Diff [purge]

Index: trunk/phase3/js2/mwEmbed/example_usage/Firefogg_ReWriteForm.php
@@ -1,54 +0,0 @@
2 -<?php
3 -if($_FILES){
4 - print "file uploaded oky:<pre>";
5 - print_r($_FILES);
6 - print "</pre>";
7 - die();
8 -}
9 -?>
10 -
11 -<!DOCTYPE HTML>
12 -<html><head>
13 -<meta http-equiv="content-type" content="text/html; charset=UTF-8">
14 - <title>Firefogg - Make Ogg Video in your Browser</title>
15 - <script type="text/javascript" src="../mv_embed.js?debug=true"></script>
16 -<style type="text/css" media="all">@import "http://www.firefogg.org/css/style.css";</style>
17 -<style type="text/css" media="all">
18 -.install{
19 -display:none;
20 -}
21 -input{
22 -font-size:110%;
23 -}
24 -</style>
25 -<script type="text/javascript">
26 -mwAddOnloadHook(function(){
27 - $j('#fogg-file').firefogg();
28 -});
29 -</script>
30 -</head><body>
31 -<div id="main">
32 - <h1>Rewrite Form example</h1>
33 -<br><br><br>
34 -<center>
35 - <div style="width:500px">
36 - <!-- we submit it to ourselves (ie do nothing) -->
37 - <form action="Firefogg_ReWriteForm.php" method="POST" enctype='multipart/form-data'>
38 - <table>
39 - <tr><td>
40 - Video Name:</td><td> <input type="text" name="fname" /></td>
41 - </tr>
42 - <tr>
43 - <td>Video File :</td><td> <input type="file" name="fogg-file" id="fogg-file"/></td>
44 - </tr>
45 - <tr>
46 - <td>
47 - <input type="submit" value="Submit" />
48 - </td>
49 - </tr>
50 - </table>
51 - </form>
52 - <br><br>
53 - </div>
54 -</center>
55 -</body></html>
Index: trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js
@@ -101,7 +101,14 @@
102102 'categories':page.categories
103103 }
104104 }
 105+ //attempt to parse out some stuff from the teplate:
 106+ var desc = this.resultsObj[page_id].desc.match(/\|Description=(([^\n]*\n)*)\|Source=/)
 107+ if( desc && desc[1] ){
 108+ this.resultsObj[page_id].desc = $j.trim( desc[1] );
 109+ }
105110
 111+
 112+
106113 //likely a audio clip if no poster and type application/ogg
107114 //@@todo we should return audio/ogg for the mime type or some other way to specify its "audio"
108115 if( ! this.resultsObj[page_id].poster && this.resultsObj[page_id].mime == 'application/ogg' ){
Index: trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/baseRemoteSearch.js
@@ -1,5 +1,8 @@
22 //base remote search obj
33
 4+loadGM({
 5+ "imported_from" : "$1 imported from [$2 $3]. See the original [$4 resource page] for more info"
 6+})
47 // @key is name of rObj variable
58 // @value is where to find the value in the item xml
69 //
@@ -99,11 +102,11 @@
100103 }
101104 if( node!=null && attr_name != null){
102105 if(typeof attr_name == 'string'){
103 - tag_val = $j.trim( $j(node).attr( attr_name ) );
 106+ tag_val = $j.trim( $j( node ).attr( attr_name ) );
104107 }else{
105108 var attr_vals = {};
106109 for(var j in attr_name){
107 - if( $j(node).attr( attr_name[j]).length != 0)
 110+ if( $j(node).attr( attr_name[j] ).length != 0)
108111 attr_vals[ attr_name[j] ] = $j.trim( $j(node).attr( attr_name[j]) ).replace(/(<([^>]+)>)/ig,"");
109112 }
110113 tag_val = attr_vals ;
@@ -168,8 +171,7 @@
169172
170173 },
171174 getImportResourceDescWiki:function(rObj){
172 - return rObj.title + ' imported from ' + '[' + this.cp.homepage +
173 - ' ' + this.cp.title+']';
 175+ return gM('imported_from', [rObj.title, this.cp.homepage, this.cp.title, rObj.link]);
174176 },
175177 //for thigns like categories and the like
176178 getExtraResourceDescWiki:function( rObj ){
Index: trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/metavidSearch.js
@@ -83,7 +83,7 @@
8484 return '{{PD-USGov}}';
8585 },
8686 getExtraResourceDescWiki:function( rObj ){
87 - var o = '';
 87+ var o = "\n";
8888 //check for person
8989 if( rObj.person && rObj.person['label'])
9090 o += '* featuring [[' + rObj.person['label'] + ']]' + "\n";
Index: trunk/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js
@@ -32,7 +32,9 @@
3333 "cc_pd_title": "Public Domain",
3434 "unknown_license": "Unknown License",
3535 "no_import_by_url": "This User or Wiki <b>can not</b> import assets from remote URLs. </p><p> Do you need to Login? </p><p> If permissions are set you may have to enable $wgAllowCopyUploads, <a href=\"http://www.mediawiki.org/wiki/Manual:$wgAllowCopyUploads\">more info</a></p>",
36 - "results_from": "Results from <a href=\"$1\" target=\"_new\" >$2</a>"
 36+ "results_from": "Results from <a href=\"$1\" target=\"_new\" >$2</a>",
 37+
 38+ "missing_desc_see_soruce": "This Asset is missing a description. Please see the [$1 orginal source] and help describe it"
3739 });
3840 var default_remote_search_options = {
3941 'profile':'mediawiki_edit',
@@ -123,8 +125,8 @@
124126 //@@todo should query wgForeignFileRepos setting maybe interwikimap from the api
125127 */
126128 'this_wiki':{
127 - 'enabled': 0,
128 - 'checked': 0,
 129+ 'enabled': 1,
 130+ 'checked': 1,
129131 'title' : 'This Wiki',
130132 'desc' : '(should be updated with the proper text) maybe import from some config value',
131133 'api_url': wgServer + wgScriptPath + '/api.php',
@@ -958,7 +960,7 @@
959961 var overflow_style = ( mediaType =='video' )?'':'overflow:auto;';
960962 //append to the top level of model window:
961963 $j( _this.target_container ).append('<div id="rsd_resource_edit" '+
962 - 'style="position:absolute;top:0px;left:0px;bottom:85px;right:4px;background-color:#FFF;">' +
 964+ 'style="position:absolute;top:0px;left:0px;bottom:75px;right:4px;background-color:#FFF;">' +
963965 '<div id="clip_edit_disp" style="position:absolute;' + overflow_style + 'width:100%;height:100%;padding:5px;'+
964966 'width:' + (maxWidth) + 'px;" >' +
965967 mv_get_loading_img('position:absolute;top:30px;left:30px') +
@@ -1200,10 +1202,16 @@
12011203 rObj.pSobj.updateDataForImport( rObj );
12021204
12031205 //setup the resource description from resource description:
1204 - var wt = '{{Information '+"\n"+
1205 - '|Description= ' + rObj.pSobj.getImportResourceDescWiki( rObj );
 1206+ var wt = '{{Information '+"\n";
 1207+
 1208+ if( rObj.desc ){
 1209+ wt += '|Description= ' + rObj.desc + "\n";
 1210+ }else{
 1211+ wt += '|Description= ' + gM('missing_desc_see_soruce', rObj.link ) + "\n";
 1212+ }
 1213+
12061214 //output person and bill info if
1207 - wt+='|Source=' + '[' + $j.trim( rObj.link ) + ' Original Source]'+ "\n";
 1215+ wt+='|Source=' + rObj.pSobj.getImportResourceDescWiki( rObj ) + "\n";
12081216
12091217 if( rObj.author )
12101218 wt+='|Author=' + rObj.author +"\n";
Index: trunk/phase3/js2/mwEmbed/php/languages/mwEmbed.i18n.php
@@ -57,36 +57,14 @@
5858 'fogg-preset-custom' => 'Custom Settings',
5959
6060 /*
61 - * js file: /libAddMedia/mediaWikiUploadHelper.OFF.js
 61+ * js file: /libAddMedia/searchLibs/metavidSearch.js
6262 */
63 - 'upload-enable-converter' => 'Enable video converter (to upload source video not yet converted to theora format) <a href="http://commons.wikimedia.org/wiki/Commons:Firefogg">more info</a>',
64 - 'upload-fogg_not_installed' => 'If you want to upload video consider installing <a href="http://firefogg.org">firefogg.org</a>, <a href="http://commons.wikimedia.org/wiki/Commons:Firefogg">more info</a>',
65 - 'upload-transcode-in-progress' => 'Doing Transcode & Upload (do not close this window)',
66 - 'upload-in-progress' => 'Upload in Progress (do not close this window)',
67 - 'upload-transcoded-status' => 'Transcoded',
68 - 'uploaded-status' => 'Uploaded',
69 - 'upload-select-file' => 'Select File...',
70 - 'wgfogg_wrong_version' => 'You have firefogg installed but its outdated, <a href="http://firefogg.org">please upgrade</a> ',
71 - 'wgfogg_waring_ogg_upload' => 'You have selected an ogg file for conversion to ogg (this is probably unnessesary). Maybe disable the video converter?',
72 - 'wgfogg_waring_bad_extension' => 'You have selected a file with an unsuported extension. <a href="http://commons.wikimedia.org/wiki/Commons:Firefogg#Supported_File_Types">More help</a>',
73 - 'upload-stats-fileprogres' => '$1 of $2',
74 - 'mv_upload_done' => 'Your upload <i>should be</i> accessible <a href="$1">here</a>',
75 - 'upload-unknown-size' => 'Unknown size',
76 - 'successfulupload' => 'Successful upload',
77 - 'uploaderror' => 'Upload error',
78 - 'uploadwarning' => 'Upload warning',
79 - 'unknown-error' => 'Unknown Error',
80 - 'return-to-form' => 'Return to form',
81 - 'file-exists-duplicate' => 'This file is a duplicate of the following file',
82 - 'fileexists' => 'A file with this name exists already, please check <b><tt>$1</tt></b> if you are not sure if you want to change it.',
83 - 'fileexists-thumb' => '<center><b>Existing file</b></center>',
84 - 'ignorewarning' => 'Ignore warning and save file anyway',
85 - 'file-thumbnail-no' => 'The filename begins with <b><tt>$1</tt></b>',
 63+ 'mv_stream_title' => '$1 $2 to $3',
8664
8765 /*
88 - * js file: /libAddMedia/searchLibs/metavidSearch.js
 66+ * js file: /libAddMedia/searchLibs/baseRemoteSearch.js
8967 */
90 - 'mv_stream_title' => '$1 $2 to $3',
 68+ 'imported_from' => '$1 imported from [$2 $3]. See the original [$4 resource page] for more info',
9169
9270 /*
9371 * js file: /libAddMedia/mvFirefogg.js
@@ -129,6 +107,7 @@
130108 'unknown_license' => 'Unknown License',
131109 'no_import_by_url' => 'This User or Wiki <b>can not</b> import assets from remote URLs. </p><p> Do you need to Login? </p><p> If permissions are set you may have to enable $wgAllowCopyUploads, <a href="http://www.mediawiki.org/wiki/Manual:$wgAllowCopyUploads">more info</a></p>',
132110 'results_from' => 'Results from <a href="$1" target="_new" >$2</a>',
 111+ 'missing_desc_see_soruce' => 'This Asset is missing a description. Please see the [$1 orginal source] and help describe it',
133112
134113 /*
135114 * js file: /libSequencer/mvSequencer.js
Index: trunk/phase3/js2/mwEmbed/mv_embed.js
@@ -577,7 +577,7 @@
578578 this.onReadyEvents.push(fn);
579579 },
580580 //checks the jQuery flag (this way when remote embeding we don't load jQuery
581 - // unless mwAddOnloadHook was used or there is video on the page
 581+ // unless js2AddOnloadHook was used or there is video on the page
582582 runQuededFunctions:function(){
583583 var _this = this;
584584 this.doneReadyEvents=true;
@@ -634,8 +634,8 @@
635635 mvJsLoader.runQuededFunctions();
636636 }
637637 }
638 -//mwAddOnloadHook: ensure jQuery and the DOM are ready:
639 -function mwAddOnloadHook( func ) {
 638+//js2AddOnloadHook: ensure jQuery and the DOM are ready:
 639+function js2AddOnloadHook( func ) {
640640 //make sure the skin/style sheets are avaliable always:
641641 loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' );
642642 loadExternalCss( mv_embed_path + 'skins/'+mv_skin_name+'/styles.css');
@@ -647,11 +647,13 @@
648648 func();
649649 });
650650 }else{
651 - //if using mwAddOnloadHook we need to get jQuery into place (if its not already included)
 651+ //if using js2AddOnloadHook we need to get jQuery into place (if its not already included)
652652 mvJsLoader.jQueryCheckFlag = true;
653653 mvJsLoader.addLoadEvent( func );
654654 };
655655 }
 656+//depreciated mwAddOnloadHook in favor of js2 naming (for clear seperation of js2 code from old mw code
 657+var mwAddOnloadHook = js2AddOnloadHook;
656658 /*
657659 * this function allows for targeted rewriting
658660 */
Index: trunk/phase3/js2/uploadPage.js
@@ -2,7 +2,7 @@
33 * uploadPage.js to be run on specialUpload page.
44 * controls the invocation of the mvUploader class based on local config.
55 */
6 -mwAddOnloadHook( function(){
 6+js2AddOnloadHook( function(){
77 mwUploadHelper.init();
88 });
99 //set up the upoload form bindings once all dom manipluation is done
Index: trunk/phase3/js2/editPage.js
@@ -17,7 +17,7 @@
1818 };
1919
2020
21 -mwAddOnloadHook( function(){
 21+js2AddOnloadHook( function(){
2222 mwEditPageHelper.init();
2323 });
2424 var mwEditPageHelper = {

Status & tagging log