diff --git a/Jenkinsfile b/Jenkinsfile
index 03e3c24..ea3793b 100755
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -27,9 +27,14 @@ node {
}
stage('Deploy') {
- input message: 'Deploy?', submitter: 'ziver'
+ timeout(time:2, unit:'HOURS') {
+ input message: 'Deploy?', submitter: 'ziver'
+ }
node {
- sh 'ant deploy'
+ withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: '46f1d99b-2037-47b9-a7b7-57a1066337fc',
+ usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
+ sh 'ant -Dtomcat.user=${USERNAME} -Dtomcat.pass=${PASSWORD} deploy'
+ }
}
}
diff --git a/WebContent/WEB-INF/web_debug.xml b/WebContent/WEB-INF/web_debug.xml
new file mode 100644
index 0000000..51220ff
--- /dev/null
+++ b/WebContent/WEB-INF/web_debug.xml
@@ -0,0 +1,91 @@
+
+
+ Zallery
+
+
+ gallery
+
+
+
+ Zallery
+ zall.Zallery
+
+ WEBSITE_NAME
+ Koc.se Gallery
+
+
+ WEBSITE_URL
+ http://koc.se/Zallery/
+
+
+ SMTP_HOST
+ 192.168.0.10
+
+
+ THEME
+
+
+
+ DATA_PATH
+ C:\\Users\\Ziver\\Desktop\\Downloads\\temp\\album
+
+ 1
+
+
+ Zallery
+ /gallery
+ /media
+ /slideshow
+ /login
+ /logout
+ /upload
+ /profile
+ /users
+ /register
+
+
+
+ Content
+ zall.ZalleryContent
+
+
+ Content
+ /content
+
+
+
+ Ajax
+ zall.ZalleryAjax
+
+
+ Ajax
+ /ajax
+
+
+
+ Upload
+ zall.UploadServlet
+
+ TEMP_PATH
+ C:\\Users\\Ziver\\Desktop\\Downloads\\temp\\
+
+
+ ALLOWED_EXTENSIONS
+ png,jpg,jpeg,gif,tif,bmp,avi,wmv,mov,mp4,mpeg,flv,m4v,divx,xvid
+
+
+
+ Upload
+ /uploadserv
+
+
+
+ transcoder
+ zall.ZalleryTranscoder
+ 1
+
+
+
+ gallery
+
+
\ No newline at end of file
diff --git a/WebContent/WEB-INF/web_server.xml b/WebContent/WEB-INF/web_server.xml
new file mode 100644
index 0000000..fd41747
--- /dev/null
+++ b/WebContent/WEB-INF/web_server.xml
@@ -0,0 +1,87 @@
+
+
+ Zallery
+
+
+ gallery
+
+
+
+ Zallery
+ zall.Zallery
+
+ WEBSITE_NAME
+ Koc.se Gallery
+
+
+ WEBSITE_URL
+ http://koc.se/Zallery/
+
+
+ SMTP_HOST
+ 192.168.0.10
+
+
+ THEME
+
+
+
+ DATA_PATH
+ /home/tomcat/ZalleryData/
+
+ 1
+
+
+ Zallery
+ /gallery
+ /media
+ /slideshow
+ /login
+ /logout
+ /upload
+ /profile
+ /users
+ /register
+
+
+
+ Content
+ zall.ZalleryContent
+
+
+ Content
+ /content
+
+
+
+ Ajax
+ zall.ZalleryAjax
+
+
+ Ajax
+ /ajax
+
+
+
+ Upload
+ zall.UploadServlet
+
+ ALLOWED_EXTENSIONS
+ png,jpg,jpeg,gif,tif,bmp,avi,wmv,mov,mp4,mpeg,flv,m4v,divx,xvid
+
+
+
+ Upload
+ /uploadserv
+
+
+
+ transcoder
+ zall.ZalleryTranscoder
+ 1
+
+
+
+ gallery
+
+
\ No newline at end of file
diff --git a/WebContent/footer.jsp b/WebContent/footer.jsp
old mode 100644
new mode 100755
index d0f9634..03e6afa
--- a/WebContent/footer.jsp
+++ b/WebContent/footer.jsp
@@ -1,4 +1,4 @@
-
+<%@ page import="zall.*" %>
@@ -17,7 +17,7 @@
Powered by
- Java2EE And Tomcat. Zallery Gallery created by Ziver Koc.
+ Java2EE And Tomcat. Zallery Gallery(v<%=Zallery.VERSION %>) created by Ziver Koc.
Built on the
Gallery WordPress Theme
by
diff --git a/build.xml b/build.xml
index 450401b..d033c56 100755
--- a/build.xml
+++ b/build.xml
@@ -11,7 +11,12 @@
-
+
+
+
+
+
+
@@ -63,11 +68,19 @@
+
+
-
-
+
+
+
+
diff --git a/prototype/css/zallery.css b/prototype/css/zallery.css
index 856c83e..2cb83d8 100755
--- a/prototype/css/zallery.css
+++ b/prototype/css/zallery.css
@@ -6,6 +6,9 @@ body{
margin-top: 40px;
margin-bottom: 40px;
}
+.navbar .action a, .navbar .action span{
+ color: #5a5ada !important;
+}
.photo-thumb, .photo {
padding: 0px;
@@ -18,4 +21,20 @@ body{
.col-center{
float: none;
margin: 0 auto;
+}
+
+.navbar .divider-vertical {
+ height: 40px;
+ margin: 5px 14px;
+ border-right: 2px solid #ffffff;
+ border-left: 2px solid #f2f2f2;
+}
+.navbar-inverse .divider-vertical {
+ border-right-color: #222222;
+ border-left-color: #111111;
+}
+@media (max-width: 767px) {
+ .navbar-collapse .nav > .divider-vertical {
+ display: none;
+ }
}
\ No newline at end of file
diff --git a/prototype/img/folder1.jpg b/prototype/img/folder1.jpg
new file mode 100644
index 0000000..1c8ce4e
Binary files /dev/null and b/prototype/img/folder1.jpg differ
diff --git a/prototype/img/folder2.jpg b/prototype/img/folder2.jpg
new file mode 100644
index 0000000..e0859ae
Binary files /dev/null and b/prototype/img/folder2.jpg differ
diff --git a/prototype/img/folder3.jpg b/prototype/img/folder3.jpg
new file mode 100644
index 0000000..6f2c52f
Binary files /dev/null and b/prototype/img/folder3.jpg differ
diff --git a/prototype/main.html b/prototype/main.html
index 3bb3c82..854e90b 100755
--- a/prototype/main.html
+++ b/prototype/main.html
@@ -2,107 +2,135 @@
-
-
-
-
+
+
+
+
- Koc.se
+ Koc.se
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
+
-
+
-
+
+
+
+
+

+
+

+
+

+
+

+
+

+
+

+
+

+
+

+
+
+
+
-
+
diff --git a/src/zall/UploadServlet.java b/src/zall/UploadServlet.java
index e814c4c..e3e1731 100644
--- a/src/zall/UploadServlet.java
+++ b/src/zall/UploadServlet.java
@@ -30,9 +30,8 @@ public class UploadServlet extends AjaxFileUpload{
private static final Logger logger = LogUtil.getLogger();
private static final long serialVersionUID = 1L;
- public static final Set VIDEO_EXT = Collections.unmodifiableSet(new HashSet(Arrays.asList(new String[]{
- "avi","mp4","mpeg","mpeg","divx","xvid","wmv","mov","flv","m4v"
- })));
+ private static final Set VIDEO_EXT = Collections.unmodifiableSet(new HashSet(Arrays.asList(
+ "avi","mp4","mpeg","mpeg","divx","xvid","wmv","mov","flv","m4v")));
@Override
public String getProgressHTML() {
@@ -76,6 +75,7 @@ public class UploadServlet extends AjaxFileUpload{
vid.setUser( user );
vid.setFile( item );
vid.save(db);
+ logger.info("Video upload successful: "+vid.getFolder().getPath());
}
else{
Image img = new Image();
@@ -83,7 +83,8 @@ public class UploadServlet extends AjaxFileUpload{
img.setFolder( folder );
img.setUser( user );
img.setFile( item );
- img.save(db);
+ img.save(db);
+ logger.info("Image upload successful: "+img.getFolder().getPath());
}
} catch (Exception e) {
logger.log(Level.WARNING, "Error: Creating new Media(\""+item.getName()+"\")", e);
diff --git a/src/zall/Zallery.java b/src/zall/Zallery.java
index 9c366ef..d9c6d7a 100755
--- a/src/zall/Zallery.java
+++ b/src/zall/Zallery.java
@@ -31,7 +31,8 @@ import zutil.log.LogUtil;
public class Zallery extends HttpServlet{
private static Logger logger = LogUtil.getLogger();
- private static final long serialVersionUID = 1L;
+
+ public static final String VERSION = "1.0.2";
public static String WEBSITE_NAME = "Example.com";
public static String WEBSITE_URL = "http://example.com";
@@ -53,7 +54,7 @@ public class Zallery extends HttpServlet{
Context context = new InitialContext();
// Check if Zallery has been properly configured
if ("C:\\\\data".equals(context.lookup("java:comp/env/DATA_PATH")))
- throw new ServletException("Zallery has not been properly configured, set proper configuration in Zaller.xml context file.");
+ throw new ServletException("Zallery has not been properly configured, set proper configuration in Zallery.xml context file.");
WEBSITE_NAME = (String)context.lookup("java:comp/env/WEBSITE_NAME");
WEBSITE_URL = (String)context.lookup("java:comp/env/WEBSITE_URL");
@@ -210,7 +211,7 @@ public class Zallery extends HttpServlet{
}
}
List list = Media.load(db, folder);
- List subFolders = Folder.loadSubFolders(db, folder.getId(), user);
+ List subFolders = Folder.loadSubFolders(db, folder, user);
//session.setAttribute("user", user);
request.setAttribute("folder", folder);
diff --git a/src/zall/bean/Folder.java b/src/zall/bean/Folder.java
index fdb585a..6f4cc36 100755
--- a/src/zall/bean/Folder.java
+++ b/src/zall/bean/Folder.java
@@ -4,8 +4,10 @@ import java.io.File;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Timestamp;
+import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
+import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
@@ -21,25 +23,24 @@ import zall.Zallery;
public class Folder extends DBBean{
private static final Logger logger = LogUtil.getLogger();
- protected transient String name;
- protected User user;
- protected String path;
+ private transient String name;
+ protected long user = -1;
+ protected transient User userInstance;
+ private String path;
protected Folder parent;
- protected Timestamp date;
- protected boolean isPrivate;
+ protected Timestamp date;
+ private boolean isPrivate;
- //@DBLinkTable(name="FolderTree", beanClass=Folder.class, idColumn="parent")
- //protected LinkedList subFolders;
public static Folder load(DBConnection db, Long id) throws SQLException{
return load(db, Folder.class, id);
}
- public static List loadSubFolders(DBConnection db, Long id, User user) throws SQLException{
+ public static List loadSubFolders(DBConnection db, Folder folder, User requestingUser) throws SQLException{
PreparedStatement sql = db.getPreparedStatement("SELECT * FROM Folder WHERE parent=? AND (isPrivate=0 OR user=? OR ?)");
- sql.setLong(1, id);
- sql.setLong(2, user.getId());
- sql.setBoolean(3, user.isSuperUser());
+ sql.setLong(1, folder.getId());
+ sql.setLong(2, folder.user);
+ sql.setBoolean(3, requestingUser.isSuperUser());
return DBConnection.exec(sql, DBBeanSQLResultHandler.createList(Folder.class, db));
}
@@ -60,15 +61,14 @@ public class Folder extends DBBean{
public static List load(DBConnection db, User user) throws SQLException{
if( user.getId() == null )
- return new LinkedList();
+ return Collections.emptyList();
PreparedStatement sql = db.getPreparedStatement("SELECT * FROM Folder WHERE user=?");
sql.setLong(1, user.getId() );
return DBConnection.exec(sql, DBBeanSQLResultHandler.createList(Folder.class, db));
}
public Folder(){
- //subFolders = new LinkedList();
- date = new Timestamp( System.currentTimeMillis() );
+ date = new Timestamp( System.currentTimeMillis() );
}
public String getName(){
@@ -76,20 +76,25 @@ public class Folder extends DBBean{
String[] tmp = path.split("/");
name = tmp[tmp.length-1];
}
- String userName = user != null ? user.getName() : "UNKNOWN";
+ String userName = getUser() != null ? getUser().getName() : "UNKNOWN";
String tmp = name.replaceAll("\\{NAME\\}", userName);
return tmp;
}
- public String getUnModName(){
- if(name == null)
- getName();
- return name;
- }
public User getUser(){
- return user;
+ if (userInstance == null) {
+ try {
+ DBConnection db = Zallery.getDB();
+ userInstance = User.load(db, user);
+ db.close();
+ } catch (Exception e) {
+ logger.log(Level.WARNING, null, e);
+ }
+ }
+ return userInstance;
}
public void setUser(User user){
- this.user = user;
+ this.user = user.getId();
+ this.userInstance = null;
}
public boolean isPrivate(){
return isPrivate;
@@ -98,12 +103,9 @@ public class Folder extends DBBean{
this.isPrivate = priv;
}
public String getPath(){
- String tmp = path.replaceAll("\\{NAME\\}", user.getName());
+ String tmp = path.replaceAll("\\{NAME\\}", getUser().getName());
return tmp;
}
- public String getUnModPath(){
- return path;
- }
public void setName(String name){
this.name = name;
if( parent.path.endsWith("/") )
@@ -125,20 +127,10 @@ public class Folder extends DBBean{
return parent;
}
- /*public void addSubFolder(Folder f){
- if( !subFolders.contains(f) ){
- subFolders.add( f );
- f.setParent( this );
- }
- }*/
+ public Timestamp getDate(){
+ return date;
+ }
- /*public List getSubFolders(){
- return subFolders;
- }*/
-
- public Timestamp getDate(){
- return date;
- }
/**
* @param filename is the name of the file
@@ -153,7 +145,7 @@ public class Folder extends DBBean{
return null;
}
- if( user == null || filename == null )
+ if( user < 0 || filename == null )
return null;
StringBuilder tmp = new StringBuilder();
@@ -166,7 +158,7 @@ public class Folder extends DBBean{
tmp.append( File.separatorChar );
// Add UserID and this folders path
- String tmp_path = path.replaceAll("\\{NAME\\}", ""+user.getId());
+ String tmp_path = path.replaceAll("\\{NAME\\}", ""+user);
tmp_path = tmp_path.replaceAll("/", Matcher.quoteReplacement(File.separator));
tmp.append( tmp_path );
@@ -195,6 +187,6 @@ public class Folder extends DBBean{
}
public boolean isEmpty(DBConnection db) throws SQLException {
- return Folder.loadSubFolders(db, this.getId(), user).isEmpty() && Media.load(db, this).isEmpty();
+ return Folder.loadSubFolders(db, this, getUser()).isEmpty() && Media.load(db, this).isEmpty();
}
}