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

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



Revision: 6044
          http://sourceforge.net/p/ledger-smb/code/6044
Author:   einhverfr
Date:     2013-09-18 02:20:18 +0000 (Wed, 18 Sep 2013)
Log Message:
-----------
Moving dojo setup on contact form to programmatic autodetection rather that declarative syntax.  Next up, declarative table-like forms

Modified Paths:
--------------
    trunk/UI/Contact/contact.html
    trunk/UI/Contact/contact.js
    trunk/UI/Contact/divs/address.html
    trunk/UI/Contact/divs/bank_act.html
    trunk/UI/Contact/divs/company.html
    trunk/UI/Contact/divs/contact_info.html
    trunk/UI/Contact/divs/credit.html
    trunk/UI/Contact/divs/employee.html
    trunk/UI/Contact/divs/files.html
    trunk/UI/Contact/divs/notes.html
    trunk/UI/Contact/divs/person.html
    trunk/UI/Contact/divs/user.html
    trunk/UI/Contact/divs/wage.html
    trunk/UI/Contact/tabs.js
    trunk/UI/lib/ui-header.html

Modified: trunk/UI/Contact/contact.html
===================================================================
--- trunk/UI/Contact/contact.html	2013-09-17 10:38:24 UTC (rev 6043)
+++ trunk/UI/Contact/contact.html	2013-09-18 02:20:18 UTC (rev 6044)
@@ -27,9 +27,11 @@
 <?lsmb IF entity_id ?><?lsmb operation = "Edit" ?><?lsmb ELSE
 ?><?lsmb operation = "Add"
 ?><?lsmb END ?>
-<script type="text/javascript">
+<script type="text/javascript" language="JavaScript">
 	var activeDiv = '<?lsmb request.target_div ?>';
 </script>
+<script type="text/javascript" language="JavaScript" 
+        src="UI/Contact/contact.js"></script>
 <!-- CT: Keys for localization scripts:
 <?lsmb text("Add Customer") ?>
 <?lsmb text("Edit Customer") ?>

Modified: trunk/UI/Contact/contact.js
===================================================================
--- trunk/UI/Contact/contact.js	2013-09-17 10:38:24 UTC (rev 6043)
+++ trunk/UI/Contact/contact.js	2013-09-18 02:20:18 UTC (rev 6044)
@@ -1,48 +1,42 @@
+require(['dojo/parser', 
+         'dojo/query', 
+         'dojo/dom', 
+         "dijit/layout/TabContainer",
+         "dijit/layout/ContentPane",
+         'lsmb/Contact/tabs',
+          'dijit/registry',
+         'dojo/ready'],
+       function(parser, query, dom, tc, cp, obj, registry){
+           parser.instantiate([dom.byId('contact_tabs')], 
+              { "data-dojo-type": "dijit/layout/TabContainer" }
+           );
+           var tabs = registry.byId('contact_tabs');
+           query('.container').forEach(function(cnode){
+               new cp (
+                   { "data-dojo-type": 'dijit.layout.ContentPane',
+                     "title": cnode.title},
+                   cnode 
+               );
+               var t = registry.byId(cnode.id);
+               if (t !== undefined){
+                   tabs.addChild(t);
+               }
+           });
+           tabs.startup();
+           obj.init();
+       } 
+ 
+);
 
-function init(div_id) {
-	var lis = document.getElementsByTagName('li');
-	for (var e in lis){
-		if (e != e * 1){
-			continue;
-                }
-		e = lis[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')[a];
-					var dest = a.getAttribute('href');
-					dest = dest.replace('#', '');
-					select_div(dest);
-					break;
-				}
-				return false;
-			},false);
-		}
-	}
-	if (div_id != '' && document.getElementById(div_id)){
-		select_div(div_id);
-	}
-}
 
-function select_div(div_id){
-	var divs = document.getElementsByTagName('div');
-	var i = 0;
-	for (i=0;i<=divs.length;i++){
-		var e = divs[i];
-		if (!e || !e.getAttribute || !e.getAttribute('class')){
-			continue;
+require([
+	'lsmb/Contact/tabs',
+	'dojo/parser',
+	'dojo/ready'], 
+	function(
+		  obj,
+		  parser){
 		}
-		if (e.getAttribute('class').match(/^container/)){
-			if (e.getAttribute('id') == div_id){
-				e.className = 'container';
-			}
-			else {
-				e.className = 'container_hidden';
-			}
-		}
-	}
-}
+);
 
+

Modified: trunk/UI/Contact/divs/address.html
===================================================================
--- trunk/UI/Contact/divs/address.html	2013-09-17 10:38:24 UTC (rev 6043)
+++ trunk/UI/Contact/divs/address.html	2013-09-18 02:20:18 UTC (rev 6044)
@@ -1,4 +1,4 @@
-<div id="address_div" data-dojo-type="dijit/layout/ContentPane" title="<?lsmb text('Addresses') ?>" class="container">
+<div id="address_div" title="<?lsmb text('Addresses') ?>" class="container">
     <div class="listtop"><?lsmb text('Locations') ?></div>
 	<!-- This entire form should probably be optionaly automated with AJAX
 	in order to prevent user confusion -CT -->

Modified: trunk/UI/Contact/divs/bank_act.html
===================================================================
--- trunk/UI/Contact/divs/bank_act.html	2013-09-17 10:38:24 UTC (rev 6043)
+++ trunk/UI/Contact/divs/bank_act.html	2013-09-18 02:20:18 UTC (rev 6044)
@@ -1,4 +1,4 @@
-<div class="container" id="bank_act_div" data-dojo-type="dijit/layout/ContentPane" title="<?lsmb text('Bank Accounts') ?>">
+<div class="container" id="bank_act_div" title="<?lsmb text('Bank Accounts') ?>">
 <div class="listtop"><?lsmb text('Bank Accounts') ?></div>
 <?lsmb 
 href_base = script _ '?&entity_id=' _ entity_id _ '&target_div=bank_act_div' _

Modified: trunk/UI/Contact/divs/company.html
===================================================================
--- trunk/UI/Contact/divs/company.html	2013-09-17 10:38:24 UTC (rev 6043)
+++ trunk/UI/Contact/divs/company.html	2013-09-18 02:20:18 UTC (rev 6044)
@@ -1,4 +1,4 @@
-<div class="container" id="company_div" data-dojo-type="dijit/layout/ContentPane" title="<?lsmb text('Company') ?>">
+<div class="container" id="company_div" title="<?lsmb text('Company') ?>">
 <?lsmb SWITCH entity_class
 	?><?lsmb CASE 1 ?><?lsmb entity_classname = "Vendor" 
 	?><?lsmb CASE 2 ?><?lsmb entity_classname = "Customer" 

Modified: trunk/UI/Contact/divs/contact_info.html
===================================================================
--- trunk/UI/Contact/divs/contact_info.html	2013-09-17 10:38:24 UTC (rev 6043)
+++ trunk/UI/Contact/divs/contact_info.html	2013-09-18 02:20:18 UTC (rev 6044)
@@ -1,4 +1,4 @@
-<div class="container" id="contact_info_div" data-dojo-type="dijit/layout/ContentPane" title="<?lsmb text('Contact Info') ?>">
+<div class="container" id="contact_info_div" title="<?lsmb text('Contact Info') ?>">
 <div class="listtop"><?lsmb text('Contact Information') ?></div>
 <?lsmb 
 

Modified: trunk/UI/Contact/divs/credit.html
===================================================================
--- trunk/UI/Contact/divs/credit.html	2013-09-17 10:38:24 UTC (rev 6043)
+++ trunk/UI/Contact/divs/credit.html	2013-09-18 02:20:18 UTC (rev 6044)
@@ -1,4 +1,4 @@
-<div id="credit_div" class="container" data-dojo-type="dijit/layout/ContentPane" title="<?lsmb text('Credit Accounts') ?>">
+<div id="credit_div" class="container" title="<?lsmb text('Credit Accounts') ?>">
 <div class="listtop"><strong>Accounts</strong></div>
 <?lsmb 
 

Modified: trunk/UI/Contact/divs/employee.html
===================================================================
--- trunk/UI/Contact/divs/employee.html	2013-09-17 10:38:24 UTC (rev 6043)
+++ trunk/UI/Contact/divs/employee.html	2013-09-18 02:20:18 UTC (rev 6044)
@@ -1,4 +1,4 @@
-<div id="employee_div" class="container"  data-dojo-type="dijit/layout/ContentPane" title="<?lsmb text('Employee') ?>">
+<div id="employee_div" class="container"  title="<?lsmb text('Employee') ?>">
 	<div class="listtop"><strong><?lsmb text("$operation Employee") ?></strong></div>
 <form name="hr" action="<?lsmb script ?>" method="post">
 <?lsmb PROCESS input element_data = {

Modified: trunk/UI/Contact/divs/files.html
===================================================================
--- trunk/UI/Contact/divs/files.html	2013-09-17 10:38:24 UTC (rev 6043)
+++ trunk/UI/Contact/divs/files.html	2013-09-18 02:20:18 UTC (rev 6044)
@@ -1,4 +1,4 @@
-<div class="container" id="files_div" data-dojo-type="dijit/layout/ContentPane" title="<?lsmb text('Files') ?>">
+<div class="container" id="files_div" title="<?lsmb text('Files') ?>">
 <?lsmb callback="contact.pl?action=get&entity_class=" _ 
                 credit_act.entity_class _ "&entity_id=" _ entity_id _
                 "&credit_id=" _ credit_act.id; 

Modified: trunk/UI/Contact/divs/notes.html
===================================================================
--- trunk/UI/Contact/divs/notes.html	2013-09-17 10:38:24 UTC (rev 6043)
+++ trunk/UI/Contact/divs/notes.html	2013-09-18 02:20:18 UTC (rev 6044)
@@ -1,4 +1,4 @@
-<div id="notes_div" class="container" data-dojo-type="dijit/layout/ContentPane" title="<?lsmb text('Notes') ?>">
+<div id="notes_div" class="container" title="<?lsmb text('Notes') ?>">
 <div class="listtop"><?lsmb text('Notes') ?></div>
 <form action="<?lsmb script ?>" method="post">
 <?lsmb PROCESS input element_data = {

Modified: trunk/UI/Contact/divs/person.html
===================================================================
--- trunk/UI/Contact/divs/person.html	2013-09-17 10:38:24 UTC (rev 6043)
+++ trunk/UI/Contact/divs/person.html	2013-09-18 02:20:18 UTC (rev 6044)
@@ -1,5 +1,4 @@
-<div class="container" id="person_div" title="<?lsmb text('Person') ?>"
-data-dojo-type="dijit/layout/ContentPane">
+<div class="container" id="person_div" title="<?lsmb text('Person') ?>">
 <?lsmb SWITCH entity_class
 	?><?lsmb CASE 1 ?><?lsmb entity_classname = "Vendor" 
 	?><?lsmb CASE 2 ?><?lsmb entity_classname = "Customer" 

Modified: trunk/UI/Contact/divs/user.html
===================================================================
--- trunk/UI/Contact/divs/user.html	2013-09-17 10:38:24 UTC (rev 6043)
+++ trunk/UI/Contact/divs/user.html	2013-09-18 02:20:18 UTC (rev 6044)
@@ -1,6 +1,4 @@
-<?lsmb PROCESS 'elements.html' ?>
-<div id="user_div" class="container"  data-dojo-type="dijit/layout/ContentPane"
-title="<?lsmb text('User') ?>">
+<div id="user_div" class="container"  title="<?lsmb text('User') ?>">
 	<div class="listtop">
             <?lsmb 
                IF request.pls_import;

Modified: trunk/UI/Contact/divs/wage.html
===================================================================
--- trunk/UI/Contact/divs/wage.html	2013-09-17 10:38:24 UTC (rev 6043)
+++ trunk/UI/Contact/divs/wage.html	2013-09-18 02:20:18 UTC (rev 6044)
@@ -1,4 +1,5 @@
-<div class="container" id="wage_div">
+<div class="container" id="wage_div" 
+     title='<?lsmb text("Wages and Deductions") ?>'>
 <?lsmb 
 columns = [{ col_id = 'type', name = text('Type'), type = 'text' },
            { col_id = 'rate', name = text('Amount/Rate'), type = 'text' }];

Modified: trunk/UI/Contact/tabs.js
===================================================================
--- trunk/UI/Contact/tabs.js	2013-09-17 10:38:24 UTC (rev 6043)
+++ trunk/UI/Contact/tabs.js	2013-09-18 02:20:18 UTC (rev 6044)
@@ -1,3 +1,4 @@
+
 define(['dijit/registry','dojo/ready'],
     function(registry, ready) {
       return {

Modified: trunk/UI/lib/ui-header.html
===================================================================
--- trunk/UI/lib/ui-header.html	2013-09-17 10:38:24 UTC (rev 6043)
+++ trunk/UI/lib/ui-header.html	2013-09-18 02:20:18 UTC (rev 6044)
@@ -21,44 +21,24 @@
 	<?lsmb FOREACH s = include_stylesheet ?>
 	<link rel="stylesheet" href="<?lsmb s ?>" type="text/css" title="LedgerSMB stylesheet" />
 	<?lsmb END ?>
-	<?lsmb FOREACH s = include_script ?>
-	<script type="text/javascript" language="JavaScript" src="<?lsmb s ?>" ></script>
+	<?lsmb IF warn_expire ?>
+	<script type="text/javascript" language="JavaScript">
+	window.alert('<?lsmb text('Warning:  Your password will expire in [_1]', pw_expires)?>');
+	</script>
 	<?lsmb END ?>
-	<script type="text/javascript">    
+	<script type="text/javascript" language="JavaScript">    
 	  var dojoConfig = {
 	       async: 1,
 	       parseOnLoad: 0,
 	       packages: [{"name":"lsmb","location":"../../.."}]
 	   }
-       </script>
+           var dateformat = '<?lsmb USER.dateformat ?>';
+        </script>
        <script type="text/javascript" language="JavaScript" src="UI/lib/dojo/dojo/dojo.js"></script>
-       <script type="text/javascript">
-               var dateformat = '<?lsmb USER.dateformat ?>';
-	       require([
-	          <?lsmb IF dojo_load ?>
-	          '<?lsmb dojo_load ?>',
-		  <?lsmb END ?>
-		  'dojo/parser',
- 		  <?lsmb FOREACH s = dojo_require ?>
-		  '<?lsmb s ?>',
-                  <?lsmb END ?>
-		  'dojo/ready'], function(
-	          <?lsmb IF dojo_load ?>
-		  obj,
-		  <?lsmb END ?>
-		  parser){
-			parser.parse();
-	          <?lsmb IF dojo_load ?>
-			obj.init();
-		  <?lsmb END ?>
-			});
-        </script>
+	<?lsmb FOREACH s = include_script ?>
+	<script type="text/javascript" language="JavaScript" src="<?lsmb s ?>" ></script>
+	<?lsmb END ?>
 	
-	<?lsmb IF warn_expire ?>
-	<script type="text/javascript" language="JavaScript">
-	window.alert('<?lsmb text('Warning:  Your password will expire in [_1]', pw_expires)?>');
-	</script>
-	<?lsmb END ?>
         <?lsmb IF html_charset ?>
         <meta http-equiv="content-type" content="text/html; charset=<?lsmb
                                                            html_charset ?>">

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


------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits