Using an external Link in Liferay Structure/Template - liferay

Currently I'm developing a Structure/Template combination in Liferay 6.2 and I discovered a problem.
In my Structure the user can type an url to an external site ("www.google.com" for example):
<dynamic-element dataType="string" indexType="keyword" localizable="true" name="website" readOnly="false" repeatable="false" required="false" showLabel="true" type="text" width="small">
<meta-data locale="de_DE">
<entry name="label">
<![CDATA[Website (www.)]]>
</entry>
<entry name="predefinedValue">
<![CDATA[]]>
</entry>
<entry name="tip">
<![CDATA[]]>
</entry>
</meta-data>
</dynamic-element>
In my Template i want a Link to that page, but the current code just appends the String Value of the Structure to the BaseURL of my site. Something like www.company-url.de/web/www.google.de
More information
(I can't give the correct URLs because I'm not sure wether it's allowed)
Is there a way to tell Liferay to use the String as an independent url, instead of appending it?
Thanks a lot for your help.

Check if ${website.getData()} contains a ":", if not prepend it by yourself:
<#assign myURL = website.getData()>
<#if !website.getData()?matches(".*:.*")>
<#assign myURL = "http://" + myURL>
</#if>
More information
However, this is absolutely not enough to validate an URL...

The problem is that you are using the method ".getData()", as you said it's just an string. Try using ".getText()" instead:
More information
Hope it helps, and let me know if it works or not :)

Related

ReSharper doesn't apply type layout

I've probably missed an extremely obvious setting, but no matter what I try, I can't get ReSharper to apply any type layout (neither my own nor the default ones).
(using ReSharper 10.0.0.2 Ultimate trial)
I just made a quick type layout in the visual designer, this is the generated XAML:
<?xml version="1.0" encoding="utf-16"?>
<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns">
<TypePattern DisplayName="Default">
<Entry DisplayName="Fields">
<Entry.Match>
<Kind Is="Field" />
</Entry.Match>
</Entry>
<Entry DisplayName="Methods">
<Entry.Match>
<Kind Is="Method" />
</Entry.Match>
</Entry>
</TypePattern>
</Patterns>
I always did a full code cleanup, but even with a custom profile (as seen below, only "apply file template" selected) nothing is reordered:
Edit:
It seems Resharper did move certain things in some files of my project, but by no means were all fields/methods (no matter what access or static) put in the right order.
Turns out it indeed was something obvious. Apparently the regions in code (despite they grouped methods/properties already) prevented the layout from being applied.

How to alias/set display name for odata metadata xml document (v4)

Following is a sample of the metadata that is returned by my odata endpoint. I am using the endpoint w/ Microsoft Excel Power Query. All is working OK, except that I want to change the displayed name of "MyTable" below to something else, like say "My Cool Table".
I have tried adding annotations, but anytime I add annotations, Excel throws a cryptic error that says my metadata is invalid.
The question is, given the OData XML metadata below, what do I need to add so that the name of the table that is displayed is "My Cool Table" instead of "MyTable".
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
<edmx:DataServices xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" m:MaxDataServiceVersion="4.0" m:DataServiceVersion="4.0">
<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="MyOData">
<EntityType Name="MyTable">
<Key>
<PropertyRef Name="myid" />
</Key>
<Property Name="myid" Type="Edm.String" Nullable="false" />
<Property Name="Anotherfield" Type="Edm.String" />
</EntityType>
<EntityContainer Name="DefaultContainer">
<EntitySet Name="MyTable" EntityType="MyOData.MyTable" />
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>

Can't create params for custom component

I'm currently working on a custom joomla component but I fail to get the component wide parameters to work.
The joomla docs say that if you add
to your 'myComponent.xml' file, the parameter should appear in the _components table. I do see my component but there are no params there.
Is there anything I should know? Or anything I might do wrong?
here is test.xml { myComponent.xml }:
<?xml version="1.0" encoding="UTF-8"?>
<install type="component" version="1.5.0">
<name>test</name>
<creationDate>2010-08-05</creationDate>
<author>test</author>
<version>1.0.0</version>
<description>test</description>
<administration>
<menu>Ctest</menu>
<files folder="admin">
<filename>controller.php</filename>
<filename>test.php</filename>
<filename>index.html</filename>
<filename>models/test.php</filename>
<filename>models/index.html</filename>
<filename>views/index.html</filename>
<filename>views/test/index.html</filename>
<filename>views/test/view.html.php</filename>
<filename>views/test/tmpl/default.php</filename>
<filename>views/test/tmpl/index.html</filename>
</files>
</administration>
<params>
<param name="test" type="text" default="" label="test" description="test" />
</params>
</install>
Make sure you're configuring the params correctly in both places config is needed.
In COMPONENTNAME.xml, you need the block you've got above (although I think only 'name' and 'default' are used here).
Also, in admin/config.xml, you'll need something like:
<root>
<params>
<param type="text" name="test" size="30" label="test" description="test" />
</params>
</root>
You'll then need to make sure there's a way to get to these config options, with this in your 'toolbar.COMPONENTNAME.html.php':
JToolBarHelper::preferences('com_magentocatalogue');
Then, a 'config' button should appear in the toolbar for your component. Only once you save some changes will these parameters appear in the #__components.params field.

xsl server variable returns null

xsl server variable URL returns null. I tried all the other server variable and they all returns nulls.
Is there anything I need to do (like in IIS or web.config) in order for xsl to show server variables? (i am working on webpart in sharepoint).
<ParameterBinding Name="URL" Location="ServerVariable(URL)" DefaultValue=""/>
<xsl:param name="$URL"/>
Your XSL parameter should be declared with the name "URL", not "$URL":
<xsl:param name="URL" />

How to get out parameters working in SharePoint workflows

I'm trying to create a custom workflow action with an output parameter for error handling. Working from various examples, I can't get Parameter Direction="Out" to work. Everything seems right, but when I try to assign the output to the "error" variable in SharePoint Designer, it places asterisks around it and flags it as a workflow error. Here is what the action XML looks like:
<Action Name="Create Folder"
ClassName="ActivityLibrary.CreateFolderActivityTest"
Assembly="ActivityLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxx"
AppliesTo="all"
CreatesInList="ListId"
Category="Custom">
<RuleDesigner Sentence="Create a folder %1 in the %2 base folder. If an error occurs it will be output to %3.">
<FieldBind Field="FolderName" Text="folder name" Id="1" />
<FieldBind Field="BaseFolderPath" Text="folder path" Id="2"/>
<FieldBind Field="OutError" DesignerType="ParameterNames" Text="out error" Id="3"/>
</RuleDesigner>
<Parameters>
<Parameter Name="FolderName" Type="System.String, mscorlib" Direction="In" />
<Parameter Name="BaseFolderPath" Type="System.String, mscorlib" Direction="In" />
<Parameter Name="OutError" Type="System.String, mscorlib" Direction="Out" />
</Parameters>
</Action>
I think you may want Direction="InOut" from the looks of the binding
Are you sure the issue is with the parameters and not maybe the variable in SPD? Certainly nothing looks wrong with your XML.
I always hated the way SPD and workflows make you create a variable within the workflow and another within the page to assign to the same value as the workflow variable.
Did you get anywhere with this? I suspect the problem was more likely in your logic code rather than this xml (.actions) file. It looks perfectly acceptable to me.

Resources