Page Index Toggle Pages: 1 ReplyAdd Poll Send Topic
Normal Topic SideMenue Mod (Read 8007 times)
 
Paste Member Name in Quick Reply Box XTC
Global Moderator
*****
Offline


YaBB 2.6.0/1/11 Mods

Posts: 174
Location: @ustria
Joined: Feb 12th, 2014
Gender: Male
Mood: Freaky
Zodiac sign: Aquarius
SideMenue Mod
Jun 21st, 2014 at 2:29pm
Mark & QuoteQuote  
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| 



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
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
YaBB Modder
*****
Offline


I love YaBB 2.7!

Posts: 2234
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: SideMenue Mod
Reply #1 - Jun 21st, 2014 at 2:45pm
Mark & QuoteQuote  
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
 
Paste Member Name in Quick Reply Box XTC
Global Moderator
*****
Offline


YaBB 2.6.0/1/11 Mods

Posts: 174
Location: @ustria
Joined: Feb 12th, 2014
Gender: Male
Mood: Freaky
Zodiac sign: Aquarius
Re: SideMenue Mod
Reply #2 - Jun 21st, 2014 at 8:36pm
Mark & QuoteQuote  
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
 
Page Index Toggle Pages: 1
ReplyAdd Poll Send Topic
Bookmarks: del.icio.us Digg Facebook Google LinkedIn reddit Twitter Yahoo
SideMenue Mod

Please type the characters exactly as they appear in the image,
without the first 2 and last 2 characters.
The characters must be typed in the same order,
and they are case-sensitive.
Open Preview Preview

You can resize the textbox by dragging the right or bottom border.
Off Topic Comment Insert Spoiler
Insert Hyperlink Insert FTP Link Insert Image Insert E-mail Insert Media Insert Table Insert Table Row Insert Table Column Insert Horizontal Rule Insert Teletype Insert Code Insert Quote Edited Superscript Subscript Insert List /me - my name Insert Marquee Insert Timestamp No Parse
Bold Italicized Underline Insert Strikethrough Highlight
                       
Change Text Color
Insert Preformatted Text Left Align Centered Right Align
resize_wb
resize_hb







Max 5000 characters. Remaining characters:
Text size: %
More Smilies
View All Smilies
Collapse additional features Collapse/Expand additional features Smiley Wink Cheesy Grin Angry Sad Shocked Cool Huh Roll Eyes Tongue Embarrassed Lips Sealed Undecided Kiss Cry