Block not saving on Concrete5 version 8 (GlobalArea)

Permalink Browser Info Environment
I'm trying to add a custom menu to some global areas, the blocks get added to the area correctly but then, after settingt the pages i want to show and save, seems like it doesn't get save and thus no pages are displayed.
I'm afraid the problem is with version 8 (note that during installation i had an issue due to save function declaration, i just had to comment "array" on the declaration of block controller).
Thanks in advance.

Type: Discussion
Status: In Progress
starsolutions
View Replies:
Justin1978 replied on at Permalink Reply
Justin1978
Hi Starsolutions,

Unfortunately they made alterations to the core in Concrete version 8 wich
is causing bugs with all my add-ons. I'm am very unhappy with this. That is
why I added comments in bold on all the pages of my add-ons to warn users
that the add-ons are not compatible with version 8.

I have to refactor and test all my add-ons for version 8 so it will be a
while before I can get them released. So unfortunately I can't offer
support on the issue because the Concrete team basically broke my code and
it is not a bug in the add-on. You can get your money back if you contact
the Concrete team. There will be a new release eventually that addresses
this problem. Could you supply me with the steps to reproduce the problem?
Then I can fix it in the new release.

Regards,

Justin



On Jan 5, 2017 5:55 AM, "concrete5 Community" <discussions@concretecms.com>
wrote:
starsolutions replied on at Permalink Reply
starsolutions
Hi,
I fixed the code on my own (actually it's just a few small changes, but the debug took hours), if you want I can send you my changes
Justin1978 replied on at Permalink Reply
Justin1978
Hi,

I'm sorry you had to go to all that trouble. I would like to see the
changes you made and I'll apply them in the next version for Concrete
version 8 and mention you in the changelog ;).

I'm currently backpacking for a year and I have a laptop with me but often
don't have internet to work. I'll be in Auckland the next 5 days and will
see if I can work on my add-ons.

They modified the core in Concrete version 8 and it's not a small thing
because the return types of a lot of methods have changed for objects like
User, File, Package, etc due to Doctrine implementation. That violates the
open/closed principle of software design. I take great care in writing
solid, clean code and suddenly I find all my add-ons broken due to version
8.

Regards,

Justin

On Jan 5, 2017 11:40 PM, "concrete5 Community" <discussions@concretecms.com>
wrote:
starsolutions replied on at Permalink Reply
starsolutions
Hi!
sorry for the delay, basically I changed \Src\Page\PageList function as follow

public function __construct(\Concrete\Core\Search\StickyRequest $req = null) {
        parent::__construct($req);
        // Setup our join; only returns pages that are save to the page picker pages table
        //$this->query->from("Pages","p");
        $this->includeSystemPages = true;
        //$this->query->leftJoin('p', Controller::PAGES_TABLE, 'ppp', 'ppp.cID = p.cID')->orderBy('ppp.position', 'ASC');
    }

the issue is due to new Doctrine as you said, they added a check with an exception (now i don't remember exactly where).
Beside this lost order and it's not the best (i know this) but at least it works.
And this only work for 1 level menus, subpages still not working but for the moment it's ok for me. Hope to hear news soon.

Thanks
Justin1978 replied on at Permalink Reply
Justin1978
That's weird. That's part of the sql query builder. I'm not getting the bug
and can add nested pages. I need some more information to debug the
problem.

Can you give me the exception message you are getting? That's our first
clue. It could be a MySQL error.

On Jan 11, 2017 4:18 AM, "concrete5 Community" <discussions@concretecms.com>
wrote:
JackVanson replied on at Permalink Reply
JackVanson
Hi

I am having this issue but with multilingual pages.

I have a en-gb site tree and an en-us site tree.

When I pick pages from the en-gb site tree within a en-gb Global Area it works fine.

BUT when I try to pick pages within a en-us Global Area it doesn't save the pages I have picked.

Please help :)

Thanks

Jack
Justin1978 replied on at Permalink Reply
Justin1978
Hi Jack,

I'm sorry to hear you are having problems with my add-on. Do you have any error message?

To be clear on what's happening: you have a global area and on the en_US section you added the page picker and added pages from the that same language tree? And these are not showing. Is that correct? I will need try to reproduce the error by doing what you did so I can see what's going on.
Justin1978 replied on at Permalink Reply
Justin1978
Hi Jack,

I managed to reproduce the bug. Very strange, as you say it works with the default language tree but not with the other language. I haven't figured out yet why. I could be a bug in my code or it could have something to do with how the Multilanguage code works. I'm currently looking at the database query.

I will keep you up to speed. I hope to fix it this weekend.
Justin1978 replied on at Permalink Reply
Justin1978
I think I figured out what's going on. If you add pages from a different language/locale section than the page it's displayed on then the pages won't show. You have to select the correct language first in the dropdown above the sitemap. I noticed when the sitemap dialog comes up it does not show the pages for the current language you are on but for the default language. This can be confusing.

I'm not sure this qualifies as a bug because it makes sense you don't want to show pages from the wrong language (the database query makes use of the default Concrete5 page list query). But I do think this all leads to a confusing user experience which is the reason you reported this in the first place so I will have a look to see if I can find a solution for that. This will take some time but for now you know how to solve your problem.
JackVanson replied on at Permalink Reply
JackVanson
Hi Justin

Thank you for getting back to me.I have been selecting the right site tree but it isn't working for me. There has to be a bug here. I am 100% sure I am selecting the right pages for the right locale.

Any ideas?

Also I don't get any errors just no data is saved.

Thanks

Jack
Justin1978 replied on at Permalink Reply
Justin1978
Strange, I will see if I can figure out what's going on. Using the PageList class is rather important because it builds the proper query with all kinds of default joins. Can you upload a screenshot of the PagePicker form so I can see what pages you added and a screenshot of the sitemap expanded? This might help me get a sense of what you are doing so I can reproduce the problem. I will get to it after I get home from work tomorrow. I'm actually kind of curious to figure out the problem.

Saving the pages is not the problem by the way, if you check the database table 'pkgPagePickerPlusPages' you will see they are saved. It's the select query that's not working properly. That's why it seems they aren't saved.
Justin1978 replied on at Permalink Reply
Justin1978
Hi Jack,

I've been fiddling around for a while now and the only way I manage to reproduce the bug is when I select pages from the wrong site tree. However you said it is the right site tree.

I inspected the database query and noticed Concrete's PageList class filters on the current site tree, which is causing the pages from the other site tree not to show up. Other than that there's nothing unusual about the query.

This is an example query done by the PageList for the page picker:
SELECT p.cID FROM Pages p LEFT JOIN btPagePickerPlusPages ppp ON ppp.cID = p.cID LEFT JOIN PagePaths pp ON (p.cID = pp.cID and pp.ppIsCanonical = true) LEFT JOIN PageSearchIndex psi ON p.cID = psi.cID LEFT JOIN PageTypes pt ON p.ptID = pt.ptID INNER JOIN Collections c ON p.cID = c.cID INNER JOIN CollectionVersions cv ON p.cID = cv.cID LEFT JOIN CollectionSearchIndexAttributes csi ON c.cID = csi.cID WHERE (ppp.bID = 282) AND (p.cPointerID < 1) AND (p.cIsTemplate = 0) AND (cvIsApproved = 1) AND ((cvPublishDate <= '2019-02-26 17:28:44' or cvPublishDate is null)) AND (p.cIsActive = TRUE) AND (p.siteTreeID = 2) AND (p.cIsSystemPage = FALSE) ORDER BY ppp.position ASC


It returns nothing until I leave out the p.siteTreeID part.

I think I found a solution. Could you open this file:
/packages/page_picker_plus/blocks/page_picker_plus/src/Page/PageList.php


You will see this block of code:
public function __construct(\Concrete\Core\Search\StickyRequest $req = null) {
      parent::__construct($req);
      // Setup our join; only returns pages that are save to the page picker pages table
      $this->query
         ->leftJoin('p', Controller::PAGES_TABLE, 'ppp', 'ppp.cID = p.cID')
         ->orderBy('ppp.position', 'ASC');
   }


Could you edit it so that it looks like this:
public function __construct(\Concrete\Core\Search\StickyRequest $req = null) {
      parent::__construct($req);
      $this->setSiteTreeToAll();
      $this->includeSystemPages = true;
      // Setup our join; only returns pages that are save to the page picker pages table
      $this->query
         ->leftJoin('p', Controller::PAGES_TABLE, 'ppp', 'ppp.cID = p.cID')
         ->orderBy('ppp.position', 'ASC');
   }


So that is the same code but with two lines extra. After doing that please check if the bug still occurs. I think it should work now. If so, please let me know and I will release a new version with this fix.
JackVanson replied on at Permalink Reply
JackVanson
Hi Justin

I have just come across this issue while adding a page picker block to a global stack. the above fix you have given works.

Thanks

Jack

concrete5 Environment Information

# concrete5 Version
Core Version - 8.0.0
Version Installed - 8.0.0
Database Version - 20161109000000

# concrete5 Packages
BeeSmart (0.0.1), Concrete Custom Theme (0.0.4), Formify (2.4), Page Picker+ (1.0), Styled Maps (1.2.3)

# concrete5 Overrides
blocks/external_form/form/cc_test_form.php, blocks/external_form/form, blocks/external_form, languages/nb_NO/LC_MESSAGES/messages.mo, languages/nb_NO/LC_MESSAGES, languages/nb_NO, languages/ja_JP/LC_MESSAGES/messages.mo, languages/ja_JP/LC_MESSAGES, languages/ja_JP, languages/da_DK/LC_MESSAGES/messages.mo, languages/da_DK/LC_MESSAGES, languages/da_DK, languages/en_GB/LC_MESSAGES/messages.mo, languages/en_GB/LC_MESSAGES, languages/en_GB, languages/cs_CZ/LC_MESSAGES/messages.mo, languages/cs_CZ/LC_MESSAGES, languages/cs_CZ, languages/de_DE/LC_MESSAGES/messages.mo, languages/de_DE/LC_MESSAGES, languages/de_DE, languages/es_PY/LC_MESSAGES/messages.mo, languages/es_PY/LC_MESSAGES, languages/es_PY, languages/it_IT/LC_MESSAGES/messages.mo, languages/it_IT/LC_MESSAGES, languages/it_IT, languages/el_GR/LC_MESSAGES/messages.mo, languages/el_GR/LC_MESSAGES, languages/el_GR, languages/sv_SE/LC_MESSAGES/messages.mo, languages/sv_SE/LC_MESSAGES, languages/sv_SE, languages/site/de_AT.po, languages/site, languages/es_PE/LC_MESSAGES/messages.mo, languages/es_PE/LC_MESSAGES, languages/es_PE, languages/nl_NL/LC_MESSAGES/messages.mo, languages/nl_NL/LC_MESSAGES, languages/nl_NL, languages/fi_FI/LC_MESSAGES/messages.mo, languages/fi_FI/LC_MESSAGES, languages/fi_FI, languages/ru_RU/LC_MESSAGES/messages.mo, languages/ru_RU/LC_MESSAGES, languages/ru_RU, languages/pt_BR/LC_MESSAGES/messages.mo, languages/pt_BR/LC_MESSAGES, languages/pt_BR, blocks/external_form/form/cc_test_form.php, blocks/external_form/form, blocks/external_form, languages/nb_NO/LC_MESSAGES/messages.mo, languages/nb_NO/LC_MESSAGES, languages/nb_NO, languages/ja_JP/LC_MESSAGES/messages.mo, languages/ja_JP/LC_MESSAGES, languages/ja_JP, languages/da_DK/LC_MESSAGES/messages.mo, languages/da_DK/LC_MESSAGES, languages/da_DK, languages/en_GB/LC_MESSAGES/messages.mo, languages/en_GB/LC_MESSAGES, languages/en_GB, languages/cs_CZ/LC_MESSAGES/messages.mo, languages/cs_CZ/LC_MESSAGES, languages/cs_CZ, languages/de_DE/LC_MESSAGES/messages.mo, languages/de_DE/LC_MESSAGES, languages/de_DE, languages/es_PY/LC_MESSAGES/messages.mo, languages/es_PY/LC_MESSAGES, languages/es_PY, languages/it_IT/LC_MESSAGES/messages.mo, languages/it_IT/LC_MESSAGES, languages/it_IT, languages/el_GR/LC_MESSAGES/messages.mo, languages/el_GR/LC_MESSAGES, languages/el_GR, languages/sv_SE/LC_MESSAGES/messages.mo, languages/sv_SE/LC_MESSAGES, languages/sv_SE, languages/site/de_AT.po, languages/site, languages/es_PE/LC_MESSAGES/messages.mo, languages/es_PE/LC_MESSAGES, languages/es_PE, languages/nl_NL/LC_MESSAGES/messages.mo, languages/nl_NL/LC_MESSAGES, languages/nl_NL, languages/fi_FI/LC_MESSAGES/messages.mo, languages/fi_FI/LC_MESSAGES, languages/fi_FI, languages/ru_RU/LC_MESSAGES/messages.mo, languages/ru_RU/LC_MESSAGES, languages/ru_RU, languages/pt_BR/LC_MESSAGES/messages.mo, languages/pt_BR/LC_MESSAGES, languages/pt_BR

# concrete5 Cache Settings
Block Cache - Off
Overrides Cache - Off
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
nginx/1.10.2

# Server API
fpm-fcgi

# PHP Version
7.0.14

# PHP Extensions
apcu, bz2, cgi-fcgi, Core, ctype, curl, date, dom, fileinfo, filter, gd, hash, iconv, json, libxml, mbstring, mcrypt, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_mysql, Phar, posix, readline, Reflection, session, SimpleXML, SPL, standard, tokenizer, xml, xmlreader, xmlwriter, zip, zlib

# PHP Settings
max_execution_time - 300
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 128M
post_max_size - 20M
sql.safe_mode - Off
upload_max_filesize - 20M
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200

Browser User-Agent String

Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.