How to use AlloyUI 3.0.1 within a portlet in Liferay 6.2 The version without losing functionality in the rest of the portal.
happens whether or not I import the following
<script src="http://cdn.alloyui.com/3.0.1/aui/aui-min.js"></script>
<link href="http://cdn.alloyui.com/3.0.1/aui-css/css/bootstrap.min.css" rel="stylesheet"></link>
this is my code...
liferay-portlet.xml
<?xml version="1.0"?>
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 6.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_6_2_0.dtd">
<liferay-portlet-app>
<portlet>
<portlet-name>example-input-alert</portlet-name>
<icon>/icon.png</icon>
<header-portlet-css>/css/main.css</header-portlet-css>
<header-portlet-css>http://cdn.alloyui.com/3.0.1/aui-css/css/bootstrap.min.css</header-portlet-css>
<header-portlet-javascript>http://cdn.alloyui.com/3.0.1/aui/aui-min.js</header-portlet-javascript>
<footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
<css-class-wrapper>example-input-alert-portlet</css-class-wrapper>
</portlet>
<role-mapper>
<role-name>administrator</role-name>
<role-link>Administrator</role-link>
</role-mapper>
<role-mapper>
<role-name>guest</role-name>
<role-link>Guest</role-link>
</role-mapper>
<role-mapper>
<role-name>power-user</role-name>
<role-link>Power User</role-link>
</role-mapper>
<role-mapper>
<role-name>user</role-name>
<role-link>User</role-link>
</role-mapper>
</liferay-portlet-app>
Resource "http://cdn.alloyui.com/3.0.1/aui/aui-min.js" not found.
view.jsp
<%# taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<portlet:defineObjects />
<div id="myAlert"></div>
<script>
YUI()
.use(
'aui-alert',
function(Y) {
new Y.Alert(
{
animated : true,
bodyContent : 'Thank You Mario! But Our Princess Is In That Castle!',
boundingBox : '#myAlert',
closeable : true,
cssClass : 'alert-warning',
destroyOnHide : false,
duration : 1,
render : true
});
});
</script>
before
after
some elements disappear portal and portlets lose other functionality...
thx !
This is the response of staff Liferay...
You need to import the library using liferay-portlet.xml in your portlet:
<header-portlet-css>http://cdn.alloyui.com/3.0.1/aui-css/css/bootstrap.min.css</header-portlet-css>
<header-portlet-javascript>http://cdn.alloyui.com/3.0.1/aui/aui-min.js</header-portlet-javascript>
See the docs (It's explained at the bottom)
Related
Hi have 2 entity and 1 portlet:
Entity 1: Autore
Entity 2: Opera
Portlet: BibliotecaWebPortlet
I have create a default.xml for the portlet in resource>resource-action :
<?xml version="1.0"?>
<!DOCTYPE resource-action-mapping PUBLIC "-//Liferay//DTD Resource Action Mapping 7.1.0//EN" "http://www.liferay.com/dtd/liferay-resource-action-mapping_7_1_0.dtd">
<resource-action-mapping>
<portlet-resource>
<portlet-name>it_cloudtec_biblioteca_portlet_BibliotecaWebPortlet</portlet-name>
<permissions>
<supports>
<action-key>AGGIUNGI_AL_TEMPLATE</action-key>
<action-key>CONFIGURAZIONE</action-key>
<action-key>VISUALIZZA</action-key>
</supports>
<site-member-defaults>
<action-key>VISUALIZZA</action-key>
</site-member-defaults>
<guest-defaults>
<action-key>VISUALIZZA</action-key>
</guest-defaults>
<guest-unsupported>
<action-key>AGGIUNGI_AL_TEMPLATE</action-key>
<action-key>CONFIGURAZIONE</action-key>
</guest-unsupported>
</permissions>
</portlet-resource>
</resource-action-mapping>
(Portlet name is correct)
i have created default.xml for service in resource>resource-action:
<?xml version="1.0"?>
<!DOCTYPE resource-action-mapping PUBLIC "-//Liferay//DTD Resource Action Mapping 7.1.0//EN" "http://www.liferay.com/dtd/liferay-resource-action-mapping_7_1_0.dtd">
<resource-action-mapping><model-resource>
<model-name>it.cloudtec.biblioteca</model-name>
<portlet-ref>
<portlet-name>it_cloudtec_biblioteca_portlet_BibliotecaWebPortlet</portlet-name>
</portlet-ref>
<root>true</root>
<weight>1</weight>
<permissions>
<supports>
<action-key>AGGIUNGI</action-key>
</supports>
<site-member-defaults>
</site-member-defaults>
<guest-defaults />
<guest-unsupported>
</guest-unsupported>
</permissions>
</model-resource><model-resource>
<model-name>it.cloudtec.biblioteca.model.Autore</model-name>
<portlet-ref>
<portlet-name>it_cloudtec_biblioteca_portlet_BibliotecaWebPortlet</portlet-name>
</portlet-ref>
<weight>2</weight>
<permissions>
<supports>
<action-key>AGGIUNGI_AUTORE</action-key>
<action-key>CANCELLA_AUTORE</action-key>
<action-key>AGGIORNA_AUTORE</action-key>
<action-key>VISUALIZZA_LISTA_AUTORI</action-key>
</supports>
<site-member-defaults>
<action-key>VISUALIZZA_LISTA_AUTORI</action-key>
</site-member-defaults>
<guest-defaults>
<action-key>VISUALIZZA_LISTA_AUTORI</action-key>
</guest-defaults>
<guest-unsupported>
<action-key>AGGIUNGI_AUTORE</action-key>
<action-key>CANCELLA_AUTORE</action-key>
<action-key>AGGIORNA_AUTORE</action-key>
</guest-unsupported>
</permissions>
</model-resource>
</resource-action-mapping>
Why dont show the action key in control panel? (Website > user > role s > select my custom role > define permission > site administration > application >BibliotecaWebApp)
I view only default's keys. > Add to Page - Configuration - Permissions - Preferences portlet.properties is present in portlet and service modules.
Never used Tabulator, just down loaded version 4. I read the QuickStart and documentation, but only get a blank screen when running the example script. My pathways are correct and I can run other javascript scripts, so not sure what is wrong. I really like the idea of this interface and will help me keep up a small pharmacy organization website, I support.
Here is my html and script
<script>
//create Tabulator on DOM element with id "example-table"
var table = new Tabulator("#example-table", {
height:205, // set height of table (in CSS or here), this enables the Virtual DOM and improves render speed dramatically (can be any valid css height value)
layout:"fitColumns", //fit columns to width of table (optional)
columns:[ //Define Table Columns
{title:"Name", field:"name", width:150},
{title:"Age", field:"age", align:"left", formatter:"progress"},
{title:"Favourite Color", field:"col"},
{title:"Date Of Birth", field:"dob", sorter:"date", align:"center"},
],
rowClick:function(e, row){ //trigger an alert message when the row is clicked
alert("Row " + row.getData().id + " Clicked!!!!");
},
});
//define some sample data
var tabledata = [
{id:1, name:"Oli Bob", age:"12", col:"red", dob:""},
{id:2, name:"Mary May", age:"1", col:"blue", dob:"14/05/1982"},
{id:3, name:"Christine Lobowski", age:"42", col:"green", dob:"22/05/1982"},
{id:4, name:"Brendon Philips", age:"125", col:"orange", dob:"01/08/1980"},
{id:5, name:"Margret Marmajuke", age:"16", col:"yellow", dob:"31/01/1999"},
];
//load sample data into the table
table.setData(tabledata);
</script>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html" />
<title>Tabulator</title>
<link href="css/tabulator.min.css" rel="stylesheet" />
<script type="text/javascript" src="js/tabulator.min.js"></script>
</head>
<body>
<div id="example-table"></div>
</body>
</html>
I would appreciate any help.
Where are you putting your script tags that contain the Tabulator constructor? they should be in the body and under the example-table div.
Are you getting any warning messages in your browser console?
i'm a beginner in bootstrap,i was trying to build an Xpage with the BootstrapValidator to validate an inputText but it dosen't work,below the code source,can we help me to find a solution!
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xc="http://www.ibm.com/xsp/custom">
<xp:this.resources>
<xp:styleSheet href="/bootstrapValidator/css/bootstrap.css"></xp:styleSheet>
<xp:styleSheet href="/bootstrapValidator/css/bootstrapValidator.css"></xp:styleSheet>
<xp:script src="/JQueryXSnippet.js" clientSide="true"></xp:script>
<xp:script src="/bootstrapValidator/js/bootstrap.min.js" clientSide="true"> </xp:script>
<xp:script src="/bootstrapValidator/js/bootstrapValidator.js" clientSide="true"></xp:script>
</xp:this.resources>
<div class="col-md-5">
<xp:inputText id="username" title=" username"></xp:inputText>
</div>
<xp:scriptBlock id="scriptBlock1">
<xp:this.value><![CDATA[$(document).ready(
function() {
$("#{id:username}" ).bootstrapValidator({
message: 'This value is not valid',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
username: {
message: 'The username is not valid',
validators: {
notEmpty: {
message: 'The username is required and can\'t be empty'
},
stringLength: {
min: 6,
max: 30,
message: 'The username must be more than 6 and less than 30 characters long'
},
regexp: {
regexp: /^[a-zA-Z0-9_\.]+$/,
message: 'The username can only consist of alphabetical, number, dot and underscore'
}
}
} } });
]]></xp:this.value>
</xp:scriptBlock>
</xp:view>
Use the XPages compatible jQuery selector x$ instead of the native jQuery $ selector.
Also try using XSP.addOnLoad() instead of (document).ready().
Furthermore, your XPages xp:inputText field called "username" has an id in the browser called something like "view:_id1:_id2:_id8:username". So it's not called "username" as stated in your fields definition for bootstrapValidator. Therefore bootstrapValidator is unable to find the field. Try adding this to your scriptBlock instead of "username: {":
#{id:username}: {
have a problem with translation is Symfony2.1
I tried almost all methods provided in the symfony_book but, only the translation from english to frensh that works, the reverse doesn't work
here is my routing.yml
_acceuil:
pattern: /{_locale}/acceuil/
defaults: { _controller: gestionConferenceApplicationBundle:acceuil:acceuil, _locale: en }
requirements:
_locale: en|fr|de
is my layout page I have thoses to links that allaw to switch between langage:
<a style="padding-top: -10px;" href="{{ path('_acceuil', {'_locale': 'fr' }) }}" >FRANCAIS</a>
<a style="padding-top: -10px;" href="{{ path('_acceuil', {'_locale': 'en' }) }}" >ANGLAIS</a>
and this line for test
{{ 'welcome in my site'|trans }}
and here is my messages.fr.xlf
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="file.ext">
<body>
<trans-unit id="1">
<source>welcome in my site</source>
<target>bienvenue dans mon site</target>
</trans-unit>
</body>
</file>
</xliff>
and here is my messages.en.xlf
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="fr" datatype="plaintext" original="file.ext">
<body>
<trans-unit id="1">
<source>bienvenue dans mon site</source>
<target>welcome in my site</target>
</trans-unit>
</body>
</file>
</xliff>
and here is the part wwe are interested in my config.yml :
framework:
#esi: ~
translator: { fallback: en }
secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: "%kernel.debug%"
form: true
csrf_protection: true
validation: { enable_annotations: true }
templating: { engines: ['twig'] } #assets_version: SomeVersionScheme
default_locale: en
trust_proxy_headers: false # Whether or not the Request object should trust proxy headers (X_FORWARDED_FOR/HTTP_CLIENT_IP)
session: ~
and when I run I have always :
bienvenue dans mon site
how can I achieve that
thank you in advance
I know why your translations don't work.
Because the translation source is still this same. It's string from your template.
So ex:
{{'My Trans'|trans()}}
messages catalogues shoudl look like this fr:
'My Trans': 'My trans FR'
and the en trans:
'My Trans': 'My trans EN'
I hope this example will help you.
How to run SpecFlow tests in OrchardCMS 1.4?
Steps:
Download OrchardCMS from here.
Run UsersFeature.ICanCreateANewUser() test. (WITHOUT BUILDING ALL SOLUTION!)
Result in Unit Test Sessions - Session window:
...
error: Unable to locate <input> name SiteName in page html:
<html>
<head>
<title>A 'script' named 'jQuery' could not be found.</title>
<style>
...
</style>
</head>
<body bgcolor="white">
<span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>
<h2> <i>A 'script' named 'jQuery' could not be found.</i> </h2></span>
...
<b> Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
<br><br>
<b> Exception Details: </b>System.InvalidOperationException: A 'script' named 'jQuery' could not be found.<br><br>
<b>Source Error:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code><pre>
Line 259: throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, "A '{1}' named '{0}' could not be found.", settings.Name, settings.Type));
Line 260: }
<font color=red>Line 261: ExpandDependencies(resource, settings, allResources);
</font>Line 262: }
Line 263: requiredResources = (from DictionaryEntry entry in allResources</pre></code>
</td>
</tr>
</table>
<br>
<b> Source File: </b> ...OrchardCMS_1.4\src\Orchard\UI\Resources\ResourceManager.cs<b> Line: </b> 261
<br><br>
<b>Stack Trace:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code><pre>
[InvalidOperationException: A 'script' named 'jQuery' could not be found.]
Orchard.UI.Resources.ResourceManager.BuildRequiredResources(String resourceType) in F:\coding\zulatm\OrchardCMS_1.4\src\Orchard\UI\Resources\ResourceManager.cs:261
Orchard.Core.Shapes.CoreShapes.WriteResources(Object Display, TextWriter Output, String resourceType, Nullable`1 includeLocation, Nullable`1 excludeLocation) in F:\coding\zulatm\OrchardCMS_1.4\src\Orchard.Web\Core\Shapes\CoreShapes.cs:354
CallSite.Target(Closure , CallSite , CoreShapes , Object , TextWriter , String , ResourceLocation , Object ) +420
System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid6(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) +1323
Orchard.Core.Shapes.CoreShapes.HeadScripts(Object Display, TextWriter Output) in F:\coding\zulatm\OrchardCMS_1.4\src\Orchard.Web\Core\Shapes\CoreShapes.cs:286
</body>
That is shown for every test case in SpecFlow I tried.
have you tried with a source enlistment rather than downloading the 1.4 release?
Didn't build all solution. Hence the Jquery module was not built and no JQuery script files there. Stupid mistake!