Issue Details (XML | Word | Printable)

Key: SAK-15823
Type: Task Task
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Savitha Prakash
Reporter: Savitha Prakash
Votes: 0
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
Sakai

There is a need to have a feature to strip the html, trim and add ellipse to a formatted text.

Created: 25-Feb-2009 08:10   Updated: 24-Nov-2009 09:03
Component/s: Site Info, Sites (Admin Site Management), Sites (Gateway)
Affects Version/s: 2.5.0, 2.5.2, 2.5.3, 2.5.4, 2.5.x, 2.5.5, 2.6.x, 2.6.0
Fix Version/s: 2.7.0

Time Tracking:
Not Specified

File Attachments: 1. File SAK-15823.diff (8 kB)
2. Java Source File SiteTextEditUtil.java (1 kB)

Issue Links:
Depend
 
Relate
 

2.6.x Status: Merge
2.5.x Status: Merge
2.4.x Status: None


 Description  « Hide
Many tools has the requirement of displaying a trimmed and plain text version of the description in the UI. So, it will be helpful to have a macro to do such an action in a centralized service.

 All   Comments   Work Log   Change History   Subversion Commits   git Commits      Sort Order: Ascending order - Click to sort in descending order
Savitha Prakash added a comment - 25-Feb-2009 08:18
A method "doPlainTextAndLimit" has been added to the Validator. This can be used to strip, trim and add ellipse to a text. A patch to add such a functionality is attached.

Stephen Marquard added a comment - 25-Feb-2009 08:57
Hi Savitha,

Why does this method ignore the case of "<br/>"?

Savitha Prakash added a comment - 25-Feb-2009 09:16
Sometimes, even when there is no description, it might contain </br>, which is misleading as it might think that is has some content and in the process adds the ellipse. To avoid this, I have added a check.

If the text contains only </br>, we don't need to convert to plain text or trim it or add ellipse, as it will just be displayed as empty.

Savitha Prakash added a comment - 26-Feb-2009 12:50
I slightly modified the patch to accommodate for the empty text.

Savitha Prakash added a comment - 03-Mar-2009 08:50
seems like that there are many more tags present for an empty text from the fck editor. Some of them are " ", "&nbsp;" "" ;"<br>"; "<br/>"; Empty"&lt; br type=&quot;_moz&quot; /&gt and many more.

So I was thinking it would be better to first implement in the tool itself, where ever it is required, monitor its working, and then probably plan to move it into kernel.

Savitha Prakash added a comment - 09-Mar-2009 13:48
RTE is being planned to be removed and just retain plain text for group description. Hence, strip html and trim feature is required only for site description. We have to target the following for site desciption-

site-manage
----------------
M site-manage-tool/tool/src/webapp/vm/sitesetup/chef_site-list.vm
M site-manage-tool/tool/src/webapp/vm/sitesetup/chef_site-siteInfo-list.vm
M site-manage-tool/tool/src/webapp/vm/sitebrowser/chef_sitebrowser_list.vm
M site-manage-tool/tool/src/webapp/vm/membership/chef_membership.vm
M site-manage-tool/tool/src/webapp/vm/membership/chef_membership_joinable.vm
M site-manage-tool/tool/src/webapp/vm/sitesetup/chef_site-siteInfo-list.vm

Savitha Prakash added a comment - 09-Mar-2009 13:53
Feature has been added to siteAction
r58432

Savitha Prakash added a comment - 10-Mar-2009 07:14
Feature added to sitebrowser for list view
r58443

Savitha Prakash added a comment - 10-Mar-2009 08:04
This feature for membership is part of the branch https://source.sakaiproject.org/svn/site-manage/branches/SAK-15142/
Branch has been merged to trunk
r58448

Savitha Prakash added a comment - 10-Mar-2009 08:14
Membership action name is changed to membershipTextEdit instead of membershioFormattedText.
r58449

Savitha Prakash added a comment - 10-Mar-2009 08:19
Feature has been added to sitebrowser, siteaction and membership tools. Following are the functions available for these tools-

1. For worksitesetup and site info - use $siteTextEdit.doPlainTextAndLimit(String formattedText, int maxNumOfChars, String ellipse)
2. For Site browser (available only for list view) - use $siteBrowserTextEdit.doPlainTextAndLimit(String formattedText, int maxNumOfChars, String ellipse)
3. Membership - $membershipTextEdit.doPlainTextAndLimit(String formattedText, int maxNumOfChars, String ellipse)

Savitha Prakash added a comment - 12-Mar-2009 11:00
doPlainTextAndLimit returns empty string if the text contains empty characters
r58576

Zhen Qian added a comment - 17-Mar-2009 07:14
Savitha,

Please see the related SAK-15868 for further problems. I will attach an patch here, which put the html format routine into a single util class.

- Zhen

Savitha Prakash added a comment - 17-Mar-2009 09:14
Fix to SAK-15868 has been implemented and doPlainTextAndTrim has been moved into a utility class SiteTextEditUtil
r58700
r58701