Subversion Repositories eFlore/Archives.cel-v2

Compare Revisions

Ignore whitespace Rev 11 → Rev 12

/trunk/src/org/tela_botanica/client/modeles/ImageUploaderAsynchroneDAO.java
New file
0,0 → 1,93
package org.tela_botanica.client.modeles;
 
import com.gwtext.client.widgets.Window;
import com.gwtextux.client.widgets.upload.UploadDialog;
 
 
/**
* DAO un peu particulier car il crée une fenetre d'upload différente
* suivant que le plugin Java est détecté ou non
*
*
*/
public class ImageUploaderAsynchroneDAO {
private static void appelerUploadSimple()
{
UploadDialog up = new UploadDialog("Upload simple de fichiers") ;
up.setUrl("jrest/InventoryImage");
up.show();
}
private static void appelerUploadMultiple()
{
final Window nPan = new Window("Upload multiple");
nPan.setSize(640, 800);
 
final String applet = "<applet code=\"wjhk.jupload2.JUploadApplet\" archive=\"wjhk.jupload.jar\" alt=\"\" mayscript=\"\" height=\"770\" width=\"625\">";
final String paramPostTarget = "<param name=\"postURL\" value=\"jrest/InventoryImage/\">";
final String paramUploadPolicy = "<param name=\"uploadPolicy\" value=\"PictureUploadPolicy\">";
final String paramMaxChunkSize = "<param name=\"maxChunkSize\" value=\"0\">";
final String paramMaxFileSize = "<param name=\"maxFileSize\" value=\"10000000\">";
final String paramMaxPicHeight = "<param name=\"maxPicHeight\" value=\"1200\">" ;
final String paramMaxPicWidth = "<param name=\"maxPicWidth\" value=\"1600\">" ;
final String paramTransmitMetaData = "<param name=\"pictureTransmitMetadata\" value=\"true\">";
final String paramFilesPerRequest = "<param name=\"nbFilesPerRequest\" value=\"1\">";
final String paramAllowedExtensions = "<param name=\"allowedFileExtensions\" value=\"jpg/jpeg/\">";
final String paramUploadSuccess = "<param name=\"stringUploadSuccess\" value=\"OK\">" ;
final String paramShowLogWindow = "<param name=\"showLogWindow\" value=\"false\">";
final String finApplet = "</applet>";
 
final String appelApplet = applet
+ paramPostTarget
+ paramUploadPolicy
+ paramMaxChunkSize
+ paramMaxFileSize
+ paramMaxPicHeight
+ paramMaxPicWidth
+ paramTransmitMetaData
+ paramFilesPerRequest
+ paramAllowedExtensions
+ paramUploadSuccess
+ paramShowLogWindow
+ finApplet;
 
nPan.setHtml(appelApplet);
nPan.show();
}
public static native void choisirMethodeUpload() /*-{
var agt=navigator.userAgent.toLowerCase();
var ie = (agt.indexOf("msie") != -1);
var ns = (navigator.appName.indexOf("Netscape") != -1);
var win = ((agt.indexOf("win")!=-1) || (agt.indexOf("32bit")!=-1));
var mac = (agt.indexOf("mac")!=-1);
function detectIE(ClassID,name) { result = false; document.write('<SCRIPT LANGUAGE=VBScript>\n on error resume next \n result = IsObject(CreateObject("' + ClassID + '"))</SCRIPT>\n'); if (result) return name+','; else return ''; }
function detectNS(ClassID,name) { n = ""; if (nse.indexOf(ClassID) != -1) if (navigator.mimeTypes[ClassID].enabledPlugin != null) n = name+","; return n; }
if (ie && win) { pluginlist = detectIE("Adobe.SVGCtl","SVG Viewer") + detectIE("SWCtl.SWCtl.1","Shockwave Director") + detectIE("ShockwaveFlash.ShockwaveFlash.1","Shockwave Flash") + detectIE("rmocx.RealPlayer G2 Control.1","RealPlayer") + detectIE("QuickTimeCheckObject.QuickTimeCheck.1","QuickTime") + detectIE("MediaPlayer.MediaPlayer.1","Windows Media Player") + detectIE("PDF.PdfCtrl.5","Acrobat Reader"); }
if (ns || !win) {
nse = ""; for (var i=0;i<navigator.mimeTypes.length;i++) nse += navigator.mimeTypes[i].type.toLowerCase();
pluginlist = detectNS("image/svg-xml","SVG Viewer") + detectNS("application/x-director","Shockwave Director") + detectNS("application/x-shockwave-flash","Shockwave Flash") + detectNS("audio/x-pn-realaudio-plugin","RealPlayer") + detectNS("video/quicktime","QuickTime") + detectNS("application/x-mplayer2","Windows Media Player") + detectNS("application/pdf","Acrobat Reader");
}
pluginlist += navigator.javaEnabled() ? "Java," : "";
if (pluginlist.length > 0) pluginlist = pluginlist.substring(0,pluginlist.length-1);
if(pluginlist.indexOf("Java")!=-1)
{
@org.tela_botanica.client.modeles.ImageUploaderAsynchroneDAO::appelerUploadMultiple()() ;
}
else
{
@org.tela_botanica.client.modeles.ImageUploaderAsynchroneDAO::appelerUploadSimple()() ;
}
}-*/;
 
}
/trunk/src/org/tela_botanica/client/modeles/ImageCarnet.java
1,29 → 1,169
package org.tela_botanica.client.modeles;
 
public class ImageCarnet {
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
 
import com.google.gwt.json.client.JSONObject;
 
/**
*
* Classe representant une image du carnet,
* elle ne contient pas d'image à proprement parler mais
* plutôt les informations associées ainsi que l'url distante
*
*/
public class ImageCarnet extends HashMap {
private String url = null ;
private int numero = 0 ;
private String nom = null ;
/*
// infos sur l'image
private String url = " " ;
private String ordre = " " ;
private String utilisateur = " " ;
private boolean publiable = false ;
private String height = "0" ;
private String width = "0" ;
private String make = " " ;
private String model = " " ;
private String xResolution = "0" ;
private String yResolution = "0" ;
private String date = " " ;
private String GPS = " " ;
private String comment = " " ;
public ImageCarnet(String url,int numero,String nom)
// metadonnees exif
private String exifExposureTime = " " ;
private String exifFNumber = " " ;
private String exifVersion = " " ;
private String exifCompressedBitsPerPixel = " " ;
private String exifShutterSpeedValue = " " ;
private String exifApertureValue = " " ;
private String exifExposureBiasValue = " " ;
private String exifMaxApertureValue = " " ;
private String exifMeteringMode = " " ;
private String exifLightSource = " " ;
private String exifFlash = " " ;
private String exifFocalLength = " " ;
private String exifFlashPixVersion = " " ;
private String exifColorSpace = " " ;
private String exifInteroperabilityOffset = " " ;
private String exifFocalPlaneXResolution = " " ;
private String exifFocalPlaneYResolution = " " ;
private String exifFocalPlaneResolutionUnit = " " ;
private String exifSensingMethod = " " ;
private String exifFileSource = " " ;
private String exifCustomRendered = " " ;
private String exifExposureMode = " " ;
private String exifWhiteBalance = " " ;
private String exifDigitalZoomRatio = " " ;
private String exifSceneCaptureType = " " ;
private String exifGainControl = " " ;
private String exifContrast = " " ;
private String exifSaturation = " " ;
private String exifSharpness = " " ;
private String exifSubjectDistanceRange = " " ;
private String exifAutres = " " ;
// metadonnes iptc
private String iptcMotsCles = " " ;
private String iptcByLine = " " ;
private String iptcByLineTitle = " " ;
private String iptcCity = " " ;
private String iptcSubLocation = " " ;
private String iptcProvinceState = " " ;
private String iptcCountryPrimaryLocationCode = " " ;
private String iptcHeadline = " " ;
private String iptcCredit = " " ;
private String iptcCopyrightNotice = " " ;
private String iptcContact = " " ;
private String iptcAutres = " " ;
*/
 
public ImageCarnet(JSONObject image)
{
Set im = image.keySet() ;
for (Iterator iterator = im.iterator(); iterator.hasNext();) {
String key = (String) iterator.next();
if(image.get(key).isString() != null)
{
String valeur = image.get(key).isString().stringValue() ;
this.put(key, valeur) ;
}
}
 
}
public String renvoyerValeurCorrecte(String cle)
{
this.url = url ;
this.numero = numero ;
this.nom = nom ;
if(this.containsKey((cle)))
{
String valeur = (String)this.get(cle) ;
if(valeur.equals("null"))
{
return " " ;
}
else
{
return valeur ;
}
}
else
{
return " " ;
}
}
 
public String getOrdre() {
return renvoyerValeurCorrecte("ci_ordre") ;
}
public String getBaseUrl()
{
return "http://localhost/Documents/images_serveur/" ;
}
 
public String getUrl() {
return url;
return getBaseUrl()+(String)this.get("ci_id_image")+".jpg" ;
}
public String getSUrl() {
return getBaseUrl()+(String)this.get("ci_id_image")+"_S.jpg" ;
}
public String getMUrl() {
return getBaseUrl()+(String)this.get("ci_id_image")+"_M.jpg" ;
}
 
public int getNumero() {
return numero;
 
public String getDate() {
return renvoyerValeurCorrecte("ci_meta_date_time") ;
}
 
public String getNom() {
return nom;
 
public Object getIptcCity() {
return renvoyerValeurCorrecte("ci_meta_iptc_city") ;
}
 
 
public String getMake() {
return renvoyerValeurCorrecte("ci_meta_make") ;
}
 
 
public String getModel() {
return renvoyerValeurCorrecte("ci_meta_model") ;
}
}
/trunk/src/org/tela_botanica/client/modeles/ListeImageAsynchroneDAO.java
3,6 → 3,7
import org.tela_botanica.client.interfaces.Rafraichissable;
 
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;
15,32 → 16,49
import com.gwtext.client.data.Store;
import com.gwtext.client.data.StringFieldDef;
 
/**
* Data Object Access communiquant avec le serveur jrest fournissant la liste des images
* répondant à des critères donné
* @author aurelien
*
*/
public class ListeImageAsynchroneDAO {
public void ObtenirListeImages(final Rafraichissable r)
{
HTTPRequest.asyncGet("getphotos.php", new ResponseTextHandler() {
HTTPRequest.asyncGet("jrest/inventoryImageList/1/ci_publiable_eflore=0", new ResponseTextHandler() {
public void onCompletion(String responseText) {
final Object[][] photoData ;
final ListeImage photoData ;
 
final JSONValue responseValue = JSONParser.parse(responseText);
if (responseValue.isArray() != null) {
final JSONArray liste_noms = responseValue.isArray();
final JSONArray reponse = responseValue.isArray();
 
final int taillemax = liste_noms.size();
photoData = new Object[taillemax][2];
for (int j = 0; j < liste_noms.size(); j++) {
final JSONString debuturl = (JSONString) liste_noms
.get(j);
photoData[j] = new Object[]{"photo" + j,
"images/" + debuturl.stringValue()};
final int taillemax = reponse.size();
photoData = new ListeImage(taillemax);
for (int j = 0; j < taillemax ; j++) {
JSONObject image = (JSONObject)reponse.get(j) ;
photoData.add(new ImageCarnet(image)) ;
}
}
else
{
photoData = null ;
if(responseValue.isObject() != null)
{
photoData = new ListeImage(1);
photoData.add(new ImageCarnet(responseValue.isObject())) ;
}
else
{
photoData = null ;
}
}
r.rafraichir(photoData);
/trunk/src/org/tela_botanica/client/modeles/ListeImage.java
2,6 → 2,12
 
import java.util.Vector;
 
/**
* vecteur composé d'ImageCarnet, renvoyé par les objets de type DAO
* pour les images
* @author aurelien
*
*/
public class ListeImage extends Vector {
public ListeImage()
9,12 → 15,17
super();
}
public ListeImage(int taille)
{
super(taille);
}
public ListeImage(ImageCarnet[] ic)
{
super() ;
for (int i = 0; i < ic.length; i++)
{
if(ic[i] != null)
if(ic[i] != null && ic[i] instanceof ImageCarnet)
{
this.add(ic[i]);
}
/trunk/src/org/tela_botanica/client/modeles/ObservationAsynchroneDAO.java
5,7 → 5,6
*
*/
 
 
import org.tela_botanica.client.Util;
import org.tela_botanica.client.interfaces.iRetourObservation;