MVCSitemapProvider current node not detected - asp.net-mvc-3

I am using MvcSiteMapProvider 3.3.3.0 and have a file MvcSiteMap.sitemap which contains two nodes defined as follows:
<mvcSiteMapNode title="Node1" controller="MyController" action="MyAction" type="A" />
<mvcSiteMapNode title="Node2" controller="MyController" action="MyAction" type="B" />
My routes in global.asax.cs are configured "out of the box", so the URLs are:
Node 1: http://server/MyController/MyAction?type=A
Node 2: http://server/MyController/MyAction?type=B
Now if I navigate to Node 2, I find that MenuHelper.GetCurrentNode() returns Node 1.
Why is this and is there a way to get MvcSiteMapProvider to recognize a current node based on the querystring parameter?

I believe this is possible although I have not tested this. You should check out the wiki at their github repository. It has some usefull information but it still lacks some basic examples.
https://github.com/maartenba/MvcSiteMapProvider/wiki/Dynamic-sitemaps/

Unfortunately there is no way to do this.
I got around this problem using a custom DynamicNodeProvider, but it doesn't seem to fit in your case.

Related

Why can't I search DocumentReferences for a particular subject using Spark server for FHIR DSTU-2 1.0.1?

I have a Patient resource at this url: http://localhost:49911/fhir/Patient/PHFId1
and DocumentReference resource with the following element:
<subject>
<reference value=" http://localhost:49911/fhir/Patient/PHFId1" />
</subject>
I want to be able to get a list of all DocumentReferences belonging to a certain patient but everything I have tried either returns no results, or else returns all Document References on the system. Some of the variations I have tried include:
fhir/Patient/PHFId1/DocumentReference (404 Not Found)
fhir/DocumentReference?subject:Patient=PHFId1 (no results)
fhir/DocumentReference?fhir/Patient/PHFId1 (no results)
fhir/DocumentReference?subject.reference=PHFId1 (no results)
What am I doing wrong? It must be a common use case to require a list of all documents relating to a Patient. Perhaps I have set up the linkage incorrectly by using the subject element?
Thanks in advance
The search syntax you've used is only correct in the second line, but other than that you're not doing anything wrong. This is a known issue in the Spark server (see https://github.com/furore-fhir/spark/issues/6).

How to correctly add constraints to the querybuilder node for CQ5 Reports

I'm working on creating a custom report report page in CQ5. I've got my reportbase and columnbase components set up correctly, by following the steps listed here. I am able to, for instance, pick up all the templates that are available, by setting the property nodeTypes to cq:Template
I want to add a constraint to it, say for example pick up templates whose jcr:title is foo. I created a node under querybuilder called propertyConstraints and added my constraints in the form of nodes below it, as describedhere. However, this does not work for me at all.
What is the correct way to add constraints to the querybuildernode? Has anyone tried this?
Also, once I get this working correctly, can I extend this example to return pages of a specific template?
Have you looked into the QueryBuilder API? Adobe's documentation discusses how to match 1 or more property values.
Create a node propertyConstraints under queryBuilder of type nt:unstructured
create another node under propertyConstraints with any name.
Add properties to this node :
name String jcr:title
value String foo

MVCSiteMapProvider: non-clickable nodes with security trimming enabled

I am using MVCSiteMapProvider, v4.6.1
This is my issue: I have a section of my menu that is visible only to Administrators. I achieve this by enabling security trimming and decorating my controllers and/or controller methods to define the trimming criteria.
AdminTasks
Add
Edit
Remove
What I need to do is to make the "AdminTasks" node non-clickable, but still visible only to administrators.
The behavior I am observing is that, if I mark "AdminTasks" as clickable="false" in the sitemap, the node show for everyone, regardless the user is an admin or not. It seems like, in nodes marked clickable='false' there is no security trimming performed.
It is my assumption, without exploring the code too much, that when the node is marked clickable='false', SiteMapProvider doesn't attempt to resolve any route (since it is not needed anyway for navigation purposes); but in doing so, it doesn't inspect the decorations in the controllers, therefore skipping security trimming.
Is my assumption correct?
Is there any way to have a non-clickable node that still is security trimmed?
Thanks
Non-clickable "grouping" nodes don't represent a controller action, so there would be no reasonable way to control security on them using AuthorizeAttribute.
However, you can use the TrimEmptyGroupingNodesVisibilityProvider to make a non-clickable node invisible when there are no accessible nodes nested within it. Therefore, if the current user doesn't have permission for any of the children of the "Admin Tasks" node, the "Admin Tasks" node will be hidden.
<mvcSiteMapNode title="Admin Tasks" clickable="false" visibilityProvider="MvcSiteMapProvider.TrimEmptyGroupingNodesVisibilityProvider, MvcSiteMapProvider">
If you have a more complex scenario than this, you could also build your own visibility provider.

How to build CodeIgniter URL with hierarchy?

I know this doesn't exactly match the form of www.example.com/class/function/ID/, but what I want to display to the user would make more sense.
This is what I would like to do:
www.example.com/project/id/item/item_id/
So, an example would be:
www.example.com/project/5/item/198237/
And this would be the behavior:
www.example.com/project/ --> This would show a list of projects (current implementation)
www.example.com/project/5/ --> This would show a list of items on project 5 (current implementation)
www.example.com/project/5/item/ --> This wouldn't really mean anything different than the line above. (Is that bad?)
www.example.com/project/5/item/198237/ --> This would show details for item 198237.
So, each item is directly associated with one and only one project.
The only way I can think how to do this is to bloat the "project" controller and parse the various parameters and control ALL views from that "project" controller. I'd prefer not to do this, because the model and view for an "item" are truly separate from the model and view of a "project."
The only other solution (that I am currently implementing and don't prefer) is to have the following:
www.example.com/project/5/
www.example.com/item/198237/
Is there any way to build a hierarchical URL as I showed at the beginning without bloating the "project" controller?
There are 3 options, sorted by how practical they can be:
Use URI Routing. Define a regular expression that will use a specific controller/method combination for each URL.
Something like that could help you, in routes.php:
$route['project/'] = 'project/viewall';
$route['project/(.+)'] = 'project/view/$1';
$route['project/(.+)/item/'] = 'project/view/$1';
$route['project/(.+)/item/(.+)'] = 'item/view/$2';
That is, considering your controllers are item and project respectively. Also note that $n in the value corresponds to the part matched in the n-th parenthesis.
Use the same controller with (or without) redirection. I guess you already considered this.
Use redirection at a lower level, such as ModRewrite on Apache servers. You could come up with a rule similar to the one in routes.php. If you are already using such a method, it wouldn't be a bad idea to use that, but only if you are already using such a thing, and preferably, in the case of Apache, in the server configuration rather than an .htaccess file.
You can control all of these options using routes.php (found in the config folder). You can alternatively catch any of your URI segments using the URI class, as in $this->uri->segment(2). That is if you have the URL helper loaded. That you can load by default in the autoload.php file (also in the config folder).

Jenkins—get "Build Time Trend" values using "Remote Access API"

Is there a way that we can get all Jenkins-"Build Time Trend" information ( Build number + Status[success/failed etc] + Duration ) for an application; using the Jenkins remote access API?
Or else I would appreciate if you could post a link of any documentation on how to get information from Jenkins using the Remote Access API. Most of the sources consist of the way of running jobs, but I couldn't find any, which shows how to fetch information from jenkins.
Thanks!
You can use something like this URL:
http://jenkins:8080/job/MY-APPLICATION/api/json?tree=builds[number,id,timestamp,result,duration]
There's a little more documentation in the root api element:
http://jenkins:8080/job/MY-APPLICATION/api
I admit to not completely understanding the tree parameter. I couldn't find a simple example of retrieving the entire builds subtree.
I admit to not completely understanding the tree parameter. I couldn't
find a simple example of retrieving the entire builds subtree.
You can access the entire subtree of an element by using [*] such as http://jenkins:8080/job/MY-APPLICATION/api/json?tree=builds[*]
Cheers,
For retrieving ALL builds, use
http://jenkins:8080/job/MY-APPLICATION/api/json?tree=allBuilds[number,id,timestamp,result,duration]
Note that B is capitalized in allBuilds

Resources