Skip to content

Commit f03f957

Browse files
committed
Fix code missing during merge.
1 parent d19300b commit f03f957

2 files changed

Lines changed: 19 additions & 15 deletions

File tree

blockstore/src/org/model/DBHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public void contextInitialized(ServletContextEvent servletContextEvent) {
6464
e.printStackTrace();
6565
}
6666
createBookTable();
67+
createUserTable();
6768
createUserTablesTable();
6869
}
6970

webapp/src/org/zkoss/zss/app/ui/AppCtrl.java

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
*/
1212
package org.zkoss.zss.app.ui;
1313

14-
//import com.sun.org.glassfish.external.statistics.RangeStatistic;
1514
import org.zkoss.image.AImage;
1615
import org.zkoss.lang.Library;
1716
import org.zkoss.lang.Strings;
@@ -71,13 +70,14 @@
7170
import java.util.Date;
7271

7372
/**
73+
*
7474
* @author dennis
75+
*
7576
*/
76-
7777
public class AppCtrl extends CtrlBase<Component> {
78+
public static final String ZSS_USERNAME = "zssUsername";
7879
private static final Log log = Log.lookup(AppCtrl.class);
7980
private static final long serialVersionUID = 1L;
80-
public static final String ZSS_USERNAME = "zssUsername";
8181
private static final String UNSAVED_MESSAGE = "Do you want to leave this book without save??";
8282
private static final String UTF8 = "UTF-8";
8383
private static final boolean DISABLE_BOOKMARK = Boolean.valueOf(Library.getProperty("zssapp.bookmark.disable", "false"));
@@ -86,7 +86,6 @@ public class AppCtrl extends CtrlBase<Component> {
8686
private static BookRepository repo = BookRepositoryFactory.getInstance().getRepository();
8787
private static CollaborationInfo collaborationInfo = CollaborationInfoImpl.getInstance();
8888
private static BookManager bookManager = BookManagerImpl.getInstance(repo);
89-
private ModelEventListener dirtyChangeEventListener;
9089

9190
static {
9291
collaborationInfo.addEvent(new CollaborationEventListener() {
@@ -112,24 +111,19 @@ public void onEvent(CollaborationEvent event) {
112111
});
113112
}
114113

115-
private String username;
116-
117114
@Wire
118115
Spreadsheet ss;
119-
120116
@Wire
121117
Script confirmMsgWorkaround;
122-
123118
@Wire
124119
Script gaScript;
125-
126120
@Wire
127121
Html usersPopContent; //ZSS-998
128-
129122
BookInfo selectedBookInfo;
130123
Book loadedBook;
131124
Desktop desktop = Executions.getCurrent().getDesktop();
132-
125+
private ModelEventListener dirtyChangeEventListener;
126+
private String username;
133127
private UnsavedAlertState isNeedUnsavedAlert = UnsavedAlertState.DISABLED;
134128

135129
public AppCtrl() {
@@ -310,6 +304,16 @@ private void initBook() throws UnsupportedEncodingException {
310304

311305
BookInfo bookinfo = getBookInfo(bookName);
312306
String sheetName = Executions.getCurrent().getParameter("sheet");
307+
308+
Cookie[] cookies = ((HttpServletRequest) Executions.getCurrent().getNativeRequest()).getCookies();
309+
if (cookies != null) {
310+
for (Cookie cookie : cookies) {
311+
if (cookie.getName().equals(ZSS_USERNAME)) {
312+
username = cookie.getValue();
313+
break;
314+
}
315+
}
316+
}
313317
if (bookinfo != null) {
314318
doLoadBook(bookinfo, null, sheetName, false);
315319
} else {
@@ -377,8 +381,7 @@ public void onEvent(DlgCallbackEvent event) throws Exception {
377381
return;
378382
}
379383
}
380-
}
381-
}, name, loadedBook, "Save Book for sharing", "Next");
384+
}}, name, loadedBook, "Save Book for sharing", "Next");
382385
} else {
383386
ShareBookCtrl.show();
384387
}
@@ -410,7 +413,7 @@ public void onEvent(DlgCallbackEvent event) throws Exception {
410413
pushAppEvent(AppEvts.ON_AFTER_CHANGED_USERNAME, username);
411414
}
412415
}
413-
}, username == null ? "" : username, message == null ? "" : message);
416+
}, username == null ? "admin" : username, message == null ? "" : message);
414417
} else {
415418
// already in cookie
416419
Cookie[] cookies = ((HttpServletRequest) Executions.getCurrent().getNativeRequest()).getCookies();
@@ -575,7 +578,7 @@ private void doOpenNewBook0(boolean renewState) {
575578
if (renewState)
576579
setBookmark("");
577580

578-
collaborationInfo.removeRelationship(username);
581+
collaborationInfo.setRelationship(username, loadedBook);
579582
ss.setBook(loadedBook);
580583
initSaveNotification(loadedBook);
581584
pushAppEvent(AppEvts.ON_CHANGED_FILE_STATE, BookInfo.STATE_UNSAVED);

0 commit comments

Comments
 (0)