Author: kien_nguyen
Date: 2011-10-28 03:54:08 -0400 (Fri, 28 Oct 2011)
New Revision: 7905
Modified:
portal/trunk/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java
portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_en.properties
portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_fr.properties
portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_vi.properties
Log:
GTNPORTAL-2236 Have conflict when edit label of user's page
Modified:
portal/trunk/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java
===================================================================
---
portal/trunk/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java 2011-10-28
07:52:56 UTC (rev 7904)
+++
portal/trunk/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java 2011-10-28
07:54:08 UTC (rev 7905)
@@ -252,11 +252,6 @@
{
try
{
- if (nodeLabel == null || nodeLabel.length() == 0)
- {
- nodeLabel = "Tab_" + getCurrentNumberOfTabs();
- }
-
UserNavigation userNav = getCurrentUserNavigation();
UserNode parentNode = getParentTab();
if (userNav == null || parentNode == null)
@@ -264,8 +259,7 @@
return null;
}
- String uniqueNodeName = nodeLabel.toLowerCase().replace(' ',
'_');
-
+ String uniqueNodeName = buildName(nodeLabel);
SiteKey siteKey = userNav.getKey();
Page page =
configService.createPageTemplate(UITabPaneDashboard.PAGE_TEMPLATE,
siteKey.getTypeName(), siteKey.getName());
@@ -304,16 +298,23 @@
{
return false;
}
+ return true;
+ }
+
+ private String buildName(String label)
+ {
+ StringBuffer nodeName = new StringBuffer();
for (int i = 0; i < label.length(); i++)
{
char c = label.charAt(i);
- if (Character.isLetter(c) || Character.isDigit(c) || c == '_' || c ==
'-' || Character.isSpaceChar(c))
+ if (Character.isLetter(c) || Character.isDigit(c) || c == '_' || c ==
'-')
{
+ nodeName.append(c);
continue;
}
- return false;
+ nodeName.append("_");
}
- return true;
+ return nodeName.toString();
}
public UserNode renamePageNode(String nodeName, String newNodeLabel)
@@ -328,7 +329,7 @@
UserNode renamedNode = parentNode.getChild(nodeName);
renamedNode.setLabel(newNodeLabel);
- String newNodeName = newNodeLabel.toLowerCase().replace(' ',
'_');
+ String newNodeName = buildName(newNodeLabel);
if (parentNode.getChild(newNodeName) != null)
{
newNodeName = newNodeName + "_" + System.currentTimeMillis();
Modified:
portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_en.properties
===================================================================
---
portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_en.properties 2011-10-28
07:52:56 UTC (rev 7904)
+++
portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_en.properties 2011-10-28
07:54:08 UTC (rev 7905)
@@ -20,5 +20,5 @@
UITabPaneDashboard.action.addNewDashboard=Add Dashboard
UITabPaneDashboard.action.switchShowRange=Switch Range
UITabPaneDashboard.msg.deleteTab=Really want to remove this dashboard?
-UITabPaneDashboard.msg.cannotDeleteLastTab=Can not delete the last tab.
-UITabPaneDashboard.msg.wrongTabName={0}: is invalid; only alpha, digit, underscore, dash
and space characters allowed.
\ No newline at end of file
+UITabPaneDashboard.msg.cannotDeleteLastTab=Can not delete the last tab
+UITabPaneDashboard.msg.wrongTabName=Name cannot be empty and must start with a character
\ No newline at end of file
Modified:
portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_fr.properties
===================================================================
---
portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_fr.properties 2011-10-28
07:52:56 UTC (rev 7904)
+++
portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_fr.properties 2011-10-28
07:54:08 UTC (rev 7905)
@@ -17,8 +17,8 @@
# 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
#
-UITabPaneDashboard.action.addNewDashboard =Ajoute Dashboard
-UITabPaneDashboard.action.switchShowRange =Decale
-UITabPaneDashboard.msg.deleteTab=Really want to remove this dashboard?
-UITabPaneDashboard.msg.cannotDeleteLastTab=Can not delete the last tab.
-UITabPaneDashboard.msg.wrongTabName={0}: is invalid; only alpha, digit, underscore, dash
and space characters allowed.
\ No newline at end of file
+UITabPaneDashboard.action.addNewDashboard =Ajoute Dashboard
+UITabPaneDashboard.action.switchShowRange =Decale
+UITabPaneDashboard.msg.deleteTab=Etes-vous sûr de supprimer ce tableau de bord?
+UITabPaneDashboard.msg.cannotDeleteLastTab=Impossible de supprimer le dernier onglet
+UITabPaneDashboard.msg.wrongTabName=Nom ne peut pas être vide et doit commencer par un
caractère
Modified:
portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_vi.properties
===================================================================
---
portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_vi.properties 2011-10-28
07:52:56 UTC (rev 7904)
+++
portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_vi.properties 2011-10-28
07:54:08 UTC (rev 7905)
@@ -17,8 +17,8 @@
# 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
#
-UITabPaneDashboard.action.addNewDashboard=Thêm Dashboard
-UITabPaneDashboard.action.switchShowRange=Switch Range
-UITabPaneDashboard.msg.deleteTab=Bạn muốn xóa dashboard này?
+UITabPaneDashboard.action.addNewDashboard=Thêm Dashboard
+UITabPaneDashboard.action.switchShowRange=Switch Range
+UITabPaneDashboard.msg.deleteTab=Bạn muốn xóa dashboard này?
UITabPaneDashboard.msg.cannotDeleteLastTab=Không thể xóa tab cuối cùng.
-UITabPaneDashboard.msg.wrongTabName={0}: không hợp lệ, chỉ cho phép chữ cái, chữ số, kí
tự '_', kí tự '-' và kí tự cách.
+UITabPaneDashboard.msg.wrongTabName=Tên phải bắt đầu bằng một ký tự và không được để
trống