--- /dev/null
+<?php
+ error_reporting(E_ERROR | E_WARNING | E_PARSE);
+
+ header('Content-Type: text/html; charset=utf-8');
+
+ define('MOBILE_VERSION', true);
+
+ require_once "../config.php";
+ require_once "functions.php";
+ require_once "../functions.php";
+
+ require_once "../sessions.php";
+
+ require_once "../version.php";
+ require_once "../db-prefs.php";
+
+ $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
+
+ init_connection($link);
+
+ login_sequence($link, true);
+
+ $op = $_REQUEST["op"];
+
+ switch ($op) {
+ case "toggleMarked":
+ $cmode = db_escape_string($_REQUEST["mark"]);
+ $id = db_escape_string($_REQUEST["id"]);
+
+ markArticlesById($link, array($id), $cmode);
+ break;
+ case "togglePublished":
+ $cmode = db_escape_string($_REQUEST["pub"]);
+ $id = db_escape_string($_REQUEST["id"]);
+
+ publishArticlesById($link, array($id), $cmode);
+ break;
+ default:
+ print json_encode(array("error", "UNKNOWN_METHOD"));
+ break;
+ }
+?>
+
$is_starred = (sql_bool_to_bool($line["marked"])) ? "true" : "false";
$is_published = (sql_bool_to_bool($line["published"])) ? "true" : "false";
- print "<div class=\"row\">
- <label>Starred</label>
- <div class=\"toggle\" onclick=\"toggleMarked($id, this)\" toggled=\"$is_starred\"><span class=\"thumb\"></span><span class=\"toggleOn\">ON</span><span class=\"toggleOff\">OFF</span></div>
- </div>";
-
- print "<div class=\"row\">
- <label>Published</label>
- <div class=\"toggle\" onclick=\"togglePublished($id, this)\" toggled=\"$is_published\"><span class=\"thumb\"></span><span class=\"toggleOn\">ON</span><span class=\"toggleOff\">OFF</span></div>
- </div>";
-
-
print "<div class=\"row\">";
print "<label id='updated'>Updated:</label>";
print "<input enabled='false' name='updated' disabled value='$updated_fmt'/>";
print "<p>";
print $line["content"];
print "</p>";
+
+ print "<fieldset>";
+
+ print "<div class=\"row\">
+ <label>Starred</label>
+ <div class=\"toggle\" onclick=\"toggleMarked($id, this)\" toggled=\"$is_starred\"><span class=\"thumb\"></span><span class=\"toggleOn\">ON</span><span class=\"toggleOff\">OFF</span></div>
+ </div>";
+ print "<div class=\"row\">
+ <label>Published</label>
+ <div class=\"toggle\" onclick=\"togglePublished($id, this)\" toggled=\"$is_published\"><span class=\"thumb\"></span><span class=\"toggleOn\">ON</span><span class=\"toggleOff\">OFF</span></div>
+ </div>";
+
+ print "</fieldset>";
+
print "</div>";
}
<style type="text/css" media="screen">@import "../lib/iui/iui.css";</style>
<script type="application/x-javascript" src="../lib/iui/iui.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-
+<script type="text/javascript" src="../lib/prototype.js"></script>
+<script type="text/javascript" src="mobile.js"></script>
</head>
<style type="text/css">
}
</style>
-<script type="text/javascript">
- function toggleMarked(id, elem) {
- alert(id + " => " + elem.getAttribute('toggled'));
- }
-
- function togglePublished(id, elem) {
- alert(id + " => " + elem.getAttribute('toggled'));
- }
-</script>
-
<body>
<div class="toolbar">
<h1 id="pageTitle"></h1>
--- /dev/null
+var backend = "backend.php";
+
+function toggleMarked(id, elem) {
+
+ var toggled = false;
+
+ if (elem.getAttribute("toggled") == "true") {
+ toggled = 1;
+ } else {
+ toggled = 0;
+ }
+
+ var query = "?op=toggleMarked&id=" + id + "&mark=" + toggled;
+
+ new Ajax.Request(backend, {
+ parameters: query,
+ onComplete: function (transport) {
+ //
+ } });
+}
+
+function togglePublished(id, elem) {
+
+ var toggled = false;
+
+ if (elem.getAttribute("toggled") == "true") {
+ toggled = 1;
+ } else {
+ toggled = 0;
+ }
+
+ var query = "?op=togglePublished&id=" + id + "&mark=" + toggled;
+
+ new Ajax.Request(backend, {
+ parameters: query,
+ onComplete: function (transport) {
+ //
+ } });
+
+}
+