diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php
index a6ae659008..7f3322b1ab 100644
--- a/apps/calendar/lib/object.php
+++ b/apps/calendar/lib/object.php
@@ -814,7 +814,7 @@ class OC_Calendar_Object{
if($allday){
$return['start'] = $start_dt->format('Y-m-d');
$end_dt->modify('-1 minute');
- while($start_dt->format('U') >= $end_dt->format('U')){
+ while($start_dt >= $end_dt){
$end_dt->modify('+1 day');
}
$return['end'] = $end_dt->format('Y-m-d');
diff --git a/apps/contacts/ajax/addcontact.php b/apps/contacts/ajax/addcontact.php
index e45072c954..12f7bb9db9 100644
--- a/apps/contacts/ajax/addcontact.php
+++ b/apps/contacts/ajax/addcontact.php
@@ -47,4 +47,4 @@ if(!$id) {
exit();
}
-OCP\JSON::success(array('data' => array( 'id' => $id )));
+OCP\JSON::success(array('data' => array( 'id' => $id, 'aid' => $aid )));
diff --git a/apps/contacts/ajax/contacts.php b/apps/contacts/ajax/contacts.php
index bf4d5deb2e..16730ec947 100644
--- a/apps/contacts/ajax/contacts.php
+++ b/apps/contacts/ajax/contacts.php
@@ -17,14 +17,25 @@ function cmp($a, $b)
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
-$ids = OC_Contacts_Addressbook::activeIds(OCP\USER::getUser());
-$contacts_alphabet = OC_Contacts_VCard::all($ids);
$active_addressbooks = OC_Contacts_Addressbook::active(OCP\USER::getUser());
+error_log('active_addressbooks: '.print_r($active_addressbooks, true));
+
+$contacts_addressbook = array();
+$ids = array();
+foreach($active_addressbooks as $addressbook) {
+ $ids[] = $addressbook['id'];
+ if(!isset($contacts_addressbook[$addressbook['id']])) {
+ $contacts_addressbook[$addressbook['id']] = array('contacts' => array());
+ $contacts_addressbook[$addressbook['id']]['displayname'] = $addressbook['displayname'];
+ }
+}
+error_log('ids: '.print_r($ids, true));
+$contacts_alphabet = OC_Contacts_VCard::all($ids);
+error_log('contacts_alphabet: '.print_r($contacts_alphabet, true));
// Our new array for the contacts sorted by addressbook
-$contacts_addressbook = array();
foreach($contacts_alphabet as $contact) {
- if(!isset($contacts_addressbook[$contact['addressbookid']])) {
+ if(!isset($contacts_addressbook[$contact['addressbookid']])) { // It should never execute.
$contacts_addressbook[$contact['addressbookid']] = array('contacts' => array());
}
$display = trim($contact['fullname']);
@@ -38,14 +49,6 @@ foreach($contacts_alphabet as $contact) {
$contacts_addressbook[$contact['addressbookid']]['contacts'][] = array('id' => $contact['id'], 'addressbookid' => $contact['addressbookid'], 'displayname' => htmlspecialchars($display));
}
-foreach($contacts_addressbook as $addressbook_id => $contacts) {
- foreach($active_addressbooks as $addressbook) {
- if($addressbook_id == $addressbook['id']) {
- $contacts_addressbook[$addressbook_id]['displayname'] = $addressbook['displayname'];
- }
- }
-}
-
uasort($contacts_addressbook, 'cmp');
$tmpl = new OCP\Template("contacts", "part.contacts");
diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js
index 2319334c58..8ab2a3fbb8 100644
--- a/apps/contacts/js/contacts.js
+++ b/apps/contacts/js/contacts.js
@@ -174,7 +174,7 @@ Contacts={
// TODO: Take addressbook into account
$('#fn').change(function(){
var name = $('#fn').val().strip_tags();
- var item = $('.contacts [data-id="'+Contacts.UI.Card.id+'"]');
+ var item = $('.contacts li[data-id="'+Contacts.UI.Card.id+'"]');
$(item).find('a').html(name);
Contacts.UI.Card.fn = name;
var added = false;
@@ -186,7 +186,7 @@ Contacts={
}
});
if(!added) {
- $('#leftcontent ul[data-id="'+Contacts.UI.Card.bookid+'"]').append(item);
+ $('#contacts ul[data-id="'+Contacts.UI.Card.bookid+'"]').append(item);
}
Contacts.UI.Contacts.scrollTo(Contacts.UI.Card.id);
});
@@ -250,8 +250,10 @@ Contacts={
var newid, firstitem;
if(!id) {
firstitem = $('#contacts:first-child li:first-child');
- newid = firstitem.data('id');
- bookid = firstitem.data('bookid');
+ if(firstitem.length > 0) {
+ newid = firstitem.data('id');
+ bookid = firstitem.data('bookid');
+ }
} else {
newid = id;
}
@@ -269,7 +271,7 @@ Contacts={
}
// Make sure proper DOM is loaded.
- if(!$('#card')[0]) {
+ if(!$('#card')[0] && newid) {
$.getJSON(OC.filePath('contacts', 'ajax', 'loadcard.php'),{},function(jsondata){
if(jsondata.status == 'success'){
$('#rightcontent').html(jsondata.data.page).ready(function() {
@@ -281,7 +283,7 @@ Contacts={
}
});
}
- else if($('.contacts li').length == 0) {
+ else if(!newid) {
// load intro page
$.getJSON(OC.filePath('contacts', 'ajax', 'loadintro.php'),{},function(jsondata){
if(jsondata.status == 'success'){
@@ -316,13 +318,14 @@ Contacts={
if (jsondata.status == 'success'){
$('#rightcontent').data('id',jsondata.data.id);
var id = jsondata.data.id;
+ var aid = jsondata.data.aid;
$.getJSON(OC.filePath('contacts', 'ajax', 'contactdetails.php'),{'id':id},function(jsondata){
if(jsondata.status == 'success'){
Contacts.UI.Card.loadContact(jsondata.data, aid);
- $('#leftcontent .active').removeClass('active');
+ $('#contacts .active').removeClass('active');
var item = $('
'+Contacts.UI.Card.fn+'');
var added = false;
- $('#leftcontent ul li').each(function(){
+ $('#contacts ul[data-id="'+aid+'"] li').each(function(){
if ($(this).text().toLowerCase() > Contacts.UI.Card.fn.toLowerCase()) {
$(this).before(item).fadeIn('fast');
added = true;
@@ -330,7 +333,7 @@ Contacts={
}
});
if(!added) {
- $('#leftcontent ul').append(item);
+ $('#contacts ul[data-id="'+aid+'"]').append(item);
}
if(isnew) { // add some default properties
Contacts.UI.Card.addProperty('EMAIL');
@@ -374,7 +377,7 @@ Contacts={
$.post(OC.filePath('contacts', 'ajax', 'deletecard.php'),{'id':Contacts.UI.Card.id},function(jsondata){
if(jsondata.status == 'success'){
var newid = '', bookid;
- var curlistitem = $('#leftcontent [data-id="'+jsondata.data.id+'"]');
+ var curlistitem = $('#contacts li[data-id="'+jsondata.data.id+'"]');
var newlistitem = curlistitem.prev();
if(newlistitem == undefined) {
newlistitem = curlistitem.next();
@@ -1541,13 +1544,16 @@ Contacts={
});
},
refreshThumbnail:function(id){
- var item = $('.contacts [data-id="'+id+'"]').find('a');
+ var item = $('.contacts li[data-id="'+id+'"]').find('a');
item.html(Contacts.UI.Card.fn);
item.css('background','url('+OC.filePath('contacts', '', 'thumbnail.php')+'?id='+id+'&refresh=1'+Math.random()+') no-repeat');
},
scrollTo:function(id){
- $('.contacts').animate({
- scrollTop: $('#leftcontent li[data-id="'+id+'"]').offset().top-20}, 'slow','swing');
+ var item = $('#contacts li[data-id="'+id+'"]');
+ if(item) {
+ $('.contacts').animate({
+ scrollTop: $('#contacts li[data-id="'+id+'"]').offset().top-20}, 'slow','swing');
+ }
}
}
}
diff --git a/apps/contacts/lib/addressbook.php b/apps/contacts/lib/addressbook.php
index 79445ceeee..878d8835f9 100644
--- a/apps/contacts/lib/addressbook.php
+++ b/apps/contacts/lib/addressbook.php
@@ -172,12 +172,11 @@ class OC_Contacts_Addressbook{
if(!$prefbooks){
$addressbooks = OC_Contacts_Addressbook::all($uid);
if(count($addressbooks) == 0){
- OC_Contacts_Addressbook::add($uid,'default','Default Address Book');
- $addressbooks = OC_Contacts_Addressbook::all($uid);
+ $id = OC_Contacts_Addressbook::add($uid,'default','Default Address Book');
+ self::setActive($id, true);
}
- $prefbooks = $addressbooks[0]['id'];
- OCP\Config::setUserValue($uid,'contacts','openaddressbooks',$prefbooks);
}
+ $prefbooks = OCP\Config::getUserValue($uid,'contacts','openaddressbooks',null);
return explode(';',$prefbooks);
}
@@ -195,7 +194,7 @@ class OC_Contacts_Addressbook{
$stmt = OCP\DB::prepare( $prep );
$result = $stmt->execute($active);
} catch(Exception $e) {
- OCP\Util::writeLog('contacts','OC_Contacts_Addressbook:active:, exception: '.$e->getMessage(),OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts','OC_Contacts_Addressbook:active:, exception: '.$e->getMessage(),OCP\Util::ERROR);
OCP\Util::writeLog('contacts','OC_Contacts_Addressbook:active, ids: '.join(',', $active),OCP\Util::DEBUG);
OCP\Util::writeLog('contacts','OC_Contacts_Addressbook::active, SQL:'.$prep,OCP\Util::DEBUG);
}
@@ -210,7 +209,7 @@ class OC_Contacts_Addressbook{
/**
* @brief Activates an addressbook
* @param integer $id
- * @param integer $name
+ * @param boolean $active
* @return boolean
*/
public static function setActive($id,$active){
@@ -256,11 +255,15 @@ class OC_Contacts_Addressbook{
* @return boolean
*/
public static function delete($id){
- // FIXME: There's no error checking at all.
self::setActive($id, false);
- $stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*contacts_addressbooks WHERE id = ?' );
- $stmt->execute(array($id));
-
+ try {
+ $stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*contacts_addressbooks WHERE id = ?' );
+ $stmt->execute(array($id));
+ } catch(Exception $e) {
+ OCP\Util::writeLog('contacts','OC_Contacts_Addressbook:delete:, exception for '.$id.': '.$e->getMessage(),OCP\Util::ERROR);
+ return false;
+ }
+
$cards = OC_Contacts_VCard::all($id);
foreach($cards as $card){
OC_Contacts_VCard::delete($card['id']);
diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php
index 71a874d783..110d721ace 100644
--- a/apps/contacts/lib/vcard.php
+++ b/apps/contacts/lib/vcard.php
@@ -56,7 +56,7 @@ class OC_Contacts_VCard{
$stmt = OCP\DB::prepare( $prep );
$result = $stmt->execute($id);
} catch(Exception $e) {
- OCP\Util::writeLog('contacts','OC_Contacts_VCard:all:, exception: '.$e->getMessage(),OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts','OC_Contacts_VCard:all:, exception: '.$e->getMessage(),OCP\Util::ERROR);
OCP\Util::writeLog('contacts','OC_Contacts_VCard:all, ids: '.join(',', $id),OCP\Util::DEBUG);
OCP\Util::writeLog('contacts','SQL:'.$prep,OCP\Util::DEBUG);
}
diff --git a/apps/gallery/css/styles.css b/apps/gallery/css/styles.css
index 98d3651549..dcef1f08c6 100644
--- a/apps/gallery/css/styles.css
+++ b/apps/gallery/css/styles.css
@@ -4,3 +4,11 @@ div#controls input[type=button] { -webkit-transition: opacity 0.5s ease-in-out;
input[type=button]:disabled { opacity: 0.5 }
.ui-dialog tr {background-color: #eee;}
.ui-dialog input {width: 90%;}
+
+div.gallery_div {position:relative; display: inline-block; height: 152px; width: 150px; margin: 5px;}
+div.miniature_border {position:absolute; height: 150px; -moz-transition-duration: 0.2s; -o-transition-duration:0.2s; -webkit-transition-duration: .2s; background-position: 50%;}
+div.line {display:inline-block; border: 0; width: auto; height: 160px}
+div.gallery_div img{position:absolute; top: 1; left: 0; -moz-transition-duration: 0.3s; -o-transition-duration:0.3s; -webkit-transition-duration: 0.3s; height:150px; width: auto;}
+div.gallery_div img.shrinker {width:80px !important;}
+div.title { opacity: 0; text-align: center; vertical-align: middle; font-family: Arial; font-size: 12px; border: 0; position: absolute; text-overflow: ellipsis; bottom: 20px; right:-5px; height:auto; padding: 5px; width: 140px; background-color: black; color: white; -webkit-transition: opacity 0.5s; z-index:1000; border-radius: 7px}
+div.visible { opacity: 0.8;}
diff --git a/apps/gallery/index.php b/apps/gallery/index.php
index b87d99bb6c..c08305bff9 100644
--- a/apps/gallery/index.php
+++ b/apps/gallery/index.php
@@ -31,6 +31,70 @@ OCP\Util::addStyle('files', 'files');
OCP\Util::addStyle('gallery', 'styles');
OCP\Util::addScript('gallery', 'pictures');
+include('apps/gallery/lib/tiles.php');
+
+$root = !empty($_GET['root']) ? $_GET['root'] : '/';
+$images = \OC_FileCache::searchByMime('image', null, '/'.\OCP\USER::getUser().'/files'.$root);
+sort($images);
+
+$tl = new \OC\Pictures\TilesLine();
+$ts = new \OC\Pictures\TileStack(array(), '');
+$previous_element = @$images[0];
+
+$root_images = array();
+$second_level_images = array();
+
+$fallback_images = array(); // if the folder only cotains subfolders with images -> these are taken for the stack preview
+
+for($i = 0; $i < count($images); $i++) {
+ $prev_dir_arr = explode('/', $previous_element);
+ $dir_arr = explode('/', $images[$i]);
+
+ if(count($dir_arr) == 1) { // getting the images in this directory
+ $root_images[] = $root.$images[$i];
+ } else {
+ if(strcmp($prev_dir_arr[0], $dir_arr[0]) != 0) { // if we entered a new directory
+ if(count($second_level_images) == 0) { // if we don't have images in this directory
+ if(count($fallback_images) != 0) { // but have fallback_images
+ $tl->addTile(new \OC\Pictures\TileStack($fallback_images, $prev_dir_arr[0]));
+ $fallback_images = array();
+ }
+ } else { // if we collected images for this directory
+ $tl->addTile(new \OC\Pictures\TileStack($second_level_images, $prev_dir_arr[0]));
+ $fallback_images = array();
+ $second_level_images = array();
+ }
+ }
+ if (count($dir_arr) == 2) { // These are the pics in our current subdir
+ $second_level_images[] = $root.$images[$i];
+ $fallback_images = array();
+ } else { // These are images from the deeper directories
+ if(count($second_level_images) == 0) {
+ $fallback_images[] = $root.$images[$i];
+ }
+ }
+ // have us a little something to compare against
+ $previous_element = $images[$i];
+ }
+}
+
+// if last element in the directory was a directory we don't want to miss it :)
+if(count($second_level_images)>0) {
+ $tl->addTile(new \OC\Pictures\TileStack($second_level_images, $prev_dir_arr[0]));
+}
+
+// if last element in the directory was a directory with no second_level_images we also don't want to miss it ...
+if(count($fallback_images)>0) {
+ $tl->addTile(new \OC\Pictures\TileStack($fallback_images, $prev_dir_arr[0]));
+}
+
+// and finally our images actually stored in the root folder
+for($i = 0; $iaddTile(new \OC\Pictures\TileSingle($root_images[$i]));
+}
+
$tmpl = new OCP\Template( 'gallery', 'index', 'user' );
+$tmpl->assign('root', $root);
+$tmpl->assign('tl', $tl, false);
$tmpl->printPage();
?>
diff --git a/apps/gallery/js/pictures.js b/apps/gallery/js/pictures.js
index 678c9bcbf5..3a79788968 100644
--- a/apps/gallery/js/pictures.js
+++ b/apps/gallery/js/pictures.js
@@ -1,4 +1,3 @@
-
function constructSharingPath() {
return document.location.protocol + '//' + document.location.host + OC.linkTo('', 'public.php') + '?service=gallery&token=' + Albums.token;
}
@@ -35,3 +34,35 @@ function shareGallery() {
});
});
}
+
+function explode(element) {
+ $('div', element).each(function(index, elem) {
+ if ($(elem).hasClass('title')) {
+ $(elem).addClass('visible');
+ } else {
+ $(elem).css('margin-top', Math.floor(30-(Math.random()*60)) + 'px')
+ .css('margin-left', Math.floor(30-(Math.random()*60))+ 'px')
+ .css('z-index', '999');
+ }
+ });
+}
+
+function deplode(element) {
+ $('div', element).each(function(index, elem) {
+ if ($(elem).hasClass('title')) {
+ $(elem).removeClass('visible');
+ } else {
+ $(elem).css('margin-top', Math.floor(5-(Math.random()*10)) + 'px')
+ .css('margin-left', Math.floor(5-(Math.random()*10))+ 'px')
+ .css('z-index', '3');
+ }
+ });
+}
+
+function openNewGal(album_name) {
+ root = root + album_name + "/";
+ var url = window.location.toString().replace(window.location.search, '');
+ url = url + "?app=gallery&root="+encodeURIComponent(root);
+
+ window.location = url;
+}
diff --git a/apps/gallery/templates/index.php b/apps/gallery/templates/index.php
index bf4f117c7d..1890552fc0 100644
--- a/apps/gallery/templates/index.php
+++ b/apps/gallery/templates/index.php
@@ -1,52 +1,6 @@
-
-
+?>
these are taken for the stack preview
-
-for($i = 0; $i < count($images); $i++) {
- $prev_dir_arr = explode('/', $previous_element);
- $dir_arr = explode('/', $images[$i]);
-
- if(count($dir_arr) == 1) { // getting the images in this directory
- $root_images[] = $root.$images[$i];
- } else {
- if(strcmp($prev_dir_arr[0], $dir_arr[0]) != 0) { // if we entered a new directory
- if(count($second_level_images) == 0) { // if we don't have images in this directory
- if(count($fallback_images) != 0) { // but have fallback_images
- $tl->addTile(new \OC\Pictures\TileStack($fallback_images, $prev_dir_arr[0]));
- $fallback_images = array();
- }
- } else { // if we collected images for this directory
- $tl->addTile(new \OC\Pictures\TileStack($second_level_images, $prev_dir_arr[0]));
- $fallback_images = array();
- $second_level_images = array();
- }
- }
- if (count($dir_arr) == 2) { // These are the pics in our current subdir
- $second_level_images[] = $root.$images[$i];
- $fallback_images = array();
- } else { // These are images from the deeper directories
- if(count($second_level_images) == 0) {
- $fallback_images[] = $root.$images[$i];
- }
- }
- // have us a little something to compare against
- $previous_element = $images[$i];
- }
-}
-
-// if last element in the directory was a directory we don't want to miss it :)
-if(count($second_level_images)>0) {
- $tl->addTile(new \OC\Pictures\TileStack($second_level_images, $prev_dir_arr[0]));
-}
-
-// if last element in the directory was a directory with no second_level_images we also don't want to miss it ...
-if(count($fallback_images)>0) {
- $tl->addTile(new \OC\Pictures\TileStack($fallback_images, $prev_dir_arr[0]));
-}
-
-// and finally our images actually stored in the root folder
-for($i = 0; $iaddTile(new \OC\Pictures\TileSingle($root_images[$i]));
-}
-
-echo $tl->get();
+echo $_['tl']->get();
?>
diff --git a/lib/fileproxy/quota.php b/lib/fileproxy/quota.php
index b0c3775b9d..7316224cc6 100644
--- a/lib/fileproxy/quota.php
+++ b/lib/fileproxy/quota.php
@@ -55,7 +55,12 @@ class OC_FileProxy_Quota extends OC_FileProxy{
*/
private function getFreeSpace(){
$rootInfo=OC_FileCache_Cached::get('');
- $sharedInfo=OC_FileCache_Cached::get('/Shared');
+ // TODO Remove after merge of share_api
+ if (OC_FileCache::inCache('/Shared')) {
+ $sharedInfo=OC_FileCache_Cached::get('/Shared');
+ } else {
+ $sharedInfo = null;
+ }
$usedSpace=isset($rootInfo['size'])?$rootInfo['size']:0;
$usedSpace=isset($sharedInfo['size'])?$usedSpace-$sharedInfo['size']:$usedSpace;
$totalSpace=$this->getQuota();