mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Phase one of merge of EC multilingual work
These files are their changes plus adjustments for formatting and immediate clashes I anticipate that this will break the build, but there are too many changes coming to risk it. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5740 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program 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 General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.web.bean.spaces;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.i18n.I18NUtil;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.node.MLPropertyInterceptor;
|
||||
import org.alfresco.service.cmr.repository.MLText;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.util.PropertyMap;
|
||||
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.CreateMultilingualPropertiesBean;
|
||||
import org.alfresco.web.bean.UserPreferencesBean;
|
||||
|
||||
public class CreateMultilingualPropertiesWizard extends CreateSpaceWizard
|
||||
{
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
MLText title, description;
|
||||
|
||||
// bind to the bean
|
||||
CreateMultilingualPropertiesBean createMultilingualPropertiesBean = (CreateMultilingualPropertiesBean) FacesHelper.getManagedBean(context, "CreateMultilingualPropertiesBean");
|
||||
UserPreferencesBean userPreferencesBean = (UserPreferencesBean) FacesHelper.getManagedBean(context, "UserPreferencesBean");
|
||||
|
||||
if (this.createFrom.equals("scratch"))
|
||||
{
|
||||
// create the space (just create a folder for now)
|
||||
NodeRef nodeRef = this.browseBean.getDocument().getNodeRef();
|
||||
// Add aspect (PropertyMap is a extension of HashMap with key LOCALE)
|
||||
PropertyMap properties = new PropertyMap();
|
||||
|
||||
// Modification du casting de l objet r<>cup<75>r<EFBFBD> des getters de MLText en Text
|
||||
MLPropertyInterceptor.setMLAware(true);
|
||||
|
||||
// MLText is a HashMap composed by key and description The Function addValue is the same that the function put() but the key is the Locale value
|
||||
Serializable oTitle = nodeService.getProperty(nodeRef, ContentModel.PROP_TITLE);
|
||||
Serializable oDescription = nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION);
|
||||
|
||||
|
||||
if(oTitle instanceof MLText)
|
||||
{
|
||||
title = (MLText) oTitle;
|
||||
}
|
||||
else
|
||||
{
|
||||
title = new MLText();
|
||||
title.addValue(I18NUtil.parseLocale(userPreferencesBean.getContentFilterLanguage()), oTitle.toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(oDescription instanceof MLText)
|
||||
{
|
||||
description = (MLText) oDescription;
|
||||
}
|
||||
else
|
||||
{
|
||||
description = new MLText();
|
||||
title.addValue(I18NUtil.parseLocale(userPreferencesBean.getContentFilterLanguage()), oDescription.toString());
|
||||
}
|
||||
|
||||
title.addValue(I18NUtil.parseLocale(createMultilingualPropertiesBean.getNewlanguage()), createMultilingualPropertiesBean.getTitle());
|
||||
description.addValue(I18NUtil.parseLocale(createMultilingualPropertiesBean.getNewlanguage()), createMultilingualPropertiesBean.getDescription());
|
||||
|
||||
properties.put(ContentModel.PROP_TITLE, title);
|
||||
properties.put(ContentModel.PROP_DESCRIPTION, description);
|
||||
|
||||
|
||||
// Ajout de l'aspect multilingue sur le titre
|
||||
this.nodeService.addAspect(nodeRef, ContentModel.ASPECT_TITLED, properties);
|
||||
/*
|
||||
MLText descriptionss = (MLText) nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION);
|
||||
|
||||
List<SelectItem> sel = new ArrayList();
|
||||
|
||||
for(Map.Entry<Locale, String> dd : descriptionss.entrySet())
|
||||
{
|
||||
sel.add(new SelectItem(dd.getKey().toString(), dd.getValue()));
|
||||
}
|
||||
|
||||
SelectItem[] items = new SelectItem[sel.size()];
|
||||
sel.toArray(items);
|
||||
*/
|
||||
// Modification du casting de l objet r<>cup<75>r<EFBFBD> des getters de MLText en Text
|
||||
MLPropertyInterceptor.setMLAware(false);
|
||||
}
|
||||
else if (this.createFrom.equals("existing"))
|
||||
{
|
||||
}
|
||||
else if (this.createFrom.equals("template"))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
if (createMultilingualPropertiesBean.isAdd_new_properties())
|
||||
{
|
||||
createMultilingualPropertiesBean.setTitle("");
|
||||
createMultilingualPropertiesBean.setDescription("");
|
||||
createMultilingualPropertiesBean.setAdd_new_properties(false);
|
||||
|
||||
return "dialog:createMultilingualProperties";
|
||||
}
|
||||
else
|
||||
{
|
||||
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + AlfrescoNavigationHandler.OUTCOME_SEPARATOR + "browse";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param preferences The UserPreferencesBean to set
|
||||
*/
|
||||
public void setUserPreferencesBean(UserPreferencesBean preferences)
|
||||
{
|
||||
this.preferences = preferences;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the preferences of the user
|
||||
*/
|
||||
public UserPreferencesBean getUserPreferencesBean()
|
||||
{
|
||||
return preferences;
|
||||
}
|
||||
|
||||
|
||||
/** The user preferences bean reference */
|
||||
protected UserPreferencesBean preferences;
|
||||
protected CreateMultilingualPropertiesBean createMultilingualPropertiesBean;
|
||||
}
|
||||
|
Reference in New Issue
Block a user