sync
[web.mtrack] / MTrackWeb / templates / images / js / mtrack.js
index 9a9ac7a..0ec4f41 100644 (file)
  
 MTrack = {
     
+    
+    init : function()
+    {
+        
+        $(document).ready(function () {
+            window.mtrack_footer_position();
+            if (authUser) {
+                setTimeout(MTrack.keepLoggedIn, 30000);
+                
+            }
+            
+            
+            
+        });
+            
+        $(document).ready(function () {
+            var path = [ 'Tree' ];
+            //if (repoName) path.push( repoName );
+            // ??/ jump?
+            
+            var href = (window.location.pathname + window.location.search).substring(baseURL.length);
+            try { 
+                window.history.pushState( { url: href }, document.title , window.location.pathname + window.location.search );
+            } catch (e) {}
+            MTrack.currentURL = href;
+            jQuery.ajax( {
+            
+                url : window.location.pathname + window.location.search,
+                data : { ajax_body : 1 } ,
+                success : function (data) {
+                    $('#ajaxbody').html(data);
+                    document.body.scrollTop = 0;
+                    MTrack.addHandlers($('#ajaxbody'));
+                    MTrack.missingHashes($('#ajaxbody'), href)
+                }
+            }); 
+        });
+        
+    },
+    
     registry : [],
     /**
      * usage:
@@ -53,6 +93,26 @@ MTrack = {
             sortable: false
         });
       
+    },
+    
+    keepLoggedIn: function()
+    {
+        jQuery.ajax({
+            url : baseURL + '/Login.html',
+            type:  'POST',
+            data : { refresh : 1 },
+            success : function() {
+                
+                setTimeout(MTrack.keepLoggedIn, 30000);
+                // what if it's false..currentURL = false;
+                
+                
+            }
+            
+        })
+        
+        
+        
     }
     
 }
@@ -63,11 +123,11 @@ $(document).ready(function() {
     $('#banner select').change( function(e) {
         // ajax change project, and refresh body..
         jQuery.ajax({
-            url : baseURL + '/Project.html',
-            data : { active_project_id : this.value }
+            url : baseURL + '/core_project.html',
+            data : { active_project_id : this.value },
             success : function() {
                 // what if it's false..currentURL = false;
-                MTrack.ajaxLoad(MTrack.currentURL);
+                MTrack.ajaxLoad(MTrack.currentURL, true);
                 
             }
             
@@ -78,6 +138,11 @@ $(document).ready(function() {
         
 });
 
+// any date picers.. - on milestones?
+MTrack.register('.dateinput', 'datepicker', {
+    // minDate: 0,
+    dateFormat: 'yy-mm-dd' // nice and compatible..
+});
 
 
 //// ------------------- OLD STUFF NEEDS TIDY UP ----------------------
@@ -236,6 +301,7 @@ $(document).ready(function() {
   var last_dh = 0;
   var last_wh = 0;
   function mtrack_footer_position(force) {
+    return;
     var ele = $('#footer');
     if (!force &&
         (last_dh != $(document).height() || last_wh != $(window).height)) {
@@ -274,6 +340,7 @@ $(document).ready(function() {
     .scroll(mtrack_footer_position)
     .resize(mtrack_footer_position);
   function mtrack_footer_set_and_wait() {
+    return;
     mtrack_footer_position();
     setTimeout(function () {
       mtrack_footer_set_and_wait();