Sep 06, 2008, 01:41 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Wayfinder and Unpublished Docs?  (Read 1745 times)
0 Members and 1 Guest are viewing this topic.
pixelchutes
Coding Team
*
Posts: 801



WWW
« on: Aug 25, 2007, 07:22 PM »

I have been reviewing the following: http://www.muddydogpaws.com/development/wayfinder/parameters.html

...but have not been able to find what I am looking for. Maybe it's not even an option!?

Can Wayfinder work with "Unpublished" documents? It doesn't appear so....Hmm, does a parameter to override filtering of unpublished docs exist, similar to Ditto's?

Logged

Mike Reid - www.pixelchutes.com
MODx Team Member / Contributor
[Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
________________________________
Where every pixel matters.
pixelchutes
Coding Team
*
Posts: 801



WWW
« Reply #1 on: Aug 25, 2007, 07:38 PM »

Update:

For those looking to use Wayfinder 2.0 with Unpublished Documents, here is a preliminary patch that seems to do the trick. Please note, this has not been tested in more advanced, deeply nested list situations. It simply introduces the hideUnpublished parameter. If defined w/ a value of 0, Wayfinder will include unpublished documents from the current branch within the result set.

2 simple patches:

Edit assets/snippets/wayfinder/wayfinder.inc.php: (Line 351)

1. Replace:
Code:
$sql = "SELECT DISTINCT {$fields} FROM {$tblsc} sc LEFT JOIN {$tbldg} dg ON dg.document = sc.id WHERE sc.published=1 AND sc.deleted=0 AND ({$access}){$menuWhere} AND sc.id IN (".implode(',',$ids).") GROUP BY sc.id ORDER BY {$sort} {$this->_config['sortOrder']} {$sqlLimit};";
With:
Code:
// pixelchutes - Work with unpublished documents  - 6:19 PM 8/25/2007
$sql = "SELECT DISTINCT {$fields} FROM {$tblsc} sc LEFT JOIN {$tbldg} dg ON dg.document = sc.id WHERE sc.published<>".( $this->_config['hideUnpublished'] ? 0 : 2 )." AND sc.deleted=0 AND ({$access}){$menuWhere} AND sc.id IN (".implode(',',$ids).") GROUP BY sc.id ORDER BY {$sort} {$this->_config['sortOrder']} {$sqlLimit};";
//$sql = "SELECT DISTINCT {$fields} FROM {$tblsc} sc LEFT JOIN {$tbldg} dg ON dg.document = sc.id WHERE sc.published=1 AND sc.deleted=0 AND ({$access}){$menuWhere} AND sc.id IN (".implode(',',$ids).") GROUP BY sc.id ORDER BY {$sort} {$this->_config['sortOrder']} {$sqlLimit};";

2. Edit Wayfinder snippet: (v2.0/MODx v0.9.6 - Line 61)

Add the following new parameter to Line 61
Code:
    'hideUnpublished' => isset($hideUnpublished) ? $hideUnpublished: TRUE, // pixelchutes - work with unpublished documents

That's it!

Simply pass hideUnpublished in your Wayfinder snippet call:
Code:
[[Wayfinder? &hideUnpublished=`0` &startId=`[*id*]`]]
with your snippet call to include Unpublished Documents with Wayfinder!

* Further testing in more advanced scenarios should take place to confirm desired functionality
« Last Edit: Aug 25, 2007, 09:02 PM by pixelchutes » Logged

Mike Reid - www.pixelchutes.com
MODx Team Member / Contributor
[Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
________________________________
Where every pixel matters.
davidm
Marketing & Design Team
*
Posts: 6,590


The best way to predict the future is to invent it


WWW
« Reply #2 on: Mar 02, 2008, 06:25 AM »

Exactly what I was looking for !
Works as advertised, thanks !

It would be nice if it made it into the next wayfinder release...

Logged

blog.nodeo.net : Pour un web libre, moderne et ouvert! :: | ! Nouveau ! Les forums modxcms.fr : Participez à l'élaboration du site MODx francophone ! ! Nouveau ! :.

MODx est l'outil idéal pour les developpeurs et webdesigners qui cherchent un framework de gestion de contenu hautement flexible et performant, tout en étant simple d'accès pour les utilisateurs finaux.

Config : Apache 2.2.8 - MySQL 5.0.45 - PHP 5.2.5 | Debian 4.0 (Etch)

Réalisations sous MODx : nodeo.net | gican.asso.fr | michelez-notaires.com | amadom.gerondicap.com | sworld.com | soleil.info
 et 3 autres en cours de réalisation Smiley
dev_cw
Testers
*
Posts: 2,242



« Reply #3 on: Mar 02, 2008, 06:31 AM »

Interesting that this is such an 'old' post. I have seen requests for this often and never knew that there was a posted solution.

Bookmarked now for future reference  Roll Eyes
Logged

Shane Sponagle | Snippet Call Anatomy | Document Specific Variables

Hey Brian, there is a message in my Alphabits. It says Ooooooo.
Peter, those are Cherios.
davidm
Marketing & Design Team
*
Posts: 6,590


The best way to predict the future is to invent it


WWW
« Reply #4 on: Mar 02, 2008, 06:52 AM »

Neither did I until I had to find a solution for this and Google brought me here...
I am amazed to see how old the post was (missed it) and how little feedback there was...
Logged

blog.nodeo.net : Pour un web libre, moderne et ouvert! :: | ! Nouveau ! Les forums modxcms.fr : Participez à l'élaboration du site MODx francophone ! ! Nouveau ! :.

MODx est l'outil idéal pour les developpeurs et webdesigners qui cherchent un framework de gestion de contenu hautement flexible et performant, tout en étant simple d'accès pour les utilisateurs finaux.

Config : Apache 2.2.8 - MySQL 5.0.45 - PHP 5.2.5 | Debian 4.0 (Etch)

Réalisations sous MODx : nodeo.net | gican.asso.fr | michelez-notaires.com | amadom.gerondicap.com | sworld.com | soleil.info
 et 3 autres en cours de réalisation Smiley
BobRay
Coding Team
*
Posts: 1,240


WWW
« Reply #5 on: Mar 02, 2008, 04:13 PM »

Could you guys satisfy my curiosity about why you would want Wayfinder to work with unpublished docs?

Bob
Logged

MODx info for newbies: http://bobsguides.com/MODx.html
ganeshXL
Testers
*
Posts: 1,326



WWW
« Reply #6 on: Mar 02, 2008, 05:40 PM »

Yep, I'm curious as well. If it's just for previewing new pages, wouldn't it be easier to just use doc-groups + user-groups?
Logged
davidm
Marketing & Design Team
*
Posts: 6,590


The best way to predict the future is to invent it


WWW
« Reply #7 on: Mar 03, 2008, 02:51 AM »

You're right it's for previewing pages, and yes I have been using doc groups and user groups in the past but on this one, I had to duplicate the entire tree for a website which is undergoing a total re-structuring / re-writing and those pages have several doc groups and user groups tied to them. It was easier in my opinion to keep those unpublished...
Logged

blog.nodeo.net : Pour un web libre, moderne et ouvert! :: | ! Nouveau ! Les forums modxcms.fr : Participez à l'élaboration du site MODx francophone ! ! Nouveau ! :.

MODx est l'outil idéal pour les developpeurs et webdesigners qui cherchent un framework de gestion de contenu hautement flexible et performant, tout en étant simple d'accès pour les utilisateurs finaux.

Config : Apache 2.2.8 - MySQL 5.0.45 - PHP 5.2.5 | Debian 4.0 (Etch)

Réalisations sous MODx : nodeo.net | gican.asso.fr | michelez-notaires.com | amadom.gerondicap.com | sworld.com | soleil.info
 et 3 autres en cours de réalisation Smiley
pixelchutes
Coding Team
*
Posts: 801



WWW
« Reply #8 on: Mar 04, 2008, 01:38 PM »

Could you guys satisfy my curiosity about why you would want Wayfinder to work with unpublished docs?

Bob


I thought it had something to do with trying to use &includeDocs=`123` where doc_id 123's parent was an unpublished container...However, I tried a few different scenarios/test cases and that doesn't seem to be the case. I couldn't find a valid scenario that justified how this parameter might be leveraged, however I do like the idea of optionally using it temporarily during development, however.

Honestly, it's been awhile and now I can't even remember! Glad to see it managed to help someone Smiley
« Last Edit: Mar 04, 2008, 01:47 PM by pixelchutes » Logged

Mike Reid - www.pixelchutes.com
MODx Team Member / Contributor
[Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
________________________________
Where every pixel matters.
BobRay
Coding Team
*
Posts: 1,240


WWW
« Reply #9 on: Mar 04, 2008, 03:49 PM »

What confuses me is that if you use it during development, it seems visitors to the site would see the unpublished documents, so why not just publish them?

Bob
Logged

MODx info for newbies: http://bobsguides.com/MODx.html
dev_cw
Testers
*
Posts: 2,242



« Reply #10 on: Mar 04, 2008, 03:58 PM »

I have a case where the client wants to be able to see unpublished documents while logged in and editing.  Since you cant change document group from the front-end that is not an option. After all QuickEdit lets you publish unpublished documents but you need to know where they are. and while logged as manager you can view unpublished docs.

I resolved this with a ditto call in a 'hidden' chunk. But if I could add these to the live menu (maybe with a different style) this could have worked.

I can think of a few other situations where this could be useful, all involving front-end site management. I have one site with @ 30 editors and some just don't like to use the manager so by keeping it in the front-end they are happy.
Logged

Shane Sponagle | Snippet Call Anatomy | Document Specific Variables

Hey Brian, there is a message in my Alphabits. It says Ooooooo.
Peter, those are Cherios.
pixelchutes
Coding Team
*
Posts: 801



WWW
« Reply #11 on: Mar 04, 2008, 04:37 PM »

What confuses me is that if you use it during development, it seems visitors to the site would see the unpublished documents, so why not just publish them?

Bob


True. Of course this obviously depends on your development environment, etc.

When developing on a live production box/active domain, I normally have my MODx sites completely disabled (turned off in site config) until they are ready. Sometimes I choose to develop sites using just the IP Address or the local file system which would work out ok.
« Last Edit: Mar 04, 2008, 04:39 PM by pixelchutes » Logged

Mike Reid - www.pixelchutes.com
MODx Team Member / Contributor
[Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
________________________________
Where every pixel matters.
BobRay
Coding Team
*
Posts: 1,240


WWW
« Reply #12 on: Mar 04, 2008, 04:41 PM »

I have a case where the client wants to be able to see unpublished documents while logged in and editing.  Since you cant change document group from the front-end that is not an option. After all QuickEdit lets you publish unpublished documents but you need to know where they are. and while logged as manager you can view unpublished docs.

I resolved this with a ditto call in a 'hidden' chunk. But if I could add these to the live menu (maybe with a different style) this could have worked.

I can think of a few other situations where this could be useful, all involving front-end site management. I have one site with @ 30 editors and some just don't like to use the manager so by keeping it in the front-end they are happy.

That makes sense. I have a site where I use the Personalize snippet to show a different wayfinder menu to logged in users. IOW, there are two Wayfinder menus in two separate chunks. Logged in users get one and regular visitors get the other.

Bob
Logged

MODx info for newbies: http://bobsguides.com/MODx.html
tirithen
Jr. Member
*
Posts: 41


« Reply #13 on: Jun 26, 2008, 03:02 AM »

This is a great addition to the Wayfinder snippet, but I'm wondering if there is a simple way to make it possible for logged in users to show the unpublished documents that Wayfinder now create links for? As I think already said above it would be great to be able to set a different css class for the unpublished documents.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP

Copyright © 2005-2008 MODxCMS, All rights reserved. Contact Us
Styles by ziworks.com

Powered by SMF 1.1.4 | SMF © 2005, Simple Machines LLC

Valid XHTML 1.0! Valid CSS!