[Rt-commit] rt branch, 4.2/article-create, repushed
Alex Vandiver
alexmv at bestpractical.com
Wed Mar 4 15:54:16 EST 2015
The branch 4.2/article-create was deleted and repushed:
was 3b35d737121f95746e09a90da11707129c44d867
now 4e4eda15f8e6dabb0eac1e3cb962e56265fb6028
1: bcf0ba4 < -: ------- Simplify ->Next logic
2: f6454b9 ! 1: c122647 Distinguish between "no classes exist" and "none visible to user"
@@ -1,6 +1,8 @@
Author: Alex Vandiver <alexmv at bestpractical.com>
Distinguish between "no classes exist" and "none visible to user"
+
+ Fixes: I#30638
diff --git a/share/html/Articles/Article/PreCreate.html b/share/html/Articles/Article/PreCreate.html
--- a/share/html/Articles/Article/PreCreate.html
@@ -35,3 +37,69 @@
+my $classes_configured = $Classes->Count;
+</%init>
+diff --git a/share/html/Articles/Article/Search.html b/share/html/Articles/Article/Search.html
+--- a/share/html/Articles/Article/Search.html
++++ b/share/html/Articles/Article/Search.html
+@@
+ <& /Elements/Tabs &>
+
+ % unless ( keys %ARGS ) {
+-% my $Classes = RT::Classes->new($session{'CurrentUser'});
+-% $Classes->LimitToEnabled();
+ <table width="100%" border="0">
+ <tr>
+ <td valign="top" width="50%">
+-<%perl>
+-if (not $Classes->First) {
+- $m->comp("/Articles/Elements/NeedsSetup");
+-} else {
+- $Classes->GotoFirstItem; # Reset for loop below
+-}
+-</%perl>
++% if (not $classes_configured) {
++<& /Articles/Elements/NeedsSetup &>
++% } elsif (not @classes) {
++<i><&|/l&>You don't have permission to view Articles in any Class</&></i>
++% } else {
+ <ul>
+-% while (my $class = $Classes->Next) {
++% for my $class (@classes) {
+ <li><a href="<%RT->Config->Get('WebPath')%>/Articles/Article/Search.html?<% $m->comp('/Elements/QueryString', %filtered, Class => $class->id) %>"><&|/l, $class->Name&>in class [_1]</&></a></li>
+-% }
++% }
+ </ul>
++% }
+ </td>
+ <td valign="top" width="50%">
+ <form action="Search.html" method="get">
+@@
+ <a href="<%RT->Config->Get('WebPath')%>/Articles/Article/Search.html<%$QueryString%>"><&|/l&>Bookmarkable link for this search</&></a><br />
+ </div>
+ <%init>
++my $Classes = RT::Classes->new($session{'CurrentUser'});
++$Classes->LimitToEnabled();
++
++# This is a COUNT(), which doesn't apply ACLs; as such, we don't display
++# the warning if there are classes, but the user can't see them.
++my $classes_configured = $Classes->Count;
++my @classes = @{ $Classes->ItemsArrayRef };
++
+ use RT::SavedSearch;
+ my @results;
+ my $articles = RT::Articles->new( $session{'CurrentUser'} );
+
+diff --git a/share/html/Articles/Elements/MaybeNeedsSetup b/share/html/Articles/Elements/MaybeNeedsSetup
+--- a/share/html/Articles/Elements/MaybeNeedsSetup
++++ b/share/html/Articles/Elements/MaybeNeedsSetup
+@@
+ <%init>
+ my $Classes = RT::Classes->new( $session{'CurrentUser'} );
+ $Classes->LimitToEnabled();
+-$Classes->RowsPerPage(1);
+-return if $Classes->First;
++# This is a COUNT(), which doesn't apply ACLs; as such, we don't display
++# the warning if there are classes, but the user can't see them.
++return if $Classes->Count;
+ </%init>
+ <& NeedsSetup &>
+
3: a3c49b3 = 2: 5209d26 Limit the listing to classes with CreateArticle
4: 8bde325 = 3: c41f11b Provide a better message if there are no potential classes to create in
5: 3b35d73 ! 4: 4e4eda1 Skip the Class selection page if there is only one valid option
@@ -2,7 +2,7 @@
Skip the Class selection page if there is only one valid option
- Partially resolves I#29975
+ Fixes: I#29975
diff --git a/share/html/Articles/Article/PreCreate.html b/share/html/Articles/Article/PreCreate.html
--- a/share/html/Articles/Article/PreCreate.html
@@ -19,3 +19,15 @@
+ Arguments => { Class => $classes[0]->id },
+) if @classes == 1;
</%init>
+
+diff --git a/share/html/Articles/Article/Search.html b/share/html/Articles/Article/Search.html
+--- a/share/html/Articles/Article/Search.html
++++ b/share/html/Articles/Article/Search.html
+@@
+ # the warning if there are classes, but the user can't see them.
+ my $classes_configured = $Classes->Count;
+ my @classes = @{ $Classes->ItemsArrayRef };
++$ARGS{Class} = $classes[0]->id if @classes == 1;
+
+ use RT::SavedSearch;
+ my @results;
More information about the rt-commit
mailing list