From 039bbfde2d2e1efc90fa9828811566ea1f328722 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 29 Jan 2012 17:39:54 +0100 Subject: [PATCH 1/6] automatically show advanced options when no sqlite is available --- core/js/setup.js | 12 ++++++++++++ core/templates/installation.php | 3 +++ 2 files changed, 15 insertions(+) diff --git a/core/js/setup.js b/core/js/setup.js index 94097785e42..6e056cc90d1 100644 --- a/core/js/setup.js +++ b/core/js/setup.js @@ -1,4 +1,11 @@ +var dbtypes $(document).ready(function() { + dbtypes={ + sqlite:!!$('#hasSQLite').val(), + mysql:!!$('#hasMySQL').val(), + postgresql:!!$('#hasPostgreSQL').val(), + } + $('#selectDbType').buttonset(); $('#datadirContent').hide(250); $('#databaseField').hide(250); @@ -60,4 +67,9 @@ $(document).ready(function() { form.submit(); return false; }); + + if(!dbtypes.sqlite){ + $('#showAdvanced').click(); + $('input[type="radio"]').first().click(); + } }); diff --git a/core/templates/installation.php b/core/templates/installation.php index f1cde6b3904..4558f97bc08 100644 --- a/core/templates/installation.php +++ b/core/templates/installation.php @@ -1,3 +1,6 @@ +'> +'> +'>
From 5574b87e9bbafd10b60dea1696cac31978a24c87 Mon Sep 17 00:00:00 2001 From: Bartek Przybylski Date: Mon, 30 Jan 2012 19:36:33 +0100 Subject: [PATCH 2/6] new gallery look and feel --- apps/gallery/appinfo/info.xml | 2 +- apps/gallery/css/styles.css | 16 ++-- apps/gallery/img/delete.png | Bin 0 -> 275 bytes apps/gallery/img/rename.png | Bin 0 -> 310 bytes apps/gallery/img/share.png | Bin 0 -> 377 bytes apps/gallery/js/album_cover.js | 105 +++++++++++++++++--------- apps/gallery/js/albums.js | 11 +-- apps/gallery/templates/index.php | 20 ++++- apps/gallery/templates/view_album.php | 13 ++++ 9 files changed, 117 insertions(+), 50 deletions(-) create mode 100644 apps/gallery/img/delete.png create mode 100644 apps/gallery/img/rename.png create mode 100644 apps/gallery/img/share.png diff --git a/apps/gallery/appinfo/info.xml b/apps/gallery/appinfo/info.xml index c275f39bb25..9aecb0c781d 100644 --- a/apps/gallery/appinfo/info.xml +++ b/apps/gallery/appinfo/info.xml @@ -2,7 +2,7 @@ gallery Gallery - 0.2 + 0.3 AGPL Bartek Przybylski 2 diff --git a/apps/gallery/css/styles.css b/apps/gallery/css/styles.css index bb8d0607f8c..7872b6445ca 100644 --- a/apps/gallery/css/styles.css +++ b/apps/gallery/css/styles.css @@ -1,12 +1,14 @@ -div#gallery_list { margin: 90pt 20pt; } +div#gallery_list { margin: 70pt 20pt 0 20pt; } div#gallery_list.leftcontent { padding-top: 15pt; margin: 0; position: absolute; bottom:0px; text-align: center; overflow: auto; } -div.gallery_album_box { width: 200px; text-align: center; border: 0; display: inline-block; margin: 5pt; vertical-align: top; padding: 10px; position: relative; overflow: hidden; color: #999; } -div.gallery_album_box:hover { color: black; } -.leftcontent div.gallery_album_box { margin: 5px; } +div.gallery_album_box { width: 200px; position:relative; text-align: center; border: 0; display: inline-block; margin: 5pt; vertical-align: top; padding: 20px 5px 5px 5px; position: relative; -webkit-transition: color 0.5s ease-in-out; -o-transition: color 0.5s ease-in-out; -moz-transition: color 0.5s ease-in-out;color: #BBB;} div.gallery_album_box h1 { font-size: 9pt; font-family: Verdana; } -div.gallery_album_cover { width: 199px; height: 199px; border: solid 1pt #999; padding: 0; } -div.gallery_control_overlay { border: 0; position:absolute; right: 10pt; background-color: #333; opacity: 0; padding: 0 5pt; } +div.gallery_album_decoration { width: 200px; position: absolute; border: 0; height: 20px; top: 20px; text-align:right; vertical-align:middle; background-color: #eee; opacity: 0; -webkit-transition: opacity 0.5s ease-in-out; -moz-transition: opacity 0.5s ease-in-out; -o-transition: opacity 0.5s ease-in-out; border-bottom-right-radius: 7px; border-bottom-left-radius: 7px; -moz-border-radius-bottomright: 7px; -moz-border-radius-bottomleft:7px;} +div.gallery_album_box:hover { color: black; } +div.gallery_album_box:hover div.gallery_album_decoration { opacity: 0.7;} +div.gallery_album_decoration a {padding: 0 4pt; cursor: pointer;} +div.gallery_album_cover { width: 200px; height: 200px; border: 0; padding: 0; position:relative;} div.gallery_album_box:hover div.gallery_control_overlay { opacity:0.5 } div.gallery_control_overlay a { color:white; } #gallery_images.rightcontent { padding:10px 5px; bottom: 0px; overflow: auto; right:0px} - +#scan { position:absolute; right:13.5em; top:0em; } +#scan #scanprogressbar { position:relative; display:inline-block; width:10em; height:1.5em; top:.4em; } diff --git a/apps/gallery/img/delete.png b/apps/gallery/img/delete.png new file mode 100644 index 0000000000000000000000000000000000000000..bc0c782882deaa4f9ecf1676592ddba0cc9aacbc GIT binary patch literal 275 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf2?p zUk71ECym(^Ktah8*NBqf{Irtt#G+J&^73-M%)IR4%Pm*(PLD+t=F;b z*eX3n(MkRcKXtZMbAR7WZg&GK3{-9d P-NxYQ>gTe~DWM4f<>O_1 literal 0 HcmV?d00001 diff --git a/apps/gallery/img/rename.png b/apps/gallery/img/rename.png new file mode 100644 index 0000000000000000000000000000000000000000..9993a092df101d4b2796379ac6f1cbe62f131a3c GIT binary patch literal 310 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf2?p zUk71ECym(^Ktah8*NBqf{Irtt#G+J&^73-M%)IR4=coeX%YV7tbaA(MAa9*?eMT*!Qy-Sie zj2?p zUk71ECym(^Ktah8*NBqf{Irtt#G+J&^73-M%)IR4tz7Bi3xz?fT8}8>>mieLaaai)NT>?rS*O zT6%m#`O~7-yQSjkO}AYX4&y z?)p_a9CF&9*mfL9n!8h2m|e8Ft>SR{+QY3)wKXD_)vMLx3OZ)&baLF(!mN`lT&}uE zea@q-Rh`D?cC`N1RR2?ZOlr|$O_saIST^tbRL^ni#ln8RsF{{!<@0{9@#lsd-TujO R1~3E|JYD@<);T3K0RX?fll}kz literal 0 HcmV?d00001 diff --git a/apps/gallery/js/album_cover.js b/apps/gallery/js/album_cover.js index 513dd47d351..e78db221cff 100644 --- a/apps/gallery/js/album_cover.js +++ b/apps/gallery/js/album_cover.js @@ -10,6 +10,10 @@ $(document).ready(function() { if (targetDiv) { $(targetDiv).html(''); Albums.display(targetDiv); + $('#gallery_list').sortable({revert:true}); + $('.gallery_album_box').each(function(i, e) { + $(e).draggable({connectToSortable: '#gallery_list', handle: '.dummy'}) + }); } else { alert('Error occured: no such layer `gallery_list`'); } @@ -37,9 +41,6 @@ var totalAlbums = 0; function scanForAlbums() { var albumCounter = 0; var totalAlbums = 0; - $('#notification').text(t('gallery',"Scanning directories")); - $("#notification").fadeIn(); - $("#notification").slideDown(); $.getJSON('ajax/galleryOp.php?operation=filescan', function(r) { if (r.status == 'success') { @@ -48,7 +49,7 @@ function scanForAlbums() { $('#notification').text(t('gallery', "No photos found")).fadeIn().slideDown().delay(3000).fadeOut().slideUp(); return; } - $('#notification').text(t('gallery',"Creating thumbnails")+' ... ' + Math.floor((albumCounter/totalAlbums)*100) + "%"); + $('#scanprogressbar').progressbar({ value: (albumCounter/totalAlbums)*100 }).fadeIn(); for(var a in r.paths) { $.getJSON('ajax/galleryOp.php?operation=partial_create&path='+r.paths[a], function(r) { @@ -57,10 +58,9 @@ function scanForAlbums() { } albumCounter++; - $('#notification').text(t('gallery',"Creating thumbnails")+' ... ' + Math.floor((albumCounter/totalAlbums)*100) + "%"); + $('#scanprogressbar').progressbar({ value: (albumCounter/totalAlbums)*100 }); if (albumCounter == totalAlbums) { - $("#notification").fadeOut(); - $("#notification").slideUp(); + $('#scanprogressbar').fadeOut(); var targetDiv = document.getElementById('gallery_list'); if (targetDiv) { targetDiv.innerHTML = ''; @@ -78,36 +78,71 @@ function scanForAlbums() { } function galleryRemove(albumName) { - if (confirm(t('gallery',"Do you wan't to remove album")+' ' + albumName + "?")) { - $.getJSON("ajax/galleryOp.php", {operation: "remove", name: albumName}, function(r) { - if (r.status == "success") { - $(".gallery_album_box").filterAttr('data-album',albumName).remove(); - Albums.remove(albumName); - } else { - alert("Error: " + r.cause); - } - }); - } + // a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore! + $( "#dialog:ui-dialog" ).dialog( "destroy" ); + $('#albumName', $("#dialog-confirm")).text(albumName); + + $( '#dialog-confirm' ).dialog({ + resizable: false, + height:150, + buttons: [{ + text: t('gallery', 'OK'), + click: function() { + $.getJSON("ajax/galleryOp.php", {operation: "remove", name: albumName}, function(r) { + if (r.status == "success") { + $(".gallery_album_box").filterAttr('data-album',albumName).remove(); + Albums.remove(albumName); + } else { + alert("Error: " + r.cause); + } + $('#dialog-confirm').dialog('close'); + }); + }}, + { + text: t('gallery', 'Cancel'), + click: function() { + $( this ).dialog( 'close' ); + }}] + }); } function galleryRename(name) { - var result = window.prompt(t('gallery',"Input new gallery name"), name); - if(result=='' || result==name){ - return; - } - if (result) { - if (Albums.find(result)) { - alert("Album named '" + result + "' already exists"); - return; - } - $.getJSON("ajax/galleryOp.php", {operation: "rename", oldname: name, newname: result}, function(r) { - if (r.status == "success") { - Albums.rename($(".gallery_album_box").filterAttr('data-album',name), result); - } else { - alert("Error: " + r.cause); - } - }); - - } + $('#name', $('#dialog-form')).val(name); + $( "#dialog-form" ).dialog({ + height: 140, + width: 350, + modal: false, + buttons: [{ + text: t('gallery', 'Change name'), + click: function() { + var newname = $('#name', $('#dialog-form')).val(); + if (newname == name || newname == '') { + $(this).dialog("close"); + return; + } + if (Albums.find(newname)) { + alert("Album ", newname, " exists"); + $(this).dialog("close"); + return; + } + $.getJSON("ajax/galleryOp.php", {operation: "rename", oldname: name, newname: newname}, function(r) { + if (r.status == "success") { + Albums.rename($(".gallery_album_box").filterAttr('data-album',name), newname); + } else { + alert("Error: " + r.cause); + } + $('#dialog-form').dialog("close"); + }); + + } + }, + { + text: t('gallery', 'Cancel'), + click: function() { + $( this ).dialog( "close" ); + } + } + ], + }); } diff --git a/apps/gallery/js/albums.js b/apps/gallery/js/albums.js index 6150b0daa1e..59efb5b5659 100644 --- a/apps/gallery/js/albums.js +++ b/apps/gallery/js/albums.js @@ -41,16 +41,16 @@ Albums={ // displays gallery in linear representation // on given element, and apply default styles for gallery display: function(element) { - var displayTemplate = ''; + var displayTemplate = ''; for (var i in Albums.albums) { var a = Albums.albums[i]; var local=$(displayTemplate); local.attr('data-album',a.name); - $(".gallery_control_overlay a.rename", local).click(function(name,event){ + $(".gallery_album_decoration a.rename", local).click(function(name,event){ event.preventDefault(); galleryRename(name); }.bind(null,a.name)); - $(".gallery_control_overlay a.remove", local).click(function(name,event){ + $(".gallery_album_decoration a.remove", local).click(function(name,event){ event.preventDefault(); galleryRemove(name); }.bind(null,a.name)); @@ -66,8 +66,9 @@ Albums={ if (albumMetadata == undefined) { return; } - var x = Math.min(Math.floor((e.layerX - this.offsetLeft)/(this.offsetWidth/albumMetadata.numOfCovers)), albumMetadata.numOfCovers-1); - x *= this.offsetWidth-1; + var x = Math.floor((e.layerX - this.offsetLeft)/(this.offsetWidth/albumMetadata.numOfCovers)); + x *= this.offsetWidth; + if (x < 0) x=0; $(this).css('background-position', -x+'px 0'); }); $(element).append(local); diff --git a/apps/gallery/templates/index.php b/apps/gallery/templates/index.php index eb6ebd1bb7b..4c2fbcfe6c6 100644 --- a/apps/gallery/templates/index.php +++ b/apps/gallery/templates/index.php @@ -7,8 +7,24 @@ $l = new OC_L10N('gallery');
- -
+
+
+ +
+ + + + + diff --git a/apps/gallery/templates/view_album.php b/apps/gallery/templates/view_album.php index 55a2ee09e4a..6b513a672d5 100644 --- a/apps/gallery/templates/view_album.php +++ b/apps/gallery/templates/view_album.php @@ -32,3 +32,16 @@ foreach ($_['photos'] as $a) { } ?> + + + + From 45038af948cd07ffc74efc8d4b0282fa11b7de7e Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 30 Jan 2012 20:19:51 +0100 Subject: [PATCH 3/6] provide small wrapper around server side events and provide a fallback for IE --- core/js/eventsource.js | 94 ++++++++++++++++++++++++++++++++++++++++++ lib/base.php | 1 + lib/eventsource.php | 73 ++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+) create mode 100644 core/js/eventsource.js create mode 100644 lib/eventsource.php diff --git a/core/js/eventsource.js b/core/js/eventsource.js new file mode 100644 index 00000000000..422f97657bd --- /dev/null +++ b/core/js/eventsource.js @@ -0,0 +1,94 @@ +/** + * ownCloud + * + * @author Robin Appelman + * @copyright 2012 Robin Appelman icewind1991@gmail.com + * + * 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 . + * + */ + +/** + * wrapper for server side events (http://en.wikipedia.org/wiki/Server-sent_events) + * includes a fallback for older browsers and IE + * + * use server side events with causion, to many open requests can hang the server + */ + +OC.EventSource=function(src){ + if(!this.useFallBack && typeof EventSource !='undefined'){ + this.source=new EventSource(src); + this.source.onmessage=function(e){ + for(var i=0;i'); + this.iframe.attr('id',iframeId); + this.iframe.hide(); + this.iframe.attr('src',src+'?fallback=true&fallback_id='+OC.EventSource.iframeCount); + $('body').append(this.iframe); + this.useFallBack=true; + OC.EventSource.iframeCount++ + + } +} +OC.EventSource.fallBackSources=[]; +OC.EventSource.iframeCount=0;//number of fallback iframes +OC.EventSource.fallBackCallBack=function(id,type,data){ + OC.EventSource.fallBackSources[id].fallBackCallBack(type,JSON.parse(data)); +} +OC.EventSource.prototype={ + typelessListeners:[], + iframe:null, + listeners:{},//only for fallback + useFallBack:false, + fallBackCallBack:function(type,data){ + if(type){ + for(var i=0;i. +* +*/ + +/** + * wrapper for server side events (http://en.wikipedia.org/wiki/Server-sent_events) + * includes a fallback for older browsers and IE + * + * use server side events with causion, to many open requests can hang the server + */ +class OC_EventSource{ + private $fallback; + private $fallBackId=0; + + public function __construct(){ + ob_end_clean(); + header('Cache-Control: no-cache'); + $this->fallback=isset($_GET['fallback']) and $_GET['fallback']=='true'; + if($this->fallback){ + $fallBackId=$_GET['fallback_id']; + header("Content-Type: text/html"); + echo str_repeat(''.PHP_EOL,10); //dummy data to keep IE happy + }else{ + header("Content-Type: text/event-stream"); + } + flush(); + + } + + /** + * send a message to the client + * @param string type + * @param object data + * + * if only one paramater is given, a typeless message will be send with that paramater as data + */ + public function send($type,$data=null){ + if(is_null($data)){ + $data=$type; + $type=null; + } + if($this->fallback){ + $response=''.PHP_EOL; + echo $response; + }else{ + if($type){ + echo 'event: '.$type.PHP_EOL; + } + echo 'data: '.json_encode($data).PHP_EOL; + } + echo PHP_EOL; + flush(); + } +} \ No newline at end of file From 0ba315912ba99c4fb7c30134754846cf7b66c8a0 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Mon, 30 Jan 2012 22:05:31 +0100 Subject: [PATCH 4/6] fix outdated README file --- README | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README b/README index 60b18defd59..cd562b66c6c 100644 --- a/README +++ b/README @@ -1,10 +1,9 @@ ownCloud gives you freedom and control over your own data. A personal cloud which runs on your own server. -It is alpha software in development and should be treated accordingly. http://ownCloud.org -Installation instructions: http://owncloud.org/install +Installation instructions: http://owncloud.org/support Source code: http://gitorious.org/owncloud Mailing list: http://mail.kde.org/mailman/listinfo/owncloud From e0f655fb707e1c632602319a6b989e8f58866953 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Mon, 30 Jan 2012 16:49:24 -0500 Subject: [PATCH 5/6] Sharing app needs to be loaded for public link of file in Shared folder - fixes bug 113 --- apps/files_sharing/get.php | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/files_sharing/get.php b/apps/files_sharing/get.php index ca95a68c6ce..c80b0c2ef03 100644 --- a/apps/files_sharing/get.php +++ b/apps/files_sharing/get.php @@ -1,5 +1,4 @@ Date: Mon, 30 Jan 2012 23:19:43 +0100 Subject: [PATCH 6/6] provide server side close option for EventStream --- core/js/eventsource.js | 7 ++++++- lib/eventsource.php | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/core/js/eventsource.js b/core/js/eventsource.js index 422f97657bd..30b942f59e8 100644 --- a/core/js/eventsource.js +++ b/core/js/eventsource.js @@ -44,8 +44,13 @@ OC.EventSource=function(src){ $('body').append(this.iframe); this.useFallBack=true; OC.EventSource.iframeCount++ - } + //add close listener + this.listen('__internal__',function(data){ + if(data=='close'){ + this.close(); + } + }.bind(this)); } OC.EventSource.fallBackSources=[]; OC.EventSource.iframeCount=0;//number of fallback iframes diff --git a/lib/eventsource.php b/lib/eventsource.php index c123eb4b837..b0450ff3d55 100644 --- a/lib/eventsource.php +++ b/lib/eventsource.php @@ -70,4 +70,11 @@ class OC_EventSource{ echo PHP_EOL; flush(); } + + /** + * close the connection of the even source + */ + public function close(){ + $this->send('__internal__','close');//server side closing can be an issue, let the client do it + } } \ No newline at end of file