Layout + Move Bug

Permalink 4 users found helpful
I had this on 2 different pages, one with the standard theme, one with a customized one, both with 5.4.0.5.

I added on a page a couple of normal content blocks and also 2 Layout areas filled again with normal content blocks and images.

After moving stuff a bit around and editing the content a bit the layout blocks become stuck when I try to move their position.

If I tell the layout block Nr. 1 to "move up" over layout block Nr. 2 it all works fine. But when I then Exit the Edit Mode and "Publish my Edits" the layout block is back at it's old position.

Am I doing something wrong or is it a bug?

 
tallacman replied on at Permalink Reply
tallacman
I have noticed something like this too. If I change the layout position it is best if I save position changes and exit edit mode. Then reenter edit mode to edit content.

If I try to edit content after saving the position but NOT exiting edit mode the blocks sometimes move back to their original position.
Tony replied on at Permalink Reply
Tony
Are you totally sure this is related directly to the new layout stuff, and not just areas in general? I think I've seen this type of behavior with just standard areas too, without layouts.
Kiesel replied on at Permalink Reply
I'm not sure that it just affects the layouts only and not the areas in general, but so far I had the problem only with the layouts.
Tony replied on at Permalink Reply
Tony
k, will keep an eye on it
cursal replied on at Permalink Reply
cursal
tallacman said "I have noticed something like this too. If I change the layout position it is best if I save position changes and exit edit mode. Then reenter edit mode to edit content.

If I try to edit content after saving the position but NOT exiting edit mode the blocks sometimes move back to their original position. "

This worked perfectly! Thanks.
Would like to make that the official answer for now, until it is either fixed or accepted that there is an order of operation when adding and moving layouts
cursal replied on at Permalink Reply
cursal
Tony,

I know that when you edit a default page's block POSITIONS (in pages and themes) and set that to to show on child pages it will not move the new saved positions on pages already created (child pages).

Thought it was a bug, but frz says it's more of a request than a bug.

here is that Thread:
http://www.concrete5.org/community/forums/usage/moving_blocks_on_pa...
johnnyNui replied on at Permalink Reply
johnnyNui
Not sure what version you have, I have 5.4.1.1.

I don't have the option to "Save" layout positions after I move them.

I have several layouts on a page, but I need to reorder the layouts.
So i click on the little "+" symbol and choose to move up or move down, it works.
There is no option to "save" position (as there is when moving blocks).

So I assume you don't need to save positions....

But when I exit edit mode, and publish changes, everything reverts to the way it was. No layouts have moved.

This seems like a bug to me, and it does not seem related to the "feature request" that Frz is talking about here.
http://www.concrete5.org/community/forums/usage/moving_blocks_on_pa...

Because they are talking about moving blocks while in page defaults, not layouts in regular mode (i believe).
tseib replied on at Permalink Reply
johnnyNui has articulated the problem perfectly. The layout move command appears to work until you exit page mode, at which time it simply reverts to how it was before. Also, there is no "save positioning" command when moving layouts up and down.
dantheman replied on at Permalink Reply
I have exactly the same problem as this. I have 2 layouts on a page, one with 2 columns, the other with 1 column. No matter what I do, the 1 column item reverts to the bottom of the page.

Which is a bummer cos it's the introductory text.

Edit: By adding another layout and dragging the heading into it then reordering the layouts I got what I wanted. But it was not pretty while it lasted.
marcandre replied on at Permalink Reply
marcandre
It is a bug as far as I can see.
In /concrete/tools/layout_services.php under the switch case for 'move' (line 55) are 3 SQL queries.

The first on line 68:
$sql = 'UPDATE CollectionVersionAreaLayouts SET position=? WHERE cvalID=? ';

then on line 77:
$sql = 'UPDATE CollectionVersionAreaLayouts SET position=? WHERE cvalID=? ';

and finally line 83:
$sql = 'UPDATE CollectionVersionAreaLayouts SET position=? WHERE cvalID=? ';

As you can see, there are placeholders (?) for the values, but as it concurred to me, the $db->query() function does not accept a second argument (you may correct me if I overlooked another function with the same name)!

So the only way i see is to modify the layout_services.php directly and adjust the SQL queries to:
(line 68)
$sql = 'UPDATE CollectionVersionAreaLayouts SET position='.$prevLayout->position.' WHERE cvalID='.intval($prevLayout->cvalID);

(line 76)
$sql = 'UPDATE CollectionVersionAreaLayouts SET position='.$nextLayout->position.' WHERE cvalID='.intval($nextLayout->cvalID);

(line 81)
$sql = 'UPDATE CollectionVersionAreaLayouts SET position='.$layout->position.' WHERE cvalID='.$layout->cvalID;


and finally remove the second argument from the $db->query() functions on lines 69, 77 and 82 respectively.

At least now it works for me.
formermember replied on at Permalink Reply
I am also having issues with re-ordering of content blocks. I go to a page click edit and then click on a content block >> select MOVE and reorder the blocks to where I want them.

When I click Save Positioning it perpetually saves...but never does actually save.

I also tried editing the layout_services.php file as mentioned previously but to no avail.

Any help would be great.

Thanks
Remo replied on at Permalink Reply
Remo
Query does support a second argument

function Query($sql, $inputarr=false)
   {
      $rs = $this->Execute($sql, $inputarr);
      if (!$rs && defined('ADODB_PEAR')) return ADODB_PEAR_Error();
      return $rs;
   }
shelkie replied on at Permalink Reply 1 Attachment
We were also running into trouble moving layouts, both in previous version of C5, and still with 5.4.2. I looked into it, and thought I should post how I fixed the problem.

Looks like content versions are not correctly taken into account when moving layouts.

When you click the "move up" or "move down" buttons, the file "/tools/layout_services.php" handles the request and uses the function "getVersionToModify" to get a working copy of the page. Problem is, the "cvalID" parameter send in the JSON request applies to the currently published version of the page, not the unsaved version you're actually working on.

I've attached my modified version of layout_services.php in hopes that it will help someone else that is running into this issue.
chassa2556 replied on at Permalink Reply
chassa2556
Nice one Shelkie - this worked for me...
shelkie replied on at Permalink Reply
Glad this helped. We ended up having to make some more significant changes to core in order to get layouts working correctly in 5.4.2. I haven't tested recent version of C5, but I think those issues might have been resolved now.
fastcrash replied on at Permalink Reply
fastcrash
is the issue has been fix in 5.4.2.2 or this is just some modification?

please explain me if you can, what modification is this?

thanks.
shelkie replied on at Permalink Reply
The layout problems had not been fixed in 5.4.2.2
While the attachment I posted previously helped to resolve some issues, we ended up discovering more serious problems with the way layouts are stored in the database (in version 5.4.2.2 at least).
We had to modify several other core files, plus make changes to the database schema in order to make them work reliably.
With that resolved, we've made heavy use of layouts, including one site with over 500 pages, and many thousands of layouts.
chassa2556 replied on at Permalink Reply
chassa2556
The client has just got back to me and said that the layout will now only move one slot at a time. So she can't move it up multiple times. If she does it reverts back to where it was. So she has to move it up one then save, move it up another one then save. This is a listing with 20 or so products so entirely impractical! She is using 4.2.2 and I'm anxious about upgrading to 5 as I've just trained her in this and she uses the scrapbook a lot.
evavra replied on at Permalink Reply
evavra
I'm running 5.5 and using a customized version of the default theme and also had the same issues with moving layout up/down. I realized that if I removed the Saved Preset in the Design/Set Block Types that I had chosen for the blocks I was trying to move (and set it back to "Custom (No Presets)", then I was able to move the layout, BUT only one move at a time, as chassa2556 mentions above.
andrew replied on at Permalink Reply
andrew
FYI - to anyone monitoring this bug, we've fixed this in 5.5.2.1. It's not ideal – it forces a page refresh on a layout moving, but it does work.
maccahutch replied on at Permalink Reply
maccahutch
I am still having issues with this. I have tried the modifications to the layout_services.php with no luck. I have also updated to 5.5.2.1 which has the 'fix'. When I try to move layouts up or down now, I have no idea where they are going to move as some will move up when I click move down and some just jump to the top. I am totally baffled and will just lay out the page manually again in the order I want!!!
chriseaton91 replied on at Permalink Reply
I'm running 5.6.0.2 and its the same.

I have a page with 10 sections and a header. Moving the first section is fine, but any other movements mean the 1st section moves above the header to the top of the page and the one I want to move stays firmly where it is.

The only option I have right now is to rebuild the page every time the client wants to move something.
shelkie replied on at Permalink Reply
I've submitted a pull request that would integrate our fix for this problem into 5.6.1:https://github.com/concrete5/concrete5/pull/689...