Liferay only html and js - liferay

I have maven project which I want place as portlet in liferay. This portlet will be single page application (inside portlet). I want to deploy this portlet which contains only html, js, and css.
I want expose ./src/main/webapp/index.html and other files js, css, html without updating portlet.xml or liferay-portlet.xml.
Is it possible to expose all content inside src/main/webapp as static resources. As my starting point index.html. I dont't want use any jsp. Is there any easy solution for that?
I.e
If I'll have index.html (src/main/webapp/index.html) and preview/invoices.js (src/main/webapp/preview/invoices.js). I want to put inside index.html and it will work. Without any additional configuration. Is it possible?

It seems like you didn't try this already: A portlet is nothing but a standard java web application with a few more deployment descriptors. Thus, your application is available as static resource out of the box. You won't gain anything from the portal integration if you don't go through portal URLs (e.g. who's the currently logged in user?), but you do totally can access all of your content from the browser.
In order to blend well into the portal, you should not render index.html out of the box but at least have a portlet with static HTML UI - reason is that a portlet is not supposed to include <html>, <head> and <body> markup, and out-of-the-box it doesn't have access to the head-section of your document where you might want to have css or js includes (same with the footer). With the portlet you can easily add your js to the end of the page and then go from there.
If you need information like the currently logged in user, their permissions etc., you should go through portal URLs instead of your webapp directly, because you'd just get the information you need this way.
"I want to integrate as a portlet without writing a portlet" sounds a bit like "I'd like to go swimming without getting wet". Make sure that this is not your case - a basic portlet (that delegates all of the implementation to JS) is no magic and not complex.

The easiest way to use html, css and js (if the development is not big) is to use the content-viewer portlet and insert all ass the content in html format
If what you want is bigger and you want to have over source control and deploy as a portlet, using the liferay ide(or eclipse with the liferay plugin) is really easy to create a maven portlet and then edit the default jsp.
Regards

Related

Site wide HTTP Header for Tags

I have just inherited a massive old HTML site that I want to track on Google analytics. It's nearly a 1000 pages of good old '90s html.
I've been running a web server for many years but am not a coder in any particular language although I do edit my PHP config files and my HTML files, install and configure modules in Mediawiki, phpBB and Drupal. I am currently on Svr2016, IIS10. For this HTML site, how would I include the Google tag (or any other tracking tag) in the header on every page served from my IIS console?
I need a pretty cut and paste or point and click solution.
Assuming you’re using IIS and have SSI enabled (SSI= server side include).
I would create an include file (server side include - could be .shtml) and paste the google analytics or tracking.
Then, I would find a file such as footer that’s used by all the other files and include it.
Or maybe put it other common files like navigation that’s used site-wide.
See sample use/issues.
https://serverfault.com/questions/244352/why-wont-ssi-work-in-iis

building website with AMP

is it okay to build website completely using only AMP?
what will happen to the desktop version of the site?
does the code will be converted to normal html tag when viewer view the normal web page?
Yes, you can build your website using only AMP. Essentially, you'll be using AMP as a framework. The company I work for has the entire site (minus 3 pages) done using AMP as a framework: https://www.craigattachments.com/.
Depending on the size of your site, a few considerations you might want to make...
Templating is your friend. Create an overall CSS file for universal styles, and then template oriented styles based on your different page layouts.
If you're using a universal header.php file that will apply to all pages, you can use some if statements to filter out unnecessary CSS to avoid hitting the CSS limitation set by AMP. This also works for AMP libraries you may be using on one page but not another.
For our implementation we run about 9 different CSS files that we include into the tag using a PHP include_once and filter in and out of the header using an if statement based on which page template is being used - our site is built on Wordpress.
Have a look at the AMP Start page. They have some responsive page examples there.

Is it possible to show chrome extension icon inside the web page?

Is it possible to show chrome extension icon inside the web page?I am able to create an extension using page action ,icon is shown inside the address bar ,but i need to show it inside the web page ...
Well, there is no special API you can simply use for that.
You can inject your own UI elements into the page, but it's going to be difficult. I will only outline this, don't ask for specific code.
You will need a Content Script (also, read the Architecture Overview page if you haven't yet) to access the contents of the page.
Then, you need to create and append your elements to the DOM of the page. In your case, you could possibly add an <img> tag with your icon and a click listener that does something.
Note that to avoid clashes with CSS of the page itself it is recommended to use Shadow DOM techniques.
Of course, this may or may not work well depending on the page you're injecting into.

IBM Connections Customization: Add custom jsp containing navigation, header, footer

We're currently adding a custom jsp file, which can be browsed by clicking a link in the (customized) navigation bar.
Said new page should look like a "native" page in connections and therefore of course contain headers, navigation, footers like any other page in IBM Connections. We added a <jsp:include> for the header.jsp file, which results in the links being shown in the resulting html. However, the styles and js are still missing.
To get around this, we included <lc-ui:dojo include="${javascriptModuleInclude}" /> into our page, since we observed this in other (native) connections jsp files. Sadly, that did not work out at all.
We can't find any help on this in the customization Documentations and the only thread in the official Connections Forum did not receive an answer http://www-10.lotus.com/ldd/lcforum.nsf/d6091795dfaa5b1185256a7a0048a2d0/b9b5303e92c5676d85257c040046ff8c?OpenDocument
Does anyone have insights or even a hint were to look for a solution here?
Customization Dir is located on your system in a directory like /local/IBM/Connections/data/shared/customization
customizationDir/themes/applications/profiles.css
override the css values for lotusPostDetails, you can check exactly what renders the css *rules wise in Firebug, and selectively override
Learn more info at
http://infolib.lotus.com/resources/connections/4.5.0/doc/accessible/admin/en_us/acc_p4.html
Subtopic... Determining where to save your customizations
You will need to restart the Connections Server before the customizations take effect.
you can add common.css as well.
also you can reference oneui as well http://infolib.lotus.com/resources/oneui/3.0/docPublic/index.htm
The bare minimum dependencies required to make the <lc-ui:dojo> tag work in a third party JSP page are:
lc.util.base-3.0.jar
lc.util.web-3.0.jar
lc.config.svc-1.1.jar
com.ibm.connections.directory.services.jar
Please keep in mind that this is not a supported use case — as you pointed out, you're reverse engineering native Connections JSP files. The Connections banner will probably be offered as a reusable UI component through the SBT in the near future.

OpenLayers's CSS breaks after publishing to Azure Web Site

I've created a very simple ASP.NET 4.5 MVC4 web site which uses OpenLayers 2.12. It's got only one page that shows a map with a few points and lines on it. If I run it locally, it runs fine, but after publishing to my Azure Web Site, the OpenLayers' CSS files won't load. I have now added the OpenLayers CSS hard coded in my bundleConfig, and now it works fine. But of course, this is not what I want, because OpenLayers has specific CSS files for other platforms and browser versions etc.
Locally, I just have to include openlayers.js and OpenLayers then adds the right css files. Does anybody know why this doesn't work after publishing to Azure?
From the docs in openlayers.js:
Please remember that when your OpenLayers script is not named
"OpenLayers.js" you will have to make sure that the default theme is
loaded into the page by including an appropriate <link>-tag,
e.g.:
(code)
<link rel="stylesheet" href="/path/to/default/style.css" type="text/css">
(end code)
Because Azure changes the file names that are included, I indeed should be adding the reference to the default style myself. Also, I can just link to style.css, the other css files for e.g. IE6 or Mobile won't be uses automatically, these are just there for yourself to use it when appropriate.

Resources