Index: /extensions/Copyrights/admin.php
===================================================================
--- /extensions/Copyrights/admin.php	(revision 11793)
+++ /extensions/Copyrights/admin.php	(revision 11794)
@@ -145,4 +145,6 @@
   'SELECT *
   FROM %s
+  WHERE cr_id <> -1
+  ORDER BY cr_id ASC
   ;',
   COPYRIGHTS_ADMIN);
Index: /extensions/Copyrights/batch_global.php
===================================================================
--- /extensions/Copyrights/batch_global.php	(revision 11793)
+++ /extensions/Copyrights/batch_global.php	(revision 11794)
@@ -1,11 +1,3 @@
 <?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
@@ -28,4 +20,5 @@
 		FROM %s
 		WHERE `visible`<>0
+		ORDER BY cr_id ASC
 		;',
 	COPYRIGHTS_ADMIN);
@@ -39,9 +32,9 @@
 
 	// Add info on the "choose action" dropdown in the batch manager
-  $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('CR_batch_global', true)
-  )
+	$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('CR_batch_global', true)
+		)
 	);
 }
@@ -55,7 +48,7 @@
 		$crID = pwg_db_real_escape_string($_POST['copyrightID']);
 
-    // Delete any previously assigned copyrights
-    if (count($collection) > 0) {
-    	$query = sprintf(
+		// Delete any previously assigned copyrights
+		if (count($collection) > 0) {
+			$query = sprintf(
 				'DELETE
 				FROM %s
@@ -66,23 +59,25 @@
 		}
 
-    // Add the copyrights from the submit form to an array
-		$edits = array();
-		foreach ($collection as $image_id)
-		{
-			array_push(
-				$edits,
-				array(
-					'media_id' => $image_id,
-					'cr_id' => $crID,
-				)
+		// If you assign no copyright, dont put them in the table
+		if ($crID != '') {
+			// Add the copyrights from the submit form to an array
+			$edits = array();
+			foreach ($collection as $image_id) {
+				array_push(
+					$edits,
+					array(
+						'media_id' => $image_id,
+						'cr_id' => $crID,
+					)
+				);
+			}
+
+			// Insert the array into the database
+			mass_inserts(
+				COPYRIGHTS_MEDIA,		// Table name
+				array_keys($edits[0]),	// Columns
+				$edits					// Data
 			);
 		}
-
-    // Insert the array into the database
-		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 11793)
+++ /extensions/Copyrights/batch_global.tpl	(revision 11794)
@@ -3,5 +3,5 @@
 	{'Copyright'|@translate}
 	<select name="copyrightID">
-		<option value="0">--</option>
+		<option value="">--</option>
 		{html_options options=$CRoptions}
 	</select>
Index: /extensions/Copyrights/batch_single.php
===================================================================
--- /extensions/Copyrights/batch_single.php	(revision 11793)
+++ /extensions/Copyrights/batch_single.php	(revision 11794)
@@ -24,5 +24,5 @@
 		<td>
 			<select id="copyright-{$element.ID}" name="copyright-{$element.ID}">
-				<option value="0">--</option>
+				<option value="">--</option>
 				{html_options options=$CRoptions selected=$CRcopyrights[$element.ID]}
 			</select>
@@ -48,4 +48,5 @@
 		FROM %s
 		WHERE `visible`<>0
+		ORDER BY cr_id ASC
 		;',
 		COPYRIGHTS_ADMIN);
@@ -92,5 +93,5 @@
 				COPYRIGHTS_MEDIA, implode(',', $collection));
 			pwg_query($query);
-    }
+		}
 
 		// Add all copyrights to an array
@@ -100,20 +101,24 @@
 			$crID = pwg_db_real_escape_string($_POST['copyright-'.$image_id]);
 
-			array_push(
-				$edits,
-				array(
-					'media_id' => $image_id,
-		
-		'cr_id' => $crID,
-				)
+			// If you assign no copyright, dont put them in the table
+			if ($crID != '') {
+				array_push(
+					$edits,
+					array(
+						'media_id' => $image_id,
+						'cr_id' => $crID,
+					)
+				);
+			}
+		}
+
+		if (count($edits) > 0) {
+			// Insert the array to the database
+			mass_inserts(
+				COPYRIGHTS_MEDIA,        // Table name
+				array_keys($edits[0]),   // Columns
+				$edits                   // Data
 			);
-    }
-
-		// Insert the array to the database
-		mass_inserts(
-			COPYRIGHTS_MEDIA,        // Table name
-			array_keys($edits[0]),   // Columns
-			$edits                   // Data
-		);
+		}
 	}
 }
Index: /extensions/Copyrights/image.php
===================================================================
--- /extensions/Copyrights/image.php	(revision 11793)
+++ /extensions/Copyrights/image.php	(revision 11794)
@@ -44,19 +44,36 @@
 		// Get the copyright name, url and description that belongs to the current media_item
 		$query = sprintf('
-		  select name, url, descr
+		  select cr_id, name, url, descr
 		  FROM %s NATURAL JOIN %s
 		  WHERE media_id = %s
 		  AND visible = 1
-      ;',
-      COPYRIGHTS_ADMIN, COPYRIGHTS_MEDIA, $page['image_id']);
+		;',
+		COPYRIGHTS_ADMIN, COPYRIGHTS_MEDIA, $page['image_id']);
 		$result = pwg_query($query);
-		$row = pwg_db_fetch_row($result);
+		$row = pwg_db_fetch_assoc($result);
 		$name = '';
 		$url = '';
 		$descr = '';
-		if(count($row) > 0) {
-			$name = $row[0];
-			$url = $row[1];
-			$descr = $row[2];
+		if (count($row) > 0) {
+			if ($row['cr_id'] == -1) {
+						$query = sprintf('
+							SELECT name, url, descr
+							FROM %s
+							WHERE cr_id IN (
+								SELECT a.copyright
+								FROM '.$prefixeTable.'images i, '.$prefixeTable.'author_extended a
+								WHERE i.id = %d
+								AND i.author = a.name
+							)
+						;',
+						COPYRIGHTS_ADMIN, $page['image_id']);
+						$result = pwg_query($query);
+						$row = pwg_db_fetch_assoc($result);
+			}
+		}
+		if (count($row) > 0) {
+			$name = $row['name'];
+			$url = $row['url'];
+			$descr = $row['descr'];
 		}
 			
Index: /extensions/Copyrights/modify.php
===================================================================
--- /extensions/Copyrights/modify.php	(revision 11793)
+++ /extensions/Copyrights/modify.php	(revision 11794)
@@ -3,5 +3,5 @@
 // Add a prefilter
 add_event_handler('loc_begin_admin', 'CR_set_prefilter_modify', 50 );
-add_event_handler('loc_begin_admin', 'CR_modify_submit', 50 );
+add_event_handler('loc_begin_admin', 'CR_modify_submit', 45 );
 
 // Change the variables used by the function that changes the template
@@ -22,5 +22,5 @@
 		<td>
 			<select id="copyrightID" name="copyrightID">
-				<option value="0">--</option>
+				<option value="">--</option>
 				{html_options options=$CRoptions selected=$CRid}
 			</select>
@@ -48,4 +48,5 @@
 			FROM %s
 			WHERE `visible`<>0
+			ORDER BY cr_id ASC
 			;',
 			COPYRIGHTS_ADMIN);
@@ -96,11 +97,14 @@
 			pwg_query($query);
 
-		// Insert the Copyright
-		$query = sprintf(
-		  'INSERT INTO %s
-		  VALUES (%d, %d)
-		  ;',
-		  COPYRIGHTS_MEDIA, $image_id, $CRid);
-		pwg_query($query);
+			// If you assign no copyright, dont put it in the table
+			if ($CRid != '') {
+				// Insert the Copyright
+				$query = sprintf(
+					'INSERT INTO %s
+					VALUES (%d, %d)
+					;',
+					COPYRIGHTS_MEDIA, $image_id, $CRid);
+				pwg_query($query);
+			}
 		}
 	}
