From 33d77ccf391a8136f83479cd9dbc691f6d77e5d7 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Tue, 24 Nov 2009 11:40:40 +0000 Subject: [PATCH] - Started work on Torrent Files display (Web UI) --- src/Icons/tree/I.gif | Bin 0 -> 66 bytes src/Icons/tree/L.gif | Bin 0 -> 66 bytes src/Icons/tree/Lminus.gif | Bin 0 -> 92 bytes src/Icons/tree/Lplus.gif | Bin 0 -> 96 bytes src/Icons/tree/Rminus.gif | Bin 0 -> 89 bytes src/Icons/tree/Rplus.gif | Bin 0 -> 91 bytes src/Icons/tree/T.gif | Bin 0 -> 69 bytes src/Icons/tree/Tminus.gif | Bin 0 -> 109 bytes src/Icons/tree/Tplus.gif | Bin 0 -> 97 bytes src/Icons/tree/_closed.gif | Bin 0 -> 242 bytes src/Icons/tree/_doc.gif | Bin 0 -> 193 bytes src/Icons/tree/_open.gif | Bin 0 -> 351 bytes src/Icons/tree/minus.gif | Bin 0 -> 98 bytes src/Icons/tree/plus.gif | Bin 0 -> 88 bytes src/icons.qrc | 14 +++++ src/webui.qrc | 1 + src/webui/css/mocha.css | 60 +++++++++--------- src/webui/index.html | 1 + src/webui/prop-files.html | 13 +++- src/webui/scripts/tree.js | 124 +++++++++++++++++++++++++++++++++++++ 20 files changed, 182 insertions(+), 31 deletions(-) create mode 100644 src/Icons/tree/I.gif create mode 100644 src/Icons/tree/L.gif create mode 100644 src/Icons/tree/Lminus.gif create mode 100644 src/Icons/tree/Lplus.gif create mode 100644 src/Icons/tree/Rminus.gif create mode 100644 src/Icons/tree/Rplus.gif create mode 100644 src/Icons/tree/T.gif create mode 100644 src/Icons/tree/Tminus.gif create mode 100644 src/Icons/tree/Tplus.gif create mode 100644 src/Icons/tree/_closed.gif create mode 100644 src/Icons/tree/_doc.gif create mode 100644 src/Icons/tree/_open.gif create mode 100644 src/Icons/tree/minus.gif create mode 100644 src/Icons/tree/plus.gif create mode 100644 src/webui/scripts/tree.js diff --git a/src/Icons/tree/I.gif b/src/Icons/tree/I.gif new file mode 100644 index 0000000000000000000000000000000000000000..1a259eea00c330eee85fb18aa64e2e232d5410b1 GIT binary patch literal 66 zcmZ?wbhEHb6k-r!XkcV$XlVHV|G(l-7DfgJMg|=QAOOiQFiG~vH=KUEdfpt3ORshA Txqp6J8?ND(@^elGBZD;ng_;%{ literal 0 HcmV?d00001 diff --git a/src/Icons/tree/L.gif b/src/Icons/tree/L.gif new file mode 100644 index 0000000000000000000000000000000000000000..48b81c80a9e25f6f29e2614aaa33bdf4a4d2881b GIT binary patch literal 66 zcmZ?wbhEHb6k-r!XkcV$XlVHV|G(l-7DfgJMg|=QAOOiQFiG~vH=KUEdfpt3ORshA Tx&LIzy5lkJS?4l0Mh0sDgH;v` literal 0 HcmV?d00001 diff --git a/src/Icons/tree/Lminus.gif b/src/Icons/tree/Lminus.gif new file mode 100644 index 0000000000000000000000000000000000000000..26c2b3449fffc7c01e67b8bc05697c129f75e5aa GIT binary patch literal 92 zcmZ?wbhEHb6k-r!n8?8J|NsAnh6V-(hT6R+6@RiYGB7YR=m5DuSs?}nCfzyqji=wP wo;PP<)NiI6GDnt`-ag)<#L0MQSJlbiGiAF@$kg6QE{na)&%@Pzh>5`(0DfK}d;kCd literal 0 HcmV?d00001 diff --git a/src/Icons/tree/Lplus.gif b/src/Icons/tree/Lplus.gif new file mode 100644 index 0000000000000000000000000000000000000000..775619d3272da22197b01493839ef5ac22e45901 GIT binary patch literal 96 zcmZ?wbhEHb6k-r!n8?8J|NsAnh6V-(hT6R+6@RiYGB7YR=m5DuSs?}nCc`=Qji=wP zo;PP<)NiI6GDnu>GJQ8xG{{qJ;d-~?$jQQGamQ|I7nNDp?(}Ipvgl(5P^&cn_Ff~7 literal 0 HcmV?d00001 diff --git a/src/Icons/tree/Rminus.gif b/src/Icons/tree/Rminus.gif new file mode 100644 index 0000000000000000000000000000000000000000..e62222abd17907f57e7b0dd930974eec7dd4ec33 GIT binary patch literal 89 zcmZ?wbhEHb6k-r!n8?8J|NsAnh6V-(hT6R+6@RiYGB7YR=m5DuSs?}nCapRBD^I_@ t-!#X#soQbG&pfe`d8$*En&rF_?7DxcY`su=vD4EF=f3~Duff1z4FDnVA_xEg literal 0 HcmV?d00001 diff --git a/src/Icons/tree/Rplus.gif b/src/Icons/tree/Rplus.gif new file mode 100644 index 0000000000000000000000000000000000000000..1c40a78dcf9aa5cd38afd1752ace7f3b5f2dc823 GIT binary patch literal 91 zcmZ?wbhEHb6k-r!n8?8J|NsAnh6V-(hT6R+6@RiYGB7YR=m5DuSs?}nCY?F`D^I_@ u-!#X#soQZw_=B@7Gs+vgHI}S2%Xz0*CeJ=0XU17YSI2++JY3SO4AuZZ(;lM$ literal 0 HcmV?d00001 diff --git a/src/Icons/tree/T.gif b/src/Icons/tree/T.gif new file mode 100644 index 0000000000000000000000000000000000000000..34dd47610a5d7c3580dedc342683559bf77abce2 GIT binary patch literal 69 zcmZ?wbhEHb6k-r!XkcV$XlVHV|G(l-7DfgJMg|=QAOOiQFv;}DH=KUEdfpt3ORshA Wx&LIzk};W<vKC_i literal 0 HcmV?d00001 diff --git a/src/Icons/tree/Tminus.gif b/src/Icons/tree/Tminus.gif new file mode 100644 index 0000000000000000000000000000000000000000..025840f4ffdde0f9f778d272b2622a722c5ddb37 GIT binary patch literal 109 zcmZ?wbhEHb6k-r!Sj52a|NsA{rly951_lO(+Px=%Bm^k_WMO1rU}4Y!aY1Ssn2kJk zsr)fG^?cc0rEFW)9|{4kaX)$kG8c&$>{)-~%wnlcJ-m;)>&j-IP1WEO=ogX`n#90h F4FK2!BBcNT literal 0 HcmV?d00001 diff --git a/src/Icons/tree/Tplus.gif b/src/Icons/tree/Tplus.gif new file mode 100644 index 0000000000000000000000000000000000000000..4659651e06153fbad76f3e9df29b1389d10eab72 GIT binary patch literal 97 zcmZ?wbhEHb6k-r!n8?8J|NsAnh6V-(hT6R+6@RiYGB7YR=m5DuSs?}nCZjp_ji=wP zo;PP<)NiI6GDnu>GJQ8xG{{qJ;d-~?$jQQGamQ|I7nNDp?(}KvlmBSp%*V}O4FD6P BBGv!^ literal 0 HcmV?d00001 diff --git a/src/Icons/tree/_closed.gif b/src/Icons/tree/_closed.gif new file mode 100644 index 0000000000000000000000000000000000000000..c2d3b329cb5c8ba75171b0177c0dc87eaf4229cf GIT binary patch literal 242 zcmZ?wbhEHb6k-r!I3mID|8(;I?>+xN_x!(K{r~fvrL_Y8U$^}KzV!d)?C;lG?rm~< zzAxzBCd+%dHh#h)yU3=9$s zIv`1qoeZq`3Tk~Rne$#)tPS?^3;(l4&*$!y)VI}vek~0K3LTQQ`pzxKb5^lUJDqH0 zswOwBE2C+{1C4h5hDmps_VjJJr5G_`>x`2#g;w5HZacP6X1?>k1_5TS{Iocsj?NAq amKq7)2{r{vqEn|$pQbl!_8dJ$25SI!#%$97 literal 0 HcmV?d00001 diff --git a/src/Icons/tree/_doc.gif b/src/Icons/tree/_doc.gif new file mode 100644 index 0000000000000000000000000000000000000000..155a632442c5df6830480ecaaf8ea5d707af57d8 GIT binary patch literal 193 zcmV;y06zamNk%w1VG;lm0J9GOS6GN>YngX@rFMa^jH}t?@BgXJ|HIt>)aL)~_5b$z z|5}{Z|NsB%>+96i)c^ngA^8LW000jFEC2ui01^Na000DT@X1MQT_oc?TC)$qj3hHG zo+Xy!aG)QxvOzsK7dsY+A>cBdBGLO*W+R0HQ3Otq3?=1tXCt9H`b%HlZkZ v4S=vnN<En>ge8bf|xBZP)8~%WSaTEZBhKGe=4-Sltj*K9Y77+kDcRE*Q literal 0 HcmV?d00001 diff --git a/src/Icons/tree/_open.gif b/src/Icons/tree/_open.gif new file mode 100644 index 0000000000000000000000000000000000000000..7064a303848f38a3831192e101b170c12f4fe026 GIT binary patch literal 351 zcmZ?wbhEHb6k-r!xT?zV|8vi|MT-BQxBR`D|9+R#hbNW)KhHV8NcI2!rH>B!fB(=q zw@UK=^_Jg1r#;^nbZnO7t^L{iXKGyEVgLVl)VV#;_cl5Gzh8ZFfx`da-;d9ceze)? z|KsYVMLhpsxBUM;<^T2UIh7Izrb+z&Kj+viAPE8tR0WDZSr{1@R2g(Yrh@#$z*ci$ zQh|q#RR4*@1W6Ae<|P`LPjq@c7Oly!dR5k~%$#5|&CQ+r(Td3*cHN!xu*0y)#V~DB zgNS$^n=)5avyw1xZJ3lehg@%8FP}(i4#VYl?B)yC*ViKXvr-n(-$SOWl%+aQ(z literal 0 HcmV?d00001 diff --git a/src/Icons/tree/plus.gif b/src/Icons/tree/plus.gif new file mode 100644 index 0000000000000000000000000000000000000000..3fe85900f3bd2a794c19155b9efedeb34f4af52c GIT binary patch literal 88 zcmZ?wbhEHb6k-r!n8?8J|NsAnh6V-(hT6R+6@RiYGB7YR=m5DuSs?}nCe1nhD^I_@ r-!#X#soQZw_=B@7Gs+vgHI}SA#;79Q7e9L@SF7`{bKmQN85pbq>UtlM literal 0 HcmV?d00001 diff --git a/src/icons.qrc b/src/icons.qrc index 67d239c0b..7149a3dac 100644 --- a/src/icons.qrc +++ b/src/icons.qrc @@ -114,6 +114,20 @@ Icons/flags/japan.png Icons/flags/malaysia.png Icons/flags/philippines.png + Icons/tree/Lplus.gif + Icons/tree/Tminus.gif + Icons/tree/Tplus.gif + Icons/tree/_open.gif + Icons/tree/plus.gif + Icons/tree/Rminus.gif + Icons/tree/Lminus.gif + Icons/tree/T.gif + Icons/tree/_closed.gif + Icons/tree/L.gif + Icons/tree/_doc.gif + Icons/tree/I.gif + Icons/tree/minus.gif + Icons/tree/Rplus.gif Icons/oxygen/mail-queue.png Icons/oxygen/view-refresh.png Icons/oxygen/file.png diff --git a/src/webui.qrc b/src/webui.qrc index fb1c22824..dbbd2f305 100644 --- a/src/webui.qrc +++ b/src/webui.qrc @@ -18,6 +18,7 @@ webui/scripts/excanvas-compressed.js webui/scripts/mocha.js webui/scripts/mocha-init.js + webui/scripts/tree.js webui/scripts/mootools-1.2-core-yc.js webui/scripts/mootools-1.2-more.js webui/scripts/dynamicTable.js diff --git a/src/webui/css/mocha.css b/src/webui/css/mocha.css index bc9793fbc..7a2e999ac 100644 --- a/src/webui/css/mocha.css +++ b/src/webui/css/mocha.css @@ -892,36 +892,36 @@ div.mochaToolbarWrapper.bottom { padding-bottom: 5px; } -/* Folder Tree */ - -.tree { - font-size: 11px; - line-height: 15px; - margin: 0; -} - -.tree ul { - margin: 0; -} - -.tree li { - list-style-type: none; - white-space: nowrap; -} - -.tree li a { - color: #3f3f3f; -} - -.tree li img { - vertical-align: middle; - width: 18px; - height: 18px; - overflow: hidden; -} - -.tree li span { - padding-left: 2px; +/* Folder Tree */ + +.tree { + font-size: 11px; + line-height: 15px; + margin: 0; +} + +.tree ul { + margin: 0; +} + +.tree li { + list-style-type: none; + white-space: nowrap; +} + +.tree li a { + color: #3f3f3f; +} + +.tree li img { + vertical-align: middle; + width: 18px; + height: 18px; + overflow: hidden; +} + +.tree li span { + padding-left: 2px; } /* View Toggle */ diff --git a/src/webui/index.html b/src/webui/index.html index 2b9935dec..72135b99f 100644 --- a/src/webui/index.html +++ b/src/webui/index.html @@ -16,6 +16,7 @@ +
diff --git a/src/webui/prop-files.html b/src/webui/prop-files.html index 33840068c..151353cc6 100644 --- a/src/webui/prop-files.html +++ b/src/webui/prop-files.html @@ -1 +1,12 @@ -CONTENT \ No newline at end of file + + + \ No newline at end of file diff --git a/src/webui/scripts/tree.js b/src/webui/scripts/tree.js new file mode 100644 index 000000000..8c25a9541 --- /dev/null +++ b/src/webui/scripts/tree.js @@ -0,0 +1,124 @@ +/* + +Script: Tree.js + Create folder trees. + +Copyright: + Copyright (c) 2007-2008 Greg Houston, . + +License: + MIT-style license. + +*/ + +function buildTree(treeID){ + + $$('#'+treeID+' li.folder').each(function(folder){ + var folderContents = folder.getChildren('ul'); + var folderImage = new Element('img', { + 'src': '../images/tree/_open.gif', + 'width': 18, + 'height': 18 + }).inject(folder, 'top'); + + // Determine which open and close graphic each folder gets + + if (folder.hasClass('root')) { + folder.minus = '../images/tree/Rminus.gif' + folder.plus = '../images/tree/Rplus.gif' + } + else + if (folder.getNext()) { + folder.minus = '../images/tree/Tminus.gif' + folder.plus = '../images/tree/Tplus.gif' + } + else { + folder.minus = '../images/tree/Lminus.gif' + folder.plus = '../images/tree/Lplus.gif' + } + + var image = new Element('img', { + 'src': folder.minus, + 'width': 18, + 'height': 18 + }).addEvent('click', function(){ + if (folder.hasClass('f-open')) { + image.setProperty('src', folder.plus); + folderImage.setProperty('src', '../images/tree/_closed.gif'); + folderContents.each(function(el){ + el.setStyle('display', 'none'); + }); + folder.removeClass('f-open'); + } + else { + image.setProperty('src', folder.minus); + folderImage.setProperty('src', '../images/tree/_open.gif'); + folderContents.each(function(el){ + el.setStyle('display', 'block'); + }); + folder.addClass('f-open'); + } + }).inject(folder, 'top'); + + if (!folder.hasClass('f-open')) { + image.setProperty('src', folder.plus); + folderContents.each(function(el){ + el.setStyle('display', 'none'); + }); + folder.removeClass('f-open'); + } + + // Add connecting branches to each file node + + folderContents.each(function(element){ + var docs = element.getChildren('li.doc'); + docs.each(function(el){ + if (el == docs.getLast() && !el.getNext()) { + new Element('img', { + 'src': '../images/tree/L.gif', + 'width': 18, + 'height': 18 + }).inject(el.getElement('span'), 'before'); + } + else { + new Element('img', { + 'src': '../images/tree/T.gif', + 'width': 18, + 'height': 18 + }).inject(el.getElement('span'), 'before'); + } + }); + }); + + }); + + // Add connecting branches to each node + + $$('#'+treeID+' li').each(function(node){ + node.getParents('li').each(function(parent){ + if (parent.getNext()) { + new Element('img', { + 'src': '../images/tree/I.gif', + 'width': 18, + 'height': 18 + }).inject(node, 'top'); + } + else { + new Element('img', { + 'src': 'images/spacer.gif', + 'width': 18, + 'height': 18 + }).inject(node, 'top'); + } + }); + }); + + $$('#'+treeID+' li.doc').each(function(el){ + new Element('img', { + 'src': '../images/tree/_doc.gif', + 'width': 18, + 'height': 18 + }).inject(el.getElement('span'), 'before'); + }); + +}