The following is my Perl code for modifying the Epicenter and Vitals nodelets. The modifications are one part reorganization and two parts subgrouping, to make the ever-increasing number of links in those nodelets easier to browse. There are a number of new files (seven, to be exact) which take advantage of nodeletsection to subgroup links.

Epicenter

[{borgcheck}]

<p>
[%
my $nl = "<br />\n";
my $str;

if (getId($USER)==$HTMLVARS{guest_user}) {
    $str .= htmlcode('minilogin');
} else {
    $str .= linkNode($USER,0,{lastnode_id=>0}) . $nl
          . linkNode($HTMLVARS{userSettings_node},'Preferences') . $nl
          ;
    if(isGod($USER)) {
    # 'Create node' allows gods to create a node of any type
        my ($tmpnode) = getNode('Create node',getType('restricted_superdoc'));    
        $str .= linkNode($$tmpnode{node_id},'Create a Node') . $nl;
    } else {
    # Normal users may only create e2nodes
        my ($tmpnode) = getNode('Create a Node',getType('superdoc'));
        $str .= linkNode(getId($tmpnode),'Create a Node') . $nl;
    }
}
$str .= htmlcode('randomnode','Random Node') . $nl;
$str .= linkNodeTitle('Everything User Search') . $nl; # move this??
$str .= linkNode($NODE,'Log Out',{op=>'logout'}) . $nl
        unless getId($USER)==$HTMLVARS{guest_user};

# for gods only
if(isGod($USER)) {
    $str .= htmlcode('nodeletsection','epi,gods');
}
# for new users, mostly
$str .= htmlcode('nodeletsection','epi,advice');
$str;
%]
</p>

<p>
[%
return if getId($USER) eq $HTMLVARS{default_user};
my $c = $$VARS{cools} || 0;
my $v = $$USER{votesleft} || 0;
if($v =~ /none/i) { $v = 0; } #FIXME check for all digits instead
return unless $c || $v;

my @thingys = ();
if($c) { push @thingys,'<strong>'.$c.'</strong> C!'.($c>1?'s':''); }
if($v) { push @thingys,'<strong>'.$v.'</strong> vote'.($v>1?'s':''); }
'You have ' . join(' and ',@thingys) . ' left today.';
%]
</p>

<p>
[{shownewexp:TRUE}]
</p>

<p align="right">
[{killit}]
[{coolit}]
[{bookmarkit}]
[{goduseroptions}]
<br />[{newsify:165580}]
<br />[{newsify:114,Godsify}]
<br />[{newsify:838015,Edevify,edev}]
<br />[{newsify:923653,Contentify,content editors}]
[%
return;
my $str;
#my $N = getNode('content editors');
#$str .= htmlcode('newsify',$$N{node_id}.',Post');
return unless $str;
#$str = "<br />$str to ".linkNode($N);
%]
</p>

<p align="center">
<small>
[%
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
'server time<br />' 
    . ('Sun','Mon','Tues','Wednes','Thurs','Fri','Satur')[$wday].'day, ' 
    . ('January','February','March','April','May','June','July',
        'August','September','October','November','December')[$mon] 
    . ' ' . $mday . ',' 
    . (1900+$year) 
    . sprintf(" at %02d:%02d:%02d",$hour,$min,$sec);
%]
</small>
</p>

[{randotip}]

episection_gods

my $nl = "<br />\n";
if(isGod($USER)) {
linkNodeTitle('Approved HTML Tags') . $nl
      . linkNodeTitle('The Node Crypt') . $nl
      . linkNodeTitle('System Settings') . $nl 
      ;
}

episection_advice

my $nl = "<br />\n";
'<b>' . linkNodeTitle('Read Me First: Getting Started on E2|Getting Started') . '</b>' . $nl
      . linkNodeTitle('Voting/Experience System') . $nl
      . linkNodeTitle('Everything University') . $nl
      . linkNodeTitle('Everything FAQ') . $nl
      . linkNodeTitle('Tip of the Day') . $nl
      . linkNodeTitle('E2 Mentoring Sign-Up') . $nl
      ;

Vitals

<p>
[%
htmlcode('nodeletsection','vital,noding')
    . htmlcode('nodeletsection','vital,changes')
    . htmlcode('nodeletsection','vital,lists')
    . htmlcode('nodeletsection','vital,useful')
    . htmlcode('nodeletsection','vital,donate')
    ;
%]
</p>

vitalsection_noding

my $nl = "<br />\n";
linkNodeTitle('E2 HTML Tags') . $nl
      . linkNodeTitle('HTML Symbol Reference') . $nl
      . linkNodeTitle('Reference Desk') . $nl
      . linkNodeTitle('E2 Scratch Pad|Scratch Pad') . $nl
      . linkNodeTitle('E2 Source Code Formatter|Source Code Formatter') . $nl
      . linkNodeTitle('Wharfinger\'s Linebreaker') . $nl
      ;

vitalsection_changes

my $nl = "<br />\n";
linkNodeTitle('Broken Nodes') . $nl
      . linkNodeTitle('Edit These E2 Titles|Node Title Edit') . $nl
      . linkNodeTitle('Nodeshells Marked for Destruction|Nodeshell Delete') . $nl
      . linkNodeTitle('E2 Nuke Request|Writeup Delete') . $nl
      . linkNodeTitle('E2 Bugs|Bug Report') . $nl
      . linkNodeTitle('Suggestions for E2') . $nl
      ;

vitalsection_lists

my $nl = "<br />\n";
linkNodeTitle('Everything Email Options|Everything Daily Report') . $nl
      . linkNodeTitle('Everything New Nodes') . $nl
      . linkNodeTitle('Cool Archive') . $nl
      . linkNodeTitle('Page of Cool') . $nl
      . linkNodeTitle('News for Noders. Stuff that Matters.|News for Noders') . $nl
      ;

vitalsection_useful

use Everything::Experience;

my $nl = "<br />\n";
my $str;
$str .= linkNodeTitle('Everything Finger') . $nl
      . linkNodeTitle('Everything Quote Server') . $nl
      . linkNodeTitle('Java Chatterbox') . $nl
      . linkNodeTitle('Message Inbox') . $nl
      . linkNodeTitle('Node Heaven') . $nl
      ;
# $str .= linkNodeTitle('Node Heaven') . $nl if isGod($USER) or getLevel($USER)>=1;
$str;

vitalsection_donate

my $nl = "<br />\n";
$str .= linkNodeTitle('Donation Box') . $nl
      . '<a href="http://everydevel.com/?node=product+listing">EDC Merchandise</a>' . $nl
      ;

In addition, I'd like to suggest changing the (show) and (hide) links in nodeletsection to (+) and (-), which are easy to recognize and won't interfere with the "scanability" of the nodelet (update: this seems to have been implemented recently), as well as extra whitespace before and after open nodeletsections:

nodeletsection

16: return ($$VARS{$param} 17: ? ('<br /><tt>(' . linkNode($NODE,'+',{$param => 0}) . ')</tt> <strong>$field</strong>\n') 18: : ('<p /><tt>(' . linkNode($NODE,'-',{$param => 1}) . ')</tt> <strong>$field</strong><br />\n' . htmlcode($pref.'section_'.$field,'') ) 19: );

The output would look something like this:

(-) title a
link one
link two
link three

(+) title b
(+) title c

(-) title d
link one
link two
link three

(-) title e
link one
link two
link three

Log in or register to write something here or to contact authors.