Confluence rest API - get labels that are used in the pages - search

I have code written which pulls all the labels created under the ancestor pages. That is throwing all the labels that are used/not used to the pages.
What I want is to only get labels that are attached to the pages.
My code:
`search?cql=(ancestor="page-id" and lastmodified>="${year}/${month}/01")&expand=metadata.labels&limit=1000`
Result:
abc // not assigned to page
def // assigned to page
ghi // not assigned to page
However, only one label is attached to the page for example "def"
Expected result
def // assigned to page
I couldn't find any query in the confluence documentation to get the labels if they are actually assigned to the pages
https://developer.atlassian.com/server/confluence/advanced-searching-using-cql/
Can anyone know if this is possible?
Thanks

Related

Orchard CMS: Using different Layout for Anonymous users

I would like to use a different layout view for anonymous users. I have tried using url alternates and I am not sure how I can create a layout for anonymous users since there is no particular url for them.
The idea is that, if a new user visits the site I want to show a splash screen with very limited information with an option to register/ login to view the full site. This splash screen will have a completely different layout / look and feel from the rest of the site.
I tried using the Anonymous user layer but all I could do was move widgets (maybe I am missing something).
Any help would be greatly appreciated.
Thanks!
There is no out of the box solution but you can do something like this to get what you want:
Add new layout in a file with the name of your choosing - for example, you could name it Splash.cshtml.
Add the code below to the top of your Layout.cshtml template:
#if (WorkContext.CurrentUser == null) {
#Display.Splash()
return;
}
The code will check if the user is logged in. If it's not, it will render the content of your Splash.cshtml template, and stop the rendering of the rest of the Layout.cshtml template.
If you need to display any of the widgets in your Splash.cshtml template, you could add it by simply adding #Display(Layout.NameOfTheZone) where you should replace NameOfTheZone with the actual name of the zone you're using inside the Layout.cshtml template. Generally, anything that you use inside Layout.cshtml template with the Model object, you can use through Layout object inside any of your views.

Mixing Orchard CMS content with module

I am currently working on an Orchard module. This module contains an MVC application including the views. I would like to make the module as configurable as possible. One of the items that I would like the customer to configure is the way the MVC views from the module look. Part of it will be determined by the theme. But not everything. Consider the following scenario:
The module contains a view for placing an order. The view displays a form in ´normal view way´. That is field labels and input labels. But at the head of the form each customer must be able to define his own set of instructions to display. Or maybe the customer wants to put there a message for pointing the customer to some other actions.
In the most ideal way I would have a content page where the customer can put all kind of content and one specific block that is the result of the view of the module. Kind like a web part. I can´t find out if it is possible and how that is achieved.
Edit for clarification
Module creates a page like this:
TITLE
FORM
So both title and form are outputted by the module controller.
I have managed to create a layer with the condition that the url matches the page with my form.
I have added a HTML widget to this layer in the content zone with position 1 (tried 0 to).
However the pages looks like this:
TITLE
FORM
WIDGET
instead of
WIDGET
TITLE
FORM
Returning a ShapeResult from your controller action will ensure that your view is themed and benefits from widgets, which are your "kind like a web part" thingies in Orchard.

XPages Mobile Controls - sessionScope variable being lost

I am building a mobile app for iPhone using the mobile controls in the XPages Extension Library.
The first page displays a list of categories (happens to be a list of user names). When a category is selected the second page is displayed listing all documents belonging to the selected user.
The URL to open the second page includes a parameter with the user's name. The second page has a page heading control and on the "label" property I have added the following code:-
if (param.get("User") != null) {
sessionScope.put("UserName", param.get("User"));
}
return sessionScope.UserName;
I'm doing this so that I have access to the user name on subsequent pages, e.g. the third page is displayed when the user opens a document from the list on the second page.
When I test this in Chrome everything is fine. When I test in Safari I can see that the sessionScope variable is set when the second page is opened. However, when I select a document and the third page is opened the sessionScope variable is disappearing. I can't see any code that would explain this and when tested in Chrome the sessionScope variable is still there on page 3. Unsurprisingly I get the same issue when I test on an iPhone.
The problem this gives me is that, when navigating back from a document (p.3) to the list of documents for the selected user (p.2) I don't know which user was selected originally.
Anyone seen this before or have any explanation as to what might be going on?
Thanks for any suggestions.
you might want to refrain from the parameter approach unless you are sanetizing your input first, so instead of the URL write the userName directly into the scope - or even easier - bind the first field with the categories to the sessionScope. Did u try to modify your code to use a different variable name?

How to show list of custom objects in a page in Drupal

I want to create a page in Drupal 6 where I can show list of restaurants.When a user clicks on any restaurant page, I should be redirected to Restaurant details page.
For this :
1.) I created a new content type called "Restaurant" with some fields.
2.) Created 3-4 content items for Restaurant( Restaurant1, Restaurant2, Restaurant3)
3.) Created view called: RestaurantList, Added Fields for it. Then added Page Display and gave the path for it http://website/Restaurants
Now, when I browse to Restaurants page, I only get labels of my fields but no values. How can I get the values but not the labels? Also, I want to go to the RestaurantDetails page. How can that be achieved?
Thanks,
Rashmi
Well if I were to set up a page view this is how I would set it up:
Filters:
Node type - Restaurants
Node published - Yes
Fields
Node title
check the option Link this field to it's node
leave the Label: field empty
check option Hide if empty
And if your view style is a HTML list, for extra you can go to Row style options and check the option: Hide empty fields
Make sure you click Preview to see if you get any values. If you don't then there's something wrong with the view settings, most probably the filters which are to restrictive. Start with something loose, like Node type - Restaurants.

Read value from one aspx page to another

i have two pages: 1) web control(ascx page) and 2) web page(aspx page without master page).
Now i calculate some values on page2 through google api through Javascript on render, and i need to transfer these values to page 1 in a hidden field through code. please help
Khushi
One way (of many):
On the Client side: Fill the hidden
field, submit the form (with js)
Code Behind
Page 2: Collect the data in the code
behind, Populate the session,
Response.Redirect to page 1
Another:
Without using the the hidden field, you could
just append the calculation result to
the query string. (/page.aspx?myResult=xy)
Obvious, quick answer: use querystring or Session object.

Resources