Hello
I work on the Sidemenu Mod (have make this for many years for yabb 1.3/1.4) ... now i bring it back with new functions to YaBB 2.6.0
A screen you can see here
http://www.xonder.com/cgi-bin/yabb26/YaBB.pl?num=1403094838 The finalstatus is ~ 90 %
I have
only one problem with
reorder Sidemenue Links ... and i hope you can help me with this code.
It works with my old code (Copy & Paste) .... but i want make it with "moveup" and "movedown" Button like "Reorder Category". Can you take a look of my code ... why this not work
The test input look like this ....
test2|http://www.xonder.at|0
test1|http://www.xonder.at|0
test3|http://www.xonder.com|0
To display the Reorder Links (same as Reorder Category) is this one.
if ( @sidemenuelist > 1 ) {
$catcnt = @sidemenuelist;
$catnum = $catcnt;
if ( $catcnt < 4 ) { $catcnt = 4; }
$sidelinklist =
qq~<select name="selectlink" id="selectlink" size="$catcnt" style="width: 190px;">~;
foreach my $category (@sidemenuelist) {
chomp $category;
( $sidelinkname, undef, undef ) = split /\|/xsm, $category, 2;
ToChars($sidelinkname);
$sidelinklist .=
qq~<option value="$category">$sidelinkname</option>~;
}
$sidelinklist .= q~</select>~;
}
$yymain .= qq~
<br /><br />
<form action="$scripturl?action=reorderusersidemenue2" method="post" accept-charset="$yymycharset">
<input type="hidden" name="sidusername" value="$INFO{'username'}">
<table class="bordercolor border-space pad-cell" style="width:525px">
<tr>
<td class="titlebg">$admin_img{'board'} <b>$sidemenuetxt{'16'}</b></td>
</tr><tr>
<td class="windowbg">~;
if ( $catnum > 1 ) {
$yymain .= qq~
<div style="float: left; width: 280px; text-align: left; margin-bottom: 4px;" class="small"><label for="selectlink">$admin_txt{'738'}</label></div>
<div style="float: left; width: 230px; text-align: center; margin-bottom: 4px;">$sidelinklist</div>
<div style="float: left; width: 280px; text-align: left; margin-bottom: 4px;" class="small">$admin_txt{'738a'}</div>
<div style="float: left; width: 230px; text-align: center; margin-bottom: 4px;">
<input type="submit" value="<-" name="moveup" style="font-size: 11px; width: 95px;" class="button" />
<input type="submit" value="->" name="movedown" style="font-size: 11px; width: 95px;" class="button" />
</div>~;
}
else {
$yymain .= qq~
<div class="small" style="text-align: center; margin-bottom: 4px;">$admin_txt{'738b'}</div>~;
}
$yymain .= q~
</td>
</tr>
</table>
</form>
~;
... and here te sub to reorder ... but the Links are always placed on the same point.
## Save Reorder User SiteMenue Links ##
sub ReorderUserSideMenue2 {
my $usersidemenue = "$FORM{'sidusername'}";
my $moveitem = $FORM{'selectlink'};
fopen( SIDEFILE, "$memberdir/Sidemenue/$usersidemenue.sidem" );
my @sidemenue = <SIDEFILE>;
fclose(SIDEFILE);
if ($moveitem) {
if ( $FORM{'moveup'} ) {
for my $i ( 0 .. ( @sidemenue - 1 ) ) {
if ( $sidemenue[$i] eq $moveitem && $i > 0 ) {
$j = $i - 1;
$sidemenue[$i] = $sidemenue[$j];
$sidemenue[$j] = $moveitem;
last;
}
}
}
elsif ( $FORM{'movedown'} ) {
for my $i ( 0 .. ( @sidemenue - 1 ) ) {
if ( $sidemenue[$i] eq $moveitem && $i < $#sidemenue ) {
$j = $i + 1;
$sidemenue[$i] = $sidemenue[$j];
$sidemenue[$j] = $moveitem;
last;
}
}
}
# Print sidemenuelink to file
fopen( SIDEFILE, ">$memberdir/Sidemenue/$usersidemenue.sidem" );
print {SIDEFILE} @sidemenue or croak "$croak{'print'} SIDEFILE";
fclose(SIDEFILE);
}
$yySetLocation = qq~$scripturl?action=sideusermenuepanel;username=$usersidemenue~;
redirectexit();
return;
}
@Dandello ... can you help me
lg XTC