Author: dom
Date: 2005-06-05 18:20:22 +0100 (Sun, 05 Jun 2005)
New Revision: 645
Modified:
trunk/Changes
trunk/README.CSS
trunk/templates/wanted_pages.tt
trunk/wiki.cgi
Log:
Display number of linking nodes in wanted pages list (RT #9286).
Modified: trunk/Changes
===================================================================
--- trunk/Changes 2005-06-02 22:42:31 UTC (rev 644)
+++ trunk/Changes 2005-06-05 17:20:22 UTC (rev 645)
@@ -22,6 +22,8 @@
natural commas; change "locale" to "locales" in label.
Replace <label> tags in display_metadata.tt with <span
class="metadata_label">.
+ Wanted pages listing now displays, and sorts by, the number of nodes
+ pointing to each node.
0.47 15 January 2005
Fixed bug with list_all_versions for nodes with only one version.
Modified: trunk/README.CSS
===================================================================
--- trunk/README.CSS 2005-06-02 22:42:31 UTC (rev 644)
+++ trunk/README.CSS 2005-06-05 17:20:22 UTC (rev 645)
@@ -263,3 +263,7 @@
div#redirect_message
Used in: node.tt
Purpose: A short message indicating that your reached a node via a redirect
+
+table#wanted_pages
+ Used in: wanted_pages.tt
+ Purpose: A list of all unlinked nodes
Modified: trunk/templates/wanted_pages.tt
===================================================================
--- trunk/templates/wanted_pages.tt 2005-06-02 22:42:31 UTC (rev 644)
+++ trunk/templates/wanted_pages.tt 2005-06-05 17:20:22 UTC (rev 645)
@@ -7,15 +7,18 @@
<p>
These are nodes which have been linked to but do not yet exist.
</p>
-<ul>
+<table id="wanted_pages">
+<tr><th>Node name</th><th>Number of backlinks</th><th>Action</th></tr>
[% FOREACH node = wanted %]
- <li>[% node.name %] ......
- [<a href="[% node.edit_link %]"><b>Create</b></a>]
- ......
- [<a href="[% node.backlink_link %]">Show nodes linking to this</a>]
- </li>
+ <tr>
+ <td>[% node.name %]</td>
+ <td>[% node.backlinks_count %]</td>
+ <td><a href="[% node.backlink_link %]">Show linking nodes</a>
+ or <a href="[% node.edit_link %]">Create node</a>
+ </td>
+ </tr>
[% END %]
-</ul>
+</table>
</div>
[% INCLUDE footer.tt %]
Modified: trunk/wiki.cgi
===================================================================
--- trunk/wiki.cgi 2005-06-02 22:42:31 UTC (rev 644)
+++ trunk/wiki.cgi 2005-06-05 17:20:22 UTC (rev 645)
@@ -294,9 +294,12 @@
sub show_wanted_pages {
my @dangling = $wiki->list_dangling_links;
- @dangling = sort @dangling;
my @wanted;
+ my %backlinks_count;
foreach my $node_name (@dangling) {
+ $backlinks_count{$node_name} = scalar($wiki->list_backlinks( node => $node_name ));
+ }
+ foreach my $node_name (sort { $backlinks_count{$b} <=> $backlinks_count{$a} } @dangling) {
my $node_param =
uri_escape($formatter->node_name_to_node_param($node_name));
push @wanted, {
@@ -304,7 +307,8 @@
edit_link => $script_url . uri_escape($script_name)
. "?action=edit;id=$node_param",
backlink_link => $script_url . uri_escape($script_name)
- . "?action=show_backlinks;id=$node_param"
+ . "?action=show_backlinks;id=$node_param",
+ backlinks_count => $backlinks_count{$node_name}
};
}
process_template( "wanted_pages.tt",