From 6c86abcc14b7f59dd99f906b1ba197102266dfb8 Mon Sep 17 00:00:00 2001 From: SJ Date: Tue, 20 Aug 2013 14:47:55 +0200 Subject: [PATCH] mobile theme fixes and enhancements --- .../javascript/jquery.resizableColumns.min.js | 1 + webui/view/javascript/piler-in.js | 4 + webui/view/javascript/store.js | 153 ++++++++++++++++++ .../theme/default/templates/search/popup.tpl | 2 +- .../theme/mobile/stylesheet/style-mobile.css | 20 ++- .../mobile/templates/common/layout-search.tpl | 5 +- .../theme/mobile/templates/search/helper.tpl | 75 +++++---- .../theme/mobile/templates/search/popup.tpl | 2 +- .../theme/mobile/templates/user/settings.tpl | 8 +- 9 files changed, 221 insertions(+), 49 deletions(-) create mode 100644 webui/view/javascript/jquery.resizableColumns.min.js create mode 100644 webui/view/javascript/store.js diff --git a/webui/view/javascript/jquery.resizableColumns.min.js b/webui/view/javascript/jquery.resizableColumns.min.js new file mode 100644 index 00000000..e0bb8a7f --- /dev/null +++ b/webui/view/javascript/jquery.resizableColumns.min.js @@ -0,0 +1 @@ +var __bind=function(a,b){return function(){return a.apply(b,arguments)}},__slice=[].slice;!function(a,b){var c,d,e;return d=function(a){return parseFloat(a.style.width.replace("%",""))},e=function(a,b){return b=b.toFixed(2),a.style.width=""+b+"%"},c=function(){function c(c,d){this.mousedown=__bind(this.mousedown,this);var e=this;this.options=a.extend({},this.defaults,d),this.$table=c,this.setHeaders(),this.restoreColumnWidths(),this.syncHandleWidths(),a(b).on("resize.rc",function(){return e.syncHandleWidths()})}return c.prototype.defaults={store:b.store,rigidSizing:!1,resizeFromBody:!0},c.prototype.getColumnId=function(a){return this.$table.data("resizable-columns-id")+"-"+a.data("resizable-column-id")},c.prototype.setHeaders=function(){return this.$tableHeaders=this.$table.find("tr th:visible"),this.assignPercentageWidths(),this.createHandles()},c.prototype.destroy=function(){return this.$handleContainer.remove(),this.$table.removeData("resizableColumns"),a(b).off(".rc")},c.prototype.assignPercentageWidths=function(){var b=this;return this.$tableHeaders.each(function(c,d){var f;return f=a(d),e(f[0],100*(f.outerWidth()/b.$table.width()))})},c.prototype.createHandles=function(){var b=this;return a(".rc-handle-container").remove(),this.$table.before(this.$handleContainer=a("
")),this.$tableHeaders.each(function(c,d){var e;if(0!==b.$tableHeaders.eq(c+1).length&&null==b.$tableHeaders.eq(c).attr("data-noresize")&&null==b.$tableHeaders.eq(c+1).attr("data-noresize"))return e=a("
"),e.data("th",a(d)),e.appendTo(b.$handleContainer)}),this.$handleContainer.on("mousedown",".rc-handle",this.mousedown)},c.prototype.syncHandleWidths=function(){var b=this;return this.setHeaders(),this.$handleContainer.width(this.$table.width()).find(".rc-handle").each(function(c,d){var e;return e=a(d),e.css({left:e.data("th").outerWidth()+(e.data("th").offset().left-b.$handleContainer.offset().left),height:b.options.resizeFromBody?b.$table.height():b.$table.find("thead").height()})})},c.prototype.saveColumnWidths=function(){var b=this;return this.$tableHeaders.each(function(c,e){var f;return f=a(e),null==f.attr("data-noresize")&&null!=b.options.store?store.set(b.getColumnId(f),d(f[0])):void 0})},c.prototype.restoreColumnWidths=function(){var b=this;return this.$tableHeaders.each(function(c,d){var f,g;return f=a(d),null!=b.options.store&&(g=store.get(b.getColumnId(f)))?e(f[0],g):void 0})},c.prototype.totalColumnWidths=function(){var b;return b=0,this.$tableHeaders.each(function(c,d){return b+=parseFloat(a(d)[0].style.width.replace("%",""))}),b},c.prototype.mousedown=function(b){var c,f,g,h,i,j=this;return b.preventDefault(),h=b.pageX,c=a(b.currentTarget),f=c.data("th"),g=this.$tableHeaders.eq(this.$tableHeaders.index(f)+1),i={left:d(f[0]),right:d(g[0])},this.$table.addClass("rc-table-resizing"),a(document).on("mousemove.rc",function(a){var b;return b=100*((a.pageX-h)/j.$table.width()),e(g[0],i.right-b),e(f[0],i.left+b)}),a(document).one("mouseup",function(){return a(document).off("mousemove.rc"),j.$table.removeClass("rc-table-resizing"),j.syncHandleWidths(),j.saveColumnWidths()})},c}(),a.fn.extend({resizableColumns:function(){var b,d;return d=arguments[0],b=2<=arguments.length?__slice.call(arguments,1):[],this.each(function(){var e,f;return e=a(this),f=e.data("resizableColumns"),f||e.data("resizableColumns",f=new c(e,d)),"string"==typeof d?f[d].apply(f,b):void 0})}})}(window.jQuery,window); \ No newline at end of file diff --git a/webui/view/javascript/piler-in.js b/webui/view/javascript/piler-in.js index c03dbfc9..ee0dc756 100644 --- a/webui/view/javascript/piler-in.js +++ b/webui/view/javascript/piler-in.js @@ -148,6 +148,10 @@ var Piler = Piler.fill_current_messages_array(); Piler.spinner('stop'); $('#resultsheader').show(); + + /*$("table").resizableColumns({ + store: store + });*/ }) .fail(function( a, b )// jqXHR, textStatus, errorThrown { diff --git a/webui/view/javascript/store.js b/webui/view/javascript/store.js new file mode 100644 index 00000000..c6f3b4b6 --- /dev/null +++ b/webui/view/javascript/store.js @@ -0,0 +1,153 @@ +;(function(){ + var store = {}, + win = window, + doc = win.document, + localStorageName = 'localStorage', + namespace = '__storejs__', + storage + + store.disabled = false + store.set = function(key, value) {} + store.get = function(key) {} + store.remove = function(key) {} + store.clear = function() {} + store.transact = function(key, defaultVal, transactionFn) { + var val = store.get(key) + if (transactionFn == null) { + transactionFn = defaultVal + defaultVal = null + } + if (typeof val == 'undefined') { val = defaultVal || {} } + transactionFn(val) + store.set(key, val) + } + store.getAll = function() {} + + store.serialize = function(value) { + return JSON.stringify(value) + } + store.deserialize = function(value) { + if (typeof value != 'string') { return undefined } + try { return JSON.parse(value) } + catch(e) { return value || undefined } + } + + // Functions to encapsulate questionable FireFox 3.6.13 behavior + // when about.config::dom.storage.enabled === false + // See https://github.com/marcuswestin/store.js/issues#issue/13 + function isLocalStorageNameSupported() { + try { return (localStorageName in win && win[localStorageName]) } + catch(err) { return false } + } + + if (isLocalStorageNameSupported()) { + storage = win[localStorageName] + store.set = function(key, val) { + if (val === undefined) { return store.remove(key) } + storage.setItem(key, store.serialize(val)) + return val + } + store.get = function(key) { return store.deserialize(storage.getItem(key)) } + store.remove = function(key) { storage.removeItem(key) } + store.clear = function() { storage.clear() } + store.getAll = function() { + var ret = {} + for (var i=0; idocument.w=window') + storageContainer.close() + storageOwner = storageContainer.w.frames[0].document + storage = storageOwner.createElement('div') + } catch(e) { + // somehow ActiveXObject instantiation failed (perhaps some special + // security settings or otherwse), fall back to per-path storage + storage = doc.createElement('div') + storageOwner = doc.body + } + function withIEStorage(storeFunction) { + return function() { + var args = Array.prototype.slice.call(arguments, 0) + args.unshift(storage) + // See http://msdn.microsoft.com/en-us/library/ms531081(v=VS.85).aspx + // and http://msdn.microsoft.com/en-us/library/ms531424(v=VS.85).aspx + storageOwner.appendChild(storage) + storage.addBehavior('#default#userData') + storage.load(localStorageName) + var result = storeFunction.apply(store, args) + storageOwner.removeChild(storage) + return result + } + } + + // In IE7, keys may not contain special chars. See all of https://github.com/marcuswestin/store.js/issues/40 + var forbiddenCharsRegex = new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]", "g") + function ieKeyFix(key) { + return key.replace(forbiddenCharsRegex, '___') + } + store.set = withIEStorage(function(storage, key, val) { + key = ieKeyFix(key) + if (val === undefined) { return store.remove(key) } + storage.setAttribute(key, store.serialize(val)) + storage.save(localStorageName) + return val + }) + store.get = withIEStorage(function(storage, key) { + key = ieKeyFix(key) + return store.deserialize(storage.getAttribute(key)) + }) + store.remove = withIEStorage(function(storage, key) { + key = ieKeyFix(key) + storage.removeAttribute(key) + storage.save(localStorageName) + }) + store.clear = withIEStorage(function(storage) { + var attributes = storage.XMLDocument.documentElement.attributes + storage.load(localStorageName) + for (var i=0, attr; attr=attributes[i]; i++) { + storage.removeAttribute(attr.name) + } + storage.save(localStorageName) + }) + store.getAll = withIEStorage(function(storage) { + var attributes = storage.XMLDocument.documentElement.attributes + var ret = {} + for (var i=0, attr; attr=attributes[i]; ++i) { + var key = ieKeyFix(attr.name) + ret[attr.name] = store.deserialize(storage.getAttribute(key)) + } + return ret + }) + } + + try { + store.set(namespace, namespace) + if (store.get(namespace) != namespace) { store.disabled = true } + store.remove(namespace) + } catch(e) { + store.disabled = true + } + store.enabled = !store.disabled + if (typeof module != 'undefined' && module.exports) { module.exports = store } + else if (typeof define === 'function' && define.amd) { define(store) } + else { this.store = store } +})(); diff --git a/webui/view/theme/default/templates/search/popup.tpl b/webui/view/theme/default/templates/search/popup.tpl index 1bb14ea9..26f5fc5a 100644 --- a/webui/view/theme/default/templates/search/popup.tpl +++ b/webui/view/theme/default/templates/search/popup.tpl @@ -57,7 +57,7 @@
Word checked="checked" onclick="Piler.clear_attachment_any();" /> Excel checked="checked" onclick="Piler.clear_attachment_any();" /> - PDF checked="checked" onclick="Piler.clear_attachment_any();" /> + PDF checked="checked" onclick="Piler.clear_attachment_any();" /> image checked="checked" onclick="Piler.clear_attachment_any();" /> any checked="checked" onclick="Piler.clear_attachment_others();" />
diff --git a/webui/view/theme/mobile/stylesheet/style-mobile.css b/webui/view/theme/mobile/stylesheet/style-mobile.css index 833017d5..4b2bf8e7 100644 --- a/webui/view/theme/mobile/stylesheet/style-mobile.css +++ b/webui/view/theme/mobile/stylesheet/style-mobile.css @@ -31,9 +31,6 @@ #main { margin: 0px 40px 20px 40px; width: 100%; text-align: left; float: left; clear: both; } - .sleek { margin:0; padding:0; } - .center { text-align: center; } - #expertsearch { position: absolute; border: 0px solid black; right: 20px; left: 20px; text-align: left; font-family: normal 19px "Trebuchet MS", Arial, Verdana; margin-top: 18px; } #resultsheader { display: none; } @@ -61,15 +58,17 @@ #results { float: left; width: 100%; margin-top: 0px; margin-bottom: 0px; border-collapse: collapse; display: table; clear: both; } - #mailpreviewframe { text-align: left; overflow:auto; } + #results th { font-size:14px; } - .download_icon { margin: 0px 0 -15px 0; border: 0px solid black; } + #mailpreviewframe { text-align: left; overflow:auto; } #sspinner { position: relative; width: 60%; border: 0px solid #999999; color: #000000; font-weight: bold; vertical-align: middle; text-align: left; padding: 15px; z-index: 1; display: none; margin: auto; margin-top: 150px; } + table { resize:both; } + .row { display: table-row; } .row.savedsearch { display: table-row; text-align: right; } - .resultrow { display: table-row; height: 18px; font-style: italic; font-size:14px; font-family: "Trebuchet MS", Arial, Verdana; } + .resultrow { display: table-row; height: 18px; font-style: italic; font-size:12px; font-family: "Trebuchet MS", Arial, Verdana; } .resultrow a { color: #3d3d3d; } .resultrow.odd { background: #f5f5f5; } .resultrow.new { font-style: normal; } @@ -141,6 +140,8 @@ .bold { font-weight: bold; } .left { text-align: left; } + .center { text-align: center; } + .sleek { margin:0; padding:0; } .messagecontents {background-color:#fff; padding:8px; font-size:14px; font-family: "Trebuchet MS", Arial, Verdana; } @@ -158,7 +159,7 @@ #mailcontframe { position: absolute; width: 100%; top: 0; bottom: 0; border: 1px solid #999999; background-color: #F9F9F9; overflow: hidden; } #mailpreviewframe { position: absolute; width: 100%; top: 205px; bottom: 0px; border: 1px solid #999999; background-color: #F9F9F9; } - .boxlistcontent { position: absolute; top: 5px; bottom: 50px; left: 0; right: 0; width: 100%; overflow-y: auto; overflow-x: hidden; height: auto; } + .boxlistcontent { position: absolute; top: 0px; bottom: 50px; left: 0; right: 0; width: 100%; overflow-y: auto; overflow-x: hidden; height: auto; } .boxfooter { position: absolute; bottom: 0px; left: 0px; right: 0px; overflow: hidden; border-top: 1px solid #999; } .splitter { user-select: none; -moz-user-select: none; -khtml-user-select: none; position: absolute; background: url(/view/theme/mobile/images/dimple.png) center no-repeat; } @@ -167,6 +168,11 @@ .message_highlight { background: lightblue; } + .rc-handle-container { position: relative; } + .rc-handle { position: absolute; width: 7px; cursor: ew-resize; margin-left: -3px; z-index: 2; } + table.rc-table-resizing { cursor: ew-resize; } + table.rc-table-resizing thead, table.rc-table-resizing thead > th, table.rc-table-resizing thead > th > a { cursor: ew-resize; } + } diff --git a/webui/view/theme/mobile/templates/common/layout-search.tpl b/webui/view/theme/mobile/templates/common/layout-search.tpl index 02f81bcb..53f74601 100644 --- a/webui/view/theme/mobile/templates/common/layout-search.tpl +++ b/webui/view/theme/mobile/templates/common/layout-search.tpl @@ -23,6 +23,10 @@ + + + + @@ -127,6 +131,5 @@ $(document).ready(function(){ - diff --git a/webui/view/theme/mobile/templates/search/helper.tpl b/webui/view/theme/mobile/templates/search/helper.tpl index 1185733b..621adb5c 100644 --- a/webui/view/theme/mobile/templates/search/helper.tpl +++ b/webui/view/theme/mobile/templates/search/helper.tpl @@ -4,44 +4,48 @@
0) { ?> - + +
+ - - + + + - + @@ -51,18 +55,17 @@ - - + + - - + - - - + + + - + @@ -109,3 +112,5 @@ + + diff --git a/webui/view/theme/mobile/templates/search/popup.tpl b/webui/view/theme/mobile/templates/search/popup.tpl index 49e2311b..064811ad 100644 --- a/webui/view/theme/mobile/templates/search/popup.tpl +++ b/webui/view/theme/mobile/templates/search/popup.tpl @@ -50,7 +50,7 @@
Word checked="checked" onclick="Piler.clear_attachment_any();" /> Excel checked="checked" onclick="Piler.clear_attachment_any();" /> - PDF checked="checked" onclick="Piler.clear_attachment_any();" /> + PDF checked="checked" onclick="Piler.clear_attachment_any();" /> image checked="checked" onclick="Piler.clear_attachment_any();" /> any checked="checked" onclick="Piler.clear_attachment_others();" />
diff --git a/webui/view/theme/mobile/templates/user/settings.tpl b/webui/view/theme/mobile/templates/user/settings.tpl index 9e72568b..82223d1a 100644 --- a/webui/view/theme/mobile/templates/user/settings.tpl +++ b/webui/view/theme/mobile/templates/user/settings.tpl @@ -9,7 +9,7 @@
:
-
+
@@ -18,7 +18,7 @@
:
-
+
@@ -29,7 +29,7 @@
:
-
+
@@ -40,7 +40,7 @@
:
-
+
checked="checked" onclick="Piler.toggle_bulk_check('');" /> + + checked="checked" onclick="Piler.toggle_bulk_check('');" /> + - +   - - + + - - - - + + + + - - - - + + + + - - + + - - - - + + + + - - - - - - + + + +  
checked="checked" />.. class="spam" title="" onclick="Piler.view_message_by_pos();"> [+]class="spam" title="" onclick="Piler.view_message_by_pos();"> [+] 0) { ?> 0) { ?>