Show / hide design

Hi,
Wondering if you can set a condition in the design to hide if in _edit mode. For the reason that it doesn't make sense to edit an asset builder.



Currently we have 2 options for our users to choose when they login into our simple edit screen.


  • create new page
  • upload files



    when they click on a menu item, a third option appears


  • edit this page



    here is the code to create this logic.



    <MySource_AREA id_name="simple_edit" design_area="show_if" print="no">

    <MySource_SET name="condition" value="simple_edit_mode" />

    <mysource_then>



    SHOW TWO OPTION design code here



    </mysource_then>

    <mysource_else>



    SHOW THIRD OPTION design code here



    </mysource_else>

    </MySource_AREA>



    Any help would be great.



    thanks

You can have more than one show_if, so just combine them together. :slight_smile:

What I can think of is to use a write access condition for the ‘edit this page’ option. When the currently logged in user does not have write permission to the asset builder, the ‘edit this page’ will not be shown, here’s the code


<MySource_AREA id_name=“simple_edit” design_area=“show_if” print=“no”>

<MySource_SET name=“condition” value=“simple_edit_mode” />

<mysource_then>



SHOW TWO OPTION design code here



</mysource_then>

<mysource_else>



<MySource_AREA id_name=“write_access” design_area=“show_if” print=“no”>

<MySource_SET name=“condition” value=“write_access” />

<mysource_then>

SHOW THIRD OPTION design code here

</mysource_then>

</MySource_AREA>




</mysource_else>

</MySource_AREA>



edited to add link to manual:

More conditions that you can use are explained in CMS manual > Other Design Areas > Show If (available here)

[quote]You can have more than one show_if, so just combine them together. :slight_smile:
[right][post=“12894”]<{POST_SNAPBACK}>[/post][/right][/quote]



Could you give an example using my sample code below. I have called two of your support staff, Ryan Ong and Karl Davidson to figure it out. They couldn’t help me.



So after you log-in using Account Manager Page Asset. A floating tool box is displyed on the right hand side. with the option (create new page)(upload files)



If the user clicks on a menu item.

the second option is displayed (Edit this page) in the floating tool box



When you click on the (Edit this page) link it goes into simple edit mode and the floating toolbox display the first logged in option (create new page)(upload files)



Q1. Is there a way to show another option (Exit Edit Mode)?, it doen’t make sense when your edting a page to have the two option there.



Here is the code to create this logic.



<MySource_AREA id_name=“simple_edit” design_area=“show_if” print=“no”>

<MySource_SET name=“condition” value=“simple_edit_mode” />

<mysource_then>



(create new page)(upload files) design code here



</mysource_then>

<mysource_else>



(Edit this page) design code here



</mysource_else>

</MySource_AREA>



Q2. Why when im in the asset builder page I get the second option of (Edit this page) looking at the code above, what determin what asset type display what option.



thanks in advance.

Kenny – That toolbox was added with very little "smarts" attached, as I recall. Also, you can't nest design areas like Rayn suggests in his post – you need to define it in a different way.


Here's a far more detailed version:



[html]<MySource_AREA id_name="limbo_controls" design_area="nest_content" print="no"/>



<MySource_AREA id_name="logged_in" design_area="show_if" print="no">

<MySource_SET name="condition" value="logged_in" />

<MySource_THEN>

<style type="text/css"><MySource_PRINT id_name="simple_edit_styles" /></style>

<div id="tool_box">

<div id="tool_box_bg"></div>

<h1><img src="mysource_files/toolbox_top.gif" alt="Toolbox" /></h1>

<MySource_PRINT id_name="in_limbo" />

<MySource_PRINT id_name="limbo_controls" />

<h1><img src="mysource_files/my_account.gif" alt="My Account" /></h1>

<h2 id="currentUserName"><MySource_PRINT id_name="global" var="current_user" attr="name" /></h2>

<a href="<MySource_PRINT id_name="global" var="site_link" full_url="yes" />/home/edit_my_details" class="my_details">Edit My Details</a>

<a href="<MySource_PRINT id_name="global" var="site_link" full_url="yes" />?SQ_ACTION=logout" class="logout">Logout</a>

<img src="mysource_files/toolbox_bottom.gif" alt="Toolbox" />

</div>

</MySource_THEN>

</MySource_AREA>



<MySource_AREA id_name="in_limbo" design_area="show_if" print="no">

<MySource_SET name="condition" value="simple_edit_mode" />

<MySource_THEN>

<h2>Current Page</h2>

<MySource_PRINT id_name="admin_access" />

<MySource_PRINT id_name="write_access" />

<br />

</MySource_THEN>

<MySource_ELSE>

<h2>Current Page</h2>

<MySource_PRINT id_name="current_page" />

<br />

</MySource_ELSE>

</MySource_AREA>



<MySource_AREA id_name="current_page" design_area="show_if" print="no">

<MySource_SET name="condition" value="write_access" />

<MySource_THEN>

<a href="<MySource_PRINT id_name="global" var="asset_link" full_url="yes" />/_edit/?hide_frames=1&start_safe_edit=1&asset_ei_screen=details" class="edit_page">Edit</a>

<a href="<MySource_PRINT id_name="global" var="site_link" full_url="yes" />/home/delete_page" class="delete_page">Request to Delete</a>

</MySource_THEN>

<MySource_ELSE>

<a href="#" class="edit_page_denied">No Access</a>

</MySource_ELSE>

</MySource_AREA>



<MySource_AREA id_name="write_access" design_area="show_if" print="no">

<MySource_SET name="condition" value="write_access" />

<MySource_THEN>

<a href="<MySource_PRINT id_name="global" var="asset_link" full_url="yes" />/_edit/?asset_ei_screen=details" class="edit_page_details">Now Editing</a>

<a href="<MySource_PRINT id_name="global" var="asset_link" full_url="yes" />?SQ_ACTION=release_locks&cancel_safe=1" target="_top" class="edit_page_cancel">Stop Editing</a>

</MySource_THEN>

<MySource_ELSE>

</MySource_ELSE>

</MySource_AREA>





<MySource_AREA id_name="admin_access" design_area="show_if" print="no">

<MySource_SET name="condition" value="admin_access" />

<MySource_THEN>

</MySource_THEN>

<MySource_ELSE></MySource_ELSE>

</MySource_AREA>[/html]



You then call this in the correct place in your parsefile by adding this line where you want to print the toolbox:



[html]<MySource_PRINT id_name="logged_in" />[/html]



If you use this system, you need to remote write and admin permission to your asset builders from your authors, or they will continue to see the "Edit This Page" option after clicking "Add new page". Its all controlled by the fact that the authors only get Read permission to the asset builders.

thanks, Avi
this is working out for us now,

… and thanks Ryan, don't worry i tried that method before i got in contact with you.



cheers

[quote]
<a href="<MySource_PRINT id_name="global" var="site_link" full_url="yes" />/home/delete_page" class="delete_page">Request to Delete</a>

(…)

<a href="<MySource_PRINT id_name="global" var="site_link" full_url="yes" />/home/edit_my_details" class="my_details">Edit My Details</a>

[/quote]



Avi,



This is an old topic, but Your code is quite interesting.



I'm curious - what happens when somewhone click on this link:

<a href="<MySource_PRINT id_name="global" var="site_link" full_url="yes" />/home/delete_page" class="delete_page">Request to Delete</a>

(An email is sent or The page changes it's status or LINK1 to LINK2 or some metadata is added? I think about implementing something similar, so any help would be very useful.)



And where You hide details about account:

<a href="<MySource_PRINT id_name="global" var="site_link" full_url="yes" />/home/edit_my_details" class="my_details">Edit My Details</a>

[quote]
<a href="<MySource_PRINT id_name="global" var="site_link" full_url="yes" />/home/delete_page" class="delete_page">Request to Delete</a>

(An email is sent or The page changes it's status or LINK1 to LINK2 or some metadata is added? I think about implementing something similar, so any help would be very useful.)



And where You hide details about account:

<a href="<MySource_PRINT id_name="global" var="site_link" full_url="yes" />/home/edit_my_details" class="my_details">Edit My Details</a>

[/quote]



There is nothing special about those links, so, really they are not going to do anything. Take a look at Avi's full example, which has URLs that pertain to simple edit and the Admin interface.



If you are interested in doing things like deleting pages or changing links from simple edit, you could also do this using triggers with a asset access event, URL condition, etc.

From memory, I believe the link took you to a page that was a form that emailed someone your request :wink:

nnhubbard - I've used recently yours concept of massive upload which is great, thanks!

[quote]

There is nothing special about those links, so, really they are not going to do anything. Take a look at Avi’s full example, which has URLs that pertain to simple edit and the Admin interface.

[/quote]

I’m just interested what functionality beneath links Avi did :slight_smile: I can see links to simple edit and admin interface and I’m using it already.

If there’s a bigger source code that here - please give me a link.

[quote]

If you are interested in doing things like deleting pages or changing links from simple edit, you could also do this using triggers with a asset access event, URL condition, etc.

[/quote]

I can't see Trigger Action Type that delete asset. I can't find an action that move asset to other location, so I don't know how to give "delete like" functionality to my Simple Edit Users :frowning:



Shane - thanks, I'm already using something similar for my public users to "report errors on page" :slight_smile:

[quote]
nnhubbard - I've used recently yours concept of massive upload which is great, thanks!

[/quote]



Wonderful! Glad to help.


[quote]

I can't see Trigger Action Type that delete asset. I can't find an action that move asset to other location, so I don't know how to give "delete like" functionality to my Simple Edit Users :frowning:

[/quote]



You need to use the Create Link trigger action linking to the trach, make sure to check "unlink from all parents" if you do want it completely deleted.

If you are using safe trash you can expect to have some failures with the triggers too.

[quote]
If you are using safe trash you can expect to have some failures with the triggers too.

[/quote]

So I created new trigger that unlink asset from everywhere (not good idea, but it all was on testing server).



I configurated it to unlink asset from GET location (before this I prepared Asset Map with additional link "DELETE this asset").



I'm not sure how to start Trigger but I assumed that I can do it by just entering just it's assetid, so I just passed Trigger ID with GET variable.



Probably I did something wrong - now I see only:

URL "http://matrix.local/error/HTTP_INTERNAL_SERVER_ERROR.html.var" not found [SYS0218]



So it's time to recreate testing environment from backup :slight_smile:

The world of Matrix triggers can be a frustrating experience when you are starting out. I am not sure of the topic I'd but if you search for a topic about debugging triggers there is some stuff in there that may help you.

[quote]
The world of Matrix triggers can be a frustrating experience when you are starting out. I am not sure of the topic I'd but if you search for a topic about debugging triggers there is some stuff in there that may help you.

[/quote]

I don't know why - but testing server seems to work again without recovering from backup.

I will try to find topics about debugging triggers.



I'm not happy about starting triggers. I see that linking Trigger ID doesn't work (like it is in Asset Builder). So when I wanna start a trigger for particular asset - I probably need to set some metadata or move it to other folder first - to use a Trigger action. This is frustrating…



Is there a possibility to start trigger by link or button?

[quote]
Is there a possibility to start trigger by link or button?

[/quote]



You made sure to enable triggers on the details screen of the Trigger Manager, correct?



Yes, you can call a trigger from a link or button. Just set up a trigger, with the "Asset Accessed" event. Make sure to add detailed Conditions such as root node, asset type, etc. Then add a URL matches condition, and set it to match something like action=create_link. Then, when you set up your trigger, you target the URL that will satisfy your conditions, and append the action:


    My new trigger button


You can always add a little javascript in there to prevent the link from actually taking you to that page.

I would encourage you to read the triggers manual ans search all the triggers posts in the forum and give Nic's suggestion above a go. If you are still having issues then maybe start a new post as it would be useful for other people and not so hidden within a post about designs. Good luck