diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2013-01-30 17:25:39 +0400 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2013-01-30 17:25:39 +0400 |
commit | 99ad8a1191736faae03f25e7894f715f98b9cdee (patch) | |
tree | 354907d7729620db1de87e2bf9bcc831f3ebddf8 |
removed all data but folder to move
-rw-r--r-- | ajax/disable.php | 29 | ||||
-rw-r--r-- | ajax/enable.php | 29 | ||||
-rwxr-xr-x | appinfo/app.php | 39 | ||||
-rwxr-xr-x | appinfo/info.xml | 10 | ||||
-rwxr-xr-x | appinfo/version | 1 | ||||
-rwxr-xr-x | css/colorbox.css | 38 | ||||
-rw-r--r-- | css/firstrunwizard.css | 10 | ||||
-rw-r--r-- | enable.php | 9 | ||||
-rw-r--r-- | img/appstore.png | bin | 0 -> 7418 bytes | |||
-rw-r--r-- | img/desktopapp.png | bin | 0 -> 4593 bytes | |||
-rw-r--r-- | img/desktopapp.svg | 100 | ||||
-rw-r--r-- | img/googleplay.png | bin | 0 -> 7758 bytes | |||
-rw-r--r-- | js/activate.js | 3 | ||||
-rw-r--r-- | js/firstrunwizard.js | 25 | ||||
-rw-r--r-- | js/jquery.colorbox-min.js | 4 | ||||
-rwxr-xr-x | js/jquery.colorbox.js | 942 | ||||
-rwxr-xr-x | lib/firstrunwizard.php | 60 | ||||
-rw-r--r-- | templates/enable.php | 4 | ||||
-rw-r--r-- | templates/wizard.php | 38 | ||||
-rw-r--r-- | wizard.php | 31 |
20 files changed, 1372 insertions, 0 deletions
diff --git a/ajax/disable.php b/ajax/disable.php new file mode 100644 index 00000000..b1e2b69d --- /dev/null +++ b/ajax/disable.php @@ -0,0 +1,29 @@ +<?php + +/** +* ownCloud - firstrunwizard application +* +* @author Frank Karlitschek +* @copyright 2012 Frank Karlitschek frank@owncloud.org +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +\OCP\User::checkLoggedIn(); +\OCP\App::checkAppEnabled('firstrunwizard'); + +\OCA_FirstRunWizard\Config::disable(); + + diff --git a/ajax/enable.php b/ajax/enable.php new file mode 100644 index 00000000..b71ec0f2 --- /dev/null +++ b/ajax/enable.php @@ -0,0 +1,29 @@ +<?php + +/** +* ownCloud - firstrunwizard application +* +* @author Frank Karlitschek +* @copyright 2012 Frank Karlitschek frank@owncloud.org +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +OCP\JSON::checkLoggedIn(); +OCP\JSON::checkAppEnabled('firstrunwizard'); + +\OCA_FirstRunWizard\Config::enable(); + + diff --git a/appinfo/app.php b/appinfo/app.php new file mode 100755 index 00000000..f15fae48 --- /dev/null +++ b/appinfo/app.php @@ -0,0 +1,39 @@ +<?php + +/** + * ownCloud - firstrunwizard App + * + * @author Frank Karlitschek + * @copyright 2012 Frank Karlitschek karlitschek@kde.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + + +OC::$CLASSPATH['OCA_FirstRunWizard\Config'] = 'apps/firstrunwizard/lib/firstrunwizard.php'; + +OCP\Util::addStyle( 'firstrunwizard', 'colorbox'); +OCP\Util::addScript( 'firstrunwizard', 'jquery.colorbox-min'); +OCP\Util::addScript( 'firstrunwizard', 'firstrunwizard'); + +OCP\App::registerPersonal('firstrunwizard', 'enable'); +OCP\Util::addStyle('firstrunwizard', 'firstrunwizard'); + +if(\OCP\User::isLoggedIn() and \OCA_FirstRunWizard\Config::isenabled()){ + OCP\Util::addScript( 'firstrunwizard', 'activate'); +} + + +?> diff --git a/appinfo/info.xml b/appinfo/info.xml new file mode 100755 index 00000000..ace12105 --- /dev/null +++ b/appinfo/info.xml @@ -0,0 +1,10 @@ +<?xml version="1.0"?> +<info> + <id>firstrunwizard</id> + <name>First Run Wizard</name> + <description>A first run wizard that explains the basic working of ownCloud to new users</description> + <licence>AGPL</licence> + <author>Frank Karlitschek</author> + <require>4.9</require> + <shipped>true</shipped> +</info> diff --git a/appinfo/version b/appinfo/version new file mode 100755 index 00000000..9f8e9b69 --- /dev/null +++ b/appinfo/version @@ -0,0 +1 @@ +1.0
\ No newline at end of file diff --git a/css/colorbox.css b/css/colorbox.css new file mode 100755 index 00000000..1d2809b4 --- /dev/null +++ b/css/colorbox.css @@ -0,0 +1,38 @@ +/* + ColorBox Core Style: + The following CSS is consistent between example themes and should not be altered. +*/ +#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;} +#cboxOverlay{position:fixed; width:100%; height:100%;} +#cboxMiddleLeft, #cboxBottomLeft{clear:left;} +#cboxContent{position:relative;} +#cboxLoadedContent{overflow:auto;} +#cboxTitle{margin:8;} +#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;} +#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;} +.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none;} +.cboxIframe{width:100%; height:100%; display:block; border:0;} +#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;} + +/* + User Style: + Change the following styles to modify the appearance of ColorBox. They are + ordered & tabbed in a way that represents the nesting of the generated HTML. +*/ +#cboxOverlay{background:#000;} +#colorbox{} + #cboxContent{margin-top:20px;} + .cboxIframe{background:#fff;} + #cboxError{padding:50px; border:0px solid #ccc;} + #cboxLoadedContent{border:0px solid #555; background:#fff;border-radius: 5px;} + #cboxTitle{position:absolute; top:-20px; left:0; color:#ccc;} + #cboxCurrent{position:absolute; top:-20px; right:0px; color:#ccc;} + #cboxSlideshow{position:absolute; top:-20px; right:90px; color:#fff;} + #cboxPrevious{position:absolute; top:50%; left:5px; margin-top:-32px; background:url(images/controls.png) no-repeat top left; width:28px; height:65px; text-indent:-9999px;} + #cboxPrevious:hover{background-position:bottom left;} + #cboxNext{position:absolute; top:50%; right:5px; margin-top:-32px; background:url(images/controls.png) no-repeat top right; width:28px; height:65px; text-indent:-9999px;} + #cboxNext:hover{background-position:bottom right;} + #cboxLoadingOverlay{background:#fff;} + #cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;} + #cboxClose{position:absolute; top:5px; right:5px; display:block; background:url(images/controls.png) no-repeat top center; width:38px; height:19px; text-indent:-9999px;} + #cboxClose:hover{background-position:bottom center;} diff --git a/css/firstrunwizard.css b/css/firstrunwizard.css new file mode 100644 index 00000000..ebcebd6d --- /dev/null +++ b/css/firstrunwizard.css @@ -0,0 +1,10 @@ +#firstrunwizard { margin:12px; text-align:center; } +#firstrunwizard h1 { font-size:40px; font-weight:bold; margin:50px 0 20px; } +#firstrunwizard h2 { font-size:20px; font-weight:bold; margin:35px 0 10px; } + +#firstrunwizard .appsmall { height:16px; width:16px; position:relative; top:3px; } +#firstrunwizard p a { font-weight:bold; } +#firstrunwizard p a:hover, #firstrunwizard p a:focus { color:#444; } +#firstrunwizard .footnote { margin-top:40px; } + +#firstrunwizard .close { position:absolute; top:0; right:0; padding:20px; } diff --git a/enable.php b/enable.php new file mode 100644 index 00000000..0dde117d --- /dev/null +++ b/enable.php @@ -0,0 +1,9 @@ +<?php +/** + * Copyright (c) 2012 Frank Karlitschek <frank@owncloud.org> + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ +$tmpl = new OCP\Template( 'firstrunwizard', 'enable'); +return $tmpl->fetchPage(); diff --git a/img/appstore.png b/img/appstore.png Binary files differnew file mode 100644 index 00000000..009b2b51 --- /dev/null +++ b/img/appstore.png diff --git a/img/desktopapp.png b/img/desktopapp.png Binary files differnew file mode 100644 index 00000000..182ddd2c --- /dev/null +++ b/img/desktopapp.png diff --git a/img/desktopapp.svg b/img/desktopapp.svg new file mode 100644 index 00000000..93d91e46 --- /dev/null +++ b/img/desktopapp.svg @@ -0,0 +1,100 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.1" + id="Layer_1" + x="0px" + y="0px" + width="170" + height="60" + viewBox="0 0 1346.4 475.2" + enable-background="new 0 0 792 612" + xml:space="preserve" + inkscape:version="0.48.3.1 r9886" + sodipodi:docname="desktopapp.svg" + inkscape:export-filename="desktopapp.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90"><metadata + id="metadata3043"><rdf:RDF><cc:Work + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs + id="defs3041" /><sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1280" + inkscape:window-height="773" + id="namedview3039" + showgrid="true" + fit-margin-top="3" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="3" + inkscape:zoom="2" + inkscape:cx="155.97228" + inkscape:cy="56.168028" + inkscape:window-x="0" + inkscape:window-y="-1" + inkscape:window-maximized="1" + inkscape:current-layer="Layer_1" + showguides="true" + inkscape:guide-bbox="true"><inkscape:grid + type="xygrid" + id="grid3146" + empspacing="4" + visible="true" + enabled="true" + snapvisiblegridlinesonly="true" + originx="-3.5865408e-16px" + originy="-3px" /></sodipodi:namedview> + + +<rect + id="rect3026" + width="1346.3999" + height="475.20016" + x="-2.8405402e-15" + y="-3.5527137e-15" + rx="50" + ry="50" + style="fill:#1a1a1a" /><path + d="m 150.48,126.72 c -11.88,0 -23.76,11.88 -23.76,23.76 l 0,166.32 -47.52,23.76 0,11.88 c 0,0 0,11.88 11.88,11.88 l 356.4,0 c 11.88,0 11.88,-11.88 11.88,-11.88 l 0,-11.88 -47.52,-23.76 0,-166.32 c 0,-11.88 -11.88,-23.76 -23.76,-23.76 z m 0,23.66718 237.6,0 0,142.65282 -237.6,0 z" + id="path3037" + inkscape:connector-curvature="0" + sodipodi:nodetypes="sscccsscccsssccccc" + style="fill:#ffffff" /><text + xml:space="preserve" + style="font-size:316.79998778999998876px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" + x="451.44" + y="239.58" + id="text2983" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan2985" + x="451.44" + y="239.58" + style="font-size:126.71999999999999886px;font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;font-family:FreeSans;-inkscape-font-specification:FreeSans Semi-Bold;fill:#ffffff">Desktop app</tspan></text> +<text + xml:space="preserve" + style="font-size:316.79998778999998876px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" + x="493.01996" + y="342.54001" + id="text2991" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan2993" + x="493.01996" + y="342.54001" + style="font-size:71.28000000000000114px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:FreeSans;-inkscape-font-specification:FreeSans;fill:#ffffff">Windows, OS X, Linux</tspan></text> +</svg>
\ No newline at end of file diff --git a/img/googleplay.png b/img/googleplay.png Binary files differnew file mode 100644 index 00000000..2d9ad629 --- /dev/null +++ b/img/googleplay.png diff --git a/js/activate.js b/js/activate.js new file mode 100644 index 00000000..f6fd6df2 --- /dev/null +++ b/js/activate.js @@ -0,0 +1,3 @@ +jQuery(document).ready(function () { + showfirstrunwizard(); +}); diff --git a/js/firstrunwizard.js b/js/firstrunwizard.js new file mode 100644 index 00000000..b73ac448 --- /dev/null +++ b/js/firstrunwizard.js @@ -0,0 +1,25 @@ +function showfirstrunwizard(){ + $.colorbox({ + opacity:0.4, + transition:"elastic", + speed:100, + width:"70%", + height:"70%", + href: OC.filePath('firstrunwizard', '', 'wizard.php'), + onClosed : function(){ + + $.ajax({ + url: OC.filePath('firstrunwizard', 'ajax', 'disable.php'), + data: "" + }); + } + }); +} + +$('#showWizard').live('click', function () { + showfirstrunwizard(); +}); + +$('#closeWizard').live('click', function () { + $.colorbox.close(); +});
\ No newline at end of file diff --git a/js/jquery.colorbox-min.js b/js/jquery.colorbox-min.js new file mode 100644 index 00000000..54286977 --- /dev/null +++ b/js/jquery.colorbox-min.js @@ -0,0 +1,4 @@ +// ColorBox v1.3.20.2 - jQuery lightbox plugin +// (c) 2012 Jack Moore - jacklmoore.com +// License: http://www.opensource.org/licenses/mit-license.php +(function(a,b,c){function Z(c,d,e){var g=b.createElement(c);return d&&(g.id=f+d),e&&(g.style.cssText=e),a(g)}function $(a){var b=y.length,c=(Q+a)%b;return 0>c?b+c:c}function _(a,b){return Math.round((/%/.test(a)?("x"===b?z.width():z.height())/100:1)*parseInt(a,10))}function ab(a){return K.photo||/\.(gif|png|jp(e|g|eg)|bmp|ico)((#|\?).*)?$/i.test(a)}function bb(){var b,c=a.data(P,e);null==c?(K=a.extend({},d),console&&console.log&&console.log("Error: cboxElement missing settings object")):K=a.extend({},c);for(b in K)a.isFunction(K[b])&&"on"!==b.slice(0,2)&&(K[b]=K[b].call(P));K.rel=K.rel||P.rel||a(P).data("rel")||"nofollow",K.href=K.href||a(P).attr("href"),K.title=K.title||P.title,"string"==typeof K.href&&(K.href=a.trim(K.href))}function cb(b,c){a.event.trigger(b),c&&c.call(P)}function db(){var a,d,e,b=f+"Slideshow_",c="click."+f;K.slideshow&&y[1]?(d=function(){F.html(K.slideshowStop).unbind(c).bind(j,function(){(K.loop||y[Q+1])&&(a=setTimeout(W.next,K.slideshowSpeed))}).bind(i,function(){clearTimeout(a)}).one(c+" "+k,e),r.removeClass(b+"off").addClass(b+"on"),a=setTimeout(W.next,K.slideshowSpeed)},e=function(){clearTimeout(a),F.html(K.slideshowStart).unbind([j,i,k,c].join(" ")).one(c,function(){W.next(),d()}),r.removeClass(b+"on").addClass(b+"off")},K.slideshowAuto?d():e()):r.removeClass(b+"off "+b+"on")}function eb(b){U||(P=b,bb(),y=a(P),Q=0,"nofollow"!==K.rel&&(y=a("."+g).filter(function(){var c,b=a.data(this,e);return b&&(c=a(this).data("rel")||b.rel||this.rel),c===K.rel}),Q=y.index(P),-1===Q&&(y=y.add(P),Q=y.length-1)),S||(S=T=!0,r.show(),K.returnFocus&&a(P).blur().one(l,function(){a(this).focus()}),q.css({opacity:+K.opacity,cursor:K.overlayClose?"pointer":"auto"}).show(),K.w=_(K.initialWidth,"x"),K.h=_(K.initialHeight,"y"),W.position(),o&&z.bind("resize."+p+" scroll."+p,function(){q.css({width:z.width(),height:z.height(),top:z.scrollTop(),left:z.scrollLeft()})}).trigger("resize."+p),cb(h,K.onOpen),J.add(D).hide(),I.html(K.close).show()),W.load(!0))}function fb(){!r&&b.body&&(Y=!1,z=a(c),r=Z(X).attr({id:e,"class":n?f+(o?"IE6":"IE"):""}).hide(),q=Z(X,"Overlay",o?"position:absolute":"").hide(),C=Z(X,"LoadingOverlay").add(Z(X,"LoadingGraphic")),s=Z(X,"Wrapper"),t=Z(X,"Content").append(A=Z(X,"LoadedContent","width:0; height:0; overflow:hidden"),D=Z(X,"Title"),E=Z(X,"Current"),G=Z(X,"Next"),H=Z(X,"Previous"),F=Z(X,"Slideshow").bind(h,db),I=Z(X,"Close")),s.append(Z(X).append(Z(X,"TopLeft"),u=Z(X,"TopCenter"),Z(X,"TopRight")),Z(X,!1,"clear:left").append(v=Z(X,"MiddleLeft"),t,w=Z(X,"MiddleRight")),Z(X,!1,"clear:left").append(Z(X,"BottomLeft"),x=Z(X,"BottomCenter"),Z(X,"BottomRight"))).find("div div").css({"float":"left"}),B=Z(X,!1,"position:absolute; width:9999px; visibility:hidden; display:none"),J=G.add(H).add(E).add(F),a(b.body).append(q,r.append(s,B)))}function gb(){return r?(Y||(Y=!0,L=u.height()+x.height()+t.outerHeight(!0)-t.height(),M=v.width()+w.width()+t.outerWidth(!0)-t.width(),N=A.outerHeight(!0),O=A.outerWidth(!0),r.css({"padding-bottom":L,"padding-right":M}),G.click(function(){W.next()}),H.click(function(){W.prev()}),I.click(function(){W.close()}),q.click(function(){K.overlayClose&&W.close()}),a(b).bind("keydown."+f,function(a){var b=a.keyCode;S&&K.escKey&&27===b&&(a.preventDefault(),W.close()),S&&K.arrowKey&&y[1]&&(37===b?(a.preventDefault(),H.click()):39===b&&(a.preventDefault(),G.click()))}),a(b).delegate("."+g,"click",function(a){a.which>1||a.shiftKey||a.altKey||a.metaKey||(a.preventDefault(),eb(this))})),!0):!1}var q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,Y,d={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",open:!1,returnFocus:!0,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0},e="colorbox",f="cbox",g=f+"Element",h=f+"_open",i=f+"_load",j=f+"_complete",k=f+"_cleanup",l=f+"_closed",m=f+"_purge",n=!a.support.opacity&&!a.support.style,o=n&&!c.XMLHttpRequest,p=f+"_IE6",X="div";a.colorbox||(a(fb),W=a.fn[e]=a[e]=function(b,c){var f=this;if(b=b||{},fb(),gb()){if(!f[0]){if(f.selector)return f;f=a("<a/>"),b.open=!0}c&&(b.onComplete=c),f.each(function(){a.data(this,e,a.extend({},a.data(this,e)||d,b))}).addClass(g),(a.isFunction(b.open)&&b.open.call(f)||b.open)&&eb(f[0])}return f},W.position=function(a,b){function j(a){u[0].style.width=x[0].style.width=t[0].style.width=a.style.width,t[0].style.height=v[0].style.height=w[0].style.height=a.style.height}var c,h,i,d=0,e=0,g=r.offset();z.unbind("resize."+f),r.css({top:-9e4,left:-9e4}),h=z.scrollTop(),i=z.scrollLeft(),K.fixed&&!o?(g.top-=h,g.left-=i,r.css({position:"fixed"})):(d=h,e=i,r.css({position:"absolute"})),e+=K.right!==!1?Math.max(z.width()-K.w-O-M-_(K.right,"x"),0):K.left!==!1?_(K.left,"x"):Math.round(Math.max(z.width()-K.w-O-M,0)/2),d+=K.bottom!==!1?Math.max(z.height()-K.h-N-L-_(K.bottom,"y"),0):K.top!==!1?_(K.top,"y"):Math.round(Math.max(z.height()-K.h-N-L,0)/2),r.css({top:g.top,left:g.left}),a=r.width()===K.w+O&&r.height()===K.h+N?0:a||0,s[0].style.width=s[0].style.height="9999px",c={width:K.w+O,height:K.h+N,top:d,left:e},0===a&&r.css(c),r.dequeue().animate(c,{duration:a,complete:function(){j(this),T=!1,s[0].style.width=K.w+O+M+"px",s[0].style.height=K.h+N+L+"px",K.reposition&&setTimeout(function(){z.bind("resize."+f,W.position)},1),b&&b()},step:function(){j(this)}})},W.resize=function(a){S&&(a=a||{},a.width&&(K.w=_(a.width,"x")-O-M),a.innerWidth&&(K.w=_(a.innerWidth,"x")),A.css({width:K.w}),a.height&&(K.h=_(a.height,"y")-N-L),a.innerHeight&&(K.h=_(a.innerHeight,"y")),a.innerHeight||a.height||(A.css({height:"auto"}),K.h=A.height()),A.css({height:K.h}),W.position("none"===K.transition?0:K.speed))},W.prep=function(b){function g(){return K.w=K.w||A.width(),K.w=K.mw&&K.mw<K.w?K.mw:K.w,K.w}function h(){return K.h=K.h||A.height(),K.h=K.mh&&K.mh<K.h?K.mh:K.h,K.h}if(S){var c,d="none"===K.transition?0:K.speed;A.remove(),A=Z(X,"LoadedContent").append(b),A.hide().appendTo(B.show()).css({width:g(),overflow:K.scrolling?"auto":"hidden"}).css({height:h()}).prependTo(t),B.hide(),a(R).css({"float":"none"}),o&&a("select").not(r.find("select")).filter(function(){return"hidden"!==this.style.visibility}).css({visibility:"hidden"}).one(k,function(){this.style.visibility="inherit"}),c=function(){function s(){n&&r[0].style.removeAttribute("filter")}var b,c,h,l,o,p,q,g=y.length,i="frameBorder",k="allowTransparency";if(S){if(l=function(){clearTimeout(V),C.detach().hide(),cb(j,K.onComplete)},n&&R&&A.fadeIn(100),D.html(K.title).add(A).show(),g>1){if("string"==typeof K.current&&E.html(K.current.replace("{current}",Q+1).replace("{total}",g)).show(),G[K.loop||g-1>Q?"show":"hide"]().html(K.next),H[K.loop||Q?"show":"hide"]().html(K.previous),K.slideshow&&F.show(),K.preloading)for(b=[$(-1),$(1)];c=y[b.pop()];)q=a.data(c,e),q&&q.href?(o=q.href,a.isFunction(o)&&(o=o.call(c))):o=c.href,ab(o)&&(p=new Image,p.src=o)}else J.hide();K.iframe?(h=Z("iframe")[0],i in h&&(h[i]=0),k in h&&(h[k]="true"),K.scrolling||(h.scrolling="no"),a(h).attr({src:K.href,name:(new Date).getTime(),"class":f+"Iframe",allowFullScreen:!0,webkitAllowFullScreen:!0,mozallowfullscreen:!0}).one("load",l).one(m,function(){h.src="//about:blank"}).appendTo(A),K.fastIframe&&a(h).trigger("load")):l(),"fade"===K.transition?r.fadeTo(d,1,s):s()}},"fade"===K.transition?r.fadeTo(d,0,function(){W.position(0,c)}):W.position(d,c)}},W.load=function(b){var c,d,e=W.prep;T=!0,R=!1,P=y[Q],b||bb(),cb(m),cb(i,K.onLoad),K.h=K.height?_(K.height,"y")-N-L:K.innerHeight&&_(K.innerHeight,"y"),K.w=K.width?_(K.width,"x")-O-M:K.innerWidth&&_(K.innerWidth,"x"),K.mw=K.w,K.mh=K.h,K.maxWidth&&(K.mw=_(K.maxWidth,"x")-O-M,K.mw=K.w&&K.w<K.mw?K.w:K.mw),K.maxHeight&&(K.mh=_(K.maxHeight,"y")-N-L,K.mh=K.h&&K.h<K.mh?K.h:K.mh),c=K.href,V=setTimeout(function(){C.show().appendTo(t)},100),K.inline?(Z(X).hide().insertBefore(a(c)[0]).one(m,function(){a(this).replaceWith(A.children())}),e(a(c))):K.iframe?e(" "):K.html?e(K.html):ab(c)?(a(R=new Image).addClass(f+"Photo").error(function(){K.title=!1,e(Z(X,"Error").html(K.imgError))}).load(function(){var a;R.onload=null,K.scalePhotos&&(d=function(){R.height-=R.height*a,R.width-=R.width*a},K.mw&&R.width>K.mw&&(a=(R.width-K.mw)/R.width,d()),K.mh&&R.height>K.mh&&(a=(R.height-K.mh)/R.height,d())),K.h&&(R.style.marginTop=Math.max(K.h-R.height,0)/2+"px"),y[1]&&(K.loop||y[Q+1])&&(R.style.cursor="pointer",R.onclick=function(){W.next()}),n&&(R.style.msInterpolationMode="bicubic"),setTimeout(function(){e(R)},1)}),setTimeout(function(){R.src=c},1)):c&&B.load(c,K.data,function(b,c){e("error"===c?Z(X,"Error").html(K.xhrError):a(this).contents())})},W.next=function(){!T&&y[1]&&(K.loop||y[Q+1])&&(Q=$(1),W.load())},W.prev=function(){!T&&y[1]&&(K.loop||Q)&&(Q=$(-1),W.load())},W.close=function(){S&&!U&&(U=!0,S=!1,cb(k,K.onCleanup),z.unbind("."+f+" ."+p),q.fadeTo(200,0),r.stop().fadeTo(300,0,function(){r.add(q).css({opacity:1,cursor:"auto"}).hide(),cb(m),A.remove(),setTimeout(function(){U=!1,cb(l,K.onClosed)},1)}))},W.remove=function(){a([]).add(r).add(q).remove(),r=null,a("."+g).removeData(e).removeClass(g),a(b).undelegate("."+g)},W.element=function(){return a(P)},W.settings=d)})(jQuery,document,window);
\ No newline at end of file diff --git a/js/jquery.colorbox.js b/js/jquery.colorbox.js new file mode 100755 index 00000000..3db60c69 --- /dev/null +++ b/js/jquery.colorbox.js @@ -0,0 +1,942 @@ +// ColorBox v1.3.20.2 - jQuery lightbox plugin +// (c) 2012 Jack Moore - jacklmoore.com +// License: http://www.opensource.org/licenses/mit-license.php +(function ($, document, window) { + var + // Default settings object. + // See http://jacklmoore.com/colorbox for details. + defaults = { + transition: "elastic", + speed: 300, + width: false, + initialWidth: "600", + innerWidth: false, + maxWidth: false, + height: false, + initialHeight: "450", + innerHeight: false, + maxHeight: false, + scalePhotos: true, + scrolling: true, + inline: false, + html: false, + iframe: false, + fastIframe: true, + photo: false, + href: false, + title: false, + rel: false, + opacity: 0.9, + preloading: true, + + current: "image {current} of {total}", + previous: "previous", + next: "next", + close: "close", + xhrError: "This content failed to load.", + imgError: "This image failed to load.", + + open: false, + returnFocus: true, + reposition: true, + loop: true, + slideshow: false, + slideshowAuto: true, + slideshowSpeed: 2500, + slideshowStart: "start slideshow", + slideshowStop: "stop slideshow", + onOpen: false, + onLoad: false, + onComplete: false, + onCleanup: false, + onClosed: false, + overlayClose: true, + escKey: true, + arrowKey: true, + top: false, + bottom: false, + left: false, + right: false, + fixed: false, + data: undefined + }, + + // Abstracting the HTML and event identifiers for easy rebranding + colorbox = 'colorbox', + prefix = 'cbox', + boxElement = prefix + 'Element', + + // Events + event_open = prefix + '_open', + event_load = prefix + '_load', + event_complete = prefix + '_complete', + event_cleanup = prefix + '_cleanup', + event_closed = prefix + '_closed', + event_purge = prefix + '_purge', + + // Special Handling for IE + isIE = !$.support.opacity && !$.support.style, // IE7 & IE8 + isIE6 = isIE && !window.XMLHttpRequest, // IE6 + event_ie6 = prefix + '_IE6', + + // Cached jQuery Object Variables + $overlay, + $box, + $wrap, + $content, + $topBorder, + $leftBorder, + $rightBorder, + $bottomBorder, + $related, + $window, + $loaded, + $loadingBay, + $loadingOverlay, + $title, + $current, + $slideshow, + $next, + $prev, + $close, + $groupControls, + + // Variables for cached values or use across multiple functions + settings, + interfaceHeight, + interfaceWidth, + loadedHeight, + loadedWidth, + element, + index, + photo, + open, + active, + closing, + loadingTimer, + publicMethod, + div = "div", + init; + + // **************** + // HELPER FUNCTIONS + // **************** + + // Convience function for creating new jQuery objects + function $tag(tag, id, css) { + var element = document.createElement(tag); + + if (id) { + element.id = prefix + id; + } + + if (css) { + element.style.cssText = css; + } + + return $(element); + } + + // Determine the next and previous members in a group. + function getIndex(increment) { + var + max = $related.length, + newIndex = (index + increment) % max; + + return (newIndex < 0) ? max + newIndex : newIndex; + } + + // Convert '%' and 'px' values to integers + function setSize(size, dimension) { + return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : $window.height()) / 100) : 1) * parseInt(size, 10)); + } + + // Checks an href to see if it is a photo. + // There is a force photo option (photo: true) for hrefs that cannot be matched by this regex. + function isImage(url) { + return settings.photo || /\.(gif|png|jp(e|g|eg)|bmp|ico)((#|\?).*)?$/i.test(url); + } + + // Assigns function results to their respective properties + function makeSettings() { + var i, + data = $.data(element, colorbox); + + if (data == null) { + settings = $.extend({}, defaults); + if (console && console.log) { + console.log('Error: cboxElement missing settings object'); + } + } else { + settings = $.extend({}, data); + } + + for (i in settings) { + if ($.isFunction(settings[i]) && i.slice(0, 2) !== 'on') { // checks to make sure the function isn't one of the callbacks, they will be handled at the appropriate time. + settings[i] = settings[i].call(element); + } + } + + settings.rel = settings.rel || element.rel || $(element).data('rel') || 'nofollow'; + settings.href = settings.href || $(element).attr('href'); + settings.title = settings.title || element.title; + + if (typeof settings.href === "string") { + settings.href = $.trim(settings.href); + } + } + + function trigger(event, callback) { + $.event.trigger(event); + if (callback) { + callback.call(element); + } + } + + // Slideshow functionality + function slideshow() { + var + timeOut, + className = prefix + "Slideshow_", + click = "click." + prefix, + start, + stop; + + if (settings.slideshow && $related[1]) { + start = function () { + $slideshow + .html(settings.slideshowStop) + .unbind(click) + .bind(event_complete, function () { + if (settings.loop || $related[index + 1]) { + timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed); + } + }) + .bind(event_load, function () { + clearTimeout(timeOut); + }) + .one(click + ' ' + event_cleanup, stop); + $box.removeClass(className + "off").addClass(className + "on"); + timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed); + }; + + stop = function () { + clearTimeout(timeOut); + $slideshow + .html(settings.slideshowStart) + .unbind([event_complete, event_load, event_cleanup, click].join(' ')) + .one(click, function () { + publicMethod.next(); + start(); + }); + $box.removeClass(className + "on").addClass(className + "off"); + }; + + if (settings.slideshowAuto) { + start(); + } else { + stop(); + } + } else { + $box.removeClass(className + "off " + className + "on"); + } + } + + function launch(target) { + if (!closing) { + + element = target; + + makeSettings(); + + $related = $(element); + + index = 0; + + if (settings.rel !== 'nofollow') { + $related = $('.' + boxElement).filter(function () { + var data = $.data(this, colorbox), + relRelated; + + if (data) { + relRelated = $(this).data('rel') || data.rel || this.rel; + } + + return (relRelated === settings.rel); + }); + index = $related.index(element); + + // Check direct calls to ColorBox. + if (index === -1) { + $related = $related.add(element); + index = $related.length - 1; + } + } + + if (!open) { + open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys. + + $box.show(); + + if (settings.returnFocus) { + $(element).blur().one(event_closed, function () { + $(this).focus(); + }); + } + + // +settings.opacity avoids a problem in IE when using non-zero-prefixed-string-values, like '.5' + $overlay.css({"opacity": +settings.opacity, "cursor": settings.overlayClose ? "pointer" : "auto"}).show(); + + // Opens inital empty ColorBox prior to content being loaded. + settings.w = setSize(settings.initialWidth, 'x'); + settings.h = setSize(settings.initialHeight, 'y'); + publicMethod.position(); + + if (isIE6) { + $window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function () { + $overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()}); + }).trigger('resize.' + event_ie6); + } + + trigger(event_open, settings.onOpen); + + $groupControls.add($title).hide(); + + $close.html(settings.close).show(); + } + + publicMethod.load(true); + } + } + + // ColorBox's markup needs to be added to the DOM prior to being called + // so that the browser will go ahead and load the CSS background images. + function appendHTML() { + if (!$box && document.body) { + init = false; + + $window = $(window); + $box = $tag(div).attr({id: colorbox, 'class': isIE ? prefix + (isIE6 ? 'IE6' : 'IE') : ''}).hide(); + $overlay = $tag(div, "Overlay", isIE6 ? 'position:absolute' : '').hide(); + $loadingOverlay = $tag(div, "LoadingOverlay").add($tag(div, "LoadingGraphic")); + $wrap = $tag(div, "Wrapper"); + $content = $tag(div, "Content").append( + $loaded = $tag(div, "LoadedContent", 'width:0; height:0; overflow:hidden'), + $title = $tag(div, "Title"), + $current = $tag(div, "Current"), + $next = $tag(div, "Next"), + $prev = $tag(div, "Previous"), + $slideshow = $tag(div, "Slideshow").bind(event_open, slideshow), + $close = $tag(div, "Close") + ); + + $wrap.append( // The 3x3 Grid that makes up ColorBox + $tag(div).append( + $tag(div, "TopLeft"), + $topBorder = $tag(div, "TopCenter"), + $tag(div, "TopRight") + ), + $tag(div, false, 'clear:left').append( + $leftBorder = $tag(div, "MiddleLeft"), + $content, + $rightBorder = $tag(div, "MiddleRight") + ), + $tag(div, false, 'clear:left').append( + $tag(div, "BottomLeft"), + $bottomBorder = $tag(div, "BottomCenter"), + $tag(div, "BottomRight") + ) + ).find('div div').css({'float': 'left'}); + + $loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none'); + + $groupControls = $next.add($prev).add($current).add($slideshow); + + $(document.body).append($overlay, $box.append($wrap, $loadingBay)); + } + } + + // Add ColorBox's event bindings + function addBindings() { + if ($box) { + if (!init) { + init = true; + + // Cache values needed for size calculations + interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();//Subtraction needed for IE6 + interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width(); + loadedHeight = $loaded.outerHeight(true); + loadedWidth = $loaded.outerWidth(true); + + // Setting padding to remove the need to do size conversions during the animation step. + $box.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth}); + + // Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly. + $next.click(function () { + publicMethod.next(); + }); + $prev.click(function () { + publicMethod.prev(); + }); + $close.click(function () { + publicMethod.close(); + }); + $overlay.click(function () { + if (settings.overlayClose) { + publicMethod.close(); + } + }); + + // Key Bindings + $(document).bind('keydown.' + prefix, function (e) { + var key = e.keyCode; + if (open && settings.escKey && key === 27) { + e.preventDefault(); + publicMethod.close(); + } + if (open && settings.arrowKey && $related[1]) { + if (key === 37) { + e.preventDefault(); + $prev.click(); + } else if (key === 39) { + e.preventDefault(); + $next.click(); + } + } + }); + + $(document).delegate('.'+boxElement, 'click', function(e) { + // ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt. + // See: http://jacklmoore.com/notes/click-events/ + if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey)) { + e.preventDefault(); + launch(this); + } + }); + } + return true; + } + return false; + } + + // Don't do anything if ColorBox already exists. + if ($.colorbox) { + return; + } + + // Append the HTML when the DOM loads + $(appendHTML); + + + // **************** + // PUBLIC FUNCTIONS + // Usage format: $.fn.colorbox.close(); + // Usage from within an iframe: parent.$.fn.colorbox.close(); + // **************** + + publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) { + var $this = this; + + options = options || {}; + + appendHTML(); + + if (addBindings()) { + if (!$this[0]) { + if ($this.selector) { // if a selector was given and it didn't match any elements, go ahead and exit. + return $this; + } + // if no selector was given (ie. $.colorbox()), create a temporary element to work with + $this = $('<a/>'); + options.open = true; // assume an immediate open + } + + if (callback) { + options.onComplete = callback; + } + + $this.each(function () { + $.data(this, colorbox, $.extend({}, $.data(this, colorbox) || defaults, options)); + }).addClass(boxElement); + + if (($.isFunction(options.open) && options.open.call($this)) || options.open) { + launch($this[0]); + } + } + + return $this; + }; + + publicMethod.position = function (speed, loadedCallback) { + var + css, + top = 0, + left = 0, + offset = $box.offset(), + scrollTop, + scrollLeft; + + $window.unbind('resize.' + prefix); + + // remove the modal so that it doesn't influence the document width/height + $box.css({top: -9e4, left: -9e4}); + + scrollTop = $window.scrollTop(); + scrollLeft = $window.scrollLeft(); + + if (settings.fixed && !isIE6) { + offset.top -= scrollTop; + offset.left -= scrollLeft; + $box.css({position: 'fixed'}); + } else { + top = scrollTop; + left = scrollLeft; + $box.css({position: 'absolute'}); + } + + // keeps the top and left positions within the browser's viewport. + if (settings.right !== false) { + left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(settings.right, 'x'), 0); + } else if (settings.left !== false) { + left += setSize(settings.left, 'x'); + } else { + left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2); + } + + if (settings.bottom !== false) { + top += Math.max($window.height() - settings.h - loadedHeight - interfaceHeight - setSize(settings.bottom, 'y'), 0); + } else if (settings.top !== false) { + top += setSize(settings.top, 'y'); + } else { + top += Math.round(Math.max($window.height() - settings.h - loadedHeight - interfaceHeight, 0) / 2); + } + + $box.css({top: offset.top, left: offset.left}); + + // setting the speed to 0 to reduce the delay between same-sized content. + speed = ($box.width() === settings.w + loadedWidth && $box.height() === settings.h + loadedHeight) ? 0 : speed || 0; + + // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly, + // but it has to be shrank down around the size of div#colorbox when it's done. If not, + // it can invoke an obscure IE bug when using iframes. + $wrap[0].style.width = $wrap[0].style.height = "9999px"; + + function modalDimensions(that) { + $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = that.style.width; + $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height; + } + + css = {width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: top, left: left}; + if(speed===0){ // temporary workaround to side-step jQuery-UI 1.8 bug (http://bugs.jquery.com/ticket/12273) + $box.css(css); + } + $box.dequeue().animate(css, { + duration: speed, + complete: function () { + modalDimensions(this); + + active = false; + + // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation. + $wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px"; + $wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px"; + + if (settings.reposition) { + setTimeout(function () { // small delay before binding onresize due to an IE8 bug. + $window.bind('resize.' + prefix, publicMethod.position); + }, 1); + } + + if (loadedCallback) { + loadedCallback(); + } + }, + step: function () { + modalDimensions(this); + } + }); + }; + + publicMethod.resize = function (options) { + if (open) { + options = options || {}; + + if (options.width) { + settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth; + } + if (options.innerWidth) { + settings.w = setSize(options.innerWidth, 'x'); + } + $loaded.css({width: settings.w}); + + if (options.height) { + settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight; + } + if (options.innerHeight) { + settings.h = setSize(options.innerHeight, 'y'); + } + if (!options.innerHeight && !options.height) { + $loaded.css({height: "auto"}); + settings.h = $loaded.height(); + } + $loaded.css({height: settings.h}); + + publicMethod.position(settings.transition === "none" ? 0 : settings.speed); + } + }; + + publicMethod.prep = function (object) { + if (!open) { + return; + } + + var callback, speed = settings.transition === "none" ? 0 : settings.speed; + + $loaded.remove(); + $loaded = $tag(div, 'LoadedContent').append(object); + + function getWidth() { + settings.w = settings.w || $loaded.width(); + settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w; + return settings.w; + } + function getHeight() { + settings.h = settings.h || $loaded.height(); + settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h; + return settings.h; + } + + $loaded.hide() + .appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations. + .css({width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden'}) + .css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height. + .prependTo($content); + + $loadingBay.hide(); + + // floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width. + //$(photo).css({'float': 'none', marginLeft: 'auto', marginRight: 'auto'}); + + $(photo).css({'float': 'none'}); + + // Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay. + if (isIE6) { + $('select').not($box.find('select')).filter(function () { + return this.style.visibility !== 'hidden'; + }).css({'visibility': 'hidden'}).one(event_cleanup, function () { + this.style.visibility = 'inherit'; + }); + } + + callback = function () { + var preload, + i, + total = $related.length, + iframe, + frameBorder = 'frameBorder', + allowTransparency = 'allowTransparency', + complete, + src, + img, + data; + + if (!open) { + return; + } + + function removeFilter() { + if (isIE) { + $box[0].style.removeAttribute('filter'); + } + } + + complete = function () { + clearTimeout(loadingTimer); + // Detaching forces Andriod stock browser to redraw the area underneat the loading overlay. Hiding alone isn't enough. + $loadingOverlay.detach().hide(); + trigger(event_complete, settings.onComplete); + }; + + if (isIE) { + //This fadeIn helps the bicubic resampling to kick-in. + if (photo) { + $loaded.fadeIn(100); + } + } + + $title.html(settings.title).add($loaded).show(); + + if (total > 1) { // handle grouping + if (typeof settings.current === "string") { + $current.html(settings.current.replace('{current}', index + 1).replace('{total}', total)).show(); + } + + $next[(settings.loop || index < total - 1) ? "show" : "hide"]().html(settings.next); + $prev[(settings.loop || index) ? "show" : "hide"]().html(settings.previous); + + if (settings.slideshow) { + $slideshow.show(); + } + + // Preloads images within a rel group + if (settings.preloading) { + preload = [ + getIndex(-1), + getIndex(1) + ]; + while (i = $related[preload.pop()]) { + data = $.data(i, colorbox); + + if (data && data.href) { + src = data.href; + if ($.isFunction(src)) { + src = src.call(i); + } + } else { + src = i.href; + } + + if (isImage(src)) { + img = new Image(); + img.src = src; + } + } + } + } else { + $groupControls.hide(); + } + + if (settings.iframe) { + iframe = $tag('iframe')[0]; + + if (frameBorder in iframe) { + iframe[frameBorder] = 0; + } + + if (allowTransparency in iframe) { + iframe[allowTransparency] = "true"; + } + + if (!settings.scrolling) { + iframe.scrolling = "no"; + } + + $(iframe) + .attr({ + src: settings.href, + name: (new Date()).getTime(), // give the iframe a unique name to prevent caching + 'class': prefix + 'Iframe', + allowFullScreen : true, // allow HTML5 video to go fullscreen + webkitAllowFullScreen : true, + mozallowfullscreen : true + }) + .one('load', complete) + .one(event_purge, function () { + iframe.src = "//about:blank"; + }) + .appendTo($loaded); + + if (settings.fastIframe) { + $(iframe).trigger('load'); + } + } else { + complete(); + } + + if (settings.transition === 'fade') { + $box.fadeTo(speed, 1, removeFilter); + } else { + removeFilter(); + } + }; + + if (settings.transition === 'fade') { + $box.fadeTo(speed, 0, function () { + publicMethod.position(0, callback); + }); + } else { + publicMethod.position(speed, callback); + } + }; + + publicMethod.load = function (launched) { + var href, setResize, prep = publicMethod.prep; + + active = true; + + photo = false; + + element = $related[index]; + + if (!launched) { + makeSettings(); + } + + trigger(event_purge); + + trigger(event_load, settings.onLoad); + + settings.h = settings.height ? + setSize(settings.height, 'y') - loadedHeight - interfaceHeight : + settings.innerHeight && setSize(settings.innerHeight, 'y'); + + settings.w = settings.width ? + setSize(settings.width, 'x') - loadedWidth - interfaceWidth : + settings.innerWidth && setSize(settings.innerWidth, 'x'); + + // Sets the minimum dimensions for use in image scaling + settings.mw = settings.w; + settings.mh = settings.h; + + // Re-evaluate the minimum width and height based on maxWidth and maxHeight values. + // If the width or height exceed the maxWidth or maxHeight, use the maximum values instead. + if (settings.maxWidth) { + settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth; + settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw; + } + if (settings.maxHeight) { + settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight; + settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh; + } + + href = settings.href; + + loadingTimer = setTimeout(function () { + $loadingOverlay.show().appendTo($content); + }, 100); + + if (settings.inline) { + // Inserts an empty placeholder where inline content is being pulled from. + // An event is bound to put inline content back when ColorBox closes or loads new content. + $tag(div).hide().insertBefore($(href)[0]).one(event_purge, function () { + $(this).replaceWith($loaded.children()); + }); + prep($(href)); + } else if (settings.iframe) { + // IFrame element won't be added to the DOM until it is ready to be displayed, + // to avoid problems with DOM-ready JS that might be trying to run in that iframe. + prep(" "); + } else if (settings.html) { + prep(settings.html); + } else if (isImage(href)) { + $(photo = new Image()) + .addClass(prefix + 'Photo') + .error(function () { + settings.title = false; + prep($tag(div, 'Error').html(settings.imgError)); + }) + .load(function () { + var percent; + photo.onload = null; //stops animated gifs from firing the onload repeatedly. + + if (settings.scalePhotos) { + setResize = function () { + photo.height -= photo.height * percent; + photo.width -= photo.width * percent; + }; + if (settings.mw && photo.width > settings.mw) { + percent = (photo.width - settings.mw) / photo.width; + setResize(); + } + if (settings.mh && photo.height > settings.mh) { + percent = (photo.height - settings.mh) / photo.height; + setResize(); + } + } + + if (settings.h) { + photo.style.marginTop = Math.max(settings.h - photo.height, 0) / 2 + 'px'; + } + + if ($related[1] && (settings.loop || $related[index + 1])) { + photo.style.cursor = 'pointer'; + photo.onclick = function () { + publicMethod.next(); + }; + } + + if (isIE) { + photo.style.msInterpolationMode = 'bicubic'; + } + + setTimeout(function () { // A pause because Chrome will sometimes report a 0 by 0 size otherwise. + prep(photo); + }, 1); + }); + + setTimeout(function () { // A pause because Opera 10.6+ will sometimes not run the onload function otherwise. + photo.src = href; + }, 1); + } else if (href) { + $loadingBay.load(href, settings.data, function (data, status) { + prep(status === 'error' ? $tag(div, 'Error').html(settings.xhrError) : $(this).contents()); + }); + } + }; + + // Navigates to the next page/image in a set. + publicMethod.next = function () { + if (!active && $related[1] && (settings.loop || $related[index + 1])) { + index = getIndex(1); + publicMethod.load(); + } + }; + + publicMethod.prev = function () { + if (!active && $related[1] && (settings.loop || index)) { + index = getIndex(-1); + publicMethod.load(); + } + }; + + // Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close(); + publicMethod.close = function () { + if (open && !closing) { + + closing = true; + + open = false; + + trigger(event_cleanup, settings.onCleanup); + + $window.unbind('.' + prefix + ' .' + event_ie6); + + $overlay.fadeTo(200, 0); + + $box.stop().fadeTo(300, 0, function () { + + $box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide(); + + trigger(event_purge); + + $loaded.remove(); + + setTimeout(function () { + closing = false; + trigger(event_closed, settings.onClosed); + }, 1); + }); + } + }; + + // Removes changes ColorBox made to the document, but does not remove the plugin + // from jQuery. + publicMethod.remove = function () { + $([]).add($box).add($overlay).remove(); + $box = null; + $('.' + boxElement) + .removeData(colorbox) + .removeClass(boxElement); + + $(document).undelegate('.'+boxElement); + }; + + // A method for fetching the current element ColorBox is referencing. + // returns a jQuery object. + publicMethod.element = function () { + return $(element); + }; + + publicMethod.settings = defaults; + +}(jQuery, document, window));
\ No newline at end of file diff --git a/lib/firstrunwizard.php b/lib/firstrunwizard.php new file mode 100755 index 00000000..420b0626 --- /dev/null +++ b/lib/firstrunwizard.php @@ -0,0 +1,60 @@ +<?php + +/** + * ownCloud - firstrunwizard App + * + * @author Frank Karlitschek + * @copyright 2012 Frank Karlitschek frank@owncloud.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + */ + + +namespace OCA_FirstRunWizard; + +class Config { + + /** + * @brief Disable the FirstRunWizard + */ + public static function enable() { + \OCP\Config::setUserValue( \OCP\User::getUser(), 'firstrunwizard', 'show', 1 ); + } + + /** + * @brief Enable the FirstRunWizard + */ + public static function disable() { + \OCP\Config::setUserValue( \OCP\User::getUser(), 'firstrunwizard', 'show', 0 ); + } + + /** + * @brief Check if the FirstRunWizard is enabled or not + * @return bool + */ + public static function isenabled() { + $conf=\OCP\CONFIG::getUserValue( \OCP\User::getUser() , 'firstrunwizard' , 'show' , 1 ); + if($conf==1) { + return(true); + }else{ + return(false); + } + } + + + +} + +?> diff --git a/templates/enable.php b/templates/enable.php new file mode 100644 index 00000000..f0a8b8f1 --- /dev/null +++ b/templates/enable.php @@ -0,0 +1,4 @@ +<fieldset class="personalblock"> + <legend><strong><?php echo $l->t('First Run Wizard');?></strong></legend> + <a class="button" href="#" id="showWizard"><?php echo $l->t('Show First Run Wizard again');?></a> +</fieldset> diff --git a/templates/wizard.php b/templates/wizard.php new file mode 100644 index 00000000..9f4b74ef --- /dev/null +++ b/templates/wizard.php @@ -0,0 +1,38 @@ +<div id="firstrunwizard"> + +<a id="closeWizard" class="close"> + <img class="svg" src="/owncloud/core/img/actions/delete.svg"> +</a> + +<h1>Welcome to ownCloud</h1> +<p>Your personal web services. All your files, contacts, calendar and more, in one place.</p> + + +<h2>Get the apps to sync your files</h2> +<a href="http://owncloud.org/sync-clients/"> + <img src="<?php echo OCP\Util::imagePath('firstrunwizard', 'desktopapp.png'); ?>" /> +</a> +<a href="https://play.google.com/store/apps/details?id=com.owncloud.android"> + <img src="<?php echo OCP\Util::imagePath('firstrunwizard', 'googleplay.png'); ?>" /> +</a> +<a href="https://itunes.apple.com/us/app/owncloud/id543672169?mt=8"> + <img src="<?php echo OCP\Util::imagePath('firstrunwizard', 'appstore.png'); ?>" /> +</a> + + +<h2>Connect your desktop apps to ownCloud</h2> +<a class="button" href="http://doc.owncloud.org/server/5.0/user_manual/calendars.html#synchronising-calendars-with-caldav"> + <img class="appsmall" src="<?php echo OCP\Util::imagePath('calendar', 'icon.svg'); ?>" /> Connect your Calendar +</a> +<a class="button" href="http://doc.owncloud.org/server/5.0/user_manual/contacts.html#keeping-your-address-book-in-sync"> + <img class="appsmall" src="<?php echo OCP\Util::imagePath('settings', 'users.svg'); ?>" /> Connect your Contacts +</a> +<a class="button" href="http://doc.owncloud.org/server/5.0/user_manual/connecting_webdav.html"> + <img class="appsmall" src="<?php echo OCP\Util::imagePath('core', 'places/folder.svg'); ?>" /> Access files via WebDAV +</a> + +<p class="footnote">There’s more information in the <a href="http://doc.owncloud.org/server/5.0/user_manual/">documentation</a> and on our <a href="http://owncloud.org">website</a>.<br> +If you like ownCloud, <a href="mailto:?subject=ownCloud&body=ownCloud is a great open software to sync and share your files. You can freely get it from http://owncloud.org">recommend it to your friends</a>!</p> + + +</div> diff --git a/wizard.php b/wizard.php new file mode 100644 index 00000000..e018eff8 --- /dev/null +++ b/wizard.php @@ -0,0 +1,31 @@ +<?php + +/** +* ownCloud - First Run Wizard +* +* @author Frank Karlitschek +* @copyright 2012 Frank Karlitschek frank@owncloud.org +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Affero General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + + +// Check if we are a user +OCP\User::checkLoggedIn(); + +$tmpl = new OCP\Template( 'firstrunwizard', 'wizard', '' ); +$tmpl->assign('logo', OCP\Util::linkTo('core','img/logo-inverted.svg')); +$tmpl->printPage(); + |