[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[2528] trunk/UI/payments



Revision: 2528
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2528&view=rev
Author:   einhverfr
Date:     2009-03-24 20:52:20 +0000 (Tue, 24 Mar 2009)

Log Message:
-----------
Payment javascript fixes

Modified Paths:
--------------
    trunk/UI/payments/payments_detail.html
    trunk/UI/payments/payments_detail.js

Modified: trunk/UI/payments/payments_detail.html
===================================================================
--- trunk/UI/payments/payments_detail.html	2009-03-23 23:21:15 UTC (rev 2527)
+++ trunk/UI/payments/payments_detail.html	2009-03-24 20:52:20 UTC (rev 2528)
@@ -207,7 +207,7 @@
 		name = "paid_$r.contact_id"
 		value = "some"
 		class = "paid_some"
-		id = "paid_some_$r.contact_id"
+		id = "paid-some-$r.contact_id"
 		label = text('Some')
 		checked = (${"paid_$r.contact_id"} == 'some') ? "checked" : ""
 		type = "radio"
@@ -216,7 +216,7 @@
 		name = "paid_$r.contact_id"
 		value = "all"
 		class = "paid_all"
-		id = "paid_all_$r.contact_id"
+		id = "paid-all-$r.contact_id"
 		label = text('All')
 		checked = (${"paid_$r.contact_id"} != 'some') ? "checked" : ""
 		type = "radio"
@@ -232,7 +232,7 @@
     </tr>
     <tr class="listrow<?lsmb rc ?>">
 	<td class="invoice_detail_list" colspan="3">
-	<table id = "invoice_data_table_<?lsmb r.contact_id ?>" width="100%" class = "detail_table_visible">
+	<table id = "invoice-data-table-<?lsmb r.contact_id ?>" width="100%" class = "detail_table_visible">
 		<tr class="listheading">
 			<th class="invoice_date_list"><?lsmb text('Date') ?>
 			</th>

Modified: trunk/UI/payments/payments_detail.js
===================================================================
--- trunk/UI/payments/payments_detail.js	2009-03-23 23:21:15 UTC (rev 2527)
+++ trunk/UI/payments/payments_detail.js	2009-03-24 20:52:20 UTC (rev 2528)
@@ -1,67 +1,52 @@
 
 function init() {
-	var spans = document.getElementsByTagName('span');
-	var tables = document.getElementsByTagName('table');
-	for (var i=0, il=tables.length; i<il; i++){
-		var table = tables.item(i);
-		if (table.getAttribute('class') == 'detail_table_visible'){
-			var tid = table.getAttribute('id');
-			var cid = tid.slice(19, tid.length);
-			var rg = document.getElementsByName('paid_' + cid);
-			for (var i=0, il=rg.length; i<il; i++){
-				var button = rg.item(i);
-				if ((button.value == 'all') && 
-						(button.checked == true)){
-					table.className = 'detail_table_hidden';
-				}
-			}
+	var cc = document.getElementById('contact-count').value;
+	for (var i=1; i <= cc; i++){
+		var paid = '';
+		var cid = document.getElementById('contact-' + i).value;
+		var radio = document.getElementById('paid-all-' + cid);
+		if (radio.checked == true){
+			paid = 'all';
+		} else {
+			paid = 'some';
 		}
-	}
-	for (var i=0, il=spans.length; i<il; i++){
-		var span = spans.item(i);
-		if (span.getAttribute('class') != 'details_select'){
-			continue;
+		radio.addEventListener('click', 
+			function(e){
+				var my_id = 
+					this.getAttribute('id');
+					var contact_id = 
+						my_id.slice(9, 
+							my_id.length);
+					hide_details(contact_id);
+					return true;
+				}, false);
+		radio = document.getElementById('paid-some-' + cid);
+		radio.addEventListener('click', 
+			function(e){
+				var my_id = 
+					this.getAttribute('id');
+					var contact_id = 
+						my_id.slice(10, 
+							my_id.length);
+					show_details(contact_id);
+					return true;
+				}, false);
+		var table = document.getElementById('invoice-data-table-' + cid);
+		if (paid == 'all'){
+			table.className = 'detail_table_hidden';
 		}
-		var inputs = span.getElementsByTagName('input');
-		for (var i=0, il=inputs.length; i<il; i++){
-			var input = inputs.item(i);
-			if (input.getAttribute('class') == 'paid_some'){
-				input.addEventListener('click', 
-					function(e){
-						var my_id = 
-							this.getAttribute('id');
-						var contact_id = 
-							my_id.slice(10, 
-								my_id.length);
-						show_details(contact_id);
-						return true;
-					}, false);
-			}
-			else if (input.getAttribute('class') == 'paid_all'){
-				input.addEventListener('click', 
-					function(e){
-						var my_id = 
-							this.getAttribute('id');
-						var contact_id = 
-							my_id.slice(9, 
-								my_id.length);
-						hide_details(contact_id);
-						return true;
-					}, false);
-			}
-		}
 	}
 }
 
 function show_details(contact_id){
-	var e_id = "invoice_data_table_" + contact_id;
+	var e_id = "invoice-data-table-" + contact_id;
 	var e = document.getElementById(e_id);
 	e.className = "detail_table_visible";
 	return true;
 }
 
 function hide_details(contact_id){
-	var e_id = "invoice_data_table_" + contact_id;
+	var e_id = "invoice-data-table-" + contact_id;
 	var e = document.getElementById(e_id);
 	e.className = "detail_table_hidden";
 	return true;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.