Browse Source

Closes #50

* works for Up, Down, Update
* Close works when etherpad isn't open, otherwise scrolls to top
devel
Jonathan Rosenbaum 7 years ago
parent
commit
91e11655d8
  1. 71
      include_header_shop.html
  2. 18
      shop_log_iframe.php

71
include_header_shop.html

@ -19,7 +19,7 @@ function resetTimer()
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>YBDB</title> <title>YBDB</title>
<link href="css/transactions.css" rel="stylesheet" type="text/css" /> <link href="css/transactions.css" rel="stylesheet" type="text/css" />
<link href="css/contacts.css" rel="stylesheet" type="text/css" /> <link href="css/contacts.css" rel="stylesheet" type="text/css" />
@ -38,19 +38,74 @@ function resetTimer()
<script src="js/jquery.liblink.js"></script> <script src="js/jquery.liblink.js"></script>
<script src="js/wNumb.js"></script> <script src="js/wNumb.js"></script>
<script> <script>
/*
// scroll back to same location when up or down are selected
$(function() {
$(".down").on("click keypress", function(e) {
var hash = document.body.scrollTop + 25;
var query = window.location.search;
query = query.split("&");
var visit_id = query[1].split("=")[1] - 1;
var new_query = query[0] + "&visit_id=" + visit_id;
var new_url = window.location.origin + window.location.pathname + new_query + "&#" + hash;
window.location = new_url;
});
$(".up").on("click keypress", function(e) {
var hash = document.body.scrollTop - 25;
var query = window.location.search;
query = query.split("&");
var visit_id = parseInt(query[1].split("=")[1]) + 1;
var new_query = query[0] + "&visit_id=" + visit_id;
var new_url = window.location.origin + window.location.pathname + new_query + "&#" + hash;
window.location = new_url;
});
$(".close").on("click keypress", function(e) {
var hash = document.body.scrollTop;
var query = window.location.search;
query = query.split("&");
var new_query = query[0];
var new_url = window.location.origin + window.location.pathname + new_query + "&#" + hash;
window.location = new_url;
});
// have to do this a little differently because it is a submit, not a button
$(".update_changes").on("click keypress", function(e) {
var hash = parseInt(document.body.scrollTop);
var query = window.location.search;
query = query.split("&");
var visit_id = parseInt(query[1].split("=")[1]);
var add_hash = "&#" + hash;
var action = $("[name=FormUpdate_" + visit_id).attr("action");
$("[name=FormUpdate_" + visit_id).attr("action", action + add_hash);
});
});
$( window ).on( "load", function() { $( window ).on( "load", function() {
var page_y = $( document ).scrollTop(); if(window.location.hash != "") {
window.location.href = window.location.href + '?page_y=' + page_y;
document.body.scrollTop = window.location.hash.replace("#", "") * 1;
if ( window.location.href.indexOf('page_y') != -1 ) {
var match = window.location.href.split('?')[1].split("&")[0].split("=");
$('html, body').scrollTop( match[1] );
} }
}); });
*/
</script> </script>
</head> </head>

18
shop_log_iframe.php

@ -102,6 +102,7 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form_new") && ($_PO
//Update Record isset($_POST["MM_update"]) //Update Record isset($_POST["MM_update"])
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormUpdate")) { if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormUpdate")) {
$updateSQL = sprintf("UPDATE shop_hours SET time_out=%s WHERE shop_visit_id=%s", $updateSQL = sprintf("UPDATE shop_hours SET time_out=%s WHERE shop_visit_id=%s",
GetSQLValueString($_POST['time_out'], "date"), GetSQLValueString($_POST['time_out'], "date"),
GetSQLValueString($_POST['shop_visit_id'], "int")); GetSQLValueString($_POST['shop_visit_id'], "int"));
@ -115,6 +116,7 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormUpdate")) {
} }
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormEdit")) { if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormEdit")) {
$updateSQL = sprintf("UPDATE shop_hours SET contact_id=%s, shop_user_role=%s, project_id=%s, time_in=%s, time_out=%s, comment=%s WHERE shop_visit_id=%s", $updateSQL = sprintf("UPDATE shop_hours SET contact_id=%s, shop_user_role=%s, project_id=%s, time_in=%s, time_out=%s, comment=%s WHERE shop_visit_id=%s",
GetSQLValueString($_POST['contact_id'], "int"), GetSQLValueString($_POST['contact_id'], "int"),
GetSQLValueString($_POST['user_role'], "text"), GetSQLValueString($_POST['user_role'], "text"),
@ -235,18 +237,12 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "FormEdit")) {
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><input type="submit" name="Submit" value="Update Changes" /> <td><input class="update_changes" type="submit" name="Submit" value="Update Changes" />
<input type="button" value="Close" <input class="close" type="button" value="Close" />
onclick="location.href='<?php echo "/shop_log_iframe.php?shop_id={$shop_id}";?>';" /></td> </td>
<td> <td>
<input type="button" value="Up" <input class="up" type="button" value="Up" />
onclick="location.href='<?php <input class="down" type="button" value="Down" />
$prev = $visit_id + 1;
echo "/shop_log_iframe.php?shop_id={$shop_id}&visit_id={$prev}";?>';"/>
<input type="button" value="Down"
onclick="location.href='<?php
$prev = $visit_id - 1;
echo "/shop_log_iframe.php?shop_id={$shop_id}&visit_id={$prev}";?>';" />
</td> </td>
</tr> </tr>
<?php //if(current_shop_by_ip()>=$shop_id & (current_shop_by_ip()-5)<=$shop_id ) { <?php //if(current_shop_by_ip()>=$shop_id & (current_shop_by_ip()-5)<=$shop_id ) {

Loading…
Cancel
Save