Index: extensions/Copyrights/TODO
===================================================================
--- extensions/Copyrights/TODO	(revision 11422)
+++ extensions/Copyrights/TODO	(revision 11423)
@@ -1,5 +1,7 @@
 === TODO ===
 - Implement single mode Batch Manager
-    Probably use prefilters combined with loc_begin_element_set_unit
+    Probably use prefilters combined with "loc_begin_element_set_unit" (found in event tracer)
+	SOURCES: "loc_begin_admin": http://piwigo.org/forum/viewtopic.php?id=17468
+			 "use prefilters": http://piwigo.org/forum/viewtopic.php?id=17551&p=2
 - Add Icon field to copyrights
 - Show the copyright when image is displayed
@@ -9,2 +11,3 @@
 	- If you create a new copyright with a name that's already used
 	- Description doesnt show with the copyright info (on the admin page)
+	- The warning triangle saying our plugin does not seem compatible - no clue
Index: extensions/Copyrights/batch_global.php
===================================================================
--- extensions/Copyrights/batch_global.php	(revision 11423)
+++ extensions/Copyrights/batch_global.php	(revision 11423)
@@ -0,0 +1,89 @@
+<?php
+
+// @Johan: Misschien een goed idee om dit ook in een apart php scriptje te zetten, voor de overzichtelijkheid.
+// En om deze reden (Citaat uit de piwigo docs http://piwigo.org/doc/doku.php?id=en:plugins):
+// Code size
+// When PWG loads the plugins, it will include every main.inc.php.
+// Don't put in your main.inc.php 3000 lines of code just to add a page on the administration menu.
+// Split you main.inc.php in several files and feel free to add include_once inside functions defined in main.inc.php as much as you want.
+
+
+// Add copyrights drop down menu to the batch manager
+add_event_handler('loc_end_element_set_global', 'copyrights_batch_global');
+// Add handler to the submit event of the batch manager
+add_event_handler('element_set_global_action', 'copyrights_batch_global_submit', 50, 2);
+
+function copyrights_batch_global()
+{
+  global $template;
+
+  load_language('plugin.lang', dirname(__FILE__).'/');					// Engels is voorlopig goed zat
+
+  // Assign the template for batch management
+  $template->set_filename('batch_global', dirname(__FILE__).'/batch_global.tpl');
+
+  // Fetch all the copyrights and assign them to the template
+  $query = sprintf(
+    'SELECT `cr_id`,`name`
+    FROM %s
+    WHERE `visible`<>0
+    ;',
+    COPYRIGHTS_ADMIN);
+  $result = pwg_query($query);
+  $CRoptions = array();
+  while ($row = pwg_db_fetch_assoc($result)) {
+    $CRoptions[$row['cr_id']] = $row['name'];
+  }
+  $template->assign('CRoptions', $CRoptions);
+
+  
+  // Goed, ik weet dus echt niet waarom dit hieronder gedaan wordt...
+  // AHA!!!! - dit is er zodat de "choose action" optie deze plugin gebruikt....
+  $template->append('element_set_global_plugins_actions', array(
+    'ID' => 'copyrights',	// ID of the batch manager action
+    'NAME' => l10n('Edit copyright'), // Description of the batch manager action
+    'CONTENT' => $template->parse('batch_global', true)
+    )
+  );
+}
+
+// * Deze functie wordt een keer aangeroepen, nadat de gebruiker submit.
+// * Fietst met een foreach loop over de geselecteerde fotos
+// * Rammelt alle toevoegingen in 1x met mass_updates naar de db.
+function copyrights_batch_global_submit($action, $collection)
+{
+  if ($action == 'copyrights')
+  {
+	  $crID = pwg_db_real_escape_string($_POST['copyrightID']);
+    
+    if (count($collection) > 0) {
+      $query = sprintf(
+        'DELETE
+        FROM %s
+        WHERE media_id IN (%s)
+        ;',
+        COPYRIGHTS_MEDIA, implode(',', $collection));
+      pwg_query($query);
+    }
+
+    $edits = array();
+    foreach ($collection as $image_id)
+    {
+      array_push(
+        $edits,
+        array(
+          'media_id' => $image_id,
+          'cr_id' => $crID,
+          )
+        );
+    }
+
+    mass_inserts(
+      COPYRIGHTS_MEDIA, // Table name
+      array_keys($edits[0]), //Columns
+      $edits // Data
+    );
+  }
+}
+
+?>
Index: extensions/Copyrights/batch_global.tpl
===================================================================
--- extensions/Copyrights/batch_global.tpl	(revision 11423)
+++ extensions/Copyrights/batch_global.tpl	(revision 11423)
@@ -0,0 +1,3 @@
+<div id="copyrights">
+  {'Copyright'|@translate} {html_options name=copyrightID options=$CRoptions}
+</div>
Index: extensions/Copyrights/batch_single.php
===================================================================
--- extensions/Copyrights/batch_single.php	(revision 11423)
+++ extensions/Copyrights/batch_single.php	(revision 11423)
@@ -0,0 +1,18 @@
+<?php
+
+/*
+Try to be able to change something in the batch manager single mode (unit mode)
+*/
+
+
+
+// Add a prefilter - whatever a prefilter may be - loc begin admin, because of this: http://piwigo.org/forum/viewtopic.php?id=17468
+add_event_handler('loc_begin_admin', 'set_prefilter_batch_single', 55 );
+
+function set_prefilter_batch_single()
+{
+	global $template;
+	$template->set_prefilter('picture', 'copyrights_batch_single');
+}
+
+?>
Index: extensions/Copyrights/image.php
===================================================================
--- extensions/Copyrights/image.php	(revision 11422)
+++ extensions/Copyrights/image.php	(revision 11423)
@@ -9,18 +9,23 @@
 */
 
-
+// What do these prefilters do?
+// First they use loc_begin_picture to set some template variables
+// Then they use the same event to set a prefilter, who on his turn will change the content
 
 // Add a prefilter - whatever a prefilter may be
-add_event_handler('loc_begin_picture', 'set_prefilter_add_to_pic_info', 55 );
+add_event_handler('loc_begin_picture', 'copyrights_set_prefilter_add_to_pic_info', 55 );
 
-function set_prefilter_add_to_pic_info()
+// Another function of which i cant see the use ;-)
+add_event_handler('loc_begin_picture', 'copyrights_add_vars_to_template');
+
+function copyrights_set_prefilter_add_to_pic_info()
 {
 	global $template;
-	$template->set_prefilter('picture', 'add_to_pic_info');
+	$template->set_prefilter('picture', 'copyrights_add_to_pic_info');
 }
  
 
  // This function is called by the set_prefilter_add_to_pic_info function. It has something to do with the prefilter stuff, whatever it may be :p
-function add_to_pic_info($content, &$smarty)
+function copyrights_add_to_pic_info($content, &$smarty)
 {
 	// Voeg de informatie toe na de auteur - dus voor de datum dat ie gemaakt is...
@@ -42,11 +47,9 @@
 }
 
-// Another function of which i cant see the use ;-)
-add_event_handler('loc_begin_picture', 'add_vars_to_template');
-
-function add_vars_to_template()
+function copyrights_add_vars_to_template()
 {
 // For as far as i know i only need the $prefixtable, $page and $template
-global $conf, $page, $template, $tab, $cit, $nbr, $prefixeTable;
+//global $conf, $page, $template, $tab, $cit, $nbr, $prefixeTable;
+global $page, $template, $prefixeTable;
 //load_language('plugin.lang', ADDINFO_PATH);
 //load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) );
Index: extensions/Copyrights/main.inc.php
===================================================================
--- extensions/Copyrights/main.inc.php	(revision 11422)
+++ extensions/Copyrights/main.inc.php	(revision 11423)
@@ -32,7 +32,6 @@
 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
-define('COPYRIGHTS_PATH', PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)) . '/'); // The plugin path
-define('COPYRIGHTS_WEB_PATH', get_root_url().'admin.php?page=plugin-Copyrights');
-// Whats the difference between "COPYRIGHTS_PATH" and "COPYRIGHTS_WEB_PATH" ???
+define('COPYRIGHTS_PATH', PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)) . '/');  // The plugin path
+define('COPYRIGHTS_WEB_PATH', get_root_url().'admin.php?page=plugin-Copyrights'); // The path used in admin.php
 
 global $prefixeTable;
@@ -48,4 +47,5 @@
 
 
+ // Add to the menu, dont do anything right now
 add_event_handler('get_admin_plugin_menu_links', 'copyrights_admin_menu');
 function copyrights_admin_menu($menu) {
@@ -66,5 +66,5 @@
 
 
-//if (script_basename() == 'picture') // Why should i want this here?
+// Add information to the picture's description (The copyright's name)
 include_once(dirname(__FILE__).'/image.php');
 
@@ -74,90 +74,11 @@
  * +-----------------------------------------------------------------------+ */
 
+ 
+ // Global mode
+include_once(dirname(__FILE__).'/batch_global.php');
 
-// @Johan: Misschien een goed idee om dit ook in een apart php scriptje te zetten, voor de overzichtelijkheid.
-// En om deze reden (Citaat uit de piwigo docs http://piwigo.org/doc/doku.php?id=en:plugins):
-// Code size
-// When PWG loads the plugins, it will include every main.inc.php.
-// Don't put in your main.inc.php 3000 lines of code just to add a page on the administration menu.
-// Split you main.inc.php in several files and feel free to add include_once inside functions defined in main.inc.php as much as you want.
-
-
-// Add copyrights drop down menu to the batch manager
-add_event_handler('loc_end_element_set_global', 'copyrights_batch');
-// Add handler to the submit event of the batch manager
-add_event_handler('element_set_global_action', 'copyrights_batch_submit', 50, 2);
-
-function copyrights_batch()
-{
-  global $template;
-
-  load_language('plugin.lang', dirname(__FILE__).'/');					// Engels is voorlopig goed zat
-
-  // Assign the template for batch management
-  $template->set_filename('batch', dirname(__FILE__).'/batch.tpl');
-
-  // Fetch all the copyrights and assign them to the template
-  $query = sprintf(
-    'SELECT `cr_id`,`name`
-    FROM %s
-    WHERE `visible`<>0
-    ;',
-    COPYRIGHTS_ADMIN);
-  $result = pwg_query($query);
-  $CRoptions = array();
-  while ($row = pwg_db_fetch_assoc($result)) {
-    $CRoptions[$row['cr_id']] = $row['name'];
-  }
-  $template->assign('CRoptions', $CRoptions);
-
-  
-  // Goed, ik weet dus echt niet waarom dit hieronder gedaan wordt...
-  // AHA!!!! - dit is er zodat de "choose action" optie deze plugin gebruikt....
-  $template->append('element_set_global_plugins_actions', array(
-    'ID' => 'copyrights',	// ID of the batch manager action
-    'NAME' => l10n('Edit copyright'), // Description of the batch manager action
-    'CONTENT' => $template->parse('batch', true)
-    )
-  );
-}
-
-// * Deze functie wordt een keer aangeroepen, nadat de gebruiker submit.
-// * Fietst met een foreach loop over de geselecteerde fotos
-// * Rammelt alle toevoegingen in 1x met mass_updates naar de db.
-function copyrights_batch_submit($action, $collection)
-{
-  if ($action == 'copyrights')
-  {
-	  $crID = pwg_db_real_escape_string($_POST['copyrightID']);
-    
-    if (count($collection) > 0) {
-      $query = sprintf(
-        'DELETE
-        FROM %s
-        WHERE media_id IN (%s)
-        ;',
-        COPYRIGHTS_MEDIA, implode(',', $collection));
-      pwg_query($query);
-    }
-
-    $edits = array();
-    foreach ($collection as $image_id)
-    {
-      array_push(
-        $edits,
-        array(
-          'media_id' => $image_id,
-          'cr_id' => $crID,
-          )
-        );
-    }
-
-    mass_inserts(
-      COPYRIGHTS_MEDIA, // Table name
-      array_keys($edits[0]), //Columns
-      $edits // Data
-    );
-  }
-}
+// Single mode - TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST 
+// should become a include_once !!!
+include(dirname(__FILE__).'/batch_single.php');
 
 ?>
