Index: /extensions/jiwigo/trunk/install/install.txt
===================================================================
--- /extensions/jiwigo/trunk/install/install.txt	(revision 8837)
+++ /extensions/jiwigo/trunk/install/install.txt	(revision 8838)
@@ -5,5 +5,5 @@
 #####################################################################################
 
-1 - You must first checkout the project from svn. Create a new Java project from the svn version.
+1 - You must first checkout the project from svn (url is http://piwigo.org/svn/extensions/jiwigo/). Create a new Java project from the svn version.
 2 - Then install maven plugin for eclipse. It is available from that update site : http://m2eclipse.sonatype.org/sites/m2e
 3 - Then enable maven dependency management : right click on the project > maven > enable dependency management.
Index: /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/Main.java
===================================================================
--- /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/Main.java	(revision 8837)
+++ /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/Main.java	(revision 8838)
@@ -3,6 +3,9 @@
 import java.io.File;
 import java.io.IOException;
+
 import javax.swing.UIManager;
+
 import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel;
+
 import fr.mael.jiwigo.transverse.session.SessionManager;
 import fr.mael.jiwigo.transverse.util.Outil;
@@ -10,5 +13,4 @@
 import fr.mael.jiwigo.ui.ConnexionDialog;
 import fr.mael.jiwigo.ui.mainframe.MainFrame;
-
 
 /**
@@ -38,5 +40,5 @@
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    
- * Classe principale de lancement de l'interface.
+ * Main class
  * @author mael
  *
@@ -44,49 +46,47 @@
 public class Main {
 
-	/**
-	 * Logger
-	 */
-	public static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(Main.class);
-	/**
-	 * The login and session manager that allows to connect to
-	 * the webservice and to query it
-	 */
-	public static SessionManager sessionManager;
+    /**
+     * Logger
+     */
+    public static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(Main.class);
+    /**
+     * The login and session manager that allows to connect to
+     * the webservice and to query it
+     */
+    public static SessionManager sessionManager;
 
-	/**
-	 *  the main window
-	 */
-	private static MainFrame mainFrame;
+    /**
+     *  the main window
+     */
+    private static MainFrame mainFrame;
 
-
-	public static void main(String[] args) {
-		try {
-			UIManager.setLookAndFeel(new NimbusLookAndFeel());
-		} catch (Exception e) {
-		}
-		File dossierConfig = new File(System.getProperty("user.home") + "/.jiwigo");
-		if (!dossierConfig.exists()) {
-			dossierConfig.mkdir();
-		}
-		try {
-			PreferencesManagement.creerFichierParDefaut();
-			//dialog de connexion
-			ConnexionDialog dialog = new ConnexionDialog();
-			dialog.showDialog();
-		} catch (IOException e) {
-			LOG.error(Outil.getStackTrace(e));
-		}
-
+    public static void main(String[] args) {
+	try {
+	    UIManager.setLookAndFeel(new NimbusLookAndFeel());
+	} catch (Exception e) {
+	}
+	File dossierConfig = new File(System.getProperty("user.home") + "/.jiwigo");
+	if (!dossierConfig.exists()) {
+	    dossierConfig.mkdir();
+	}
+	try {
+	    PreferencesManagement.creerFichierParDefaut();
+	    //dialog de connexion
+	    ConnexionDialog dialog = new ConnexionDialog();
+	    dialog.showDialog();
+	} catch (IOException e) {
+	    LOG.error(Outil.getStackTrace(e));
 	}
 
+    }
 
-	public static void showFrame() {
+    public static void showFrame() {
 
-		if (mainFrame == null) {
-			mainFrame = MainFrame.getInstance();
-		}
-		if (!mainFrame.isVisible()) {
-			mainFrame.showUi();
-		}
+	if (mainFrame == null) {
+	    mainFrame = MainFrame.getInstance();
 	}
+	if (!mainFrame.isVisible()) {
+	    mainFrame.showUi();
+	}
+    }
 }
Index: /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/dao/ImageDao.java
===================================================================
--- /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/dao/ImageDao.java	(revision 8837)
+++ /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/dao/ImageDao.java	(revision 8838)
@@ -14,9 +14,9 @@
 import fr.mael.jiwigo.Main;
 import fr.mael.jiwigo.om.Image;
-import fr.mael.jiwigo.transverse.ImagesManagement;
 import fr.mael.jiwigo.transverse.enumeration.MethodsEnum;
 import fr.mael.jiwigo.transverse.enumeration.PreferencesEnum;
 import fr.mael.jiwigo.transverse.util.Outil;
 import fr.mael.jiwigo.transverse.util.preferences.PreferencesManagement;
+import fr.mael.jiwigo.ui.mainframe.MainFrame;
 
 /**
@@ -191,4 +191,5 @@
 	    reussite = false;
 	}
+	MainFrame.getInstance().setMessage("");
 	suppressionFichierTemporaires();
 	return reussite;
Index: /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/om/Category.java
===================================================================
--- /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/om/Category.java	(revision 8837)
+++ /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/om/Category.java	(revision 8838)
@@ -46,4 +46,5 @@
     private Element element;
     private Integer parentDirect;
+    private Integer level;
 
     public Category() {
@@ -197,3 +198,11 @@
     }
 
+    public Integer getLevel() {
+	return level;
+    }
+
+    public void setLevel(Integer level) {
+	this.level = level;
+    }
+
 }
Index: /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/service/CategoryService.java
===================================================================
--- /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/service/CategoryService.java	(revision 8837)
+++ /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/service/CategoryService.java	(revision 8838)
@@ -82,5 +82,5 @@
      * @throws IOException 
      */
-    public List<Category> construireArbre() throws IOException {
+    public List<Category> makeTree() throws IOException {
 	List<Category> list = CategoryDao.getInstance().lister(true);
 	for (Category category : list) {
Index: /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/service/ImageService.java
===================================================================
--- /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/service/ImageService.java	(revision 8837)
+++ /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/service/ImageService.java	(revision 8838)
@@ -7,4 +7,5 @@
 import fr.mael.jiwigo.dao.ImageDao;
 import fr.mael.jiwigo.om.Image;
+import fr.mael.jiwigo.transverse.ImagesManagement;
 import fr.mael.jiwigo.transverse.enumeration.PreferencesEnum;
 import fr.mael.jiwigo.transverse.util.ImagesUtil;
@@ -133,4 +134,5 @@
 	image.setOriginale(originale);
 	image.setIdCategory(idCategory);
+	image.setPrivacyLevel(String.valueOf(ImagesManagement.getInstance().getPrivacyLevel()));
 	MainFrame.getInstance()
 		.setMessage(Messages.getMessage("mainFrame_sendingFiles") + " " + originalFile.getName());
Index: /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/transverse/session/SessionManager.java
===================================================================
--- /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/transverse/session/SessionManager.java	(revision 8837)
+++ /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/transverse/session/SessionManager.java	(revision 8838)
@@ -168,4 +168,5 @@
 	method.addParameter("method", methode);
 	for (int i = 0; i < parametres.length; i += 2) {
+	    System.out.println(parametres[i] + " -> " + parametres[i + 1]);
 	    method.addParameter(parametres[i], parametres[i + 1]);
 
Index: /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/ui/mainframe/CategoriesTree.java
===================================================================
--- /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/ui/mainframe/CategoriesTree.java	(revision 8837)
+++ /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/ui/mainframe/CategoriesTree.java	(revision 8838)
@@ -138,5 +138,5 @@
 	DefaultMutableTreeNode category = null;
 	try {
-	    List<Category> list = CategoryService.getInstance().construireArbre();
+	    List<Category> list = CategoryService.getInstance().makeTree();
 	    for (Category cat : list) {
 		if (cat.getCategoriesMeres().size() == 0) {
Index: /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/ui/search/ComboCategoryRenderer.java
===================================================================
--- /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/ui/search/ComboCategoryRenderer.java	(revision 8838)
+++ /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/ui/search/ComboCategoryRenderer.java	(revision 8838)
@@ -0,0 +1,60 @@
+package fr.mael.jiwigo.ui.search;
+
+import java.awt.Component;
+
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.ListCellRenderer;
+
+import fr.mael.jiwigo.om.Category;
+
+/**
+ * 
+   Copyright (c) 2010, Mael
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+    * Neither the name of jiwigo nor the
+      names of its contributors may be used to endorse or promote products
+      derived from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+   DISCLAIMED. IN NO EVENT SHALL Mael BE LIABLE FOR ANY
+   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+   
+ * @author mael
+ * Renderer used to display the category list with a hierarchy 
+ *
+ */
+public class ComboCategoryRenderer extends JLabel implements ListCellRenderer {
+
+    @Override
+    public Component getListCellRendererComponent(JList arg0, Object arg1, int arg2, boolean arg3, boolean arg4) {
+	Category category = (Category) arg1;
+	String toAdd = "";
+	//the indentation depends on the level of the category
+	for (int i = 0; i < category.getLevel(); i++) {
+	    toAdd += " ";
+	}
+	//if it's not a "root" category, an arrow is added
+	if (category.getLevel() != 0) {
+	    toAdd += "-> ";
+	}
+	this.setText(toAdd + category);
+	return this;
+    }
+
+}
Index: /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/ui/search/DialogChooseCategory.java
===================================================================
--- /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/ui/search/DialogChooseCategory.java	(revision 8838)
+++ /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/ui/search/DialogChooseCategory.java	(revision 8838)
@@ -0,0 +1,159 @@
+package fr.mael.jiwigo.ui.search;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+
+import fr.mael.jiwigo.om.Category;
+import fr.mael.jiwigo.service.CategoryService;
+import fr.mael.jiwigo.service.ImageService;
+import fr.mael.jiwigo.ui.mainframe.MainFrame;
+
+/**
+ * 
+   Copyright (c) 2010, Mael
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+    * Neither the name of jiwigo nor the
+      names of its contributors may be used to endorse or promote products
+      derived from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+   DISCLAIMED. IN NO EVENT SHALL Mael BE LIABLE FOR ANY
+   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+   
+ * @author mael
+ * Renderer used to display the category list with a hierarchy 
+ *
+ */
+public class DialogChooseCategory extends JDialog implements ActionListener {
+    /**
+     * ArrayList containing all files to send
+     */
+    private ArrayList<File> filesToSend;
+
+    /**
+     * Combobox containing all categories, with a hierarchical display
+     */
+    private JComboBox comboCategories;
+
+    private JButton okButton;
+
+    private JButton cancelButton;
+
+    /**
+     * categories list
+     */
+    private List<Category> categories;
+
+    private JLabel labelCategory;
+
+    public DialogChooseCategory(ArrayList<File> filesToSend) {
+	super(MainFrame.getInstance());
+	this.filesToSend = filesToSend;
+	okButton = new JButton("Ok");
+	cancelButton = new JButton("Annuler");
+	okButton.addActionListener(this);
+	cancelButton.addActionListener(this);
+	labelCategory = new JLabel("Categorie : ");
+	comboCategories = new JComboBox();
+	comboCategories.setRenderer(new ComboCategoryRenderer());
+	try {
+	    categories = CategoryService.getInstance().makeTree();
+	    createCategoriesTree();
+	} catch (IOException e) {
+	    e.printStackTrace();
+	}
+
+	this.setLayout(new GridBagLayout());
+	GridBagConstraints constraints = new GridBagConstraints();
+	constraints.gridx = 0;
+	constraints.gridy = 0;
+	this.add(labelCategory, constraints);
+	constraints.gridx++;
+	this.add(comboCategories, constraints);
+
+	constraints.gridx = 0;
+	constraints.gridy++;
+	this.add(okButton, constraints);
+	constraints.gridx++;
+	this.add(cancelButton, constraints);
+
+	this.pack();
+	this.setLocationRelativeTo(null);
+	this.setVisible(true);
+
+    }
+
+    /**
+     * Method that create the first level of the combobox list
+     * it calls the method that creates the hierarchy
+     */
+    private void createCategoriesTree() {
+	for (Category category : categories) {
+	    if (category.getCategoriesMeres().size() == 0) {
+		category.setLevel(0);
+		comboCategories.addItem(category);
+		createRecursiveCategoriesTree(1, category);
+	    }
+
+	}
+
+    }
+
+    /**
+     * Method that creates the hierarchical view of the combobox list
+     * @param level
+     * @param category
+     */
+    private void createRecursiveCategoriesTree(int level, Category category) {
+
+	for (Category cat : category.getCategoriesFilles()) {
+	    cat.setLevel(level);
+	    comboCategories.addItem(cat);
+	    int levelTemp = level + 1;
+	    createRecursiveCategoriesTree(levelTemp, cat);
+	}
+
+    }
+
+    @Override
+    public void actionPerformed(ActionEvent arg0) {
+	if (arg0.getSource().equals(okButton)) {
+	    Category category = (Category) comboCategories.getSelectedItem();
+	    for (File file : filesToSend) {
+		try {
+		    ImageService.getInstance().creer(file.getAbsolutePath(), category.getIdentifiant());
+		} catch (Exception e) {
+		    e.printStackTrace();
+		}
+	    }
+	    this.dispose();
+	} else if (arg0.getSource().equals(cancelButton)) {
+	    this.dispose();
+	}
+    }
+}
Index: /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/ui/search/tree/FileTree.java
===================================================================
--- /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/ui/search/tree/FileTree.java	(revision 8837)
+++ /extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/ui/search/tree/FileTree.java	(revision 8838)
@@ -3,4 +3,6 @@
 import java.awt.BorderLayout;
 import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseListener;
@@ -9,5 +11,7 @@
 import javax.swing.JFileChooser;
 import javax.swing.JFrame;
+import javax.swing.JMenuItem;
 import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
 import javax.swing.JScrollPane;
 import javax.swing.JTextField;
@@ -17,6 +21,10 @@
 import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreePath;
 import javax.swing.tree.TreeSelectionModel;
 
+import fr.mael.jiwigo.transverse.ImagesManagement;
+import fr.mael.jiwigo.ui.mainframe.DialogPrivacyLevel;
+import fr.mael.jiwigo.ui.search.DialogChooseCategory;
 import fr.mael.jiwigo.ui.search.File;
 
@@ -50,5 +58,5 @@
     * File tree
 */
-public class FileTree extends JPanel implements TreeSelectionListener, MouseListener {
+public class FileTree extends JPanel implements TreeSelectionListener, MouseListener, ActionListener {
     private String path;
 
@@ -58,4 +66,11 @@
 
     private JTree tree;
+
+    private ArrayList<File> filesToSend;
+
+    /**
+     * the menu to add a category
+     */
+    private JMenuItem menuSend;
 
     public static void main(String[] args) {
@@ -78,8 +93,9 @@
 	fieldPath.addMouseListener(this);
 	tree = new JTree(root);
-	tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+	tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
 	tree.addTreeSelectionListener(this);
 	tree.setCellRenderer(new MyTreeCellRenderer());
 	tree.setRootVisible(false);
+	tree.addMouseListener(this);
 	JScrollPane treeView = new JScrollPane(tree);
 	Dimension minimumSize = new Dimension(100, 50);
@@ -90,4 +106,7 @@
     }
 
+    /**
+     * Method that reload the tree
+     */
     public void reload() {
 	root.removeAllChildren();
@@ -96,4 +115,9 @@
     }
 
+    /**
+     * This method creates filters the files to display depending on their
+     * extension (only image files)
+     * @param root
+     */
     private void createNodes(DefaultMutableTreeNode root) {
 	DefaultMutableTreeNode fileNode = null;
@@ -103,4 +127,5 @@
 	    ArrayList<File> filter = new ArrayList<File>();
 	    for (File file : fls) {
+		//only png and jpg are displayed
 		if ((file.isDirectory() && !(file.getName().charAt(0) == '.'))
 			|| (file.isFile() && ((file.getName().toLowerCase().endsWith(".jpg")
@@ -110,4 +135,5 @@
 		}
 	    }
+	    //call to the method that creates the files hierarchy
 	    for (File file : filter) {
 		fileNode = new DefaultMutableTreeNode(file);
@@ -154,6 +180,6 @@
 
     @Override
-    public void mouseClicked(MouseEvent arg0) {
-	if (arg0.getSource().equals(fieldPath)) {
+    public void mouseClicked(MouseEvent mouseEvent) {
+	if (mouseEvent.getSource().equals(fieldPath)) {
 	    JFileChooser chooser = new JFileChooser();
 	    chooser.setCurrentDirectory(new java.io.File(path));
@@ -166,4 +192,19 @@
 	    }
 	}
+
+	if (mouseEvent.getButton() == 3) {
+	    filesToSend = new ArrayList<File>();
+	    TreePath treePath[] = tree.getSelectionPaths();
+	    for (TreePath treeP : treePath) {
+		DefaultMutableTreeNode node = (DefaultMutableTreeNode) treeP.getLastPathComponent();
+		File file = (File) node.getUserObject();
+		filesToSend.add(file);
+	    }
+	    JPopupMenu popup = new JPopupMenu();
+	    menuSend = new JMenuItem("Envoyer");
+	    menuSend.addActionListener(this);
+	    popup.add(menuSend);
+	    popup.show(tree, mouseEvent.getX(), mouseEvent.getY());
+	}
     }
 
@@ -196,3 +237,15 @@
     }
 
+    @Override
+    public void actionPerformed(ActionEvent paramActionEvent) {
+	if (paramActionEvent.getSource().equals(menuSend)) {
+	    //first, the dialog that allows to choose the privacy level of the photo(s) is called
+	    if (!ImagesManagement.getInstance().isRememberPrivacyLevel()) {
+		new DialogPrivacyLevel();
+	    }
+	    //then the dialog that allow to choose the category is called
+	    new DialogChooseCategory(filesToSend);
+	}
+    }
+
 }
