[Rt-commit] r4599 - in rtfm/branches/2.1-TESTING: .
etc/upgrade/2.2.0RC2 html/Admin/RTFM/Classes
html/Callbacks/RTFM/Ticket/Update.html lib/RT/FM
alexmv at bestpractical.com
alexmv at bestpractical.com
Tue Feb 28 05:34:55 EST 2006
Author: alexmv
Date: Tue Feb 28 05:34:54 2006
New Revision: 4599
Added:
rtfm/branches/2.1-TESTING/etc/upgrade/2.2.0RC2/
rtfm/branches/2.1-TESTING/etc/upgrade/2.2.0RC2/acl.Oracle
rtfm/branches/2.1-TESTING/etc/upgrade/2.2.0RC2/acl.Pg
rtfm/branches/2.1-TESTING/etc/upgrade/2.2.0RC2/acl.mysql
rtfm/branches/2.1-TESTING/etc/upgrade/2.2.0RC2/content
rtfm/branches/2.1-TESTING/etc/upgrade/2.2.0RC2/schema.Oracle
rtfm/branches/2.1-TESTING/etc/upgrade/2.2.0RC2/schema.Pg
rtfm/branches/2.1-TESTING/etc/upgrade/2.2.0RC2/schema.mysql
Modified:
rtfm/branches/2.1-TESTING/ (props changed)
rtfm/branches/2.1-TESTING/etc/schema.Oracle
rtfm/branches/2.1-TESTING/etc/schema.Pg
rtfm/branches/2.1-TESTING/etc/schema.mysql
rtfm/branches/2.1-TESTING/html/Admin/RTFM/Classes/Modify.html
rtfm/branches/2.1-TESTING/html/Callbacks/RTFM/Ticket/Update.html/BeforeMessageBox
rtfm/branches/2.1-TESTING/lib/RT/FM/Class.pm
Log:
r9354 at zoq-fot-pik: chmrr | 2006-02-28 05:34:44 -0500
* Hotlisting functionality
Modified: rtfm/branches/2.1-TESTING/etc/schema.Oracle
==============================================================================
--- rtfm/branches/2.1-TESTING/etc/schema.Oracle (original)
+++ rtfm/branches/2.1-TESTING/etc/schema.Oracle Tue Feb 28 05:34:54 2006
@@ -10,7 +10,8 @@
Creator NUMBER(11,0) DEFAULT 0 NOT NULL,
Created DATE,
LastUpdatedBy NUMBER(11,0) DEFAULT 0 NOT NULL,
-LastUpdated DATE
+LastUpdated DATE,
+HotList NUMBER(11,0) DEFAULT 0 NOT NULL
);
CREATE SEQUENCE FM_Articles_seq;
Modified: rtfm/branches/2.1-TESTING/etc/schema.Pg
==============================================================================
--- rtfm/branches/2.1-TESTING/etc/schema.Pg (original)
+++ rtfm/branches/2.1-TESTING/etc/schema.Pg Tue Feb 28 05:34:54 2006
@@ -4,11 +4,12 @@
Name varchar(255) NOT NULL DEFAULT '',
Description varchar(255) NOT NULL DEFAULT '',
SortOrder integer NOT NULL DEFAULT 0,
-Disabled smallint not null default '0',
+Disabled smallint NOT NULL DEFAULT 0,
Creator integer NOT NULL DEFAULT 0,
Created TIMESTAMP NULL,
LastUpdatedBy integer NOT NULL DEFAULT 0,
LastUpdated TIMESTAMP NULL,
+HotList smallint NOT NULL DEFAULT 0,
PRIMARY KEY (id)
);
Modified: rtfm/branches/2.1-TESTING/etc/schema.mysql
==============================================================================
--- rtfm/branches/2.1-TESTING/etc/schema.mysql (original)
+++ rtfm/branches/2.1-TESTING/etc/schema.mysql Tue Feb 28 05:34:54 2006
@@ -4,11 +4,12 @@
Name varchar(255) NOT NULL DEFAULT '',
Description varchar(255) NOT NULL DEFAULT '',
SortOrder integer NOT NULL DEFAULT 0,
-Disabled int(2) not null default '0',
+Disabled int(2) NOT NULL DEFAULT 0,
Creator integer NOT NULL DEFAULT 0,
Created DATETIME NULL,
LastUpdatedBy integer NOT NULL DEFAULT 0,
LastUpdated DATETIME NULL,
+HotList int(2) NOT NULL DEFAULT 0,
PRIMARY KEY (id)
) TYPE=InnoDB;
Added: rtfm/branches/2.1-TESTING/etc/upgrade/2.2.0RC2/acl.Oracle
==============================================================================
--- (empty file)
+++ rtfm/branches/2.1-TESTING/etc/upgrade/2.2.0RC2/acl.Oracle Tue Feb 28 05:34:54 2006
@@ -0,0 +1,4 @@
+sub acl {
+ return ();
+}
+1;
Added: rtfm/branches/2.1-TESTING/etc/upgrade/2.2.0RC2/acl.Pg
==============================================================================
--- (empty file)
+++ rtfm/branches/2.1-TESTING/etc/upgrade/2.2.0RC2/acl.Pg Tue Feb 28 05:34:54 2006
@@ -0,0 +1,4 @@
+sub acl {
+ return ();
+}
+1;
Added: rtfm/branches/2.1-TESTING/etc/upgrade/2.2.0RC2/acl.mysql
==============================================================================
--- (empty file)
+++ rtfm/branches/2.1-TESTING/etc/upgrade/2.2.0RC2/acl.mysql Tue Feb 28 05:34:54 2006
@@ -0,0 +1,4 @@
+sub acl {
+ return ();
+}
+1;
Added: rtfm/branches/2.1-TESTING/etc/upgrade/2.2.0RC2/content
==============================================================================
--- (empty file)
+++ rtfm/branches/2.1-TESTING/etc/upgrade/2.2.0RC2/content Tue Feb 28 05:34:54 2006
@@ -0,0 +1,2 @@
+# nothing to do
+1;
Added: rtfm/branches/2.1-TESTING/etc/upgrade/2.2.0RC2/schema.Oracle
==============================================================================
--- (empty file)
+++ rtfm/branches/2.1-TESTING/etc/upgrade/2.2.0RC2/schema.Oracle Tue Feb 28 05:34:54 2006
@@ -0,0 +1 @@
+ALTER TABLE FM_Classes ADD HotList NUMBER(11,0) DEFAULT 0 NOT NULL;
Added: rtfm/branches/2.1-TESTING/etc/upgrade/2.2.0RC2/schema.Pg
==============================================================================
--- (empty file)
+++ rtfm/branches/2.1-TESTING/etc/upgrade/2.2.0RC2/schema.Pg Tue Feb 28 05:34:54 2006
@@ -0,0 +1,4 @@
+ALTER TABLE FM_Classes ADD COLUMN HotList smallint(11,0);
+UPDATE FM_Classes SET HotList = 0;
+ALTER TABLE FM_Classes ALTER COLUMN HotList SET DEFAULT 0;
+ALTER TABLE FM_Classes ALTER COLUMN HotList SET NOT NULL;
Added: rtfm/branches/2.1-TESTING/etc/upgrade/2.2.0RC2/schema.mysql
==============================================================================
--- (empty file)
+++ rtfm/branches/2.1-TESTING/etc/upgrade/2.2.0RC2/schema.mysql Tue Feb 28 05:34:54 2006
@@ -0,0 +1 @@
+ALTER TABLE FM_Classes ADD COLUMN HotList int(2) NOT NULL DEFAULT 0;
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 Tue Feb 28 05:34:54 2006
@@ -20,35 +20,29 @@
$current_subtab, Title => $title &>
<& /Elements/ListActions, actions => \@results &>
-
-
-
-
-<FORM ACTION="<%$RT::WebPath%>/Admin/RTFM/Classes/Modify.html" METHOD=POST>
+<form action="<%$RT::WebPath%>/Admin/RTFM/Classes/Modify.html" method="POST">
+<input type="hidden" name="Submitted" value="1">
%if ($Create ) {
-<INPUT TYPE=HIDDEN NAME=id VALUE="new">
+<input type="hidden" name="id" value="new" />
% } else {
-<INPUT TYPE=HIDDEN NAME=id VALUE="<%$ClassObj->Id%>">
+<input type="hidden" name="id" value="<%$ClassObj->Id%>" />
% }
-<TABLE>
-<TR><TD ALIGN=RIGHT>
-<&|/l&>Class Name</&>:
-</TD>
-<TD><INPUT name="Name" value="<% $Create ? "" : $ClassObj->Name %>"></TD>
-</TR><TR>
-<TD ALIGN=RIGHT>
-<&|/l&>Description</&>:</TD><TD COLSPAN=3><INPUT name="Description" value="<% $Create ? "" : $ClassObj->Description %>" size=60></TD></TR>
-<TR>
-<TR>
-<TD>
-</TD>
-<TD COLSPAN=4><INPUT TYPE=HIDDEN NAME="SetEnabled" VALUE="1">
-<INPUT TYPE=CHECKBOX NAME="Enabled" VALUE="1" <%$EnabledChecked%>> <&|/l&>Enabled (Unchecking this box disables this Class)</&><BR>
-</TD>
-</TR>
-</TABLE>
-
+<table>
+<tr>
+<td align="right"><&|/l&>Class Name</&>: </td>
+<td><input name="Name" value="<% $Create ? "" : $ClassObj->Name %>" /></td>
+</tr><tr>
+<td align="right"><&|/l&>Description</&>:</TD>
+<td><input name="Description" value="<% $Create ? "" : $ClassObj->Description %>" size=60></td>
+</tr><tr>
+<td> </td>
+<td><input type="checkbox" name="Enabled" value="1" <%$EnabledChecked%>> <&|/l&>Enabled (Unchecking this box disables this Class)</&></td>
+</tr><tr>
+<td> </td>
+<td><input type="checkbox" name="HotList" value="1" <%$HotListChecked%>> <&|/l&>All articles in this topic are on dropdown on ticket reply page</&></td>
+</tr>
+</table>
<h3>When inserting articles in this class into emails:</h3>
<ul>
@@ -70,67 +64,47 @@
<%INIT>
my $ClassObj = new RT::FM::Class($session{'CurrentUser'});
-my ($title, @results, $Disabled, $EnabledChecked);
+my ($title, @results, $Disabled);
if ($Create) {
$title = loc("Create a Class");
-}
-
-else {
+} else {
if ($id eq 'new') {
- my ($val, $msg) = $ClassObj->Create(Name => $Name);
- if ($val == 0 ) {
- $m->comp("/RTFM/Elements/Error", Why => "$msg");
- }
- else {
- push @results, $msg;
- }
- }
- else {
+ my ($val, $msg) = $ClassObj->Create(Name => $Name);
+ if ($val == 0 ) {
+ $m->comp("/RTFM/Elements/Error", Why => "$msg");
+ } else {
+ push @results, $msg;
+ }
+ } else {
$ClassObj->Load($id) || $ClassObj->Load($Name) || $m->comp("/RTFM/Elements/Error", Why => "Couldn't load class '$Name'");
}
- $title = loc('Editing Configuration for Class [_1]', $ClassObj->Name);
-
+ $title = loc('Editing Configuration for Class [_1]', $ClassObj->Name);
}
-if ($ClassObj->Id()) {
-my @attribs= qw(Description Name);
-
- @results = UpdateRecordObject( AttributesRef => \@attribs,
- Object => $ClassObj,
- ARGSRef => \%ARGS);
+if ($ClassObj->Id()) {
+ $ARGS{HotList} ||= 0 if $Submitted;
+ my @attribs= qw(Description Name HotList);
+ @results = UpdateRecordObject( AttributesRef => \@attribs,
+ Object => $ClassObj,
+ ARGSRef => \%ARGS);
}
#we're asking about enabled on the web page but really care about disabled.
if ($Enabled == 1 or (not defined $Enabled and $Create)) {
$Disabled = 0;
-}
-else {
+} else {
$Disabled = 1;
}
-if ( ($SetEnabled) and ( $Disabled != $ClassObj->Disabled) ) {
- my ($code, $msg) = $ClassObj->SetDisabled($Disabled);
- push @results, loc('Enabled status [_1]', loc_fuzzy($msg));
-}
-
-unless ($Create ? $Disabled : $ClassObj->Disabled()) {
- $EnabledChecked ="CHECKED";
-}
-
-my $current_subtab;
-if ($Create == 1) {
- $current_subtab = "Admin/RTFM/Classes/Modify.html?Create=1";
-
-} else {
- $current_subtab = "Admin/RTFM/Classes/Modify.html?id=$id";
-
-}
my %include = (Name => 1, Summary => 1);
my $cfs = $ClassObj->ArticleCustomFields;
$include{"CF-Title-".$_->Id} = $include{"CF-Value-".$_->Id} = 1 while $_ = $cfs->Next;
-if ($SetEnabled) {
+if ( ($Submitted) and ( $Disabled != $ClassObj->Disabled) ) {
+ my ($code, $msg) = $ClassObj->SetDisabled($Disabled);
+ push @results, loc('Enabled status [_1]', loc_fuzzy($msg));
+
for (keys %include) {
if ($ARGS{"Include-$_"}) {
$ClassObj->DeleteAttribute("Skip-$_");
@@ -142,6 +116,16 @@
$include{$_} = not $ClassObj->FirstAttribute("Skip-$_") for keys %include;
$include{$_} = $include{$_} ? " CHECKED" : "" for keys %include;
+
+my $EnabledChecked = ($Create ? $Disabled : $ClassObj->Disabled()) ? "" : "CHECKED";
+my $HotListChecked = $ClassObj->HotList ? "CHECKED" : "";
+
+my $current_subtab;
+if ($Create == 1) {
+ $current_subtab = "Admin/RTFM/Classes/Modify.html?Create=1";
+} else {
+ $current_subtab = "Admin/RTFM/Classes/Modify.html?id=$id";
+}
</%INIT>
@@ -151,6 +135,6 @@
$Name => undef
$Create => undef
$Description => undef
-$SetEnabled => undef
+$Submitted => undef
$Enabled => undef
</%ARGS>
Modified: rtfm/branches/2.1-TESTING/html/Callbacks/RTFM/Ticket/Update.html/BeforeMessageBox
==============================================================================
--- rtfm/branches/2.1-TESTING/html/Callbacks/RTFM/Ticket/Update.html/BeforeMessageBox (original)
+++ rtfm/branches/2.1-TESTING/html/Callbacks/RTFM/Ticket/Update.html/BeforeMessageBox Tue Feb 28 05:34:54 2006
@@ -34,14 +34,21 @@
<td><input size=20 name="RTFM_Content"></td>
</tr>
<tr>
-<td><&|/l&>Include RTFM article:</&></td><td><input size=20 name="RTFM-Include-Article-Named"></td><td><input type=submit value="Go"></td>
+<td><&|/l&>Include RTFM article:</&></td><td><input size=20 name="RTFM-Include-Article-Named"></td><td><input type="submit" value="Go"></td>
</tr>
+% if ($hotlist->Count) {
+<tr><td> </td><td><select name="RTFM-Include-Article-Named-Hotlist">
+% while (my $article = $hotlist->Next) {
+<option value="<% $article->Id %>"><%$article->Name|| loc('(no name)')%>: <%$article->Summary%></option>
+% }
+</select></td><td><input type="submit" value="Go"></td></tr>
+% }
% while (my $article = $articles_content->Next) {
-<tr><td> </td><td><%$article->Name|| loc('(no name)')%>: <%$article->Summary%></td><td><input type=submit name="RTFM-Include-Article-<%$article->Id%>" value="Go"></td></tr>
-%}
+<tr><td> </td><td><%$article->Name|| loc('(no name)')%>: <%$article->Summary%></td><td><input type="submit" name="RTFM-Include-Article-<%$article->Id%>" value="Go"></td></tr>
+% }
% while (my $article = $articles_basics->Next) {
-<tr><td> </td><td><%$article->Name || loc('(no name)')%>: <%$article->Summary%></td><td><input type=submit name="RTFM-Include-Article-<%$article->Id%>" value="Go"></td></tr>
-%}
+<tr><td> </td><td><%$article->Name || loc('(no name)')%>: <%$article->Summary%></td><td><input type="submit" name="RTFM-Include-Article-<%$article->Id%>" value="Go"></td></tr>
+% }
</table>
<%init>
use RT::FM::ArticleCollection;
@@ -64,4 +71,13 @@
VALUE => $ARGS{'RTFM_Content'},
ENTRYAGGREGATOR => "OR" );
}
+
+my $hotlist = RT::FM::ArticleCollection->new( $session{'CurrentUser'} );
+my $classes = $hotlist->Join(
+ ALIAS1 => 'main',
+ FIELD1 => 'Class',
+ TABLE2 => 'FM_Classes',
+ FIELD2 => 'id',
+);
+$hotlist->Limit( ALIAS => $classes, FIELD => 'HotList', VALUE => 1 );
</%init>
Modified: rtfm/branches/2.1-TESTING/lib/RT/FM/Class.pm
==============================================================================
--- rtfm/branches/2.1-TESTING/lib/RT/FM/Class.pm (original)
+++ rtfm/branches/2.1-TESTING/lib/RT/FM/Class.pm Tue Feb 28 05:34:54 2006
@@ -46,6 +46,7 @@
varchar(255) 'Description'.
int(11) 'SortOrder'.
int(2) 'Disabled'.
+ int(2) 'HotList'.
=cut
@@ -59,6 +60,7 @@
Description => '',
SortOrder => '0',
Disabled => '0',
+ HotList => '0',
@_);
$self->SUPER::Create(
@@ -66,6 +68,7 @@
Description => $args{'Description'},
SortOrder => $args{'SortOrder'},
Disabled => $args{'Disabled'},
+ HotList => $args{'HotList'},
);
}
@@ -153,6 +156,24 @@
=cut
+=item HotList
+
+Returns the current value of HotList.
+(In the database, HotList is stored as int(2).)
+
+
+
+=item SetHotList VALUE
+
+
+Set HotList to VALUE.
+Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
+(In the database, HotList will be stored as a int(2).)
+
+
+=cut
+
+
=item Creator
Returns the current value of Creator.
@@ -203,6 +224,8 @@
{read => 1, write => 1, type => 'int(11)', default => '0'},
Disabled =>
{read => 1, write => 1, type => 'int(2)', default => '0'},
+ HotList =>
+ {read => 1, write => 1, type => 'int(2)', default => '0'},
Creator =>
{read => 1, auto => 1, type => 'int(11)', default => '0'},
Created =>
More information about the Rt-commit
mailing list