Hide the long URL when opening or editing Xpages - xpages

Is it possible to hide the URL of the action of opening or editing a document in a XPage?
I am trying to avoid this:
http(example)://notesdev1.my_company.com/po/po.nsf/%24%24OpenDominoDocument.xsp?databaseName=CN=My_Company_NotesDev1/O=HCI!!PO%5CPO-data.nsf&documentId=E879C68A9A88F6DD87257BC6005A0748&action=editDocument"
I don't think you can use site documents for URL's that open specific documents. I started out customizing the 'Default Action' and 'Document id' of the Document data source. I then switched and tried rebuilding the URL in the beforePageLoad event, and using context.redirectToPage but it still shows the long URL.
I would like to know if I can have control over the entire URL, and still direct pages as I see fit. I know that I can't stop a user from Bookmarking, but if I can control the URL, I can prevent the user from bookmarking intermediate steps in a wizard, and also avoid ugly URLs.

You can use a website document to mask those long urls. Your short url needs to have the DocId visible and then you can map it by a substitution rule.
The other option is to compute your data source. You set it to ignore request parameters and use your own:
http://yourserver/some.nsf/thexpage.xsp?doc=unid
Then use the context to retrieve the Unid and compute

Related

How to force a Live Url (AbsoluteUrl) to update on a Kentico page type

I'm looking for information about how the Live Url (Absolute Url on the back end) regenerates and what triggers it to update.
Using Kentico 12SP MVC I have a pretty normal NewsArticle page type that uses a custom url pattern of "/news/{% UrlSlug %}" to route to an article. It was previously using AliasPath but because the content editors wanted the ability to create slugs that would be longer than the 50 character limit we created a custom field for it.
On any page that I create from scratch and many newer pages that I've edited this works out just fine and changing the UrlSlug to the desired (very long) slug updates the url. On a huge number of older articles though it appears that changing the UrlSlug has no effect on the Live Url. On many the url has changed to just "/news/" and others it's still showing as the old url (based on NodeAlias). I can still route to the page by hand typing the UrlSlug based url, but I've been using the TreeNode.AbsoluteUrl which is based on the Live Url (afaik) to generate menus and sitemap items and those are all still refusing to update on a large portion of our articles.
Hopefully someone knows how to force them to all regenerate or at least has a clue why some would be working and others not.
The "Live URL" displayed on the Page "General" tab is sourced from CMS.DocumentEngine.DocumentURLProvider.GetAbsoluteLiveSiteURL(TreeNode node);
Eventually that calls out to DocumentURLProvider.GetUrlInternal(TreeNode node);
You can override this with a custom DocumentURLProvider by registering a custom provider.
This would let you call the base.GetUrlInternal(node) and see what that is returning.
One conditional that is checked in the original DocumentURLProvider is NodeIsContentOnly, which is in the CMS_Tree table.
So I would check and make sure that all the pages with issues have this set to true (1 in the db column), otherwise the traditional Portal Engine Live URL generation takes effect.
At no point is there any 'regeneration' of Live URLs. What is displayed is coming from the values of the Page Type configuration (URL Pattern), the Node in the db, and the value populating the Macro Expression in your URL Pattern.

Kentico Form - Edit Form Action and Field Names

I have a form built in Kentico and want to change the form action to point to a marketing automation vendor website (eloqua) to process the form. I noticed that there's no way to change the Action on the Form app, so I thought of using js to replace the action dynamically. I'm not sure whether it'll work, but another immediate problem I have is the field name/id generated by Kentico is so long (> 70 characters - e.g. p$lt$ctl02$pageplaceholder$p$lt$ctl03$On_lineForm$viewBiz$Company$txtText) and exceeds the length allowed by the vendor. Is there a way to shorten those names/ids?
To clarify, the reason I need to edit the name because the vendor allows to map (copy/paste) html name to whatever name it's using. I've tried pasting the whole string from one Kentico field and got the error message of exceeding character limit.
First part of the question, how do i direct a form to submit to another site?
In ASP.Net, the only way is to use javascript to alter the 's action url. Since you want to be careful where you edit this, i would use jQuery to replace the "Submit" button on your form with a javascript function that will alter the form before submission (so you don't mess up other postbacks)
$("button.MySubmitButton").click(function() {
$("form").attr("action", "http://TheVendor.com/PostLocation");
});
Next question is to alter the field names. If you absolutely MUST have form element IDs sub 70 characters, you will have to use Javascript again and it will break any postback-related functionality of the elements, so make sure the form is "as is" before doing it.
Again there is security concern because when you post to another location, you are sending ALL the data, including hidden asp.net inputs that contain viewstates and the like. You may want to take the time to 'eliminate' right before you submit any field that you don't want sent to the other site.
Something like this (Test it out a bit first though)
$("input:not(id*='txtName'):not(id*='txtEmail'),select:not(id*='ddlQuestion')").remove();
As #trevor-j-fayas points out, you can use javascript to point a form action to another url. While this does work you may end up writing a lot of javascript to not only point the form to a new url but also to do some data massaging (changing id's, doing url formatting, etc) before sending it to the target.
Additionally you lose some of the benefits of using a Kentico Form because the data never actually gets submitted back to Kentico such as email alerts.
I have worked in a similar scenario where were we sending data to Eloqua but instead of doing it client side we did it from the server by using either:
The OnOnAfterSave event on the BizForm control itself
The global BizForm submit hook BizFormInfo.TYPEINFO.Events.Insert.After
After the form is submitted to Kentico, our custom hook code runs which sends the data to Eloqua. In either hook you can fully access the Form metadata, field names, and submitted values. You can then craft an HTTP POST request and submit it asynchronously using a class such as HttpClient.
Is not a good idea from the architecture stand point and most likely not going to work without opening a huge hole in their vendor web site security. First of all how are they going to process the from if they don't know the field names, what if form fields change etc. Secondly you going to run into hell of trouble trying to submit form one site to another etc. What if the vendor site is not responding etc.
What you need to do is submit the form back to kentico web site i.e. process it on kentico web site and send email notification with results to marketing automation vendor website (the easy way for now) and redirect user to vendor web site.
Redirection and email - you can do out of the box without any programming. Actually to do all the above requires no programming and you get all the information recorded on your Kentico site.

Friendly URLs in XPages

in order to open a document with an XPages, we have to call an url with following format :
http://server/database/name_of_xpage.xsp&documentID=xxxx
In one of my databases, the documents to open contain a "title" field.
I'd like to open the document by using an url like this : http://server/database/title_value
How to force the domino server to answer to such an url and to open the related XPage (like it's working on stackoverflow web site)
There are few options:
administrative solution - you can configure Domino to translate URLs at server level
XAgent, Form opening script, LotusScript agent - to redirect to correct URL
Form property to redirect to XPage, described below.
All you need is to make a view with short name or alias, "key" for example. First sorted column should contain your key value. Form property of every document should define XPage to open on web. Then url like this http://server/database/key/title_value will work. With one small caveat.
Create a web site substitution rule to redirect http://server/database/* to
http://server/database/yourxpage.xsp?openPage=*
You could create an XAgent (I called mine "open"), and take in smaller parameters to open the document. For example, let's say your main XPage "form" is called "xpDoc". Here is your XAgent (code in afterRenderResponse):
var val = context.getUrlParameter('title');
var nd:NotesDocument = database.getView('viewname').getDocumentByKey(val);
context.redirectToPage('xpDoc.xsp?documentId=' + nd.getUniversalID() + '?OpenDocument');
So, using this simple XAgent, you can use URLs to open documents, like so:
http://server/database/open.xsp?title=title_value
I just tried it out in a development db I have, and it seems to work pretty well. You can always make the XAgent name and "title" parameter smaller, to make the link smaller.
Take note that with this option, you won't need to update the NAB with any website rules. Since you want to link to documents, I'm assuming that you have more than a handful of documents in your application. Adding website rules in the NAB, I don't think, would be a good option as this would add a lot of extra maintenance. With the above method, everything can be done within your application.

Sharepoint 2007 custom DispForm.aspx issue

I have a custom list tracking idea submissions (think virtual suggestion box) where I am attempting to customize the DispForm.aspx so that users will not see fields that are not directly relevant to viewing the submission.
I am making a copy of the original DispForm.aspx and renaming to i_DispForm_mod.aspx and then changing the settings of the list to use this as the display form.
Problem is, once I modify the display form settings, it takes over the whole ball of wax. I can no longer access EditForm.aspx. Clicking on "Edit" gets you the display form.
Creating the URL to the edit page manually takes you to the display page. Creating a new item works as normal.
For some reason, SP is deciding to redirect all requests for EditForm.aspx to the display form. Properties for the list supporting files are set to all the appropriate pages - but SP is ignoring that in favor of serving up the display form. WTF?
I have no idea how to fix this. This is my second go-round with this after abandoning the first list created when I first got this behaviour.
Oh and just to add additional fun, the behaviour persists after restoring to original DispForm.aspx and resetting list supporting file properties appropriately.
Absent solutions I may have to mark DispForm.aspx as radioactive, do not touch and abandon my design as unattainable.
I cannot find anything similar being documented anywhere on the web.

Associate 2 pages' analytics datas

I have a page with this url : example.com/someurl.
For some reason, I made a 301 redirection on it to example.com/some-url
But I would like to make sure that ancient datas for the first url will be associated with my new url.
Because if I export my datas, I'll have two entries which means two different pages, but actually this is only one page.
Thank you :)
Alas this doesn't work to well. Your best chance would be to use virtual pageview and pass in the old url to the pageview tracking on the new page:
ga("send","pageview","/some-url");
Alternatively you can create a filter in your GA view settings that rewrites the new url to the old url.
This will work for newly incoming hits. Data that's already connected will not change, and you cannot really consolidate after the fact.
You can use filter in settings
Filter Type: Search and Replace
field request URI
Search String: /some-url
Replace String: /someurl
And its merge wtih historical data

Resources