How to acquire request parameter from url from Oracle Porta HTML Page Skin? - oracleportal

I hope any of Oracle Portal experts here could help me out regarding this question.
I have a portal template/page that is using a HTML Page Skin. The skin may looks like:
<html>
<head>
<title>#TITLE#</title>
</head>
<body>
#BODY#
</body>
</html>
By using Oracle Portal, I could add portlets (PL/SQL and Java portlet) to the body section, in its respective template/page. However there is no way that I am aware of that could enable me to add portlets to other section in the HTML Skin, eg in section.
I need to dynamically change the title with some value that I get from the page URL and query string.
eg. if the page's url is http://www.example.com/portal/page/portal/examplepagegroup/page1?param1=paramvalue
so that the title will be 'param1', and it should be done without javascript technique.
How could I get the request parameter param1 from the URL so that it will be available to the head section? I am thinking of PL/SQL code to be used here, but, I do not how to access query string of current page.
Please comment here if clarification to the question is needed. Thanks.

The page title is a static attribute of the Portal page. There is no supported way for a portlet to change the page title dynamically at runtime. The rendering engine combines the HTML from each portlet with some HTML it builds itself, and the title is part of what the renderer builds.
What is possible is to dynamically build pages with specific names by calling WWSBR_API.ADD_FOLDER (a folder is the same as a page). See So your portlet could build a page and then redirect to it.
You find the Portal 10.1.4 API at http://www.oracle.com/technology/products/ias/portal/html/plsqldoc/pldoc1014/index.html

Related

Create a template page for html that can be used on every page

I would like to build the equivalent of a _layouts.cshtml page that I can use with every page in my web app. I don't want to use cshtml or razor though I want to use html. Is there a simple way to convert the _layouts page to standard html and then include it with the other pages in the app?
I have inherited an app that uses cshtml, with a _layouts page for menus and some content styling used on each page. I can duplicate the content on every page, but would prefer to have a generic solution for it. The client does not want to use cshtml pages. Any java library, such as AngularJS that would provide tools is ok for me to use. I'm not a front-end guy and this is a relatively low budget operation where I'm working for free. TIA.
i'm not familiar with .cshtml but on an html page you could use an iframe and update the contents of the iframe with different pages as needed.
you could also get external html and put it on the current page using jquery's get().
// get the contents of 'test.html' and put it into the 'result' element
// on the current page.
$.get("ajax/test.html", function(data) {
$(".result" ).html( data );
alert("Load was performed.");
});

WSO2 Carbon: Re-Theming a single page

We have followed the guide provided by WSO2 to get access to the CSS / JSP pages.
Our aim is to re-theme / rebrand / restyle the login page. We have found that the login page is part of the jar: WSO2\repository\components\plugins\org.wso2.carbon.identity.sso.saml.ui_4.0.3.jar
The login page is called login_ajaxprocessor.jsp
The guide mentioned above states the following about JSP's ending with _ajaxprocessor.
By default when create a jsp file ( say “foo.jsp”) in a Carbon UI
component, it will inherit header, left menu and footer from the
Carbon core UI. But if the file name is “foo_ajaxprocessor.jsp”, there
will be no inheritance.
For an example let's consider, “login_ajaxprocessor.jsp” in
“org.wso2.carbon.identity.saml.sso.ui” component. It simply omit the
header, left menu and footer and display only the content from this
file. So we are able to customize this page in to a different look and
feel.
Were were successful in modifying the language (buttons, etc) in the JSP files. This Jar also contains a CSS file in: \web\sso-saml\css\main.css
We have modified this CSS file to my own style. However, when the page gets loaded, it seems the default WSO2 main.css file is read.
When looking at the default way in which the JSP page refers to the CSS, it says:
<link media="all" type="text/css" rel="stylesheet" href="carbon/sso-saml/css/main.css"/>
We would expect that the /sso-saml/ part wordt select our own modified CSS file.
Is it possible to configure that for this page only, our modified CSS file will be used? We want to prevent to have to change the default main.css. Also, it is because we want to use specific images, that we want to store in jar\web\sso-saml\images
Yes you can use your custom style pages and apply them. Please refer [1] [2] for more info. This will guide you on your task.
Hope this will help you.
[1] http://wso2.com/library/knowledge-base/2010/11/customize-ui-theming-wso2-carbon-based-products
[2] http://wso2.com/library/knowledge-base/2011/11/playing-around-carbon-product-themes
The login.jsp can be found in following jar.
/repository/components/plugins/org.wso2.carbon.ui_4.0.5.jar => /repository/components/plugins/login.jsp
and css => /repository/components/plugins

How to include HTML contents from another site? I have access to both sites

I have a site which is using DNN (DotNetNuke) as a content management system. I am using another site for my event registrations. I have sent them my template; which displays the basics including a hover menu with many different items in it.
Issue is - as I update the menu on my site using DNN, I need it to be reflected on the site using my template - without me having to send them a new file. Anyone have suggetsions on how to approach this?
I don't want to send the events provider all of the DNN DLLs as well as my database login information in order to render the menu.
I created a page on my site that is something like 'menu.aspx' - this produces the menu in HTML format, however it has tags like in it that I'd like to remove before serving it to them.
What is the best approach for this? Do I need to write a custom server control using XMLHttp? Can I accomplish this in Javascript?
Any advice much appreciated.
Thank you!
If both sites are hosted on the same domain (eg site1.domain.com and site2.domain.com) you can use JavaScript and XmlHttpRequest to insert code from one site to another. Otherwise, the Same Origin Policy prevents you from using AJAX.
If they're not on the same domain but you have access to the page on their website, you can simply include there a JS script from your site :
<script type="text/javascript" src="http://yoursite.com/code.js"></script>
In the JS, simply document.write() what you want on the page. This way, you can easily change the content of the page on their site without having to send them a new file.
Finally, you can also use an iframe on their site, pointing to a page on yours.
EDIT: As Vincent E. pointed out, this will only work if they're on the same domain - my bad.
If you are unwilling or unable to use frames, then I would set up an ashx on your DNN server which renders the menu (if you've got it in a user control all the better, as you can just instatiate it and Render it directly to the output stream) and then just make an Ajax call to that from your events page and insert it directly into the DOM.
Here's a quick and hacky jquery-based example of the events page end of things:
<script type="text/javascript">
function RenderMenu(data)
{
$('#Menu').html(data);
}
$(document).ready(function() {
$.ajax({
type : 'GET',
url : 'http://localhost/AjaxHandlers/Menu.ashx',
data : '',
success : RenderMenu,
});
});
</script>
You'll want an empty div with the ID 'Menu' on the page where you want your menu to sit, but apart from that you're good to go.
If for whatever reason you can't get the menu HTML in an isolated way, then you'll need to do some text processing in RenderMenu, but it's still do-able.
I am not a web expert, so don't shoot me.
Can't you just put their registration form into an iFrame in DNN ?

How do I use Google Analytics with Sitecore 6?

I know that I need to add the tracking code snippet at the bottom of all my pages, but is there a central location to do this?
Or do I need to add this tracking code to all of my templates?
I guess that I could wrap the snippet in a user control, or external .js file, and reference it on each page, but is there a global footer somewhere? The site I'm working on has about 30-40 layouts, and adding it to each one would be a pain!
Thanks in advance!
Actually, the role of a Sitecore layout is exactly this; to act as a global file that all individual page templates "derive" from.
Normally you'd stick the analytics code into the master layout, and use Sitecore sublayout/placeholder techniques to construct the various page templates you need. You would not normally need more than perhaps one or two layouts for any device you are serving content to. And I guess for most sites, the only device in use is regular web content delivery.
That being said, what you could do, is have all the layouts inherit their codebase from a common base class (inheriting from Page), and inject the google code centrally from here. Would still require you to go through all layout files however.
I have not tried the module, I think that is codebehind version. I have made this in XSLT, its pretty fast and easy to make. I have footer.xslt where I put the code that simply checks if page you are standing on uses template that I want to index and does not belong to page names that I want to exclude. Then I have an item with a custom template for Google Analytics with following memo fields.
IncludeTemplates -field contains list of templates that I want to include for analytics :
ExcludeItemsNames -field for excluding pages by item name
contains($includeTemplates, concat('|',./#template,'|')) and not(contains($excludeItemNames, concat('|',./#template,'|')))
Remember #key and #template is always in small letters
If you run many domains don't forget to add pageTracker._setDomainName("www.example.com"); in analytics script so you can separate sub-domains etc. if they use same footer.xslt
Normally we consider the actual Google code as content. Within Sitecore we normally have a settings folder, something like /sitecore/content/settings. This exists outside the root of the site. Beneath this have a settings item with a plain multi-line text field, I think the field type is memo or something similar.
Afterwards create an XSLT that renders out the content of this settings item. Something like (assuming the field is called value in the setting item):
<xsl:value-of select="sc:fld('Value','/sitecore/content/settings/footerJavaScript')" />
You may or may not need to set the disable-output-escaping attribute.
Then on the aspx page that your pages use as the template add a control that looks at the xslt rendering:
<sc:XslFile runat="server" Path="/xsl/footerJavaScript" />
The reason that we normally keep the javascript as content is this allows the client to change the analytics code without having to contact us.

ASP.NET MVC: How to use static HTML pages in MVC applications?

In the app I am working on, I want to allow the user to upload static HTML pages to replace the default "user profile" MVC View page. Is this possible? That is, the user uploaded html pages will totally run out of MVC, and it can include its own CSS links, etc.
Ideas? Suggestions?
Obviously the .net MVC framework handles static content already for images / css / js etc. It would just be a matter of extending that (routing?) to pass .html files through straight to IIS. That coupled with a dash of rewriting to make prettier urls should do the trick.
However, I would be very, very wary of allowing User Generated Content in the form of raw HTML uploads as you're leaving a very very wide door open. At best, you're going to wind up with people's pages full of spam/porn/adverts. At the worst, you'll be providing a gateway for people to upload cross-site scripting hacks and potentially uploading malicious content to damage your site. The could easily take an existing form on your site, hardcode a load of junk into it, and exectute it from their homepage and break a whole heap of things.
At the very least you should be parsing the uploaded content to reduce it down to just a block of content, and then wrapping that in your own etc. I would personally be much more inclined to just provide users with a nice WYSIWYG editor to edit a single block of content - any editor worth it's salt should provide you with sanitisation as to what elements it includes / excludes. Then store this content fragment in your database / on disc and have the request for a homepage go through a standard MVC controller route and load up that content.
Edit - for you request for examples
You should be able to add an Ignore rule to your routing - there will probably already be examples of these already - crack open your Global.asax file - you will want to put in a call to the routes.IgnoreRoute method :
routes.IgnoreRoute("UserPages/{*path}");
Should let IIS handle all requests for yourwebsite.com/UserPages/aUser/homepage.html - you can also play about a bit more with the wild card fragments / constraints for prettier solutions
I suggest you to make your custom ViewEngine that will allow to use static html markup with custom tags in it, that will be replaced by user info.
So, your view engine may accept something like that:
<html>
<body>
<b><user:FirstName /></b>
<b><user:LastName /></b>
</body>
</html>
and produce
<html>
<body>
<b>First Name</b>
<b>Last Name</b>
</body>
</html>
This custom markup you can store in database, for example.
You can take a look at custom ViewEngine implementations at MVC Contrib project.

Resources