Completed Task #12286: Align portlet container labels to the new CKAN mapping

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@171248 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2018-08-30 15:35:45 +00:00
parent 234a64ee00
commit ec01c921a2
7 changed files with 124 additions and 25 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/gcube-ckan-datacatalog-1.5.3-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/gcube-ckan-datacatalog-1.6.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
@ -19,7 +19,7 @@
</attributes>
</classpathentry>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry excluding="**" kind="src" output="target/gcube-ckan-datacatalog-1.5.3-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<classpathentry excluding="**" kind="src" output="target/gcube-ckan-datacatalog-1.6.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@ -34,5 +34,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/gcube-ckan-datacatalog-1.5.3-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/gcube-ckan-datacatalog-1.6.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -1,6 +1,6 @@
eclipse.preferences.version=1
jarsExcludedFromWebInfLib=
lastWarOutDir=/home/costantino/workspace/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT
lastWarOutDir=/home/francesco-mangiacrapa/wseclipseluna/gcube-ckan-datacatalog-TRUNK/target/gcube-ckan-datacatalog-1.6.0-SNAPSHOT
launchConfigExternalUrlPrefix=
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

14
pom.xml
View File

@ -89,6 +89,11 @@
</dependency>
<!-- END FWS -->
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-encryption</artifactId>
</dependency>
<!-- share link widget -->
<dependency>
<groupId>org.gcube.portlets-widgets</groupId>
@ -109,12 +114,19 @@
<scope>compile</scope>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.gcube.portlets.widgets</groupId> -->
<!-- <artifactId>session-checker</artifactId> -->
<!-- <version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->
<dependency>
<groupId>org.gcube.resources</groupId>
<artifactId>registry-publisher</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-client</artifactId>

View File

@ -38,6 +38,11 @@ import com.google.gwt.user.client.ui.InlineHTML;
*/
public class CkanMetadataManagementPanel extends FlowPanel{
/**
*
*/
private static final String MY_PREFIX = "My ";
private static final String MANAGE_ITEM_TOOLTIP = "By pushing on this button, you will be able to manage the item you are viewing."
+ " Manageable items are the GRSF ones.";
@ -69,7 +74,8 @@ public class CkanMetadataManagementPanel extends FlowPanel{
/**
* Instantiates a new ckan metadata management panel.
* @param eventBus
*
* @param eventBus the event bus
*/
public CkanMetadataManagementPanel(HandlerManager eventBus){
this.eventBus = eventBus;
@ -150,7 +156,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
}
/**
*
* Adds the handlers.
*/
private void addHandlers() {
@ -294,8 +300,9 @@ public class CkanMetadataManagementPanel extends FlowPanel{
}
/**
* Those buttons can be only visible when the logged user has role edit/admin/sysadmin
* @param show
* Those buttons can be only visible when the logged user has role edit/admin/sysadmin.
*
* @param show the show
*/
public void showInsertAndEditProductButtons(boolean show){
@ -307,29 +314,33 @@ public class CkanMetadataManagementPanel extends FlowPanel{
/**
* Button to manage the product.. for example in grsf case
*
* @param value true or false
* @param isManageProductEnabled
*/
public void showManageProductButton(boolean value){
manageProduct.setVisible(value);
}
/**
* Enable or disable the manage product button
* Enable or disable the manage product button.
*
* @param value the value
*/
public void enableManageProductButton(boolean value){
manageProduct.setEnabled(value);
}
/**
* Enable or disable the share link button
* Enable or disable the share link button.
*
* @param value the value
*/
public void enableShareItemButton(boolean value){
shareLink.setEnabled(value);
}
/**
* Show only home/statistics buttons
* Show only home/statistics buttons.
*/
public void doNotShowUserRelatedInfo(){
@ -345,6 +356,9 @@ public class CkanMetadataManagementPanel extends FlowPanel{
}
/**
* Removes the generic management buttons.
*/
public void removeGenericManagementButtons() {
home.setVisible(true);
@ -375,15 +389,50 @@ public class CkanMetadataManagementPanel extends FlowPanel{
if(labelName==null || labelName.isEmpty() || translateValue==null || translateValue.isEmpty())
return;
if(labelName==organizations.getText()){
// GWT.log("labelName "+labelName);
// GWT.log("translateValue "+translateValue);
// GWT.log("organizations "+organizations.getText());
if(labelName.compareToIgnoreCase(organizations.getText().trim())==0){
organizations.setText(translateValue);
}else if(labelName==groups.getText()){
//return;
}else if(labelName.compareToIgnoreCase(groups.getText().trim())==0){
groups.setText(translateValue);
}else if(labelName==items.getText()){
//return;
}else if(labelName.compareToIgnoreCase(items.getText().trim())==0){
items.setText(translateValue);
}else if(labelName==types.getText()){
//return;
}else if(labelName.compareToIgnoreCase(types.getText().trim())==0){
types.setText(translateValue);
//return;
}
String mylabelName = MY_PREFIX+labelName;
// GWT.log("mylabelName "+mylabelName);
// GWT.log("myDatasets.getText() "+myDatasets.getText());
if(mylabelName.compareToIgnoreCase(myDatasets.getText().trim())==0){
myDatasets.setText(MY_PREFIX+translateValue);
return;
}else if(labelName.compareToIgnoreCase(myOrganizations.getText().trim())==0){
myOrganizations.setText(MY_PREFIX+translateValue);
return;
}else if(labelName.compareToIgnoreCase(myGroups.getText().trim())==0){
myGroups.setText(MY_PREFIX+translateValue);
return;
}
}
/**
* Capitalize.
*
* @param stringValue the translate value
* @return the string
*/
public static String capitalize(String stringValue){
return stringValue.substring(0,1).toUpperCase()+stringValue.substring(1, stringValue.length());
}
}

View File

@ -413,9 +413,11 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
//Supporting Task #12286: parsing the translate values for 'dataset', 'organization' and so on
if(object.containsKey("translate")){
JSONObject theTranslate = (JSONObject) object.get("translate");
GWT.log("theTranslate is " + object);
for (String key : theTranslate.keySet()) {
String value = object.get(key).isString().stringValue();
GWT.log("Customizing key " + key +" with translate: "+value);
GWT.log("theTranslate key " + key);
String value = theTranslate.get(key).isString().stringValue();
printString("Customizing navigation link '" + key +"' with translate: "+value);
managementPanel.customizeLabelAccordingTranslate(key,value);
}

View File

@ -96,10 +96,12 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
logger.info("queryStringParameters detected like Base64 and decoded like: "+queryStringParameters);
}
ScopeBean scopeBean = new ScopeBean(scopePerCurrentUrl);
if(scopeBean.is(Type.VRE) && !checksItemCatalogueResourceUpdated.containsKey(scopePerCurrentUrl)){
new UpdateItemCatalogueResource(scopePerCurrentUrl, SessionUtil.getCurrentClientUrl(getThreadLocalRequest()).split("\\?")[0]).start();
checksItemCatalogueResourceUpdated.put(scopePerCurrentUrl, true);
if(SessionUtil.isIntoPortal()){
ScopeBean scopeBean = new ScopeBean(scopePerCurrentUrl);
if(scopeBean.is(Type.VRE) && !checksItemCatalogueResourceUpdated.containsKey(scopePerCurrentUrl)){
new UpdateItemCatalogueResource(scopePerCurrentUrl, SessionUtil.getCurrentClientUrl(getThreadLocalRequest()).split("\\?")[0]).start();
checksItemCatalogueResourceUpdated.put(scopePerCurrentUrl, true);
}
}
if(pathInfoParameter == null || pathInfoParameter.isEmpty()){
@ -181,8 +183,8 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
SessionUtil.getCurrentUser(
getThreadLocalRequest()).getEmail(),
scopePerCurrentUrl,
getCatalogue(scopePerCurrentUrl),
isViewPerVREEnabled() != null,
getCatalogue(scopePerCurrentUrl),
isViewPerVREEnabled() != null,
getThreadLocalRequest().getSession());
ckan.addListOfVREs(roleForVre);

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='gCubeCkanDataCatalog'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name="com.github.gwtbootstrap.Bootstrap" />
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard' /> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<inherits name="com.google.gwt.json.JSON" />
<!-- Specify the app entry point class. -->
<entry-point
class='org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GCubeCkanDataCatalog' />
<!-- Inherits widget -->
<inherits
name='org.gcube.portlets_widgets.catalogue_sharing_widget.ShareCatalogue' />
<inherits
name='org.gcube.portlets.widgets.ckandatapublisherwidget.CKanMetadataPublisher' />
<inherits name='org.gcube.datacatalogue.grsf_manage_widget.GRSFManageWidget' />
<inherits name='org.gcube.datacatalogue.ckanutillibrary.CkanUtilLibrary' />
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
</module>