Jump to content

er314

Members
  • Posts

    44
  • Joined

  • Last visited

Posts posted by er314

  1. While we are at the comments API, I was considering implementing a "search" feature on comments, but it seems that find() API can't be used for this :

    Error Exception: Operator '*=' is not implemented in FieldtypeComments

    Error Exception: Operator '~=' is not implemented in FieldtypeComments

    Do you have plans to implement these operators ?

    thanks

  2. Thanks for your reply.

    So this means that the stock "language gateway.php" code does not work as is, when the application has pages with URL segments

    -> I should adapt the template code to my needs, is order to detect whenever the target page has URL segments, and then only perform get() on the real base URL.

    This leads to another questioning : once I have the real page object in one hand, at the target url segments in another hand, is there a way to render() the page by providing it with the urlsegments ? I don't see how this can be done with the API (I don't see neither how to do this with regular URL variables, instead of urlsegments, by the way)

    I'll think about it and I'll post back here if I have ideas :-)

  3. while I'm not fond of the head.inc + hidden status (because for instance I have a page which does heavy use of find() on potentially unpublished pages, so the display of this page would still get unwanted data),

    the last 2 options seem very good and straightforward, with the last one being particularly impressive, thank you very much !

  4. So far I didn’t look into the roles security model, my security model is more basic, with myself as the superuser on one side, and Internet end-users on the other side :)

    By the way, with current version 2.2.9, even tough I’m superuser, I can assign an unpublished page to a PageField, but then it is not displayed as being assigned.

    Logically, I was presuming that on the backend side (ie. roles > guest), a status of published vs unpublished would have no impact in terms of who has the permission to do what -> ok it seems I was wrong.

    Notwithstanding backend issues, one of the main purposes of the unpublished status is that pages are… unpublished, so they can’t be accessed at their URL by the “anonymous” end-users, nor with pages->find, $pages->get, ...

    This is something the hidden status doesn’t provide : you mentioned it in previous posts, and I just verified, that a hidden page can still be accessed by its URL, and by $pages->get. So using hidden instead of unpublished doesn’t sound good to me, for obvious security/disclosure reasons. Same goes for using a checkbox : ok, but is there a solution for preventing end-users access to these pages, equivalent to unpublished ? Maybe performing a test (eg. if($page->viewable()) ) everywhere in the code before displaying anything? I don’t know why I’m not a big fan of this approach… which would mean reimplementing “unpublished” feature by hand.

    Well, in my case I can cope with a workflow where I first publish the pages (which happen to be less sensitive) which are going to be referenced inside unpublished pages (which are more sensitive), so I’ll do this way.

    But I think it’s a worthwhile discussion :)

    Ok, I add to my TODO list “learn more about Processwire RBAC model” :)

    Update : I’ve just read the RBAC model API introduction, and I think I have another option :

    The Work-In-Progress stuff could take place in a /WIP directory tree, which would have no guest access.

    From my lazy-cron, when publish_date field is met for pages in /WIP, then move the relevant pages from /WIP to the relevant locations in /Live-Content, which is the main tree with guest access.

    In order to be automated inside a lazon-cron, it's more complex and more rigid than just switching a status flag, but I suppose it should work.

    Still, it would be great if “unpublished” status behaviour could be made more convenient and useful, as per my arguments ;)

    • Like 1
  5. Thanks for your explanation.

    From a backend workflow usage perspective, my objective is to keep new pages unpublished while I work on them, then publish everything at once by lazy-cron, based on a "publish_date" Date field. This includes unpublished pages which are PageFields of other unpublished pages.

    My lazy-cron code is working fine for this.

    But given what you describe, such a workflow should not be used, because I shouldn't be able to have unpublished PageFields within (unpublished) Pages.

    What shoud I do ? Use "hidden" status instead of unpublished ? (I didn't look "hidden" status in depth so far)

  6. Hello, I have an odd behaviour going on with unpublished pages on the backend admin :

    Let's consider a page (PageA) whose template has a Page field (FieldA).

    PageA status is published.

    FieldA input field type is "PageListSelect".

    The backend interface allows to add an unpublished page (PageB) to FieldA, then save PageA.

    However, once this is done, after refresh, FieldA is still displayed as empty, without the newly assigned PageB.

    Moreover, if this field is set as "required", then PW refuses to update-resave the page.

    As soon as you publish PageB, then it reappears in FieldA, and PageA can be updated-resaved.

    Note that if FieldA input field type is set to "Select" instead of ""PageListSelect", then the unpublished PageB is no more available for being assigned to FieldA.

    There is something non consistent going on.

    I suppose the expected behavior is to allow the addition of unpublished pages, then display them once added even though they are unpublished, and not complaining about missing required field ?

  7. In addition to the expected forward slash to separate directories, ProcessWire only accepts these [ASCII] characters in it's URLs:

    abcdefghijklmnopqrstuvwxyz 0123456789 . - _ 

    The same goes for page names (which make up URLs), and url segments. But it doesn't apply to GET vars of course.

    [...]

    I have url segments which may contain characters out of this allowed list.

    Did you consider also allowing '%' character in URLs ?

    Having '%' would permit to use urlencode/urldecode functions.

    Instead, I guess I have to write by own urlencode/urldecode function, or use base64_encode/base64_decode + handling the '=' characters which is somewhat overkill ;-)

    Or do I overlook a simpler approach ?

  8. I have followed this method #3, based on language gateway and url segments, and it’s mostly working fine.

    Except that when accessing a URL which is including url segments, for default language it's OK, but for custom language, language-gateway fails to retrieve the page.

    In the above code, the following fails :

    $mypage = $pages->get($path);

    example of $path which fails : /artiste/kandinsky/, where

    - (/fr/ is the language gateway)

    - /artiste/ is the real page url, and

    - kandinsky is url segment No1

    Any idea ?

    ** edit **

    Given the huge success with my question ;-) , I'll try again by rephrasing it as follows :

    The behaviour that I observe implies that the language gateway code does not support a target URL which has url segments.

    It this the expected behaviour ? Or am I obviously doing somethig wrong ?

    thanks

  9. Ok this thread is not a FR thread ;-) , but nevertheless I vote for "optional website field" and "honeypot spam protection".

    Plus, as a user I personally like when replies are tree-oriented instead of flat, I don't know if this is something you think about.

  10. Hello,

    I have a Comments field in "an-article" template.

    Regarding structure, several "an-article" pages can be children of one same parent "a-container" page.

    Regarding display, one "an-article" page can be displayed simply on its own,

    or multiple "an-article" pages are displayed in sequence when invoking the display of the parent "a-container" page

    For displaying/rendering the Comments field, I simply invoke the "an-article" $page->comments->render(); and $page->comments->renderForm();

    In terms of display, this is working fine : displaying the multiple "an-article" instances view shows the right comments for each instance displayed.

    However, in terms of posting a new comment,

    - it works fine if posted from a single "an-article" display,

    - but when posted from a multiple "an-article" display, actually the new comment is assigned simultaneously to all the instances that are currently displayed, instead of only to the one on which the post is performed.

    Any ideas how to solve this ? (ok, 1st workaround is to forbid posting new comment from the "multiple instance" view :-)

    thanks

  11. Thanks,

    Currently, for testing (and for understanding/learning !) purpose, I'm doing the request outside of the category template,

    So yes Ryan your 1st solution, the one with 2 selects, is working, thanks a lot !

    For the sake of understanding/learning,

    as I will have to perform several requests/selections of this type in the same block of code, my aim was to

    - first, perform only once the supposedly "heaviest" request (the one which queries all pages)

    - then, perform the subsequent requests not on all pages, but on the "one-article" subset of pages

    Hence, my initial code, which added an intermediate step (3 selections instead of 2, with the heaviest first)

    -> Ryan, do you know exactly what was wrong in my initial code ?

    Can it be fixed, while preserving this 3 steps behaviour ?

    Or should I just forget about that, given that this kind of optimization is probably negligible ?

    (my aim is to display, in the category tree view, the number of "one-article" pages for earch category ; well, a bit like the "Pages" view in PW admin interface...)

  12. Hi, I'm new here, I'll start by posting in an existing thread ;-)

    I'm trying to do something similar than the OP, but I can't get it to work :

    Basically,

    - I have pages with template "one-category", where each page represent one category

    - I have pages with template "one-article", which are used for the actual contents.

    - one of the fields of "one-article" is "article_categories", it is of type "Page", more specifically "Multiple pages (PageArray)". It is used to reference a list of pages of type "one-category" (which means it is used for assigning categories to each article).

    Now, I want to select, for each existing category pages, the list of the "one-article" pages which are referencing the category.

    For troubleshooting, I also try to "just" select all the "one-article" pages which are referencing one single category page.

    here is the code :

    $the_articles = $pages->find("template=one-article"); // select all existing real pages
    $the_cat = $pages->get("template=one-category, title='cat1'"); // select one category page
    $the_list = $the_articles->find("article_categories=$the_cat"); // select real pages referencing the desired category page

    as a result,

    - this is working if I have only 1 category referenced in the articles : $the_list->count() returns '1' for the relevant article, and I can use the returned objet

    - but it (seems to) fail as soon as I add a second category to this article : $the_list->count() now returns '0', while I would expect it to still return '1'

    any idea ?

    • Like 1
×
×
  • Create New...