Browse files

Replacing the individual scan page

  • Loading branch information...
1 parent 5878d05 commit 3f9dea8d5bf2e0dbb16dd8c500c7617891756535 Michael Lawrence Evans committed Feb 1, 2012
Showing with 71 additions and 100 deletions.
  1. +62 −52 site/templates/scan.html.tpl
  2. +9 −48 site/www/scan.php
View
114 site/templates/scan.html.tpl
@@ -1,67 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html lang="{$language|default:"en"}">
+<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
- <title>Scanned Map #{$scan.id|escape} (Field Papers)</title>
- <link rel="stylesheet" href="{$base_dir}/style.css" type="text/css" />
- <link rel="stylesheet" href="{$base_dir}/scan.css" type="text/css" />
- <link rel="data" type="application/paperwalking+xml" href="{$base_dir}{$base_href}?id={$scan.id|escape:"url"}&amp;type=xml" />
- <link rel="data" type="application/json" href="{$base_dir}{$base_href}?id={$scan.id|escape:"url"}&amp;type=json" />
+ <title>Atlas/Page - fieldpapers.org</title>
+ <link rel="stylesheet" href="{$base_dir}/css/fieldpapers.css" type="text/css" />
+ <script type="text/javascript" src="{$base_dir}/modestmaps.js"></script>
+ <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
{if $scan && !$scan.decoded && !$scan.failed}
<meta http-equiv="refresh" content="5" />
{else}
- <script type="text/javascript" src="{$base_dir}/swfobject.js"></script>
<script type="text/javascript" src="{$base_dir}/modestmaps.js"></script>
- <script type="text/javascript" src="{$base_dir}/script.js"></script>
- <script type="text/javascript" src="{$base_dir}/scan.js"></script>
{/if}
</head>
<body>
-
- {if $scan && $scan.decoded}
- <span id="scan-info" style="display: none;">
- <span class="scan">{$scan.id|escape}</span>
- <span class="tile">{$scan.base_url}/{$scan.id|escape}/{literal}{z}/{x}/{y}{/literal}.jpg</span>
- <span class="minrow">{$scan.min_row|escape}</span>
- <span class="mincolumn">{$scan.min_column|escape}</span>
- <span class="minzoom">{$scan.min_zoom|escape}</span>
- <span class="maxrow">{$scan.max_row|escape}</span>
- <span class="maxcolumn">{$scan.max_column|escape}</span>
- <span class="maxzoom">{$scan.max_zoom|escape}</span>
- {if $scan.description}<span class="description">{$scan.description|escape}</span>{/if}
- </span>
-
- <span id="print-info" style="display: none;">
- {if $print.atlas_page}
- <span class="print">{$print.id|escape}/{$print.atlas_page.part|escape}</span>
- <span class="north">{$print.atlas_page.bounds.north|escape}</span>
- <span class="south">{$print.atlas_page.bounds.south|escape}</span>
- <span class="east">{$print.atlas_page.bounds.east|escape}</span>
- <span class="west">{$print.atlas_page.bounds.west|escape}</span>
- {else}
- <span class="print">{$print.id|escape}</span>
- <span class="north">{$print.north|escape}</span>
- <span class="south">{$print.south|escape}</span>
- <span class="east">{$print.east|escape}</span>
- <span class="west">{$print.west|escape}</span>
- {/if}
- </span>
- {/if}
-
- {include file="header.htmlf.tpl"}
-
- {include file="navigation.htmlf.tpl"}
-
- {if $scan && $scan.decoded}
- {include file="$language/scan-info.htmlf.tpl"}
-
+ <div class="container">
+ <div class="content">
+ {include file="header.htmlf.tpl"}
+
+ {include file="navigation.htmlf.tpl"}
+
+ {if $scan && $scan.decoded}
+ <script>
+ {literal}
+ $(document).ready(function() {
+ var MM = com.modestmaps;
+
+ var provider = '{/literal}{$scan.base_url}{literal}/{Z}/{X}/{Y}.jpg';
+
+ var map = new MM.Map("map", new MM.TemplatedMapProvider(provider));
+
+ var bounds = '{/literal}{$scan.geojpeg_bounds}{literal}';
+ bounds = bounds.split(',');
+ console.log(bounds);
+ var north = parseFloat(bounds[0]);
+ var west = parseFloat(bounds[1]);
+ var south = parseFloat(bounds[2]);
+ var east = parseFloat(bounds[3]);
+
+ var extents = [new MM.Location(north, west), new MM.Location(south, east)];
+
+ map.setExtent(extents);
+
+ map.setZoom(14);
+ });
+ {/literal}
+ </script>
+
+ <div class="page_map" id="map"></div>
+ <p style="background-color: #000; text-align: center; color: #fff">
+ <b>Notes about this scan</b>
+ <br/><br/>
+ {if $scan_note}
+ {$scan_note}
+ {else}
+ There are no notes associated with this scan!
+ {/if}
+ </p>
+ <div class="fieldSet">
+ <form action="{$base_dir}/fieldset.php?id={$scan.id}" method="post">
+ <div><span id="notes_title">Notes</span></div><br />
+ <textarea name="notes" id="notes" cols="45" rows="5"></textarea>
+ <div><input id="notes_submit" type="submit" value="Add Note" /></div>
+ </form>
+ </div>
+
+ {include file="footer.htmlf.tpl"}
+ <!-- end .content --></div>
+
+ <!-- end .container --></div>
{elseif $scan}
- {include file="$language/scan-process-info.htmlf.tpl"}
+ {include file="en/scan-process-info.htmlf.tpl"}
{/if}
-
- {include file="footer.htmlf.tpl"}
-
</body>
-</html>
+</html>
View
57 site/www/scan.php
@@ -1,52 +1,33 @@
<?php
/**
- * Display page for a single scan with a given ID.
+ * Individual page for the print
*/
ini_set('include_path', ini_get('include_path').PATH_SEPARATOR.'../lib');
- ini_set('include_path', ini_get('include_path').PATH_SEPARATOR.'/usr/home/migurski/pear/lib');
require_once 'init.php';
require_once 'data.php';
require_once 'lib.auth.php';
- $scan_id = $_GET['id'] ? $_GET['id'] : null;
- list($user_id, $language) = read_userdata($_COOKIE['visitor'], $_SERVER['HTTP_ACCEPT_LANGUAGE']);
-
- enforce_master_on_off_switch($language);
+ $scan_id = $_GET["id"];
/**** ... ****/
+
session_start();
$dbh =& get_db_connection();
remember_user($dbh);
-
- /*
- $dbh =& get_db_connection();
-
- if($user_id)
- $user = get_user($dbh, $user_id);
-
- if($user)
- setcookie('visitor', write_userdata($user['id'], $language), time() + 86400 * 31);
- */
- $scan = get_scan($dbh, $scan_id);
-
- if($scan)
- {
- $print = get_print($dbh, $scan['print_id']);
- }
$sm = get_smarty_instance();
+
+ $scan = get_scan($dbh, $scan_id);
$sm->assign('scan', $scan);
- $sm->assign('step', $step);
- $sm->assign('print', $print);
- $sm->assign('language', $language);
+
+ // Needed?
+ $user_id = $_SESSION['user']['id'];
+ $sm->assign('user_id', $user_id);
$scan_note = get_simple_scan_note($dbh, $scan_id);
$sm->assign('scan_note', $scan_note[0]['note']);
- scan_headers($scan);
- print_headers($print);
-
$type = $_GET['type'] ? $_GET['type'] : $_SERVER['HTTP_ACCEPT'];
$type = get_preferred_type($type);
@@ -60,26 +41,6 @@
print '<'.'?xml version="1.0" encoding="utf-8"?'.">\n";
print $sm->fetch("scan.xml.tpl");
- } elseif($type == 'application/json') {
- $scan = modify_scan_for_json($scan);
-
- unset($print['age']);
-
- $print['north'] = floatval($print['north']);
- $print['south'] = floatval($print['south']);
- $print['east'] = floatval($print['east']);
- $print['west'] = floatval($print['west']);
- $print['zoom'] = intval($print['zoom']);
- $print['latitude'] = floatval($print['latitude']);
- $print['longitude'] = floatval($print['longitude']);
- $print['created'] = intval($print['created']);
-
- $scan['print'] = $print;
-
- header("Content-Type: application/json; charset=UTF-8");
- header("Access-Control-Allow-Origin: *");
- echo json_encode($scan)."\n";
-
} else {
header('HTTP/1.1 400');
die("Unknown type.\n");

0 comments on commit 3f9dea8

Please sign in to comment.