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:
Derek Hulley
2007-05-22 04:47:14 +00:00
parent ed5b547943
commit a266aab21c
48 changed files with 5780 additions and 1220 deletions

View File

@@ -1,5 +1,46 @@
# I18N message properties
# Multilingual
make_multilingual=Make Multilingual
make_multilingual_tooltip=Make this document multilingual
make_multilingual_description=Transform this document as a multilingual document.
error_make_multilingual_dialog=Unable to make this file multilingual.
add_translation=Add Translation
add_translation_tooltip=Add a translation to this document
add_translation_description=Add a translation to the document.
error_add_translation_dialog=Unable to add a translation.
trad_exists_error=A traduction already exists for this locale.
add_translation_wc=Add Translation Without Content
add_translation_wc_tooltip=Add a translation without content to the document
add_translation_wc_description=Add a translation to the document's properties.
error_add_translation_wc_dialog=Unable to add a translation without content.
create_properties_close=Add new properties when the dialog closes
ml_common_content_properties=Common Multilingual Content Properties
ml_other_options=Other Options
ml_add_trans_when_diag_close=Add translation when this dialog closes.
ml_with_content=With content
ml_just_trans_info=Without content (just translation information)
not_multilingual=This document has no multilinguism aspect.
allow_multilinguism=Allow Multilinguism Aspect
select_language=<Select a language>
ml_content_info=Multilingual Content Info
edit_ml_container_properties=Edit multilingual content properties
edit_ml_container_description=Modify the information about the multilingual content.
error_locale_null=A locale must be defined for this node.
translator=Translator
manage_multilingual_details_for=Manage Multilingual Content for
manage_multilingual_details=Manage Multilingual Content
manage_multilingual_details_tooltip=Manage multilingual properties of the document
manage_multilingual_details_description=Use this page to manage manage multilingual content.
translations=Translations
related_translations=Related Translations
related_content=Related Content
deep_copy=Deep Copy
new_edition=New Edition
new_edition_from=New Edition from this
properties_close=Edit multilingual properties when the dialog close
pivot_translation=Pivot translation
# Date Pattern
date_pattern=d MMMM yyyy
date_time_pattern=d MMMM yyyy HH:mm
@@ -35,6 +76,7 @@ editworkflow_description=Modify the simple workflow properties then click OK.
editspace_description=Modify the space properties then click OK.
editlink_description=Modify the link object properties then click OK.
create_space_description=Enter information about the new space then click Create Space.
create_multilingual_space_description=Enter information about the new space then click Create Space.
space_rules_description=This view shows you all the rules to be applied to content in this space.
warning_inline=This is only recommended for HTML or plain text documents.
categories_description=This view allows you to browse and modify the categories hiearchy.
@@ -215,6 +257,7 @@ author=Author
date=Date
mimetype=Format
modifier=Modifier
locale=Locale
# Repo permission display labels
# Note - these come from the server, the english translation is generally the same
@@ -244,6 +287,7 @@ delete_rule=Delete Rule
delete_user=Delete User
remove_user=Remove User
create_space=Create Space
create_multilingual_space=Create Multilingual Space
add_content=Add Content
create_content=Create Content
create_form=Create Web Form

View File

@@ -42,6 +42,67 @@
</params>
</action>
<!-- Make a document multilingual -->
<action id="make_doc_multilingual">
<permissions>
<permission allow="true">Write</permission>
</permissions>
<evaluator>org.alfresco.web.action.evaluator.MakeMultilingualEvaluator</evaluator>
<label-id>make_multilingual</label-id>
<tooltip-id>make_multilingual_tooltip</tooltip-id>
<image>/images/icons/make_ml.gif</image>
<action>dialog:makeMultilingual</action>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Add a translation -->
<action id="add_translation">
<permissions>
<permission allow="true">Write</permission>
</permissions>
<evaluator>org.alfresco.web.action.evaluator.AddTranslationEvaluator</evaluator>
<label-id>add_translation</label-id>
<tooltip-id>add_translation_tooltip</tooltip-id>
<image>/images/icons/add_tranlsation.gif</image>
<action-listener>#{AddTranslationDialog.start}</action-listener>
<action>addTranslation</action>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Add a translation whithout content -->
<action id="add_translation_wc">
<permissions>
<permission allow="true">Write</permission>
</permissions>
<evaluator>org.alfresco.web.action.evaluator.AddTranslationEvaluator</evaluator>
<label-id>add_translation_wc</label-id>
<tooltip-id>add_translation_wc_tooltip</tooltip-id>
<image>/images/icons/add_tranlsation_wc.gif</image>
<action>dialog:addTranslationWithoutContent</action>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Manage ml container details -->
<action id="ml_details">
<permissions>
<permission allow="true">Read</permission>
</permissions>
<evaluator>org.alfresco.web.action.evaluator.MultilingualDetailsEvaluator</evaluator>
<label-id>manage_multilingual_details</label-id>
<tooltip-id>manage_multilingual_details_tooltip</tooltip-id>
<image>/images/icons/multilingual_details.gif</image>
<action-listener>#{BrowseBean.setupContentAction}</action-listener>
<action>dialog:showMLContainerDetails</action>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Edit document action to open using normal HTTP access or inline Edit if set -->
<action id="edit_doc_http">
<permissions>
@@ -309,6 +370,7 @@
</permissions>
<label-id>cut</label-id>
<image>/images/icons/cut.gif</image>
<evaluator>org.alfresco.web.action.evaluator.CutNodeEvaluator</evaluator>
<action-listener>#{ClipboardBean.cutNode}</action-listener>
<params>
<param name="ref">#{actionContext.nodeRef}</param>
@@ -381,6 +443,17 @@
<action>dialog:createSpace</action>
</action>
<!-- Create multilingual space -->
<action id="create_multilingual_space">
<permissions>
<permission allow="true">CreateChildren</permission>
</permissions>
<label-id>create_multilingual_space</label-id>
<image>/images/icons/create_space.gif</image>
<action>dialog:createMultilingualSpace</action>
</action>
<!-- Create Advanced Space Wizard -->
<action id="create_space_wizard">
<permissions>
@@ -626,6 +699,7 @@
<action idref="create_form" />
<action idref="create_website_wizard" />
<action idref="create_space" />
<action idref= "create_multilingual_space" />
<action idref="create_space_wizard" />
</action-group>
@@ -665,8 +739,25 @@
<action idref="create_shortcut" />
<action idref="preview_doc" />
<action idref="run_action" />
<action idref="make_doc_multilingual" />
<action idref="add_translation" />
<action idref="add_translation_wc" />
<action idref="ml_details" />
</action-group>
<action-group id="Multilingual_details_actions">
<action idref="add_translation" />
<action idref="add_translation_wc" />
<!--action idref="cut_container" /-->
<!--action idref="copy_container" /-->
<!--action idref="delete_container" /-->
<!--action idref="take_ownership_container" /-->
<!--action idref="start_discussion_container" /-->
<!--action idref="new_edition_container" /-->
</action-group>
<!-- Actions Menu for Space Details screen -->
<action-group id="space_details_actions">
<action idref="approve_space_details" />

View File

@@ -6,14 +6,43 @@
<dialogs>
<!-- -->
<!-- Multilingual Dialogs -->
<!-- Definition of the make multilingual dialog -->
<dialog name="makeMultilingual" page="/jsp/ml/make-multilingual-dialog.jsp" managed-bean="MakeMultilingualDialog"
icon="/images/icons/make_ml_large.gif" title-id="make_multilingual"
description-id="make_multilingual_description" error-message-id="error_make_multilingual_dialog" />
<!-- Definition of the add translation dialog dialog -->
<dialog name="addTranslationWithoutContent" page="/jsp/ml/add-translation-without-content.jsp" managed-bean="AddTranslationWithoutContentDialog"
icon="/images/icons/add_tranlsation_wc_large.gif" title-id="add_translation_wc"
description-id="add_translation_wc_description" error-message-id="error_add_translation_wc_dialog" />
<!-- Definition of the edit ml container dialog -->
<dialog name="editMlContainer" page="/jsp/ml/edit-ml-container-dialog.jsp" managed-bean="EditMLContainerDialog"
icon="/images/icons/details_large.gif" title-id="edit_ml_container_properties"
description-id="edit_ml_container_description" />
<!-- -->
<!-- Content and Space Dialogs -->
<!-- Definition of the create space dialog -->
<dialog name="createSpace" page="/jsp/spaces/create-space-dialog.jsp" managed-bean="CreateSpaceDialog"
<dialog name="createSpace" page="/jsp/spaces/create-space-dialog.jsp" managed-bean="CreateMultilingualSpaceDialog"
icon="/images/icons/create_space_large.gif" title-id="create_space"
description-id="create_space_description" error-message-id="error_create_space_dialog" />
<!-- Definition of the create multilingual space dialog -->
<dialog name="createMultilingualSpace" page="/jsp/spaces/ml/create-multilingual-space-dialog.jsp" managed-bean="CreateMultilingualSpaceDialog"
icon="/images/icons/create_space_large.gif" title-id="create_multilingual_space"
description-id="create_multilingual_space_description" error-message-id="error_create_space_dialog" />
<!-- Definition of the create multilingual properties dialog -->
<dialog name="createMultilingualProperties" page="/jsp/spaces/ml/create-multilingual-properties-dialog.jsp" managed-bean="CreateMultilingualPropertiesDialog"
icon="/images/icons/create_space_large.gif" title-id="create_multilingual_space"
description-id="create_multilingual_space_description" error-message-id="error_create_multilingual_space_dialog" />
<!-- Definition of the edit space dialog -->
<dialog name="editSpace" page="/jsp/spaces/edit-space-dialog.jsp" managed-bean="EditSpaceDialog"
icon="/images/icons/details_large.gif" title-id="modify_space_properties"

View File

@@ -20,7 +20,7 @@
<!-- Override the cut action to check for discussions, don't allow them to be cut -->
<!-- Cut a document or space to the clipboard, from browse or doc details screens -->
<action id="cut_node">
<evaluator>org.alfresco.web.action.evaluator.DiscussionCutCopyEvaluator</evaluator>
<evaluator>org.alfresco.web.action.evaluator.CutNodeEvaluator</evaluator>
<permissions>
<permission allow="true">Delete</permission>
</permissions>

View File

@@ -189,6 +189,36 @@
</property-sheet>
</config>
<config evaluator="aspect-name" condition="cm:mlDocument">
<property-sheet>
<show-property name="author" display-label-id="translator"/>
<show-property name="sys:locale"
component-generator="LanguageSelectorGenerator" display-label-id="language"/>
<show-property name="description" component-generator="TextAreaGenerator" />
<!-- Bug issue, icon displays with other properties if visible -->
<show-property name="app:icon" show-in-view-mode="false" show-in-edit-mode="false" />
<!-- Don't allow mofification of the Auto Version property -->
<show-property name="autoVersion" show-in-view-mode="true" show-in-edit-mode="false" />
</property-sheet>
</config>
<config evaluator="aspect-name" condition="cm:mlEmptyTranslation">
<property-sheet>
<show-property name="mimetype" show-in-edit-mode="false" show-in-view-mode="false" />
</property-sheet>
</config>
<config evaluator="node-type" condition="cm:mlContainer">
<property-sheet>
<show-property name="author"/>
<show-property name="sys:locale"
display-label-id="pivot_translation"
component-generator="MlContainerLanguageSelectorGenerator" />
<!-- Don't allow mofification of the Auto Version property -->
<show-property name="autoVersion" show-in-view-mode="true" show-in-edit-mode="false" />
</property-sheet>
</config>
<!-- ********************************** -->
<!-- Configuration for discussion types -->
<!-- ********************************** -->

View File

@@ -0,0 +1,70 @@
/*
* 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.action.evaluator;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.ml.MultilingualContentService;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.UserPreferencesBean;
import org.alfresco.web.bean.repository.Node;
/**
* Evaluates whether the Add Translation (with or without content) action should be visible.
*
* If the node is not already Multilingual, locked, or if a translation exists for each available
* filter language, don't allow the action.
*
* @author yanipig
*/
public class AddTranslationEvaluator implements ActionEvaluator
{
public boolean evaluate(Node node)
{
FacesContext fc = FacesContext.getCurrentInstance();
MultilingualContentService mlservice =
(MultilingualContentService) FacesHelper.getManagedBean(fc, "MultilingualContentService");
UserPreferencesBean userprefs =
(UserPreferencesBean) FacesHelper.getManagedBean(fc, "UserPreferencesBean");
// the number of translation of this document
int availableTranslationCount = mlservice.getTranslations(node.getNodeRef()).size();
// the total number of available languages for the translation
int contentFilterLanguagesCount = userprefs.getContentFilterLanguages(false).length;
return (
node.isLocked() == false &&
node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false &&
node.hasAspect(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT) == true &&
availableTranslationCount < contentFilterLanguagesCount
);
}
}

View File

@@ -51,6 +51,7 @@ public class CheckoutDocEvaluator implements ActionEvaluator
return dd.isSubClass(node.getType(), ContentModel.TYPE_CONTENT) &&
((node.hasPermission(PermissionService.CHECK_OUT) && node.hasPermission(PermissionService.CREATE_CHILDREN) &&
(node.isLocked() == false &&
node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false)));
node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false) &&
node.hasAspect(ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION) == false));
}
}

View File

@@ -0,0 +1,59 @@
/*
* 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.action.evaluator;
import org.alfresco.model.ContentModel;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.bean.repository.Node;
/**
* Evaluates whether the Cut Node action should be visible.
*
* Among all available operations over non-multilingual documents (i.e. copy,
* delete, start discussion, etc), there is a missing one: <b>Move</b>.
* Translations cannot be moved due to the exiting link it has with the logical
* document. Despite it is technically achievable, it could be functionally
* troublesome. Spreading translations of the same semantic message among several
* spaces could lead to confusion and problems.
*
* @author yanipig
*/
public class CutNodeEvaluator extends DiscussionCutCopyEvaluator
{
public boolean evaluate(Node node)
{
boolean eval = super.evaluate(node);
if(eval == true)
{
eval = !node.getAspects().contains(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT);
}
return eval;
}
}

View File

@@ -24,8 +24,12 @@
*/
package org.alfresco.web.action.evaluator;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.ml.MultilingualContentService;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.repository.Node;
/**
@@ -40,7 +44,33 @@ public class DeleteDocEvaluator implements ActionEvaluator
*/
public boolean evaluate(Node node)
{
boolean isPivot = false;
// special case for multilingual documents
if(node.getAspects().contains(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT))
{
FacesContext fc = FacesContext.getCurrentInstance();
MultilingualContentService mlservice =
(MultilingualContentService) FacesHelper.getManagedBean(fc, "MultilingualContentService");
// if the translation is the last translation, user can delete it
if(mlservice.getTranslations(node.getNodeRef()).size() == 1)
{
isPivot = false;
}
// Else if the node is the pivot language, user can't delete it
else if( mlservice.getPivotTranslation(node.getNodeRef()).getId()
.equalsIgnoreCase(node.getNodeRef().getId()))
{
isPivot = true;
}
// finally, the node is not the pivot translation, user can delete it
}
return (node.isLocked() == false &&
node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false);
node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false &&
isPivot == false
);
}
}

View File

@@ -26,6 +26,7 @@ package org.alfresco.web.action.evaluator;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.model.ForumModel;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeService;
@@ -64,6 +65,12 @@ public class DiscussionCutCopyEvaluator implements ActionEvaluator
result = (assocType.equals(ForumModel.ASSOC_DISCUSSION) == false);
}
// impossible to copy a translation without content.
if(result && node.getAspects().contains(ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))
{
result = false;
}
return result;
}
}

View File

@@ -52,9 +52,15 @@ public class EditDocHttpEvaluator implements ActionEvaluator
boolean result = false;
// Since the reader returned of an empty translation is the reader of it's pivot translation, it makes
// no sens to edit it on-line.
if(node.getAspects().contains(ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))
{
//result = false
}
// if the node is inline editable, the default http behaviour should
// always be used otherwise the configured approach is used
if (dd.isSubClass(node.getType(), ContentModel.TYPE_CONTENT))
else if (dd.isSubClass(node.getType(), ContentModel.TYPE_CONTENT))
{
if (node.hasAspect(ApplicationModel.ASPECT_INLINEEDITABLE) == true ||
"http".equals(Application.getClientConfig(fc).getEditLinkType()))

View File

@@ -0,0 +1,62 @@
/*
* 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.action.evaluator;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.UserPreferencesBean;
import org.alfresco.web.bean.repository.Node;
/**
* Evaluates whether the Make Multilingual action should be visible.
*
* If the node is already Multilingual don't allow the action.
*
* @author yanipig
*/
public class MakeMultilingualEvaluator implements ActionEvaluator
{
public boolean evaluate(Node node)
{
FacesContext fc = FacesContext.getCurrentInstance();
UserPreferencesBean userprefs =
(UserPreferencesBean) FacesHelper.getManagedBean(fc, "UserPreferencesBean");
// the total number of available languages for the translation have to be greather that 0
int contentFilterLanguagesCount = userprefs.getContentFilterLanguages(false).length;
return (node.isLocked() == false &&
node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == false &&
node.hasAspect(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT) == false &&
contentFilterLanguagesCount > 0
);
}
}

View File

@@ -0,0 +1,48 @@
/*
* 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.action.evaluator;
import org.alfresco.model.ContentModel;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.bean.repository.Node;
/**
* Evaluates whether the Manage Multinlingual Details action should be visible.
*
* The action is available only if the node is a translation.
*
* @author yanipig
*/
public class MultilingualDetailsEvaluator implements ActionEvaluator
{
public boolean evaluate(Node node)
{
return (
node.hasAspect(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT) == true
);
}
}

View File

@@ -26,6 +26,7 @@ package org.alfresco.web.action.evaluator;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.NavigationBean;
@@ -45,6 +46,10 @@ public class StartWorkflowEvaluator implements ActionEvaluator
{
NavigationBean nav =
(NavigationBean)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), NavigationBean.BEAN_NAME);
return (nav.getIsGuest() == false);
return (
nav.getIsGuest() == false
&& node.hasAspect(ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION) == false
);
}
}

View File

@@ -30,6 +30,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
@@ -132,6 +133,15 @@ public class BrowseBean implements IContextListener
this.searchService = searchService;
}
/**
* @param userPreferencesBean The UserPreferencesBean to set.
*/
public void setUserPreferencesBean(UserPreferencesBean userPreferencesBean)
{
this.userPreferencesBean = userPreferencesBean;
}
/**
* @param lockService The Lock Service to set.
*/
@@ -481,6 +491,7 @@ public class BrowseBean implements IContextListener
node.addPropertyResolver("fileType16", this.resolverFileType16);
node.addPropertyResolver("fileType32", this.resolverFileType32);
node.addPropertyResolver("size", this.resolverSize);
node.addPropertyResolver("lang", this.resolverLang);
}
@@ -659,6 +670,7 @@ public class BrowseBean implements IContextListener
node.addPropertyResolver("fileType16", this.resolverFileType16);
node.addPropertyResolver("fileType32", this.resolverFileType32);
node.addPropertyResolver("size", this.resolverSize);
node.addPropertyResolver("lang", this.resolverLang);
this.contentNodes.add(node);
}
@@ -823,6 +835,7 @@ public class BrowseBean implements IContextListener
node.addPropertyResolver("fileType16", this.resolverFileType16);
node.addPropertyResolver("fileType32", this.resolverFileType32);
node.addPropertyResolver("size", this.resolverSize);
node.addPropertyResolver("lang", this.resolverLang);
node.addPropertyResolver("path", this.resolverPath);
node.addPropertyResolver("displayPath", this.resolverDisplayPath);
@@ -1043,6 +1056,39 @@ public class BrowseBean implements IContextListener
}
};
public NodePropertyResolver resolverLang = new NodePropertyResolver() {
public Object get(Node node) {
String lang = null;
if(node.getAspects().contains(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT))
{
Locale locale = (Locale) node.getProperties().get(ContentModel.PROP_LOCALE);
// the content filter lang defined by the user
String userLang = userPreferencesBean.getContentFilterLanguage();
// the node lang
String nodeLang = locale.getLanguage();
// if filter equals all languages : display the lang for each translation
if(nodeLang == null)
{
lang = nodeLang;
}
// if filter is different : display the lang
else if (!nodeLang.equalsIgnoreCase(userLang))
{
lang = nodeLang;
}
// else if the filter is equal to the lang node : nothing to do [lang = null]
}
return lang;
}
};
// ------------------------------------------------------------------------------
// Navigation action event handlers
@@ -1357,6 +1403,7 @@ public class BrowseBean implements IContextListener
node.addPropertyResolver("fileType32", this.resolverFileType32);
node.addPropertyResolver("mimetype", this.resolverMimetype);
node.addPropertyResolver("size", this.resolverSize);
node.addPropertyResolver("lang", this.resolverLang);
for (NodeEventListener listener : getNodeEventListeners())
{
@@ -1727,6 +1774,9 @@ public class BrowseBean implements IContextListener
/** The NavigationBean bean reference */
protected NavigationBean navigator;
/** The UserPreferencesBean to be used by the bean */
protected UserPreferencesBean userPreferencesBean;
/** The DictionaryService bean reference */
protected DictionaryService dictionaryService;

View File

@@ -0,0 +1,224 @@
/*
* 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;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
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.service.cmr.repository.NodeService;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.FacesHelper;
public class CreateMultilingualPropertiesBean
{
/** binding with edit of Other Options */
private String language = null;
private String newlanguage = null;
private String title = null;
private String description = null;
protected boolean add_new_properties = false;
/** The NodeService to be used by the bean */
protected NodeService nodeService;
/** The user preferences bean reference */
protected UserPreferencesBean preferences;
/**
* @param nodeService The NodeService to set.
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
public String getLanguage()
{
return this.language;
}
public void setLanguage(String x)
{
this.language = x;
Application.setLanguage(FacesContext.getCurrentInstance(), this.language);
}
public void setNewlanguage(String x)
{
this.newlanguage = x;
}
public String getNewlanguage()
{
return this.newlanguage;
}
public void setUserPreferencesBean(UserPreferencesBean preferences)
{
this.preferences = preferences;
}
public UserPreferencesBean getUserPreferencesBean()
{
return preferences;
}
public void setTitle(String x)
{
this.title = x;
}
public void setDescription(String x)
{
this.description = x;
}
public String getTitle()
{
return this.title;
}
public String getDescription()
{
return this.description;
}
// Display the list of all multilingual properties
public SelectItem[] getListAllDescriptionsProperties()
{
MLPropertyInterceptor.setMLAware(true);
BrowseBean browseBean = (BrowseBean) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "BrowseBean");
// create the space (just create a folder for now)
NodeRef nodeRef = browseBean.getDocument().getNodeRef();
if(nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION) != null)
{
List<SelectItem> sel = new ArrayList<SelectItem>();
if (nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION) instanceof MLText)
{
MLText descriptions = (MLText) nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION);
for(Map.Entry<Locale, String> description : descriptions.entrySet())
{
sel.add(new SelectItem(description.getKey().toString(), description.getValue().toString()));
}
MLPropertyInterceptor.setMLAware(false);
// Create the table
SelectItem[] items = new SelectItem[sel.size()];
// Copy into table
sel.toArray(items);
if(sel.size() > 0)
{
return items;
}
else
{
SelectItem[] elements = { new SelectItem("","")}; return elements;
}
}
else
{
SelectItem[] elements = { new SelectItem("","")}; return elements;
}
}
else
{
SelectItem[] elements = { new SelectItem("")}; return elements;
}
}
// Display the list of all multilingual properties
public SelectItem[] getListAllTitlesProperties()
{
MLPropertyInterceptor.setMLAware(true);
BrowseBean browseBean = (BrowseBean) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "BrowseBean");
// create the space (just create a folder for now)
NodeRef nodeRef = browseBean.getDocument().getNodeRef();
if(nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION) != null)
{
List<SelectItem> sel = new ArrayList<SelectItem>();
if (nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION) instanceof MLText)
{
MLText descriptions = (MLText) nodeService.getProperty(nodeRef, ContentModel.PROP_TITLE);
for(Map.Entry<Locale, String> description : descriptions.entrySet())
{
sel.add(new SelectItem(description.getKey().toString(), description.getValue()));
}
MLPropertyInterceptor.setMLAware(false);
// Create the table
SelectItem[] items = new SelectItem[sel.size()];
// Copy into table
sel.toArray(items);
if(sel.size() > 0)
{
return items;
}
else
{
SelectItem[] elements = { new SelectItem("","")}; return elements;
}
}
else
{
SelectItem[] elements = { new SelectItem("","")}; return elements;
}
}
else
{
SelectItem[] elements = { new SelectItem("","")}; return elements;
}
}
public SelectItem[] getContentFilterLanguages()
{
return preferences.getContentFilterLanguages(false);
}
public boolean isAdd_new_properties() {return this.add_new_properties;}
public void setAdd_new_properties(boolean x){this.add_new_properties = x;}
}

View File

@@ -30,6 +30,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.faces.application.FacesMessage;
@@ -79,6 +80,8 @@ public class DocumentDetailsBean extends BaseDetailsBean
protected LockService lockService;
protected VersionService versionService;
protected CheckOutCheckInService cociService;
protected MultilingualContentService multilingualContentService;
protected ContentFilterLanguagesService contentFilterLanguagesService;
private NodeRef addedCategory;
private List categories;
@@ -96,6 +99,8 @@ public class DocumentDetailsBean extends BaseDetailsBean
// initial state of some panels that don't use the default
panels.put("version-history-panel", false);
panels.put("ml-info-panel", false);
panels.put("related-translation-panel", false);
}
@@ -184,6 +189,14 @@ public class DocumentDetailsBean extends BaseDetailsBean
return getDocument().hasAspect(ApplicationModel.ASPECT_INLINEEDITABLE);
}
/**
* @return true if the current document has the 'inlineeditable' aspect applied
*/
public boolean isMultilingual()
{
return getDocument().hasAspect(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT);
}
/**
* Returns a list of objects representing the versions of the
* current document
@@ -220,6 +233,69 @@ public class DocumentDetailsBean extends BaseDetailsBean
return versions;
}
/**
* Returns a list of objects representing the editions of the
* logical document
*
* @return List of editions
*/
public List getEditionHistory()
{
List<MapNode> editions = new ArrayList<MapNode>();
if (getDocument().getType().equals(ContentModel.TYPE_MULTILINGUAL_CONTAINER))
{
}
return editions;
}
/**
* Returns a list of objects representing the translations of the
* current document
*
* @return List of translations
*/
public List getTranslations()
{
List<MapNode> translations = new ArrayList<MapNode>();
if (getDocument().hasAspect(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT))
{
Map<Locale, NodeRef> translationsMap = this.multilingualContentService.getTranslations(getDocument().getNodeRef());
if (translationsMap != null && translationsMap.size() > 0)
{
for (Map.Entry entry : translationsMap.entrySet())
{
NodeRef nodeRef = (NodeRef) entry.getValue();
// create a map node representation of the translation
MapNode mapNode = new MapNode(nodeRef);
Locale locale = (Locale) nodeService.getProperty(nodeRef, ContentModel.PROP_LOCALE);
String lgge = (locale != null) ?
// convert the locale into new ISO codes
contentFilterLanguagesService.convertToNewISOCode(locale.getLanguage()).toUpperCase()
: null ;
mapNode.put("name", nodeService.getProperty(nodeRef, ContentModel.PROP_NAME));
mapNode.put("language", lgge);
mapNode.put("url", DownloadContentServlet.generateBrowserURL(nodeRef, mapNode.getName()));
// add the client side version to the list
translations.add(mapNode);
}
}
}
return translations;
}
/**
* Determines whether the current document has any categories applied
*
@@ -699,6 +775,19 @@ public class DocumentDetailsBean extends BaseDetailsBean
return this.getNode();
}
/**
* Returns the ml container of the document this bean is currently representing
*
* @return The document multilingual container NodeRef
*/
public Node getDocumentMlContainer()
{
NodeRef nodeRef = getNode().getNodeRef();
return new Node(multilingualContentService.getTranslationContainer(nodeRef));
}
/**
* Sets the lock service instance the bean should use
*
@@ -728,4 +817,21 @@ public class DocumentDetailsBean extends BaseDetailsBean
{
this.cociService = cociService;
}
/**
* @param multilingualContentService the multilingualContentService to set
*/
public void setMultilingualContentService(
MultilingualContentService multilingualContentService)
{
this.multilingualContentService = multilingualContentService;
}
/**
* @param contentFilterLanguagesService The ContentFilterLanguagesService to set.
*/
public void setContentFilterLanguagesService(ContentFilterLanguagesService contentFilterLanguagesService)
{
this.contentFilterLanguagesService = contentFilterLanguagesService;
}
}

View File

@@ -35,6 +35,10 @@ import javax.faces.model.SelectItem;
import org.alfresco.config.Config;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.i18n.I18NUtil;
import org.alfresco.service.cmr.ml.ContentFilterLanguagesService;
import org.alfresco.service.cmr.ml.MultilingualContentService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.context.UIContextService;
import org.alfresco.web.app.servlet.FacesHelper;
@@ -51,7 +55,12 @@ public class UserPreferencesBean
private static final String PREF_STARTLOCATION = "start-location";
private static final String PREF_CONTENTFILTERLANGUAGE = "content-filter-language";
private static final String MSG_CONTENTALLLANGUAGES = "content_all_languages";
/**
* Remplacement message for set the filter at 'all languages'.
* Must be considered as a null value.
*/
public static final String MSG_CONTENTALLLANGUAGES = "content_all_languages";
/** language locale selection */
private String language = null;
@@ -59,6 +68,14 @@ public class UserPreferencesBean
/** content language locale selection */
private String contentFilterLanguage = null;
/** the injected MultilingualContentService */
MultilingualContentService multilingualContentService;
/** the injected ContentFilterLanguagesService */
ContentFilterLanguagesService contentFilterLanguagesService;
/** the injected NodeService */
NodeService nodeService;
/**
* @return the list of available languages
@@ -66,7 +83,7 @@ public class UserPreferencesBean
public SelectItem[] getLanguages()
{
// Get the item selection list
SelectItem[] items = getLanguageItems(false);
SelectItem[] items = getLanguageItems();
// Change the current language
if (this.language == null)
{
@@ -120,56 +137,134 @@ public class UserPreferencesBean
// Null means All Languages
if (locale == null)
{
this.contentFilterLanguage = MSG_CONTENTALLLANGUAGES;
this.contentFilterLanguage = null;
}
else
{
this.contentFilterLanguage = locale.toString();
}
}
return (contentFilterLanguage.equals(MSG_CONTENTALLLANGUAGES)) ? null : contentFilterLanguage;
// set the content filter locale on the core
I18NUtil.setContentLocale(I18NUtil.parseLocale(this.contentFilterLanguage));
return this.contentFilterLanguage;
//return (contentFilterLanguage.equals(MSG_CONTENTALLLANGUAGES)) ? "en" : contentFilterLanguage;
}
/**
* @param languageStr A valid locale string or {@link #MSG_CONTENTALLLANGUAGES}
*/
public void setContentFilterLanguage(String languageStr)
public void setContentFilterLanguage(String contentFilterLanguage)
{
this.contentFilterLanguage = languageStr;
this.contentFilterLanguage = contentFilterLanguage;
Locale language = null;
if (languageStr.equals(MSG_CONTENTALLLANGUAGES))
if (contentFilterLanguage.equals(MSG_CONTENTALLLANGUAGES))
{
// The generic "All Languages" was selected - persist this as a null
this.contentFilterLanguage = null;
}
else
{
// It should be a proper locale string
language = I18NUtil.parseLocale(languageStr);
language = I18NUtil.parseLocale(contentFilterLanguage);
}
PreferencesService.getPreferences().setValue(PREF_CONTENTFILTERLANGUAGE, language);
// set the content filter locale on the core
I18NUtil.setContentLocale(language);
// Ensure a refresh
UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans();
}
/**
* @return list of items for the content filtering language selection
* @return list of items for the content filtering language selection include the label 'all langaguages'
*/
public SelectItem[] getContentFilterLanguages()
{
// Get the item selection list
SelectItem[] items = getLanguageItems(true);
return getContentFilterLanguages(true);
}
/**
* @param includeAllLanguages if true, the list must include the label 'all languages'
* @return list of items for the content filtering language selection
*/
public SelectItem[] getContentFilterLanguages(boolean includeAllLanguages)
{
FacesContext fc = FacesContext.getCurrentInstance();
ResourceBundle msg = Application.getBundle(fc);
// get the list of filter languages
List<String> languages = contentFilterLanguagesService.getFilterLanguages();
// set the item selection list
SelectItem[] items = new SelectItem[(includeAllLanguages) ? languages.size() + 1 : languages.size()];
int idx = 0;
// include the <All Languages> item if needed
if (includeAllLanguages)
{
String allLanguagesStr = msg.getString(MSG_CONTENTALLLANGUAGES);
items[idx] = new SelectItem(MSG_CONTENTALLLANGUAGES, allLanguagesStr);
idx++;
}
for(String lang : languages)
{
String label = contentFilterLanguagesService.getLabelByCode(lang);
items[idx] = new SelectItem(
lang,
label);
idx++;
}
return items;
}
/**
* return the list of languages in which the given node hasn't be translated yet.
*
* @param translation the translatable node ref
* @param returnTranslationLanguage if true, return the language of the given translation.
* @return the list of languages
*/
public SelectItem[] getAvailablesContentFilterLanguages(NodeRef translation, boolean returnTranslationLanguage)
{
// get the list of missing translation of this node
List<Locale> missingLocales = multilingualContentService.getMissingTranslations(translation, returnTranslationLanguage);
// set the item selection list
SelectItem[] items = new SelectItem[missingLocales.size()];
int idx = 0;
for(Locale locale : missingLocales)
{
String label = contentFilterLanguagesService.getLabelByCode(locale.getLanguage());
items[idx] = new SelectItem(
locale.toString(),
label);
idx++;
}
return items;
}
/**
* Helper to return the available language items
*
* @param includeAllLanguages True to include a marker item for "All Languages"
* @return Array of SelectItem objects
*/
private static SelectItem[] getLanguageItems(boolean includeAllLanguages)
private static SelectItem[] getLanguageItems()
{
FacesContext fc = FacesContext.getCurrentInstance();
Config config = Application.getConfigService(fc).getConfig("Languages");
@@ -178,11 +273,7 @@ public class UserPreferencesBean
List<String> languages = langConfig.getLanguages();
List<SelectItem> items = new ArrayList<SelectItem>(10);
if (includeAllLanguages)
{
String allLanguagesStr = Application.getMessage(fc, MSG_CONTENTALLLANGUAGES);
items.add(new SelectItem(MSG_CONTENTALLLANGUAGES, allLanguagesStr));
}
for (String locale : languages)
{
// get label associated to the locale
@@ -258,4 +349,46 @@ public class UserPreferencesBean
{
return Application.getClientConfig(FacesContext.getCurrentInstance()).getAllowGuestConfig();
}
/**
* @return the multilingualContentService
*/
public MultilingualContentService getMultilingualContentService()
{
return multilingualContentService;
}
/**
* @param multilingualContentService the multilingualContentService to set
*/
public void setMultilingualContentService(
MultilingualContentService multilingualContentService)
{
this.multilingualContentService = multilingualContentService;
}
/**
* @return the nodeService
*/
public NodeService getNodeService()
{
return nodeService;
}
/**
* @param nodeService the nodeService to set
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
/**
* @param contentFilterLanguagesService the contentFilterLanguagesService to set
*/
public void setContentFilterLanguagesService(
ContentFilterLanguagesService contentFilterLanguagesService)
{
this.contentFilterLanguagesService = contentFilterLanguagesService;
}
}

View File

@@ -0,0 +1,111 @@
/*
* 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.generator;
import javax.faces.component.UIComponent;
import javax.faces.component.UISelectItems;
import javax.faces.component.UISelectOne;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.UserPreferencesBean;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.ui.repo.component.property.PropertySheetItem;
import org.alfresco.web.ui.repo.component.property.UIPropertySheet;
import org.alfresco.web.ui.repo.converter.LanguageConverter;
/**
* Generates a LANGUAGE selector component.
*
* @author yanipig
*/
public class LanguageSelectorGenerator extends BaseComponentGenerator
{
protected Node node;
protected UserPreferencesBean userPreferencesBean;
@SuppressWarnings("unchecked")
public UIComponent generate(FacesContext context, String id)
{
UIComponent component = context.getApplication().
createComponent(UISelectOne.COMPONENT_TYPE);
FacesHelper.setupComponentId(context, component, id);
// create the list of choices
UISelectItems itemsComponent = (UISelectItems)context.getApplication().
createComponent("javax.faces.SelectItems");
itemsComponent.setValue(getLanguageItems());
// add the items as a child component
component.getChildren().add(itemsComponent);
return component;
}
protected SelectItem[] getLanguageItems()
{
SelectItem[] items = userPreferencesBean.getAvailablesContentFilterLanguages(node.getNodeRef(), true);
return items;
}
@Override
protected UIComponent createComponent(FacesContext context, UIPropertySheet propertySheet, PropertySheetItem item) {
this.node = propertySheet.getNode();
return super.createComponent(context, propertySheet, item);
}
@Override
protected void setupConverter(FacesContext context,
UIPropertySheet propertySheet, PropertySheetItem property,
PropertyDefinition propertyDef, UIComponent component)
{
createAndSetConverter(context, LanguageConverter.CONVERTER_ID, component);
}
@Override
protected void setupMandatoryValidation(FacesContext context,
UIPropertySheet propertySheet, PropertySheetItem item,
UIComponent component, boolean realTimeChecking, String idSuffix)
{
// null is may be a right value for a language
}
/**
* Set the injected userPreferencesBean
*
* @param userPreferencesBean
*/
public void setUserPreferencesBean(UserPreferencesBean userPreferencesBean)
{
this.userPreferencesBean = userPreferencesBean;
}
}

View File

@@ -0,0 +1,112 @@
/*
* 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.generator;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.faces.model.SelectItem;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.ml.ContentFilterLanguagesService;
import org.alfresco.service.cmr.ml.MultilingualContentService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
/**
* Generates a LANGUAGE selector component for display a list of language
* for a ML container.
*
* The list of languages must contains the languages of each of this <b>non-empty</b>
* translations.
*
* @author yanipig
*/
public class MlContainerLanguageSelectorGenerator extends LanguageSelectorGenerator
{
protected MultilingualContentService multilingualContentService;
protected ContentFilterLanguagesService contentFilterLanguagesService;
protected NodeService nodeService;
protected SelectItem[] getLanguageItems()
{
Map<Locale, NodeRef> translations = multilingualContentService.getTranslations(node.getNodeRef());
List<SelectItem> items = new ArrayList<SelectItem>();
for(Map.Entry<Locale, NodeRef> entry : translations.entrySet())
{
if(!nodeService.hasAspect(entry.getValue(), ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))
{
Locale loc = entry.getKey();
items.add(new SelectItem(
loc.getLanguage(),
contentFilterLanguagesService.getLabelByCode(loc.toString())));
}
}
SelectItem[] itemsArray = new SelectItem[items.size()];
items.toArray(itemsArray);
return itemsArray;
}
/**
* Set the injected contentFilterLanguagesService
*
* @param contentFilterLanguagesService
*/
public void setContentFilterLanguagesService(
ContentFilterLanguagesService contentFilterLanguagesService)
{
this.contentFilterLanguagesService = contentFilterLanguagesService;
}
/**
* Set the injected multilingualContentService
*
* @param multilingualContentService
*/
public void setMultilingualContentService(
MultilingualContentService multilingualContentService)
{
this.multilingualContentService = multilingualContentService;
}
/**
* Set the injected nodeService
*
* @param nodeService the nodeService to set
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
}

View File

@@ -0,0 +1,225 @@
/*
* 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.ml;
import java.util.Locale;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.i18n.I18NUtil;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.ml.MultilingualContentService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.web.app.servlet.DownloadContentServlet;
import org.alfresco.web.bean.UserPreferencesBean;
import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.ui.common.Utils;
/**
* Dialog bean to add a new translation without content. I means, a new node is created
* but it doesn't content the propertie <code>{http://www.alfresco.org/model/content/1.0}content</code>
*
* @author yanipig
*/
public class AddTranslationWithoutContentDialog extends BaseDialogBean
{
public static String LOCALE_REGEX = "%locale%";
public static String EMPTY_DOCUMENT_EXTENSION = "." + LOCALE_REGEX + "_properties";
private MultilingualContentService multilingualContentService;
private UserPreferencesBean userPreferencesBean;
// the translation being to be created
protected NodeRef newTranslation;
private String name;
private String title;
private String description;
private String author;
private String language;
@Override
public void init(Map<String, String> parameters)
{
super.init(parameters);
name = null;
title = null;
description = null;
author = null;
language = null;
}
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
// get the reference node
NodeRef refNode = this.browseBean.getDocument().getNodeRef();
// get the required properties to create the new node and to make it multilingual
Locale locale = I18NUtil.parseLocale(language);
// rename the translation like [name].[lang]_properties
String extension = EMPTY_DOCUMENT_EXTENSION.replaceAll(LOCALE_REGEX, language);
this.name += extension;
// add the empty translation
newTranslation = multilingualContentService.addEmptyTranslation(refNode, name, locale);
// set the properties
nodeService.setProperty(newTranslation, ContentModel.PROP_DESCRIPTION, description);
nodeService.setProperty(newTranslation, ContentModel.PROP_AUTHOR, author);
nodeService.setProperty(newTranslation, ContentModel.PROP_TITLE, title);
// set the current browse node
Node browse = new Node(newTranslation);
// get the content data of the pivot translation
NodeRef pivot = multilingualContentService.getPivotTranslation(refNode);
Map<String, Object> browseProp = browse.getProperties();
browseProp.put("size", 0);
browseProp.put("mimetype", extension);
browseProp.put("fileType32", Utils.getFileTypeImage(name, false));
browseProp.put("url", DownloadContentServlet.generateDownloadURL(pivot, name));
this.browseBean.setDocument(browse);
return outcome;
}
/**
* @param userPreferencesBean the userPreferencesBean to set
*/
public void setUserPreferencesBean(UserPreferencesBean userPreferencesBean)
{
this.userPreferencesBean = userPreferencesBean;
}
/**
* @param multilingualContentService the multilingualContentService to set
*/
public void setMultilingualContentService(
MultilingualContentService multilingualContentService)
{
this.multilingualContentService = multilingualContentService;
}
/**
* @return the author
*/
public String getAuthor()
{
return author;
}
/**
* @param author the author to set
*/
public void setAuthor(String author)
{
this.author = author;
}
/**
* @return the description
*/
public String getDescription()
{
return description;
}
/**
* @param description the description to set
*/
public void setDescription(String description)
{
this.description = description;
}
/**
* @return the language
*/
public String getLanguage()
{
return language;
}
/**
* @param language the language to set
*/
public void setLanguage(String language)
{
this.language = language;
}
/**
* @return the name
*/
public String getName()
{
return name;
}
/**
* @param name the name to set
*/
public void setName(String name)
{
this.name = name;
}
/**
* @return the title
*/
public String getTitle()
{
return title;
}
/**
* @param title the title to set
*/
public void setTitle(String title)
{
this.title = title;
}
/**
* @return the unusedLanguages
*/
public SelectItem[] getUnusedLanguages()
{
return userPreferencesBean.getAvailablesContentFilterLanguages(this.browseBean.getDocument().getNodeRef(), false);
}
}

View File

@@ -0,0 +1,211 @@
/*
* 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.ml;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.i18n.I18NUtil;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.ml.MultilingualContentService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.UserPreferencesBean;
import org.alfresco.web.bean.content.AddContentDialog;
import org.alfresco.web.bean.repository.Node;
/**
* Dialog bean to upload a new document and to add it to an existing MLContainer.
*
* @author yanipig
*/
public class AddTranslationlDialog extends AddContentDialog
{
private MultilingualContentService multilingualContentService;
private UserPreferencesBean userPreferencesBean;
// the multilingual container where to add this translation
protected NodeRef mlContainer;
// Locale of the new translation
private String language;
// languages available in the ML container yet
private SelectItem[] unusedLanguages;
/* (non-Javadoc)
* @see org.alfresco.web.bean.content.AddContentDialog#init(java.util.Map)
*/
@Override
public void init(Map<String, String> parameters)
{
super.init(parameters);
this.language = null;
setMlContainer(this.browseBean.getDocument().getNodeRef());
setFileName(null);
unusedLanguages = null;
}
/* (non-Javadoc)
* @see org.alfresco.web.bean.content.AddContentDialog#finishImpl(javax.faces.context.FacesContext, java.lang.String)
*/
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
// add the new file to the repository
outcome = super.finishImpl(context, outcome);
// add a new translation
multilingualContentService.addTranslation(this.createdNode, this.mlContainer, I18NUtil.parseLocale(this.language));
this.browseBean.setDocument(new Node(this.createdNode));
return outcome;
}
@Override
protected String getDefaultFinishOutcome()
{
return "showDocDetails";
}
@Override
public String cancel()
{
super.cancel();
return getDefaultFinishOutcome();
}
public boolean finishButtonDisabled()
{
return author == null || author.length() < 1 || language == null;
}
/**
* @return the locale of this new translation
*/
public String getLanguage()
{
return language;
}
/**
* @param language the locale of this new translation
*/
public void setLanguage(String language)
{
this.language = language;
}
/**
* @return the Multilingual container where the translation will be associated
*/
public NodeRef getMlContainer()
{
return mlContainer;
}
/**
* Set the Multilingual container where the translation will be associated.
*
* @param mlContainer mlContainer is a MLDocument, the the MLContainer will
* become it's own MLContainer
*/
public void setMlContainer(NodeRef mlContainer)
{
QName type = null;
if(mlContainer != null)
{
type = nodeService.getType(mlContainer);
if(ContentModel.TYPE_MULTILINGUAL_CONTAINER.equals(type)){
this.mlContainer = mlContainer;
}
else if(ContentModel.TYPE_CONTENT.equals(type)
&& nodeService.hasAspect(mlContainer, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT)){
this.mlContainer = multilingualContentService.getTranslationContainer(mlContainer);
}
else{
this.mlContainer = null;
}
}
}
/**
* @param unusedLanguages
*/
public void setUnusedLanguages(SelectItem[] unusedLanguages)
{
this.unusedLanguages = unusedLanguages;
}
/**
* Method calls by the dialog to limit the list of languages.
*
* @return the list of availables translation in the MLContainer
*/
public SelectItem[] getUnusedLanguages()
{
if(unusedLanguages == null)
{
unusedLanguages = userPreferencesBean.getAvailablesContentFilterLanguages(getMlContainer(), false);
}
return unusedLanguages;
}
public MultilingualContentService getMultilingualContentService()
{
return multilingualContentService;
}
public void setMultilingualContentService(
MultilingualContentService multilingualContentService)
{
this.multilingualContentService = multilingualContentService;
}
public UserPreferencesBean getUserPreferencesBean()
{
return userPreferencesBean;
}
public void setUserPreferencesBean(UserPreferencesBean userPreferencesBean)
{
this.userPreferencesBean = userPreferencesBean;
}
}

View File

@@ -0,0 +1,140 @@
/*
* 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.ml;
import java.io.Serializable;
import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.service.cmr.ml.MultilingualContentService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.bean.repository.Node;
/**
* Dialog bean to edit an existing multilingual container.
*
* @author yanipig
*/
public class EditMLContainerDialog extends BaseDialogBean
{
MultilingualContentService multilingualContentService;
private Node editableNode;
@Override
public void init(Map<String, String> parameters)
{
super.init(parameters);
this.editableNode = initEditableNode();
}
@Override
public boolean getFinishButtonDisabled()
{
return false;
}
@Override
public String getFinishButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), "ok");
}
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
// get the container node ref
NodeRef container = editableNode.getNodeRef();
// get the modified properties
Map<String, Object> editProperties = this.editableNode.getProperties();
// modify the properties of the container with the user modified properties
for(Map.Entry<String, Object> entry : editProperties.entrySet())
{
QName qname = QName.createQName(entry.getKey());
nodeService.setProperty(container, qname, (Serializable) entry.getValue());
}
return outcome;
}
/**
* Init the editable Node
*/
protected Node initEditableNode()
{
return new Node(
multilingualContentService.getTranslationContainer(
this.browseBean.getDocument().getNodeRef())
);
}
/**
* @return the editableNode
*/
public Node getEditableNode() {
return editableNode;
}
@Override
protected String doPostCommitProcessing(FacesContext context, String outcome)
{
this.browseBean.getDocument().reset();
return outcome;
}
// ------------------------------------------------------------------------------
// Bean getters and setters
/**
* @return the multilingualContentService
*/
public MultilingualContentService getMultilingualContentService() {
return multilingualContentService;
}
/**
* @param multilingualContentService the multilingualContentService to set
*/
public void setMultilingualContentService(
MultilingualContentService multilingualContentService) {
this.multilingualContentService = multilingualContentService;
}
}

View File

@@ -0,0 +1,288 @@
/*
* 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.ml;
import java.util.Locale;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.i18n.I18NUtil;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.ml.MultilingualContentService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.UserPreferencesBean;
import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.bean.repository.Node;
/**
* Dialog bean to make a node multilingual
*
* @author yanipig
*/
public class MakeMultilingualDialog extends BaseDialogBean
{
private MultilingualContentService multilingualContentService;
private UserPreferencesBean userPreferencesBean;
/** if needed, add a new translation with content after this dialog closed */
public static final String OPT_ADD_WITH_CONTENT = "ADD_WITH_CONTENT";
/** if needed, add a new translation without content after this dialog closed */
public static final String OPT_ADD_WITHOUT_CONTENT = "ADD_WITHOUT_CONTENT";
// The author is a mandatory properties
private String author;
// The langage of the node to make multilingual
private String language;
// set to true, a new translation will be added at the end of this dialog
private boolean addTranslationAfter = true;
// set if the new translation to add will be an empty document or not
private String addingMode = OPT_ADD_WITH_CONTENT;
// the node to edit
protected Node editableNode;
@Override
public void init(Map<String, String> parameters)
{
super.init(parameters);
// setup the editable node
this.editableNode = initEditableNode();
NodeRef nodeRef = this.editableNode.getNodeRef();
// propose the author and the language of the content for the properties of the MLContainer
if(this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUTHOR) == true
&& this.nodeService.getProperty(nodeRef, ContentModel.PROP_AUTHOR) != null)
{
setAuthor((String) this.nodeService.getProperty(nodeRef, ContentModel.PROP_AUTHOR));
}
else
{
setAuthor("");
}
if(this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_LOCALIZED) == true
&& this.nodeService.getProperty(nodeRef, ContentModel.PROP_LOCALE) != null)
{
setLanguage(((Locale) this.nodeService.getProperty(nodeRef, ContentModel.PROP_LOCALE)).toString());
}
else
{
setLanguage(null);
}
addTranslationAfter = false;
addingMode = OPT_ADD_WITH_CONTENT;
}
/**
* Init the editable Node
*/
protected Node initEditableNode()
{
return new Node(this.browseBean.getDocument().getNodeRef());
}
/* (non-Javadoc)
* @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String)
*/
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
Locale loc = I18NUtil.parseLocale(getLanguage());
NodeRef nodeRef = this.editableNode.getNodeRef();
// make this node multilingual
NodeRef mlContainer = multilingualContentService.makeTranslation(nodeRef, loc);
// set the local of the current node.
nodeService.setProperty(nodeRef, ContentModel.PROP_LOCALE, getLanguage());
// if the author of the node is not set, set it with the default author name of
// the new ML Container
String nodeAuthor = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_AUTHOR);
if(nodeAuthor == null || nodeAuthor.length() < 1)
nodeService.setProperty(nodeRef, ContentModel.PROP_AUTHOR, getAuthor());
// set properties of the ml container
nodeService.setProperty(mlContainer, ContentModel.PROP_AUTHOR, getAuthor());
nodeService.setProperty(mlContainer, ContentModel.PROP_LOCALE, getLanguage());
return outcome;
}
/* (non-Javadoc)
* @see org.alfresco.web.bean.dialog.BaseDialogBean#doPostCommitProcessing(javax.faces.context.FacesContext, java.lang.String)
*/
@Override
protected String doPostCommitProcessing(FacesContext context, String outcome)
{
// reset the document held by the browse bean as it's just been updated
this.browseBean.getDocument().reset();
// go to the set add translation dialog if asked
// to otherwise just return
if (this.addTranslationAfter)
{
if(addingMode.equalsIgnoreCase(OPT_ADD_WITHOUT_CONTENT))
{
return "dialog:addTranslationWithoutContent";
}
else
{
AddTranslationlDialog dialog = (AddTranslationlDialog) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "AddTranslationDialog");
dialog.start(null);
return "addTranslation";
}
}
// close the dialog
return outcome;
}
@Override
public boolean getFinishButtonDisabled()
{
return !(author != null && author.length() > 0 && language != null);
}
// ------------------------------------------------------------------------------
// Bean getters and setters
/**
* Returns the node being edited
*
* @return The node being edited
*/
public Node getEditableNode()
{
return this.editableNode;
}
/**
* @return the author of the new created MLContainer
*/
public String getAuthor()
{
return author;
}
/**
* @param author the author of new created MLContainer
*/
public void setAuthor(String author)
{
this.author = author;
}
/**
* @return if a new translation must be added after this dialog closes
*/
public boolean isAddTranslationAfter()
{
return addTranslationAfter;
}
/**
* @param addTranslationAfter set to true, a new translation will be added after this dialog closes
*/
public void setAddTranslationAfter(boolean addTranslationAfter)
{
this.addTranslationAfter = addTranslationAfter;
}
/**
* @return the language of the translation
*/
public String getLanguage()
{
return language;
}
/**
* @param language the language of the translation
*/
public void setLanguage(String language)
{
this.language = language;
}
/**
* @param editableNode the node will become a multilingual
*/
public void setEditableNode(Node editableNode)
{
this.editableNode = editableNode;
}
/**
* @return if the new translation must be added at the end of this dialog,
* this mode defines if the translation will be an empty document or not
*/
public String getAddingMode() {
return addingMode;
}
/**
* @param addingMode if the new translation must be added at the end of this dialog,
* this mode defines if the translation will be an empty document or not
*/
public void setAddingMode(String addingMode) {
this.addingMode = addingMode;
}
/**
* @return the complete list of available languages for the multilinguism
*/
public SelectItem[] getFilterLanguages()
{
return userPreferencesBean.getContentFilterLanguages(false);
}
public void setMultilingualContentService(
MultilingualContentService multilingualContentService)
{
this.multilingualContentService = multilingualContentService;
}
public void setUserPreferencesBean(UserPreferencesBean userPreferencesBean)
{
this.userPreferencesBean = userPreferencesBean;
}
}

View File

@@ -0,0 +1,72 @@
/*
* 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 javax.faces.context.FacesContext;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application;
public class CreateMultilingualPropertiesDialog extends CreateMultilingualPropertiesWizard
{
// ------------------------------------------------------------------------------
// Wizard implementation
@Override
public String getFinishButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), "create_multilingual_space");
}
@Override
protected String getDefaultCancelOutcome()
{
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + AlfrescoNavigationHandler.OUTCOME_SEPARATOR + "browse";
// return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
@Override
protected String getDefaultFinishOutcome()
{
// return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + AlfrescoNavigationHandler.OUTCOME_SEPARATOR + "browse";
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
protected String doPostCommitProcessing(FacesContext context, String outcome)
{
// do nothing by default, subclasses can override if necessary
return outcome;
}
}

View File

@@ -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;
}

View File

@@ -0,0 +1,95 @@
/*
* 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 javax.faces.context.FacesContext;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.CreateMultilingualPropertiesBean;
public class CreateMultilingualSpaceDialog extends CreateMultilingualSpaceWizard
{
// ------------------------------------------------------------------------------
// Wizard implementation
@Override
public String getFinishButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), "create_multilingual_space");
}
@Override
protected String getDefaultCancelOutcome()
{
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
@Override
protected String getDefaultFinishOutcome()
{
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
protected String doPostCommitProcessing(FacesContext context, String outcome)
{
// do nothing by default, subclasses can override if necessary
if(isEdit())
{
return "dialog:createMultilingualProperties";
}
else
{
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
}
public void setCreateMultilingualPropertiesBean(CreateMultilingualPropertiesBean x)
{
this.createMultilingualPropertiesBean = x;
}
public boolean isEdit()
{
return this.edit;
}
public void setEdit(boolean x)
{
this.edit=x;
}
private boolean edit;
public CreateMultilingualPropertiesBean getCreateMultilingualPropertiesBean(){return this.createMultilingualPropertiesBean;}
protected CreateMultilingualPropertiesBean createMultilingualPropertiesBean;
}

View File

@@ -0,0 +1,224 @@
/*
* 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 java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.i18n.I18NUtil;
import org.alfresco.model.ApplicationModel;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.model.FileInfo;
import org.alfresco.service.cmr.repository.MLText;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.DynamicNamespacePrefixResolver;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.CreateMultilingualPropertiesBean;
import org.alfresco.web.bean.UserPreferencesBean;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
public class CreateMultilingualSpaceWizard extends CreateSpaceWizard
{
protected boolean showOtherProperties = true;
/**
* @return Determines whether the edit properties dialog should be
* shown when this one ends
*/
public boolean isShowOtherProperties()
{
return this.showOtherProperties;
}
/**
* @param showOthers Sets whether the edit properties dialog is shown
*/
public void setShowOtherProperties(boolean showOthers)
{
this.showOtherProperties = showOthers;
}
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
String newSpaceId = null;
CreateMultilingualPropertiesBean createMultilingualPropertiesBean = (CreateMultilingualPropertiesBean) FacesHelper.getManagedBean(context, "CreateMultilingualPropertiesBean");
if (this.createFrom.equals("scratch"))
{
// create the space (just create a folder for now)
NodeRef parentNodeRef;
String nodeId = this.navigator.getCurrentNodeId();
if (nodeId == null)
{
parentNodeRef = this.nodeService.getRootNode(Repository.getStoreRef());
}
else
{
parentNodeRef = new NodeRef(Repository.getStoreRef(), nodeId);
}
FileInfo fileInfo = fileFolderService.create(parentNodeRef, this.name, Repository.resolveToQName(this.spaceType));
NodeRef nodeRef = fileInfo.getNodeRef();
newSpaceId = nodeRef.getId();
// apply the uifacets aspect - icon, title and description props
Map<QName, Serializable> uiFacetsProps = new HashMap<QName, Serializable>(5);
uiFacetsProps.put(ApplicationModel.PROP_ICON, this.icon);
// uiFacetsProps.put(ContentModel.PROP_TITLE, this.title);
// uiFacetsProps.put(ContentModel.PROP_DESCRIPTION, this.description);
// Ajout de l icone
this.nodeService.addAspect(nodeRef, ApplicationModel.ASPECT_UIFACETS, uiFacetsProps);
Locale language = I18NUtil.parseLocale(createMultilingualPropertiesBean.getNewlanguage());
this.nodeService.setProperty(nodeRef, ContentModel.PROP_TITLE, new MLText(language, this.title));
this.nodeService.setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, new MLText(language, this.description));
// remember the created node
this.createdNode = nodeRef;
// Passer le noeud en parametre afin de le recuperer dans un autre dialogue
this.browseBean.setDocument(new Node(this.createdNode));
setTitle(""); setDescription(""); setName("");
}
else if (this.createFrom.equals("existing"))
{
// copy the selected space and update the name, description and icon
NodeRef sourceNode = this.existingSpaceId;
NodeRef parentSpace = new NodeRef(Repository.getStoreRef(), this.navigator.getCurrentNodeId());
// copy from existing
NodeRef copiedNode = this.fileFolderService.copy(sourceNode, parentSpace, this.name).getNodeRef();
Locale usrLocale = I18NUtil.parseLocale(getUserPreferencesBean().getContentFilterLanguage());
// also need to set the new title, description and icon properties
this.nodeService.setProperty(copiedNode, ContentModel.PROP_TITLE, new MLText(usrLocale, this.title));
this.nodeService.setProperty(copiedNode, ContentModel.PROP_DESCRIPTION, new MLText(usrLocale, this.description));
this.nodeService.setProperty(copiedNode, ApplicationModel.PROP_ICON, this.icon);
newSpaceId = copiedNode.getId();
// remember the created node
this.createdNode = copiedNode;
}
else if (this.createFrom.equals("template"))
{
// copy the selected space and update the name, description and icon
NodeRef sourceNode = new NodeRef(Repository.getStoreRef(), this.templateSpaceId);
NodeRef parentSpace = new NodeRef(Repository.getStoreRef(), this.navigator.getCurrentNodeId());
// copy from the template
NodeRef copiedNode = this.fileFolderService.copy(sourceNode, parentSpace, this.name).getNodeRef();
// also need to set the new title, description and icon properties
this.nodeService.setProperty(copiedNode, ContentModel.PROP_TITLE, this.title);
this.nodeService.setProperty(copiedNode, ContentModel.PROP_DESCRIPTION, this.description);
this.nodeService.setProperty(copiedNode, ApplicationModel.PROP_ICON, this.icon);
newSpaceId = copiedNode.getId();
// remember the created node
this.createdNode = copiedNode;
}
// if the user selected to save the space as a template space copy the new
// space to the templates folder
if (this.saveAsTemplate)
{
// get hold of the Templates node
DynamicNamespacePrefixResolver namespacePrefixResolver = new DynamicNamespacePrefixResolver(null);
namespacePrefixResolver.registerNamespace(NamespaceService.APP_MODEL_PREFIX, NamespaceService.APP_MODEL_1_0_URI);
String xpath = Application.getRootPath(FacesContext.getCurrentInstance()) + "/" +
Application.getGlossaryFolderName(FacesContext.getCurrentInstance()) + "/" +
Application.getSpaceTemplatesFolderName(FacesContext.getCurrentInstance());
NodeRef rootNodeRef = this.nodeService.getRootNode(Repository.getStoreRef());
List<NodeRef> templateNodeList = this.searchService.selectNodes(
rootNodeRef,
xpath, null, namespacePrefixResolver, false);
if (templateNodeList.size() == 1)
{
// get the first item in the list as we from test above there is only one!
NodeRef templateNode = templateNodeList.get(0);
NodeRef sourceNode = new NodeRef(Repository.getStoreRef(), newSpaceId);
// copy this to the template location
fileFolderService.copy(sourceNode, templateNode, this.templateName);
}
}
return outcome;
}
/**
* @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;
}

View File

@@ -249,6 +249,8 @@ public class CreateSpaceWizard extends BaseWizardBean
}
}
setTitle(""); setDescription("");
return outcome;
}
@@ -348,7 +350,7 @@ public class CreateSpaceWizard extends BaseWizardBean
*/
public void setName(String name)
{
this.name = name;
this.name = name.trim();
}
/**

View File

@@ -38,6 +38,7 @@ import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node;
@@ -178,7 +179,18 @@ public class EditSpaceDialog extends CreateSpaceDialog
}
}
return outcome;
// do nothing by default, subclasses can override if necessary
if(isEdit())
{
this.browseBean.setDocument(this.getEditableNode()); // (this.editableNode.getNodeRef());
return "dialog:createMultilingualProperties";
}
else
{
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
}
@Override
@@ -202,4 +214,18 @@ public class EditSpaceDialog extends CreateSpaceDialog
{
return this.editableNode;
}
public boolean isEdit()
{
return this.edit;
}
public void setEdit(boolean x)
{
this.edit=x;
}
private boolean edit;
}

View File

@@ -0,0 +1,144 @@
/*
* 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.ui.repo.component;
import java.io.IOException;
import javax.faces.component.UISelectItems;
import javax.faces.component.UISelectOne;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.UserPreferencesBean;
import org.alfresco.web.bean.users.SpaceUsersBean;
/**
* Component that holds a list of languages avalaiable to make a node multilingual.
*
*
* @author yanipig
*/
public class UILanguageSelector extends UISelectOne
{
public static final String COMPONENT_TYPE = "org.alfresco.faces.LanguageSelector";
public static final String COMPONENT_FAMILY = "javax.faces.SelectOne";
// If true, the langage list is filtered to return all the langages yet available in the
// MLContainer of the current node.
// An available langage is a language where any translation is set.
private boolean onlyAvailableLanguages = false;
// If true and if onlyAvailableLanguages, the list of available languages
// will be return with the language of the node.
// Used in the edit properties dialog.
private boolean returnCurrentLanguage = true;
@Override
@SuppressWarnings("unchecked")
public void encodeBegin(FacesContext context) throws IOException
{
// if the component does not have any children yet create the
// list of Languages the user can choose from as a child
// SelectItems component.
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);
}
/**
* Creates the list of SelectItem components to represent the list
* of Langages the user can select from
*
* @return List of SelectItem components
*/
protected SelectItem[] createList()
{
FacesContext fc = FacesContext.getCurrentInstance();
SpaceUsersBean spaceUserBean = (SpaceUsersBean) FacesHelper.getManagedBean(fc, "SpaceUsersBean");
UserPreferencesBean userPreferencesBean = (UserPreferencesBean) FacesHelper.getManagedBean(fc, "UserPreferencesBean");
// get the node ref
NodeRef nodeRef = spaceUserBean.getNode().getNodeRef();
if(this.onlyAvailableLanguages)
{
return userPreferencesBean.getAvailablesContentFilterLanguages(nodeRef, this.returnCurrentLanguage);
}
else
{
return userPreferencesBean.getContentFilterLanguages(false);
}
}
/**
* @return true if the list of languages is filtered
*/
public boolean isOnlyAvailableLanguages()
{
return onlyAvailableLanguages;
}
/**
* @param onlyAvailableLanguages the list of languages is filtered
*/
public void setOnlyAvailableLanguages(boolean onlyAvailableLanguages)
{
this.onlyAvailableLanguages = onlyAvailableLanguages;
}
/**
* @return true if the list must contain the language of the current node
*/
public boolean isReturnCurrentLanguage()
{
return returnCurrentLanguage;
}
/**
* Without effect if onlyAvailableLanguages is false
*
* @param returnCurrentLanguage the list must contain the language of the current node
*
*/
public void setReturnCurrentLanguage(boolean returnCurrentLanguage)
{
this.returnCurrentLanguage = returnCurrentLanguage;
}
}

View File

@@ -0,0 +1,86 @@
/*
* 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.ui.repo.converter;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import org.alfresco.i18n.I18NUtil;
import org.alfresco.service.cmr.ml.ContentFilterLanguagesService;
import org.alfresco.web.app.servlet.FacesHelper;
/**
* Converter class to convert a Locale into a language libelle
*
* @author yanipig
*/
public class LanguageConverter implements Converter
{
/**
* <p>The standard converter id for this converter.</p>
*/
public static final String CONVERTER_ID = "org.alfresco.faces.LanguageConverter";
/**
* @see javax.faces.convert.Converter#getAsObject(javax.faces.context.FacesContext, javax.faces.component.UIComponent, java.lang.String)
*/
public Object getAsObject(FacesContext context, UIComponent component, String value)
{
if(value == null)
{
throw new IllegalArgumentException(I18NUtil.getMessage("error_locale_null"));
}
else
{
return value;
}
}
/**
* @see javax.faces.convert.Converter#getAsString(javax.faces.context.FacesContext, javax.faces.component.UIComponent, java.lang.Object)
*/
public String getAsString(FacesContext context, UIComponent component, Object value)
{
if(value == null)
{
throw new IllegalArgumentException(I18NUtil.getMessage("error_locale_null"));
}
// if the component's rendrer type is javax.faces.Text, return
// the language label correponding to the received language code (as string) or the received locale
else if(component.getRendererType().equalsIgnoreCase("javax.faces.Text"))
{
ContentFilterLanguagesService contentFilterLanguagesService = (ContentFilterLanguagesService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "ContentFilterLanguagesService");
return contentFilterLanguagesService.getLabelByCode(value.toString());
}
// else don't modify
else
{
return value.toString();
}
}
}

View File

@@ -0,0 +1,154 @@
/*
* 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.ui.repo.tag;
import javax.faces.component.UIComponent;
import org.alfresco.web.ui.common.ComponentConstants;
import org.alfresco.web.ui.common.tag.HtmlComponentTag;
import org.alfresco.web.ui.repo.component.UILanguageSelector;
import org.alfresco.web.ui.repo.component.UIMimeTypeSelector;
/**
* Tag class for the Language selector component
*
* @author yanipig
*/
public class LanguageSelectorTag extends HtmlComponentTag
{
/** The value */
private String value;
/** Whether the component is disabled */
private String disabled;
/**
* If the value is 'true', only the missing translations of the node will be return
* Else returns all the languages
*/
private String onlyAvailable;
/**
* If the value is 'true', the language of the node will be returned.
*
* Without effect if <code>onlyAvailable</code> is 'false'
*/
private String returnCurLgge;
@Override
public String getComponentType()
{
return UILanguageSelector.COMPONENT_TYPE;
}
@Override
public String getRendererType()
{
return ComponentConstants.JAVAX_FACES_MENU;
}
@Override
protected void setProperties(UIComponent component)
{
super.setProperties(component);
setStringBindingProperty(component, "value", this.value);
setBooleanProperty(component, "disabled", this.disabled);
if(onlyAvailable != null && "true".equalsIgnoreCase(onlyAvailable))
{
UILanguageSelector lggSelector = (UILanguageSelector) getComponentInstance();
lggSelector.setOnlyAvailableLanguages(true);
if(returnCurLgge != null && "true".equalsIgnoreCase(returnCurLgge))
{
lggSelector.setReturnCurrentLanguage(true);
}
}
}
@Override
public void release()
{
super.release();
this.value = null;
this.disabled = null;
this.onlyAvailable = null;
}
/**
* Set the value
*
* @param value the value
*/
public void setValue(String value)
{
this.value = value;
}
/**
* Sets whether the component should be rendered in a disabled state
*
* @param disabled true to render the component in a disabled state
*/
public void setDisabled(String disabled)
{
this.disabled = disabled;
}
/**
* Sets whether the component should returns each language or only the available
* translations of the cuyrrent node.
*
* @param onlyAvailable
*/
public void setOnlyAvailable(String onlyAvailable)
{
this.onlyAvailable = onlyAvailable;
}
public String getOnlyAvailable()
{
return onlyAvailable;
}
public String getReturnCurLgge() {
return returnCurLgge;
}
/**
* Sets whether the component should returns the language of the node
*
* Without effect if <code>onlyAvailable</code> is false.
*
* @param returnCurLgge
*/
public void setReturnCurLgge(String returnCurLgge) {
this.returnCurLgge = returnCurLgge;
}
}

View File

@@ -4,6 +4,174 @@
<faces-config>
<!-- ==================== MANAGED BEANS ==================== -->
<managed-bean>
<description>
The bean that make a document multilingual
</description>
<managed-bean-name>MakeMultilingualDialog</managed-bean-name>
<managed-bean-class>org.alfresco.web.bean.ml.MakeMultilingualDialog</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>multilingualContentService</property-name>
<value>#{MultilingualContentService}</value>
</managed-property>
<managed-property>
<property-name>nodeService</property-name>
<value>#{NodeService}</value>
</managed-property>
<managed-property>
<property-name>fileFolderService</property-name>
<value>#{FileFolderService}</value>
</managed-property>
<managed-property>
<property-name>searchService</property-name>
<value>#{SearchService}</value>
</managed-property>
<managed-property>
<property-name>navigator</property-name>
<value>#{NavigationBean}</value>
</managed-property>
<managed-property>
<property-name>browseBean</property-name>
<value>#{BrowseBean}</value>
</managed-property>
<managed-property>
<property-name>dictionaryService</property-name>
<value>#{DictionaryService}</value>
</managed-property>
<managed-property>
<property-name>namespaceService</property-name>
<value>#{NamespaceService}</value>
</managed-property>
<managed-property>
<property-name>userPreferencesBean</property-name>
<value>#{UserPreferencesBean}</value>
</managed-property>
</managed-bean>
<managed-bean>
<description>
The bean that edit the multilinguals properties of a document
</description>
<managed-bean-name>EditMLContainerDialog</managed-bean-name>
<managed-bean-class>org.alfresco.web.bean.ml.EditMLContainerDialog</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>multilingualContentService</property-name>
<value>#{MultilingualContentService}</value>
</managed-property>
<managed-property>
<property-name>nodeService</property-name>
<value>#{NodeService}</value>
</managed-property>
<managed-property>
<property-name>fileFolderService</property-name>
<value>#{FileFolderService}</value>
</managed-property>
<managed-property>
<property-name>searchService</property-name>
<value>#{SearchService}</value>
</managed-property>
<managed-property>
<property-name>navigator</property-name>
<value>#{NavigationBean}</value>
</managed-property>
<managed-property>
<property-name>browseBean</property-name>
<value>#{BrowseBean}</value>
</managed-property>
<managed-property>
<property-name>dictionaryService</property-name>
<value>#{DictionaryService}</value>
</managed-property>
<managed-property>
<property-name>namespaceService</property-name>
<value>#{NamespaceService}</value>
</managed-property>
</managed-bean>
<managed-bean>
<description>
The bean that add a new translation without content
</description>
<managed-bean-name>AddTranslationWithoutContentDialog</managed-bean-name>
<managed-bean-class>org.alfresco.web.bean.ml.AddTranslationWithoutContentDialog</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>nodeService</property-name>
<value>#{NodeService}</value>
</managed-property>
<managed-property>
<property-name>fileFolderService</property-name>
<value>#{FileFolderService}</value>
</managed-property>
<managed-property>
<property-name>dictionaryService</property-name>
<value>#{DictionaryService}</value>
</managed-property>
<managed-property>
<property-name>browseBean</property-name>
<value>#{BrowseBean}</value>
</managed-property>
<managed-property>
<property-name>multilingualContentService</property-name>
<value>#{MultilingualContentService}</value>
</managed-property>
<managed-property>
<property-name>userPreferencesBean</property-name>
<value>#{UserPreferencesBean}</value>
</managed-property>
</managed-bean>
<managed-bean>
<description>
The bean that add a translation with a content
</description>
<managed-bean-name>AddTranslationDialog</managed-bean-name>
<managed-bean-class>org.alfresco.web.bean.ml.AddTranslationlDialog</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>multilingualContentService</property-name>
<value>#{MultilingualContentService}</value>
</managed-property>
<managed-property>
<property-name>userPreferencesBean</property-name>
<value>#{UserPreferencesBean}</value>
</managed-property>
<managed-property>
<property-name>nodeService</property-name>
<value>#{NodeService}</value>
</managed-property>
<managed-property>
<property-name>fileFolderService</property-name>
<value>#{FileFolderService}</value>
</managed-property>
<managed-property>
<property-name>searchService</property-name>
<value>#{SearchService}</value>
</managed-property>
<managed-property>
<property-name>navigator</property-name>
<value>#{NavigationBean}</value>
</managed-property>
<managed-property>
<property-name>browseBean</property-name>
<value>#{BrowseBean}</value>
</managed-property>
<managed-property>
<property-name>contentService</property-name>
<value>#{ContentService}</value>
</managed-property>
<managed-property>
<property-name>dictionaryService</property-name>
<value>#{DictionaryService}</value>
</managed-property>
<managed-property>
<property-name>namespaceService</property-name>
<value>#{NamespaceService}</value>
</managed-property>
</managed-bean>
<managed-bean>
<description>
The bean that backs up the Login screen

View File

@@ -49,6 +49,10 @@
<from-outcome>showDocDetails</from-outcome>
<to-view-id>/jsp/dialog/document-details.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>showMLContainerDetails</from-outcome>
<to-view-id>/jsp/ml/ml-container-details.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>showSpaceDetails</from-outcome>
<to-view-id>/jsp/dialog/space-details.jsp</to-view-id>
@@ -61,6 +65,11 @@
<from-outcome>addContent</from-outcome>
<to-view-id>/jsp/content/add-content-dialog.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>addTranslation</from-outcome>
<to-view-id>/jsp/ml/add-translation-dialog.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<!-- rule to get to the Advanced Search page from anywhere -->
@@ -231,6 +240,14 @@
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/jsp/ml/*</from-view-id>
<navigation-case>
<from-outcome>addTranslation</from-outcome>
<to-view-id>/jsp/ml/add-translation-dialog.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/jsp/dialog/edit-text-inline.jsp</from-view-id>
<navigation-case>

View File

@@ -74,6 +74,11 @@
<component-class>org.alfresco.web.ui.repo.component.UIMimeTypeSelector</component-class>
</component>
<component>
<component-type>org.alfresco.faces.LanguageSelector</component-type>
<component-class>org.alfresco.web.ui.repo.component.UILanguageSelector</component-class>
</component>
<component>
<component-type>org.alfresco.faces.SimpleSearch</component-type>
<component-class>org.alfresco.web.ui.repo.component.UISimpleSearch</component-class>
@@ -200,6 +205,11 @@
<converter-class>org.alfresco.web.ui.repo.converter.MimeTypeConverter</converter-class>
</converter>
<converter>
<converter-id>org.alfresco.faces.LanguageConverter</converter-id>
<converter-class>org.alfresco.web.ui.repo.converter.LanguageConverter</converter-class>
</converter>
<converter>
<converter-id>org.alfresco.faces.DisplayPathConverter</converter-id>
<converter-class>org.alfresco.web.ui.repo.converter.DisplayPathConverter</converter-class>

View File

@@ -985,6 +985,55 @@
</attribute>
</tag>
<tag>
<name>mlLanguageSelector</name>
<tag-class>org.alfresco.web.ui.repo.tag.LanguageSelectorTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>id</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>binding</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>rendered</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>value</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>disabled</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>onlyAvailable</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>returnCurLgge</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>shelf</name>
<tag-class>org.alfresco.web.ui.repo.tag.shelf.ShelfTag</tag-class>

View File

@@ -498,6 +498,18 @@ a.topToolbarLinkHighlight, a.topToolbarLinkHighlight:link, a.topToolbarLinkHighl
padding-left: 4px;
}
.langCode
{
color:#FFFFFF;
padding-left:2px;
padding-right:2px;
letter-spacing:1px;
border:1px solid #000000;
background-color:#0000FF;
font-weight:bolder;
text-transform:uppercase;
}
.userGroupPickerList
{
padding: 2px;

View File

@@ -422,6 +422,8 @@
</f:facet>
<a:actionLink id="col10-act2" value="#{r.name}" href="#{r.url}" target="new" />
<r:lockIcon id="col10-lock" value="#{r.nodeRef}" align="absmiddle" />
<h:outputLabel value=" " rendered="#{r.lang != null}"/>
<h:outputLabel value="#{r.lang}" styleClass="langCode" rendered="#{r.lang != null}"/>
<r:nodeInfo id="col10-info" value="#{r.id}">
<h:graphicImage id="col10-img" url="/images/icons/popup.gif" styleClass="popupImage" width="16" height="16" />
</r:nodeInfo>
@@ -434,6 +436,8 @@
</f:facet>
<a:actionLink id="col11-act2" value="#{r.name}" href="#{r.url}" target="new" styleClass="header" />
<r:lockIcon id="col11-lock" value="#{r.nodeRef}" align="absmiddle" />
<h:outputLabel value=" " rendered="#{r.lang != null}"/>
<h:outputLabel value="#{r.lang}" styleClass="langCode" rendered="#{r.lang != null}"/>
<r:nodeInfo id="col11-info" value="#{r.id}">
<h:graphicImage id="col11-img" url="/images/icons/popup.gif" styleClass="popupImage" width="16" height="16" />
</r:nodeInfo>
@@ -446,6 +450,8 @@
</f:facet>
<a:actionLink id="col12-act2" value="#{r.name}" href="#{r.url}" target="new" styleClass="title" />
<r:lockIcon id="col12-lock" value="#{r.nodeRef}" align="absmiddle" />
<h:outputLabel value=" " rendered="#{r.lang != null}"/>
<h:outputLabel value="#{r.lang}" styleClass="langCode" rendered="#{r.lang != null}"/>
<r:nodeInfo id="col12-info" value="#{r.id}">
<h:graphicImage id="col12-img" url="/images/icons/popup.gif" styleClass="popupImage" width="16" height="16" />
</r:nodeInfo>

View File

@@ -284,6 +284,108 @@
<div style="padding:4px"></div>
<%-- Multlingual properties --%>
<h:panelGroup id="ml-props-panel-facets">
<f:facet name="title">
<r:permissionEvaluator value="#{DocumentDetailsBean.document}" allow="Write">
<a:actionLink id="titleLinkMl" value="#{msg.modify}" showLink="false" image="/images/icons/edit_properties.gif"
action="dialog:editMlContainer" />
</r:permissionEvaluator>
</f:facet>
</h:panelGroup>
<%-- Panel if the node has the multinlingual aspect--%>
<a:panel label="#{msg.ml_content_info}" facetsId="ml-props-panel-facets" id="ml-info-panel" progressive="true"
border="white" bgcolor="white" titleBorder="lbgrey" expandedTitleBorder="dotted" titleBgcolor="white" rendered="#{DocumentDetailsBean.multilingual}"
expanded='#{DocumentDetailsBean.panels["ml-info-panel"]}' expandedActionListener="#{DocumentDetailsBean.expandPanel}">
<%-- properties for Ml container --%>
<div style="padding:4px"></div>
<h:outputText value="#{msg.properties}" styleClass="nodeWorkflowInfoTitle" style="padding:20px;"/>
<div style="padding:4px"></div>
<r:propertySheetGrid id="ml-container-props-sheet" value="#{DocumentDetailsBean.documentMlContainer}"
var="mlContainerProps" columns="1" labelStyleClass="propertiesLabel"
externalConfig="true" cellpadding="2" cellspacing="2" mode="view"/>
<div style="padding:8px"></div>
<a:panel label="#{msg.related_translations}" id="related-translation-panel" progressive="true"
expanded='#{DocumentDetailsBean.panels["related-translation-panel"]}' expandedActionListener="#{DocumentDetailsBean.expandPanel}" styleClass="nodeWorkflowInfoTitle">
<div style="padding:4px"></div>
<%-- list of translations --%>
<a:richList id="TranslationList" viewMode="details" value="#{DocumentDetailsBean.translations}"
var="r" styleClass="recordSet" headerStyleClass="recordSetHeader"
rowStyleClass="recordSetRow" altRowStyleClass="recordSetRowAlt" width="100%"
pageSize="10" initialSortColumn="Name" initialSortDescending="false">
<%-- Icon details view mode --%>
<a:column id="col20" primary="true" width="20" style="padding:2px;">
<f:facet name="header">
<h:outputText value=""/>
</f:facet>
<h:graphicImage url="/images/icons/space_small.gif" />
</a:column>
<%-- Name columns --%>
<a:column id="col21" width="300" style="text-align:left">
<f:facet name="header">
<a:sortLink label="#{msg.name}" value="Name" mode="case-insensitive" styleClass="header"/>
</f:facet>
<a:actionLink id="view-name" value="#{r.name}" href="#{r.url}" target="new" />
</a:column>
<%-- Language columns --%>
<a:column id="col22" width="50" style="text-align:left">
<f:facet name="header">
<a:sortLink label="#{msg.language}" value="language" mode="case-insensitive" styleClass="header"/>
</f:facet>
<a:actionLink id="view-language" value="#{r.language}" href="#{r.url}" target="new" />
</a:column>
<%-- view actions --%>
<a:column id="col25" style="text-align: left">
<f:facet name="header">
<h:outputText value="#{msg.actions}"/>
</f:facet>
<a:actionLink id="view-link" value="#{msg.view}" href="#{r.url}" target="new" />
</a:column>
<a:dataPager styleClass="pager" />
</a:richList>
</a:panel>
<%-- Actions add translation --%>
<table width="100%" cellspacing="2" cellpadding="15" border="0" align="center">
<tr>
<td>
<a:actionLink id="act-add-trans-with-c" value="#{msg.add_translation}" action="addTranslation" actionListener="#{AddTranslationDialog.start}" showLink="true" image="/images/icons/add_tranlsation.gif" />
</td>
<td>
<a:actionLink id="act-add-trans-without-c" value="#{msg.add_translation_wc}" action="dialog:addTranslationWithoutContent" showLink="true" image="/images/icons/add_tranlsation_wc.gif" />
</td>
</tr>
</table>
</a:panel>
<%-- Panel if the node has not the multinlingual aspect--%>
<a:panel label="#{msg.ml_content_info}" id="no-ml-info-panel" progressive="true"
border="white" bgcolor="white" titleBorder="lbgrey" expandedTitleBorder="dotted" titleBgcolor="white"
rendered="#{DetailsBean.multilingual == false}"
expanded='#{DocumentDetailsBean.panels["ml-info-panel"]}' expandedActionListener="#{DocumentDetailsBean.expandPanel}">
<h:outputText id="no-ml-msg" value="#{msg.not_multilingual}<br/><br/>" escape="false" />
<%-- Actions add translation --%>
<table width="100%" cellspacing="2" cellpadding="15" border="0" align="center">
<tr>
<td>
<a:actionLink id="act-make-multilingual" value="#{msg.make_multilingual}" action="dialog:makeMultilingual" showLink="true" image="/images/icons/make_ml.gif" />
</td>
</tr>
</table>
</a:panel>
<div style="padding:4px"></div>
<h:panelGroup id="workflow-panel-facets">
<f:facet name="title">
<r:permissionEvaluator value="#{DocumentDetailsBean.document}" allow="Write">

View File

@@ -0,0 +1,380 @@
<%--
* 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"
--%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %>
<%@ page isELIgnored="false" %>
<%@ page import="javax.faces.context.FacesContext" %>
<%@ page import="org.alfresco.web.app.Application" %>
<%@ page import="org.alfresco.web.app.servlet.FacesHelper" %>
<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %>
<%@ page import="org.alfresco.web.bean.ml.AddTranslationlDialog" %>
<%
boolean fileUploaded = false;
AddTranslationlDialog dialog = (AddTranslationlDialog)FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "AddTranslationDialog");
if (dialog != null && dialog.getFileName() != null)
{
fileUploaded = true;
}
%>
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/validation.js"> </script>
<r:page titleId="title_add_content">
<f:view>
<%-- load a bundle of properties with I18N strings --%>
<f:loadBundle basename="alfresco.messages.webclient" var="msg"/>
<h:form acceptcharset="UTF-8" id="add-content-upload-start">
<%-- Main outer table --%>
<table cellspacing="0" cellpadding="2">
<%-- Title bar --%>
<tr>
<td colspan="2"><%@ include file="../parts/titlebar.jsp"%>
</td>
</tr>
<%-- Main area --%>
<tr valign="top">
<%-- Shelf --%>
<td><%@ include file="../parts/shelf.jsp"%>
</td>
<%-- Work Area --%>
<td width="100%">
<table cellspacing="0" cellpadding="0" width="100%">
<%-- Breadcrumb --%>
<%@ include file="../parts/breadcrumb.jsp"%>
<%-- Status and Actions --%>
<tr>
<td
style="background-image: url(<%=request.getContextPath()%>/images/parts/statuspanel_4.gif)"
width="4"></td>
<td bgcolor="#dfe6ed"><%-- Status and Actions inner contents table --%>
<%-- Generally this consists of an icon, textual summary and actions for the current object --%>
<table cellspacing="4" cellpadding="0" width="100%">
<tr>
<td width="32"><h:graphicImage id="dialog-logo"
url="/images/icons/add_tranlsation_large.gif" /></td>
<td>
<div class="mainTitle"><h:outputText
value="#{msg.add_translation}" /></div>
<div class="mainSubText"><h:outputText
value="#{msg.add_translation_description}" /></div>
</td>
</tr>
</table>
</td>
<td
style="background-image: url(<%=request.getContextPath()%>/images/parts/statuspanel_6.gif)"
width="4"></td>
</tr>
<%-- separator row with gradient shadow --%>
<tr>
<td><img
src="<%=request.getContextPath()%>/images/parts/statuspanel_7.gif"
width="4" height="9"></td>
<td
style="background-image: url(<%=request.getContextPath()%>/images/parts/statuspanel_8.gif)"></td>
<td><img
src="<%=request.getContextPath()%>/images/parts/statuspanel_9.gif"
width="4" height="9"></td>
</tr>
</h:form>
<%-- Details --%>
<tr valign=top>
<td
style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_4.gif)"
width="4"></td>
<td>
<table cellspacing="0" cellpadding="3" border="0" width="100%">
<tr>
<td width="100%" valign="top"><a:errors
message="#{msg.error_add_translation_dialog}"
styleClass="errorMessage" /> <%
if (fileUploaded)
{
PanelGenerator.generatePanelStart(out, request.getContextPath(), "yellowInner", "#ffffcc");
out.write("<img alt='' align='absmiddle' src='");
out.write(request.getContextPath());
out.write("/images/icons/info_icon.gif' />&nbsp;&nbsp;");
out.write(dialog.getFileUploadSuccessMsg());
PanelGenerator.generatePanelEnd(out, request.getContextPath(), "yellowInner");
out.write("<div style='padding:2px;'></div>");
}
%> <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %>
<table cellpadding="2" cellspacing="2" border="0" width="100%">
<% if (fileUploaded == false) { %>
<tr>
<td colspan="3" class="wizardSectionHeading"><h:outputText
value="#{msg.upload_content}" /></td>
</tr>
<tr>
<td class="paddingRow"></td>
</tr>
<tr>
<td class="mainSubText" colspan="3"><h:outputText
id="text1" value="1. #{msg.locate_content}" /></td>
</tr>
<tr>
<td class="paddingRow"></td>
</tr>
<r:uploadForm>
<tr>
<td colspan="3"><input style="margin-left:12px;"
type="file" size="75" name="alfFileInput" /></td>
</tr>
<tr>
<td class="paddingRow"></td>
</tr>
<tr>
<td class="mainSubText" colspan="3">2. <%=Application.getMessage(FacesContext.getCurrentInstance(), "click_upload")%>
</td>
</tr>
<tr>
<td colspan="3"><input style="margin-left:12px;"
type="submit"
value="<%=Application.getMessage(FacesContext.getCurrentInstance(), "upload")%>" />
</td>
</tr>
</r:uploadForm>
<% } %>
<h:form acceptcharset="UTF-8" id="add-content-upload-end" onsubmit="return validate();">
<% if (fileUploaded) { %>
<tr>
<td colspan="3">
<table border="0" cellspacing="2" cellpadding="2"
class="selectedItems">
<tr>
<td colspan="2" class="selectedItemsHeader"><h:outputText
id="text2" value="#{msg.uploaded_content}" />
</td>
</tr>
<tr>
<td class="selectedItemsRow"><h:outputText id="text3"
value="#{AddTranslationDialog.fileName}" /></td>
<td><a:actionLink image="/images/icons/delete.gif"
value="#{msg.remove}"
action="#{AddTranslationDialog.removeUploadedFile}"
showLink="false" id="link1" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="paddingRow"></td>
</tr>
<tr>
<td colspan="3" class="wizardSectionHeading">&nbsp;<h:outputText
id="text4" value="#{msg.general_properties}" /></td>
</tr>
<tr>
<td class="paddingRow"></td>
</tr>
<tr>
<td align="middle"><h:graphicImage
value="/images/icons/required_field.gif"
alt="#{msg.required_field}" /></td>
<td><h:outputText id="text5" value="#{msg.name}:" /></td>
<td width="85%">
<h:inputText id="file-name" value="#{AddTranslationDialog.fileName}" maxlength="1024" size="35"
onkeyup="checkButtonState();"
onchange="checkButtonState();" />
</td>
</tr>
<tr>
<td></td>
<td><h:outputText id="text6" value="#{msg.type}:" /></td>
<td><h:selectOneMenu id="object-type" value="#{AddTranslationDialog.objectType}">
<f:selectItems value="#{AddTranslationDialog.objectTypes}" />
</h:selectOneMenu></td>
</tr>
<tr>
<td></td>
<td><h:outputText id="text7"
value="#{msg.content_type}:" /></td>
<td><r:mimeTypeSelector id="mime-type"
value="#{AddTranslationDialog.mimeType}" /></td>
</tr>
<%-- language selection drop-down --%>
<tr>
<td><h:graphicImage
value="/images/icons/required_field.gif"
alt="#{msg.required_field}" /></td>
<td><h:outputText id="text25" value="#{msg.language}:" />
</td>
<td>
<h:selectOneMenu id="language" value="#{AddTranslationDialog.language}" immediate="false" onchange="checkButtonState();" onkeydown="checkButtonState();" onkeyup="checkButtonState();">
<f:selectItem itemLabel="#{msg.select_language}" itemValue="null"/>
<f:selectItems value="#{AddTranslationDialog.unusedLanguages}" />
</h:selectOneMenu>
</td>
</tr>
<% if (dialog.getOtherPropertiesChoiceVisible()) { %>
<tr>
<td class="paddingRow"></td>
</tr>
<tr>
<td colspan="3" class="wizardSectionHeading">&nbsp;<h:outputText
id="text8" value="#{msg.other_properties}" /></td>
</tr>
<tr>
<td colspan="3">
<table style="padding-top: 2px;">
<tr>
<td colspan="3"><h:outputText id="text9"
value="#{msg.modify_props_help_text}" /></td>
</tr>
<tr>
<td class="paddingRow"></td>
</tr>
<tr>
<td>
<h:selectBooleanCheckbox value="#{AddTranslationDialog.showOtherProperties}" />
</td>
<td width="100%">
<h:outputText id="text10" value="#{msg.modify_props_when_page_closes}" />
</td>
</tr>
</table>
</td>
</tr>
<% } } %>
</table>
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %>
</td>
<td valign="top">
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "greyround", "#F5F5F5"); %>
<table cellpadding="1" cellspacing="1" border="0">
<tr>
<td align="center">
<h:commandButton id="finish-button"
styleClass="wizardButton"
value="#{msg.ok}"
action="#{AddTranslationDialog.finish}"
disabled="#{AddTranslationDialog.finishButtonDisabled}"
/>
</td>
</tr>
<tr>
<td align="center">
<h:commandButton id="cancel-button"
styleClass="wizardButton"
value="#{msg.cancel}"
action="#{AddTranslationDialog.cancel}"
/>
</td>
</tr>
</table>
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "greyround"); %>
</td>
</tr>
</table>
</td>
<td
style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_6.gif)"
width="4"></td>
</tr>
<%-- separator row with bottom panel graphics --%>
<tr>
<td><img
src="<%=request.getContextPath()%>/images/parts/whitepanel_7.gif"
width="4" height="4"></td>
<td width="100%" align="center"
style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_8.gif)"></td>
<td><img
src="<%=request.getContextPath()%>/images/parts/whitepanel_9.gif"
width="4" height="4"></td>
</tr>
</table>
</td>
</tr>
</table>
<script type="text/javascript">
var finishButtonPressed = false;
window.onload = pageLoaded;
function pageLoaded()
{
document.getElementById("add-content-upload-end:finish-button").onclick = function() {finishButtonPressed = true; clear_add_2Dcontent_2Dupload_2Dend();}
checkButtonState();
}
function checkButtonState()
{
if (document.getElementById("add-content-upload-end:file-name").value.length == 0
|| document.getElementById("add-content-upload-end:language").selectedIndex == 0)
{
document.getElementById("add-content-upload-end:finish-button").disabled = true;
}
else
{
document.getElementById("add-content-upload-end:finish-button").disabled = false;
}
}
function validate()
{
if (finishButtonPressed)
{
finishButtonPressed = false;
return validateName(document.getElementById("add-content-upload-end:file-name"),
'<a:outputText id="text11" value="#{msg.validation_invalid_character}" />', true);
}
else
{
return true;
}
}
</script>
</h:form>
</f:view>
</r:page>

View File

@@ -0,0 +1,82 @@
<%--
* 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"
--%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<h:panelGrid columns="1" cellpadding="2" style="padding-top: 4px; padding-bottom: 4px;" width="100%" rowClasses="wizardSectionHeading">
<h:outputText value="#{msg.properties}" escape="false" />
</h:panelGrid>
<h:panelGrid columns="3" cellpadding="3" cellspacing="3" border="0">
<h:graphicImage value="/images/icons/required_field.gif" alt="#{msg.required_field}" />
<h:outputText value="#{msg.name}:"/>
<h:inputText id="name" value="#{DialogManager.bean.name}" maxlength="1024" size="35" immediate="false" onkeyup="checkButtonState();" onchange="checkButtonState();"/>
<h:graphicImage/>
<h:outputText value="#{msg.title}:"/>
<h:inputText id="title" value="#{DialogManager.bean.title}" maxlength="1024" size="35" immediate="false"/>
<h:graphicImage/>
<h:outputText value="#{msg.description}:"/>
<h:inputTextarea id="description" value="#{DialogManager.bean.description}" cols="35" rows="5" immediate="false"/>
<h:graphicImage value="/images/icons/required_field.gif" alt="#{msg.required_field}" />
<h:outputText value="#{msg.author}:"/>
<h:inputText id="author" value="#{DialogManager.bean.author}" maxlength="1024" size="35" immediate="false" onkeyup="checkButtonState();" onchange="checkButtonState();"/>
<h:graphicImage value="/images/icons/required_field.gif" alt="#{msg.required_field}" />
<h:outputText value="#{msg.language}:"/>
<h:selectOneMenu id="language" value="#{DialogManager.bean.language}" immediate="false" onchange="checkButtonState();" onkeydown="checkButtonState();" onkeyup="checkButtonState();">
<f:selectItem itemLabel="#{msg.select_language}" itemValue="null"/>
<f:selectItems value="#{DialogManager.bean.unusedLanguages}"/>
</h:selectOneMenu>
</h:panelGrid>
<script type="text/javascript">
function checkButtonState()
{
if (document.getElementById("dialog:dialog-body:name").value.length == 0 ||
document.getElementById("dialog:dialog-body:author").value.length == 0 ||
document.getElementById("dialog:dialog-body:language").selectedIndex == 0 )
{
document.getElementById("dialog:finish-button").disabled = true;
}
else
{
document.getElementById("dialog:finish-button").disabled = false;
}
}
</script>

View File

@@ -0,0 +1,38 @@
<%--
* 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 Alan 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"
--%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<h:panelGrid columns="1" rowClasses="wizardSectionHeading, paddingRow"
cellpadding="2" cellspacing="2" width="100%">
<h:outputText value="#{msg.ml_common_content_properties}" />
<r:propertySheetGrid id="ml-props" value="#{DialogManager.bean.editableNode}"
var="mlContainerProps" columns="1" labelStyleClass="propertiesLabel"
externalConfig="true" cellpadding="2" cellspacing="2" />
</h:panelGrid>

View File

@@ -0,0 +1,80 @@
<%--
Copyright (C) 2005 Alfresco, Inc.
Licensed under the Mozilla Public License version 1.1
with a permitted attribution clause. You may obtain a
copy of the License at
http://www.alfresco.org/legal/license.txt
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific
language governing permissions and limitations under the
License.
--%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<h:panelGrid columns="1" cellpadding="2" style="padding-top: 4px; padding-bottom: 4px;" width="100%" rowClasses="wizardSectionHeading">
<h:outputText value="#{msg.ml_common_content_properties}" escape="false" />
</h:panelGrid>
<h:panelGrid columns="3" cellpadding="3" cellspacing="3" border="0">
<h:graphicImage value="/images/icons/required_field.gif" alt="#{msg.required_field}" />
<h:outputText value="#{msg.author}:"/>
<h:inputText id="author" value="#{DialogManager.bean.author}" maxlength="1024" size="35" immediate="false" onkeyup="checkButtonState();" onchange="checkButtonState();" />
<%-- language selection drop-down --%>
<h:graphicImage value="/images/icons/required_field.gif" alt="#{msg.required_field}" />
<h:outputText value="#{msg.language}:"/>
<h:selectOneMenu id="language" value="#{DialogManager.bean.language}" immediate="false" onchange="checkButtonState();" onkeydown="checkButtonState();" onkeyup="checkButtonState();">
<f:selectItem itemLabel="#{msg.select_language}" itemValue="null"/>
<f:selectItems value="#{DialogManager.bean.filterLanguages}"/>
</h:selectOneMenu>
</h:panelGrid>
<h:panelGrid columns="1" cellpadding="3" cellspacing="3" border="0" style="padding-top: 4px;"
width="100%" rowClasses="wizardSectionHeading, paddingRow">
<h:outputText value="#{msg.ml_other_options}" escape="false" />
</h:panelGrid>
<h:panelGrid style="padding-top: 2px;" columns="2">
<h:selectBooleanCheckbox id="add_translation" value="#{DialogManager.bean.addTranslationAfter}" onchange="submit();" immediate="false"/>
<h:outputText value="#{msg.ml_add_trans_when_diag_close}" />
</h:panelGrid>
<h:panelGrid style="padding-top: 2px;" id="panel_adding_mode" >
<h:panelGrid style="padding-top: 4px;padding-left: 15px;">
<h:selectOneRadio required="false" value="#{DialogManager.bean.addingMode}" disabled="#{!DialogManager.bean.addTranslationAfter}" immediate="false" id="radioWithContent" layout="pageDirection">
<f:selectItem itemValue="ADD_WITH_CONTENT" itemLabel="#{msg.ml_with_content}" itemDisabled="#{!DialogManager.bean.addTranslationAfter}"/>
<f:selectItem itemValue="ADD_WITHOUT_CONTENT" itemLabel="#{msg.ml_just_trans_info}" itemDisabled="#{!DialogManager.bean.addTranslationAfter}"/>
</h:selectOneRadio>
</h:panelGrid>
</h:panelGrid>
<script type="text/javascript">
function checkButtonState()
{
if (document.getElementById("dialog:dialog-body:author").value.length == 0 ||
document.getElementById("dialog:dialog-body:language").selectedIndex == 0 )
{
document.getElementById("dialog:finish-button").disabled = true;
}
else
{
document.getElementById("dialog:finish-button").disabled = false;
}
}
</script>

View File

@@ -0,0 +1,247 @@
<%--
* 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"
--%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<%@ page buffer="64kb" contentType="text/html;charset=UTF-8" %>
<%@ page isELIgnored="false" %>
<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %>
<r:page titleId="title_file_details">
<f:view>
<%-- load a bundle of properties with I18N strings --%>
<f:loadBundle basename="alfresco.messages.webclient" var="msg"/>
<h:form acceptcharset="UTF-8" id="document-details">
<%-- Main outer table --%>
<table cellspacing="0" cellpadding="2">
<%-- Title bar --%>
<tr>
<td colspan="2">
<%@ include file="../parts/titlebar.jsp" %>
</td>
</tr>
<%-- Main area --%>
<tr valign="top">
<%-- Shelf --%>
<td>
<%@ include file="../parts/shelf.jsp" %>
</td>
<%-- Work Area --%>
<td width="100%">
<table cellspacing="0" cellpadding="0" width="100%">
<%-- Breadcrumb --%>
<%@ include file="../parts/breadcrumb.jsp" %>
<%-- Status and Actions --%>
<tr>
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/statuspanel_4.gif)" width="4"></td>
<td bgcolor="#dfe6ed">
<%-- Status and Actions inner contents table --%>
<%-- Generally this consists of an icon, textual summary and actions for the current object --%>
<table cellspacing="4" cellpadding="0" width="100%">
<tr>
<td width="32">
<img src="<%=request.getContextPath()%>/images/icons/details_large.gif" width=32 height=32>
</td>
<td>
<div class="mainTitle">
<h:outputText value="#{msg.manage_multilingual_details_for}" /> '<h:outputText value="#{DocumentDetailsBean.name}" />'<r:lockIcon value="#{DocumentDetailsBean.document.nodeRef}" align="absmiddle" />
</div>
<div class="mainSubText"><h:outputText id="ml-details-description" value="#{msg.manage_multilingual_details_description}" /></div>
</td>
</tr>
</table>
</td>
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/statuspanel_6.gif)" width="4"></td>
</tr>
<%-- separator row with gradient shadow --%>
<tr>
<td><img src="<%=request.getContextPath()%>/images/parts/statuspanel_7.gif" width="4" height="9"></td>
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/statuspanel_8.gif)"></td>
<td><img src="<%=request.getContextPath()%>/images/parts/statuspanel_9.gif" width="4" height="9"></td>
</tr>
<%-- Error Messages --%>
<tr valign=top>
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_4.gif)" width=4></td>
<td>
<%-- messages tag to show messages not handled by other specific message tags --%>
<a:errors message="" infoClass="statusWarningText" errorClass="statusErrorText" />
</td>
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_6.gif)" width=4></td>
</tr>
<%-- Details --%>
<tr valign=top>
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_4.gif)" width="4"></td>
<td>
<table cellspacing="0" cellpadding="3" border="0" width="100%">
<tr>
<td width="100%" valign="top">
<%-- wrapper comment used by the panel to add additional component facets --%>
<h:panelGroup id="dashboard-panel-facets">
<f:facet name="title">
<r:permissionEvaluator value="#{DocumentDetailsBean.document}" allow="Write" id="evalChange">
<a:actionLink id="actModify" value="#{msg.modify}" action="dialog:applyTemplate" showLink="false" image="/images/icons/preview.gif" style="padding-right:8px" />
<a:actionLink id="actRemove" value="#{msg.remove}" actionListener="#{DocumentDetailsBean.removeTemplate}" showLink="false" image="/images/icons/delete.gif" />
</r:permissionEvaluator>
</f:facet>
</h:panelGroup>
<%--
Multlingual details
--%>
<%-- properties for Ml container --%>
<h:panelGroup id="ml-props-panel-facets">
<f:facet name="title">
<r:permissionEvaluator value="#{DocumentDetailsBean.documentMlContainer}" allow="Write">
<a:actionLink id="titleLinkMl" value="#{msg.modify}" showLink="false" image="/images/icons/edit_properties.gif"
action="dialog:editMlContainer" />
</r:permissionEvaluator>
</f:facet>
</h:panelGroup>
<a:panel label="#{msg.properties}" facetsId="ml-props-panel-facets" id="ml-properties-panel" progressive="true"
border="white" bgcolor="white" titleBorder="lbgrey" expandedTitleBorder="dotted" titleBgcolor="white"
expanded='#{DocumentDetailsBean.panels["ml-properties-panel"]}' expandedActionListener="#{DocumentDetailsBean.expandPanel}">
<h:outputText styleClass="nodeWorkflowInfoTitle"/>
<r:propertySheetGrid id="ml-container-props-sheet" value="#{DocumentDetailsBean.documentMlContainer}"
var="mlContainerProps" columns="1" labelStyleClass="propertiesLabel"
externalConfig="true" cellpadding="2" cellspacing="2" mode="view"/>
</a:panel>
<div style="padding:4px"></div>
<%-- list of translations --%>
<a:panel label="#{msg.translations}" id="ml-translation-panel" progressive="true"
border="white" bgcolor="white" titleBorder="lbgrey" expandedTitleBorder="dotted" titleBgcolor="white"
expanded='#{DocumentDetailsBean.panels["ml-translation-panel"]}' expandedActionListener="#{DocumentDetailsBean.expandPanel}">
<a:richList id="TranslationList" viewMode="details" value="#{DocumentDetailsBean.translations}"
var="r" styleClass="recordSet" headerStyleClass="recordSetHeader"
rowStyleClass="recordSetRow" altRowStyleClass="recordSetRowAlt" width="100%"
pageSize="10" initialSortColumn="Name" initialSortDescending="false">
<%-- Icon details view mode --%>
<a:column id="col20" primary="true" width="20" style="padding:2px;">
<f:facet name="header">
<h:outputText value=""/>
</f:facet>
<h:graphicImage url="/images/icons/space_small.gif" />
</a:column>
<%-- Name Columns --%>
<a:column id="col21" width="300" style="text-align:left">
<f:facet name="header">
<a:sortLink label="#{msg.name}" value="Name" mode="case-insensitive" styleClass="header"/>
</f:facet>
<a:actionLink id="view-name" value="#{r.name}" href="#{r.url}" target="new" />
</a:column>
<%-- Language columns --%>
<a:column id="col22" width="50" style="text-align:left">
<f:facet name="header">
<a:sortLink label="#{msg.language}" value="language" mode="case-insensitive" styleClass="header"/>
</f:facet>
<h:outputText id="view-language" value="#{r.language}" />
</a:column>
<%-- view actions --%>
<a:column id="col25" style="text-align: left">
<f:facet name="header">
<h:outputText value="#{msg.actions}"/>
</f:facet>
<a:actionLink id="view-link" value="#{msg.view}" href="#{r.url}" target="new" />
</a:column>
<a:dataPager styleClass="pager" />
</a:richList>
</a:panel>
<td valign="top">
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "greyround", "#F5F5F5"); %>
<table cellpadding="1" cellspacing="1" border="0" width="100%">
<tr>
<td align="center">
<h:commandButton id="close-btn" value="#{msg.close}" action="dialog:close" styleClass="wizardButton" />
</td>
</tr>
</table>
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "greyround"); %>
<div style="padding:4px"></div>
<%-- Document Actions --%>
<a:panel label="#{msg.actions}" id="actions-panel" border="white" bgcolor="white" titleBorder="lbgrey" expandedTitleBorder="dotted" titleBgcolor="white" style="text-align:center"
progressive="true" expanded='#{DocumentDetailsBean.panels["actions-panel"]}' expandedActionListener="#{DocumentDetailsBean.expandPanel}">
<r:actions id="actions_doc" value="Multilingual_details_actions" context="#{DocumentDetailsBean.document}" verticalSpacing="3" style="white-space:nowrap" />
</a:panel>
</td>
</tr>
</table>
</td>
<td style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_6.gif)" width="4"></td>
</tr>
<%-- separator row with bottom panel graphics --%>
<tr>
<td><img src="<%=request.getContextPath()%>/images/parts/whitepanel_7.gif" width="4" height="4"></td>
<td width="100%" align="center" style="background-image: url(<%=request.getContextPath()%>/images/parts/whitepanel_8.gif)"></td>
<td><img src="<%=request.getContextPath()%>/images/parts/whitepanel_9.gif" width="4" height="4"></td>
</tr>
</table>
</td>
</tr>
</table>
</h:form>
</f:view>
</r:page>

View File

@@ -31,8 +31,12 @@
<h:panelGrid columns="1" rowClasses="wizardSectionHeading, paddingRow"
cellpadding="2" cellspacing="2" width="100%">
<h:outputText value="#{msg.space_props}" />
<r:propertySheetGrid id="space-props" value="#{DialogManager.bean.editableNode}"
var="spaceProps" columns="1" labelStyleClass="propertiesLabel"
externalConfig="true" cellpadding="2" cellspacing="2" />
</h:panelGrid>
<h:selectBooleanCheckbox value="#{EditSpaceDialog.edit}" id="edit" />
<h:outputText value="#{msg.create_properties_close}" />

View File

@@ -0,0 +1,147 @@
<%--
* 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"
--%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<f:verbatim>
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/validation.js"> </script>
<script type="text/javascript">
var finishButtonPressed = false;
window.onload = pageLoaded;
function pageLoaded()
{
document.getElementById("dialog:dialog-body:title").focus();
document.getElementById("dialog").onsubmit = validate;
document.getElementById("dialog:finish-button").onclick = function() {finishButtonPressed = true; clear_dialog();}
checkButtonState();
}
function checkButtonState(){document.getElementById("dialog:finish-button").disabled = false;}
function validate()
{
if (finishButtonPressed)
{
finishButtonPressed = false;
return validateName(document.getElementById("dialog:dialog-body:title"),
'</f:verbatim><a:outputText value="#{msg.validation_invalid_character}" /><f:verbatim>', true);
}
else
{
return true;
}
}
</script>
<table cellpadding="2" cellspacing="2" border="0" width="100%">
<tr>
<td colspan="3" class="wizardSectionHeading">
</f:verbatim>
<h:outputText value="#{msg.properties}" />
<f:verbatim>
</td>
</tr>
<tr>
<td >
</f:verbatim>
<f:verbatim>
</td>
<td>
</f:verbatim>
<h:outputText value="#{msg.title}:" />
<f:verbatim>
</td>
<td>
</f:verbatim>
<h:inputText id="title" value="#{CreateMultilingualPropertiesBean.title}" size="35" maxlength="1024" onkeyup="javascript:checkButtonState();" onchange="javascript:checkButtonState();" />
<f:verbatim>
</td>
<td>
<f:verbatim>
<%-- existing properties --%>
<h:selectOneMenu id="existingpropertiestitle" value="#{CreateMultilingualPropertiesBean.language}" style="width:150px" >
<f:selectItems value="#{CreateMultilingualPropertiesBean.listAllTitlesProperties}" />
</h:selectOneMenu>
</f:verbatim>
</td>
</tr>
<tr>
<td></td>
<td>
</f:verbatim>
<h:outputText value="#{msg.description}:" />
<f:verbatim>
</td>
<td>
</f:verbatim>
<h:inputText id="description" value="#{CreateMultilingualPropertiesBean.description}" size="35" maxlength="1024" />
<f:verbatim>
</td>
<td>
<f:verbatim>
<%-- existing properties --%>
<h:selectOneMenu id="existingproperties" value="#{CreateMultilingualPropertiesBean.language}" style="width:150px" >
<f:selectItems value="#{CreateMultilingualPropertiesBean.listAllDescriptionsProperties}" />
</h:selectOneMenu>
</f:verbatim>
</td>
</br>
</tr>
</table>
</f:verbatim>
<table cellpadding="2" cellspacing="2" border="0" width="100%">
<tr>
<td colspan="3" style="padding-left:22px">
<td style="padding-left" >
<h:selectBooleanCheckbox value="#{CreateMultilingualPropertiesBean.add_new_properties}" id="editnewproperties" />
<span style="vertical-align:20%"></span>
<h:outputText value=" " />
<h:selectOneMenu id="newlanguage" immediate="true" value="#{CreateMultilingualPropertiesBean.newlanguage}" style="width:80px" >
<f:selectItems value="#{CreateMultilingualPropertiesBean.contentFilterLanguages}" />
</h:selectOneMenu>
<h:outputText value=" " />
<h:outputText value="#{msg.properties_close}" />
</td>
</tr>
</table>

View File

@@ -0,0 +1,173 @@
<%--
* 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"
--%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<f:verbatim>
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/validation.js"> </script>
<script type="text/javascript">
var finishButtonPressed = false;
window.onload = pageLoaded;
function pageLoaded()
{
document.getElementById("dialog:dialog-body:name").focus();
document.getElementById("dialog").onsubmit = validate;
document.getElementById("dialog:finish-button").onclick = function() {finishButtonPressed = true; clear_dialog();}
checkButtonState();
}
function checkButtonState()
{
if (document.getElementById("dialog:dialog-body:name").value.length == 0 )
{
document.getElementById("dialog:finish-button").disabled = true;
}
else
{
document.getElementById("dialog:finish-button").disabled = false;
}
}
function validate()
{
if (finishButtonPressed)
{
finishButtonPressed = false;
var retour = "";
var val = document.getElementById("dialog:dialog-body:name");
for(i=0;i < val.length;i++) if(val.charAt(i) != " ") {retour += val.charAt(i)}
return validateName(retour,
'</f:verbatim><a:outputText value="#{msg.validation_invalid_character}" /><f:verbatim>',
true);
}
else
{
return true;
}
}
</script>
<table cellpadding="2" cellspacing="2" border="0" width="100%">
<tr>
<td colspan="3" class="wizardSectionHeading">
</f:verbatim>
<h:outputText value="#{msg.properties}" />
<f:verbatim>
</td>
</tr>
<tr>
<td align="middle">
</f:verbatim>
<h:graphicImage value="/images/icons/required_field.gif" alt="#{msg.required_field}" />
<f:verbatim>
</td>
<td>
</f:verbatim>
<h:outputText value="#{msg.name}:" />
<f:verbatim>
</td>
<td width="85%">
</f:verbatim>
<h:inputText id="name" value="#{DialogManager.bean.name}" size="35" maxlength="1024"
onkeyup="javascript:checkButtonState();" onchange="javascript:checkButtonState();" />
<f:verbatim>
</td>
</tr>
<tr>
<td></td>
<td>
</f:verbatim>
<h:outputText value="#{msg.title}:" />
<f:verbatim>
</td>
<td>
</f:verbatim>
<h:inputText id="title" value="#{DialogManager.bean.title}" size="35" maxlength="1024" />
<f:verbatim>
</td>
</tr>
<tr>
<td></td>
<td>
</f:verbatim>
<h:outputText value="#{msg.description}:" />
<f:verbatim>
</td>
<td>
</f:verbatim>
<h:inputText id="description" value="#{DialogManager.bean.description}" size="35" maxlength="1024" />
<f:verbatim>
</td>
</tr>
<tr>
<td></td>
<td>
</f:verbatim>
<h:outputText value="#{msg.icon}:" />
<f:verbatim>
</td>
<td>
<table border="0" cellpadding="0" cellspacing="0"><tr><td>
</f:verbatim>
<a:imagePickerRadioPanel id="space-icon" columns="6" spacing="4" value="#{DialogManager.bean.icon}"
panelBorder="greyround" panelBgcolor="#F5F5F5">
<a:listItems value="#{DialogManager.bean.icons}" />
</a:imagePickerRadioPanel>
</td>
</tr>
<td style="padding-left">
<h:outputText value="#{msg.properties_close}:" />
<h:outputText value=" " />
<h:selectBooleanCheckbox value="#{CreateMultilingualSpaceDialog.edit}" id="Nedit" />
</td>
<td>
<h:selectOneMenu id="newlanguage" immediate="true" value="#{CreateMultilingualPropertiesBean.newlanguage}" style="width:80px" >
<f:selectItems value="#{CreateMultilingualPropertiesBean.contentFilterLanguages}" />
</h:selectOneMenu>
</td>
</table>
</td>
</tr>
</table>