Remove the weird i
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 15 Mar 2017 20:23:57 +0000 (16:23 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 15 Mar 2017 20:23:57 +0000 (16:23 -0400)
other updates include trying to get the second schedule the one that
will be in the drop down to work.

js/front.js
models/front/apis/schedule.php
setup/shortcodes.php
views/front/apis/schedule.html

index dc40786..91b47d5 100644 (file)
@@ -220,14 +220,6 @@ jQuery(document).ready(function($){
 
         return false;
     }
-    function myEnter(event)
-    {
-        if (typeof event == "undefined")
-        {
-            event = window.event;
-        }
-        alert(event.value);
-    }
     function checkLink()
     {
         var toAddress = document.getElementById('toaddress');
@@ -237,25 +229,6 @@ jQuery(document).ready(function($){
         }
         return false;
     }
-    function makePopup(url, width, height, overflow)
-    {
-      if (width > 640) { width = 640; }
-      if (height > 480) { height = 480; }
-
-      if (overflow == '' || !/^(scroll|resize|both)$/.test(overflow))
-      {
-        overflow = 'both';
-      }
-
-      var win = window.open(url, '',
-          'width=' + width + ',height=' + height
-          + ',scrollbars=' + (/^(scroll|both)$/.test(overflow) ? 'yes' : 'no')
-          + ',resizable=' + (/^(resize|both)$/.test(overflow) ? 'yes' : 'no')
-          + ',status=yes,toolbar=yes,menubar=yes,location=yes'
-      );
-
-      return win;
-    }
     function closeDialog(dialog,gid)
     {
         dialog.parentNode.removeChild(dialog);
@@ -293,38 +266,6 @@ jQuery(document).ready(function($){
         return true;
     }
 
-
-    function addLoadListener(fn)
-    {
-        if (typeof window.addEventListener != 'undefined')
-        {
-            window.addEventListener('load', fn, false);
-        }
-        else if (typeof document.addEventListener != 'undefined')
-        {
-            document.addEventListener('load', fn, false);
-        }
-        else if (typeof window.attachEvent != 'undefined')
-        {
-            window.attachEvent('onload', fn);
-        }
-        else
-        {
-            var oldfn = window.onload;
-            if (typeof window.onload != 'function')
-            {
-                window.onload = fn;
-            }
-            else
-            {
-                window.onload = function()
-                {
-                    oldfn();
-                    fn();
-                };
-            }
-        }
-    }
     function attachEventListener(target, eventType, functionRef, capture)
     {
         if (typeof target.addEventListener != "undefined")
index 789c26c..f5f838c 100644 (file)
@@ -1,4 +1,4 @@
-i<?php
+<?php
 /**
  * detail.php
  *
@@ -49,20 +49,26 @@ class GlmMembersFront_apis_schedule
      */
     public function modelAction($actionData = false)
     {
+        //echo '<pre>$actionData: ' . print_r( $actionData, true ) . '</pre>';
         $view     = 'schedule';
         $settings = array();
         $content  = '';
 
         // Get the schedule from starline
         $url = get_option( GLM_MEMBERS_APIS_STARLINE_OPTION_NAME ) . 'ferrySchedule.php';
+        if ( isset( $actionData['request']['in_dropdown'] ) && $inDropDown = filter_var( $actionData['request']['in_dropdown'], FILTER_VALIDATE_BOOLEAN) ) {
+            $url .= '?dropdown=1';
+        }
         $curl = curl_init( $url );
         curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
-       curl_setopt( $curl, CURLOPT_USERPWD, 'dev55:Glm15Keep!' );
+        curl_setopt( $curl, CURLOPT_USERPWD, 'dev55:Glm15Keep!' );
         $content = curl_exec( $curl );
         curl_close( $curl );
 
         $templateData = array(
-            'content' => $content
+            'content'      => $content,
+            'inDropDown'   => $inDropDown,
+            'schedulePage' => 'schedule-test-page'
         );
 
         error_reporting(E_ALL ^ E_NOTICE);
index 392a46a..e5a5961 100644 (file)
@@ -93,7 +93,7 @@ $glmMembersApisShortcodes = array(
         'action'     => 'schedule',
         'table'      => false,
         'attributes' => array(
-            'template' => false,
+            'in_dropdown' => false,
         )
     ),
 );
index 714baac..09815ae 100644 (file)
@@ -5,13 +5,67 @@
 <script>
 function get_schedule( scheduleId )
 {
-    console.log(scheduleId);
-    $.get(
-        '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=schedule&schedule_id=' + scheduleId
-        ).done(
-            function(data){
-                $('#edit-divy').html(data);;
-            }
-        );
+    {if !$inDropDown}
+        {literal}
+            $.get(
+                {/literal}'{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=schedule&schedule_id=' + scheduleId{literal}
+                ).done(
+                    function(data){
+                        $('#edit-divy').html(data);
+                    }
+                );
+        {/literal}
+    {else}
+        // For the drop down docks schedules
+        var dropdown_dockForm = $("#dockForm");
+        var dropdown_formDockId = $("#formDockId");
+        var dropdown_formSchedId = $("#formSchedId");
+        var dropdown_dock1Sel = $('#dd-sched-1');
+        dropdown_dock1Sel.change(function(){
+            formSchedId.val(1);
+            formDockId.val(dock1Sel.val());
+            dockForm.submit();
+        });
+        var dropdown_dock2Sel = $('#dd-sched-2');
+        dropdown_dock2Sel.change(function(){
+            formSchedId.val(2);
+            formDockId.val(dock2Sel.val());
+            dockForm.submit();
+        });
+        var dropdown_dock3Sel = $('#dd-sched-3');
+        dropdown_dock3Sel.change(function(){
+            formSchedId.val(3);
+            formDockId.val(dock3Sel.val());
+            dockForm.submit();
+        });
+        var dropdown_dock4Sel = $('#dd-sched-4');
+        dropdown_dock4Sel.change(function(){
+            formSchedId.val(4);
+            formDockId.val(dock4Sel.val());
+            dockForm.submit();
+        });
+        var dropdown_mapLink1 = $('#dropdown-google-map-link1');
+        dropdown_mapLink1.click(function(){
+            window.location = '{$schedulePage}/?mapLink=1';
+            return false;
+        });
+        var dropdown_mapLink2 = $('#dropdown-google-map-link2');
+        dropdown_mapLink2.click(function(){
+            window.location = '{$schedulePage}/?mapLink=2';
+            return false;
+        });
+        var dropdown_mapLink3 = $('#dropdown-google-map-link3');
+        dropdown_mapLink3.click(function(){
+            console.log('test test test');
+            return false;
+            //window.location = '{$schedulePage}/?mapLink=3';
+            //return false;
+        });
+        var dropdown_mapLink4 = $('#dropdown-google-map-link4');
+        dropdown_mapLink4.click(function(){
+            window.location = '{$schedulePage}/?mapLink=4';
+            return false;
+        });
+    {/if}
 }
 </script>