import rt 3.8.11
[freeside.git] / rt / html / Admin / Elements / EditCustomField
index a09600b..e19c00b 100644 (file)
@@ -1,8 +1,14 @@
-%# BEGIN LICENSE BLOCK
+%# BEGIN BPS TAGGED BLOCK {{{
 %# 
-%# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
+%# COPYRIGHT:
+%#  
+%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC 
+%#                                          <jesse@bestpractical.com>
 %# 
-%# (Except where explictly superceded by other copyright notices)
+%# (Except where explicitly superseded by other copyright notices)
+%# 
+%# 
+%# LICENSE:
 %# 
 %# This work is made available to you under the terms of Version 2 of
 %# the GNU General Public License. A copy of that license should have
 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 %# General Public License for more details.
 %# 
-%# Unless otherwise specified, all modifications, corrections or
-%# extensions to this work which alter its source code become the
-%# property of Best Practical Solutions, LLC when submitted for
-%# inclusion in the work.
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%# 
+%# 
+%# CONTRIBUTION SUBMISSION POLICY:
+%# 
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
 %# 
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
 %# 
-%# END LICENSE BLOCK
+%# END BPS TAGGED BLOCK }}}
 <& /Elements/ListActions, actions => \@results &>
 
 
-<FORM METHOD=GET ACTION="CustomField.html">
-<INPUT TYPE=HIDDEN NAME="CustomField" VALUE="<%$id %>">
-<INPUT TYPE=HIDDEN name="Queue" value="<%$Queue%>">
+<form method="post" action="CustomField.html">
+<input type="hidden" class="hidden" name="CustomField" value="<%$id %>" />
+<input type="hidden" class="hidden" name="Queue" value="<%$Queue%>" />
 
-<TABLE WIDTH="100%" BORDER="0">
-<TR><TD ALIGN="RIGHT">
+<table width="100%" border="0">
+<tr><td align="right">
 <&|/l&>Name</&>:
-</TD><TD>
-<input name="Name" VALUE="<%$CustomFieldObj->Name%>" SIZE=20>
-</TD></TR>
-<TR><TD ALIGN="RIGHT">
+</td><td>
+<input name="Name" value="<%$CustomFieldObj->Name%>" size="20" />
+</td></tr>
+<tr><td align="right">
 <&|/l&>Description</&>:
-</TD><TD>
-<input name="Description" VALUE="<%$CustomFieldObj->Description%>" SIZE=80>
-</TD></TR>
-<TR><TD ALIGN="RIGHT">
+</td><td>
+<input name="Description" value="<%$CustomFieldObj->Description%>" size="80" />
+</td></tr>
+<tr><td align="right">
 <&|/l&>Type</&>:
-</TD><TD>
+</td><td>
 <& /Admin/Elements/SelectCustomFieldType, Name => "Type", Default => $CustomFieldObj->Type &>
-</TD></TR>
-<TR><TD>
-</TD><TD>
-<INPUT TYPE=HIDDEN NAME="SetEnabled" VALUE="1">
-<INPUT TYPE=CHECKBOX NAME="Enabled" VALUE="1" <%$EnabledChecked%>> <&|/l&>Enabled (Unchecking this box disables this custom field)</&>
-</TD></TR>
-</TABLE>
-
-<P>
+</td></tr>
+<tr><td>
+</td><td>
+<input type="hidden" class="hidden" name="SetEnabled" value="1" />
+<input type="checkbox" class="checkbox" name="Enabled" value="1" <%$EnabledChecked%> /> <&|/l&>Enabled (Unchecking this box disables this custom field)</&>
+</td></tr>
+</table>
+
+<p>
 % if ($CustomFieldObj->Id and $CustomFieldObj->Type =~ /Select/) {
 <h2><&|/l&>Values</&></h2>
-<font size=-1>
+<font size="-1">
 <& /Admin/Elements/EditCustomFieldValues, CustomField => $CustomFieldObj &>
 <& /Admin/Elements/AddCustomFieldValue, CustomField => $CustomFieldObj &>
 </font>
 % }
-<&/Elements/Submit&>
-</FORM>
+<&/Elements/Submit, Label => loc('Create') &>
+</form>
 
 
 
@@ -81,18 +105,26 @@ if (! $CustomField ) {
                                                  Type => $Type,
                                                  Description => $Description,
                                                 );
-      Abort(loc("Could not create CustomField", $msg)) unless ($val);
-     push @results, $msg;
-     $CustomFieldObj->SetSortOrder($CustomFieldObj->id);
-     $title = loc('Created CustomField [_1]', $CustomFieldObj->Name()); 
+      
+      # if there is an error, then abort.  But since at this point there's
+      # stuff already printed, clear it out.
+      # (This only works in conjunction with temporarily turning autoflush
+      #  off in the files that use this component.)
+      unless ($val) {
+         $m->clear_buffer;
+         Abort(loc("Could not create CustomField: [_1]", $msg));
+      }
+      push @results, $msg;
+      $CustomFieldObj->SetSortOrder($CustomFieldObj->id);
+      $title = loc('Created CustomField [_1]', $CustomFieldObj->Name()); 
     } else {
-       $CustomFieldObj->Load($CustomField) || Abort(loc('No CustomField'));
+      $CustomFieldObj->Load($CustomField) || Abort(loc('No CustomField'));
       $title = loc('Editing CustomField [_1]', $CustomFieldObj->Name()); 
 
       my @aresults = ProcessCustomFieldUpdates ( 
                         CustomFieldObj => $CustomFieldObj,
                         ARGSRef => \%ARGS );
-     push @results, @aresults;
+      push @results, @aresults;
     }