From 6101b0e1a187f8cd30144b6bfa884390d2d441c3 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 18 Dec 2009 11:33:35 +0300 Subject: [PATCH] mobile: split local .js --- mobile/backend.php | 43 +++++++++++++++++++++++++++++++++++++++++++ mobile/functions.php | 25 ++++++++++++++----------- mobile/index.php | 13 ++----------- mobile/mobile.js | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 100 insertions(+), 22 deletions(-) create mode 100644 mobile/backend.php create mode 100644 mobile/mobile.js diff --git a/mobile/backend.php b/mobile/backend.php new file mode 100644 index 00000000..c6b75c51 --- /dev/null +++ b/mobile/backend.php @@ -0,0 +1,43 @@ + + diff --git a/mobile/functions.php b/mobile/functions.php index a773eb94..5f6256dc 100644 --- a/mobile/functions.php +++ b/mobile/functions.php @@ -303,17 +303,6 @@ $is_starred = (sql_bool_to_bool($line["marked"])) ? "true" : "false"; $is_published = (sql_bool_to_bool($line["published"])) ? "true" : "false"; - print "
- -
ONOFF
-
"; - - print "
- -
ONOFF
-
"; - - print "
"; print ""; print ""; @@ -324,7 +313,21 @@ print "

"; print $line["content"]; print "

"; + + print "
"; + + print "
+ +
ONOFF
+
"; + print "
+ +
ONOFF
+
"; + + print "
"; + print "
"; } diff --git a/mobile/index.php b/mobile/index.php index 4d5cf1e9..5a2ed97e 100644 --- a/mobile/index.php +++ b/mobile/index.php @@ -32,7 +32,8 @@ - + + - -

diff --git a/mobile/mobile.js b/mobile/mobile.js new file mode 100644 index 00000000..655987ce --- /dev/null +++ b/mobile/mobile.js @@ -0,0 +1,41 @@ +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) { + // + } }); + +} + -- 2.39.2