Merge branch 'master' into calendar_export
This commit is contained in:
commit
82e8cb23fe
|
@ -814,7 +814,7 @@ class OC_Calendar_Object{
|
||||||
if($allday){
|
if($allday){
|
||||||
$return['start'] = $start_dt->format('Y-m-d');
|
$return['start'] = $start_dt->format('Y-m-d');
|
||||||
$end_dt->modify('-1 minute');
|
$end_dt->modify('-1 minute');
|
||||||
while($start_dt->format('U') >= $end_dt->format('U')){
|
while($start_dt >= $end_dt){
|
||||||
$end_dt->modify('+1 day');
|
$end_dt->modify('+1 day');
|
||||||
}
|
}
|
||||||
$return['end'] = $end_dt->format('Y-m-d');
|
$return['end'] = $end_dt->format('Y-m-d');
|
||||||
|
|
|
@ -47,4 +47,4 @@ if(!$id) {
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
OCP\JSON::success(array('data' => array( 'id' => $id )));
|
OCP\JSON::success(array('data' => array( 'id' => $id, 'aid' => $aid )));
|
||||||
|
|
|
@ -17,14 +17,25 @@ function cmp($a, $b)
|
||||||
OCP\JSON::checkLoggedIn();
|
OCP\JSON::checkLoggedIn();
|
||||||
OCP\JSON::checkAppEnabled('contacts');
|
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());
|
$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
|
// Our new array for the contacts sorted by addressbook
|
||||||
$contacts_addressbook = array();
|
|
||||||
foreach($contacts_alphabet as $contact) {
|
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());
|
$contacts_addressbook[$contact['addressbookid']] = array('contacts' => array());
|
||||||
}
|
}
|
||||||
$display = trim($contact['fullname']);
|
$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));
|
$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');
|
uasort($contacts_addressbook, 'cmp');
|
||||||
|
|
||||||
$tmpl = new OCP\Template("contacts", "part.contacts");
|
$tmpl = new OCP\Template("contacts", "part.contacts");
|
||||||
|
|
|
@ -174,7 +174,7 @@ Contacts={
|
||||||
// TODO: Take addressbook into account
|
// TODO: Take addressbook into account
|
||||||
$('#fn').change(function(){
|
$('#fn').change(function(){
|
||||||
var name = $('#fn').val().strip_tags();
|
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);
|
$(item).find('a').html(name);
|
||||||
Contacts.UI.Card.fn = name;
|
Contacts.UI.Card.fn = name;
|
||||||
var added = false;
|
var added = false;
|
||||||
|
@ -186,7 +186,7 @@ Contacts={
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(!added) {
|
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);
|
Contacts.UI.Contacts.scrollTo(Contacts.UI.Card.id);
|
||||||
});
|
});
|
||||||
|
@ -250,8 +250,10 @@ Contacts={
|
||||||
var newid, firstitem;
|
var newid, firstitem;
|
||||||
if(!id) {
|
if(!id) {
|
||||||
firstitem = $('#contacts:first-child li:first-child');
|
firstitem = $('#contacts:first-child li:first-child');
|
||||||
|
if(firstitem.length > 0) {
|
||||||
newid = firstitem.data('id');
|
newid = firstitem.data('id');
|
||||||
bookid = firstitem.data('bookid');
|
bookid = firstitem.data('bookid');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
newid = id;
|
newid = id;
|
||||||
}
|
}
|
||||||
|
@ -269,7 +271,7 @@ Contacts={
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure proper DOM is loaded.
|
// Make sure proper DOM is loaded.
|
||||||
if(!$('#card')[0]) {
|
if(!$('#card')[0] && newid) {
|
||||||
$.getJSON(OC.filePath('contacts', 'ajax', 'loadcard.php'),{},function(jsondata){
|
$.getJSON(OC.filePath('contacts', 'ajax', 'loadcard.php'),{},function(jsondata){
|
||||||
if(jsondata.status == 'success'){
|
if(jsondata.status == 'success'){
|
||||||
$('#rightcontent').html(jsondata.data.page).ready(function() {
|
$('#rightcontent').html(jsondata.data.page).ready(function() {
|
||||||
|
@ -281,7 +283,7 @@ Contacts={
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if($('.contacts li').length == 0) {
|
else if(!newid) {
|
||||||
// load intro page
|
// load intro page
|
||||||
$.getJSON(OC.filePath('contacts', 'ajax', 'loadintro.php'),{},function(jsondata){
|
$.getJSON(OC.filePath('contacts', 'ajax', 'loadintro.php'),{},function(jsondata){
|
||||||
if(jsondata.status == 'success'){
|
if(jsondata.status == 'success'){
|
||||||
|
@ -316,13 +318,14 @@ Contacts={
|
||||||
if (jsondata.status == 'success'){
|
if (jsondata.status == 'success'){
|
||||||
$('#rightcontent').data('id',jsondata.data.id);
|
$('#rightcontent').data('id',jsondata.data.id);
|
||||||
var 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){
|
$.getJSON(OC.filePath('contacts', 'ajax', 'contactdetails.php'),{'id':id},function(jsondata){
|
||||||
if(jsondata.status == 'success'){
|
if(jsondata.status == 'success'){
|
||||||
Contacts.UI.Card.loadContact(jsondata.data, aid);
|
Contacts.UI.Card.loadContact(jsondata.data, aid);
|
||||||
$('#leftcontent .active').removeClass('active');
|
$('#contacts .active').removeClass('active');
|
||||||
var item = $('<li data-id="'+jsondata.data.id+'" class="active"><a href="index.php?id='+jsondata.data.id+'" style="background: url('+OC.filePath('contacts', '', 'thumbnail.php')+'?id='+jsondata.data.id+') no-repeat scroll 0% 0% transparent;">'+Contacts.UI.Card.fn+'</a></li>');
|
var item = $('<li data-id="'+jsondata.data.id+'" class="active"><a href="index.php?id='+jsondata.data.id+'" style="background: url('+OC.filePath('contacts', '', 'thumbnail.php')+'?id='+jsondata.data.id+') no-repeat scroll 0% 0% transparent;">'+Contacts.UI.Card.fn+'</a></li>');
|
||||||
var added = false;
|
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()) {
|
if ($(this).text().toLowerCase() > Contacts.UI.Card.fn.toLowerCase()) {
|
||||||
$(this).before(item).fadeIn('fast');
|
$(this).before(item).fadeIn('fast');
|
||||||
added = true;
|
added = true;
|
||||||
|
@ -330,7 +333,7 @@ Contacts={
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(!added) {
|
if(!added) {
|
||||||
$('#leftcontent ul').append(item);
|
$('#contacts ul[data-id="'+aid+'"]').append(item);
|
||||||
}
|
}
|
||||||
if(isnew) { // add some default properties
|
if(isnew) { // add some default properties
|
||||||
Contacts.UI.Card.addProperty('EMAIL');
|
Contacts.UI.Card.addProperty('EMAIL');
|
||||||
|
@ -374,7 +377,7 @@ Contacts={
|
||||||
$.post(OC.filePath('contacts', 'ajax', 'deletecard.php'),{'id':Contacts.UI.Card.id},function(jsondata){
|
$.post(OC.filePath('contacts', 'ajax', 'deletecard.php'),{'id':Contacts.UI.Card.id},function(jsondata){
|
||||||
if(jsondata.status == 'success'){
|
if(jsondata.status == 'success'){
|
||||||
var newid = '', bookid;
|
var newid = '', bookid;
|
||||||
var curlistitem = $('#leftcontent [data-id="'+jsondata.data.id+'"]');
|
var curlistitem = $('#contacts li[data-id="'+jsondata.data.id+'"]');
|
||||||
var newlistitem = curlistitem.prev();
|
var newlistitem = curlistitem.prev();
|
||||||
if(newlistitem == undefined) {
|
if(newlistitem == undefined) {
|
||||||
newlistitem = curlistitem.next();
|
newlistitem = curlistitem.next();
|
||||||
|
@ -1541,13 +1544,16 @@ Contacts={
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
refreshThumbnail:function(id){
|
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.html(Contacts.UI.Card.fn);
|
||||||
item.css('background','url('+OC.filePath('contacts', '', 'thumbnail.php')+'?id='+id+'&refresh=1'+Math.random()+') no-repeat');
|
item.css('background','url('+OC.filePath('contacts', '', 'thumbnail.php')+'?id='+id+'&refresh=1'+Math.random()+') no-repeat');
|
||||||
},
|
},
|
||||||
scrollTo:function(id){
|
scrollTo:function(id){
|
||||||
|
var item = $('#contacts li[data-id="'+id+'"]');
|
||||||
|
if(item) {
|
||||||
$('.contacts').animate({
|
$('.contacts').animate({
|
||||||
scrollTop: $('#leftcontent li[data-id="'+id+'"]').offset().top-20}, 'slow','swing');
|
scrollTop: $('#contacts li[data-id="'+id+'"]').offset().top-20}, 'slow','swing');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,12 +172,11 @@ class OC_Contacts_Addressbook{
|
||||||
if(!$prefbooks){
|
if(!$prefbooks){
|
||||||
$addressbooks = OC_Contacts_Addressbook::all($uid);
|
$addressbooks = OC_Contacts_Addressbook::all($uid);
|
||||||
if(count($addressbooks) == 0){
|
if(count($addressbooks) == 0){
|
||||||
OC_Contacts_Addressbook::add($uid,'default','Default Address Book');
|
$id = OC_Contacts_Addressbook::add($uid,'default','Default Address Book');
|
||||||
$addressbooks = OC_Contacts_Addressbook::all($uid);
|
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);
|
return explode(';',$prefbooks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +194,7 @@ class OC_Contacts_Addressbook{
|
||||||
$stmt = OCP\DB::prepare( $prep );
|
$stmt = OCP\DB::prepare( $prep );
|
||||||
$result = $stmt->execute($active);
|
$result = $stmt->execute($active);
|
||||||
} catch(Exception $e) {
|
} 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, ids: '.join(',', $active),OCP\Util::DEBUG);
|
||||||
OCP\Util::writeLog('contacts','OC_Contacts_Addressbook::active, SQL:'.$prep,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
|
* @brief Activates an addressbook
|
||||||
* @param integer $id
|
* @param integer $id
|
||||||
* @param integer $name
|
* @param boolean $active
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static function setActive($id,$active){
|
public static function setActive($id,$active){
|
||||||
|
@ -256,10 +255,14 @@ class OC_Contacts_Addressbook{
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static function delete($id){
|
public static function delete($id){
|
||||||
// FIXME: There's no error checking at all.
|
|
||||||
self::setActive($id, false);
|
self::setActive($id, false);
|
||||||
|
try {
|
||||||
$stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*contacts_addressbooks WHERE id = ?' );
|
$stmt = OCP\DB::prepare( 'DELETE FROM *PREFIX*contacts_addressbooks WHERE id = ?' );
|
||||||
$stmt->execute(array($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);
|
$cards = OC_Contacts_VCard::all($id);
|
||||||
foreach($cards as $card){
|
foreach($cards as $card){
|
||||||
|
|
|
@ -56,7 +56,7 @@ class OC_Contacts_VCard{
|
||||||
$stmt = OCP\DB::prepare( $prep );
|
$stmt = OCP\DB::prepare( $prep );
|
||||||
$result = $stmt->execute($id);
|
$result = $stmt->execute($id);
|
||||||
} catch(Exception $e) {
|
} 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','OC_Contacts_VCard:all, ids: '.join(',', $id),OCP\Util::DEBUG);
|
||||||
OCP\Util::writeLog('contacts','SQL:'.$prep,OCP\Util::DEBUG);
|
OCP\Util::writeLog('contacts','SQL:'.$prep,OCP\Util::DEBUG);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,3 +4,11 @@ div#controls input[type=button] { -webkit-transition: opacity 0.5s ease-in-out;
|
||||||
input[type=button]:disabled { opacity: 0.5 }
|
input[type=button]:disabled { opacity: 0.5 }
|
||||||
.ui-dialog tr {background-color: #eee;}
|
.ui-dialog tr {background-color: #eee;}
|
||||||
.ui-dialog input {width: 90%;}
|
.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;}
|
||||||
|
|
|
@ -31,6 +31,70 @@ OCP\Util::addStyle('files', 'files');
|
||||||
OCP\Util::addStyle('gallery', 'styles');
|
OCP\Util::addStyle('gallery', 'styles');
|
||||||
OCP\Util::addScript('gallery', 'pictures');
|
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; $i<count($root_images); $i++) {
|
||||||
|
$tl->addTile(new \OC\Pictures\TileSingle($root_images[$i]));
|
||||||
|
}
|
||||||
|
|
||||||
$tmpl = new OCP\Template( 'gallery', 'index', 'user' );
|
$tmpl = new OCP\Template( 'gallery', 'index', 'user' );
|
||||||
|
$tmpl->assign('root', $root);
|
||||||
|
$tmpl->assign('tl', $tl, false);
|
||||||
$tmpl->printPage();
|
$tmpl->printPage();
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
function constructSharingPath() {
|
function constructSharingPath() {
|
||||||
return document.location.protocol + '//' + document.location.host + OC.linkTo('', 'public.php') + '?service=gallery&token=' + Albums.token;
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -1,52 +1,6 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
$l = OC_L10N::get('gallery');
|
|
||||||
$root = !empty($_GET['root']) ? $_GET['root'] : '/';
|
|
||||||
?>
|
|
||||||
<style>
|
|
||||||
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;}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var root = "<?php echo htmlentities($root); ?>";
|
var root = "<?php echo $_['root']; ?>";
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("a[rel=images]").fancybox({
|
$("a[rel=images]").fancybox({
|
||||||
|
@ -57,7 +11,7 @@ $(document).ready(function() {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="controls"><?php
|
<div id="controls"><?php
|
||||||
$sr = trim($root, '/');
|
$sr = trim($_['root'], '/');
|
||||||
if (!empty($sr)) {
|
if (!empty($sr)) {
|
||||||
$paths = explode('/', $sr);
|
$paths = explode('/', $sr);
|
||||||
$path = '/';
|
$path = '/';
|
||||||
|
@ -68,74 +22,12 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?> <!--<a href="javascript:shareGallery();"><input type="button" value="<?php echo $l->t('Share');?>" /></a>--><br/>
|
?><br/>
|
||||||
</div>
|
</div>
|
||||||
<div id="gallerycontent">
|
<div id="gallerycontent">
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
include('apps/gallery/lib/tiles.php');
|
echo $_['tl']->get();
|
||||||
$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; $i<count($root_images); $i++) {
|
|
||||||
$tl->addTile(new \OC\Pictures\TileSingle($root_images[$i]));
|
|
||||||
}
|
|
||||||
|
|
||||||
echo $tl->get();
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -55,7 +55,12 @@ class OC_FileProxy_Quota extends OC_FileProxy{
|
||||||
*/
|
*/
|
||||||
private function getFreeSpace(){
|
private function getFreeSpace(){
|
||||||
$rootInfo=OC_FileCache_Cached::get('');
|
$rootInfo=OC_FileCache_Cached::get('');
|
||||||
|
// TODO Remove after merge of share_api
|
||||||
|
if (OC_FileCache::inCache('/Shared')) {
|
||||||
$sharedInfo=OC_FileCache_Cached::get('/Shared');
|
$sharedInfo=OC_FileCache_Cached::get('/Shared');
|
||||||
|
} else {
|
||||||
|
$sharedInfo = null;
|
||||||
|
}
|
||||||
$usedSpace=isset($rootInfo['size'])?$rootInfo['size']:0;
|
$usedSpace=isset($rootInfo['size'])?$rootInfo['size']:0;
|
||||||
$usedSpace=isset($sharedInfo['size'])?$usedSpace-$sharedInfo['size']:$usedSpace;
|
$usedSpace=isset($sharedInfo['size'])?$usedSpace-$sharedInfo['size']:$usedSpace;
|
||||||
$totalSpace=$this->getQuota();
|
$totalSpace=$this->getQuota();
|
||||||
|
|
Loading…
Reference in New Issue