From 3e0923463f1cc0ec3943cd7e7d8f1e194a2c9015 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 17 Dec 2009 20:35:49 +0300 Subject: [PATCH] mobile: fix page to page navigation --- lib/iui/iui.js | 26 ++++++++- mobile/article.php | 3 +- mobile/feed.php | 5 +- mobile/functions.php | 126 ++++++++++++++++++++++++------------------- mobile/index.php | 13 ++++- 5 files changed, 111 insertions(+), 62 deletions(-) diff --git a/lib/iui/iui.js b/lib/iui/iui.js index 6001b27b..d47cbddb 100644 --- a/lib/iui/iui.js +++ b/lib/iui/iui.js @@ -203,7 +203,7 @@ addEventListener("click", function(event) iui.showPage($(link.hash.substr(1))); setTimeout(unselect, 500); } - else if (link == $("backButton")) { + if (link == $("backButton")) { history.back(); } else if (link.getAttribute("type") == "submit") { @@ -233,7 +233,10 @@ addEventListener("click", function(event) else if (!link.target) { link.setAttribute("selected", "progress"); - iui.showPageByHref(link.href, null, null, null, unselect); + + var backwards = link.getAttribute("backwards"); + + iui.showPageByHref(link.href, null, null, null, unselect, backwards); } else return; @@ -361,6 +364,25 @@ function updatePage(page, fromPage) else backButton.style.display = "none"; } + + + var backButton = $("myBackButton"); + if (backButton) + { + var label = page.getAttribute("myBackLabel"); + + if (label) + { + backButton.style.display = "inline"; + backButton.innerHTML = label; + backButton.href = page.getAttribute("myBackHref"); + backButton.target = page.getAttribute("myBackTarget"); + backButton.setAttribute("backwards", "true"); + } + else + backButton.style.display = "none"; + } + } function slidePages(fromPage, toPage, backwards) diff --git a/mobile/article.php b/mobile/article.php index 28fef041..2379e939 100644 --- a/mobile/article.php +++ b/mobile/article.php @@ -22,7 +22,8 @@ $id = db_escape_string($_REQUEST["id"]); $feed_id = db_escape_string($_REQUEST["feed"]); + $cat_id = db_escape_string($_REQUEST["cat"]); - render_article($link, $id, $feed_id); + render_article($link, $id, $feed_id, $cat_id); ?> diff --git a/mobile/feed.php b/mobile/feed.php index c729cc34..610dd6ad 100644 --- a/mobile/feed.php +++ b/mobile/feed.php @@ -20,8 +20,9 @@ login_sequence($link, true); - $feed = db_escape_string($_REQUEST["id"]); + $feed_id = db_escape_string($_REQUEST["id"]); + $cat_id = db_escape_string($_REQUEST["cat"]); - render_headlines_list($link, $feed); + render_headlines_list($link, $feed_id, $cat_id); ?> diff --git a/mobile/functions.php b/mobile/functions.php index bc458213..b7b842b6 100644 --- a/mobile/functions.php +++ b/mobile/functions.php @@ -33,15 +33,16 @@ $title = getCategoryTitle($link, $cat_id); - print "