[Rt-commit] r2836 - in rt/branches/QUEBEC-EXPERIMENTAL: .
html/Elements lib/RT lib/RT/Interface
jesse at bestpractical.com
jesse at bestpractical.com
Fri May 6 16:39:14 EDT 2005
Author: jesse
Date: Fri May 6 16:39:11 2005
New Revision: 2836
Added:
rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/EditCustomFieldWikitext
rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/ShowCustomFieldWikitext
Modified:
rt/branches/QUEBEC-EXPERIMENTAL/ (props changed)
rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/ShowCustomFields
rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/CustomField_Overlay.pm
rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Interface/Web.pm
Log:
r15830 at hualien: jesse | 2005-05-06 16:34:11 -0400
r13240 at hualien: jesse | 2005-04-18 01:07:43 -0400
* Added Wikitext custom field type
Added: rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/EditCustomFieldWikitext
==============================================================================
--- (empty file)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/EditCustomFieldWikitext Fri May 6 16:39:11 2005
@@ -0,0 +1,65 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+%# <jesse at bestpractical.com>
+%#
+%# (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
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+%#
+%#
+%# 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 BPS TAGGED BLOCK }}}
+% while ($Values and my $value = $Values->Next ) {
+<textarea cols=<%$Cols%> rows=<%$Rows%> name="<%$NamePrefix%><%$CustomField->Id%>-Values"><% $value->Content %></textarea><br>
+% }
+% if (!$MaxValues or !$Values or $Values->Count < $MaxValues) {
+<textarea cols=<%$Cols%> rows=<%$Rows%> name="<%$NamePrefix%><%$CustomField->Id%>-Values"><% $Default %></textarea>
+% }
+<%INIT>
+# XXX - MultiValue textarea is for now outlawed.
+$MaxValues = 1;
+</%INIT>
+<%ARGS>
+$Object => undef
+$CustomField => undef
+$NamePrefix => undef
+$Default => undef
+$Values => undef
+$MaxValues => undef
+$Cols
+$Rows
+</%ARGS>
Added: rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/ShowCustomFieldWikitext
==============================================================================
--- (empty file)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/ShowCustomFieldWikitext Fri May 6 16:39:11 2005
@@ -0,0 +1,54 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+%# <jesse at bestpractical.com>
+%#
+%# (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
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+%#
+%#
+%# 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 BPS TAGGED BLOCK }}}
+% my $content = $Object->LargeContent || $Object->Content;
+% my $wiki_content = Text::WikiFormat::format( $content."\n" );
+<%$wiki_content|n%>
+<%init>
+use Text::WikiFormat;
+</%init>
+<%ARGS>
+$Object
+</%ARGS>
Modified: rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/ShowCustomFields
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/ShowCustomFields (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/ShowCustomFields Fri May 6 16:39:11 2005
@@ -53,8 +53,9 @@
<ul>
% while (my $Value = $Values->Next()) {
<li>
-% if ($CustomField->Type eq 'Image') {
-<& ShowCustomFieldImage, Object => $Value &>
+% my $comp = "ShowCustomField".$CustomField->Type;
+% if ($m->comp_exists($comp)) {
+<& $comp, Object => $Value &>
% } else {
<%$Value->Content%>
% }
Modified: rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/CustomField_Overlay.pm
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/CustomField_Overlay.pm (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/CustomField_Overlay.pm Fri May 6 16:39:11 2005
@@ -48,18 +48,43 @@
use strict;
no warnings qw(redefine);
-use vars qw(%TYPES $RIGHTS %FRIENDLY_OBJECT_TYPES);
+use vars qw(%FieldTypes $RIGHTS %FRIENDLY_OBJECT_TYPES);
use RT::CustomFieldValues;
use RT::ObjectCustomFieldValues;
-# Enumerate all valid types for this custom field
-%TYPES = (
- Freeform => 1, # loc
- Select => 1, # loc
- Text => 1, # loc
- Image => 1, # loc
- Binary => 1, # loc
+
+%FieldTypes = (
+ Select => [
+ 'Select multiple values', # loc
+ 'Select one value', # loc
+ 'Select up to [_1] values', # loc
+ ],
+ Freeform => [
+ 'Enter multiple values', # loc
+ 'Enter one value', # loc
+ 'Enter up to [_1] values', # loc
+ ],
+ Text => [
+ 'Fill in multiple text areas', # loc
+ 'Fill in one text area', # loc
+ 'Fill in up to [_1] text areas',# loc
+ ],
+ Wikitext => [
+ 'Fill in multiple wikitext areas', # loc
+ 'Fill in one wikitext area', # loc
+ 'Fill in up to [_1] wikitext areas',# loc
+ ],
+ Image => [
+ 'Upload multiple images', # loc
+ 'Upload one image', # loc
+ 'Upload up to [_1] images', # loc
+ ],
+ Binary => [
+ 'Upload multiple files', # loc
+ 'Upload one file', # loc
+ 'Upload up to [_1] files', # loc
+ ],
);
@@ -523,7 +548,7 @@
=cut
sub Types {
- return (keys %TYPES);
+ return (keys %FieldTypes);
}
# }}}
@@ -535,42 +560,13 @@
If a custom field type is specified as the parameter, the friendly type for that type will be returned
=cut
-
-my %FriendlyTypes = (
- Select => [
- 'Select multiple values', # loc
- 'Select one value', # loc
- 'Select up to [_1] values', # loc
- ],
- Freeform => [
- 'Enter multiple values', # loc
- 'Enter one value', # loc
- 'Enter up to [_1] values', # loc
- ],
- Text => [
- 'Fill in multiple text areas', # loc
- 'Fill in one text area', # loc
- 'Fill in up to [_1] text areas',# loc
- ],
- Image => [
- 'Upload multiple images', # loc
- 'Upload one image', # loc
- 'Upload up to [_1] images', # loc
- ],
- Binary => [
- 'Upload multiple files', # loc
- 'Upload one file', # loc
- 'Upload up to [_1] files', # loc
- ],
-);
-
sub FriendlyType {
my $self = shift;
my $type = @_ ? shift : $self->Type;
my $max = @_ ? shift : $self->MaxValues;
- if (my $friendly_type = $FriendlyTypes{$type}[$max>2 ? 2 : $max]) {
+ if (my $friendly_type = $FieldTypes{$type}[$max>2 ? 2 : $max]) {
return ( $self->loc( $friendly_type, $max ) );
}
else {
@@ -609,7 +605,7 @@
$RT::Logger->warning( "Prefix 'Single' and 'Multiple' to Type deprecated, use MaxValues instead");
}
- if( $TYPES{$type}) {
+ if( $FieldTypes{$type}) {
return(1);
}
else {
Modified: rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Interface/Web.pm
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Interface/Web.pm (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Interface/Web.pm Fri May 6 16:39:11 2005
@@ -329,7 +329,7 @@
$ARGS{$arg} = [split('\n', $ARGS{$arg})];
}
- if ( $cf->Type eq 'Text') {
+ if ( $cf->Type =~ /text/i) { # Catch both Text and Wikitext
$ARGS{$arg} =~ s/\r//g;
}
@@ -1144,7 +1144,7 @@
my @values = ();
if (ref( $ARGSRef->{$arg} ) eq 'ARRAY' ) {
@values = @{ $ARGSRef->{$arg} };
- } elsif ($CustomFieldObj->Type eq 'Text') {
+ } elsif ($CustomFieldObj->Type =~ /text/i) { # Both Text and Wikitext
@values = ($ARGSRef->{$arg});
} else {
@values = split /\n/, $ARGSRef->{$arg};
@@ -1152,7 +1152,7 @@
if ( ($CustomFieldObj->Type eq 'Freeform'
&& ! $CustomFieldObj->SingleValue) ||
- $CustomFieldObj->Type eq 'Text') {
+ $CustomFieldObj->Type =~ /text/i) {
foreach my $val (@values) {
$val =~ s/\r//g;
}
More information about the Rt-commit
mailing list