Skip to content

Commit 2e0f2fc

Browse files
author
svuillet
committed
add share detail screen
1 parent 0bce4da commit 2e0f2fc

File tree

9 files changed

+196
-5
lines changed

9 files changed

+196
-5
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/*
2+
* Copyright (C) 2000 - 2024 Silverpeas
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Affero General Public License as
6+
* published by the Free Software Foundation, either version 3 of the
7+
* License, or (at your option) any later version.
8+
*
9+
* As a special exception to the terms and conditions of version 3.0 of
10+
* the GPL, you may redistribute this Program in connection with Free/Libre
11+
* Open Source Software ("FLOSS") applications as described in Silverpeas's
12+
* FLOSS exception. You should have received a copy of the text describing
13+
* the FLOSS exception, and it is also available here:
14+
* "https://www.silverpeas.org/legal/floss_exception.html"
15+
*
16+
* This program is distributed in the hope that it will be useful,
17+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
* GNU Affero General Public License for more details.
20+
*
21+
* You should have received a copy of the GNU Affero General Public License
22+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
23+
*/
24+
25+
package org.silverpeas.mobile.client.apps.sharesbox.pages;
26+
27+
import com.google.gwt.core.client.GWT;
28+
import com.google.gwt.i18n.client.DateTimeFormat;
29+
import com.google.gwt.uibinder.client.UiBinder;
30+
import com.google.gwt.uibinder.client.UiField;
31+
import com.google.gwt.user.client.ui.HTMLPanel;
32+
import com.google.gwt.user.client.ui.Widget;
33+
import org.silverpeas.mobile.client.apps.sharesbox.resources.ShareMessages;
34+
import org.silverpeas.mobile.client.common.network.NetworkHelper;
35+
import org.silverpeas.mobile.client.components.base.PageContent;
36+
import org.silverpeas.mobile.shared.dto.tickets.TicketDTO;
37+
38+
import java.util.Date;
39+
40+
public class SharePage extends PageContent {
41+
42+
private static SharesBoxPageUiBinder uiBinder = GWT.create(SharesBoxPageUiBinder.class);
43+
44+
@UiField(provided = true) protected ShareMessages msg = null;
45+
private TicketDTO data;
46+
47+
@UiField
48+
HTMLPanel container;
49+
50+
public void setData(TicketDTO data) {
51+
this.data = data;
52+
setPageTitle(msg.shareOf() + " " + data.getName());
53+
54+
String rowTemplate = "<div class='field-share'><span>1</span><span>2</span></div>";
55+
56+
String html = "<div class='header-share'>" + rowTemplate.replace("1", msg.name() + " : ").replace("2", data.getName());
57+
Date d = new Date();
58+
d.setTime(Long.parseLong(data.getCreationDate().trim()));
59+
DateTimeFormat fmt = DateTimeFormat.getFormat("dd/MM/yyyy");
60+
html += rowTemplate.replace("1", msg.creationDate() + " : ").replace("2", fmt.format(d));
61+
html += "</div>";
62+
63+
html += "<div class='field-infos-share'>";
64+
if (data.getNbAccessMax().equalsIgnoreCase("-1")) {
65+
html += rowTemplate.replace("1", msg.nbAccess() + " : ").replace("2", data.getNbAccess());
66+
} else {
67+
html += rowTemplate.replace("1", msg.nbAccess() + " : ").replace("2", data.getNbAccess() + " / " + data.getNbAccessMax());
68+
}
69+
if (data.getValid().equalsIgnoreCase("true")) {
70+
html += rowTemplate.replace("1", msg.active() + " : ").replace("2", "<input type='checkbox' disabled checked/>");
71+
} else {
72+
html += rowTemplate.replace("1", msg.active() + " : ").replace("2", "<input type='checkbox' disabled />");
73+
}
74+
html += "</div>";
75+
76+
html += "<div class='field-link-share'>";
77+
String link = NetworkHelper.getHostname() + data.getUri();
78+
html += rowTemplate.replace("1", msg.link() + " : <br>").replace("2", "<a href='" + link + "'>" + link + "</a>");
79+
html += "</div>";
80+
81+
container.getElement().setInnerHTML(html);
82+
83+
}
84+
85+
interface SharesBoxPageUiBinder extends UiBinder<Widget, SharePage> {
86+
}
87+
88+
public SharePage() {
89+
msg = GWT.create(ShareMessages.class);
90+
initWidget(uiBinder.createAndBindUi(this));
91+
}
92+
93+
@Override
94+
public void stop() {
95+
super.stop();
96+
}
97+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!--
2+
~ Copyright (C) 2000 - 2024 Silverpeas
3+
~
4+
~ This program is free software: you can redistribute it and/or modify
5+
~ it under the terms of the GNU Affero General Public License as
6+
~ published by the Free Software Foundation, either version 3 of the
7+
~ License, or (at your option) any later version.
8+
~
9+
~ As a special exception to the terms and conditions of version 3.0 of
10+
~ the GPL, you may redistribute this Program in connection with Free/Libre
11+
~ Open Source Software ("FLOSS") applications as described in Silverpeas's
12+
~ FLOSS exception. You should have received a copy of the text describing
13+
~ the FLOSS exception, and it is also available here:
14+
~ "https://www.silverpeas.org/legal/floss_exception.html"
15+
~
16+
~ This program is distributed in the hope that it will be useful,
17+
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
~ GNU Affero General Public License for more details.
20+
~
21+
~ You should have received a copy of the GNU Affero General Public License
22+
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
23+
-->
24+
25+
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
26+
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
27+
xmlns:g="urn:import:com.google.gwt.user.client.ui"
28+
xmlns:base="urn:import:org.silverpeas.mobile.client.components.base"
29+
xmlns:components="urn:import:org.silverpeas.mobile.client.components">
30+
31+
<ui:with field='msg' type='org.silverpeas.mobile.client.apps.sharesbox.resources.ShareMessages' />
32+
33+
<g:HTMLPanel ui:field="container" styleName="content ui-body-a share">
34+
</g:HTMLPanel>
35+
</ui:UiBinder>

mobile-war/src/main/java/org/silverpeas/mobile/client/apps/sharesbox/pages/widgets/ShareItem.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import com.google.gwt.user.client.ui.Anchor;
3939
import com.google.gwt.user.client.ui.HTMLPanel;
4040
import com.google.gwt.user.client.ui.Widget;
41+
import org.silverpeas.mobile.client.apps.sharesbox.pages.SharePage;
4142
import org.silverpeas.mobile.client.apps.sharesbox.resources.ShareMessages;
4243
import org.silverpeas.mobile.client.components.base.widgets.SelectableItem;
4344
import org.silverpeas.mobile.shared.dto.tickets.TicketDTO;
@@ -91,7 +92,9 @@ protected void endTouch(TouchEndEvent event) {
9192
endTouch(event, true, new Command() {
9293
@Override
9394
public void execute() {
94-
//TODO : display share informations
95+
SharePage page = new SharePage();
96+
page.setData(data);
97+
page.show();
9598
}
9699
});
97100
}

mobile-war/src/main/java/org/silverpeas/mobile/client/apps/sharesbox/resources/ShareMessages.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,19 @@
2828

2929
public interface ShareMessages extends Messages {
3030
String title();
31-
31+
String shareOf();
3232
String delete();
3333

3434

3535
String deleteConfirmation();
36+
37+
String creationDate();
38+
39+
String name();
40+
41+
String nbAccess();
42+
43+
String link();
44+
45+
String active();
3646
}

mobile-war/src/main/java/org/silverpeas/mobile/client/apps/sharesbox/resources/ShareMessages.properties

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,11 @@
2424

2525
title=Mes partages
2626
delete=Supprimer
27-
deleteConfirmation=Etes-vous sûr de supprimer ces partages ?
27+
deleteConfirmation=Etes-vous sûr de supprimer ces partages ?
28+
shareOf=Partage de
29+
30+
creationDate=Date de création
31+
name=Nom
32+
nbAccess=Nombre d\''accès
33+
link=Lien
34+
active=Actif

mobile-war/src/main/java/org/silverpeas/mobile/client/apps/sharesbox/resources/ShareMessages_en.properties

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,11 @@
2424

2525
title=My tickets
2626
delete=Delete
27-
deleteConfirmation=Delete those shares ?
27+
deleteConfirmation=Delete those shares ?
28+
shareOf=Sharing
29+
30+
creationDate=Creation date
31+
name=Name
32+
nbAccess=Access number
33+
link=Link
34+
active=Active

mobile-war/src/main/java/org/silverpeas/mobile/client/apps/sharesbox/resources/ShareMessages_fr.properties

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,11 @@
2424

2525
title=Mes partages
2626
delete=Supprimer
27-
deleteConfirmation=Etes-vous sûr de supprimer ces partages ?
27+
deleteConfirmation=Etes-vous sûr de supprimer ces partages ?
28+
shareOf=Partage de
29+
30+
creationDate=Date de création
31+
name=Nom
32+
nbAccess=Nombre d\''accès
33+
link=Lien
34+
active=Actif

mobile-war/src/main/java/org/silverpeas/mobile/client/common/network/NetworkHelper.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ private static native boolean isNetworkDetectionAvailable() /*-{
8383
return (connection == null);
8484
}-*/;
8585

86+
public static native String getHostname() /*-{
87+
return "https://" + location.hostname;
88+
}-*/;
89+
8690
public static native boolean isOnline() /*-{
8791
var connection = window.navigator.onLine;
8892
return connection;

mobile-war/src/main/java/org/silverpeas/mobile/public/spmobile.css

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3218,6 +3218,27 @@ a.popin-btn {
32183218
background-color: var(--white);
32193219
}
32203220

3221+
.field-share {
3222+
padding-top: 1em;
3223+
padding-left: 1em;
3224+
}
3225+
3226+
.header-share, .field-link-share {
3227+
background-color: var(--white);
3228+
margin: 1em;
3229+
padding-bottom: 1em;
3230+
}
3231+
3232+
.field-infos-share {
3233+
margin: 1em;
3234+
}
3235+
3236+
.field-link-share a {
3237+
overflow: hidden;
3238+
text-overflow: clip;
3239+
display: block;
3240+
}
3241+
32213242
/********* favorites **************/
32223243
.favorite-desc {
32233244
display: block;

0 commit comments

Comments
 (0)