Problem with sorting articles and structure items

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
Pixelchaos
Posts: 17
Joined: Wed 25. Aug 2004, 14:04
Contact:

Problem with sorting articles and structure items

Post by Pixelchaos »

Hi,

I'm using phpwcms for almost two years now on a fairly big website. It's got about 250 pages and 70 structure items. At the moment I'm running 1.2.5DEV.

The problem is with sorting the articles and structure items. It started with non-admins not being able to move articles or conent parts up or down in a list. Now even as an admin I can't do it. Same goes for the structure items. They move, but totally unpredictable. If I click the small arrow "up" 10 times the structure item goes down 5 times and then up 1 time.

Is there a solution for this problem? Or is my website too big for PHPwcms?
pepe
Posts: 3954
Joined: Mon 19. Jan 2004, 13:46

Post by pepe »

As workaround, you can CUT & PASTE the articles :idea:
User avatar
StudioZ
Posts: 802
Joined: Fri 28. May 2004, 19:57
Location: Québec, Canada
Contact:

Post by StudioZ »

Samething here :roll:
Wish we can find the problem...
Pretty hard to find this gremlin :?
Image
PhpWCMS Evangelist, -- iRoutier.com Running phpWCMS 1.4.2, r354 -> Great Version!!!!
User avatar
StudioZ
Posts: 802
Joined: Fri 28. May 2004, 19:57
Location: Québec, Canada
Contact:

Post by StudioZ »

Customers are back again on me with:
Do you have a solution for this bug?

This is getting pretty annoying :roll: :oops:
Image
PhpWCMS Evangelist, -- iRoutier.com Running phpWCMS 1.4.2, r354 -> Great Version!!!!
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

Does this mean that any "single" click does not ALWAYS produce the correct direction of movement?
Or only clicks in "rapid" fashion cause improper movements?
User avatar
StudioZ
Posts: 802
Joined: Fri 28. May 2004, 19:57
Location: Québec, Canada
Contact:

Post by StudioZ »

Hi DeXXus :wink:
I mean: 'any "single" click does not ALWAYS produce the correct movement' + on long lists of content parts, then the ones at the bottom get stucked there without the possibility to move them up or down. Also I heard about unpredictable movements (using arrows). I myself seen this behavior but in Admin menu, not in content parts listings.
DeXXus wrote:Does this mean that any "single" click does not ALWAYS produce the correct direction of movement?
Or only clicks in "rapid" fashion cause improper movements?
Cheers, :roll:
Image
PhpWCMS Evangelist, -- iRoutier.com Running phpWCMS 1.4.2, r354 -> Great Version!!!!
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

Looks like the author of the javascript corrected a bug:
Download and replace the "original" with the updated file HERE and give it a go!

http://www.mattkruse.com/javascript/sel ... ource.html
// HISTORY
// ------------------------------------------------------------------
// April 20, 2005: Fixed the removeSelectedOptions() function to
// correctly handle single selects
// June 12, 2003: Modified up and down functions to support more than
// one selected option
/*
User avatar
StudioZ
Posts: 802
Joined: Fri 28. May 2004, 19:57
Location: Québec, Canada
Contact:

Post by StudioZ »

Thank you DeXXus for that reasearch :wink:
Could have had worked but... I gave it a try by swapping my customer's Java Script file: include\inc_js\selectbox.js
with the one at the link you kindly provided me... still... no success. :roll:
Same issue. Won't move Up or Down when in article information
detailed content parts listing
as opposed to the Article menu: simple content parts listing +

Where in the world did you found this updated Java Script? :shock: :lol:

Cheers,
Image
PhpWCMS Evangelist, -- iRoutier.com Running phpWCMS 1.4.2, r354 -> Great Version!!!!
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

StudioZ wrote:Where in the world did you found this updated Java Script? :shock: :lol:

Cheers,
I was looking in the wrong place... OBVIOUSLY...LOL! :P :lol:
I just came across function calls to moveOptionUp and hunted down the .js file on a "wild goose" chase (musta been Canadian geese. :P )

Another "wild guess" is...
It's probably related to the same problem where content parts have the symptom of not showing "preview" snippet in article information screens. Among other people, you reported it here:
http://www.phpwcms.de/forum/viewtopic.php?t=9728
Last edited by DeXXus on Fri 14. Apr 2006, 06:14, edited 1 time in total.
User avatar
StudioZ
Posts: 802
Joined: Fri 28. May 2004, 19:57
Location: Québec, Canada
Contact:

Post by StudioZ »

hey DeXXus shock:
I found this part in file:
include\inc_tmpl\articlecontent.list.tmpl.php

I have the feeling that the Crux of the Biscut -- F.Z. is right there...
Starting at line 174:

Code: Select all

if($sc) {
				//Jetzt aufbauen der Sortieranweisung
				foreach($sbutton as $key => $value) {
					if($key == 1) {
						// if 1st content part in list
						$sbutton[$key]["top"] = "<img src=\"img/button/sort_top_0.gif\" border=\"0\">";
						
					} elseif(isset($sbutton[$key-1]["block"]) && $sbutton[$key-1]["block"] != $sbutton[$key]["block"]) {
						// if this content part is selected for different block than previous
						$sbutton[$key]["top"] = "<img src=\"img/button/sort_top_0.gif\" border=\"0\">";
						
					} else {
						$sbutton[$key]["top"] = "<a href=\"include/inc_act/act_articlecontent.php?sort=".
						$sbutton[$key]["id"].":".$sbutton[$key-1]["sort"]."|".
						$sbutton[$key-1]["id"].":".$sbutton[$key]["sort"].
						"\" title=\"".$BL['be_article_cnt_up']."\"><img src=\"img/button/sort_top_1.gif\" border=\"0\"></a>";
					}
					if($key == $sc) {
						// if this is the last content part in list
						$sbutton[$key]["bottom"] = "<img src=\"img/button/sort_bottom_0.gif\" border=\"0\">";
					
					} elseif(isset($sbutton[$key+1]["block"]) && $sbutton[$key+1]["block"] != $sbutton[$key]["block"]) {
						// if this is the last content part in current block and next is different
						$sbutton[$key]["bottom"] = "<img src=\"img/button/sort_bottom_0.gif\" border=\"0\">";
					
					} else {
						$sbutton[$key]["bottom"] = "<a href=\"include/inc_act/act_articlecontent.php?sort=".
						$sbutton[$key]["id"].":".$sbutton[$key+1]["sort"]."|".
						$sbutton[$key+1]["id"].":".$sbutton[$key]["sort"].
						"\" title=\"".$BL['be_article_cnt_down']."\"><img src=\"img/button/sort_bottom_1.gif\" border=\"0\"></a>";
					}
					$sbutton_string[$sbutton[$key]["id"]] = $sbutton[$key]["top"].
					"<img src=\"img/leer.gif\" width=\"1\" height=\"1\">".
					$sbutton[$key]["bottom"];
				}
				unset($sbutton);
			}
Cheers,
Image
PhpWCMS Evangelist, -- iRoutier.com Running phpWCMS 1.4.2, r354 -> Great Version!!!!
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

"admin.functions.inc.php" has similar coding logic.
User avatar
StudioZ
Posts: 802
Joined: Fri 28. May 2004, 19:57
Location: Québec, Canada
Contact:

Post by StudioZ »

well... I guess there's only Oliver to fix this for us....
Must only be a typo somewhere I can't find... :?
Image
PhpWCMS Evangelist, -- iRoutier.com Running phpWCMS 1.4.2, r354 -> Great Version!!!!
User avatar
Oliver Georgi
Site Admin
Posts: 9938
Joined: Fri 3. Oct 2003, 22:22
Location: Dessau-Roßlau
Contact:

Post by Oliver Georgi »

I think has nothing to do with typo. The problem might be how the sorting is done. And seems very problematic for all articles and content part created by copy/paste. And also when sorting of articles is not possible for users - check sorting setup in structure editor under admin. Only manual will allow sorting for articles.

I'm willing to edit sorting in another way - what I always tried was to handle all such sorting stuff with minimized SQL queries. But maybe this is not neccessary anymore because all have fast servers.

I will check how to optimize that part of code.

What never help is replacing JS code because this all is done in PHP.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn
User avatar
StudioZ
Posts: 802
Joined: Fri 28. May 2004, 19:57
Location: Québec, Canada
Contact:

Post by StudioZ »

Hi Oliver ;-)
If it can help you...
The place (article information) where I have this problem, the section is set to manual sorting.

Thanks for dropping in, 8)
Image
PhpWCMS Evangelist, -- iRoutier.com Running phpWCMS 1.4.2, r354 -> Great Version!!!!
Post Reply