Revision: 558
Author: geof.glass
Date: Thu Jul 12 14:44:06 2012
Log: Fix quote/reply button so that it doesn't send text twice
Disable quote/reply button (but not other quote buttons - see
comments in smartquote.js) when user can't reply in forum.
Enter key was not working for creating annotations.
Remove double elipsis after Annotation Help in drop-down
Fix editor width when editin an annotation (scroll bar was appearing)
http://code.google.com/p/marginalia/source/detail?r=558
Modified:
/moodle/trunk/moodle/blocks/marginalia/MoodleMarginalia.js
/moodle/trunk/moodle/blocks/marginalia/annotation-styles.php
/moodle/trunk/moodle/blocks/marginalia/lang/en/block_marginalia.php
/moodle/trunk/moodle/blocks/marginalia/moodle_marginalia.php
/moodle/trunk/moodle/blocks/marginalia/smartquote.js
=======================================
--- /moodle/trunk/moodle/blocks/marginalia/MoodleMarginalia.js Fri Jun 22
14:05:41 2012
+++ /moodle/trunk/moodle/blocks/marginalia/MoodleMarginalia.js Thu Jul 12
14:44:06 2012
@@ -187,13 +187,6 @@
var margin = jQuery( '.mia_margin' );
margin.mouseover( function( e ) { margin.toggleClass( 'hover', e.target
== margin[0] ); } );
margin.mouseleave( function( ) { margin.removeClass( 'hover' ); } );
-
- // Enable smartquotes and quote logging
- if ( this.useSmartquote )
- {
- this.smartquote = new Smartquote( this.moodleRoot, this.selectors,
this.smartquoteService );
- this.smartquote.enable( marginalia.listPosts( ), marginalia.skipContent
);
- }
if ( this.splash && this.sheet != Marginalia.SHEET_NONE )
{
@@ -341,6 +334,7 @@
*/
function getLocalized( s )
{
- return LocalizedAnnotationStrings[ s ];
+ var l = LocalizedAnnotationStrings[ s ];
+ return l ? l : s;
}
=======================================
--- /moodle/trunk/moodle/blocks/marginalia/annotation-styles.php Wed Jun 20
22:56:48 2012
+++ /moodle/trunk/moodle/blocks/marginalia/annotation-styles.php Thu Jul 12
14:44:06 2012
@@ -85,6 +85,15 @@
.mia_margin li {
list-style-type: none;
}
+
+/* Ack! Moodle is putting padding on divs. This is bad,
+ * because the textarea child has width 100%, so it is then overflowing
+ * and inserting a horizontal scroll bar. Sheesh. The Moodle
+ * selector should be more precise.
+ */
+.forumpost .content .mia_margin div {
+ padding: 0;
+}
.mia_margin .mia_tip:hover {
outline: #aaa 1px dotted;
=======================================
--- /moodle/trunk/moodle/blocks/marginalia/lang/en/block_marginalia.php Wed
May 30 15:29:42 2012
+++ /moodle/trunk/moodle/blocks/marginalia/lang/en/block_marginalia.php Thu
Jul 12 14:44:06 2012
@@ -42,7 +42,7 @@
$string['unknown_post'] = 'unknown discussion post';
$string['post_name'] = 'discussion post "{$a->name}"';
$string['annotation_help'] = 'creating and using annotations';
-$string['annotate_help_link'] = 'Annotation Help...';
+$string['annotate_help_link'] = 'Annotation Help';
$string['annotation_summary_help_link'] = 'How to use this page';
$string['missing_help'] = 'No help for topic.';
@@ -124,6 +124,9 @@
$string['js_zero_length_quote'] = 'You must select some text to annotate.';
$string['js_quote_not_found'] = 'The highlighted passage could not be
found';
$string['js_create_overlapping_edits'] = 'You may not create overlapping
edits';
+$string['js_browser_support_of_WCC_range_required_for_smartquote'] = 'Your
browser does not support the range standard required for quoting.';
+$string['js_select_text_to_quote'] = 'You must select some text to quote.';
+
$string['marginalia:view_all'] = 'View all';
$string['marginalia:fix_notes'] = 'Fix notes';
=======================================
--- /moodle/trunk/moodle/blocks/marginalia/moodle_marginalia.php Tue Jul 10
18:46:52 2012
+++ /moodle/trunk/moodle/blocks/marginalia/moodle_marginalia.php Thu Jul 12
14:44:06 2012
@@ -352,12 +352,17 @@
return $output;
}
- public function output_quote_button( $canreply )
- {
- $output =
html_writer::tag( 'button', '<span>'.get_string( 'quote_button',
ANNOTATION_STRINGS ).'</span>',
- array( 'class'=>'smartquote' . ($canreply ? ' canreply' : '') ) );
- //$output .= html_writer::end_tag( 'button' );
- return $output;
+ public function output_quote_button( $canreply=true )
+ {
+ if ( $canreply )
+ {
+ $output = html_writer::tag( 'button',
+ '<span>'.get_string( 'quote_button', ANNOTATION_STRINGS ).'</span>',
+ array( 'class'=>'smartquote' ) );
+ //$output .= html_writer::end_tag( 'button' );
+ return $output;
+ }
+ return '';
}
/**
=======================================
--- /moodle/trunk/moodle/blocks/marginalia/smartquote.js Mon Jun 25
23:00:07 2012
+++ /moodle/trunk/moodle/blocks/marginalia/smartquote.js Thu Jul 12
14:44:06 2012
@@ -144,20 +144,23 @@
{
var pub = this.getPostMicroQuote( content, skipContent, postId );
var bus = new CookieBus( 'smartquote' );
- if ( bus.getSubscriberCount( ) > 0 )
- {
- bus.publish( pub );
-
- if ( this.extService )
- this.extService.createEvent( 'smartquote', 'send', pub, 'forum_post',
postId );
- }
- else if ( this.wwwroot && postId )
- {
- window.location = this.wwwroot + '/mod/forum/post.php?reply=' + postId
- + '&message=' + restutil.encodeURIParameter( pub + "<p> ");
-
- if ( this.extService )
- this.extService.createEvent( 'smartquote', 'new post',
pub, 'forum_post', postId );
+ if ( pub )
+ {
+ if ( bus.getSubscriberCount( ) > 0 )
+ {
+ bus.publish( pub );
+
+ if ( this.extService )
+ this.extService.createEvent( 'smartquote', 'send', pub, 'forum_post',
postId );
+ }
+ else if ( this.wwwroot && postId )
+ {
+ bus.publish( pub );
+ window.location = this.wwwroot + '/mod/forum/post.php?reply=' + postId;
+
+ if ( this.extService )
+ this.extService.createEvent( 'smartquote', 'new post',
pub, 'forum_post', postId );
+ }
}
}
@@ -195,14 +198,26 @@
}
var bus = new CookieBus( 'smartquote' );
+ // The user is editing a post: paste the quote in there
if ( bus.getSubscriberCount( ) > 0 )
{
bus.publish( pub );
if ( this.extService )
this.extService.createEvent( 'smartquote', 'send', quote, 'annotation',
annotation.getId() );
}
+ // Otherwise, reply to this post and use the quoted text
else if ( this.wwwroot && postId )
{
+ // Ideally this should never happen if the user doesn't have
+ // permission to post to this forum. Unfortunately, Moodle
+ // doesn't calculate $canreply until *after* the page header
+ // has been output. This makes it difficult to know about it
+ // here. Marginalia could search for a Reply button on the
+ // page, or it could calculate it itself, or it could set an
+ // internal field after Moodle has done its calculation. But
+ // all of these are kludges that make relatively deep
+ // assumptions about Moodle's underlying behavior, so could
+ // increase the likelihood of Marginalia breaking.
bus.publish( pub );
window.location = this.wwwroot + '/mod/forum/post.php?reply=' + postId;