I'm transitioning a corporate web page into a new xpage platform. It consists of a number of department-specific databases each with their separate ACL's with the old forms and docs, and one new xpage db front end presenting data from across the other db's read only. The content is regulations and resources for the rest of the organization to relate to.
The design consists of just a few custom controls which collects data sources dynamically via properties on the various department specific xpages. So like 30 xpages collecting data from separate db's utilizing the same handful of cc's
My scoped variable issue is related to my cc_dataViewLocal . This dataView presents the documents from the corresponding views in the source db's. To let the user know their present location in the application I pull in the name of the current view and display the name above the Data View as a headline on the DataView xpage:
<xp:text escape="true" id="computedField1" styleClass="ksHeading2">
<xp:this.value><![CDATA[#{javascript:getComponent("dataView1").getData ().getView()
}]]></xp:this.value>
</xp:text>
All documents from all databases are presented using the same documentDisplay xpage with a dynamic document data source. Thus this xpage does not have any properties but is referenced trough the data view xpage:
<xe:dataView id="dataView1" collapsibleCategory="false"
rows="50" style="font-size:8pt" rowStyle="font-size:8pt"
collapsibleDetail="true" pageName="/**ks_documentDisplay.xsp**"
var="rowHandle">
--
When I open a document from the data view in documentDisplay.xsp I want the same headline/name of the original view displayed there as well. To make that happen I try to catch the view name in a scoped variable in an afterPageLoad event in the data view xpage, to redisplay it on the documentDisplay xpage.
<xp:this.afterPageLoad>
<xp:setValue binding="#{sessionScope.ksView}">
<xp:this.value><![CDATA[#{javascript:getComponent
("computedField1").value}]] ></xp:this.value>
</xp:setValue>
</xp:this.afterPageLoad>
After all the view name is not part of the document data source, and I have no other handle to the parent view at this point as I can see.
--
When I display the scoped variable on the dataView xpage in a computed field it works fine:
<xp:text escape="true" id="computedField2"
styleClass="ksHeading1" value="#{sessionScope.ksView}">
However, when I try to display the same session variable in the documentDispay xpage using the same computed field coding it turns up empty. Like the sessionVariable is lost to the next xpage?
I started out with a viewScope, and tried both request and session with same results. What am I missing??
Any input greatly appreciated! Including workarounds but would like to get a grip on the scoped variables...:-)
Regards to all who read this somewhat long post and thanks in advance!
Vidar Solevag
Thanks again for pointing me in the right direction. The problem clearly was I wiped the sessionScope in some way or other, exactly how I still don't know.
But as often is the case the solution was to do something else to get the same thing done...
What I found not to work:
-Moving the event to onClientLoad didn't work it threw an exception "cannot handle". In addition my original approach afterPageLoad did't really work either as it didn't update properly as other dataViews were chosen via Navigator on the page. Also setting the variable via the "Set" option on the simpleAction list turned out to be a problem. I got several "Not allowed to set the value of a read only computed expression"
What I did that worked:
-I set the value not by "Set"Simple action but by "Excecute script" and code
sessionScope.ksView=context.getSubmittedValue(). This in the onClick event in Navigator that selects which Dataview to display On the DataView xpage Then the SessionScope remains alive all the way into the documentDisplay xpage and until a different Dataview is selected back in the Nav back on the DataView xpage.
Now using the same sessionScope as the viewName property on the xpage I also set the sessionScope initially on afterPageLoad to have a default value when page is first opened...
So thanks again, a lot of headbanging into the wall here but that's what you learn from I guess :-))
Related
I need to set several meta tag values in my page head to values set in blog post custom fields.
How do I access the blog item viewmodel from the head?
I've created a separate MVC view snippet for my custom head and referenced it in my template's layout, that much works.
Tried
I grab some of the same custom field values inside my blog template via references like Model.Item.Fields.MyFieldName.Fields.Title.
Adding this same line to the head template throws a
System.Web.HttpCompileException with little useful information attached. I somewhat expected this, as I suspect that viewmodel for the blog post only exists in the context of the blog widget.
Ends up that I need to rebuild after every change to the head cshtml file or I get this error. Seeing as this is about a four-minute process with Sitefinity (15 seconds to build, 3:45 to do whatever Sitefinity does for about four minutes), this is a gruelingly horrid thing to have to do.
However the Model is null at this level.
Also tried
Per the ever-helpful and highly knowledgeable #Veselin Vasilev, I looked into passing the data up via MetaDataFields. I didn't see these options in my admin section for the widget. To clarify, I'm using the built-in "Blog posts" widget with a customized view file.
But if it's possible to do this, it gives me hope that there's a way to pass more data up, even if it's going to take some work.
EDIT: Sitefinity v.10.2 and above:
There is an easier way to achieve what you are trying - in Page edit mode, in the Blog Posts widget click Edit and then Advanced. Then you should see a MetaDataFields button. Click it and you should see several meta data related fields.
In the MetaTitle field put the name of your custom field and save.
Also, from the docs:
If you leave MetaTitle field empty, Sitefinity CMS adds takes its value from the Title field of the static content item or from the identifier field of a dynamic content item. Otherwise, the tag is populated with the contents of the field that you have entered in MetaTitle field.
More details here:
https://docs.sitefinity.com/configure-meta-title-and-meta-description-on-widget-level
Sitefinity 10.1 and below:
Check this article
Basically, in your view you get a reference to the Page object and then update its Header with the meta data you need.
It is possible to define pagination on document library?
I have a document library with more that 10000 documents... when I open the library occurs an timeout.
Actually SenseNet already does this! They just don't deliver it in the standard list control. If you open up the PRC and navigate to /Root/IMS/BuiltIn/Portal you'll see a list control with paging. The code can be found at /Root/Global/renderers/UserExploreGrid.ascx as User Control portlet. You can copy the code and change it to meet your needs.
Our company prefers to create User Control portlets and use Datatables with calls to the SenseNet OData API using skip and top to deliver pages.
Finally, given that SenseNet Content is stored as a tree structure (in SQL!), you can move the Content after creation so that data is organized hierarchically. A common solution is to take the first letter of the DisplayName and create a sub-folder from that letter, thereby reducing the number of items at a single node.
Here's what the paging looks like:
The short answer is no. Right now there isn't a built in functionality for that.
The long answer is that you can make a pagination yourself. One of the core member of sensenet made a grid where you can use pagination. It won't work with the current free to use releases because they lack the js files she used. But the idea behind it, is using a custom view. Which you can achieve by adding a system folder named Views under a the Document library and adding your custom view there.
You can use this grid for Explore, just follow these steps:
Go to the Explore action page, and switch editor mode on the PRC.
Place a ClientContext portlet (this can find under the Portlets->Application section in the portlet picker dialog) to the Wide column. Set portlet (client context porlet) properties, Apparance to None. It is a technical portlet, which allow get the CurrentContext in javascript. This is a very important element to work with this grid. The Grid use the client context.
Place a UserControlPortlet (In the portlet picker, Portlets->Application section) to the Wide Column.
Set portlet properties:
4.1. Portlet title: <%$ Resources: PortletTitles, Items%>
4.2. User Control path: /Root/Global/renderers/UserExploreGrid.ascx
Checkin Page modification on the PRC.
Enjoy your pageable explore portlet.
Keep in mind that this grid is specifically designed for users, so they will miss actions in the top menu. These must be handwritten. Then I suggest you copy the UserControl ( /Root/Global/renderers/UserExploreGrid.ascx)
and then put the action list on it . You can read more info about action list here: http://wiki.sensenet.com/ActionList
Br,
maros
Hello I'm quite new to Kendo UI so my question is probably simple as well.
I am working with datasource of Kendo UI (Javascript) that reads a simple JSON object from a remote source, what works fine.
I struggle now with populating the data into single text fields within the HTML page. I find some example on Kendo UI documention talking about "template", "model", "columns", "binding", etc. but there is nothing I think I can adapt it to my needs. All examples I find are focussed on Kendo Widgets or "grid", what is not what I want.
Example:
I read the JSON by "datasource" object from remote source, looking like this:
[{"productid":"30","title":"apple"}]
In my HTML there are two input fields, one with ID="productid" and another one with ID="title"
I don't need a precise code solution just a hint/link how to proceed to populate the JSON elements into the value attributes of the two input fields. If this is possible is there also the other way possible like storing the values of the input fields back to a datasource and send it back to remote server for saving/updating purposes?
Any hint is welcome!
Sharepoint is quite limited when it comes to multi-Lookups because it saves that information in strings. So I changed the Page-Property
"Elements (MultiLookup-> elementIds" on the propertyPage
to an inserted List "PageElements":
"
(SingleLookup)pageId , (singleLookup) elementId"
Because this is quite hard to maintain for my content admins I want that they can enter that information in the page properties like before instead of adding lines into "PageElements"
Therefore I want to add a control that handles that.
I do not need a solution for the task how to achieve that specific function, but a general hint how to add any custom control into a Page property.
I starting point link would be very nice. I just doen't seem to find the right words to feed google with my topic.
Solved this by using a custom field type with that logic. Basicly Described here: http://avinashkt.blogspot.de/2011/07/creating-custom-field-in-sharepoint.html
I want to query the data from content type without using content query webpart. How could I do this?
My scenario is, I have a page layout, from the page layout I have created a page that contains some site columns values. After clicking on the save button I need to update the field in the page library column. How can I query the data in item updating event of the Site Pages Library.
Any help would be appreciated.
The ItemUpdating event method is passed an SPItemEventProperties parameter named property. This object contains information about the item responsible for firing the event handler. You can access this by calling properties.ListItem[Fieldname] or properties.AfterProperties[fieldname].
Something to note. The value of the SPItemEventProperties.BeforeProperties and SPItemEventProperties.AfterProperties as well as the properties of the SPItemEventProperties.ListItem, varies depending on the Event you are overriding and the type of SP List (List or Document Library). This chart shows these relationships.