# HG changeset patch # User Dan Fuhry # Date 1288244653 14400 # Node ID 960c1572df75d8920e97a188813a6b82897c7133 # Parent 640e1597441554ea15503a23ac88cfa81a0e7653 Better icons, and finished the image tool. diff -r 640e15974415 -r 960c1572df75 GUIEditor.php --- a/GUIEditor.php Wed Oct 27 03:18:51 2010 -0400 +++ b/GUIEditor.php Thu Oct 28 01:44:13 2010 -0400 @@ -33,7 +33,7 @@ $results = perform_search($_GET['userinput'], $warnings, false, $word_list); foreach ( $results as $i => $result ) { - if ( $result['namespace'] != 'File' ) + if ( $result['namespace'] != 'File' || !preg_match('/\.(png|jpeg|jpg|gif)$/i', $result['page_id']) ) unset($results[$i]); } if ( count($results) > 5 ) @@ -92,6 +92,24 @@ image_btn_upload: 'Upload a file', image_lbl_caption: 'Caption:', image_af_hint: 'Type a few letters to search.', + image_lbl_resize: 'Resize image:', + image_checkbox_resize: 'Resize', + image_lbl_dimensions: 'Dimensions:', + image_resize_or: 'Or', + image_resize_lbl_default: 'Use default preview size', + image_msg_preserve_aspect: 'The image\'s aspect ratio will be preserved.', + image_lbl_mode: 'Display mode:', + image_lbl_framed: 'Framed', + image_lbl_inline: 'Inline', + image_lbl_raw: 'Raw', + image_mode_hint_framed: 'Display the image off to the left or right in a frame.', + image_mode_hint_inline: 'Display the image in the middle of the paragraph.', + image_mode_hint_raw: 'Display just the image without linking to the file page - useful for putting images into links.', + image_framed_lbl_side: 'Display on:', + image_framed_left: 'Left side', + image_framed_right: 'Right side', + image_lbl_alttext: 'Alternate text:', + image_raw_msg_noopt: 'No additional options for raw image display.', btn_insert: 'Insert' } diff -r 640e15974415 -r 960c1572df75 guieditor/editor.js --- a/guieditor/editor.js Wed Oct 27 03:18:51 2010 -0400 +++ b/guieditor/editor.js Thu Oct 28 01:44:13 2010 -0400 @@ -97,7 +97,8 @@
\ ' + $lang.get('guied_intlink_text_hint') + ' \ \ - '; + \ + '; div.innerHTML += '

\ ' + $lang.get('guied_btn_insert') + ' \ ' + $lang.get('etc_cancel') + ' \ @@ -136,7 +137,8 @@
\ ' + $lang.get('guied_extlink_text_hint') + ' \ \ - '; + \ + '; div.innerHTML += '

\ ' + $lang.get('guied_btn_insert') + ' \ ' + $lang.get('etc_cancel') + ' \ @@ -160,7 +162,7 @@ ' + $lang.get('guied_image_lbl_image') + ' \ \ \ - \ + \
\ ' + $lang.get('guied_image_af_hint') + ' \

\ @@ -170,12 +172,95 @@ \ \ \ - ' + $lang.get('guied_image_lbl_caption') + ' \ + ' + $lang.get('guied_image_lbl_resize') + ' \ + \ + \ + \ + \ + \ + \ + \ + \ + ' + $lang.get('guied_image_lbl_mode') + ' \ + \ + \ +
\ + \ + \ +
\ +
\ + ' + $lang.get('guied_image_mode_hint_framed') + ' \ + \ + \ + \ +
\ + \ + \ + \ + \ + \ + \ + \ \ - '; + \ +
\ + ' + $lang.get('guied_image_framed_lbl_side') + ' \ + \ +
\ + \ + \ +
\ +
\ + ' + $lang.get('guied_image_lbl_caption') + ' \ \ \
\ +
\ + \ + '; div.innerHTML += '

\ ' + $lang.get('guied_btn_insert') + ' \ ' + $lang.get('etc_cancel') + ' \ @@ -192,6 +277,9 @@ break; } + /* + + */ } function guied_intlink_finish(insertbtn) @@ -244,12 +332,58 @@ function guied_refresh_image() { - $('#guied_image_preview').attr('src', makeUrlNS('Special', 'DownloadFile/' + $('#guied_image_file').val(), 'preview&width=200&height=400')).css('margin-bottom', '5px'); + $('#guied_image_preview').css('display', 'block').attr('src', makeUrlNS('Special', 'DownloadFile/' + $('#guied_image_file').val(), 'preview&width=200&height=400')).css('margin-bottom', '5px'); +} + +function guied_image_toggle_default() +{ + if ( $('#guied_image_resize_default:checked').length ) + { + $('#guied_image_size_x, #guied_image_size_y').attr('disabled', 'disabled'); + } + else + { + $('#guied_image_size_x, #guied_image_size_y').removeAttr('disabled'); + } +} + +function guied_image_set_mode(val) +{ + $('#guied_mode_hint').text($lang.get('guied_image_mode_hint_' + val)); + $('.guied_image_mode').hide(); + $('.guied_image_mode.' + val).show(); } -function guied_image_finish() +function guied_image_finish(insertbtn) { - // yeah... working on this. + var attrs = []; + var filename = $('#guied_image_file').val(); + attrs.push(':' + namespace_list.File + filename); + if ( $('#guied_image_resize:checked').length ) + { + if ( $('#guied_image_resize_default:checked').length ) + attrs.push('thumb'); + else + attrs.push($('#guied_image_size_x').val() + 'x' + $('#guied_image_size_y')); + } + var caption = ''; + switch($('.guied_image_mode_radio:checked').val()) + { + case 'framed': + attrs.push($('.guied_image_side:checked').val()); + caption = $('#guied_image_caption').val(); + break; + case 'inline': + caption = $('#guied_image_alttext').val(); + break; + } + if ( caption != '' ) + attrs.push(caption); + + var tag = '[[' + implode('|', attrs) + ']]'; + + guied_replace_selection(document.getElementById('ajaxEditArea'), tag); + miniPromptDestroy(insertbtn); } // Client detection from MediaWiki diff -r 640e15974415 -r 960c1572df75 guieditor/icons/bold.png Binary file guieditor/icons/bold.png has changed diff -r 640e15974415 -r 960c1572df75 guieditor/icons/extlink.png Binary file guieditor/icons/extlink.png has changed diff -r 640e15974415 -r 960c1572df75 guieditor/icons/intlink.png Binary file guieditor/icons/intlink.png has changed diff -r 640e15974415 -r 960c1572df75 guieditor/icons/italic.png Binary file guieditor/icons/italic.png has changed diff -r 640e15974415 -r 960c1572df75 guieditor/icons/underline.png Binary file guieditor/icons/underline.png has changed