Repository: openmeetings
Updated Branches:
  refs/heads/master 3d1f10f6b -> 079f92c04


[OPENMEETINGS-1714] more issues are fixed


Project: http://git-wip-us.apache.org/repos/asf/openmeetings/repo
Commit: http://git-wip-us.apache.org/repos/asf/openmeetings/commit/079f92c0
Tree: http://git-wip-us.apache.org/repos/asf/openmeetings/tree/079f92c0
Diff: http://git-wip-us.apache.org/repos/asf/openmeetings/diff/079f92c0

Branch: refs/heads/master
Commit: 079f92c04b8157253ada4cfafe9fe5fd1c675676
Parents: 3d1f10f
Author: Maxim Solodovnik <[email protected]>
Authored: Fri Oct 13 21:34:19 2017 +0700
Committer: Maxim Solodovnik <[email protected]>
Committed: Fri Oct 13 21:34:19 2017 +0700

----------------------------------------------------------------------
 .../core/converter/BaseConverter.java           |   3 +-
 .../openmeetings/db/dto/room/Whiteboard.java    |   6 +-
 .../openmeetings/backup/BackupImport.java       | 256 +++++++++----------
 .../backup/converter/WbConverter.java           |  58 +++--
 .../web/room/RoomResourceReference.java         |   3 +-
 .../openmeetings/web/room/wb/WbPanel.java       |  21 +-
 .../openmeetings/web/room/wb/tool-text.js       |   1 -
 .../web/user/dashboard/WelcomeWidgetView.java   |   1 -
 8 files changed, 180 insertions(+), 169 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/openmeetings/blob/079f92c0/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/BaseConverter.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/BaseConverter.java
 
b/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/BaseConverter.java
index 439f3d7..85c8200 100644
--- 
a/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/BaseConverter.java
+++ 
b/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/BaseConverter.java
@@ -377,7 +377,7 @@ public abstract class BaseConverter {
                                "-c:a", "libfaac",
                                "-c:a", "libfdk_aac",
                                "-ar", "22050",
-                               "-b:a", "32k", //TODO add quality constants
+                               "-b:a", "32k",
                                "-s", getDimensions(r), //
                                mp4path
                                ));
@@ -385,7 +385,6 @@ public abstract class BaseConverter {
        }
 
        protected String convertToMp4(Recording r, List<String> _argv, 
List<ProcessResult> returnLog) throws IOException {
-               //TODO add faststart, move filepaths to helpers
                String mp4path = r.getFile().getCanonicalPath();
                List<String> argv = new 
ArrayList<>(Arrays.asList(getPathToFFMPEG(), "-y"));
                argv.addAll(_argv);

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/079f92c0/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/Whiteboard.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/Whiteboard.java
 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/Whiteboard.java
index 6b375c2..404d409 100644
--- 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/Whiteboard.java
+++ 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/Whiteboard.java
@@ -33,6 +33,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 
+import org.apache.openmeetings.db.entity.file.FileItem;
 import org.apache.openmeetings.util.NullStringer;
 import org.red5.logging.Red5LoggerFactory;
 import org.slf4j.Logger;
@@ -43,6 +44,9 @@ import com.github.openjson.JSONObject;
 public class Whiteboard implements Serializable {
        private static final long serialVersionUID = 1L;
        private static final Logger log = 
Red5LoggerFactory.getLogger(Whiteboard.class, getWebAppRootKey());
+       public static final String ATTR_TYPE = "type";
+       public static final String ATTR_FILE_ID = "fileId";
+       public static final String ATTR_FILE_TYPE = "fileType";
        public enum ZoomMode {
                fullFit
                , pageWidth
@@ -125,7 +129,7 @@ public class Whiteboard implements Serializable {
                JSONArray arr = new JSONArray();
                roomItems.entrySet().removeIf(e -> {
                                JSONObject o = new JSONObject(e.getValue());
-                               boolean match = 
!"Presentation".equals(o.optString("fileType")) && o.optInt("slide", -1) == 
slide;
+                               boolean match = 
!FileItem.Type.Presentation.name().equals(o.optString(ATTR_FILE_TYPE)) && 
o.optInt("slide", -1) == slide;
                                if (match) {
                                        arr.put(e);
                                }

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/079f92c0/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
 
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
index 65c52e6..49a78e6 100644
--- 
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
+++ 
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
@@ -435,7 +435,7 @@ public class BackupImport {
                FileUtils.deleteDirectory(f);
        }
 
-       private BackupVersion getVersion(Serializer ser, File f) throws 
Exception {
+       private static BackupVersion getVersion(Serializer ser, File f) throws 
Exception {
                List<BackupVersion> list = readList(ser, f, "version.xml", 
"version", BackupVersion.class, true);
                return list.isEmpty() ? new BackupVersion() : list.get(0);
        }
@@ -446,7 +446,7 @@ public class BackupImport {
        private void importConfigs(File f) throws Exception {
                Registry registry = new Registry();
                Strategy strategy = new RegistryStrategy(registry);
-               RegistryMatcher matcher = new RegistryMatcher(); //TODO need to 
be removed in the later versions
+               RegistryMatcher matcher = new RegistryMatcher();
                Serializer serializer = new Persister(strategy, matcher);
 
                matcher.bind(Long.class, LongTransform.class);
@@ -890,7 +890,7 @@ public class BackupImport {
                log.info("File explorer item import complete, starting room 
poll import");
                Registry registry = new Registry();
                Strategy strategy = new RegistryStrategy(registry);
-               RegistryMatcher matcher = new RegistryMatcher(); //TODO need to 
be removed in the later versions
+               RegistryMatcher matcher = new RegistryMatcher();
                Serializer serializer = new Persister(strategy, matcher);
 
                matcher.bind(Integer.class, IntegerTransform.class);
@@ -989,6 +989,126 @@ public class BackupImport {
                return null;
        }
 
+       public List<User> readUserList(InputStream xml, String listNodeName) 
throws Exception {
+               return readUserList(new InputSource(xml), listNodeName);
+       }
+
+       public List<User> readUserList(File baseDir, String fileName, String 
listNodeName) throws Exception {
+               File xml = new File(baseDir, fileName);
+               if (!xml.exists()) {
+                       throw new BackupException(fileName + " missing");
+               }
+
+               return readUserList(new 
InputSource(xml.toURI().toASCIIString()), listNodeName);
+       }
+
+       private static Long getProfileId(File f) {
+               String n = f.getName();
+               if (n.indexOf(PROFILES_PREFIX) > -1) {
+                       return 
importLongType(n.substring(PROFILES_PREFIX.length()));
+               }
+               return null;
+       }
+
+       private void importFolders(File importBaseDir) throws IOException {
+               // Now check the room files and import them
+               File roomFilesFolder = new File(importBaseDir, BCKP_ROOM_FILES);
+
+               File uploadDir = getUploadDir();
+
+               log.debug("roomFilesFolder PATH " + 
roomFilesFolder.getCanonicalPath());
+
+               if (roomFilesFolder.exists()) {
+                       for (File file : roomFilesFolder.listFiles()) {
+                               if (file.isDirectory()) {
+                                       String fName = file.getName();
+                                       if (PROFILES_DIR.equals(fName)) {
+                                               // profile should correspond to 
the new user id
+                                               for (File profile : 
file.listFiles()) {
+                                                       Long oldId = 
getProfileId(profile);
+                                                       Long id = oldId != null 
? userMap.get(oldId) : null;
+                                                       if (id != null) {
+                                                               
FileUtils.copyDirectory(profile, getUploadProfilesUserDir(id));
+                                                       }
+                                               }
+                                       } else if (FILES_DIR.equals(fName)) {
+                                               log.debug("Entered FILES folder 
");
+                                               for (File rf : 
file.listFiles()) {
+                                                       // going to fix images
+                                                       if (rf.isFile() && 
rf.getName().endsWith(EXTENSION_JPG)) {
+                                                               
FileUtils.copyFileToDirectory(rf, getImgDir(rf.getName()));
+                                                       } else {
+                                                               
FileUtils.copyDirectory(rf, new File(getUploadFilesDir(), rf.getName()));
+                                                       }
+                                               }
+                                       } else {
+                                               // check if folder is room 
folder, store it under new id if necessary
+                                               Long oldId = 
importLongType(fName);
+                                               Long id = oldId != null ? 
roomMap.get(oldId) : null;
+                                               if (id != null) {
+                                                       
FileUtils.copyDirectory(file, getUploadRoomDir(id.toString()));
+                                               } else {
+                                                       
FileUtils.copyDirectory(file, new File(uploadDir, fName));
+                                               }
+                                       }
+                               }
+                       }
+               }
+
+               // Now check the recordings and import them
+               File recDir = new File(importBaseDir, BCKP_RECORD_FILES);
+               log.debug("sourceDirRec PATH " + recDir.getCanonicalPath());
+               if (recDir.exists()) {
+                       for (File r : recDir.listFiles()) {
+                               String n = fileMap.get(r.getName());
+                               if (n != null) {
+                                       FileUtils.copyFile(r, new 
File(getStreamsHibernateDir(), n));
+                               } else {
+                                       FileUtils.copyFileToDirectory(r, 
getStreamsHibernateDir());
+                               }
+                       }
+               }
+       }
+
+       private static File getImgDir(String name) {
+               int start = name.startsWith(THUMB_IMG_PREFIX) ? 
THUMB_IMG_PREFIX.length() : 0;
+               String hash = name.substring(start, name.length() - 
EXTENSION_JPG.length() - 1);
+               return new File(getUploadFilesDir(), hash);
+       }
+
+       private static Long importLongType(String value) {
+               Long val = null;
+               try {
+                       val = Long.valueOf(value);
+               } catch (Exception e) {
+                       // no-op
+               }
+               return val;
+       }
+
+       private static String getCountry(String countryId) {
+               if (countries.isEmpty()) {
+                       try (InputStream is = 
BackupImport.class.getResourceAsStream("countries.properties")) {
+                               countries.load(is);
+                       } catch (IOException e) {
+                               log.error("Unexpected exception during 
countries import", e);
+                       }
+               }
+               return countries.getProperty(String.format("country.%s", 
countryId));
+       }
+
+       private void convertOldPresentation(FileItem fi) {
+               File f = fi.getOriginal();
+               if (f != null && f.exists()) {
+                       try {
+                               StoredFile sf = new StoredFile(fi.getHash(), 
getFileExt(f.getName()), f);
+                               docConverter.convertPDF(fi, sf);
+                       } catch (Exception e) {
+                               log.error("Unexpected exception while 
converting OLD format presentations", e);
+                       }
+               }
+       }
+
        //TODO (need to be removed in later versions) HACK to fix old properties
        public List<FileItem> readFileItemList(File baseDir, String fileName, 
String listNodeName) throws Exception {
                List<FileItem> list = new ArrayList<>();
@@ -996,7 +1116,7 @@ public class BackupImport {
                if (xml.exists()) {
                        Registry registry = new Registry();
                        Strategy strategy = new RegistryStrategy(registry);
-                       RegistryMatcher matcher = new RegistryMatcher(); //TODO 
need to be removed in the later versions
+                       RegistryMatcher matcher = new RegistryMatcher();
                        Serializer ser = new Persister(strategy, matcher);
 
                        matcher.bind(Long.class, LongTransform.class);
@@ -1068,14 +1188,13 @@ public class BackupImport {
                return list;
        }
 
-       //TODO (need to be removed in later versions) HACK to fix old properties
        public List<Recording> readRecordingList(File baseDir, String fileName, 
String listNodeName) throws Exception {
                List<Recording> list = new ArrayList<>();
                File xml = new File(baseDir, fileName);
                if (xml.exists()) {
                        Registry registry = new Registry();
                        Strategy strategy = new RegistryStrategy(registry);
-                       RegistryMatcher matcher = new RegistryMatcher(); //TODO 
need to be removed in the later versions
+                       RegistryMatcher matcher = new RegistryMatcher();
                        Serializer ser = new Persister(strategy, matcher);
 
                        matcher.bind(Long.class, LongTransform.class);
@@ -1117,20 +1236,6 @@ public class BackupImport {
                return list;
        }
 
-       public List<User> readUserList(InputStream xml, String listNodeName) 
throws Exception {
-               return readUserList(new InputSource(xml), listNodeName);
-       }
-
-       public List<User> readUserList(File baseDir, String fileName, String 
listNodeName) throws Exception {
-               File xml = new File(baseDir, fileName);
-               if (!xml.exists()) {
-                       throw new BackupException(fileName + " missing");
-               }
-
-               return readUserList(new 
InputSource(xml.toURI().toASCIIString()), listNodeName);
-       }
-
-       //TODO (need to be removed in later versions) HACK to add external 
attendees previously stored in MeetingMember structure
        private List<MeetingMember> readMeetingMemberList(File baseDir, String 
filename, String listNodeName) throws Exception {
                Registry registry = new Registry();
                Strategy strategy = new RegistryStrategy(registry);
@@ -1206,7 +1311,6 @@ public class BackupImport {
                return list;
        }
 
-       //TODO (need to be removed in later versions) HACK to fix 2 deleted 
nodes in users.xml and inline Address and sipData
        private List<User> readUserList(InputSource xml, String listNodeName) 
throws Exception {
                Registry registry = new Registry();
                Strategy strategy = new RegistryStrategy(registry);
@@ -1349,14 +1453,13 @@ public class BackupImport {
                return list;
        }
 
-       //TODO (need to be removed in later versions) HACK to fix old properties
        private List<Room> readRoomList(File baseDir, String fileName, String 
listNodeName) throws Exception {
                List<Room> list = new ArrayList<>();
                File xml = new File(baseDir, fileName);
                if (xml.exists()) {
                        Registry registry = new Registry();
                        Strategy strategy = new RegistryStrategy(registry);
-                       RegistryMatcher matcher = new RegistryMatcher(); //TODO 
need to be removed in the later versions
+                       RegistryMatcher matcher = new RegistryMatcher();
                        Serializer ser = new Persister(strategy, matcher);
 
                        matcher.bind(Long.class, LongTransform.class);
@@ -1418,111 +1521,4 @@ public class BackupImport {
                }
                return list;
        }
-
-       private static Long getProfileId(File f) {
-               String n = f.getName();
-               if (n.indexOf(PROFILES_PREFIX) > -1) {
-                       return 
importLongType(n.substring(PROFILES_PREFIX.length()));
-               }
-               return null;
-       }
-
-       private void importFolders(File importBaseDir) throws IOException {
-               // Now check the room files and import them
-               File roomFilesFolder = new File(importBaseDir, BCKP_ROOM_FILES);
-
-               File uploadDir = getUploadDir();
-
-               log.debug("roomFilesFolder PATH " + 
roomFilesFolder.getCanonicalPath());
-
-               if (roomFilesFolder.exists()) {
-                       for (File file : roomFilesFolder.listFiles()) {
-                               if (file.isDirectory()) {
-                                       String fName = file.getName();
-                                       if (PROFILES_DIR.equals(fName)) {
-                                               // profile should correspond to 
the new user id
-                                               for (File profile : 
file.listFiles()) {
-                                                       Long oldId = 
getProfileId(profile);
-                                                       Long id = oldId != null 
? userMap.get(oldId) : null;
-                                                       if (id != null) {
-                                                               
FileUtils.copyDirectory(profile, getUploadProfilesUserDir(id));
-                                                       }
-                                               }
-                                       } else if (FILES_DIR.equals(fName)) {
-                                               log.debug("Entered FILES folder 
");
-                                               for (File rf : 
file.listFiles()) {
-                                                       // going to fix images
-                                                       if (rf.isFile() && 
rf.getName().endsWith(EXTENSION_JPG)) {
-                                                               
FileUtils.copyFileToDirectory(rf, getImgDir(rf.getName()));
-                                                       } else {
-                                                               
FileUtils.copyDirectory(rf, new File(getUploadFilesDir(), rf.getName()));
-                                                       }
-                                               }
-                                       } else {
-                                               // check if folder is room 
folder, store it under new id if necessary
-                                               Long oldId = 
importLongType(fName);
-                                               Long id = oldId != null ? 
roomMap.get(oldId) : null;
-                                               if (id != null) {
-                                                       
FileUtils.copyDirectory(file, getUploadRoomDir(id.toString()));
-                                               } else {
-                                                       
FileUtils.copyDirectory(file, new File(uploadDir, fName));
-                                               }
-                                       }
-                               }
-                       }
-               }
-
-               // Now check the recordings and import them
-               File recDir = new File(importBaseDir, BCKP_RECORD_FILES);
-               log.debug("sourceDirRec PATH " + recDir.getCanonicalPath());
-               if (recDir.exists()) {
-                       for (File r : recDir.listFiles()) {
-                               String n = fileMap.get(r.getName());
-                               if (n != null) {
-                                       FileUtils.copyFile(r, new 
File(getStreamsHibernateDir(), n));
-                               } else {
-                                       FileUtils.copyFileToDirectory(r, 
getStreamsHibernateDir());
-                               }
-                       }
-               }
-       }
-
-       private static File getImgDir(String name) {
-               int start = name.startsWith(THUMB_IMG_PREFIX) ? 
THUMB_IMG_PREFIX.length() : 0;
-               String hash = name.substring(start, name.length() - 
EXTENSION_JPG.length() - 1);
-               return new File(getUploadFilesDir(), hash);
-       }
-
-       private static Long importLongType(String value) {
-               Long val = null;
-               try {
-                       val = Long.valueOf(value);
-               } catch (Exception e) {
-                       // no-op
-               }
-               return val;
-       }
-
-       private static String getCountry(String countryId) {
-               if (countries.isEmpty()) {
-                       try (InputStream is = 
BackupImport.class.getResourceAsStream("countries.properties")) {
-                               countries.load(is);
-                       } catch (IOException e) {
-                               log.error("Unexpected exception during 
countries import", e);
-                       }
-               }
-               return countries.getProperty(String.format("country.%s", 
countryId));
-       }
-
-       private void convertOldPresentation(FileItem fi) {
-               File f = fi.getOriginal();
-               if (f != null && f.exists()) {
-                       try {
-                               StoredFile sf = new StoredFile(fi.getHash(), 
getFileExt(f.getName()), f);
-                               docConverter.convertPDF(fi, sf);
-                       } catch (Exception e) {
-                               log.error("Unexpected exception while 
converting OLD format presentations", e);
-                       }
-               }
-       }
 }

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/079f92c0/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/WbConverter.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/WbConverter.java
 
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/WbConverter.java
index 4040b9b..023d6c9 100644
--- 
a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/WbConverter.java
+++ 
b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/converter/WbConverter.java
@@ -20,6 +20,9 @@ package org.apache.openmeetings.backup.converter;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.apache.commons.lang3.math.NumberUtils.toLong;
+import static org.apache.openmeetings.db.dto.room.Whiteboard.ATTR_FILE_ID;
+import static org.apache.openmeetings.db.dto.room.Whiteboard.ATTR_FILE_TYPE;
+import static org.apache.openmeetings.db.dto.room.Whiteboard.ATTR_TYPE;
 import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_WML;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
 
@@ -49,9 +52,16 @@ import com.thoughtworks.xstream.io.xml.XppDriver;
 
 public class WbConverter {
        private static final Logger log = 
Red5LoggerFactory.getLogger(WbConverter.class, getWebAppRootKey());
+       private static final String ATTR_STROKE = "strokeWidth";
+       private static final String ATTR_OPACITY = "opacity";
+       private static final String TYPE_IMAGE = "image";
+
+       private WbConverter() {
+               //should not be used
+       }
 
        private static String getColor(int val) {
-               return String.format("#%06X", (0xFFFFFF & val));
+               return String.format("#%06X", 0xFFFFFF & val);
        }
 
        private static void add(Whiteboard wb, JSONObject o) {
@@ -91,7 +101,7 @@ public class WbConverter {
                String color = getColor((Integer)props.get(2));
                String style = (String)props.get(4);
                JSONObject o = setColor(init(wb, props), color, color)
-                               .put("type", "i-text")
+                               .put(ATTR_TYPE, "i-text")
                                .put("text", props.get(1))
                                .put("fontSize", props.get(3));
                if (style.indexOf("bold") > -1) {
@@ -109,8 +119,8 @@ public class WbConverter {
                }
                String color = getColor((Integer)props.get(4));
                JSONObject o = setColor(init(wb, props), color, null)
-                               .put("type", "path")
-                               .put("strokeWidth", props.get(3));
+                               .put(ATTR_TYPE, "path")
+                               .put(ATTR_STROKE, props.get(3));
                @SuppressWarnings("unchecked")
                List<List<?>> points = (List<List<?>>)props.get(1);
                JSONArray path = new JSONArray();
@@ -125,7 +135,7 @@ public class WbConverter {
                                                , (Integer)point.get(3), 
(Integer)point.get(4))));
                        }
                }
-               add(wb, o.put("path", path).put("opacity", props.get(5)));
+               add(wb, o.put("path", path).put(ATTR_OPACITY, props.get(5)));
        }
 
        private static void processLine(Whiteboard wb, List<?> props) {
@@ -134,9 +144,9 @@ public class WbConverter {
                }
                String color = getColor((Integer)props.get(1));
                add(wb, setColor(init(wb, props), color, color)
-                               .put("type", "line")
-                               .put("strokeWidth", props.get(2))
-                               .put("opacity", props.get(3))
+                               .put(ATTR_TYPE, "line")
+                               .put(ATTR_STROKE, props.get(2))
+                               .put(ATTR_OPACITY, props.get(3))
                                .put("x1", props.get(4))
                                .put("y1", props.get(5))
                                .put("x2", props.get(6))
@@ -150,15 +160,15 @@ public class WbConverter {
                return setColor(init(wb, props)
                                        , 1 == (Integer)props.get(4) ? 
getColor((Integer)props.get(1)) : null
                                        , 1 == (Integer)props.get(5) ? 
getColor((Integer)props.get(3)) : null)
-                               .put("type", "rect")
-                               .put("strokeWidth", props.get(2))
-                               .put("opacity", props.get(6));
+                               .put(ATTR_TYPE, "rect")
+                               .put(ATTR_STROKE, props.get(2))
+                               .put(ATTR_OPACITY, props.get(6));
        }
 
        private static void processEllipse(Whiteboard wb, List<?> props) {
                JSONObject o = processRect(wb, props);
                if (o != null) {
-                       o.put("type", "ellipse")
+                       o.put(ATTR_TYPE, "ellipse")
                                .put("rx", o.getDouble("width") / 2)
                                .put("ry", o.getDouble("height") / 2);
                        add(wb, o);
@@ -175,7 +185,7 @@ public class WbConverter {
                        src = String.format("./public/%s", src.substring(idx));
                }
                add(wb, init(wb, props)
-                       .put("type", "image")
+                       .put(ATTR_TYPE, TYPE_IMAGE)
                        .put("omType", "Clipart")
                        .put("_src", src)
                        .put("angle", props.get(3)));
@@ -199,9 +209,9 @@ public class WbConverter {
                        return;
                }
                add(wb, init(wb, props)
-                       .put("type", "image")
-                       .put("fileType", BaseFileItem.Type.Image.name())
-                       .put("fileId", fileId));
+                       .put(ATTR_TYPE, TYPE_IMAGE)
+                       .put(ATTR_FILE_TYPE, BaseFileItem.Type.Image.name())
+                       .put(ATTR_FILE_ID, fileId));
        }
 
        private static void processDoc(Whiteboard wb, List<?> props) {
@@ -213,9 +223,9 @@ public class WbConverter {
                        return;
                }
                add(wb, init(wb, props, false)
-                       .put("type", "image")
-                       .put("fileType", BaseFileItem.Type.Presentation.name())
-                       .put("fileId", fileId));
+                       .put(ATTR_TYPE, TYPE_IMAGE)
+                       .put(ATTR_FILE_TYPE, 
BaseFileItem.Type.Presentation.name())
+                       .put(ATTR_FILE_ID, fileId));
        }
 
        private static void processVid(Whiteboard wb, List<?> props) {
@@ -223,9 +233,9 @@ public class WbConverter {
                        return;
                }
                add(wb, init(wb, props)
-                       .put("type", "image")
-                       .put("fileType", BaseFileItem.Type.Video.name())
-                       .put("fileId", props.get(1)));
+                       .put(ATTR_TYPE, TYPE_IMAGE)
+                       .put(ATTR_FILE_TYPE, BaseFileItem.Type.Video.name())
+                       .put(ATTR_FILE_ID, props.get(1)));
        }
 
        public static Whiteboard convert(FileItem fi) {
@@ -236,7 +246,7 @@ public class WbConverter {
                List<?> wml = loadWmlFile(fi.getHash());
                for (Object wo : wml) {
                        List<?> props = (List<?>)wo;
-                       if (props.size() > 0) {
+                       if (!props.isEmpty()) {
                                String uid = (String)props.get(props.size() - 
1);
                                if (uids.contains(uid)) {
                                        continue;
@@ -263,7 +273,7 @@ public class WbConverter {
                                        case "clipart":
                                                processClipart(wb, props);
                                                break;
-                                       case "image":
+                                       case TYPE_IMAGE:
                                                processImage(wb, props);
                                                break;
                                        case "swf":

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/079f92c0/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java
index 4d6ff44..a004d99 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java
@@ -18,6 +18,7 @@
  */
 package org.apache.openmeetings.web.room;
 
+import static org.apache.openmeetings.db.dto.room.Whiteboard.ATTR_FILE_ID;
 import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_JPG;
 import static org.apache.openmeetings.util.OmFileHelper.JPG_MIME_TYPE;
 import static org.apache.openmeetings.util.OmFileHelper.MP4_MIME_TYPE;
@@ -104,7 +105,7 @@ public class RoomResourceReference extends 
FileItemResourceReference<FileItem> {
                        if (!Strings.isEmpty(wuid) && !Strings.isEmpty(ruid) && 
ruid.equals(wbs.getUid())) {
                                for (Entry<Long, Whiteboard> e : 
wbs.getWhiteboards().entrySet()) {
                                        JSONObject file = 
e.getValue().get(wuid);
-                                       if (file != null && 
f.getId().equals(file.optLong("fileId"))) {
+                                       if (file != null && 
f.getId().equals(file.optLong(ATTR_FILE_ID))) {
                                                return f; // item IS on WB
                                        }
                                }

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/079f92c0/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
index f2f7d80..32cdeac 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
@@ -18,6 +18,9 @@
  */
 package org.apache.openmeetings.web.room.wb;
 
+import static org.apache.openmeetings.db.dto.room.Whiteboard.ATTR_FILE_ID;
+import static org.apache.openmeetings.db.dto.room.Whiteboard.ATTR_FILE_TYPE;
+import static org.apache.openmeetings.db.dto.room.Whiteboard.ATTR_TYPE;
 import static org.apache.openmeetings.db.dto.room.Whiteboard.ITEMS_KEY;
 import static org.apache.openmeetings.util.OpenmeetingsVariables.ATTR_CLASS;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.getWebAppRootKey;
@@ -223,7 +226,7 @@ public class WbPanel extends AbstractWbPanel {
                        case modifyObj:
                        {
                                JSONObject o = obj.optJSONObject("obj");
-                               if (o != null && 
"pointer".equals(o.getString("type"))) {
+                               if (o != null && 
"pointer".equals(o.getString(ATTR_TYPE))) {
                                        sendWbOthers(a, obj);
                                        return;
                                }
@@ -263,7 +266,7 @@ public class WbPanel extends AbstractWbPanel {
                                for (Entry<Long, Whiteboard> entry : 
WhiteboardCache.list(roomId, rp.getClient().getUser().getLanguageId())) {
                                        Whiteboard wb = entry.getValue();
                                        for (JSONObject o : wb.list()) {
-                                               String ft = 
o.optString("fileType");
+                                               String ft = 
o.optString(ATTR_FILE_TYPE);
                                                if 
(BaseFileItem.Type.Recording.name().equals(ft) || 
BaseFileItem.Type.Video.name().equals(ft)) {
                                                        JSONObject _sts = 
o.optJSONObject("status");
                                                        if (_sts == null) {
@@ -455,7 +458,7 @@ public class WbPanel extends AbstractWbPanel {
                                        Whiteboard wb = 
WhiteboardCache.get(roomId).get(obj.getLong("wbId"));
                                        String uid = obj.getString("uid");
                                        JSONObject po = wb.get(uid);
-                                       if (po != null && 
"video".equals(po.getString("type"))) {
+                                       if (po != null && 
"video".equals(po.getString(ATTR_TYPE))) {
                                                JSONObject ns = 
obj.getJSONObject("status");
                                                po.put("status", 
ns.put("updated", System.currentTimeMillis()));
                                                WhiteboardCache.update(roomId, 
wb.put(uid, po));
@@ -496,9 +499,9 @@ public class WbPanel extends AbstractWbPanel {
 
        private JSONObject addFileUrl(String ruid, JSONObject _file, 
Consumer<BaseFileItem> consumer) {
                try {
-                       final long fid = _file.optLong("fileId", -1);
+                       final long fid = _file.optLong(ATTR_FILE_ID, -1);
                        if (fid > 0) {
-                               BaseFileItem fi = 
FileItem.Type.Recording.name().equals(_file.optString("fileType"))
+                               BaseFileItem fi = 
FileItem.Type.Recording.name().equals(_file.optString(ATTR_FILE_TYPE))
                                                ? 
getBean(RecordingDao.class).get(fid)
                                                : 
getBean(FileItemDao.class).get(fid);
                                if (fi != null) {
@@ -585,10 +588,10 @@ public class WbPanel extends AbstractWbPanel {
                                default:
                                {
                                        JSONObject file = new JSONObject()
-                                                       .put("fileId", 
fi.getId())
-                                                       .put("fileType", 
fi.getType().name())
+                                                       .put(ATTR_FILE_ID, 
fi.getId())
+                                                       .put(ATTR_FILE_TYPE, 
fi.getType().name())
                                                        .put("count", 
fi.getCount())
-                                                       .put("type", "image")
+                                                       .put(ATTR_TYPE, "image")
                                                        .put("left", 
UPLOAD_WB_LEFT)
                                                        .put("top", 
UPLOAD_WB_TOP)
                                                        .put("width", 
fi.getWidth() == null ? DEFAULT_WIDTH : fi.getWidth())
@@ -597,7 +600,7 @@ public class WbPanel extends AbstractWbPanel {
                                                        .put("slide", 
wb.getSlide())
                                                        ;
                                        if (FileItem.Type.Video == fi.getType() 
|| FileItem.Type.Recording == fi.getType()) {
-                                               file.put("type", "video");
+                                               file.put(ATTR_TYPE, "video");
                                                file.put("status", new 
JSONObject()
                                                                .put("paused", 
true)
                                                                .put("pos", 0.0)

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/079f92c0/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/tool-text.js
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/tool-text.js
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/tool-text.js
index 703ecc3..9705324 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/tool-text.js
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/tool-text.js
@@ -6,7 +6,6 @@ var Text = function(wb, s) {
        text.stroke.width = 12; //fontSize
        text.stroke.color = '#000000';
        text.style = {bold: false, italic: false};
-       //TODO font size, background color
 
        text.mouseDown = function(o) {
                const canvas = this

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/079f92c0/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/dashboard/WelcomeWidgetView.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/dashboard/WelcomeWidgetView.java
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/dashboard/WelcomeWidgetView.java
index 7bbff60..80ba6c7 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/dashboard/WelcomeWidgetView.java
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/dashboard/WelcomeWidgetView.java
@@ -49,7 +49,6 @@ public class WelcomeWidgetView extends WidgetView {
 
                User u = getBean(UserDao.class).get(getUserId());
                add(new UploadableProfileImagePanel("img", getUserId()));
-               //TODO this need to be aligned according to Locale
                add(new Label("firstname", Model.of(u.getFirstname())));
                add(new Label("lastname", Model.of(u.getLastname())));
                add(new Label("tz", Model.of(u.getTimeZoneId())));

Reply via email to