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 @@ |
102 | 102 | 'categories':page.categories |
103 | 103 | } |
104 | 104 | } |
| 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 | + } |
105 | 110 | |
| 111 | + |
| 112 | + |
106 | 113 | //likely a audio clip if no poster and type application/ogg |
107 | 114 | //@@todo we should return audio/ogg for the mime type or some other way to specify its "audio" |
108 | 115 | 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 @@ |
2 | 2 | //base remote search obj |
3 | 3 | |
| 4 | +loadGM({ |
| 5 | + "imported_from" : "$1 imported from [$2 $3]. See the original [$4 resource page] for more info" |
| 6 | +}) |
4 | 7 | // @key is name of rObj variable |
5 | 8 | // @value is where to find the value in the item xml |
6 | 9 | // |
— | — | @@ -99,11 +102,11 @@ |
100 | 103 | } |
101 | 104 | if( node!=null && attr_name != null){ |
102 | 105 | 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 ) ); |
104 | 107 | }else{ |
105 | 108 | var attr_vals = {}; |
106 | 109 | 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) |
108 | 111 | attr_vals[ attr_name[j] ] = $j.trim( $j(node).attr( attr_name[j]) ).replace(/(<([^>]+)>)/ig,""); |
109 | 112 | } |
110 | 113 | tag_val = attr_vals ; |
— | — | @@ -168,8 +171,7 @@ |
169 | 172 | |
170 | 173 | }, |
171 | 174 | 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]); |
174 | 176 | }, |
175 | 177 | //for thigns like categories and the like |
176 | 178 | getExtraResourceDescWiki:function( rObj ){ |
Index: trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/metavidSearch.js |
— | — | @@ -83,7 +83,7 @@ |
84 | 84 | return '{{PD-USGov}}'; |
85 | 85 | }, |
86 | 86 | getExtraResourceDescWiki:function( rObj ){ |
87 | | - var o = ''; |
| 87 | + var o = "\n"; |
88 | 88 | //check for person |
89 | 89 | if( rObj.person && rObj.person['label']) |
90 | 90 | o += '* featuring [[' + rObj.person['label'] + ']]' + "\n"; |
Index: trunk/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js |
— | — | @@ -32,7 +32,9 @@ |
33 | 33 | "cc_pd_title": "Public Domain", |
34 | 34 | "unknown_license": "Unknown License", |
35 | 35 | "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" |
37 | 39 | }); |
38 | 40 | var default_remote_search_options = { |
39 | 41 | 'profile':'mediawiki_edit', |
— | — | @@ -123,8 +125,8 @@ |
124 | 126 | //@@todo should query wgForeignFileRepos setting maybe interwikimap from the api |
125 | 127 | */ |
126 | 128 | 'this_wiki':{ |
127 | | - 'enabled': 0, |
128 | | - 'checked': 0, |
| 129 | + 'enabled': 1, |
| 130 | + 'checked': 1, |
129 | 131 | 'title' : 'This Wiki', |
130 | 132 | 'desc' : '(should be updated with the proper text) maybe import from some config value', |
131 | 133 | 'api_url': wgServer + wgScriptPath + '/api.php', |
— | — | @@ -958,7 +960,7 @@ |
959 | 961 | var overflow_style = ( mediaType =='video' )?'':'overflow:auto;'; |
960 | 962 | //append to the top level of model window: |
961 | 963 | $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;">' + |
963 | 965 | '<div id="clip_edit_disp" style="position:absolute;' + overflow_style + 'width:100%;height:100%;padding:5px;'+ |
964 | 966 | 'width:' + (maxWidth) + 'px;" >' + |
965 | 967 | mv_get_loading_img('position:absolute;top:30px;left:30px') + |
— | — | @@ -1200,10 +1202,16 @@ |
1201 | 1203 | rObj.pSobj.updateDataForImport( rObj ); |
1202 | 1204 | |
1203 | 1205 | //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 | + |
1206 | 1214 | //output person and bill info if |
1207 | | - wt+='|Source=' + '[' + $j.trim( rObj.link ) + ' Original Source]'+ "\n"; |
| 1215 | + wt+='|Source=' + rObj.pSobj.getImportResourceDescWiki( rObj ) + "\n"; |
1208 | 1216 | |
1209 | 1217 | if( rObj.author ) |
1210 | 1218 | wt+='|Author=' + rObj.author +"\n"; |
Index: trunk/phase3/js2/mwEmbed/php/languages/mwEmbed.i18n.php |
— | — | @@ -57,36 +57,14 @@ |
58 | 58 | 'fogg-preset-custom' => 'Custom Settings', |
59 | 59 | |
60 | 60 | /* |
61 | | - * js file: /libAddMedia/mediaWikiUploadHelper.OFF.js |
| 61 | + * js file: /libAddMedia/searchLibs/metavidSearch.js |
62 | 62 | */ |
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', |
86 | 64 | |
87 | 65 | /* |
88 | | - * js file: /libAddMedia/searchLibs/metavidSearch.js |
| 66 | + * js file: /libAddMedia/searchLibs/baseRemoteSearch.js |
89 | 67 | */ |
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', |
91 | 69 | |
92 | 70 | /* |
93 | 71 | * js file: /libAddMedia/mvFirefogg.js |
— | — | @@ -129,6 +107,7 @@ |
130 | 108 | 'unknown_license' => 'Unknown License', |
131 | 109 | '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>', |
132 | 110 | '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', |
133 | 112 | |
134 | 113 | /* |
135 | 114 | * js file: /libSequencer/mvSequencer.js |
Index: trunk/phase3/js2/mwEmbed/mv_embed.js |
— | — | @@ -577,7 +577,7 @@ |
578 | 578 | this.onReadyEvents.push(fn); |
579 | 579 | }, |
580 | 580 | //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 |
582 | 582 | runQuededFunctions:function(){ |
583 | 583 | var _this = this; |
584 | 584 | this.doneReadyEvents=true; |
— | — | @@ -634,8 +634,8 @@ |
635 | 635 | mvJsLoader.runQuededFunctions(); |
636 | 636 | } |
637 | 637 | } |
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 ) { |
640 | 640 | //make sure the skin/style sheets are avaliable always: |
641 | 641 | loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' ); |
642 | 642 | loadExternalCss( mv_embed_path + 'skins/'+mv_skin_name+'/styles.css'); |
— | — | @@ -647,11 +647,13 @@ |
648 | 648 | func(); |
649 | 649 | }); |
650 | 650 | }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) |
652 | 652 | mvJsLoader.jQueryCheckFlag = true; |
653 | 653 | mvJsLoader.addLoadEvent( func ); |
654 | 654 | }; |
655 | 655 | } |
| 656 | +//depreciated mwAddOnloadHook in favor of js2 naming (for clear seperation of js2 code from old mw code |
| 657 | +var mwAddOnloadHook = js2AddOnloadHook; |
656 | 658 | /* |
657 | 659 | * this function allows for targeted rewriting |
658 | 660 | */ |
Index: trunk/phase3/js2/uploadPage.js |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | * uploadPage.js to be run on specialUpload page. |
4 | 4 | * controls the invocation of the mvUploader class based on local config. |
5 | 5 | */ |
6 | | -mwAddOnloadHook( function(){ |
| 6 | +js2AddOnloadHook( function(){ |
7 | 7 | mwUploadHelper.init(); |
8 | 8 | }); |
9 | 9 | //set up the upoload form bindings once all dom manipluation is done |
Index: trunk/phase3/js2/editPage.js |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | }; |
19 | 19 | |
20 | 20 | |
21 | | -mwAddOnloadHook( function(){ |
| 21 | +js2AddOnloadHook( function(){ |
22 | 22 | mwEditPageHelper.init(); |
23 | 23 | }); |
24 | 24 | var mwEditPageHelper = { |