Dynamic Navigation Rules - xpages

On a Custom Control I have defined a Navigation Rule xsp-success go to xpDemo.xsp. This works fine, but the Navigation rule is probably one of the only places that there is not the little blue diamond to allow for a computed result. What I want to do is something like this
(viewScope.get("vsSomething") == "Something) ? "/xpSomeWhere.xsp" : "/xpSomeWhereElse.xsp"
I could define a different xsp-??? for each possible success but that would be a blow-up waiting to happen.
In addition I want to re-use the CC in several different situations and the major difference is that where I want to navigate to. I could do a context.reDirectTo() but that then means that I have to repeat the code many times in several different places that might not be totally obvious thus creating a maintenance headache. The obvious place would seem to be the Navigation Rules. I can't believe that I'm the first person wanting to do this but my search has turned up nothing.

They can indeed be computed, just not using the "Navigation" section of the properties pane. If you go instead to the XSP source or to the "navigationRules" element of the "All Properties" section, you can modify the "viewId" property to include a computed value as normal.

Related

Adding Duplicate Content Placeholders for Sharepoint 2013

I am working on our intranet that utilizes a custom .master page. One content placeholder that refers to the search functionality of SharePoint is being utilized in the footer ().
In our site mockup, we envisioned two search boxes, one in the top of the site, above the nav and one in the footer. I thought, easy, I just duplicate that content placeholder which brought up a duplication error from Sharepoint.
My question is this: Is there a way to duplicate content placeholders without needing to create a custom placeholder? And if not, is creating a custom placeholder the best way to go about this?
Thank you in advance!
There are many ways to customize this.
Direct master page change
Add (custom) place holder to master page
Use delegate controls (no master page change required)
Delegate controls allow you to create a regular user control (.ascx) and assign it a sequence number so that it becomes attached to an existing master page control. Using delegates could potentially allow you to attach the same user control to two different controls (delegates).
With all the recent "don't change the master page" buzz, it is becoming ever more relevant, although for on-premise scenarios, you can be a bit more eccentric.
Not only you can't duplicate place holders, but you should also be very careful while removing or even adding existing place holders, no matter how irrelevant they may appear to be. Even their original order matters (e.g. PlaceHolderPageTitleInTitleArea, PlaceHolderLeftNavBar).
refs,
http://blog.sharepointexperience.com/2013/08/missing-apps-you-can-add-with-custom-master-page-in-sharepoint-2013/
http://www.eliostruyf.com/missing-apps-can-add-zone-adding-new-app/
http://www.eliostruyf.com/document-set-view-not-visible-in-sharepoint-2013/
examples,
https://zimmergren.net/sp-2013-some-new-delegatecontrol-additions-to-the-sharepoint-2013-master-pages/
http://www.fivenumber.com/understanding-sharepoint-delegate-control/

Orchard Layouts - Visibility rule explanation

I'm working on a theme that utilises Layouts quite heavily and have come across the 'Visibility Rule' section which I have never noticed before.
Can anyone explain how this is used and perhaps give a use case for it, as I can't find anything in the docs.
Thanks!
This is for custom logic to rule the visibility of an element. Let's say you want to hide an element based on some criterion. You can specify the condition in there, and it will get evaluated. If it evaluates to true, it's visible, otherwise it will be hidden.
The code that does the evaluation is in ElementRuleCoordinator and relies on IConditionManager, which is the exact same interface that's used for evaluating widget rules for widget layers. If you go to the layer documentation, you can find examples.

Dividing long content to subpages

I need to divide long content to sub-pages.
Rule for dividing: Heading1 (H1)
Cms-system: MODX Evolution
As far as i know, there is nothing in modx to use for this kind of problem.
I probably got to do this manually anyway, but i still would like to know if there is a way to do this in MODX Evo / Revo.
Edit:
I need to do this in MODX; sub-pages got to be actual subpages, and original page becomes to container.
Navigation will be done with wayfinder.
Edit2:
All done.. manually. Question still open, though.
This is not possible out of the box and I don't know of any extra that archieves what you want. You would have to write a plugin that acts everytime you save a resource and split up the content, create/delete sibling resources as needed etc. Sounds like a lot of work for what you want to archieve to me.
I suppose you have a look at the MIGX extra. It provides you with a TV with the possibility to store an indefinite amount of distinct TV content sets. Have a look at the documentation and Mark Hamstra's tutorial (with screenshots) to see how it is done. You should define one MIGX entry to consist of a text field for the <h1> and a rich text field for the content of the "subpage".
Afterwards, you can use form customization to hide the original content field and display your MIGX Tv instead.
I think, this is a much easier way to archieve, what you want, and can't think of any way, where you would benefit from actual subpages.
Edit: Sorry, I just recognized that you were asking about Evolution, not Revolution. My solution would work in Revo, but I don't think there's something like MIGX for Evo. Sorry, my mistake.
not 'out of the box' you will have to run your content through a snippet to parse it into separate divs or something that you can run some javascript on to possibly 'tab' the content.
If you need to show the 'subpages' in your navigation, you will probably have to use the gatResources extra to parse your content ~ which will be very expensive on resource usage.
You can (depending on how you're using the tree) just create actual sub resources under the parent resource, using Ditto or Wayfinder to build navigation for it.
If you can't use the tree like that (though from your description I think you can), you could also set up a number of template variables ("content1", "content2", "content3" etc) and show that with a simple snippet or so.

Multiple Edit forms in Sharepoint 2007

I've got a form that gets filled out in stages so I wanted to direct users to a secondary edit form part way through the process. Is this possible?
Hide and reveal using JQuery on the editform.aspx would be my initial choice. I've done this type of work for a very well known bank and it worked very well. Single form with different sections of the form to fill in dependant on the answers provided (and the user group membership)
If you actually want to maintain two lists and hence two forms and redirect between the two - I would look into changing the "source" querystring parameter in the editform so that on completion of the form, you get directed to an alternate location. Not tried it but it would be a sensible place to start looking.

Can I use a Kentico macro to get a partial path?

I would like to know if it is possible to use kentico macros (not necessarily coding a custom one) to access part of the rewritten URL's Path.
Example: http://www.mysite.com/Category/Subcategory/
I would like to get the last part (Subcategory) so that I may then filter content dynamically. The reason I want to use the macro is to simply not have to have 20+ different page templates only so I can have different web part properties.
Assuming you are using Portal templates, and you don't want an 'all items in all subcategories' list on the parent:
Create an Article List web part on the parent page — parent to all the sub-categories.
Set the web part Path to /{0}/{1}/{2}/% (if your path was /Home/Parent/Subcategory for example) or something similar for your environment.
Use the default setting of Inherit for the page template for all subcategory pages.
This will not show anything on the parent page, and the sub-categories will show only the documents under themselves. Note: If you want the subcategory items to have their own views when user digs down to /{0}/{1}/{2}/item, you may need to filter by changing template inheritance, or Document Types on the web part, or something like that if you don't want the whole sub-category list to also show on the item-specific pages.
You can create a custom macro or, you can also use the string operations which are allowed within macros. Please see http://devnet.kentico.com/docs/6_0/devguide/available_macro_methods.htm#string_methods (and you can e.g. use the EndsWith or TrimStrart or something similar).
However, I think the best way would be to create a custom macro which will exactly fit. There might be some combination of macros and macro functions - but I think it is faster just to code a custom one which will cover your need 100%.
Also, you can take a look on the K# if there is something that will fit - http://devnet.kentico.com/docs/6_0/devguide/ksharp_syntax.htm

Resources