How to add editor to the textarea in my custom component in joomla 2.5? - text-editor

I have created a custom component in joomla 2.5 where the fields are creating in an xml file.
Here is the code.
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset>
<field
name="id"
type="hidden"
/>
<field
name="title"
type="text"
label="Title"
description="This is the title"
size="40"
class="inputbox"
default=""
style="width:294px;height:135px;"
/>
<field
name="description"
type="textarea"
label="Description"
description="This is the description"
rows="20"
cols="10"
class="inputbox"
default=""
/>
</fieldset>
</form>
I want to the description text area to be an editor just like in the new article form.
How will I do this?

I solved my problem.
Just change the type of the description field.
<field
name="description"
type="editor"
label="Description"
description="This is the description"
filter="safehtml"
class="inputbox"
default=""
/>

Related

UI to manage one to many relationship between classes in custom module in Kentico

I have created a Clinic module within Kentico V12 with two classes: Doctor and Appointment. There is a 1 to many relationship between Doctor and Appointment. How could I display the name and surname of the doctors in the Appointment grid?
<?xml version="1.0" encoding="utf-8" ?>
<grid>
<actions>
<action name="edit" caption="$General.Edit$" fonticonclass="icon-edit" fonticonstyle="allow" />
<action name="#delete" caption="$General.Delete$" fonticonclass="icon-bin" fonticonstyle="critical" confirmation="$General.ConfirmDelete$" />
</actions>
<columns>
<column source="AppointmentPatientFirstName" caption="First name" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
<column source="AppointmentPatientLastName" caption="Last name" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
<column source="AppointmentPatientEmail" caption="Email" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
<column source="AppointmentPatientPhoneNumber" caption="Phone Number" wrap="false" localize="true">
<filter type="text" size="15" />
</column>
<column source="Date" caption="Date" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
<column source="AppointmentPatientBirthDate" caption="BirthDate" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
<column source="AppointmentDoctorID" caption="Doctor ID" wrap="false" localize="true">
<filter type="text" size="200" />
</column>
</columns>
<options>
<key name="DisplayFilter" value="true" />
</options>
</grid>
Kind regards.
Appointment List: https://i.stack.imgur.com/Ft1pE.png
Using this column AppointmentDoctorID modify the XML to use a transformation like so:
<column source="AppointmentDoctorID" caption="Doctor" externalsourcename="#transform: yournamespace.doctor: {%FirstName%} {%LastName%}" wrap="false" localize="true"></column>
Check out more documentation on unigrids in the Kentico Documentation.

Query optimization in liferay

I have created a portlet where I want to print the list of users based on some parameter. So for showing list of users I use the following code,
<liferay-ui:search-container delta="10" emptyResultsMessage="no-users-were-found">
<liferay-ui:search-container-results
results="<%= UserLocalServiceUtil.getUsers(0, UserLocalServiceUtil.getUsersCount())%>"
/>
<liferay-ui:search-container-row
className="com.liferay.portal.model.User"
keyProperty="userId"
modelVar="user"
>
<liferay-ui:search-container-column-text
name="name"
value="<%= user.getFullName() %>"
/>
<liferay-ui:search-container-column-text
name="first-name"
property="firstName"
/>
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />
</liferay-ui:search-container>
<liferay-ui:search-container delta="10" emptyResultsMessage="no-users-were-found">
But i don't want all the users list. I need only the list of users whose facebookId = 12345. How can query the condition? Any suggestions please..
Thanks in advance

Ext Net TimeField in an editable grid

I have a grid panel which display two TimeSpans in two columns and all is well when I load the page but when I go server side the validation on my editors always fail. I don't understand why the store can display the TimeSpans but cannot return it after...
Here my code :
<ext:GridPanel ID="WeekParams" runat="server" >
<Store>
<ext:Store runat="server">
<Reader>
<ext:JsonReader IDProperty="GUID">
<Fields>
<ext:RecordField Name="Day" Type="String" />
<ext:RecordField Name="UATNumber" Type="int" />
<ext:RecordField Name="From" Type="Date" />
<ext:RecordField Name="To" Type="Date" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:Column ColumnID="Day" DataIndex="Day" />
<ext:NumberColumn ColumnID="UATNumber" DataIndex="UATNumber" Format="0" />
<ext:DateColumn ColumnID="From" DataIndex="From" Format="dd/MM/yyyy" >
<Renderer Format="Date" FormatArgs="'HH:mm'" />
<Editor>
<ext:TimeField runat="server" />
</Editor>
</ext:DateColumn>
<ext:DateColumn ColumnID="To" DataIndex="To" Format="dd/MM/yyyy" >
<Renderer Format="Date" FormatArgs="'HH:mm'" />
<Editor>
<ext:TimeField runat="server" />
</Editor>
</ext:DateColumn>
</Columns>
</ColumnModel>
<Plugins>
<ext:EditableGrid runat="server" />
</Plugins>
</ext:GridPanel>
And here the result when I'm going to the server side :

create a webform with multiple jsp

I am new to liferay, and want to create a custom web form portlet having multiple jsp.
like on one jsp i have to display the all details for the user i.e first name last name etc with next button (it will redirect the user to another jsp) that contains a message box with submit button.
after click on submit button the data from both jsp will be save in database!
i have created a register.jsp page
<%#include file="/init.jsp" %>
<html>
<body>
<form action="<portlet:actionURL></portlet:actionURL>" method="post" name="userForm" onsubmit="return Account();">
<b>First Name:</b>
<input type="text" name="<portlet:namespace/>firstName" id="<portlet:namespace/>firstName"/><br/>
<b>Last Name:</b>
<input type="text" name="<portlet:namespace/>lastName" id="<portlet:namespace/>lastName"/><br/>
<b>E-mail:</b>
<input type="text" name="<portlet:namespace/>eMail" id="<portlet:namespace/>eMail"/><br/>
<b>Age:</b>
<select name="<portlet:namespace/>age">
<option value="20">20</option>
<option value="20-25">20-25</option>
<option value="25-30">25-30</option>
<option value="30-35">30-35</option>
<option value="35+">35+</option>
</select><br/>
<b>Region:</b>
<select name="<portlet:namespace/>region">
<option value="east">east</option>
<option value="west">west</option>
<option value="north">north</option>
<option value="south">south</option>
</select><br/>
<b>Gender</b><br/>
<input type="radio" name="<portlet:namespace/>sex" value="male">Male<br>
<input type="radio" name="<portlet:namespace/>sex" value="female">Female<br/>
</form>
<br/> <button class="btn btn-primary">Go Back</button>
<portlet:renderURL var="submitDetailURL">
<portlet:param name="jspPage" value="/submit.jsp"/>
</portlet:renderURL>
<button class="btn btn-primary">Next</button>
and the next button will redirect to submit.jsp page
<%#include file="/init.jsp" %>
<html>
<body>
<form action='<portlet:actionURL></portlet:actionURL>' method="post" name="valid" onsubmit="return Account();">
<b>Message:</b>
<textarea rows="4" cols="50" name="<portlet:namespace/>address">
</textarea>
<button class="btn btn-primary">Go Back</button>
<input type="submit" name="addUser" id="addUser" value="Submit">
</tr>
</form>
</body>
</html>
and my service.xml is
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.1.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_1_0.dtd">
<service-builder package-path="com.yogisha">
<author>Sony</author>
<namespace>yogisha</namespace>
<entity name="Campaign" local-service="true" remote-service="false">
<column name="campaignId" type="long" primary="true"></column>
<column name="firstName" type="String"></column>
<column name="lastName" type="String"></column>
<column name="eMail" type="String"></column>
<column name="age" type="String"></column>
<column name="region" type="String"></column>
<column name="sex" type="String"></column>
<column name="content" type="String"></column>
</entity>
</service-builder>
but it seems like its not working. can anyone tell my what i am missing?

XmlDocuments Element ignored in Content Type?

I have a content type defined in Elements.xml and I want to add an Event Receiver. My Elements.xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- Parent ContentType: Announcement (0x0104) -->
<ContentType ID="0x0104008a424de98660457481eb7d8ddb5161ee"
Name="News Posting"
Group="News"
Description="$Resources:NewsCTypeDescription"
Inherits="TRUE"
Version="1"
Sealed="TRUE"
>
<FieldRefs>
<FieldRef ID="{7EBC5918-CB79-440A-8DF3-480C6951C4EB}" Name="NewsExcerpt"/>
</FieldRefs>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/events">
<spe:Receivers xmlns:spe="http://schemas.microsoft.com/sharepoint/events">
<Receiver>
<Name>ItemAdded</Name>
<Type>ItemAdded</Type>
<Class>MyAssembly.NewsItemEventReceiver</Class>
<Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
<SequenceNumber>10000</SequenceNumber>
<Synchronization>Synchronous</Synchronization>
<Data />
<Filter />
</Receiver>
</spe:Receivers>
</XmlDocument>
</XmlDocuments>
</ContentType>
</Elements>
The weird thing is that the Event Receiver never executes. I've checked the Schema with SharePoint Manager 2010, and it seems that the XmlDocuments element is ignored completely?
Here's the content type SchemaXml according to SharePoint Manager:
<?xml version="1.0" encoding="utf-16"?>
<ContentType ID="0x0104008A424DE98660457481EB7D8DDB5161EE" Name="News Posting" Group="News" Description="A News Posting" Sealed="TRUE" Version="1">
<Folder TargetName="_cts/News Posting" />
<Fields>
<Field ID="{c042a256-787d-4a6f-8a8a-cf6ab767f12d}" Name="ContentType" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="ContentType" Group="_Hidden" Type="Computed" DisplayName="Content Type" Sealed="TRUE" Sortable="FALSE" RenderXMLUsingPattern="TRUE" PITarget="MicrosoftWindowsSharePointServices" PIAttribute="ContentTypeID" Customization="">
<FieldRefs>
<FieldRef ID="{03e45e84-1992-4d42-9116-26f756012634}" Name="ContentTypeId" />
</FieldRefs>
<DisplayPattern>
<MapToContentType>
<Column Name="ContentTypeId" />
</MapToContentType>
</DisplayPattern>
</Field>
<Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Title" Group="_Hidden" Type="Text" DisplayName="Title" Required="TRUE" FromBaseType="TRUE" Customization="" ShowInNewForm="TRUE" ShowInEditForm="TRUE" />
<Field ID="{7662cd2c-f069-4dba-9e35-082cf976e170}" Name="Body" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Body" Group="_Hidden" Type="Note" RichText="TRUE" RichTextMode="FullHtml" IsolateStyles="TRUE" DisplayName="Body" Sortable="FALSE" NumLines="15" Customization="" />
<Field ID="{6a09e75b-8d17-4698-94a8-371eda1af1ac}" Name="Expires" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Expires" Group="_Hidden" Type="DateTime" DisplayName="Expires" Format="DateOnly" Customization="" />
<Field ID="{7EBC5918-CB79-440A-8DF3-480C6951C4EB}" Group="News" Name="NewsExcerpt" DisplayName="Excerpt of the Article" Description="165 Characters maximum" MaxLength="165" Type="Text" Customization="" />
</Field>
</Fields>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<Display>ListForm</Display>
<Edit>ListForm</Edit>
<New>ListForm</New>
</FormTemplates>
</XmlDocument>
</XmlDocuments>
</ContentType>
I have tried adding a FormTemplates XmlDocument as well, just to see if that works, but even this is ignored (I've changed the ListForm to ListForm2, but the SchemaXml is unchanged.
I've deleted the entire Web Application and Content Database to make sure there was nothing stale/stuck, but the result is still the same.
Is XmlDocuments depreciated in SharePoint 2010? What are the alternatives?
You should add your event receiver as a feature, maybe even as a part of the same feature that installs the content type. We always do it this way and it works perfectly

Resources