Skip to content

Instantly share code, notes, and snippets.

View baxtheman's full-sized avatar

Daniele Baggio baxtheman

View GitHub Profile
@baxtheman
baxtheman / gist:50ddf73438edb2d7aa8f758beed34da7
Last active September 4, 2023 09:50
Liferay, apache RewriteRule to remove maximized from login page
## using ProxyPass, when p_p_id=com_liferay_login_web_portlet_LoginPortlet , then remove p_p_state=maximized
RewriteEngine On
RewriteCond %{QUERY_STRING} ^(.*)&?p_p_id=com_liferay_login_web_portlet_LoginPortlet&?(.*)$
RewriteCond %{QUERY_STRING} ^(.*)&?p_p_state=[^&]+&?(.*)$
RewriteRule ^/?(.*)$ /$1?%1%2 [L,PT]
var ua = navigator.userAgent,
clickEvent = (ua.match(/iPad/i) || ua.match(/iPhone/i)) ? "touchstart" : "click";
//28-11-2018 Aggiunta controllo posizione aiutaci a migliorare la pagina
// ###
var HM_nuovoHeader = false;
$(document).ready(function () {
if (window.location !== window.parent.location) {
$("#header-navbar").addClass("hidden");
@baxtheman
baxtheman / portlet.properties.md
Created October 4, 2019 13:30
Read value from properties file in liferay 7

You need to add your portlet.properties under resource folder.

portlet.properties
custom.liferay.base.url = "https://www.liferay.com/"

To read it in your java class

You need to import

@baxtheman
baxtheman / adt.ftl
Created August 19, 2019 12:17
Liferay 7, asset publisher ADT, list preferences and variables context
<div>
<pre>
<#list portletPreferences?keys as preference>
<#if portletPreferences[preference] ??>
<#assign mapValues = portletPreferences[preference] />
<#list mapValues as value >
${preference} = ${value}<br />
</#list>
</#if>
</#list>
@baxtheman
baxtheman / web-content-template.ftl
Last active May 30, 2022 09:52
Liferay 7, web content template freemarker context variables
<#assign TITLE = .vars['reserved-article-title'].data />
<#assign DISPLAYDATE = .vars['reserved-article-display-date'].data?date('EEE, dd MMM yyyy HH:mm:ss Z') />
${DISPLAYDATE?string["dd MMMM yyyy"]}
<button type="button" class="btn btn-secondary btn-sm">
<@liferay_ui["message"] key="read-more"/>
</button>
[
{
"dateTime": 1558606273941,
"entry": "Box Temperature",
"entryType": "String",
"gravityId": "4",
"gravityTypeData": {
"additional": "0",
"shortDescription": "Info"
[
{
"expanded": true,
"children": [
{
"label": "TEMP_DU1",
"id": "9",
"type": "check",
"leaf": true
}
@baxtheman
baxtheman / MailEngine.beanshell
Last active October 15, 2018 07:47 — forked from request-timeout/new_gist_file
liferay mail send test script (beanshell)
import com.liferay.util.mail.MailEngine; import javax.mail.internet.InternetAddress;
MailEngine.send(new InternetAddress("sender@domain.com"),
new InternetAddress("receip@gmail.com"),
"your-appointment-has-been-scheduled",
"HOLA", false);
@baxtheman
baxtheman / sendmail.script
Created July 17, 2018 08:28
Liferay, mail send test script (via beanshell)
import com.liferay.util.mail.MailEngine;
import javax.mail.internet.InternetAddress;
MailEngine.send(new InternetAddress("sender@gmail.com"),
new InternetAddress("destination@gmail.com"),
"test email sub", "HOLA, this is the body", false);
[INFO] Eclipse Milo Build Tools ........................... SUCCESS [ 1.591 s]
[INFO] Eclipse Milo - OPC-UA (IEC 62541) .................. SUCCESS [ 2.323 s]
[INFO] opc-ua-stack ....................................... SUCCESS [ 1.592 s]
[INFO] stack-core ......................................... SUCCESS [ 21.689 s]
[INFO] stack-client ....................................... SUCCESS [ 1.886 s]
[INFO] opc-ua-sdk ......................................... SUCCESS [ 1.695 s]
[INFO] sdk-core ........................................... SUCCESS [ 5.960 s]
[INFO] bsd-parser ......................................... SUCCESS [ 1.108 s]