How to change Liferay Flag drop down values? - liferay

In liferay message board thread if we click on "Flag" then a window pop-up is coming with drop down values like "Violent & repulsive", "Spam" etc.
I want to change these text with my own words. I found code inside tomcat-6.0.18\webapps\ROOT\html\portlet\flags\edit_entry.jsp:
<option value="<%= reason %>"><liferay-ui:message key="<%= reason %>" /></option>
which is displaying the drop down but how can I edit the drop-down menu with my own words?
If anyone can suggest me how to proceed for here will be great help for me.
Thanks.

One way (easiest) is to override the following property in portal-ext.properties:
flags.reasons=sexual-content,violent-or-repulsive-content,My own flag,My content,Your violent acts
Hope this helps.
Extend this (to make it multilingual) by providing a new localization key instead of just a text. You can use a hook to introduce a new localization key into the portal, then just use the key here. If the key cannot be found (like in this sample e.g. "My own flag") it will be shown nontranslated.

Related

How to create a NotesRichtext item that is computed for display?

I know this is a common problem, and I tried a few solutions already, but the problem I have right now with my current code is that even though the attachments show in the computed for display field, I get the error "Note Item not Found" when I try to open them.
The form is built with two fields, in a programmable table that displays the editable one or the computed for display one.
The trick I found with Google's help was to delete the computed for display item in the queryopen event, so Notes regenerates the cfd item when opening the document. Visually, this works, as I see the text and attachments, but the attachments can't be opened.
Here is the code that removes the item in the QueryOpen of the form:
...
Set item = doc.GetFirstItem("dspDescription")
If Not item Is Nothing Then Call item.Remove()
...
Has anyone successfully achieved that functionality? Is there another way of doing this? I already tried with subforms, and because of the way the application is built, I need to be able to switch from editable to read only on the flick of a radio button, so subforms are out of the question as they can't be displayed dynamically.
Why don't you simple put the richtext item in a controlled access section and make that section editable / not editable with a computed for display formula. Select "always expand" and hide the section title, so that nobody can collapse it, et voila.
Regarding your comment: With this properties:
for this section in designer:
You get this result:
You see: No twisty, no "visible" section

How to validate CheckBox in Kentico 8.2?

I am working in Kentico 8.2, and I want the user to have to accept all of the terms and conditions. For this, I am using a check box. If that check box is unchecked then user will not be able to submit the form.
This is not achievable through Kentico help which says that I can achieve it by making the check box multiple choice. I have done this and it works but I want the check box's own validation to work.
I cannot attach a picture here otherwise I would show you guys what I have done so far.
If anyone has a solution then please help.
Do you use the basic Kentico forms module?
You can use Validation on a field.
in the Forms module:
new field "conditions"
check "Required"
default value unchecked
Validation "Add validation rule"
select General condition
Enter text > press edit and in the code tab add the following macro:
{%conditions.Value == 1%}
add an error message
dont forget to press Apply and save the field
This worked in my sample.

How to avoid spacing in class name

Currently, I am automating a web page using Watir-webdriver with page-objects. Here I want to check a class name if checkbox checked. I need to check infra01 and checked is present if unchecked infra01 and unchecked exists or not.
<span class="infra01 infrastructure checked"></span>
<span class="infra01 digitinline unchecked"></span>
Please help how to proceed using regular expression. Also please help me how to proceed the class name with spacing.
Not sure about the page object part, but you don't necessarily need to use a regular expression. You can use the attribute_value method to get the value of class attribute in the span tag and check to see if "unchecked" is included in the returned string:
browser.span.attribute_value("class").include? "unchecked"
try to proceed with regexp:
browser.span(:class => /#{Regexp.escape("infra01 infrastructure checked")}/).when_present.click
If it possible to use "if" 1st element unchecked "else" click 2nd element

show and hide Span/Label text in textbox

I am trying to implement a simple trick which would hide span/label inside textbox when user starts entering text in respective textbox, and show it, on blur if textbox is empty.
(It is implemented on user sign in form)
This thing is working okay so far and here is the demo
But it fails in following scenario:
1) If user enters username, previously entered username list (the form data stored by browser when auto-complete is turned off) appears. And if user selects username with mouse-click from the list, password field gets auto-populated. Now though password field has value in it, it won't hide the span.
(keydown/focus/click/change event over textbox not helping in this case)
2) When the username/password is wrong, page reloads, username textbox has last entered value. But still the span over it is being displayed.
(I tried to check if username textbox is empty on pageload. It didn't work)
Can anyone help me fix these things?
Thanks in advance... :)
What you need i s a placholder. Placeholder have been standardized by html5
and can be easily implemented via various jquery plugin (here is one).
i suggest you use those solutions, as they are standards. the ideal solution is to use html5 and than fallback to javascript for older browsers.
Look ath this form where i implemented placholders: http://www.consiglio.regione.lombardia.it/web/crl/BancheDati/atti_si
When you insert a letter in an input field, the text disappears. It's done with the help of that plugin.
It seems that you are attempting to reinvent the wheel here. Check this already answered question on what appears to be the same subject:
how do I make an html text box show a hint when empty
Usability-wise, I don't think it would be terrible to hide the watermarks of both inputs regardless of which on was clicked/keydowned etc. Now this next option is controversial, so you have been warned...
<input name="first_name" type="text" autocomplete="off">
Just wanted to make sure you were aware of that - most often used to prevent credit card fields from autocompleting. Hope something in here this helps.

SharePoint:FormField in a custom webpart?

On my home page, I want a simple webpart that allow users to quickly fill an entry in a list.
The list have, let's say, three fields : title (text), body (rich text), category (lookup).
I don't want to use the standard DataFormWebPart because I have a bit of code-behind that also fill some technical hidden fields of my list (actually, I don't exclude the DataFormWebPart, but I didn't find how to use it with code behind).
So I started to implement a custom webpart. Because I don't want to have to handle manually each field input, I started to use the FormField control, which automatically choose the rendering control, and provide a Value property with the correct format :
<SharePoint:FormField runat="server" id="fldTitle" FieldName="Title" />
This code is not sufficient, I have to specified the listid :
<SharePoint:FormField runat="server" id="fldTitle" FieldName="Title" ListId="{title list guid}" />
This is working quite correctly. I can in code access the fldTitle.Value to retrieve the user input.
BUT I have to include the webpart in a properly packaged and deployed feature, that can be activated. The webpart will always target the same list, but as the list is also instanciated in the feature (ListInstance element), I can't know the Guid in advance.
I've tried using several technics to set the list ID on the fly, but without success.
I've also "reflectored" the SP dlls to notice FormComponent class are using a "Context" that is set by ListFormWebPart.
Finally, my questions are :
is it the correct way to create a custom input webpart on the home page (not a list custom form) ?
how can I keep the behavior of the FormField (choose the right control and handle the input and its conversion to the storage format) ?
Will I have to create a custom ListFormWebPart ?
May I play with ControlTemplates ?
thanks in advance for the help... I'm struggling with this simple case for days now...
I think that customizing form templates is the easiest way to customize list forms. Since custom form templates are implemented as user controls you can add whatever code you want.
See the following article:
http://www.codeproject.com/KB/sharepoint/SharePointListForms.aspx

Resources