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

SF.net SVN: ledger-smb:[2501] trunk/UI/Contact



Revision: 2501
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2501&view=rev
Author:   einhverfr
Date:     2009-03-15 00:34:39 +0000 (Sun, 15 Mar 2009)

Log Message:
-----------
Move to Javascript-based form hiding/showing of portions of the contact management bit

Modified Paths:
--------------
    trunk/UI/Contact/contact.css
    trunk/UI/Contact/contact.html

Added Paths:
-----------
    trunk/UI/Contact/contact.js

Modified: trunk/UI/Contact/contact.css
===================================================================
--- trunk/UI/Contact/contact.css	2009-03-14 22:17:53 UTC (rev 2500)
+++ trunk/UI/Contact/contact.css	2009-03-15 00:34:39 UTC (rev 2501)
@@ -31,3 +31,10 @@
 div label {
 	margin-left: 1em;
 }
+
+div.container_hidden {
+	display: none;
+}
+div.container {
+	display: block;
+}

Modified: trunk/UI/Contact/contact.html
===================================================================
--- trunk/UI/Contact/contact.html	2009-03-14 22:17:53 UTC (rev 2500)
+++ trunk/UI/Contact/contact.html	2009-03-15 00:34:39 UTC (rev 2501)
@@ -2,9 +2,13 @@
 	include_stylesheet = [
 		stylesheet
 		'UI/Contact/contact.css'
-	] ?>
+	] 
+	include_script = [
+		'UI/Contact/contact.js'
+	]
+?>
 <?lsmb PROCESS 'elements.html' ?>
-<body>
+<body onload="init()">
     <?lsmb IF name ?> 
     <div class="pageheading"><?lsmb name?></div>
     <?lsmb END ?>
@@ -22,16 +26,16 @@
 -->
 <ul class="navigation">
 	<?lsmb IF entity_class == 3 ?>
-	<li><a href="#hr_div"><?lsmb text('HR') ?></a></li>
+	<li class="nav"><a href="#hr_div"><?lsmb text('HR') ?></a></li>
 	<?lsmb ELSE ?>
-	<li><a href="#company_div"><?lsmb text('Company') ?></a></li>
-	<li><a href="#credit_div"><?lsmb text('Accounts') ?></a></li>
+	<li class="nav"><a href="#company_div"><?lsmb text('Company') ?></a></li>
+	<li class="nav"><a href="#credit_div"><?lsmb text('Accounts') ?></a></li>
 	<?lsmb END ?>
 	<?lsmb IF entity_id ?>
-	<li><a href="#location_div"><?lsmb text('Addresses') ?></a></li>
-	<li><a href="#contact_div"><?lsmb text('Contact Info') ?></a></li>
-	<li><a href="#bank_div"><?lsmb text('Bank Accounts') ?></a></li>
-	<li><a href="#notes_div"><?lsmb text('Notes') ?></a></li>
+	<li class="nav"><a href="#location_div"><?lsmb text('Addresses') ?></a></li>
+	<li class="nav"><a href="#contact_div"><?lsmb text('Contact Info') ?></a></li>
+	<li class="nav"><a href="#bank_div"><?lsmb text('Bank Accounts') ?></a></li>
+	<li class="nav"><a href="#notes_div"><?lsmb text('Notes') ?></a></li>
 	<!-- Commented out as not yet implemented -CT
 	<li><a href="#history_div"><?lsmb text('History') ?></a></li>
 	<li><a href="#user_div"><?lsmb text('User') ?></a></li>
@@ -235,7 +239,7 @@
 <?lsmb END ?>
 </div>
 <?lsmb IF entity_id ?>
-<div id="credit_div">
+<div id="credit_div" class="container">
 <div class="listtop"><strong>Accounts</strong></div>
     <table width="100%">
     <tr class="listheading">
@@ -783,7 +787,7 @@
 	</div>
 </form>
 </div>
-<div id="notes_div">
+<div id="notes_div" class="container">
 <div class="listtop"><?lsmb text('Notes') ?></div>
 <form action="<?lsmb script ?>" method="post">
 	<?lsmb PROCESS input element_data = {

Added: trunk/UI/Contact/contact.js
===================================================================
--- trunk/UI/Contact/contact.js	                        (rev 0)
+++ trunk/UI/Contact/contact.js	2009-03-15 00:34:39 UTC (rev 2501)
@@ -0,0 +1,45 @@
+
+function init() {
+	var lis = document.getElementsByTagName('li');
+	for (var e in lis){
+		if (e != e * 1){
+			continue;
+                }
+		e = lis.item(e);
+		if (e.getAttribute('class') == "nav"){
+			e.addEventListener('click', function (e) {
+				for (var a in this.getElementsByTagName('a')){
+					if (a != a * 1){
+						continue;
+					}
+					a = this.getElementsByTagName('a').item(a);
+					var dest = a.getAttribute('href');
+					dest = dest.replace('#', '');
+					select_div(dest);
+					break;
+				}
+				return false;
+			},false);
+		}
+	}
+}
+
+function select_div(div_id){
+	var divs = document.getElementsByTagName('div');
+	var i = 0;
+	for (i=0;i<=divs.length;i++){
+		var e = divs.item(i);
+		if (!e || !e.getAttribute || !e.getAttribute('class')){
+			continue;
+		}
+		if (e.getAttribute('class').match(/^container/)){
+			if (e.getAttribute('id') == div_id){
+				e.className = 'container';
+			}
+			else {
+				e.className = 'container_hidden';
+			}
+		}
+	}
+}
+


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