You are viewing a plain text version of this content. The canonical link for it is here.
Posted to photark-commits@incubator.apache.org by lr...@apache.org on 2009/09/28 19:35:05 UTC
svn commit: r819689 - in /incubator/photark/trunk/photark-webapp: pom.xml
src/main/resources/photo-gallery-jcr.composite
src/main/resources/photo-gallery.composite src/main/webapp/gallery.html
Author: lresende
Date: Mon Sep 28 19:35:05 2009
New Revision: 819689
URL: http://svn.apache.org/viewvc?rev=819689&view=rev
Log:
Merging latest photark gallery/album navigation changes from photark-embedded
Modified:
incubator/photark/trunk/photark-webapp/pom.xml
incubator/photark/trunk/photark-webapp/src/main/resources/photo-gallery-jcr.composite
incubator/photark/trunk/photark-webapp/src/main/resources/photo-gallery.composite
incubator/photark/trunk/photark-webapp/src/main/webapp/gallery.html
Modified: incubator/photark/trunk/photark-webapp/pom.xml
URL: http://svn.apache.org/viewvc/incubator/photark/trunk/photark-webapp/pom.xml?rev=819689&r1=819688&r2=819689&view=diff
==============================================================================
--- incubator/photark/trunk/photark-webapp/pom.xml (original)
+++ incubator/photark/trunk/photark-webapp/pom.xml Mon Sep 28 19:35:05 2009
@@ -61,6 +61,13 @@
<version>1.5</version>
<scope>runtime</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-widget-runtime-tuscany</artifactId>
+ <version>1.5</version>
+ <scope>runtime</scope>
+ </dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
@@ -71,12 +78,39 @@
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-atom-js</artifactId>
+ <version>1.5</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-jsonrpc-runtime</artifactId>
- <version>1.4</version>
+ <version>1.5</version>
<scope>runtime</scope>
</dependency>
<dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc-js</artifactId>
+ <version>1.5</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-commonj_1.1_spec</artifactId>
+ <version>1.0</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ </dependency>
+
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.3.0</version>
@@ -112,13 +146,20 @@
<version>1.4</version>
</dependency>
+ <!-- marking dependency as provided to exclude from war file -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.3</version>
+ <scope>provided</scope>
+ </dependency>
+
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
<scope>test</scope>
</dependency>
-
</dependencies>
<build>
Modified: incubator/photark/trunk/photark-webapp/src/main/resources/photo-gallery-jcr.composite
URL: http://svn.apache.org/viewvc/incubator/photark/trunk/photark-webapp/src/main/resources/photo-gallery-jcr.composite?rev=819689&r1=819688&r2=819689&view=diff
==============================================================================
--- incubator/photark/trunk/photark-webapp/src/main/resources/photo-gallery-jcr.composite (original)
+++ incubator/photark/trunk/photark-webapp/src/main/resources/photo-gallery-jcr.composite Mon Sep 28 19:35:05 2009
@@ -22,8 +22,9 @@
targetNamespace="http://photo-gallery"
name="photo-gallery-jcr">
+ <!--
<service name="Gallery" promote="Album">
- <interface.java interface="services.Album"/>
+ <interface.java interface="org.apache.photark.services.Album"/>
<t:binding.jsonrpc/>
</service>
@@ -31,5 +32,6 @@
<implementation.java class="services.jcr.AlbumImpl"/>
<property name="gallery">gallery</property>
<property name="album">boston</property>
- </component>
+ </component>
+ -->
</composite>
Modified: incubator/photark/trunk/photark-webapp/src/main/resources/photo-gallery.composite
URL: http://svn.apache.org/viewvc/incubator/photark/trunk/photark-webapp/src/main/resources/photo-gallery.composite?rev=819689&r1=819688&r2=819689&view=diff
==============================================================================
--- incubator/photark/trunk/photark-webapp/src/main/resources/photo-gallery.composite (original)
+++ incubator/photark/trunk/photark-webapp/src/main/resources/photo-gallery.composite Mon Sep 28 19:35:05 2009
@@ -18,30 +18,22 @@
* under the License.
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
- targetNamespace="http://photo-gallery"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://org.apache.photoark"
name="photo-gallery">
-
- <service name="Gallery" promote="AlbumAgregator/Album">
- <interface.java interface="services.Album"/>
- <t:binding.jsonrpc/>
- </service>
-
- <component name="AlbumAgregator">
- <implementation.java class="services.AlbumAgregator"/>
- <service name="Album">
- <t:binding.jsonrpc/>
+
+ <component name="Gallery">
+ <tuscany:implementation.widget location="gallery.html"/>
+ <reference name="gallery" target="GalleryComponentService">
+ <tuscany:binding.jsonrpc uri="http://localhost:8080/photark/GalleryService"/>
+ </reference>
+ </component>
+
+ <component name="GalleryComponentService">
+ <implementation.java class="org.apache.photark.services.gallery.filesystem.GalleryImpl"/>
+ <property name="name">gallery</property>
+ <service name="Gallery">
+ <tuscany:binding.jsonrpc uri="http://localhost:8080/photark/GalleryService"/>
</service>
- <reference name="album" target="Album"/>
- <reference name="albumFeed">
- <t:binding.atom uri="http://api.flickr.com/services/feeds/photoset.gne?set=72157601530865813&nsid=36437931@N00&lang=en-us"/>
- </reference>
</component>
-
- <component name="Album">
- <implementation.java class="services.filesystem.AlbumImpl"/>
- <property name="gallery">gallery</property>
- <property name="album">boston</property>
- </component>
-
</composite>
Modified: incubator/photark/trunk/photark-webapp/src/main/webapp/gallery.html
URL: http://svn.apache.org/viewvc/incubator/photark/trunk/photark-webapp/src/main/webapp/gallery.html?rev=819689&r1=819688&r2=819689&view=diff
==============================================================================
--- incubator/photark/trunk/photark-webapp/src/main/webapp/gallery.html (original)
+++ incubator/photark/trunk/photark-webapp/src/main/webapp/gallery.html Mon Sep 28 19:35:05 2009
@@ -22,87 +22,166 @@
<link href="styles.css" rel="stylesheet">
-<script type="text/javascript" src="SCADomain/scaDomain.js"></script>
+<script type="text/javascript" src="gallery.js"></script>
<script language="JavaScript">
- //@Reference
- var album = Gallery;
-
+ index_off= new Image(31,31); index_off.src = "index.gif";
+ index_on = new Image(31,31); index_on.src = "index_on.gif";
+ next_off = new Image(31,31); next_off.src = "next.gif";
+ next_on = new Image(31,31); next_on.src = "next_on.gif";
+ prev_off = new Image(31,31); prev_off.src = "prev.gif";
+ prev_on = new Image(31,31); prev_on.src = "prev_on.gif";
+
+ //@Reference
+ var gallery = new tuscany.sca.Reference("gallery");
+
+ var galleryName;
+ var galleryAlbums;
+ var albumName;
var albumItems;
- var currPos = 0;
+ var albumPos = 0;
- function album_getResponse(items, exception) {
+ function initGallery() {
+ try {
+ gallery.getAlbums(gallery_getAlbumsResponse);
+ } catch(exception) {
+ alert(e);
+ }
+ }
+
+ function gallery_getAlbumsResponse(albums, exception) {
if(exception) {
alert(exception.msg);
return;
}
- albumItems = items;
- showAlbum();
+ galleryAlbums = albums;
+
+ if(galleryAlbums.length > 0) {
+ initializeGallery();
+ displayGallery();
+ }
}
- function showImage(pos) {
- var img = document.createElement("img");
- img.onload = function(evt) {
- document.getElementById("albumImage").src = this.src;
- document.getElementById("albumImage").width=this.width;
- document.getElementById("albumImage").height=this.height;
- }
- img.src = albumItems[pos];
- return false;
- }
-
- function showAlbum() {
- if(albumItems.length > 0) {
- showImage(currPos);
- }
- }
-
- function goNext() {
- if(currPos < albumItems.length) {
- currPos++;
- showImage(currPos);
- }
- }
-
- function goPrevious() {
- if(currPos > 0) {
- currPos--;
- showImage(currPos);
+ function initializeGallery() {
+ var table=document.getElementById('tableGallery');
+ var lastRow = table.rows.length;
+ for(i=0; i<galleryAlbums.length; i++) {
+ var row=table.insertRow(lastRow++);
+ var column=row.insertCell(0);
+
+ var albumName = galleryAlbums[i].name;
+ var albumCover = gallery.getAlbumCover(albumName);
+ var img_src = albumCover;
+ var img_html = "<img src=" + "gallery/" + albumName + "/" + img_src + " class=\"slideImage\" height=25% width=25% ondragstart=\"return false\" onselectstart=\"return false\" oncontextmenu=\"return false\" galleryimg=\"no\" usemap=\"#imagemap\" alt=\"\"/>";
+ var html="<a href=\"javascript:initializeAlbum('" + albumName +"')\">" + img_html + "</a>";
+ column.innerHTML = html;
+
+ row = table.insertRow(lastRow++);
+ column = row.insertCell(0)
+ column.innerHTML = albumName;
+
+ row = table.insertRow(lastRow++);
+ column = row.insertCell(0)
+ column.innerHTML = "<img src=\"space.gif\" class=\"slideImage\" width=\"10\" height=\"10\" ondragstart=\"return false\" onselectstart=\"return false\" oncontextmenu=\"return false\" galleryimg=\"no\" usemap=\"#imagemap\" alt=\"\">";
+ }
+
}
- }
- function init() {
+ function displayGallery() {
+ setVisibility('gallery',true);
+ setVisibility('album',false);
+ }
+
+ function initializeAlbum(albumName) {
try {
- album.getPictures(album_getResponse);
+ this.albumName = albumName;
+ gallery.getAlbumPictures(albumName, gallery_getAlbumPicturesResponse);
} catch(exception) {
alert(e);
+ }
+ }
+
+ function gallery_getAlbumPicturesResponse(items, exception) {
+ if(exception) {
+ alert(exception.msg);
+ displayGallery();
+ return;
}
+ albumItems = items;
+ albumPos = 0;
+ showAlbum();
}
+ function showAlbum() {
+ if(albumItems.length > 0) {
+ showImage(albumPos);
+ }
+ displayAlbum();
+ }
+
+ function displayAlbum() {
+ setVisibility('gallery',false);
+ setVisibility('album',true);
+ }
+
+ function showImage(albumPos) {
+ var img = document.createElement("img");
+ img.onload = function(evt) {
+ document.getElementById("albumImage").src = this.src;
+ document.getElementById("albumImage").width=this.width;
+ document.getElementById("albumImage").height=this.height;
+ }
+ img.src = "gallery/" + albumName + "/" + albumItems[albumPos];
+ return false;
+ }
+
+ function goNext() {
+ if(albumPos < albumItems.length) {
+ albumPos++;
+ showImage(albumPos);
+ }
+ }
+
+ function goPrevious() {
+ if(albumPos > 0) {
+ albumPos--;
+ showImage(albumPos);
+ }
+ }
+
+ function setVisibility(divId, visible) {
+ //valid values { visible, hidden }
+ if (document.getElementById) {
+ var element = document.getElementById(divId)
+ if(visible) {
+ element.style.display = 'block';
+ element.style.visibility = 'visible';
+ } else {
+ element.style.display = 'none';
+ element.style.visibility = 'hidden';
+ }
+ }
+ }
+
- index_off= new Image(31,31); index_off.src = "index.gif";
- index_on = new Image(31,31); index_on.src = "index_on.gif";
- next_off = new Image(31,31); next_off.src = "next.gif";
- next_on = new Image(31,31); next_on.src = "next_on.gif";
- prev_off = new Image(31,31); prev_off.src = "prev.gif";
- prev_on = new Image(31,31); prev_on.src = "prev_on.gif";
</script>
</head>
-<body onload="init()">
+<body onload="initGallery()">
<br>
<h1><center>Apache PhotArk Gallery</center></h1>
<br>
<br>
- <div id="gallery">
- <div id="album">
- <!--img id="albumImage" border="0" src=""-->
- </div>
- <br>
- </div>
+<div id='gallery' style='display:none;visibility:hidden;'>
+ <center>
+ <table id='tableGallery' style='width:720px;' border='0' cellspacing='0' cellpadding='1'></table>
+ </center>
+</div>
+
+<div id="album" style="display:none;visibility:hidden;">
<center>
<table style="height:54px;" cellspacing="0" cellpadding="0" border="0">
@@ -111,7 +190,7 @@
<!-- Navigation Header -->
<table style="width:100%;" cellspacing="0" cellpadding="0" border="0">
<tr>
- <!-- <td style="width:31px;"><a href="javascript:showAlbum()" onmouseover="document.index.src=index_on.src" onmouseout="document.index.src=index_off.src"><img src="index.gif" width="31" height="31" border="0" title="Index page" name="index" alt=""></a></td> -->
+ <td style="width:31px;"><a href="javascript:displayGallery()" onmouseover="document.index.src=index_on.src" onmouseout="document.index.src=index_off.src"><img src="index.gif" width="31" height="31" border="0" title="Index page" name="index" alt=""></a></td>
<td style="width:31px;"><a href="javascript:goPrevious()" onmouseover="document.previous.src=prev_on.src" onmouseout="document.previous.src=prev_off.src"><img src="prev.gif" width="31" height="31" border="0" title="Previous image" name="previous" alt=""></a></td>
<td style="width:31px;"><a href="javascript:goNext()" onmouseover="document.next.src=next_on.src" onmouseout="document.next.src=next_off.src"><img src="next.gif" width="31" height="31" border="0" title="Next image" name="next" alt=""></a></td>
<!-- <td style="width:31px;"><a href="javascript:void(0)" onmouseover="show_over();" onmouseout="show_out();" onmousedown="show_down();" ondblclick="change_delay();"><img src="show_slide.gif" width="31" height="31" border="0" title="Start/Stop slideshow - DoubleClick to change speed" name="show" alt=""></a></td> -->
@@ -129,7 +208,8 @@
</tr>
</table>
- </center>
+ </center>
+</div>
</body>
-</html>
+</html>
\ No newline at end of file