Index: branches/new-upload/phase3/includes/EditPage.php |
— | — | @@ -380,6 +380,9 @@ |
381 | 381 | } |
382 | 382 | |
383 | 383 | $wgOut->addScriptFile( 'edit.js' ); |
| 384 | + |
| 385 | + $wgOut->addScriptClass( 'editPage' ); |
| 386 | + |
384 | 387 | $permErrors = $this->getEditPermissionErrors(); |
385 | 388 | if ( $permErrors ) { |
386 | 389 | wfDebug( __METHOD__.": User can't edit\n" ); |
Index: branches/new-upload/phase3/includes/AutoLoader.php |
— | — | @@ -580,6 +580,7 @@ |
581 | 581 | |
582 | 582 | //phase 2 javascript: |
583 | 583 | 'uploadPage' => 'js2/uploadPage.js', |
| 584 | + 'editPage' => 'js2/editPage.js', |
584 | 585 | ); |
585 | 586 | |
586 | 587 | //add the mwEmbed set of classes that we want to expose: (could be conditional) |
Index: branches/new-upload/phase3/js2/editPage.js |
— | — | @@ -0,0 +1,67 @@ |
| 2 | +//initial refactoring of the edit page into jquery based edit page |
| 3 | + |
| 4 | +loadGM({ |
| 5 | + "add_media_to_page" : "Add Media to this Page" |
| 6 | +}); |
| 7 | + |
| 8 | +mwAddOnloadHook( function(){ |
| 9 | + //add the add media button: |
| 10 | + $j('#toolbar').append( '<img id="mv-add-media" title="' + gM('add_media_to_page') + '"' + |
| 11 | + 'src="' + mv_skin_img_path + 'Button_add_media.png"' + |
| 12 | + 'style="cursor:pointer" />' ); |
| 13 | + $j('#mv-add-media').click(mv_do_load_wiz); |
| 14 | +}); |
| 15 | + |
| 16 | +function mv_do_load_wiz(){ |
| 17 | + //add the add media-wizard button: |
| 18 | + caret_pos={}; |
| 19 | + var txtarea = document.editform.wpTextbox1; |
| 20 | + var getTextCusorStartPos = function (o){ |
| 21 | + if (o.createTextRange) { |
| 22 | + var r = document.selection.createRange().duplicate() |
| 23 | + r.moveEnd('character', o.value.length) |
| 24 | + if (r.text == '') return o.value.length |
| 25 | + return o.value.lastIndexOf(r.text) |
| 26 | + } else return o.selectionStart |
| 27 | + } |
| 28 | + var getTextCusorEndPos = function (o){ |
| 29 | + if (o.createTextRange) { |
| 30 | + var r = document.selection.createRange().duplicate(); |
| 31 | + r.moveStart('character', -o.value.length); |
| 32 | + return r.text.length; |
| 33 | + } else{ |
| 34 | + return o.selectionEnd |
| 35 | + } |
| 36 | + } |
| 37 | + caret_pos.s = getTextCusorStartPos( txtarea ); |
| 38 | + caret_pos.e = getTextCusorEndPos( txtarea ); |
| 39 | + caret_pos.text = txtarea.value; |
| 40 | + //show/empty modalbox: |
| 41 | + $j('#modalbox,#mv_overlay').remove(); |
| 42 | + $j('body').append(''+ |
| 43 | + '<div id="modalbox" style="background:#DDD;border:3px solid #666666;font-size:115%;'+ |
| 44 | + 'top:30px;left:20px;right:20px;bottom:30px;position:fixed;z-index:100;">'+ |
| 45 | + 'loading external media wizard<blink>...</blink>'+ |
| 46 | + '</div>'+ |
| 47 | + '<div id="mv_overlay" style="background:#000;cursor:wait;height:100%;left:0;position:fixed;'+ |
| 48 | + 'top:0;width:100%;z-index:5;filter:alpha(opacity=60);-moz-opacity: 0.6;'+ |
| 49 | + 'opacity: 0.6;"/>'); |
| 50 | + |
| 51 | + //load mv_embed and do text search interface: |
| 52 | + |
| 53 | + //setup the restore text value: |
| 54 | + var txtarea = document.editform.wpTextbox1; |
| 55 | + txtarea.value = caret_pos.text; |
| 56 | + //do the remote search interface: |
| 57 | + mv_do_remote_search({ |
| 58 | + 'target_id' :'modalbox', |
| 59 | + 'profile' :'mediawiki_edit', |
| 60 | + 'target_textbox' : 'wpTextbox1', |
| 61 | + 'caret_pos' : caret_pos, |
| 62 | + //note selections in the textbox will override the default query |
| 63 | + 'default_query' : wgTitle, |
| 64 | + 'target_title' : wgPageName, |
| 65 | + 'cpconfig' : {}, |
| 66 | + 'local_wiki_api_url': wgServer + wgScriptPath + '/api.php' |
| 67 | + }); |
| 68 | +} |
\ No newline at end of file |
Index: branches/new-upload/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1016,6 +1016,7 @@ |
1017 | 1017 | 'media_tip' => 'File link', |
1018 | 1018 | 'sig_tip' => 'Your signature with timestamp', |
1019 | 1019 | 'hr_tip' => 'Horizontal line (use sparingly)', |
| 1020 | +'add_media_wizard'=> 'Add Media Wizard', |
1020 | 1021 | |
1021 | 1022 | # Edit pages |
1022 | 1023 | 'summary' => 'Summary:', |