[Rt-commit] r4593 - in rtfm/branches/2.1-TESTING: .
html/Admin/RTFM/Classes html/Callbacks/RTFM/Elements/MessageBox
alexmv at bestpractical.com
alexmv at bestpractical.com
Mon Feb 27 20:13:10 EST 2006
Author: alexmv
Date: Mon Feb 27 20:13:09 2006
New Revision: 4593
Modified:
rtfm/branches/2.1-TESTING/ (props changed)
rtfm/branches/2.1-TESTING/html/Admin/RTFM/Classes/Modify.html
rtfm/branches/2.1-TESTING/html/Callbacks/RTFM/Elements/MessageBox/Default
rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/Preformatted
Log:
r9352 at zoq-fot-pik: chmrr | 2006-02-27 20:12:04 -0500
* Make which text is included in articles customizable
Modified: rtfm/branches/2.1-TESTING/html/Admin/RTFM/Classes/Modify.html
==============================================================================
--- rtfm/branches/2.1-TESTING/html/Admin/RTFM/Classes/Modify.html (original)
+++ rtfm/branches/2.1-TESTING/html/Admin/RTFM/Classes/Modify.html Mon Feb 27 20:13:09 2006
@@ -47,12 +47,25 @@
<INPUT TYPE=CHECKBOX NAME="Enabled" VALUE="1" <%$EnabledChecked%>> <&|/l&>Enabled (Unchecking this box disables this Class)</&><BR>
</TD>
</TR>
-
</TABLE>
-<& /Elements/Submit &>
-</form>
+<h3>When inserting articles in this class into emails:</h3>
+<ul>
+<li><input type="checkbox" name="Include-Name" value="1" <% $include{Name} %>> Include article name</li>
+<li><input type="checkbox" name="Include-Summary" value="1" <% $include{Summary} %>> Include article summary</li>
+% while (my $cf = $cfs->Next) {
+<li>Include custom field '<% $cf->Name %>'
+ <ul>
+ <li><input type="checkbox" name="Include-CF-Title-<% $cf->Id %>" <% $include{"CF-Title-".$cf->Id} %>>Title</li>
+ <li><input type="checkbox" name="Include-CF-Value-<% $cf->Id %>" <% $include{"CF-Value-".$cf->Id} %>>Value</li>
+ </ul>
+</li>
+% }
+</ul>
+
+<& /Elements/Submit &>
+</form>
<%INIT>
@@ -113,6 +126,22 @@
}
+my %include = (Name => 1, Summary => 1);
+my $cfs = $ClassObj->ArticleCustomFields;
+$include{"CF-Title-".$_->Id} = $include{"CF-Value-".$_->Id} = 1 while $_ = $cfs->Next;
+
+if ($SetEnabled) {
+ for (keys %include) {
+ if ($ARGS{"Include-$_"}) {
+ $ClassObj->DeleteAttribute("Skip-$_");
+ } else {
+ $ClassObj->SetAttribute(Name => "Skip-$_", Content => 1);
+ }
+ }
+}
+
+$include{$_} = not $ClassObj->FirstAttribute("Skip-$_") for keys %include;
+$include{$_} = $include{$_} ? " CHECKED" : "" for keys %include;
</%INIT>
Modified: rtfm/branches/2.1-TESTING/html/Callbacks/RTFM/Elements/MessageBox/Default
==============================================================================
--- rtfm/branches/2.1-TESTING/html/Callbacks/RTFM/Elements/MessageBox/Default (original)
+++ rtfm/branches/2.1-TESTING/html/Callbacks/RTFM/Elements/MessageBox/Default Mon Feb 27 20:13:09 2006
@@ -15,18 +15,21 @@
%# GNU General Public License for more details.
%#
%# END LICENSE BLOCK
-
%foreach my $arg (keys %ARGS) {
%
% if ($arg =~ /^RTFM-Include-Article-(\d+)$/) {
-% my $art = RT::FM::Article->new($session{'CurrentUser'});
-% $art->Load($1);
-<& /RTFM/Article/Elements/Preformatted, Article => $art &>
+% my $art = RT::FM::Article->new($session{'CurrentUser'});
+% $art->Load($1);
+<& /RTFM/Article/Elements/Preformatted, Article => $art &>\
% }
-% if ($arg =~ /RTFM-Include-Article-Named/ && $ARGS{$arg}) {
-% my $art = RT::FM::Article->new($session{'CurrentUser'});
-% $art->LoadByCols(Name => $ARGS{$arg});
-<& /RTFM/Article/Elements/Preformatted, Article => $art &>
+% if ($arg =~ /RTFM-Include-Article-Named/ && $ARGS{$arg} =~ /\D/) {
+% my $art = RT::FM::Article->new($session{'CurrentUser'});
+% $art->LoadByCols(Name => $ARGS{$arg});
+<& /RTFM/Article/Elements/Preformatted, Article => $art &>\
+% } elsif ($arg =~ /RTFM-Include-Article-Named/ && $ARGS{$arg}) {
+% my $art = RT::FM::Article->new($session{'CurrentUser'});
+% $art->LoadByCols(id => $ARGS{$arg});
+<& /RTFM/Article/Elements/Preformatted, Article => $art &>\
% }
% }
-% return(1);
+% return(1);
\ No newline at end of file
Modified: rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/Preformatted
==============================================================================
--- rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/Preformatted (original)
+++ rtfm/branches/2.1-TESTING/html/RTFM/Article/Elements/Preformatted Mon Feb 27 20:13:09 2006
@@ -15,14 +15,15 @@
%# GNU General Public License for more details.
%#
%# END LICENSE BLOCK
-
+% if ($include{Name}) {
#<%$Article->Id%>: <%$Article->Name || loc('(no name)')%>
<%'-' x length("#".$Article->Id.": ".($Article->Name || loc('(no name)'))) %>
-
-<% $Article->Summary%>
-
-%my $cfs = $Article->CustomFields;
+% }
+% if ($Article->Summary =~ /\S/ and $include{Summary}) {
+<% $Article->Summary%>
+% }
% while (my $cf = $cfs->Next) {
+% next unless $include{"CF-Title-".$cf->Id} or $include{"CF-Value-".$cf->Id};
% my $values = $Article->CustomFieldValues($cf->Id);
% if ($values->Count == 1) {
@@ -31,27 +32,46 @@
% if ($content =~ /<(.{1,5})>/) {
% $content = de_htmlify($content);
% }
-<% $cf->Name%>:
-<% '-' x length($cf->Name) %>
-<% $content%>
+% if ($include{"CF-Title-".$cf->Id}) {
+<% $cf->Name%>:
+<% '-' x length($cf->Name) %>
+% }
+% if ($include{"CF-Value-".$cf->Id}) {
+<% $content%>
+% }
% } else {
% my $val = $values->Next;
% my $content = $val ? $val->Content : "";
% if ($content =~ /<(.{1,5})>/) {
% $content = de_htmlify($content);
% }
-<% $cf->Name%>: <%$val && $content%>
+% if ($include{"CF-Title-".$cf->Id}) {
+<% $cf->Name%>: \
+% }
+% if ($include{"CF-Value-".$cf->Id}) {
+<% $val && $content%>
+% }
% while ($val = $values->Next) {
% my $content = $val->Content;
% if ($content =~ /<(.{1,5})>/) {
% $content = de_htmlify($content);
% }
-<% ' ' x length($cf->Name)%> <%$content%>
+% if ($include{"CF-Title-".$cf->Id}) {
+<% ' ' x length($cf->Name)%> \
+% }
+% if ($include{"CF-Title-".$cf->Id}) {
+<% $content%>
+% }
% }
% }
% }
-
<%init>
+my $class = $Article->ClassObj;
+my %include = (Name => 1, Summary => 1);
+my $cfs = $class->ArticleCustomFields;
+$include{"CF-Title-".$_->Id} = $include{"CF-Value-".$_->Id} = 1 while $_ = $cfs->Next;
+$include{$_} = not $class->FirstAttribute("Skip-$_") for keys %include;
+
sub de_htmlify {
my $content = shift;
require HTML::TreeBuilder;
@@ -65,7 +85,6 @@
return $content;
}
</%init>
-
<%args>
$Article
-</%args>
+</%args>
\ No newline at end of file
More information about the Rt-commit
mailing list