Author: dpillot
Date: Fri Jun 1 16:56:08 2007
New Revision: 17448
URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D17448&repname=
=3Djahia
Log:
TEMPLATES-244
Modified:
branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/ajax/webdav/GetChi=
ldren.java
branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/taglibs/mediagalle=
ry/MediaGalleryTag.java
branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/taglibs/mediagalle=
ry/MediaThumbTag.java
Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/ajax/webdav/=
GetChildren.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/ajax/webdav/GetChildren.java&rev=3D17448&re=
pname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/ajax/webdav/GetChi=
ldren.java (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/ajax/webdav/GetChi=
ldren.java Fri Jun 1 16:56:08 2007
@@ -271,6 +271,7 @@
boolean homedir =3D false;
while (ite.hasNext()) {
final DAVFileAccess child =3D (DAVFileAccess) ite.next();
+ if(!jParams.getUser().isRoot() && child.isImage() && child=
.getName().indexOf("_th_")>-1) continue;// avoid to list thumbnails
if (child.getPath().equals(key)) {
homedir =3D true;
}
Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/taglibs/medi=
agallery/MediaGalleryTag.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/taglibs/mediagallery/MediaGalleryTag.java&r=
ev=3D17448&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/taglibs/mediagalle=
ry/MediaGalleryTag.java (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/taglibs/mediagalle=
ry/MediaGalleryTag.java Fri Jun 1 16:56:08 2007
@@ -44,7 +44,7 @@
=
private String path; //required
//private int size =3D 64;//default (optionnal)
- private boolean thumbnailDisplay =3D false;
+ private boolean thumbnailDisplay =3D false;// dont list thumbnails
private String sorting =3D "name";// values possible are name, date(mo=
dification),creation (date), modified (date), creator or owner, contributor
private String order =3D"asc";//values possible are asc or desc
// excluded webdav folders by name
@@ -256,7 +256,8 @@
Vector images =3D new Vector();
for (Iterator it =3D all.iterator(); it.hasNext();) {
DAVFileAccess thefile =3D (DAVFileAccess) it.next();
- if (thefile.isImage()) {
+ //we dont list binaries files not image and not valid (with ac=
cess denied)
+ if (thefile.isImage() && thefile.isValid()) {
//excluding all thumbnails if thumbdisp is false
if (thumbdisp || thefile.getPath().lastIndexOf(thumbnailna=
me) =3D=3D -1) {
//logger.debug("adding the file "+thefile.getName());
Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/taglibs/medi=
agallery/MediaThumbTag.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/java/org/jahia/taglibs/mediagallery/MediaThumbTag.java&rev=
=3D17448&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/taglibs/mediagalle=
ry/MediaThumbTag.java (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/java/org/jahia/taglibs/mediagalle=
ry/MediaThumbTag.java Fri Jun 1 16:56:08 2007
@@ -21,6 +21,8 @@
import org.jahia.params.ProcessingContext;
import org.jahia.services.webdav.DAVFileAccess;
import org.jahia.services.webdav.JahiaWebdavBaseService;
+import org.jahia.services.usermanager.JahiaUser;
+import org.jahia.services.usermanager.JahiaDBUser;
import org.jahia.tools.imageprocess.ImageInfo;
import org.jahia.tools.imageprocess.ImageProcess;
=
@@ -144,13 +146,20 @@
JspWriter out =3D pageContext.getOut();
logger.debug("entering tag");
final ProcessingContext jParams;
+ final JahiaData jData;
+ final String opmode;
+ final JahiaUser user;
try {
- JahiaData jData =3D (JahiaData) pageContext.getRequest().getAt=
tribute("org.jahia.data.JahiaData");
+ jData =3D (JahiaData) pageContext.getRequest().getAttribute("o=
rg.jahia.data.JahiaData");
jParams =3D jData.getProcessingContext();
+ opmode=3DjParams.getOperationMode();
+ user=3DjParams.getUser();
+ logger.debug("user:"+user.getUserKey()+" opmode:"+opmode);
} catch (Exception e) {
throw new JspException("this tag is designed to be used in a J=
ahiaContext only", e);
}
=
+
if (getParent() instanceof MediaGalleryTag) {
logger.debug("this tag is included");
isNested =3D true;
@@ -159,6 +168,7 @@
=
DAVFileAccess image =3D JahiaWebdavBaseService.getInstance().getDA=
VFileAccess(jParams, path);
String parentpath =3D path.substring(0, path.lastIndexOf("/") + 1);
+
//checks
if (!image.isValid()) {
//throw new JspException("this file is not found");
@@ -171,7 +181,7 @@
return SKIP_BODY;
}
=
- // image name
+ // image name and extension
String filename =3D path.substring(path.lastIndexOf("/") + 1);
String ext =3D filename.substring(filename.lastIndexOf(".") + 1);
filename =3D filename.substring(0, filename.lastIndexOf("."));
@@ -330,8 +340,11 @@
name =3D name + thumbnailname + width + "." + ext;
String thumbpath =3D path.substring(0, path.lastIndexOf("/") + 1) =
+ name;
logger.debug("searching for thumb " + thumbpath);
- DAVFileAccess thumb =3D JahiaWebdavBaseService.getInstance().getDA=
VFileAccess(jParams, thumbpath);
- if (thumb !=3D null && thumb.isValid() && thumb.isImage()) return =
true;
+ //DAVFileAccess thumb =3D JahiaWebdavBaseService.getInstance().get=
DAVFileAccess(jParams, thumbpath);
+ //bypassing rights with fictious root user to test real existence =
of the thumb
+ DAVFileAccess thumb =3D JahiaWebdavBaseService.getInstance().getDA=
VFileAccess(jParams,jParams.getSite(),new JahiaDBUser(0,"root","","",1,null=
),thumbpath);
+
+ if (thumb.isValid() && thumb.isImage()) return true;
logger.debug("not found");
return false;
}
@@ -350,7 +363,7 @@
name =3D name.substring(0, name.lastIndexOf("."));
name =3D name + thumbnailname + width + "x" + height + "." + ext;
String thumbpath =3D path.substring(0, path.lastIndexOf("/") + 1) =
+ name;
- DAVFileAccess thumb =3D JahiaWebdavBaseService.getInstance().getDA=
VFileAccess(jParams, thumbpath);
+ DAVFileAccess thumb =3D JahiaWebdavBaseService.getInstance().getDA=
VFileAccess(jParams,jParams.getSite(),new JahiaDBUser(0,"root","","",1,null=
),thumbpath);
if (thumb !=3D null && thumb.isValid() && thumb.isImage()) return =
true;
logger.debug("not found");
return false;
_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list