From 2f30ae7ba53a8936181ba70d8cf99b9e9d3d1abd Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 26 Nov 2009 03:18:05 +0000 Subject: [PATCH] MINOR Moved jsparty/tabstrip to sapphire/thirdparty/tabstrip git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@93560 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- thirdparty/tabstrip/images/add.png | Bin 0 -> 173 bytes thirdparty/tabstrip/images/images/add.png | Bin 0 -> 173 bytes .../tabstrip/images/images/norm_a_bg.gif | Bin 0 -> 831 bytes .../tabstrip/images/images/norm_li_bg.gif | Bin 0 -> 227 bytes .../tabstrip/images/images/sel_a_bg.gif | Bin 0 -> 469 bytes .../tabstrip/images/images/sel_li_bg.gif | Bin 0 -> 184 bytes thirdparty/tabstrip/images/images/tab_bg.gif | Bin 0 -> 43 bytes thirdparty/tabstrip/images/norm_a_bg.gif | Bin 0 -> 831 bytes thirdparty/tabstrip/images/norm_li_bg.gif | Bin 0 -> 227 bytes thirdparty/tabstrip/images/sapphire.tabs.css | 104 ++++++ thirdparty/tabstrip/images/sel_a_bg.gif | Bin 0 -> 469 bytes thirdparty/tabstrip/images/sel_li_bg.gif | Bin 0 -> 184 bytes thirdparty/tabstrip/images/tab_bg.gif | Bin 0 -> 43 bytes thirdparty/tabstrip/tabstrip.css | 70 ++++ thirdparty/tabstrip/tabstrip.js | 304 ++++++++++++++++++ 15 files changed, 478 insertions(+) create mode 100644 thirdparty/tabstrip/images/add.png create mode 100644 thirdparty/tabstrip/images/images/add.png create mode 100644 thirdparty/tabstrip/images/images/norm_a_bg.gif create mode 100644 thirdparty/tabstrip/images/images/norm_li_bg.gif create mode 100644 thirdparty/tabstrip/images/images/sel_a_bg.gif create mode 100644 thirdparty/tabstrip/images/images/sel_li_bg.gif create mode 100644 thirdparty/tabstrip/images/images/tab_bg.gif create mode 100644 thirdparty/tabstrip/images/norm_a_bg.gif create mode 100644 thirdparty/tabstrip/images/norm_li_bg.gif create mode 100644 thirdparty/tabstrip/images/sapphire.tabs.css create mode 100644 thirdparty/tabstrip/images/sel_a_bg.gif create mode 100644 thirdparty/tabstrip/images/sel_li_bg.gif create mode 100644 thirdparty/tabstrip/images/tab_bg.gif create mode 100644 thirdparty/tabstrip/tabstrip.css create mode 100644 thirdparty/tabstrip/tabstrip.js diff --git a/thirdparty/tabstrip/images/add.png b/thirdparty/tabstrip/images/add.png new file mode 100644 index 0000000000000000000000000000000000000000..f6a3516aaf791f4172593a934d91840b469e9d5d GIT binary patch literal 173 zcmeAS@N?(olHy`uVBq!ia0vp^{6H+p!3-pCwzvEPQY`6?zK#qG>ra@ocD)2imbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-$(3-AeXZD?q?d-v|Tvl7pMB1|Pg ze!>44o^Chr0`lZNT^vIyZY3qSu<|e;PESynf1ZK;#?L9U{I7pt;4om|ZegTe~DWM4fEon6; literal 0 HcmV?d00001 diff --git a/thirdparty/tabstrip/images/images/add.png b/thirdparty/tabstrip/images/images/add.png new file mode 100644 index 0000000000000000000000000000000000000000..f6a3516aaf791f4172593a934d91840b469e9d5d GIT binary patch literal 173 zcmeAS@N?(olHy`uVBq!ia0vp^{6H+p!3-pCwzvEPQY`6?zK#qG>ra@ocD)2imbgZg z1m~xflqVLYGB~E>C#5QQ<|d}62BjvZR2H60wE-$(3-AeXZD?q?d-v|Tvl7pMB1|Pg ze!>44o^Chr0`lZNT^vIyZY3qSu<|e;PESynf1ZK;#?L9U{I7pt;4om|ZegTe~DWM4fEon6; literal 0 HcmV?d00001 diff --git a/thirdparty/tabstrip/images/images/norm_a_bg.gif b/thirdparty/tabstrip/images/images/norm_a_bg.gif new file mode 100644 index 0000000000000000000000000000000000000000..88a2193b8f6cc7cb8d6d1b204f187c43ca9639a3 GIT binary patch literal 831 zcmV-F1Hk-8Nk%w1VaNbv0J9GO@bK&N^Y8Zd^6~NQ{{H@vr?mY1`}+F%`1tnbV!ZA^8LW000jFEC2ui0LTDj000F4u*gZPy*TU5yZ>M)ju`V0 zXsWJk>%MR-&vb3yc-{^UqyNC5a7Zk|77c@P$!t2G(5Q4uty-_xtab|x6b|69cuX#v z&*-#z&2GEj@OU|(C?M|mynfH``~QG}f`f#GhKGoI0s#vJ0*{c9l9QB`mY0~Bnwy-R zo}ZwU0F9xgrl+W>s;ia&2?YU*vaz(Ywzasoy1Bfwy}!G`z{A4D#K*?T!*ry`&dSix z&(qS?)YsOF3ag(+7?&1sF@ALHa_V@Vt;se_S1OEa34G0KO zAi;qK6Bb;Ekm13H0vk$%7?I*cg%=%Sw8(LzM~xu=Gm7juAfCU7C{wCj$+D%(moQ_> zoJq5$O_!ry0T{5eC(oZgg905Yv?$S|J&h_w%5FW*mj(LyI0QRzYXds8g$6ZPs*x$*g0`o*mjXY}&YU>u&wp z^X}ikgP#sgy!hQ$<$a>Z(^4{i$UmZr{npRBgV_Uf#= J!rEB`06PhR#Qp#P literal 0 HcmV?d00001 diff --git a/thirdparty/tabstrip/images/images/norm_li_bg.gif b/thirdparty/tabstrip/images/images/norm_li_bg.gif new file mode 100644 index 0000000000000000000000000000000000000000..8fbe080e5539fe4a23f419f52d23c77a5aa14638 GIT binary patch literal 227 zcmV<90382ENk%w1VF>_a0J9AM@bK%Ar?mF=^7HfW@$v2c{{Hy*_WJty{QUdos6}_aJOH8H$489 zx#wZjO74kb#YCl#_#)h?M)j@N-O zLaMH8>%MR-&vb3yc&@uiVFbXSa7Zi~kI1BQ$!t2G(5P{t09dcstai)odcWYXcuX#v z&s_p~&2GEj@c36PuiNkV{Ftuq`~QGte1U|8hI)gCii?bbjgOF#S&5RBmVlI(nwxT& zoS&d(o}r|rT%)F`rl_i|pRBI2maww5kF>VAhq$`En7+Wb!NZEY#K&*O$jfNT%+Gt! z(w)=QZqC-(R@mCs+}+dP;LzgZ%;o0D=;_4k?7{BuzVY(9^!2v)__F%@uKoU00Svf` z;JASXLm^D~ilMfJ4mClHIE!Mni54Sa%qWcGvyC2t7l919i{!GACJCWT`HSVSl`i|h zjG1R9%{w-4*2$?e4$q#+fadxslnv3M&5-g_8tW)iGESe0i7FKg)v8{uVm-CBl-913 zz$z3A>ML0QX33@%yB2KQu5Y)-#X7fYU8#4U=4HB9X*6AJ*v~3CRRR6Rqopau;ipU7twKQvg%m#BGx!LQJN+N5&mEJ5UkJ`6v bdv92^%>Qe@e-<~CHkJEUx7BwDGFSruWJ*o} literal 0 HcmV?d00001 diff --git a/thirdparty/tabstrip/images/images/tab_bg.gif b/thirdparty/tabstrip/images/images/tab_bg.gif new file mode 100644 index 0000000000000000000000000000000000000000..ea4e0f974065dcd293ff02d07efa22598d6ada55 GIT binary patch literal 43 scmZ?wbhEHbWMp7uXkcJiwQ3au1B2pE79h#MpaUX6G7L;iE{qJ;0IRYE`2YX_ literal 0 HcmV?d00001 diff --git a/thirdparty/tabstrip/images/norm_a_bg.gif b/thirdparty/tabstrip/images/norm_a_bg.gif new file mode 100644 index 0000000000000000000000000000000000000000..88a2193b8f6cc7cb8d6d1b204f187c43ca9639a3 GIT binary patch literal 831 zcmV-F1Hk-8Nk%w1VaNbv0J9GO@bK&N^Y8Zd^6~NQ{{H@vr?mY1`}+F%`1tnbV!ZA^8LW000jFEC2ui0LTDj000F4u*gZPy*TU5yZ>M)ju`V0 zXsWJk>%MR-&vb3yc-{^UqyNC5a7Zk|77c@P$!t2G(5Q4uty-_xtab|x6b|69cuX#v z&*-#z&2GEj@OU|(C?M|mynfH``~QG}f`f#GhKGoI0s#vJ0*{c9l9QB`mY0~Bnwy-R zo}ZwU0F9xgrl+W>s;ia&2?YU*vaz(Ywzasoy1Bfwy}!G`z{A4D#K*?T!*ry`&dSix z&(qS?)YsOF3ag(+7?&1sF@ALHa_V@Vt;se_S1OEa34G0KO zAi;qK6Bb;Ekm13H0vk$%7?I*cg%=%Sw8(LzM~xu=Gm7juAfCU7C{wCj$+D%(moQ_> zoJq5$O_!ry0T{5eC(oZgg905Yv?$S|J&h_w%5FW*mj(LyI0QRzYXds8g$6ZPs*x$*g0`o*mjXY}&YU>u&wp z^X}ikgP#sgy!hQ$<$a>Z(^4{i$UmZr{npRBgV_Uf#= J!rEB`06PhR#Qp#P literal 0 HcmV?d00001 diff --git a/thirdparty/tabstrip/images/norm_li_bg.gif b/thirdparty/tabstrip/images/norm_li_bg.gif new file mode 100644 index 0000000000000000000000000000000000000000..8fbe080e5539fe4a23f419f52d23c77a5aa14638 GIT binary patch literal 227 zcmV<90382ENk%w1VF>_a0J9AM@bK%Ar?mF=^7HfW@$v2c{{Hy*_WJty{QUdos6}_aJOH8H$489 zx#wZjO74kb#YCl#_#)h?M)j@N-O zLaMH8>%MR-&vb3yc&@uiVFbXSa7Zi~kI1BQ$!t2G(5P{t09dcstai)odcWYXcuX#v z&s_p~&2GEj@c36PuiNkV{Ftuq`~QGte1U|8hI)gCii?bbjgOF#S&5RBmVlI(nwxT& zoS&d(o}r|rT%)F`rl_i|pRBI2maww5kF>VAhq$`En7+Wb!NZEY#K&*O$jfNT%+Gt! z(w)=QZqC-(R@mCs+}+dP;LzgZ%;o0D=;_4k?7{BuzVY(9^!2v)__F%@uKoU00Svf` z;JASXLm^D~ilMfJ4mClHIE!Mni54Sa%qWcGvyC2t7l919i{!GACJCWT`HSVSl`i|h zjG1R9%{w-4*2$?e4$q#+fadxslnv3M&5-g_8tW)iGESe0i7FKg)v8{uVm-CBl-913 zz$z3A>ML0QX33@%yB2KQu5Y)-#X7fYU8#4U=4HB9X*6AJ*v~3CRRR6Rqopau;ipU7twKQvg%m#BGx!LQJN+N5&mEJ5UkJ`6v bdv92^%>Qe@e-<~CHkJEUx7BwDGFSruWJ*o} literal 0 HcmV?d00001 diff --git a/thirdparty/tabstrip/images/tab_bg.gif b/thirdparty/tabstrip/images/tab_bg.gif new file mode 100644 index 0000000000000000000000000000000000000000..ea4e0f974065dcd293ff02d07efa22598d6ada55 GIT binary patch literal 43 scmZ?wbhEHbWMp7uXkcJiwQ3au1B2pE79h#MpaUX6G7L;iE{qJ;0IRYE`2YX_ literal 0 HcmV?d00001 diff --git a/thirdparty/tabstrip/tabstrip.css b/thirdparty/tabstrip/tabstrip.css new file mode 100644 index 000000000..31cdf4027 --- /dev/null +++ b/thirdparty/tabstrip/tabstrip.css @@ -0,0 +1,70 @@ +/* + * tabstrip-default.css + * Default styling for tabstrips + * Designed to look like windows-xp tabs + * + * Modified by Sean Harvey, SilverStripe Ltd 02/11/2007 + */ + +ul.tabstrip { + border-bottom: 1px #AAA solid; + padding: 0; + margin: 0 !important; + clear: left; + float: left; + width: 100%; + /* Need this to stop tabs from disappearing sometimes */ + position: relative; +} + ul.tabstrip li { + float: left; + list-style: none; + background: url(images/norm_li_bg.gif) no-repeat left 3px; + margin: 0 2px 0 0; + padding: 0 0 0 9px; + cursor: pointer; + position: relative; + top: 1px; + } + ul.tabstrip li a { + background: url(images/norm_a_bg.gif) no-repeat right 3px; + display: block; + float: left; + outline: none; + padding: 7px 9px 3px 0; + text-decoration: none; + color: #555; + font-size: 11px; + font-weight: bold; + } + ul.tabstrip li a:hover { + text-decoration: none; + color: #000; + } + ul.tabstrip li.current, + ul.tabstrip li.ui-tabs-selected, + ul.tabstrip li.sel, + ul.tabstrip li.over { + background: url(images/sel_li_bg.gif) no-repeat left top; + top: 1px; + } + ul.tabstrip li.current a, + ul.tabstrip li.ui-tabs-selected a, + ul.tabstrip li.sel a, + ul.tabstrip li.over a { + background: url(images/sel_a_bg.gif) no-repeat right top; + padding: 6px 9px 5px 0; + color: #0074c6; + } + +.tab { + clear: left; + overflow: auto; + border: 1px solid #aaa; + border-top: none; + position: relative; + top: 0; + margin: 0; + padding: 10px; + background-color: #FFFFFF; +} diff --git a/thirdparty/tabstrip/tabstrip.js b/thirdparty/tabstrip/tabstrip.js new file mode 100644 index 000000000..48446aa2b --- /dev/null +++ b/thirdparty/tabstrip/tabstrip.js @@ -0,0 +1,304 @@ +// jQuery loader +jQuery('ul.tabstrip').livequery(function() { + initTabstrip(this); + if(window.ontabschanged) window.ontabschanged(); +}); + +var _CUR_TABS = []; +var _TABS_ON_PAGE = []; +var _TAB_DIVS_ON_PAGE = []; + +function initTabstrip(tabstrip, namedAnchors) { + + var i, anchor, container, anchorName, li; + var childAnchors = tabstrip.getElementsByTagName('a'); + var base, curTab = null, curURL = window.location.href; + var previousTab = null; + var firstTab, foundATab = false; + + // Strip query string from current URL + var curQuery = window.location.search; + + // Detect a current tab from the # link + if(curURL.indexOf('#') == -1) { + base = curURL.length - curQuery.length; + } else { + base = curURL.indexOf('#') - curQuery.length; + curTab = curURL.substr(curURL.indexOf('#')+1); + } + + // Get a stored current tab, used when Ajax-switching between pages + if(_CUR_TABS[tabstrip.parentNode.id] && $(_CUR_TABS[tabstrip.parentNode.id]) ) { + curTab = _CUR_TABS[tabstrip.parentNode.id]; + + } else { + // Default to showing the first tab + for(i=0;i 1 ) + anchorName = tabNames.shift() + 'set'; + while( anchorName ) { + if( _TABS_ON_PAGE[anchorName] ) _TABS_ON_PAGE[anchorName].openTab( _TABS_ON_PAGE[anchorName].getElementsByTagName('a')[0] ); + + if( tabNames.length == 0 ) + anchorName = null; + else { + anchorName = anchorName + tabNames.shift() + 'set'; + } + } +} + +/* + * Returns the form object that the given element is + * inside; or null if it's not inside a form + */ +function findParentForm(el) { + var ownerForm = el.parentNode, tn; + while((tn = ownerForm.tagName.toLowerCase()) != "body" && tn != "form") { + ownerForm = ownerForm.parentNode; + } + if(tn == "form") return ownerForm; + else return null; +} + + +function tabstrip_showTab(evt) { + if(this.tagName.toLowerCase() == "a") var el = this.parentNode; + else el = this; + + _CUR_TABS[el.tabstrip.parentNode.id] = el.container.id; + + if(el.tabstrip.currentlyShowing && el.tabstrip.currentlyShowing.container && el.tabstrip.currentlyShowing != el) { + el.tabstrip.currentlyShowing.container.style.display = 'none'; + removeClass(el.tabstrip.currentlyShowing.container, 'current'); + removeClass(el.tabstrip.currentlyShowing, 'current'); + } + + var container = document.getElementById( el.container.id ); + + if( container && container.style.display == 'none' ) { + container.style.display = 'block'; + addClass( container, 'current' ); + } + + // el.container.style.display = ''; + addClass(el, 'current'); + + el.tabstrip.currentlyShowing = el; + + setHashLink(el.anchorName); + + if(evt != 'init') { + if(window.ontabschanged) window.ontabschanged(); + else if(window.onresize) window.onresize(); + } + + return false; +} + +/* + * Redirect to the given hash link + * It won't actually reload the page, but it will update the current URL + */ +function setHashLink(hashLink) { + return; //temporarily disabled this + + var preserveScroll = preserveScrollPosition(hashLink); + + // Mac/IE5 cannot handle this + if(navigator.userAgent.indexOf("Mac") > -1 && navigator.userAgent.indexOf("MSIE") > -1) + return; + + if(window.location.href.indexOf('#') == -1) + window.location.href += '#' + hashLink; + else + window.location.href = window.location.href.replace(/#.*$/, '#' + hashLink); + + if(typeof preserveScroll != 'undefined') + restoreScrollPosition(preserveScroll); +} + +/** + * Preserve the scroll position prior to visiting the given hashlink. + * Returns an object that you can pass to restoreScrollPosition + */ +function preserveScrollPosition(hashLink) { + var el = document.getElementById(hashLink); + var preserved = []; + while(el) { + preserved[preserved.length] = el; + el.oldScroll = el.scrollTop; + + if(el.tagName && el.tagName.toLowerCase() == "body") break; + el = el.parentNode; + } + return preserved; +} + +/* + * Restores the preserved scroll position + */ +function restoreScrollPosition(preserved) { + var i; + for(i=0;i