Index: /extensions/Copyrights/TODO
===================================================================
--- /extensions/Copyrights/TODO	(revision 11677)
+++ /extensions/Copyrights/TODO	(revision 11678)
@@ -2,5 +2,5 @@
 -	Add Icon field to copyrights
 -	Show the copyright when image is displayed
-	It doesnt show a picture yet, but it does show the name of the copyright
+  +	It doesnt show a picture yet, but it does show the name of the copyright
 
 === Bugs ===
Index: /extensions/Copyrights/admin.tpl
===================================================================
--- /extensions/Copyrights/admin.tpl	(revision 11677)
+++ /extensions/Copyrights/admin.tpl	(revision 11678)
@@ -68,4 +68,5 @@
           {else}{'No'|@translate}{/if}
         </td>
+        <!-- Show nice Edit and Delete icons -->
         <td>
           <a href="{$COPYRIGHTS_PATH}-edit&id={$CR.cr_id}">
Index: /extensions/Copyrights/batch_global.php
===================================================================
--- /extensions/Copyrights/batch_global.php	(revision 11677)
+++ /extensions/Copyrights/batch_global.php	(revision 11678)
@@ -21,5 +21,5 @@
 
 	// Assign the template for batch management
-	$template->set_filename('batch_global', dirname(__FILE__).'/batch_global.tpl');
+	$template->set_filename('CR_batch_global', dirname(__FILE__).'/batch_global.tpl');
 
 	// Fetch all the copyrights and assign them to the template
@@ -39,15 +39,13 @@
 
 	// 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
+  $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)
-	)
+    'CONTENT' => $template->parse('CR_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.
+// Process the submit action
 function copyrights_batch_global_submit($action, $collection)
 {
@@ -57,6 +55,7 @@
 		$crID = pwg_db_real_escape_string($_POST['copyrightID']);
 
-		if (count($collection) > 0) {
-		$query = sprintf(
+    // Delete any previously assigned copyrights
+    if (count($collection) > 0) {
+    	$query = sprintf(
 				'DELETE
 				FROM %s
@@ -67,4 +66,5 @@
 		}
 
+    // Add the copyrights from the submit form to an array
 		$edits = array();
 		foreach ($collection as $image_id)
@@ -79,8 +79,9 @@
 		}
 
+    // Insert the array into the database
 		mass_inserts(
-			COPYRIGHTS_MEDIA,		// Table name
-			array_keys($edits[0]),	//Columns
-			$edits					// Data
+			COPYRIGHTS_MEDIA,		    // Table name
+			array_keys($edits[0]),	// Columns
+			$edits					        // Data
 		);
 	}
Index: /extensions/Copyrights/batch_global.tpl
===================================================================
--- /extensions/Copyrights/batch_global.tpl	(revision 11677)
+++ /extensions/Copyrights/batch_global.tpl	(revision 11678)
@@ -1,2 +1,3 @@
+<!-- Template for the copyright selector -->
 <div id="copyrights">
 	{'Copyright'|@translate}
Index: /extensions/Copyrights/batch_single.php
===================================================================
--- /extensions/Copyrights/batch_single.php	(revision 11677)
+++ /extensions/Copyrights/batch_single.php	(revision 11678)
@@ -1,5 +1,5 @@
 <?php
 
-// Add a prefilter
+// Add event handlers for the prefilter
 add_event_handler('loc_end_element_set_unit', 'CR_set_prefilter_batch_single', 55 );
 add_event_handler('loc_begin_element_set_unit', 'CR_batch_single_submit', 50 );
@@ -8,4 +8,5 @@
 add_event_handler('loc_end_element_set_unit', 'CR_add_batch_single_vars_to_template');
 
+// Add a prefilter to the template
 function CR_set_prefilter_batch_single()
 {
@@ -14,7 +15,8 @@
 }
 
+// Insert the copyright selector to the template
 function CR_batch_single($content, &$smarty)
 {
-	$search = "#<td><strong>{'Creation date'#"; // Not ideal, but ok for now :)
+	$search = "#<td><strong>{'Creation date'#";
 
 	// We use the <tr> from the Creation date, and give them a new <tr>
@@ -31,11 +33,8 @@
 		<td><strong>{\'Creation date\'';
 
-    return preg_replace($search, $replacement, $content);
-	
-	// Dit is een interresant testje - deze functie word dus een aantal keren (3) aangeroepen,
-	// en pas de laatste keer is bevat $content meer dan een aantal enters...
-	// return $content.'<div id="dwo_test" style="display: none;">'.$content.'</div>';
+  return preg_replace($search, $replacement, $content);
 }
 
+// Assign the variables to the Smarty template
 function CR_add_batch_single_vars_to_template()
 {
@@ -70,8 +69,11 @@
 	while ($row = pwg_db_fetch_assoc($result)) {
 		$CRcopyrights[$row['media_id']] = $row['cr_id'];
-	}
+  }
+
+  // Assign the copyrights to the template
 	$template->assign('CRcopyrights', $CRcopyrights);
 }
 
+// Catch the submit and update the copyrights tables
 function CR_batch_single_submit()
 {
@@ -81,5 +83,5 @@
 		$collection = explode(',', $_POST['element_ids']);
 
-		// Delete all existing id's of which the Copyright is going to be set
+		// Delete all existing id's of which the copyright is going to be set
 		if (count($collection) > 0) {
 			$query = sprintf(
@@ -90,6 +92,7 @@
 				COPYRIGHTS_MEDIA, implode(',', $collection));
 			pwg_query($query);
-		}
-		// Add all Copyrights to an array
+    }
+
+		// Add all copyrights to an array
 		$edits = array();
 		foreach ($collection as $image_id) {
@@ -105,6 +108,7 @@
 				)
 			);
-		}
-		// Add the array to the database
+    }
+
+		// Insert the array to the database
 		mass_inserts(
 			COPYRIGHTS_MEDIA,        // Table name
Index: /extensions/Copyrights/image.php
===================================================================
--- /extensions/Copyrights/image.php	(revision 11677)
+++ /extensions/Copyrights/image.php	(revision 11678)
@@ -1,5 +1,5 @@
 <?php
 
-// Add a prefilter
+// Add an event handler for a prefilter
 add_event_handler('loc_begin_picture', 'copyrights_set_prefilter_add_to_pic_info', 55 );
 
@@ -7,4 +7,5 @@
 add_event_handler('loc_begin_picture', 'copyrights_add_image_vars_to_template');
 
+// Add the prefilter to the template
 function copyrights_set_prefilter_add_to_pic_info()
 {
@@ -13,4 +14,5 @@
 }
 
+// Insert the template for the copyright display
 function copyrights_add_to_pic_info($content, &$smarty)
 {
@@ -32,4 +34,5 @@
 }
 
+// Assign values to the variables in the template
 function copyrights_add_image_vars_to_template()
 {
@@ -40,10 +43,11 @@
 	{
 		// Get the copyright name, url and description that belongs to the current media_item
-		$query = '
+		$query = sprintf('
 		  select name, url, descr
-		  FROM '.COPYRIGHTS_ADMIN.' NATURAL JOIN '.COPYRIGHTS_MEDIA.'
-		  WHERE media_id = '.$page['image_id'].'
+		  FROM %s NATURAL JOIN %s
+		  WHERE media_id = %s
 		  AND visible = 1
-		  ;';
+      ;',
+      COPYRIGHTS_ADMIN, COPYRIGHTS_MEDIA, $page['image_id']);
 		$result = pwg_query($query);
 		$row = pwg_db_fetch_row($result);
@@ -58,10 +62,11 @@
 			
 		// Sending data to the template
-		$template->assign(
-		array	(
-		'CR_INFO_NAME' => $name,
-		'CR_INFO_URL' => $url,
-		'CR_INFO_DESCR' => $descr
-				));
+    $template->assign(
+      array	(
+        'CR_INFO_NAME' => $name,
+        'CR_INFO_URL' => $url,
+        'CR_INFO_DESCR' => $descr
+      )
+    );
 	}
 }
Index: /extensions/Copyrights/modify.php
===================================================================
--- /extensions/Copyrights/modify.php	(revision 11677)
+++ /extensions/Copyrights/modify.php	(revision 11678)
@@ -21,5 +21,5 @@
 	$replacement = '<td><strong>{\'Copyright\'|@translate}</strong></td>
 		<td>
-			<select id="copyright_selector" name="copyright_selector">
+			<select id="copyrightID" name="copyrightID">
 				<option value="0">--</option>
 				{html_options options=$CRoptions selected=$CRid}
@@ -85,5 +85,5 @@
 			// The data from the submit
 			$image_id = $_GET['image_id'];
-			$CRid = $_POST['copyright_selector'];
+			$CRid = $_POST['copyrightID'];
 
 			// Delete the Copyright if it allready exists
