Merged V3.4-BUG-FIX to HEAD

28158: ALF-8925: Merged V3.3 to V3.4-BUG-FIX
      28121: ALF-8878: Prevent authentication errors in SMBSrvSession.cleanupSession()
   28159: Merged HEAD to V3.4-BUG-FIX (RECORD ONLY)
      27951: Fixed merge issue in ContentDiskDriverTest
   28161: ALF-8861: Fix from Bitrock to kill OpenOffice process on uninstallation if all else fails
   28165: ALF-8260: Corrected French translations of 'Library'
   28166: Fix for ALF-8751 - Dates are not localized in Document Lists dashlet
   28167: Fix for ALF-8493
   28169: ALF-5797: Translation corrections to complex strings
   28171: Merged DEV TO V3.4-BUG-FIX 
      ALF-8808 : CLONE - NFS: User with editor role cannot edit content - unit test required
   28181: Fixed ALF-280: Unfriendly message appears when trying to specify non-existent file-store
   28184: Merged BRANCHES/DEV/BELARUS/V3.4-BUG-FIX-2011_04_12 to BRANCHES/DEV/V3.4-BUG-FIX:
      28179: ALF-8754: Cannot preview content on other webapp folder than ROOT (merged w/ trivial clean-up)
   28185: Fixed ALF-8020: Multivalue date in document details causes error in alfresco share   
      NOTE: We do not support any multi-valued fields other than text currently, this fix is therefore to handle the case where a multivalued date or dateTime field is configured in a form. The form will list the dates in view mode but in create and edit modes the control is not displayed at all when there are multiple values, if there is only one value the control continues to function as it has done previously.
   28188: Fix for ALF-731 - in a cluster environment (high availibility), when a node goes down, the users are asked to login


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28208 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2011-06-06 10:57:20 +00:00
parent 5e6d266b3e
commit 7a65f3f33b
11 changed files with 191 additions and 38 deletions

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.web.bean.generator;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.ui.repo.component.UIStoreSelector;
/**
* Generates a content store selector component.
*/
public class StoreSelectorGenerator extends BaseComponentGenerator
{
public UIComponent generate(FacesContext context, String id)
{
UIComponent component = context.getApplication().
createComponent(UIStoreSelector.COMPONENT_TYPE);
FacesHelper.setupComponentId(context, component, id);
return component;
}
}

View File

@@ -19,6 +19,9 @@
package org.alfresco.web.ui.repo.component;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.nio.charset.Charset;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -35,6 +38,7 @@ import javax.faces.el.ValueBinding;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.util.GUID;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.config.ActionsConfigElement;
@@ -646,7 +650,20 @@ public class UIActions extends SelfRenderingComponent
*/
private static String createUniqueId()
{
return "id_" + Short.toString(++id);
String guidString = GUID.generate();
byte[] guidBytes = null;
try
{
guidBytes = guidString.getBytes("ISO8859_1");
}
catch (UnsupportedEncodingException e)
{
//probably unreachable block, so just in case
Charset defaultCharset = Charset.defaultCharset();
logger.warn("Can't get GUID bytes for encoding ISO8859_1, use default " + defaultCharset);
guidBytes = guidString.getBytes(defaultCharset);
}
return "id_" + new BigInteger(guidBytes).toString(Character.MAX_RADIX);
}
// ------------------------------------------------------------------------------

View File

@@ -0,0 +1,81 @@
/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.web.ui.repo.component;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.faces.component.UISelectItems;
import javax.faces.component.UISelectOne;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.repo.dictionary.constraint.ConstraintRegistry;
import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint;
import org.alfresco.service.cmr.dictionary.Constraint;
import org.alfresco.web.data.IDataContainer;
import org.alfresco.web.data.QuickSort;
/**
* Component that holds a list of content stores configured in the repository.
*/
public class UIStoreSelector extends UISelectOne
{
public static final String COMPONENT_TYPE = "org.alfresco.faces.StoreSelector";
public static final String COMPONENT_FAMILY = "javax.faces.SelectOne";
@Override
@SuppressWarnings("unchecked")
public void encodeBegin(FacesContext context) throws IOException
{
if (getChildren().size() == 0)
{
UISelectItems items = (UISelectItems)context.getApplication().
createComponent("javax.faces.SelectItems");
items.setId(this.getId() + "_items");
items.setValue(createList());
// add the child component
getChildren().add(items);
}
// do the default processing
super.encodeBegin(context);
}
/**
* @return List of SelectItem components
*/
protected List<SelectItem> createList()
{
List<SelectItem> items = new ArrayList<SelectItem>(5);
Constraint storesConstraint = ConstraintRegistry.getInstance().getConstraint("defaultStoreSelector");
for(String store : ((ListOfValuesConstraint) storesConstraint).getAllowedValues())
{
items.add(new SelectItem(store, store));
}
// make sure the list is sorted by the values
QuickSort sorter = new QuickSort(items, "label", true, IDataContainer.SORT_CASEINSENSITIVE);
sorter.sort();
return items;
}
}