--- /dev/null
+/* iui.css (c) 2007-9 by iUI Project Members, see LICENSE.txt for license */
+body {
+ margin: 0;
+ font-family: Helvetica;
+ background: #FFFFFF;
+ color: #000000;
+ overflow-x: hidden;
+ -webkit-user-select: none;
+ -webkit-text-size-adjust: none;
+}
+
+body > *:not(.toolbar) {
+ display: none;
+ position: absolute;
+ margin: 0;
+ padding: 0;
+ left: 0;
+ top: 45px;
+ width: 100%;
+ min-height: 372px;
+ -webkit-transition-duration: 300ms;
+ -webkit-transition-property: -webkit-transform;
+ -webkit-transform: translateX(0%);
+}
+
+body[orient="landscape"] > *:not(.toolbar) {
+ min-height: 268px;
+}
+
+body > *[selected="true"] {
+ display: block;
+}
+
+a[selected], a:active {
+ background-color: #194fdb !important;
+ background-image: url(listArrowSel.png), url(selection.png) !important;
+ background-repeat: no-repeat, repeat-x;
+ background-position: right center, left top;
+ color: #FFFFFF !important;
+}
+
+a[selected="progress"] {
+ background-image: url(loading.gif), url(selection.png) !important;
+}
+
+/************************************************************************************************/
+
+body > .toolbar {
+ box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+ border-bottom: 1px solid #2d3642;
+ border-top: 1px solid #6d84a2;
+ padding: 10px;
+ height: 45px;
+ background: url(toolbar.png) #6d84a2 repeat-x;
+}
+
+.toolbar > h1 {
+ position: absolute;
+ overflow: hidden;
+ left: 50%;
+ margin: 1px 0 0 -75px;
+ height: 45px;
+ font-size: 20px;
+ width: 150px;
+ font-weight: bold;
+ text-shadow: rgba(0, 0, 0, 0.4) 0px -1px 0;
+ text-align: center;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ color: #FFFFFF;
+}
+
+body[orient="landscape"] > .toolbar > h1 {
+ margin-left: -125px;
+ width: 250px;
+}
+
+.button {
+ position: absolute;
+ overflow: hidden;
+ top: 8px;
+ right: 6px;
+ margin: 0;
+ border-width: 0 5px;
+ padding: 0 3px;
+ width: auto;
+ height: 30px;
+ line-height: 30px;
+ font-family: inherit;
+ font-size: 12px;
+ font-weight: bold;
+ color: #FFFFFF;
+ text-shadow: rgba(0, 0, 0, 0.6) 0px -1px 0;
+ text-overflow: ellipsis;
+ text-decoration: none;
+ white-space: nowrap;
+ background: none;
+ -webkit-border-image: url(toolButton.png) 0 5 0 5;
+}
+
+.blueButton {
+ -webkit-border-image: url(blueButton.png) 0 5 0 5;
+ border-width: 0 5px;
+}
+
+.leftButton {
+ left: 6px;
+ right: auto;
+}
+
+#backButton {
+ display: none;
+ left: 6px;
+ right: auto;
+ padding: 0;
+ max-width: 55px;
+ border-width: 0 8px 0 14px;
+ -webkit-border-image: url(backButton.png) 0 8 0 14;
+}
+
+.whiteButton,
+.redButton,
+.grayButton {
+ display: block;
+ border-width: 0 12px;
+ padding: 10px;
+ text-align: center;
+ font-size: 20px;
+ font-weight: bold;
+ text-decoration: inherit;
+ color: inherit;
+}
+
+.whiteButton {
+ -webkit-border-image: url(whiteButton.png) 0 12 0 12;
+ text-shadow: rgba(255, 255, 255, 0.7) 0 1px 0;
+}
+
+.redButton {
+ -webkit-border-image: url(redButton.png) 0 12 0 12;
+ color:#fff;
+ text-shadow: #7a0001 0 -1px 0;
+}
+
+.grayButton {
+ -webkit-border-image: url(grayButton.png) 0 12 0 12;
+ color: #FFFFFF;
+}
+
+/************************************************************************************************/
+
+body > ul > li {
+ position: relative;
+ margin: 0;
+ border-bottom: 1px solid #E0E0E0;
+ padding: 8px 0 8px 10px;
+ font-size: 20px;
+ font-weight: bold;
+ list-style: none;
+}
+
+body > ul > li.group {
+ position: relative;
+ top: -1px;
+ margin-bottom: -2px;
+ border-top: 1px solid #7d7d7d;
+ border-bottom: 1px solid #999999;
+ padding: 1px 10px;
+ background: url(listGroup.png) repeat-x;
+ font-size: 17px;
+ font-weight: bold;
+ text-shadow: rgba(0, 0, 0, 0.4) 0 1px 0;
+ color: #FFFFFF;
+}
+
+body > ul > li.group:first-child {
+ top: 0;
+ border-top: none;
+}
+
+body > ul > li > a {
+ display: block;
+ margin: -8px 0 -8px -10px;
+ padding: 8px 32px 8px 10px;
+ text-decoration: none;
+ color: inherit;
+ background: url(listArrow.png) no-repeat right center;
+}
+
+a[target="_replace"] {
+ box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+ padding-top: 25px;
+ padding-bottom: 25px;
+ font-size: 18px;
+ color: cornflowerblue;
+ background-color: #FFFFFF;
+ background-image: none;
+}
+
+/************************************************************************************************/
+
+body > .dialog {
+ top: 0;
+ width: 100%;
+ min-height: 417px;
+ z-index: 2;
+ background: rgba(0, 0, 0, 0.8);
+ padding: 0;
+ text-align: right;
+}
+
+.dialog > fieldset {
+ box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+ width: 100%;
+ margin: 0;
+ border: none;
+ border-top: 1px solid #6d84a2;
+ padding: 10px 6px;
+ background: url(toolbar.png) #7388a5 repeat-x;
+}
+
+.dialog > fieldset > h1 {
+ margin: 0 10px 0 10px;
+ padding: 0;
+ font-size: 20px;
+ font-weight: bold;
+ color: #FFFFFF;
+ text-shadow: rgba(0, 0, 0, 0.4) 0px -1px 0;
+ text-align: center;
+}
+
+.dialog > fieldset > label {
+ position: absolute;
+ margin: 16px 0 0 6px;
+ font-size: 14px;
+ color: #999999;
+}
+
+input:not(input[type|=radio]):not(input[type|=checkbox]) {
+ box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+ width: 100%;
+ margin: 8px 0 0 0;
+ padding: 6px 6px 6px 44px;
+ font-size: 16px;
+ font-weight: normal;
+}
+
+/************************************************************************************************/
+
+body > .panel {
+ box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+ padding: 10px;
+ background: #c8c8c8 url(pinstripes.png);
+}
+
+.panel > fieldset {
+ position: relative;
+ margin: 0 0 20px 0;
+ padding: 0;
+ background: #FFFFFF;
+ -webkit-border-radius: 10px;
+ -moz-border-radius: 10px;
+ border: 1px solid #999999;
+ text-align: right;
+ font-size: 16px;
+}
+
+.row {
+ position: relative;
+ min-height: 42px;
+ border-bottom: 1px solid #999999;
+ -webkit-border-radius: 0;
+ text-align: right;
+}
+
+fieldset > .row:last-child {
+ border-bottom: none !important;
+}
+
+.row > input:not(input[type|=radio]):not(input[type|=checkbox]) {
+ box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+ margin: 0;
+ border: none;
+ padding: 12px 10px 0 110px;
+ height: 42px;
+ background: none;
+}
+.row > input[type|=radio], .row > input[type|=checkbox] {
+ margin: 7px 7px 0 0;
+ height: 25px;
+ width: 25px;
+}
+
+.row > label {
+ position: absolute;
+ margin: 0 0 0 14px;
+ line-height: 42px;
+ font-weight: bold;
+}
+
+.row > span {
+ position: absolute;
+ padding: 12px 10px 0 110px;
+ margin: 0;
+}
+
+.row > .toggle {
+ position: absolute;
+ top: 6px;
+ right: 6px;
+ width: 100px;
+ height: 28px;
+}
+
+.toggle {
+ border: 1px solid #888888;
+ -webkit-border-radius: 6px;
+ background: #FFFFFF url(toggle.png) repeat-x;
+ font-size: 19px;
+ font-weight: bold;
+ line-height: 30px;
+}
+
+.toggle[toggled="true"] {
+ border: 1px solid #143fae;
+ background: #194fdb url(toggleOn.png) repeat-x;
+}
+
+.toggleOn {
+ display: none;
+ position: absolute;
+ width: 60px;
+ text-align: center;
+ left: 0;
+ top: 0;
+ color: #FFFFFF;
+ text-shadow: rgba(0, 0, 0, 0.4) 0px -1px 0;
+}
+
+.toggleOff {
+ position: absolute;
+ width: 60px;
+ text-align: center;
+ right: 0;
+ top: 0;
+ color: #666666;
+}
+
+.toggle[toggled="true"] > .toggleOn {
+ display: block;
+}
+
+.toggle[toggled="true"] > .toggleOff {
+ display: none;
+}
+
+.thumb {
+ position: absolute;
+ top: -1px;
+ left: -1px;
+ width: 40px;
+ height: 28px;
+ border: 1px solid #888888;
+ -webkit-border-radius: 6px;
+ background: #ffffff url(thumb.png) repeat-x;
+}
+
+.toggle[toggled="true"] > .thumb {
+ left: auto;
+ right: -1px;
+}
+
+.panel > h2 {
+ margin: 0 0 8px 14px;
+ font-size: inherit;
+ font-weight: bold;
+ color: #4d4d70;
+ text-shadow: rgba(255, 255, 255, 0.75) 2px 2px 0;
+}
+
+/************************************************************************************************/
+
+#preloader {
+ display: none;
+ background-image: url(loading.gif), url(selection.png),
+ url(blueButton.png), url(listArrowSel.png), url(listGroup.png);
+}
--- /dev/null
+/*
+ Copyright (c) 2007-9, iUI Project Members
+ See LICENSE.txt for licensing terms
+ */
+
+
+(function() {
+
+var slideSpeed = 20;
+var slideInterval = 0;
+
+var currentPage = null;
+var currentDialog = null;
+var currentWidth = 0;
+var currentHash = location.hash;
+var hashPrefix = "#_";
+var pageHistory = [];
+var newPageCount = 0;
+var checkTimer;
+var hasOrientationEvent = false;
+var portraitVal = "portrait";
+var landscapeVal = "landscape";
+
+// *************************************************************************************************
+
+window.iui =
+{
+ animOn: true, // Slide animation with CSS transition is now enabled by default where supported
+
+ showPage: function(page, backwards)
+ {
+ if (page)
+ {
+ if (currentDialog)
+ {
+ currentDialog.removeAttribute("selected");
+ currentDialog = null;
+ }
+
+ if (hasClass(page, "dialog"))
+ showDialog(page);
+ else
+ {
+ var fromPage = currentPage;
+ currentPage = page;
+
+ if (fromPage)
+ setTimeout(slidePages, 0, fromPage, page, backwards);
+ else
+ updatePage(page, fromPage);
+ }
+ }
+ },
+
+ showPageById: function(pageId)
+ {
+ var page = $(pageId);
+ if (page)
+ {
+ var index = pageHistory.indexOf(pageId);
+ var backwards = index != -1;
+ if (backwards)
+ pageHistory.splice(index, pageHistory.length);
+
+ iui.showPage(page, backwards);
+ }
+ },
+
+ showPageByHref: function(href, args, method, replace, cb, backwards)
+ {
+ var req = new XMLHttpRequest();
+ req.onerror = function()
+ {
+ if (cb)
+ cb(false);
+ };
+
+ req.onreadystatechange = function()
+ {
+ if (req.readyState == 4)
+ {
+ if (replace)
+ replaceElementWithSource(replace, req.responseText);
+ else
+ {
+ var frag = document.createElement("div");
+ frag.innerHTML = req.responseText;
+ iui.insertPages(frag.childNodes, backwards);
+ }
+ if (cb)
+ setTimeout(cb, 1000, true);
+ }
+ };
+
+ if (args)
+ {
+ req.open(method || "GET", href, true);
+ req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ req.setRequestHeader("Content-Length", args.length);
+ req.send(args.join("&"));
+ }
+ else
+ {
+ req.open(method || "GET", href, true);
+ req.send(null);
+ }
+ },
+
+ insertPages: function(nodes, backwards)
+ {
+ var targetPage;
+ for (var i = 0; i < nodes.length; ++i)
+ {
+ var child = nodes[i];
+ if (child.nodeType == 1)
+ {
+ if (!child.id)
+ child.id = "__" + (++newPageCount) + "__";
+
+ var clone = $(child.id);
+ if (clone)
+ clone.parentNode.replaceChild(child, clone);
+ else
+ document.body.appendChild(child);
+
+ if (child.getAttribute("selected") == "true" || !targetPage)
+ targetPage = child;
+
+ --i;
+ }
+ }
+
+ if (targetPage)
+ iui.showPage(targetPage, backwards);
+ },
+
+ getSelectedPage: function()
+ {
+ for (var child = document.body.firstChild; child; child = child.nextSibling)
+ {
+ if (child.nodeType == 1 && child.getAttribute("selected") == "true")
+ return child;
+ }
+ },
+ isNativeUrl: function(href)
+ {
+ for(var i = 0; i < iui.nativeUrlPatterns.length; i++)
+ {
+ if(href.match(iui.nativeUrlPatterns[i])) return true;
+ }
+ return false;
+ },
+ nativeUrlPatterns: [
+ new RegExp("^http:\/\/maps.google.com\/maps\?"),
+ new RegExp("^mailto:"),
+ new RegExp("^tel:"),
+ new RegExp("^http:\/\/www.youtube.com\/watch\\?v="),
+ new RegExp("^http:\/\/www.youtube.com\/v\/"),
+ new RegExp("^javascript:"),
+
+ ]
+};
+
+// *************************************************************************************************
+
+addEventListener("load", function(event)
+{
+ var page = iui.getSelectedPage();
+ var locPage = getPageFromLoc();
+
+ if (page)
+ iui.showPage(page);
+
+ if (locPage && (locPage != page))
+ iui.showPage(locPage);
+
+ setTimeout(preloadImages, 0);
+ if (typeof window.onorientationchange == "object")
+ {
+ window.onorientationchange=orientChangeHandler;
+ hasOrientationEvent = true;
+ setTimeout(orientChangeHandler, 0);
+ }
+ setTimeout(checkOrientAndLocation, 0);
+ checkTimer = setInterval(checkOrientAndLocation, 300);
+}, false);
+
+addEventListener("unload", function(event)
+{
+ return;
+}, false);
+
+addEventListener("click", function(event)
+{
+ var link = findParent(event.target, "a");
+ if (link)
+ {
+ function unselect() { link.removeAttribute("selected"); }
+
+ if (link.href && link.hash && link.hash != "#" && !link.target)
+ {
+ link.setAttribute("selected", "true");
+ iui.showPage($(link.hash.substr(1)));
+ setTimeout(unselect, 500);
+ }
+ else if (link == $("backButton")) {
+ history.back();
+ } else if (link.getAttribute("type") == "submit")
+ {
+ var form = findParent(link, "form");
+ if (form.target == "_self")
+ {
+ form.submit();
+ return; // return so we don't preventDefault
+ }
+ submitForm(form);
+ }
+ else if (link.getAttribute("type") == "cancel")
+ cancelDialog(findParent(link, "form"));
+ else if (link.target == "_replace")
+ {
+ link.setAttribute("selected", "progress");
+ iui.showPageByHref(link.href, null, null, link, unselect);
+ }
+ else if (iui.isNativeUrl(link.href))
+ {
+ return;
+ }
+ else if (link.target == "_webapp")
+ {
+ location.href = link.href;
+ }
+ else if (!link.target)
+ {
+ link.setAttribute("selected", "progress");
+ iui.showPageByHref(link.href, null, null, null, unselect);
+ }
+ else
+ return;
+
+ event.preventDefault();
+ }
+}, true);
+
+addEventListener("click", function(event)
+{
+ var div = findParent(event.target, "div");
+ if (div && hasClass(div, "toggle"))
+ {
+ div.setAttribute("toggled", div.getAttribute("toggled") != "true");
+ event.preventDefault();
+ }
+}, true);
+
+function getPageFromLoc()
+{
+ var page;
+ var result = location.hash.match(/#_([^\?_]+)/);
+ if (result)
+ page = result[1];
+ if (page)
+ page = $(page);
+ return page;
+}
+
+function orientChangeHandler()
+{
+ var orientation=window.orientation;
+ switch(orientation)
+ {
+ case 0:
+ setOrientation(portraitVal);
+ break;
+
+ case 90:
+ case -90:
+ setOrientation(landscapeVal);
+ break;
+ }
+}
+
+
+function checkOrientAndLocation()
+{
+ if (!hasOrientationEvent)
+ {
+ if (window.innerWidth != currentWidth)
+ {
+ currentWidth = window.innerWidth;
+ var orient = currentWidth == 320 ? portraitVal : landscapeVal;
+ setOrientation(orient);
+ }
+ }
+
+ if (location.hash != currentHash)
+ {
+ var pageId = location.hash.substr(hashPrefix.length);
+ iui.showPageById(pageId);
+ }
+}
+
+function setOrientation(orient)
+{
+ document.body.setAttribute("orient", orient);
+ setTimeout(scrollTo, 100, 0, 1);
+}
+
+function showDialog(page)
+{
+ currentDialog = page;
+ page.setAttribute("selected", "true");
+
+ if (hasClass(page, "dialog") && !page.target)
+ showForm(page);
+}
+
+function showForm(form)
+{
+ form.onsubmit = function(event)
+ {
+ event.preventDefault();
+ submitForm(form);
+ };
+
+ form.onclick = function(event)
+ {
+ if (event.target == form && hasClass(form, "dialog"))
+ cancelDialog(form);
+ };
+}
+
+function cancelDialog(form)
+{
+ form.removeAttribute("selected");
+}
+
+function updatePage(page, fromPage)
+{
+ if (!page.id)
+ page.id = "__" + (++newPageCount) + "__";
+
+ location.hash = currentHash = hashPrefix + page.id;
+ pageHistory.push(page.id);
+
+ var pageTitle = $("pageTitle");
+ if (page.title)
+ pageTitle.innerHTML = page.title;
+
+ if (page.localName.toLowerCase() == "form" && !page.target)
+ showForm(page);
+
+ var backButton = $("backButton");
+ if (backButton)
+ {
+ var prevPage = $(pageHistory[pageHistory.length-2]);
+ if (prevPage && !page.getAttribute("hideBackButton"))
+ {
+ backButton.style.display = "inline";
+ backButton.innerHTML = prevPage.title ? prevPage.title : "Back";
+ }
+ else
+ backButton.style.display = "none";
+ }
+}
+
+function slidePages(fromPage, toPage, backwards)
+{
+ var axis = (backwards ? fromPage : toPage).getAttribute("axis");
+
+ clearInterval(checkTimer);
+
+ if (canDoSlideAnim() && axis != 'y')
+ {
+ slide2(fromPage, toPage, backwards, slideDone);
+ }
+ else
+ {
+ slide1(fromPage, toPage, backwards, axis, slideDone);
+ }
+
+ function slideDone()
+ {
+ if (!hasClass(toPage, "dialog"))
+ fromPage.removeAttribute("selected");
+ checkTimer = setInterval(checkOrientAndLocation, 300);
+ setTimeout(updatePage, 0, toPage, fromPage);
+ fromPage.removeEventListener('webkitTransitionEnd', slideDone, false);
+ }
+}
+
+function canDoSlideAnim()
+{
+ return (iui.animOn) && (typeof WebKitCSSMatrix == "object");
+}
+
+function slide1(fromPage, toPage, backwards, axis, cb)
+{
+ if (axis == "y")
+ (backwards ? fromPage : toPage).style.top = "100%";
+ else
+ toPage.style.left = "100%";
+
+ scrollTo(0, 1);
+ toPage.setAttribute("selected", "true");
+ var percent = 100;
+ slide();
+ var timer = setInterval(slide, slideInterval);
+
+ function slide()
+ {
+ percent -= slideSpeed;
+ if (percent <= 0)
+ {
+ percent = 0;
+ clearInterval(timer);
+ cb();
+ }
+
+ if (axis == "y")
+ {
+ backwards
+ ? fromPage.style.top = (100-percent) + "%"
+ : toPage.style.top = percent + "%";
+ }
+ else
+ {
+ fromPage.style.left = (backwards ? (100-percent) : (percent-100)) + "%";
+ toPage.style.left = (backwards ? -percent : percent) + "%";
+ }
+ }
+}
+
+
+function slide2(fromPage, toPage, backwards, cb)
+{
+ toPage.style.webkitTransitionDuration = '0ms'; // Turn off transitions to set toPage start offset
+ // fromStart is always 0% and toEnd is always 0%
+ // iPhone won't take % width on toPage
+ var toStart = 'translateX(' + (backwards ? '-' : '') + window.innerWidth + 'px)';
+ var fromEnd = 'translateX(' + (backwards ? '100%' : '-100%') + ')';
+ toPage.style.webkitTransform = toStart;
+ toPage.setAttribute("selected", "true");
+ toPage.style.webkitTransitionDuration = ''; // Turn transitions back on
+ function startTrans()
+ {
+ fromPage.style.webkitTransform = fromEnd;
+ toPage.style.webkitTransform = 'translateX(0%)'; //toEnd
+ }
+ fromPage.addEventListener('webkitTransitionEnd', cb, false);
+ setTimeout(startTrans, 0);
+}
+
+function preloadImages()
+{
+ var preloader = document.createElement("div");
+ preloader.id = "preloader";
+ document.body.appendChild(preloader);
+}
+
+function submitForm(form)
+{
+ iui.showPageByHref(form.action || "POST", encodeForm(form), form.method);
+}
+
+function encodeForm(form)
+{
+ function encode(inputs)
+ {
+ for (var i = 0; i < inputs.length; ++i)
+ {
+ if (inputs[i].name)
+ args.push(inputs[i].name + "=" + escape(inputs[i].value));
+ }
+ }
+
+ var args = [];
+ encode(form.getElementsByTagName("input"));
+ encode(form.getElementsByTagName("textarea"));
+ encode(form.getElementsByTagName("select"));
+ return args;
+}
+
+function findParent(node, localName)
+{
+ while (node && (node.nodeType != 1 || node.localName.toLowerCase() != localName))
+ node = node.parentNode;
+ return node;
+}
+
+function hasClass(self, name)
+{
+ var re = new RegExp("(^|\\s)"+name+"($|\\s)");
+ return re.exec(self.getAttribute("class")) != null;
+}
+
+function replaceElementWithSource(replace, source)
+{
+ var page = replace.parentNode;
+ var parent = replace;
+ while (page.parentNode != document.body)
+ {
+ page = page.parentNode;
+ parent = parent.parentNode;
+ }
+
+ var frag = document.createElement(parent.localName);
+ frag.innerHTML = source;
+
+ page.removeChild(parent);
+
+ while (frag.firstChild)
+ page.appendChild(frag.firstChild);
+}
+
+function $(id) { return document.getElementById(id); }
+function ddd() { console.log.apply(console, arguments); }
+
+})();
--- /dev/null
+body{margin:0;font-family:Helvetica;background:#FFF;color:#000;overflow-x:hidden;-webkit-user-select:none;-webkit-text-size-adjust:none;}body>*:not(.toolbar){display:none;position:absolute;margin:0;padding:0;left:0;top:45px;width:100%;min-height:372px;-webkit-transition-duration:300ms;-webkit-transition-property:-webkit-transform;-webkit-transform:translateX(0%);}body[orient="landscape"]>*:not(.toolbar){min-height:268px;}body>*[selected="true"]{display:block;}a[selected],a:active{background-color:#194fdb!important;background-image:url(listArrowSel.png),url(selection.png)!important;background-repeat:no-repeat,repeat-x;background-position:right center,left top;color:#FFF!important;}a[selected="progress"]{background-image:url(loading.gif),url(selection.png)!important;}body>.toolbar{box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;border-bottom:1px solid #2d3642;border-top:1px solid #6d84a2;padding:10px;height:45px;background:url(toolbar.png) #6d84a2 repeat-x;}.toolbar>h1{position:absolute;overflow:hidden;left:50%;margin:1px 0 0 -75px;height:45px;font-size:20px;width:150px;font-weight:bold;text-shadow:rgba(0,0,0,0.4) 0 -1px 0;text-align:center;text-overflow:ellipsis;white-space:nowrap;color:#FFF;}body[orient="landscape"]>.toolbar>h1{margin-left:-125px;width:250px;}.button{position:absolute;overflow:hidden;top:8px;right:6px;margin:0;border-width:0 5px;padding:0 3px;width:auto;height:30px;line-height:30px;font-family:inherit;font-size:12px;font-weight:bold;color:#FFF;text-shadow:rgba(0,0,0,0.6) 0 -1px 0;text-overflow:ellipsis;text-decoration:none;white-space:nowrap;background:none;-webkit-border-image:url(toolButton.png) 0 5 0 5;}.blueButton{-webkit-border-image:url(blueButton.png) 0 5 0 5;border-width:0 5px;}.leftButton{left:6px;right:auto;}#backButton{display:none;left:6px;right:auto;padding:0;max-width:55px;border-width:0 8px 0 14px;-webkit-border-image:url(backButton.png) 0 8 0 14;}.whiteButton,.redButton,.grayButton{display:block;border-width:0 12px;padding:10px;text-align:center;font-size:20px;font-weight:bold;text-decoration:inherit;color:inherit;}.whiteButton{-webkit-border-image:url(whiteButton.png) 0 12 0 12;text-shadow:rgba(255,255,255,0.7) 0 1px 0;}.redButton{-webkit-border-image:url(redButton.png) 0 12 0 12;color:#fff;text-shadow:#7a0001 0 -1px 0;}.grayButton{-webkit-border-image:url(grayButton.png) 0 12 0 12;color:#FFF;}body>ul>li{position:relative;margin:0;border-bottom:1px solid #E0E0E0;padding:8px 0 8px 10px;font-size:20px;font-weight:bold;list-style:none;}body>ul>li.group{position:relative;top:-1px;margin-bottom:-2px;border-top:1px solid #7d7d7d;border-bottom:1px solid #999;padding:1px 10px;background:url(listGroup.png) repeat-x;font-size:17px;font-weight:bold;text-shadow:rgba(0,0,0,0.4) 0 1px 0;color:#FFF;}body>ul>li.group:first-child{top:0;border-top:none;}body>ul>li>a{display:block;margin:-8px 0 -8px -10px;padding:8px 32px 8px 10px;text-decoration:none;color:inherit;background:url(listArrow.png) no-repeat right center;}a[target="_replace"]{box-sizing:border-box;-webkit-box-sizing:border-box;padding-top:25px;padding-bottom:25px;font-size:18px;color:cornflowerblue;background-color:#FFF;background-image:none;}body>.dialog{top:0;width:100%;min-height:417px;z-index:2;background:rgba(0,0,0,0.8);padding:0;text-align:right;}.dialog>fieldset{box-sizing:border-box;-webkit-box-sizing:border-box;width:100%;margin:0;border:none;border-top:1px solid #6d84a2;padding:10px 6px;background:url(toolbar.png) #7388a5 repeat-x;}.dialog>fieldset>h1{margin:0 10px 0 10px;padding:0;font-size:20px;font-weight:bold;color:#FFF;text-shadow:rgba(0,0,0,0.4) 0 -1px 0;text-align:center;}.dialog>fieldset>label{position:absolute;margin:16px 0 0 6px;font-size:14px;color:#999;}input:not(input[type|=radio]):not(input[type|=checkbox]){box-sizing:border-box;-webkit-box-sizing:border-box;width:100%;margin:8px 0 0 0;padding:6px 6px 6px 44px;font-size:16px;font-weight:normal;}body>.panel{box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:10px;background:#c8c8c8 url(pinstripes.png);}.panel>fieldset{position:relative;margin:0 0 20px 0;padding:0;background:#FFF;-webkit-border-radius:10px;-moz-border-radius:10px;border:1px solid #999;text-align:right;font-size:16px;}.row{position:relative;min-height:42px;border-bottom:1px solid #999;-webkit-border-radius:0;text-align:right;}fieldset>.row:last-child{border-bottom:none!important;}.row>input:not(input[type|=radio]):not(input[type|=checkbox]){box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;margin:0;border:none;padding:12px 10px 0 110px;height:42px;background:none;}.row>input[type|=radio],.row>input[type|=checkbox]{margin:7px 7px 0 0;height:25px;width:25px;}.row>label{position:absolute;margin:0 0 0 14px;line-height:42px;font-weight:bold;}.row>span{position:absolute;padding:12px 10px 0 110px;margin:0;}.row>.toggle{position:absolute;top:6px;right:6px;width:100px;height:28px;}.toggle{border:1px solid #888;-webkit-border-radius:6px;background:#FFF url(toggle.png) repeat-x;font-size:19px;font-weight:bold;line-height:30px;}.toggle[toggled="true"]{border:1px solid #143fae;background:#194fdb url(toggleOn.png) repeat-x;}.toggleOn{display:none;position:absolute;width:60px;text-align:center;left:0;top:0;color:#FFF;text-shadow:rgba(0,0,0,0.4) 0 -1px 0;}.toggleOff{position:absolute;width:60px;text-align:center;right:0;top:0;color:#666;}.toggle[toggled="true"]>.toggleOn{display:block;}.toggle[toggled="true"]>.toggleOff{display:none;}.thumb{position:absolute;top:-1px;left:-1px;width:40px;height:28px;border:1px solid #888;-webkit-border-radius:6px;background:#fff url(thumb.png) repeat-x;}.toggle[toggled="true"]>.thumb{left:auto;right:-1px;}.panel>h2{margin:0 0 8px 14px;font-size:inherit;font-weight:bold;color:#4d4d70;text-shadow:rgba(255,255,255,0.75) 2px 2px 0;}#preloader{display:none;background-image:url(loading.gif),url(selection.png),url(blueButton.png),url(listArrowSel.png),url(listGroup.png);}
\ No newline at end of file
--- /dev/null
+(function(){var _1=20;var _2=0;var _3=null;var _4=null;var _5=0;var _6=location.hash;var _7="#_";var _8=[];var _9=0;var _a;var _b=false;var _c="portrait";var _d="landscape";window.iui={animOn:true,showPage:function(_e,_f){if(_e){if(_4){_4.removeAttribute("selected");_4=null;}if(hasClass(_e,"dialog")){showDialog(_e);}else{var _10=_3;_3=_e;if(_10){setTimeout(slidePages,0,_10,_e,_f);}else{updatePage(_e,_10);}}}},showPageById:function(_11){var _12=$(_11);if(_12){var _13=_8.indexOf(_11);var _14=_13!=-1;if(_14){_8.splice(_13,_8.length);}iui.showPage(_12,_14);}},showPageByHref:function(_15,_16,_17,_18,cb){var req=new XMLHttpRequest();req.onerror=function(){if(cb){cb(false);}};req.onreadystatechange=function(){if(req.readyState==4){if(_18){replaceElementWithSource(_18,req.responseText);}else{var _1b=document.createElement("div");_1b.innerHTML=req.responseText;iui.insertPages(_1b.childNodes);}if(cb){setTimeout(cb,1000,true);}}};if(_16){req.open(_17||"GET",_15,true);req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");req.setRequestHeader("Content-Length",_16.length);req.send(_16.join("&"));}else{req.open(_17||"GET",_15,true);req.send(null);}},insertPages:function(_1c){var _1d;for(var i=0;i<_1c.length;++i){var _1f=_1c[i];if(_1f.nodeType==1){if(!_1f.id){_1f.id="__"+(++_9)+"__";}var _20=$(_1f.id);if(_20){_20.parentNode.replaceChild(_1f,_20);}else{document.body.appendChild(_1f);}if(_1f.getAttribute("selected")=="true"||!_1d){_1d=_1f;}--i;}}if(_1d){iui.showPage(_1d);}},getSelectedPage:function(){for(var _21=document.body.firstChild;_21;_21=_21.nextSibling){if(_21.nodeType==1&&_21.getAttribute("selected")=="true"){return _21;}}},isNativeUrl:function(_22){for(var i=0;i<iui.nativeUrlPatterns.length;i++){if(_22.match(iui.nativeUrlPatterns[i])){return true;}}return false;},nativeUrlPatterns:[new RegExp("^http://maps.google.com/maps?"),new RegExp("^mailto:"),new RegExp("^tel:"),new RegExp("^http://www.youtube.com/watch\\?v="),new RegExp("^http://www.youtube.com/v/"),new RegExp("^javascript:"),]};addEventListener("load",function(_24){var _25=iui.getSelectedPage();var _26=getPageFromLoc();if(_25){iui.showPage(_25);}if(_26&&(_26!=_25)){iui.showPage(_26);}setTimeout(preloadImages,0);if(typeof window.onorientationchange=="object"){window.onorientationchange=orientChangeHandler;_b=true;setTimeout(orientChangeHandler,0);}setTimeout(checkOrientAndLocation,0);_a=setInterval(checkOrientAndLocation,300);},false);addEventListener("unload",function(_27){return;},false);addEventListener("click",function(_28){var _29=findParent(_28.target,"a");if(_29){function unselect(){_29.removeAttribute("selected");}if(_29.href&&_29.hash&&_29.hash!="#"&&!_29.target){_29.setAttribute("selected","true");iui.showPage($(_29.hash.substr(1)));setTimeout(unselect,500);}else{if(_29==$("backButton")){history.back();}else{if(_29.getAttribute("type")=="submit"){var _2a=findParent(_29,"form");if(_2a.target=="_self"){_2a.submit();return;}submitForm(_2a);}else{if(_29.getAttribute("type")=="cancel"){cancelDialog(findParent(_29,"form"));}else{if(_29.target=="_replace"){_29.setAttribute("selected","progress");iui.showPageByHref(_29.href,null,null,_29,unselect);}else{if(iui.isNativeUrl(_29.href)){return;}else{if(_29.target=="_webapp"){location.href=_29.href;}else{if(!_29.target){_29.setAttribute("selected","progress");iui.showPageByHref(_29.href,null,null,null,unselect);}else{return;}}}}}}}}_28.preventDefault();}},true);addEventListener("click",function(_2b){var div=findParent(_2b.target,"div");if(div&&hasClass(div,"toggle")){div.setAttribute("toggled",div.getAttribute("toggled")!="true");_2b.preventDefault();}},true);function getPageFromLoc(){var _2d;var _2e=location.hash.match(/#_([^\?_]+)/);if(_2e){_2d=_2e[1];}if(_2d){_2d=$(_2d);}return _2d;}function orientChangeHandler(){var _2f=window.orientation;switch(_2f){case 0:setOrientation(_c);break;case 90:case -90:setOrientation(_d);break;}}function checkOrientAndLocation(){if(!_b){if(window.innerWidth!=_5){_5=window.innerWidth;var _30=_5==320?_c:_d;setOrientation(_30);}}if(location.hash!=_6){var _31=location.hash.substr(_7.length);iui.showPageById(_31);}}function setOrientation(_32){document.body.setAttribute("orient",_32);setTimeout(scrollTo,100,0,1);}function showDialog(_33){_4=_33;_33.setAttribute("selected","true");if(hasClass(_33,"dialog")&&!_33.target){showForm(_33);}}function showForm(_34){_34.onsubmit=function(_35){_35.preventDefault();submitForm(_34);};_34.onclick=function(_36){if(_36.target==_34&&hasClass(_34,"dialog")){cancelDialog(_34);}};}function cancelDialog(_37){_37.removeAttribute("selected");}function updatePage(_38,_39){if(!_38.id){_38.id="__"+(++_9)+"__";}location.hash=_6=_7+_38.id;_8.push(_38.id);var _3a=$("pageTitle");if(_38.title){_3a.innerHTML=_38.title;}if(_38.localName.toLowerCase()=="form"&&!_38.target){showForm(_38);}var _3b=$("backButton");if(_3b){var _3c=$(_8[_8.length-2]);if(_3c&&!_38.getAttribute("hideBackButton")){_3b.style.display="inline";_3b.innerHTML=_3c.title?_3c.title:"Back";}else{_3b.style.display="none";}}}function slidePages(_3d,_3e,_3f){var _40=(_3f?_3d:_3e).getAttribute("axis");clearInterval(_a);if(canDoSlideAnim()&&_40!="y"){slide2(_3d,_3e,_3f,slideDone);}else{slide1(_3d,_3e,_3f,_40,slideDone);}function slideDone(){if(!hasClass(_3e,"dialog")){_3d.removeAttribute("selected");}_a=setInterval(checkOrientAndLocation,300);setTimeout(updatePage,0,_3e,_3d);_3d.removeEventListener("webkitTransitionEnd",slideDone,false);}}function canDoSlideAnim(){return (iui.animOn)&&(typeof WebKitCSSMatrix=="object");}function slide1(_41,_42,_43,_44,cb){if(_44=="y"){(_43?_41:_42).style.top="100%";}else{_42.style.left="100%";}scrollTo(0,1);_42.setAttribute("selected","true");var _46=100;slide();var _47=setInterval(slide,_2);function slide(){_46-=_1;if(_46<=0){_46=0;clearInterval(_47);cb();}if(_44=="y"){_43?_41.style.top=(100-_46)+"%":_42.style.top=_46+"%";}else{_41.style.left=(_43?(100-_46):(_46-100))+"%";_42.style.left=(_43?-_46:_46)+"%";}}}function slide2(_48,_49,_4a,cb){_49.style.webkitTransitionDuration="0ms";var _4c="translateX("+(_4a?"-":"")+window.innerWidth+"px)";var _4d="translateX("+(_4a?"100%":"-100%")+")";_49.style.webkitTransform=_4c;_49.setAttribute("selected","true");_49.style.webkitTransitionDuration="";function startTrans(){_48.style.webkitTransform=_4d;_49.style.webkitTransform="translateX(0%)";}_48.addEventListener("webkitTransitionEnd",cb,false);setTimeout(startTrans,0);}function preloadImages(){var _4e=document.createElement("div");_4e.id="preloader";document.body.appendChild(_4e);}function submitForm(_4f){iui.showPageByHref(_4f.action||"POST",encodeForm(_4f),_4f.method);}function encodeForm(_50){function encode(_51){for(var i=0;i<_51.length;++i){if(_51[i].name){args.push(_51[i].name+"="+escape(_51[i].value));}}}var _53=[];encode(_50.getElementsByTagName("input"));encode(_50.getElementsByTagName("textarea"));encode(_50.getElementsByTagName("select"));return _53;}function findParent(_54,_55){while(_54&&(_54.nodeType!=1||_54.localName.toLowerCase()!=_55)){_54=_54.parentNode;}return _54;}function hasClass(_56,_57){var re=new RegExp("(^|\\s)"+_57+"($|\\s)");return re.exec(_56.getAttribute("class"))!=null;}function replaceElementWithSource(_59,_5a){var _5b=_59.parentNode;var _5c=_59;while(_5b.parentNode!=document.body){_5b=_5b.parentNode;_5c=_5c.parentNode;}var _5d=document.createElement(_5c.localName);_5d.innerHTML=_5a;_5b.removeChild(_5c);while(_5d.firstChild){_5b.appendChild(_5d.firstChild);}}function $(id){return document.getElementById(id);}function ddd(){console.log.apply(console,arguments);}})();
\ No newline at end of file
--- /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);
+
+ $id = db_escape_string($_REQUEST["id"]);
+ $feed_id = db_escape_string($_REQUEST["feed"]);
+
+ render_article($link, $id, $feed_id);
+?>
+
--- /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);
+
+ $feed = db_escape_string($_REQUEST["id"]);
+
+ render_headlines_list($link, $feed);
+?>
+
define('MOBILE_FEEDLIST_ENABLE_ICONS', false);
define('TTRSS_SESSION_NAME', 'ttrss_m_sid');
- function render_feeds_list($link) {
+ function mobile_feed_has_icon($id) {
+ $filename = "../".ICONS_DIR."/$id.ico";
- $tags = $_GET["tags"];
+ return file_exists($filename) && filesize($filename) > 0;
+ }
- print "<div id=\"heading\">";
+ function render_category($link, $cat_id) {
+ $owner_uid = $_SESSION["uid"];
- if ($tags) {
- print __("Tags")."<span id=\"headingAddon\">
- (<a href=\"tt-rss.php\">".__("View feeds")."</a>, ";
+ if ($cat_id != 0) {
+ $cat_query = "cat_id = '$cat_id'";
} else {
- print __("Feeds")." <span id=\"headingAddon\">
- (<a href=\"tt-rss.php?tags=1\">".__("View tags")."</a>, ";
+ $cat_query = "cat_id IS NULL";
}
- print "<a href=\"tt-rss.php?go=sform\">".__("Search")."</a>, ";
-
- print "<a href=\"logout.php\">".__("Logout")."</a>)</span>";
- print "</div>";
-
- print "<ul class=\"feedList\">";
-
- $owner_uid = $_SESSION["uid"];
-
- if (!$tags) {
-
- /* virtual feeds */
-
- if (get_pref($link, 'ENABLE_FEED_CATS')) {
- print "<li class=\"feedCat\">".__("Special")."</li>";
- print "<li class=\"feedCatHolder\"><ul class=\"feedCatList\">";
- }
-
- $num_total = getFeedUnread($link, -4);
-
- $class = "virt";
-
- if ($num_total > 0) $class .= "Unread";
-
- printMobileFeedEntry(-4, $class, __("All articles"), $num_total,
- "../images/fresh.png", $link);
-
- $num_fresh = getFeedUnread($link, -3);
-
- $class = "virt";
-
- if ($num_fresh > 0) $class .= "Unread";
-
- printMobileFeedEntry(-3, $class, __("Fresh articles"), $num_fresh,
- "../images/fresh.png", $link);
-
- $num_starred = getFeedUnread($link, -1);
-
- $class = "virt";
-
- if ($num_starred > 0) $class .= "Unread";
-
- printMobileFeedEntry(-1, $class, __("Starred articles"), $num_starred,
- "../images/mark_set.png", $link);
+ $result = db_query($link, "SELECT id,
+ title,
+ (SELECT COUNT(id) FROM ttrss_entries,ttrss_user_entries
+ WHERE feed_id = ttrss_feeds.id AND unread = true
+ AND ttrss_user_entries.ref_id = ttrss_entries.id
+ AND owner_uid = '$owner_uid') as unread
+ FROM ttrss_feeds
+ WHERE
+ ttrss_feeds.hidden = false AND
+ ttrss_feeds.owner_uid = '$owner_uid' AND
+ parent_feed IS NULL AND
+ $cat_query
+ ORDER BY unread DESC,title");
+
+ $title = getCategoryTitle($link, $cat_id);
- $class = "virt";
+ print "<ul id='cat-$cat_id' title='$title'>";
- $num_published = getFeedUnread($link, -2);
+ print "<li><a href='#cat-actions'>".__('Actions...')."</a></li>";
- if ($num_published > 0) $class .= "Unread";
+ while ($line = db_fetch_assoc($result)) {
+ $id = $line["id"];
+ $unread = $line["unread"];
- printMobileFeedEntry(-2, $class, __("Published articles"), $num_published,
- "../images/pub_set.png", $link);
+ $unread = rand(0, 100);
- if (get_pref($link, 'ENABLE_FEED_CATS')) {
- print "</ul>";
+ if ($unread > 0) {
+ $line["title"] = $line["title"] . " ($unread)";
+ $class = '';
+ } else {
+ $class = 'oldItem';
}
-
- $result = db_query($link, "SELECT id,caption FROM
- ttrss_labels2 WHERE owner_uid = '$owner_uid' ORDER by caption");
-
- if (db_num_rows($result) > 0) {
- if (get_pref($link, 'ENABLE_FEED_CATS')) {
- print "<li class=\"feedCat\">".__("Labels")."</li>";
- print "<li class=\"feedCatHolder\"><ul class=\"feedCatList\">";
- } else {
-// print "<li><hr></li>";
- }
- }
-
- while ($line = db_fetch_assoc($result)) {
-
- $count = getFeedUnread($link, -$line["id"]-11);
-
- $class = "label";
-
- if ($count > 0) {
- $class .= "Unread";
- }
-
- printMobileFeedEntry(-$line["id"]-11,
- $class, $line["caption"], $count, "../images/label.png", $link);
-
- }
-
- if (db_num_rows($result) > 0) {
- if (get_pref($link, 'ENABLE_FEED_CATS')) {
- print "</ul>";
- }
- }
-
-
- if (get_pref($link, 'ENABLE_FEED_CATS')) {
- $order_by_qpart = "category,title";
+ if (mobile_feed_has_icon($id)) {
+ $icon_url = "../".ICONS_URL."/$id.ico";
} else {
- $order_by_qpart = "title";
+ $icon_url = "../images/blank_icon.gif";
}
- $result = db_query($link, "SELECT ttrss_feeds.*,
- ".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated_noms,
- (SELECT COUNT(id) FROM ttrss_entries,ttrss_user_entries
- WHERE feed_id = ttrss_feeds.id AND
- ttrss_user_entries.ref_id = ttrss_entries.id AND
- owner_uid = '$owner_uid') AS total,
- (SELECT COUNT(id) FROM ttrss_entries,ttrss_user_entries
- WHERE feed_id = ttrss_feeds.id AND unread = true
- AND ttrss_user_entries.ref_id = ttrss_entries.id
- AND owner_uid = '$owner_uid') as unread,
- cat_id,last_error,
- ttrss_feed_categories.title AS category,
- ttrss_feed_categories.collapsed
- FROM ttrss_feeds LEFT JOIN ttrss_feed_categories
- ON (ttrss_feed_categories.id = cat_id)
- WHERE
- ttrss_feeds.hidden = false AND
- ttrss_feeds.owner_uid = '$owner_uid' AND parent_feed IS NULL
- ORDER BY $order_by_qpart");
-
- $actid = $_GET["actid"];
-
- /* real feeds */
-
- $lnum = 0;
-
- $category = "";
-
- while ($line = db_fetch_assoc($result)) {
- if (get_pref($link, 'HIDE_READ_FEEDS') && (int)$line['unread']==0) {
- continue;
- }
-
- $feed = db_unescape_string($line["title"]);
- $feed_id = $line["id"];
-
- $subop = $_GET["subop"];
-
- $total = $line["total"];
- $unread = $line["unread"];
-
- $rtl_content = sql_bool_to_bool($line["rtl_content"]);
-
- if ($rtl_content) {
- $rtl_tag = "dir=\"RTL\"";
- } else {
- $rtl_tag = "";
- }
-
- $tmp_result = db_query($link,
- "SELECT id,COUNT(unread) AS unread
- FROM ttrss_feeds LEFT JOIN ttrss_user_entries
- ON (ttrss_feeds.id = ttrss_user_entries.feed_id)
- WHERE parent_feed = '$feed_id' AND unread = true
- GROUP BY ttrss_feeds.id");
-
- if (db_num_rows($tmp_result) > 0) {
- while ($l = db_fetch_assoc($tmp_result)) {
- $unread += $l["unread"];
- }
- }
-
- $cat_id = $line["cat_id"];
-
- $tmp_category = $line["category"];
-
- if (!$tmp_category) {
- $tmp_category = "Uncategorized";
- }
-
- // $class = ($lnum % 2) ? "even" : "odd";
-
- if ($line["last_error"]) {
- $class = "error";
- } else {
- $class = "feed";
- }
-
- if ($unread > 0) $class .= "Unread";
-
- if ($actid == $feed_id) {
- $class .= "Selected";
- }
-
- if ($category != $tmp_category && get_pref($link, 'ENABLE_FEED_CATS')) {
-
- if ($category) {
- print "</ul></li>";
- }
-
- $category = $tmp_category;
+ print "<li class='$class'><a href='feed.php?id=$id'>" .
+ "<img class='tinyIcon' src='$icon_url'/>".
+ $line["title"] . "</a></li>";
+ }
- $collapsed = $line["collapsed"];
+ print "</ul>";
- // workaround for NULL category
- if ($category == "Uncategorized") {
- if ($_COOKIE["ttrss_vf_uclps"] == 1) {
- $collapsed = "t";
- }
- }
+ /* print "<ul id='cat--1' title='$title'>";
- if ($collapsed == "t" || $collapsed == "1") {
- $holder_class = "invisible";
- $ellipsis = "...";
- } else {
- $holder_class = "feedCatHolder";
- $ellipsis = "";
- }
+ foreach (array(-4, -1,-2,-3) as $id) {
+ $title = getFeedTitle($link, $id);
+ $unread = getFeedUnread($link, $id, false);
- if ($cat_id) {
- $cat_id_qpart = "cat_id = '$cat_id'";
+ if ($unread > 0) {
+ $title = $title . " ($unread)";
+ $class = '';
} else {
- $cat_id_qpart = "cat_id IS NULL";
+ $class = 'oldItem';
}
- $cat_id = sprintf("%d", $cat_id);
- $cat_unread = getCategoryUnread($link, $cat_id);
-
- print "<li class=\"feedCat\">
- <a href=\"?subop=tc&id=$cat_id\">$tmp_category</a>
- <a href=\"?go=vf&id=$cat_id&cat=true\">
- <span class=\"$catctr_class\">($cat_unread)$ellipsis</span>
- </a></li>";
-
- print "<li id=\"feedCatHolder\" class=\"$holder_class\">
- <ul class=\"feedCatList\">";
- }
-
- printMobileFeedEntry($feed_id, $class, $feed, $unread,
- "../icons/$feed_id.ico", $link, $rtl_content);
-
- ++$lnum;
- }
-
- } else {
- // tags
-
- $result = db_query($link, "SELECT tag_name,SUM((SELECT COUNT(int_id)
- FROM ttrss_user_entries WHERE int_id = post_int_id
- AND unread = true)) AS count FROM ttrss_tags
- WHERE owner_uid = '".$_SESSION['uid']."' GROUP BY tag_name ORDER BY tag_name");
-
- $tags = array();
-
- while ($line = db_fetch_assoc($result)) {
- $tags[$line["tag_name"]] += $line["count"];
- }
-
- foreach (array_keys($tags) as $tag) {
-
- $unread = $tags[$tag];
-
- $class = "tag";
-
- if ($unread > 0) {
- $class .= "Unread";
+ print "<li class='$class'><a href='feed.php?id=$id'>$title</a></li>";
}
-
- printMobileFeedEntry($tag, $class, $tag, $unread,
- "../images/tag.png", $link);
-
- }
-
-
- }
- }
-
- function printMobileFeedEntry($feed_id, $class, $feed_title, $unread, $icon_file, $link,
- $rtl_content = false) {
-
- if (file_exists($icon_file) && filesize($icon_file) > 0) {
- $feed_icon = "<img src=\"$icon_file\">";
- } else {
- $feed_icon = "<img src=\"../images/blank_icon.gif\">";
- }
-
- if ($rtl_content) {
- $rtl_tag = "dir=\"rtl\"";
- } else {
- $rtl_tag = "dir=\"ltr\"";
- }
-
- $feed = "<a href=\"?go=vf&id=$feed_id\">$feed_title</a>";
-
- print "<li class=\"$class\">";
-# if (get_pref($link, 'ENABLE_FEED_ICONS')) {
-# print "$feed_icon";
-# }
- print "<span $rtl_tag>$feed</span> ";
-
- if ($unread != 0) {
- print "<span $rtl_tag>($unread)</span>";
- }
-
- print "</li>";
+ print "</ul>"; */
}
- function render_headlines($link) {
-
- $feed = db_escape_string($_GET["id"]);
- $limit = db_escape_string($_GET["limit"]);
- $view_mode = db_escape_string($_GET["viewmode"]);
- $cat_view = db_escape_string($_GET["cat"]);
- $subop = $_GET["subop"];
- $catchup_op = $_GET["catchup_op"];
-
- if (!$view_mode) {
- if ($_SESSION["mobile:viewmode"]) {
- $view_mode = $_SESSION["mobile:viewmode"];
- } else {
- $view_mode = "adaptive";
- }
- }
-
- $_SESSION["mobile:viewmode"] = $view_mode;
-
- if (!$limit) $limit = 30;
- if (!$feed) $feed = 0;
-
- if (preg_match("/^-?[0-9][0-9]*$/", $feed) != false) {
+ function render_categories_list($link) {
+ $owner_uid = $_SESSION["uid"];
- $result = db_query($link, "SELECT rtl_content FROM ttrss_feeds
- WHERE id = '$feed' AND owner_uid = " . $_SESSION["uid"]);
- if (db_num_rows($result) == 1) {
- $rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content"));
- } else {
- $rtl_content = false;
- }
+ print '<ul id="home" title="Feeds" selected="true">';
- if ($rtl_content) {
- $rtl_tag = "dir=\"RTL\"";
+ foreach (array(-1, -2) as $id) {
+ $title = getCategoryTitle($link, $id);
+ $unread = getFeedUnread($link, $id, true);
+ if ($unread > 0) {
+ $title = $title . " ($unread)";
+ $class = '';
} else {
- $rtl_tag = "";
- }
- } else {
- $rtl_content = false;
- $rtl_tag = "";
- }
-
- print "<div id=\"headlines\" $rtl_tag>";
-
- if ($subop == "ForceUpdate" && sprintf("%d", $feed) > 0) {
- update_generic_feed($link, $feed, $cat_view, true);
- }
-
- if ($subop == "MarkAllRead" || $catchup_op == "feed") {
- catchup_feed($link, $feed, $cat_view);
- }
-
- if ($catchup_op == "selection") {
- $ids_to_mark = array_keys($_GET["sel_ids"]);
- if ($ids_to_mark) {
- foreach ($ids_to_mark as $id) {
- db_query($link, "UPDATE ttrss_user_entries SET
- unread = false,last_read = NOW()
- WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
- }
- }
- }
-
- if ($subop == "MarkPageRead" || $catchup_op == "page") {
- $ids_to_mark = $_SESSION["last_page_ids.$feed"];
-
- if ($ids_to_mark) {
-
- foreach ($ids_to_mark as $id) {
- db_query($link, "UPDATE ttrss_user_entries SET
- unread = false,last_read = NOW()
- WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
- }
+ $class = 'oldItem';
}
- }
-
-
- /// START /////////////////////////////////////////////////////////////////////////////////
- $search = db_escape_string($_GET["query"]);
- $search_mode = db_escape_string($_GET["search_mode"]);
- $match_on = db_escape_string($_GET["match_on"]);
-
- if (!$match_on) {
- $match_on = "both";
+ print "<li class='$class'><a href='cat.php?id=$id'>$title</a></li>";
}
- $real_offset = $offset * $limit;
-
- if ($_GET["debug"]) $timing_info = print_checkpoint("H0", $timing_info);
-
- $qfh_ret = queryFeedHeadlines($link, $feed, $limit, $view_mode, $cat_view,
- $search, $search_mode, $match_on, false, $real_offset);
-
- if ($_GET["debug"]) $timing_info = print_checkpoint("H1", $timing_info);
+ $result = db_query($link, "SELECT
+ ttrss_feed_categories.id,
+ ttrss_feed_categories.title,
+ COUNT(ttrss_feeds.id) AS num_feeds
+ FROM ttrss_feed_categories, ttrss_feeds
+ WHERE ttrss_feed_categories.owner_uid = $owner_uid
+ AND ttrss_feed_categories.id = cat_id
+ AND hidden = false
+ GROUP BY ttrss_feed_categories.id,
+ ttrss_feed_categories.title
+ ORDER BY ttrss_feed_categories.title");
- $result = $qfh_ret[0];
- $feed_title = $qfh_ret[1];
- $feed_site_url = $qfh_ret[2];
- $last_error = $qfh_ret[3];
-
- /// STOP //////////////////////////////////////////////////////////////////////////////////
-
- if (!$result) {
- print "<div align='center'>".
- __("Could not display feed (query failed). Please check label match syntax or local configuration.").
- "</div>";
- return;
- }
-
- print "<div id=\"heading\">";
- # if (!$cat_view && file_exists("../icons/$feed.ico") && filesize("../icons/$feed.ico") > 0) {
- # print "<img class=\"feedIcon\" src=\"../icons/$feed.ico\">";
- # }
-
- print "$feed_title <span id=\"headingAddon\">(";
- print "<a href=\"tt-rss.php\">".__("Back")."</a>, ";
- print "<a href=\"tt-rss.php?go=sform&aid=$feed&ic=$cat_view\">".__("Search")."</a>, ";
- print "<a href=\"tt-rss.php?go=vf&id=$feed&subop=ForceUpdate\">".__("Update")."</a>";
-
-# print "Mark as read: ";
-# print "<a href=\"tt-rss.php?go=vf&id=$feed&subop=MarkAsRead\">Page</a>, ";
-# print "<a href=\"tt-rss.php?go=vf&id=$feed&subop=MarkAllRead\">Feed</a>";
-
- print ")</span>";
-
- print " " . __('View:');
-
- print "<form style=\"display : inline\" method=\"GET\" action=\"tt-rss.php\">";
-
- /* print "<select name=\"viewmode\">
- <option selected value=\"adaptive\"> " . __('Adaptive') . "</option>
- <option value=\"all_articles\">" . __('All Articles') . "</option>
- <option value=\"marked\">" . __('Starred') . "</option>
- <option value=\"unread\">" . __('Unread') . "</option>
- </select>"; */
-
- $sel_values = array(
- "adaptive" => __("Adaptive"),
- "all_articles" => __("All Articles"),
- "unread" => __("Unread"),
- "marked" => __("Starred"));
-
- print_select_hash("viewmode", $view_mode, $sel_values);
-
- print "<input type=\"hidden\" name=\"id\" value=\"$feed\">
- <input type=\"hidden\" name=\"cat\" value=\"$cat_view\">
- <input type=\"hidden\" name=\"go\" value=\"vf\">
- <input type=\"submit\" value=\"".__('Refresh')."\">";
- print "</form>";
-
- print "</div>";
-
- if (db_num_rows($result) > 0) {
+ $cat_ids = array();
- print "<form method=\"GET\" action=\"tt-rss.php\">";
- print "<input type=\"hidden\" name=\"go\" value=\"vf\">";
- print "<input type=\"hidden\" name=\"id\" value=\"$feed\">";
- print "<input type=\"hidden\" name=\"cat\" value=\"$cat_view\">";
+ while ($line = db_fetch_assoc($result)) {
- print "<ul class=\"headlines\" id=\"headlines\">";
+ if ($line["num_feeds"] > 0) {
- $page_art_ids = array();
-
- $lnum = 0;
-
- error_reporting (DEFAULT_ERROR_LEVEL);
-
- $num_unread = 0;
-
- while ($line = db_fetch_assoc($result)) {
-
- $class = ($lnum % 2) ? "even" : "odd";
-
+ $unread = getFeedUnread($link, $line["id"], true);
$id = $line["id"];
- $feed_id = $line["feed_id"];
-
- array_push($page_art_ids, $id);
-
- if ($line["last_read"] == "" &&
- ($line["unread"] != "t" && $line["unread"] != "1")) {
-
- $update_pic = "<img id='FUPDPIC-$id' src=\"images/updated.png\"
- alt=\"".__("Updated")."\">";
- } else {
- $update_pic = "<img id='FUPDPIC-$id' src=\"images/blank_icon.gif\"
- alt=\"".__("Updated")."\">";
- }
-
- if ($line["unread"] == "t" || $line["unread"] == "1") {
- $class .= "Unread";
- ++$num_unread;
- $is_unread = true;
- } else {
- $is_unread = false;
- }
-
- if ($line["marked"] == "t" || $line["marked"] == "1") {
- $marked_pic = "<img alt=\"S\" class='marked' src=\"../images/mark_set.png\">";
- } else {
- $marked_pic = "<img alt=\"s\" class='marked' src=\"../images/mark_unset.png\">";
- }
- if ($line["published"] == "t" || $line["published"] == "1") {
- $published_pic = "<img alt=\"P\" class='marked' src=\"../images/pub_set.gif\">";
+ if ($unread > 0) {
+ $line["title"] = $line["title"] . " ($unread)";
+ $class = '';
} else {
- $published_pic = "<img alt=\"p\" class='marked' src=\"../images/pub_unset.gif\">";
+ $class = 'oldItem';
}
-
- $content_link = "<a href=\"?go=view&id=$id&cat=$cat_view&ret_feed=$feed&feed=$feed_id\">" .
- $line["title"] . "</a>";
-
- if (get_pref($link, 'HEADLINES_SMART_DATE')) {
- $updated_fmt = smart_date_time(strtotime($line["updated"]));
- } else {
- $short_date = get_pref($link, 'SHORT_DATE_FORMAT');
- $updated_fmt = date($short_date, strtotime($line["updated"]));
- }
- print "<li class='$class' id=\"HROW-$id\">";
-
- print "<input type=\"checkbox\" name=\"sel_ids[$id]\"
- id=\"HSCB-$id\" onchange=\"toggleSelectRow(this, $id)\">";
-
- print "<a href=\"?go=vf&id=$feed&ts=$id&cat=$cat_view\">$marked_pic</a>";
- print "<a href=\"?go=vf&id=$feed&tp=$id&cat=$cat_view\">$published_pic</a>";
-
- print $content_link;
-
- if ($line["feed_title"]) {
- print " (<a href='?go=vf&id=$feed_id'>".
- $line["feed_title"]."</a>)";
- }
- print "<span class='hlUpdated'> ($updated_fmt)</span>";
+ print "<li class='$class'><a href='cat.php?id=$id'>" .
+ $line["title"] . "</a></li>";
- print "</li>";
+ array_push($cat_ids, $id);
-
- ++$lnum;
}
-
- print "</ul>";
-
- print "<div class='footerAddon'>";
-
- $_SESSION["last_page_ids.$feed"] = $page_art_ids;
-
-/* print "<a href=\"tt-rss.php?go=vf&id=$feed&subop=MarkPageRead\">Page</a>, ";
- print "<a href=\"tt-rss.php?go=vf&id=$feed&subop=MarkAllRead\">Feed</a></div>"; */
-
- print "Select:
- <a href=\"javascript:selectHeadlines(1)\">".__("All")."</a>,
- <a href=\"javascript:selectHeadlines(2)\">".__("Unread")."</a>,
- <a href=\"javascript:selectHeadlines(3)\">".__("None")."</a>,
- <a href=\"javascript:selectHeadlines(4)\">".__("Invert")."</a>";
-
- print " ";
-
- print "<select name=\"catchup_op\">
- <option value=\"selection\">".__("Selection")."</option>
- <option value=\"page\">".__("Page")."</option>
- <option value=\"feed\">".__("Entire feed")."</option>
- </select>
- <input type=\"hidden\" name=\"cat\" value=\"$cat_view\">
- <input type=\"submit\" value=\"".__("Mark as read")."\">";
-
- print "</form>";
-
- } else {
- print "<div align='center'>No articles found.</div>";
}
- }
- function render_article($link) {
+ $result = db_query($link, "SELECT COUNT(*) AS nf FROM ttrss_feeds WHERE
+ cat_id IS NULL and owner_uid = '$owner_uid'");
- $id = db_escape_string($_GET["id"]);
- $feed_id = db_escape_string($_GET["feed"]);
- $ret_feed_id = db_escape_string($_GET["ret_feed"]);
- $cat_view = db_escape_string($_GET["cat"]);
+ $num_feeds = db_fetch_result($result, 0, "nf");
- $result = db_query($link, "SELECT rtl_content FROM ttrss_feeds
- WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]);
+ if ($num_feeds > 0) {
+ $unread = getFeedUnread($link, 0, true);
+ $title = "Uncategorized";
- if (db_num_rows($result) == 1) {
- $rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content"));
- } else {
- $rtl_content = false;
- }
-
- if ($rtl_content) {
- $rtl_tag = "dir=\"RTL\"";
- $rtl_class = "RTL";
- } else {
- $rtl_tag = "";
- $rtl_class = "";
- }
-
- $result = db_query($link, "UPDATE ttrss_user_entries
- SET unread = false,last_read = NOW()
- WHERE ref_id = '$id' AND feed_id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]);
-
- $result = db_query($link, "SELECT title,link,content,feed_id,comments,int_id,
- marked,published,
- ".SUBSTRING_FOR_DATE."(updated,1,16) as updated,
- (SELECT icon_url FROM ttrss_feeds WHERE id = feed_id) as icon_url,
- num_comments,
- author
- FROM ttrss_entries,ttrss_user_entries
- WHERE id = '$id' AND ref_id = id");
-
- if ($result) {
-
- $line = db_fetch_assoc($result);
-
- $num_comments = $line["num_comments"];
- $entry_comments = "";
-
- if ($num_comments > 0) {
- if ($line["comments"]) {
- $comments_url = $line["comments"];
- } else {
- $comments_url = $line["link"];
- }
- $entry_comments = "<a href=\"$comments_url\">$num_comments comments</a>";
+ if ($unread > 0) {
+ $title = "$title ($unread)";
+ $class = '';
} else {
- if ($line["comments"] && $line["link"] != $line["comments"]) {
- $entry_comments = "<a href=\"".$line["comments"]."\">comments</a>";
- }
+ $class = 'oldItem';
}
- $tmp_result = db_query($link, "SELECT DISTINCT tag_name FROM
- ttrss_tags WHERE post_int_id = " . $line["int_id"] . "
- ORDER BY tag_name");
-
- $tags_str = "";
- $f_tags_str = "";
+ array_push($cat_ids, 0);
- $num_tags = 0;
-
- while ($tmp_line = db_fetch_assoc($tmp_result)) {
- $num_tags++;
- $tag = $tmp_line["tag_name"];
- $tag_str = "<a href=\"?go=vf&id=$tag\">$tag</a>, ";
- $tags_str .= $tag_str;
- }
-
- $tags_str = preg_replace("/, $/", "", $tags_str);
-
- $parsed_updated = date(get_pref($link, 'SHORT_DATE_FORMAT'),
- strtotime($line["updated"]));
+ print "<li class='$class'><a href='cat.php?id=0'>$title</a></li>";
+ }
- print "<div id=\"heading\">";
+ print "</ul>";
+ }
- # if (file_exists("../icons/$feed_id.ico") && filesize("../icons/$feed_id.ico") > 0) {
- # print "<img class=\"feedIcon\" src=\"../icons/$feed_id.ico\">";
- # }
+ function render_headlines_list($link, $feed_id, $is_cat = false) {
- if (!$cat_view) {
- $feed_title = getFeedTitle($link, $ret_feed_id);
- } else {
- $feed_title = getCategoryTitle($link, $ret_feed_id);
- $feed_title_native = getFeedTitle($link, $feed_id);
- }
+ $feed_id = $feed_id;
+ $limit = 30;
+ $filter = '';
+ $is_cat = $is_cat;
+ $view_mode = 'adaptive';
- if ($feed_title_native) {
- $feed_link = "<a href=\"tt-rss.php?go=vf&id=$feed_id\">$feed_title_native</a>";
- $feed_link .= " in <a href=\"tt-rss.php?go=vf&id=$ret_feed_id&cat=$cat_view\">
- $feed_title</a>";
- } else {
- $feed_link = "<a href=\"tt-rss.php?go=vf&id=$ret_feed_id\">$feed_title</a>";
- }
+ /* do not rely on params below */
- $feedlist = "<a href=\"tt-rss.php\">".__('Back to feedlist')."</a>";
+ $search = '';
+ $search_mode = '';
+ $match_on = '';
+
+ $qfh_ret = queryFeedHeadlines($link, $feed_id, $limit,
+ $view_mode, $is_cat, $search, $search_mode, $match_on);
- print "<a href=\"" . $line["link"] . "\">" .
- truncate_string($line["title"], 30) . "</a>";
- print " <span id=\"headingAddon\">$parsed_updated ($feed_link, $feedlist)</span>";
- print "</div>";
+ $result = $qfh_ret[0];
+ $feed_title = $qfh_ret[1];
- if ($num_tags > 0) {
- print "<div class=\"postTags\">".__("Tags:")." $tags_str</div>";
- }
+ print "<ul id=\"feed-$feed_id\" title=\"$feed_title\" selected=\"true\">";
- if ($line["marked"] == "t" || $line["marked"] == "1") {
- $marked_pic = "<img class='marked' src=\"../images/mark_set.png\">";
- } else {
- $marked_pic = "<img class='marked' src=\"../images/mark_unset.png\">";
- }
+ while ($line = db_fetch_assoc($result)) {
+ $id = $line["id"];
- if ($line["published"] == "t" || $line["published"] == "1") {
- $published_pic = "<img class='marked' src=\"../images/pub_set.gif\">";
+ if (sql_bool_to_bool($line["unread"])) {
+ $class = '';
} else {
- $published_pic = "<img class='marked' src=\"../images/pub_unset.gif\">";
+ $class = 'oldItem';
}
+ print "<li class='$class'><a href='article.php?id=$id&feed=$feed_id'>";
+ print $line["title"];
+ print "</a></li>";
- print "<div class=\"postStarOps\">";
- print "<a title=\"".__('Toggle starred')."\"href=\"?go=view&id=$id&ret_feed=$ret_feed_id&feed=$feed_id&sop=ts\">$marked_pic</a>";
- print "<a title=\"".__('Toggle published')."\" href=\"?go=view&id=$id&ret_feed=$ret_feed_id&feed=$feed_id&sop=tp\">$published_pic</a>";
- // Mark unread
- print "<a title=\"".__('Mark as unread')."\" href=\"?go=vf&id=$ret_feed_id&feed=$feed_id&sop=mu&aid=$id";
- if ($cat_view) { print "&cat=$cat_view"; }
- print "\"><img class='marked' src=\"../images/art-set-unread.png\"></a>";
- print "</div>";
-
- print sanitize_rss($link, $line["content"], true);;
-
}
- print "</body></html>";
+ print "</ul>";
+
}
- function render_search_form($link, $active_feed_id = false, $is_cat = false) {
+ function render_article($link, $id, $feed_id) {
- print "<div id=\"heading\">";
+ $query = "SELECT title,link,content,feed_id,comments,int_id,
+ marked,unread,published,
+ ".SUBSTRING_FOR_DATE."(updated,1,16) as updated,
+ author
+ FROM ttrss_entries,ttrss_user_entries
+ WHERE id = '$id' AND ref_id = id AND owner_uid = " .
+ $_SESSION["uid"] ;
- print __("Search")." <span id=\"headingAddon\">
- (<a href=\"tt-rss.php\">".__("Go back")."</a>)</span></div>";
+ $result = db_query($link, $query);
- print "<form method=\"GET\" action=\"tt-rss.php\" class=\"searchForm\">";
+ $line = db_fetch_assoc($result);
- print "<input type=\"hidden\" name=\"go\" value=\"vf\">";
- print "<input type=\"hidden\" name=\"id\" value=\"$active_feed_id\">";
- print "<input type=\"hidden\" name=\"cat\" value=\"$is_cat\">";
+ if (get_pref($link, 'HEADLINES_SMART_DATE')) {
+ $updated_fmt = smart_date_time(strtotime($line["updated"]));
+ } else {
+ $short_date = get_pref($link, 'SHORT_DATE_FORMAT');
+ $updated_fmt = date($short_date, strtotime($line["updated"]));
+ }
- print "<table><tr><td>".__('Search:')."</td><td>";
- print "<input name=\"query\"></td></tr>";
+ $title = $line["title"];
+ $link = $line["link"];
- print "<tr><td>".__('Where:')."</td><td>";
-
- print "<select name=\"search_mode\">
- <option value=\"all_feeds\">".__('All feeds')."</option>";
-
- $feed_title = getFeedTitle($link, $active_feed_id);
+ print "<div class=\"panel\" id=\"article-$id\" title=\"$title\"
+ selected=\"true\">";
- if (!$is_cat) {
- $feed_cat_title = getFeedCatTitle($link, $active_feed_id);
- } else {
- $feed_cat_title = getCategoryTitle($link, $active_feed_id);
- }
-
- if ($active_feed_id && !$is_cat) {
- print "<option selected value=\"this_feed\">$feed_title</option>";
- } else {
- print "<option disabled>".__('This feed')."</option>";
- }
+// print "<h2><a target='_blank' href='$link'>$title</a></h2>";
- if ($is_cat) {
- $cat_preselected = "selected";
- }
+ print "<fieldset>";
- if (get_pref($link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 || $is_cat)) {
- print "<option $cat_preselected value=\"this_cat\">$feed_cat_title</option>";
- } else {
- //print "<option disabled>".__('This category')."</option>";
- }
+ print "<div class=\"row\">";
+ print "<label id='title'><a target='_blank' href='$link'>$title</a></label>";
+ print "</div>";
- print "</select></td></tr>";
+ $is_starred = (sql_bool_to_bool($line["marked"])) ? "true" : "false";
+ $is_published = (sql_bool_to_bool($line["published"])) ? "true" : "false";
- print "<tr><td>".__('Match on:')."</td><td>";
+ 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>";
- $search_fields = array(
- "title" => __("Title"),
- "content" => __("Content"),
- "both" => __("Title or content"));
+ 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_select_hash("match_on", 3, $search_fields);
-
- print "</td></tr></table>";
- print "<input type=\"submit\" value=\"".__('Search')."\">";
+ print "<div class=\"row\">";
+ print "<label id='updated'>Updated:</label>";
+ print "<input enabled='false' name='updated' disabled value='$updated_fmt'/>";
+ print "</div>";
- print "</form>";
+ print "</fieldset>";
- print "</div>";
- }
+ print "<p>";
+ print $line["content"];
+ print "</p>";
- function toggleMarked($link, $ts_id) {
- $result = db_query($link, "UPDATE ttrss_user_entries SET marked = NOT marked
- WHERE ref_id = '$ts_id' AND owner_uid = " . $_SESSION["uid"]);
- }
- function togglePublished($link, $tp_id) {
- $result = db_query($link, "UPDATE ttrss_user_entries SET published = NOT published
- WHERE ref_id = '$tp_id' AND owner_uid = " . $_SESSION["uid"]);
- }
+ print "</div>";
- function markUnread($link, $mu_id) {
- $result = db_query($link, "UPDATE ttrss_user_entries SET unread = true
- WHERE ref_id = '$mu_id' AND owner_uid = " . $_SESSION["uid"]);
}
-
?>
-<?php require "tt-rss.php" ?>
+<?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);
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Tiny Tiny RSS</title>
+<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
+<link rel="apple-touch-icon" href="../lib/iui/iui-logo-touch-icon.png" />
+<meta name="apple-touch-fullscreen" content="YES" />
+<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"/>
+
+</head>
+
+<style type="text/css">
+ img { max-width : 75%; }
+
+ li.oldItem {
+ color : gray;
+ }
+
+ img.tinyIcon {
+ max-width : 16px;
+ max-height : 16px;
+ margin-right : 10px;
+ vertical-align : middle;
+ }
+</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>
+ <a id="backButton" class="button" href="#"></a>
+ <a class="button" target="_self" href="logout.php">Logout</a>
+ </div>
+
+ <?php render_categories_list($link); ?>
+
+</body>
+</html>
-<html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <title>Tiny Tiny RSS : Login</title>
- <link rel="stylesheet" type="text/css" href="mobile.css">
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <script type="text/javascript" charset="utf-8" src="mobile.js"></script>
+<title>Tiny Tiny RSS</title>
+<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
+<link rel="apple-touch-icon" href="../lib/iui/iui-logo-touch-icon.png" />
+<meta name="apple-touch-fullscreen" content="YES" />
+<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"/>
</head>
-<script type="text/javascript">
-function init() {
-
- if (arguments.callee.done) return;
- arguments.callee.done = true;
- var login = document.forms["loginForm"].login;
- var click = document.forms["loginForm"].click;
-
- login.focus();
- click.disabled = false;
-
-}
-function languageChange(elem) {
- try {
- document.forms['loginForm']['click'].disabled = true;
-
- var lang = elem[elem.selectedIndex].value;
- setCookie("ttrss_lang", lang, <?php print SESSION_COOKIE_LIFETIME ?>);
- window.location.reload();
- } catch (e) {
- exception_error("languageChange", e);
- }
+<script type="text/javascript">
+function do_login() {
+ var f = document.forms['login'];
+ f.submit();
}
-
</script>
<script type="text/javascript">
<body>
- <div id="content">
- <div id="heading">Tiny Tiny RSS</div>
+ <div class="toolbar">
+ <h1 id="pageTitle"></h1>
+ <a id="backButton" class="button" href="#"></a>
+ <a class="button blueButton" onclick='do_login()'><?php echo __('Log in') ?></a>
+ </div>
- <form action="tt-rss.php" method="POST" name="loginForm">
- <input type="hidden" name="rt" value="<?php echo $_GET['rt'] ?>">
- <input type="hidden" name="login_action" value="do_login">
+ <form target="_self" title="Login" action="index.php" id="login" class="panel" method="POST" name="login" selected="true">
- <?php if ($_SESSION['login_error_msg']) { ?>
- <div class="loginError"><?php echo $_SESSION['login_error_msg'] ?></div>
- <?php $_SESSION['login_error_msg'] = ""; ?>
- <?php } ?>
+ <fieldset>
- <table>
- <tr><td align='right'><?php echo __("Login:") ?></td><td><input type="text" name="login"></td>
- <tr><td align='right'><?php echo __("Password:") ?></td><td><input type="password" name="password"></tr>
+ <input type="hidden" name="login_action" value="do_login">
- <tr><td align="right"><?php echo __("Language:") ?></td>
- <td>
- <?php
- print_select_hash("language", $_COOKIE["ttrss_lang"], get_translations(),
- "style='width : 100%' onchange='languageChange(this)'");
+ <div class="row">
+ <label><?php echo __("Login:") ?></label>
+ <input type="text" name="login">
+ </div>
- ?>
- </td></tr>
- <tr><td colspan='2'>
- <input type="submit" class="button" value="<?php echo __('Log in') ?>" name="click">
- </td></tr>
- </table>
+ <div class="row">
+ <label><?php echo __("Password:") ?></label>
+ <input type="password" name="password">
+ </div>
+
+ </fieldset>
+
</form>
- </div>
</body>
</html>
logout_user();
- header("Location: tt-rss.php");
+ header("Location: index.php");
?>
+++ /dev/null
-body {
- padding : 0px;
- margin : 0px;
- font-family : sans-serif;
-}
-
-h1 {
- font-size : medium;
-}
-
-h2 {
- font-size : medium;
- font-weight : bold;
- border-width : 0px 0px 1px 0px;
- border-style : solid;
- border-color : #88b0ff;
-}
-
-h3 {
- font-size : medium;
- font-weight : bold;
- border-width : 0px 0px 1px 0px;
- border-style : solid;
- border-color : #e0e0e0;
-}
-
-#heading {
-/* border-width : 0px 0px 1px 0px;
- border-style : solid;
- border-color : #88b0ff;
- font-weight : bold;
- font-size : small; */
-
- font-size : small;
-
- border-width : 0px 0px 1px 0px;
- border-style : solid;
- border-color : #88b0ff;
- background : #ecf4ff;
-}
-
-#content {
- background : white;
-}
-
-#footer {
-/* border-width : 1px 0px 0px 0px;
- border-style : solid;
- border-color : #88b0ff; */
- text-align : center;
- font-size : x-small;
- color : gray;
-
- border-width : 1px 0px 0px 0px;
- border-style : solid;
- border-color : #88b0ff;
-
-}
-
-form {
- padding : 0px;
- margin : 0px;
-}
-
-li.feedCatHolder {
- display : inline;
-}
-
-ul.feedList {
- list-style-type : none;
- margin : 0px;
- padding : 0px;
-
-}
-
-ul.feedList li.feedCat {
- margin : 0px;
- padding : 0px;
- color : #707070;
-}
-
-ul.feedList li.feedCat a {
- color : #707070;
-}
-
-ul.feedList li.feedCat a:hover {
- color : #4684ff;
-}
-
-ul.feedCatList {
- list-style-type : none;
- margin : 0px 0px 0px 1em;
- padding : 0px;
-}
-
-ul.feedCatList li {
- margin : 0px;
- padding : 0px;
- color : black;
-}
-
-ul.feedList li {
- margin : 0px;
-}
-
-hr {
- border-width : 0px 0px 1px 0px;
- border-style : dashed;
- border-color : #e0e0e0;
-}
-
-ul.headlines a, ul.feedList a {
- color : black;
-}
-
-a {
- color : #4684ff;
- text-decoration : none;
-}
-
-a:hover {
- color : black;
-}
-
-ul.feedList img, img.tinyFeedIcon {
- margin : 0px 3px 0px 0px;
- width : 16px;
- height : 16px;
- border-width : 0px;
-}
-
-ul.feedlist li.feedUnread,
-ul.feedlist li.errorUnread,
-ul.feedlist li.labelUnread,
-ul.feedlist li.virtUnread,
-ul.feedlist li.tagUnread {
- font-weight : bold;
-}
-
-.even {
-/* background-color : #9bbdff; */
- border-width : 0px 0px 1px 0px;
- border-color : #88b0ff;
- border-style : solid;
- background-color : #cbddff;
-}
-
-.odd {
- border-width : 0px 0px 1px 0px;
- border-color : #88b0ff;
- border-style : solid;
-}
-
-.evenUnread {
- border-width : 0px 0px 1px 0px;
- border-color : #88b0ff;
- border-style : solid;
-/* background-color : #9bbdff; */
- font-weight : bold;
- background-color : #cbddff;
-}
-
-.oddUnread {
- border-width : 0px 0px 1px 0px;
- border-color : #88b0ff;
- border-style : solid;
- font-weight : bold;
-}
-
-.evenSelected, .oddSelected, .evenUnreadSelected, .oddUnreadSelected {
- background-color : #fff7d5;
- border-width : 0px 0px 1px 0px;
- border-color : #88b0ff;
- border-style : solid;
-}
-
-.evenUnreadSelected, .oddUnreadSelected {
- font-weight : bold;
-}
-
-.invisible {
- display : none;
-}
-
-ul.headlines {
- list-style-type : none;
- margin : 0px;
- padding : 0px;
-}
-
-ul.headlines span.hlUpdated {
- color : gray;
-}
-
-ul.headlines img.feedIcon {
- width : 25px;
- text-align : center;
-}
-
-ul.headlines img.marked {
- border-width : 0px;
-}
-
-div.postStarOps img.marked {
- border-width : 0px;
-}
-
-div.postTags {
- color : gray;
- font-size : small;
-}
-
-div.footerAddon {
- font-size : small;
-}
-
-.loginError {
- color : red;
- margin : 0.5em;
-}
-
-form.searchForm {
- margin : 5px;
-}
-
-div.postStarOps {
- float : right;
-}
+++ /dev/null
-function debug(msg) {
- // no-op
-}
-
-function setCookie(name, value, lifetime, path, domain, secure) {
-
- var d = false;
-
- if (lifetime) {
- d = new Date();
- d.setTime(d.getTime() + (lifetime * 1000));
- }
-
- debug("setCookie: " + name + " => " + value + ": " + d);
-
- int_setCookie(name, value, d, path, domain, secure);
-
-}
-
-function int_setCookie(name, value, expires, path, domain, secure) {
- document.cookie= name + "=" + escape(value) +
- ((expires) ? "; expires=" + expires.toGMTString() : "") +
- ((path) ? "; path=" + path : "") +
- ((domain) ? "; domain=" + domain : "") +
- ((secure) ? "; secure" : "");
-}
-
-function exception_error(location, e, silent) {
- var msg;
-
- if (e.fileName) {
- var base_fname = e.fileName.substring(e.fileName.lastIndexOf("/") + 1);
-
- msg = "Exception: " + e.name + ", " + e.message +
- "\nFunction: " + location + "()" +
- "\nLocation: " + base_fname + ":" + e.lineNumber;
-
- } else if (e.description) {
- msg = "Exception: " + e.description + "\nFunction: " + location + "()";
- } else {
- msg = "Exception: " + e + "\nFunction: " + location + "()";
- }
-
- if (!silent) {
- alert(msg);
- }
-}
-
+++ /dev/null
-function toggleSelectRow(cb, id) {
- try {
-
- var row = document.getElementById("HROW-" + id);
- var checked = cb.checked;
- if (row) {
- var unread = row.className.match("Unread");
- var new_classname = row.className;
-
- new_classname = new_classname.replace("Selected", "");
- new_classname = new_classname.replace("Unread", "");
-
- if (unread) new_classname = new_classname + "Unread";
- if (checked) new_classname = new_classname + "Selected";
-
- row.className = new_classname;
- }
- } catch (e) {
- exception_error("toggleSelectRow", e);
- }
-}
-
-function selectHeadlines(mode) {
- try {
-
- var cboxes = document.getElementsByTagName("INPUT");
-
- for (var i = 0; i < cboxes.length; i++) {
- if (cboxes[i].id && cboxes[i].id.match("HSCB-")) {
- var row_id = cboxes[i].id.replace("HSCB-", "")
- var row = document.getElementById("HROW-" + row_id);
-
- if (row) {
-
- if (mode == 1) {
- cboxes[i].checked = true;
- toggleSelectRow(cboxes[i], row_id);
- }
-
- if (mode == 2) {
-
- var unread = row.className.match("Unread");
-
- if (unread) {
- cboxes[i].checked = true;
- } else {
- cboxes[i].checked = false;
- }
- }
-
- if (mode == 3) {
- cboxes[i].checked = false;
- }
-
- if (mode == 4) {
- cboxes[i].checked = !cboxes[i].checked;
- }
-
- toggleSelectRow(cboxes[i], row_id);
-
- }
-
- }
-
- }
-
- } catch (e) {
- exception_error("selectHeadlines", e);
- }
-}
-
-function exception_error(location, e, silent) {
- var msg;
-
- if (e.fileName) {
- var base_fname = e.fileName.substring(e.fileName.lastIndexOf("/") + 1);
-
- msg = "Exception: " + e.name + ", " + e.message +
- "\nFunction: " + location + "()" +
- "\nLocation: " + base_fname + ":" + e.lineNumber;
-
- } else if (e.description) {
- msg = "Exception: " + e.description + "\nFunction: " + location + "()";
- } else {
- msg = "Exception: " + e + "\nFunction: " + location + "()";
- }
-
- debug("<b>EXCEPTION: " + msg + "</b>");
-
- if (!silent) {
- alert(msg);
- }
-}
-
+++ /dev/null
-<?php
- error_reporting(E_ERROR | E_WARNING | E_PARSE);
-
- 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);
-
- /* perform various redirect-needing subops */
-
- $subop = db_escape_string($_GET["subop"]);
- $go = $_GET["go"];
-
- if ($subop == "tc" && !$go) {
-
- $cat_id = db_escape_string($_GET["id"]);
-
- if ($cat_id != 0) {
- db_query($link, "UPDATE ttrss_feed_categories SET
- collapsed = NOT collapsed WHERE id = '$cat_id' AND owner_uid = " .
- $_SESSION["uid"]);
- } else {
- if ($_COOKIE["ttrss_vf_uclps"] != 1) {
- setcookie("ttrss_vf_uclps", 1);
- } else {
- setcookie("ttrss_vf_uclps", 0);
- }
- }
-
- header("Location: tt-rss.php");
- return;
- }
-
- $ts_id = db_escape_string($_GET["ts"]);
-
- if ($go == "vf" && $ts_id) {
-
- toggleMarked($link, $ts_id);
-
- $query_string = preg_replace("/&ts=[0-9]*/", "", $_SERVER["QUERY_STRING"]);
- header("Location: tt-rss.php?$query_string");
- return;
- }
-
- $tp_id = db_escape_string($_GET["tp"]);
-
- if ($go == "vf" && $tp_id) {
-
- togglePublished($link, $tp_id);
-
- $query_string = preg_replace("/&tp=[0-9]*/", "", $_SERVER["QUERY_STRING"]);
- header("Location: tt-rss.php?$query_string");
- return;
- }
-
- $sop = db_escape_string($_GET["sop"]);
-
- if ($sop) {
- if ($go == "view") {
- $a_id = db_escape_string($_GET["id"]);
- } elseif ($go == "vf") {
- $a_id = db_escape_string($_GET["aid"]);
- }
-
- if ($a_id) {
-
- if ($sop == "tp") {
- togglePublished($link, $a_id);
- }
-
- if ($sop == "ts") {
- toggleMarked($link, $a_id);
- }
-
- if ($sop == "mu") {
- markUnread($link, $a_id);
- }
-
- $query_string = str_replace("&sop=$sop", "", $_SERVER["QUERY_STRING"]);
- header("Location: tt-rss.php?$query_string");
- }
- }
-
-?>
-<html>
-<head>
- <title>Tiny Tiny RSS - Mobile</title>
- <link rel="stylesheet" type="text/css" href="mobile.css">
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <script type="text/javascript" src="tt-rss.js"></script>
-
- <?php $user_css_url = get_pref($link, 'USER_STYLESHEET_URL'); ?>
- <?php if ($user_css_url) { ?>
- <link rel="stylesheet" type="text/css" href="<?php echo $user_css_url ?>"/>
- <?php } ?>
-</head>
-<body id="ttrssMobile">
-
-<div id="content">
-<?php
- if (!$go) {
- render_feeds_list($link);
- } else if ($go == "vf") {
- render_headlines($link);
- } else if ($go == "view") {
- render_article($link);
- } else if ($go == "sform") {
- render_search_form($link, $_GET["aid"], $_GET["ic"]);
- } else {
- print __("Internal error: Function not implemented");
- }
-
-?>
-</div>
-
-<?php if (!$go) { ?>
-
-<div id="footer">
- <a href="http://tt-rss.org/">Tiny-Tiny RSS</a>
- <?php if (!defined('HIDE_VERSION')) { ?>
- v<?php echo VERSION ?>
- <?php } ?>
- © 2005-2009 Andrew Dolgov
-</div>
-
-<?php } ?>
-
-</body>
-</html>