As the title says, "How can I set container folders as non-containers when child items are restricted" to a different resource group?
I'm using the foundation 3 framework and came into some trouble with drop-down & fly-out menus being not populated because the user is not logged in. I need to somehow toggle the container flag off when a user has no access to the child items so that wayfinder does not insert the &parentClass.
*** Not just websites, we also create signage, banners, print, trade show displays and more! ***
Sean Kimball CLP, CLS.
Technical Director / Sr. Developer | BigBlock Studios
._______________________________________________.
Bigblock Studios
http://www.bigblockstudios.ca Web site design & development.
27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
phone/fax: 905-426-5525
Quote from: sean69 at Mar 04, 2013, 01:43 PMI need to somehow toggle the container flag off when a user has no access to the child items so that wayfinder does not insert the &parentClass.
Flag as in the little arrow or so that signifies there is more when hovered or clicked?
Does foundation use pure CSS or JavaScript to create the flag?
How about tweaking their code or creating your own jQuery to take care of the flag; in that way, the Parent menu would show the flag only when there are visible Children, not basing its rule on parentClass or so.
$("ul.dropdown li:has(ul)").find("a:first").append(" » ");
// » = » ; is the flag or whatever
TinymceWrapper: Complete back/frontend content solution.
Harden your MODX site by
passwording your three main folders:
core, manager, connectors and renaming your
assets (thank me later!)
5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
Flag as in the "container" flag on the settings tab of a modx resource.
Foundation is using pure css to implement the drop downs.
*** Not just websites, we also create signage, banners, print, trade show displays and more! ***
Sean Kimball CLP, CLS.
Technical Director / Sr. Developer | BigBlock Studios
._______________________________________________.
Bigblock Studios
http://www.bigblockstudios.ca Web site design & development.
27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
phone/fax: 905-426-5525
Quote from: rx2 at Mar 04, 2013, 03:33 PMCould you use the Personalize snippet?
&parentClass=`[[!Personalize?&yesChunk=`@CODE:yourclass`&noChunk=`@CODE:`]]`
interesting thought, but a little testing with something that will be a little lighter on the resources:
&parentClass=`[[!+modx.user.id:isnot=`0`:then=`has-dropdown`]]`
will affect all parent items with drop-down or fly-out menus, in effect disabling menus a non-logged in user should have access to.
interesting and worth some tinkering I think.
*** Not just websites, we also create signage, banners, print, trade show displays and more! ***
Sean Kimball CLP, CLS.
Technical Director / Sr. Developer | BigBlock Studios
._______________________________________________.
Bigblock Studios
http://www.bigblockstudios.ca Web site design & development.
27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
phone/fax: 905-426-5525
That flag is the 'isfolder' field of the resource if that helps. I can't think of an easy way to do what you want, especially since you'd probably want the Wayfinder tags cached to speed up page loads and I think that would make it impossible if I'm understanding you. Even without caching, I'm not sure you could set that flag before Wayfinder checks it.
The only thing I can think of that might work is to use &parentClass=`[[+CheckChildren]]` and write a CheckChildren snippet that would check the children and return an appropriate class name for your CSS to operate on, or as donshakespeare suggested, use JS to control visibility based on that class name.
Thanks to Bob & rx2's clues - I managed to comeup with this:
First off in the &rowTpl chunk I call the snippet:
<li[[+wf.id]] class="[[CheckChildren? &classes=`[[+wf.classnames]]` &docid=`[[+wf.docid]]` &uid=`[[+modx.user.id]]`]]">
<a href="/[[+wf.link]]" title="[[+wf.title]]" [[+wf.attributes]]>[[+wf.linktext]]</a>
[[+wf.wrapper]]
</li>
Then in the CheckChildren [;) Bob] chunk:
<?php
// class="[[CheckChildren? &classes=`[[+wf.classnames]]` &docid=`[[+docid]]` &uid=`[[+modx.user.id]]`]]"
$output = $classes;
if($uid == 0 & $docid == 15){
$output = str_replace('has-dropdown','',$classes);
}
return $output;
Probably could be prettied up & made a little smarter - but it's getting the job done now.
-thanks guys.
*** Not just websites, we also create signage, banners, print, trade show displays and more! ***
Sean Kimball CLP, CLS.
Technical Director / Sr. Developer | BigBlock Studios
._______________________________________________.
Bigblock Studios
http://www.bigblockstudios.ca Web site design & development.
27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
phone/fax: 905-426-5525
Glad you got it sorted.
Do you mean to do a bitwise and (&) instead of a logical and (&&) ? It will work in this case, but can bite you in others and I don't think you'll get any performance increases from it in PHP.
Quote from: BobRay at Mar 05, 2013, 12:19 AMGlad you got it sorted. 
Do you mean to do a bitwise and (&) instead of a logical and (&&) ? It will work in this case, but can bite you in others and I don't think you'll get any performance increases from it in PHP.
ha.. yes - fat fingers & an old keyboard
*** Not just websites, we also create signage, banners, print, trade show displays and more! ***
Sean Kimball CLP, CLS.
Technical Director / Sr. Developer | BigBlock Studios
._______________________________________________.
Bigblock Studios
http://www.bigblockstudios.ca Web site design & development.
27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
phone/fax: 905-426-5525