RT#8224: allow user to disable HTML editor
authormark <mark>
Mon, 24 May 2010 23:54:58 +0000 (23:54 +0000)
committermark <mark>
Mon, 24 May 2010 23:54:58 +0000 (23:54 +0000)
httemplate/edit/cust_main_note.cgi
httemplate/edit/process/cust_main_note.cgi
httemplate/pref/pref-process.html
httemplate/pref/pref.html
httemplate/view/cust_main/notes.html

index e2501cb..439c844 100755 (executable)
@@ -6,11 +6,15 @@
 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
 <INPUT TYPE="hidden" NAME="notenum" VALUE="<% $notenum %>">
 
-<% include('/elements/htmlarea.html', 'field' => 'comment',
+% if( $FS::CurrentUser::CurrentUser->option('disable_html_editor') ) {
+  <TEXTAREA NAME="comment_plain" ROWS="12" COLS="60"><% 
+  join '', split /<br \/>|&nbsp;/, $comment 
+  %></TEXTAREA>
+% }
+% else {
+<% include('/elements/htmlarea.html', 'field' => 'comment_html',
                                       'curr_value' => $comment) %>
-% #<TEXTAREA NAME="comment" ROWS="12" COLS="60">
-% # <% $comment %>
-% #</TEXTAREA>
+% }
 
 <BR><BR>
 <INPUT TYPE="submit" VALUE="<% $notenum ? "Apply Changes" : "Add Note" %>">
index f09189a..f904c59 100755 (executable)
@@ -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("<br />\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;
index 708583d..47f80af 100644 (file)
@@ -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
index 7ded183..ab76c3b 100644 (file)
@@ -40,7 +40,7 @@ Interface
   </TR>
 
   <TR>
-    <TH ALIGN="right">Default customer view: </TD>
+    <TH ALIGN="right">Default customer view: </TH>
     <TD COLSPAN=2>
       <SELECT NAME="default_customer_view">
 %       foreach my $view ( keys %customer_views ) {
@@ -53,6 +53,13 @@ Interface
       </SELECT>
     </TD>
   </TR>
+  
+  <TR>
+    <TH ALIGN="right" COLSPAN=1>Disable HTML editor for customer notes: </TH>
+    <TD ALIGN="left" COLSPAN=2>
+      <INPUT TYPE="checkbox" NAME="disable_html_editor" VALUE="1" <% $curuser->option('disable_html_editor') ? 'CHECKED' : '' %>>
+    </TD>
+  </TR>
 
 </TABLE>
 <BR>
index 74d3f60..1283b19 100755 (executable)
@@ -53,7 +53,7 @@
         &nbsp;<% $note->usernum ? $note->access_user->name : $note->otaker %>
       </TD>
       <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
-        &nbsp;<% $note->comments | defang %>
+        <% $note->comments | defang %>
       </TD>
 % if($edit) {
       <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $edit %></TD>