From b7c314a198c60a6f9236950994113aa422aa77ff Mon Sep 17 00:00:00 2001 From: mark Date: Mon, 24 May 2010 23:54:58 +0000 Subject: [PATCH] RT#8224: allow user to disable HTML editor --- httemplate/edit/cust_main_note.cgi | 12 ++++++++---- httemplate/edit/process/cust_main_note.cgi | 7 ++++++- httemplate/pref/pref-process.html | 1 + httemplate/pref/pref.html | 9 ++++++++- httemplate/view/cust_main/notes.html | 2 +- 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/httemplate/edit/cust_main_note.cgi b/httemplate/edit/cust_main_note.cgi index e2501cb54..439c84414 100755 --- a/httemplate/edit/cust_main_note.cgi +++ b/httemplate/edit/cust_main_note.cgi @@ -6,11 +6,15 @@ -<% include('/elements/htmlarea.html', 'field' => 'comment', +% if( $FS::CurrentUser::CurrentUser->option('disable_html_editor') ) { + +% } +% else { +<% include('/elements/htmlarea.html', 'field' => 'comment_html', 'curr_value' => $comment) %> -% # +% }

"> diff --git a/httemplate/edit/process/cust_main_note.cgi b/httemplate/edit/process/cust_main_note.cgi index f09189aa9..f904c5968 100755 --- a/httemplate/edit/process/cust_main_note.cgi +++ b/httemplate/edit/process/cust_main_note.cgi @@ -18,12 +18,17 @@ $cgi->param('notenum') =~ /^(\d*)$/ or die "Illegal notenum: ". $cgi->param('notenum'); my $notenum = $1; +my $comment = $cgi->param('comment_html') || + join("
\n", + split "(?:\r|\n)+", $cgi->param('comment_plain') + ); + my $new = new FS::cust_main_note ( { notenum => $notenum, custnum => $custnum, _date => time, usernum => $FS::CurrentUser::CurrentUser->usernum, - comments => scalar($cgi->param('comment')), + comments => $comment, } ); my $error; diff --git a/httemplate/pref/pref-process.html b/httemplate/pref/pref-process.html index 708583df5..47f80afd0 100644 --- a/httemplate/pref/pref-process.html +++ b/httemplate/pref/pref-process.html @@ -44,6 +44,7 @@ unless ( $error ) { # if ($access_user) { #XXX autogen my @paramlist = qw( menu_position default_customer_view + disable_html_editor email_address snom-ip snom-username snom-password vonage-fromnumber vonage-username vonage-password diff --git a/httemplate/pref/pref.html b/httemplate/pref/pref.html index 7ded18377..ab76c3bdc 100644 --- a/httemplate/pref/pref.html +++ b/httemplate/pref/pref.html @@ -40,7 +40,7 @@ Interface - Default customer view: + Default customer view: + + + Disable HTML editor for customer notes: + + option('disable_html_editor') ? 'CHECKED' : '' %>> + +
diff --git a/httemplate/view/cust_main/notes.html b/httemplate/view/cust_main/notes.html index 74d3f602b..1283b19da 100755 --- a/httemplate/view/cust_main/notes.html +++ b/httemplate/view/cust_main/notes.html @@ -53,7 +53,7 @@  <% $note->usernum ? $note->access_user->name : $note->otaker %> -  <% $note->comments | defang %> + <% $note->comments | defang %> % if($edit) { <% $edit %> -- 2.11.0