Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic SideMenue Mod (Read 8492 times)
XTC
Global Moderator
*****
Offline


YaBB 2.6.0/1/11 Mods

Posts: 159
Location: @ustria
Joined: Feb 12th, 2014
Gender: Male
Re: SideMenue Mod
Reply #2 - Jun 21st, 2014 at 8:36pm
Print Post  
Hello

@Dandello

I have found it myself out ....

This code works fine  Smiley

Send the id now with 

Code (Perl)
Select All
                $sidelinklist .=
                  qq~<option value="$sidelinkname">$sidelinkname</option>~; 

 

... and the sub to reorder is

Code (Perl)
Select All
## Save Reorder User SiteMenue Links ##
sub ReorderUserSideMenue2 {
    my $usersidemenue = "$FORM{'sidusername'}";
    my $moveitem = $FORM{'selectlink'};

    if ($moveitem) {
	fopen(FILE,"+<$memberdir/Sidemenue/$usersidemenue.sidem");
		@data = (<FILE>);
		seek(FILE,0,0);
		truncate(FILE,0);

			for ($i=0; $i<scalar(@data); $i++) {
				($sidelinkname,$sideurl,$sideblank) = split(/\|/,$data[$i],3);
				if ($sidelinkname eq $moveitem) {last;}
			}
			if ($FORM{'moveup'} && $i != 0) {
				@twocat = ($data[$i],$data[$i-1]);
				splice(@data,$i-1,2,@twocat);
			}
			elsif ($FORM{'movedown'} && $i != scalar(@data)) {
				@twocat = ($data[$i+1],$data[$i]);
				splice(@data,$i,2,@twocat);
			}
		print {FILE} @data or croak "$croak{'print'} FILE";
	fclose(FILE);
    }


    $yySetLocation = qq~$scripturl?action=sideusermenuepanel;username=$usersidemenue~;
    redirectexit();
    return;
} 



Thx lg XTC
  

Back to top
 
IP Logged
 
Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 1759
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Re: SideMenue Mod
Reply #1 - Jun 21st, 2014 at 2:45pm
Print Post  
I won't have time until Monday or so. But I'll look.  Wink
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
XTC
Global Moderator
*****
Offline


YaBB 2.6.0/1/11 Mods

Posts: 159
Location: @ustria
Joined: Feb 12th, 2014
Gender: Male
SideMenue Mod
Jun 21st, 2014 at 2:29pm
Print Post  
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  Shocked

The test input look like this ....

Code (Perl)
Select All
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.

Code (Perl)
Select All
    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.

Code (Perl)
Select All
## 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  Smiley

lg XTC
« Last Edit: Jun 21st, 2014 at 3:32pm by XTC »  

Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint