From a7b048dc05b4fd5d81cf769e1662e1381b305682 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Sat, 17 Dec 2011 20:05:54 +0100 Subject: [PATCH 1/8] Added thumbnails to contact list. The contacts have a default thumbnail when the page is first loaded. Once the page is loaded the thumbnails will be lazy-loaded to the contacts viewable. --- apps/contacts/css/styles.css | 1 + apps/contacts/js/interface.js | 146 ++++++++++++++++++++++++++++++ apps/contacts/templates/index.php | 3 +- 3 files changed, 149 insertions(+), 1 deletion(-) diff --git a/apps/contacts/css/styles.css b/apps/contacts/css/styles.css index f351589fe1..8678ca9924 100644 --- a/apps/contacts/css/styles.css +++ b/apps/contacts/css/styles.css @@ -1,3 +1,4 @@ +#contacts li { padding-left:25px;background:url('../img/person.svg') no-repeat; } #contacts_details_name { font-weight:bold;font-size:1.1em;margin-left:25%;} #contacts_details_photo { margin:.5em 0em .5em 25%; } diff --git a/apps/contacts/js/interface.js b/apps/contacts/js/interface.js index eb81e87268..93fb13372b 100644 --- a/apps/contacts/js/interface.js +++ b/apps/contacts/js/interface.js @@ -1,3 +1,118 @@ +Contacts={ + UI:{ + showCardDAVUrl:function(username, bookname){ + $('#carddav_url').val(totalurl + '/' + username + '/' + bookname); + $('#carddav_url').show(); + $('#carddav_url_close').show(); + }, + Addressbooks:{ + overview:function(){ + if($('#chooseaddressbook_dialog').dialog('isOpen') == true){ + $('#chooseaddressbook_dialog').dialog('moveToTop'); + }else{ + $('#dialog_holder').load(OC.filePath('contacts', 'ajax', 'chooseaddressbook.php'), function(){ + $('#chooseaddressbook_dialog').dialog({ + width : 600, + close : function(event, ui) { + $(this).dialog('destroy').remove(); + } + }); + }); + } + }, + activation:function(checkbox, bookid) + { + $.post(OC.filePath('contacts', 'ajax', 'activation.php'), { bookid: bookid, active: checkbox.checked?1:0 }, + function(data) { + /* + * Arguments: + * data.status + * data.bookid + * data.active + */ + if (data.status == 'success'){ + checkbox.checked = data.active == 1; + Contacts.UI.Contacts.update(); + } + }); + }, + newAddressbook:function(object){ + var tr = $(document.createElement('tr')) + .load(OC.filePath('contacts', 'ajax', 'addbook.php')); + $(object).closest('tr').after(tr).hide(); + /* TODO: Shouldn't there be some kinda error checking here? */ + }, + editAddressbook:function(object, bookid){ + var tr = $(document.createElement('tr')) + .load(OC.filePath('contacts', 'ajax', 'editaddressbook.php') + "?bookid="+bookid); + $(object).closest('tr').after(tr).hide(); + }, + deleteAddressbook:function(bookid){ + var check = confirm("Do you really want to delete this address book?"); + if(check == false){ + return false; + }else{ + $.post(OC.filePath('contacts', 'ajax', 'deletebook.php'), { id: bookid}, + function(data) { + if (data.status == 'success'){ + $('#chooseaddressbook_dialog').dialog('destroy').remove(); + Contacts.UI.Contacts.update(); + Contacts.UI.Addressbooks.overview(); + } else { + alert('Error: ' + data.message); + } + }); + } + }, + submit:function(button, bookid){ + var displayname = $("#displayname_"+bookid).val(); + var active = $("#edit_active_"+bookid+":checked").length; + var description = $("#description_"+bookid).val(); + + var url; + if (bookid == 'new'){ + url = OC.filePath('contacts', 'ajax', 'createaddressbook.php'); + }else{ + url = OC.filePath('contacts', 'ajax', 'updateaddressbook.php'); + } + $.post(url, { id: bookid, name: displayname, active: active, description: description }, + function(data){ + if(data.status == 'success'){ + $(button).closest('tr').prev().html(data.page).show().next().remove(); + } + }); + Contacts.UI.Contacts.update(); + }, + cancel:function(button, bookid){ + $(button).closest('tr').prev().show().next().remove(); + } + }, + Contacts:{ + update:function(){ + $.getJSON('ajax/contacts.php',{},function(jsondata){ + if(jsondata.status == 'success'){ + $('#contacts').html(jsondata.data.page); + } + else{ + alert(jsondata.data.message); + } + }); + /* + var contactlist = $('#contacts'); + var contacts = contactlist.children('li').get(); + //alert(contacts); + contacts.sort(function(a, b) { + var compA = $(a).text().toUpperCase(); + var compB = $(b).text().toUpperCase(); + return (compA < compB) ? -1 : (compA > compB) ? 1 : 0; + }) + $.each(contacts, function(idx, itm) { contactlist.append(itm); }); + */ + } + } + } +} + $(document).ready(function(){ /*------------------------------------------------------------------------- * Event handlers @@ -79,6 +194,11 @@ $(document).ready(function(){ return false; }); + $('#chooseaddressbook').click(function(){ + Contacts.UI.Addressbooks.overview(); + return false; + }); + $('#contacts_newcontact').click(function(){ $.getJSON('ajax/showaddcard.php',{},function(jsondata){ if(jsondata.status == 'success'){ @@ -159,4 +279,30 @@ $(document).ready(function(){ }); $('#contacts_addcardform select').chosen(); + + $('#contacts li').bind('inview', function(event, isInView, visiblePartX, visiblePartY) { + if (isInView) { //NOTE: I've kept all conditions for future reference ;-) + // element is now visible in the viewport + if (visiblePartY == 'top') { + // top part of element is visible + } else if (visiblePartY == 'bottom') { + // bottom part of element is visible + } else { + // whole part of element is visible + if (!$(this).attr('style')) { + //alert($(this).data('id') + ' has background: ' + $(this).attr('style')); + $(this).css('background','url(thumbnail.php?id='+$(this).data('id')+') no-repeat'); + }/* else { + alert($(this).data('id') + ' has style ' + $(this).attr('style').match('url')); + }*/ + } + } else { + // element has gone out of viewport + } + }); + /* + $('#contacts li').each(function(index) { + $(this).css('background','url(thumbnail.php?id='+$(this).data('id')+') no-repeat'); + }); + */ }); diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php index 649c4807dd..bada45ee0e 100644 --- a/apps/contacts/templates/index.php +++ b/apps/contacts/templates/index.php @@ -1,5 +1,6 @@ @@ -10,7 +11,7 @@ OC_Util::addStyle('contacts','formtastic');
-
From 092c41f375d70c9936bf010806dce1b34c05f43e Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Sat, 17 Dec 2011 20:38:52 +0100 Subject: [PATCH 2/8] Added missing files and tried to revert the wrong commit of app/contacts/js/interfaces.js --- apps/contacts/img/person.png | Bin 0 -> 978 bytes apps/contacts/img/person.svg | 175 ++++++++++++++++++++++++++++++ apps/contacts/js/interface.js | 125 --------------------- apps/contacts/js/jquery.inview.js | 118 ++++++++++++++++++++ apps/contacts/thumbnail.php | 150 +++++++++++++++++++++++++ 5 files changed, 443 insertions(+), 125 deletions(-) create mode 100644 apps/contacts/img/person.png create mode 100644 apps/contacts/img/person.svg create mode 100644 apps/contacts/js/jquery.inview.js create mode 100644 apps/contacts/thumbnail.php diff --git a/apps/contacts/img/person.png b/apps/contacts/img/person.png new file mode 100644 index 0000000000000000000000000000000000000000..17e791965402a1b9335d662b8909a8d392870416 GIT binary patch literal 978 zcmV;@11f z>ysiVXfH*oNTJCUiFBe(drhk73P%(vLc>+5PZUT{oPpR;i~#{&+v}a3AMd4!5#+!p zd8F5j_I>uN*?H?QGsdl*ot;1k@q-ZJYi3?_9OrK$dP_t;NX z^YimxluD%_m&;)=7@*l~Chd0nuYSM(tX8YV_w|Z#X|vhv>teB3URhZQJkLX~*8>1l ztJR=TD3r6=?CXbm$HL6~qFgTf#u#X=K|~l1hv@hFD3wY+GryP!Hpa|)o`)n!V66oa zftewtgzx*%TF*`d12~JK2&2Te@xfpK0A~}yMD(H8>%m$Jtu?gPFvi@#MD$@ISShvN z?RI&T*cbz242TF}7_!!SeYwhn7!Rzbme=_qg zdwY9ON`Z)At;NB?0j#xutgWrRn+OJgsi~>AzVGY9!$VwOU*qKD1X4=M<#Iod>-!`u zgotNmW@ILlL95k*loE4ub212m?zp}OM|yX6cS>vhEr9PTl}e^iD0o*_SD2oj#_8#) zIzB#*nE6#4$8T!2n))PMuh(aTAow1@%f-b-cWG%UU}iL%O@v{Hd_Ip-sRX4I8jXg$ zxVVUj=*KV&-)wAb$a~@K?d{Kn5C_$2HMg*^;CY@0W`?!)ri?ML)*_Wk!Sg)Cag0Wz z5ucx*heY(OR;zUYAay&fQtIXM^73cJVlg!w4&gWs9LE6wFf)kgrj$~!*1~mNR4SEB z5Co}4qwx)ZS0BOF+NVJfr273nj4>a>2%s-=BFd;4y?6)JQ~;0kLLEe z??Y>?;W!Rl*M-*l@o4|fbyG?`a$OfhgeZ#cqooujJTM?zTU*ZoJa=8U?7Hp~$8o+S zq6KU1l + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/contacts/js/interface.js b/apps/contacts/js/interface.js index 93fb13372b..d4b08deb41 100644 --- a/apps/contacts/js/interface.js +++ b/apps/contacts/js/interface.js @@ -1,118 +1,3 @@ -Contacts={ - UI:{ - showCardDAVUrl:function(username, bookname){ - $('#carddav_url').val(totalurl + '/' + username + '/' + bookname); - $('#carddav_url').show(); - $('#carddav_url_close').show(); - }, - Addressbooks:{ - overview:function(){ - if($('#chooseaddressbook_dialog').dialog('isOpen') == true){ - $('#chooseaddressbook_dialog').dialog('moveToTop'); - }else{ - $('#dialog_holder').load(OC.filePath('contacts', 'ajax', 'chooseaddressbook.php'), function(){ - $('#chooseaddressbook_dialog').dialog({ - width : 600, - close : function(event, ui) { - $(this).dialog('destroy').remove(); - } - }); - }); - } - }, - activation:function(checkbox, bookid) - { - $.post(OC.filePath('contacts', 'ajax', 'activation.php'), { bookid: bookid, active: checkbox.checked?1:0 }, - function(data) { - /* - * Arguments: - * data.status - * data.bookid - * data.active - */ - if (data.status == 'success'){ - checkbox.checked = data.active == 1; - Contacts.UI.Contacts.update(); - } - }); - }, - newAddressbook:function(object){ - var tr = $(document.createElement('tr')) - .load(OC.filePath('contacts', 'ajax', 'addbook.php')); - $(object).closest('tr').after(tr).hide(); - /* TODO: Shouldn't there be some kinda error checking here? */ - }, - editAddressbook:function(object, bookid){ - var tr = $(document.createElement('tr')) - .load(OC.filePath('contacts', 'ajax', 'editaddressbook.php') + "?bookid="+bookid); - $(object).closest('tr').after(tr).hide(); - }, - deleteAddressbook:function(bookid){ - var check = confirm("Do you really want to delete this address book?"); - if(check == false){ - return false; - }else{ - $.post(OC.filePath('contacts', 'ajax', 'deletebook.php'), { id: bookid}, - function(data) { - if (data.status == 'success'){ - $('#chooseaddressbook_dialog').dialog('destroy').remove(); - Contacts.UI.Contacts.update(); - Contacts.UI.Addressbooks.overview(); - } else { - alert('Error: ' + data.message); - } - }); - } - }, - submit:function(button, bookid){ - var displayname = $("#displayname_"+bookid).val(); - var active = $("#edit_active_"+bookid+":checked").length; - var description = $("#description_"+bookid).val(); - - var url; - if (bookid == 'new'){ - url = OC.filePath('contacts', 'ajax', 'createaddressbook.php'); - }else{ - url = OC.filePath('contacts', 'ajax', 'updateaddressbook.php'); - } - $.post(url, { id: bookid, name: displayname, active: active, description: description }, - function(data){ - if(data.status == 'success'){ - $(button).closest('tr').prev().html(data.page).show().next().remove(); - } - }); - Contacts.UI.Contacts.update(); - }, - cancel:function(button, bookid){ - $(button).closest('tr').prev().show().next().remove(); - } - }, - Contacts:{ - update:function(){ - $.getJSON('ajax/contacts.php',{},function(jsondata){ - if(jsondata.status == 'success'){ - $('#contacts').html(jsondata.data.page); - } - else{ - alert(jsondata.data.message); - } - }); - /* - var contactlist = $('#contacts'); - var contacts = contactlist.children('li').get(); - //alert(contacts); - contacts.sort(function(a, b) { - var compA = $(a).text().toUpperCase(); - var compB = $(b).text().toUpperCase(); - return (compA < compB) ? -1 : (compA > compB) ? 1 : 0; - }) - $.each(contacts, function(idx, itm) { contactlist.append(itm); }); - */ - } - } - } -} - $(document).ready(function(){ /*------------------------------------------------------------------------- * Event handlers @@ -194,11 +79,6 @@ $(document).ready(function(){ return false; }); - $('#chooseaddressbook').click(function(){ - Contacts.UI.Addressbooks.overview(); - return false; - }); - $('#contacts_newcontact').click(function(){ $.getJSON('ajax/showaddcard.php',{},function(jsondata){ if(jsondata.status == 'success'){ @@ -300,9 +180,4 @@ $(document).ready(function(){ // element has gone out of viewport } }); - /* - $('#contacts li').each(function(index) { - $(this).css('background','url(thumbnail.php?id='+$(this).data('id')+') no-repeat'); - }); - */ }); diff --git a/apps/contacts/js/jquery.inview.js b/apps/contacts/js/jquery.inview.js new file mode 100644 index 0000000000..a38ab16497 --- /dev/null +++ b/apps/contacts/js/jquery.inview.js @@ -0,0 +1,118 @@ +/** + * author Christopher Blum + * - based on the idea of Remy Sharp, http://remysharp.com/2009/01/26/element-in-view-event-plugin/ + * - forked from http://github.com/zuk/jquery.inview/ + */ +(function ($) { + var inviewObjects = {}, viewportSize, viewportOffset, + d = document, w = window, documentElement = d.documentElement, expando = $.expando; + + $.event.special.inview = { + add: function(data) { + inviewObjects[data.guid + "-" + this[expando]] = { data: data, $element: $(this) }; + }, + + remove: function(data) { + try { delete inviewObjects[data.guid + "-" + this[expando]]; } catch(e) {} + } + }; + + function getViewportSize() { + var mode, domObject, size = { height: w.innerHeight, width: w.innerWidth }; + + // if this is correct then return it. iPad has compat Mode, so will + // go into check clientHeight/clientWidth (which has the wrong value). + if (!size.height) { + mode = d.compatMode; + if (mode || !$.support.boxModel) { // IE, Gecko + domObject = mode === 'CSS1Compat' ? + documentElement : // Standards + d.body; // Quirks + size = { + height: domObject.clientHeight, + width: domObject.clientWidth + }; + } + } + + return size; + } + + function getViewportOffset() { + return { + top: w.pageYOffset || documentElement.scrollTop || d.body.scrollTop, + left: w.pageXOffset || documentElement.scrollLeft || d.body.scrollLeft + }; + } + + function checkInView() { + var $elements = $(), elementsLength, i = 0; + + $.each(inviewObjects, function(i, inviewObject) { + var selector = inviewObject.data.selector, + $element = inviewObject.$element; + $elements = $elements.add(selector ? $element.find(selector) : $element); + }); + + elementsLength = $elements.length; + if (elementsLength) { + viewportSize = viewportSize || getViewportSize(); + viewportOffset = viewportOffset || getViewportOffset(); + + for (; i viewportOffset.top && + elementOffset.top < viewportOffset.top + viewportSize.height && + elementOffset.left + elementSize.width > viewportOffset.left && + elementOffset.left < viewportOffset.left + viewportSize.width) { + visiblePartX = (viewportOffset.left > elementOffset.left ? + 'right' : (viewportOffset.left + viewportSize.width) < (elementOffset.left + elementSize.width) ? + 'left' : 'both'); + visiblePartY = (viewportOffset.top > elementOffset.top ? + 'bottom' : (viewportOffset.top + viewportSize.height) < (elementOffset.top + elementSize.height) ? + 'top' : 'both'); + visiblePartsMerged = visiblePartX + "-" + visiblePartY; + if (!inView || inView !== visiblePartsMerged) { + $element.data('inview', visiblePartsMerged).trigger('inview', [true, visiblePartX, visiblePartY]); + } + } else if (inView) { + $element.data('inview', false).trigger('inview', [false]); + } + } + } + } + + $(w).bind("scroll resize", function() { + viewportSize = viewportOffset = null; + }); + + // Use setInterval in order to also make sure this captures elements within + // "overflow:scroll" elements or elements that appeared in the dom tree due to + // dom manipulation and reflow + // old: $(window).scroll(checkInView); + // + // By the way, iOS (iPad, iPhone, ...) seems to not execute, or at least delays + // intervals while the user scrolls. Therefore the inview event might fire a bit late there + setInterval(checkInView, 250); +})(jQuery); \ No newline at end of file diff --git a/apps/contacts/thumbnail.php b/apps/contacts/thumbnail.php new file mode 100644 index 0000000000..bf0a6e96a5 --- /dev/null +++ b/apps/contacts/thumbnail.php @@ -0,0 +1,150 @@ +. + * + */ + +// Init owncloud +require_once('../../lib/base.php'); +OC_Util::checkLoggedIn(); +OC_Util::checkAppEnabled('contacts'); + +if(!function_exists('imagecreatefromjpeg')) { + OC_Log::write('contacts','GD module not installed',OC_Log::ERROR); + header('Content-Type: image/png'); + // TODO: Check if it works to read the file and echo the content. + return 'img/person.png'; +} + +function getStandardImage(){ + $src_img = imagecreatefrompng('img/person.png'); + header('Content-Type: image/png'); + imagepng($src_img); + imagedestroy($src_img); +} + + +$id = $_GET['id']; + +$l10n = new OC_L10N('contacts'); + +$card = OC_Contacts_VCard::find( $id ); +if( $card === false ){ + echo $l10n->t('Contact could not be found.'); + exit(); +} + +$addressbook = OC_Contacts_Addressbook::find( $card['addressbookid'] ); +if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){ + echo $l10n->t('This is not your contact.'); // This is a weird error, why would it come up? (Better feedback for users?) + exit(); +} + +$content = OC_VObject::parse($card['carddata']); + +// invalid vcard +if( is_null($content)){ + echo $l10n->t('This card is not RFC compatible.'); + exit(); +} + +// define the width and height for the thumbnail +// note that theese dimmensions are considered the maximum dimmension and are not fixed, +// because we have to keep the image ratio intact or it will be deformed +$thumbnail_width = 23; +$thumbnail_height = 23; + +// Photo :-) +foreach($content->children as $child){ + if($child->name == 'PHOTO'){ + foreach($child->parameters as $parameter){ + if( $parameter->name == 'TYPE' ){ + $mime = $parameter->value; + } + } + $data = base64_decode($child->value); + $src_img = imagecreatefromstring($data); + if ($src_img !== false) { + //gets the dimmensions of the image + $width_orig=imageSX($src_img); + $height_orig=imageSY($src_img); + $ratio_orig = $width_orig/$height_orig; + + if ($thumbnail_width/$thumbnail_height > $ratio_orig) { + $new_height = $thumbnail_width/$ratio_orig; + $new_width = $thumbnail_width; + } else { + $new_width = $thumbnail_height*$ratio_orig; + $new_height = $thumbnail_height; + } + + $x_mid = $new_width/2; //horizontal middle + $y_mid = $new_height/2; //vertical middle + + $process = imagecreatetruecolor(round($new_width), round($new_height)); + if ($process == false) { + getStandardImage(); + //echo 'Error creating process image: '.$new_width.'x'.$new_height; + OC_Log::write('contacts','Error creating process image for '.$id.' '.$new_width.'x'.$new_height,OC_Log::ERROR); + imagedestroy($process); + imagedestroy($src_img); + exit(); + } + + imagecopyresampled($process, $src_img, 0, 0, 0, 0, $new_width, $new_height, $width_orig, $height_orig); + if ($process == false) { + getStandardImage(); + //echo 'Error resampling process image: '.$new_width.'x'.$new_height; + OC_Log::write('contacts','Error resampling process image for '.$id.' '.$new_width.'x'.$new_height,OC_Log::ERROR); + imagedestroy($process); + imagedestroy($src_img); + exit(); + } + $thumb = imagecreatetruecolor($thumbnail_width, $thumbnail_height); + if ($process == false) { + getStandardImage(); + //echo 'Error creating thumb image: '.$thumbnail_width.'x'.$thumbnail_height; + OC_Log::write('contacts','Error creating thumb image for '.$id.' '.$thumbnail_width.'x'.$thumbnail_height,OC_Log::ERROR); + imagedestroy($process); + imagedestroy($src_img); + exit(); + } + imagecopyresampled($thumb, $process, 0, 0, ($x_mid-($thumbnail_width/2)), ($y_mid-($thumbnail_height/2)), $thumbnail_width, $thumbnail_height, $thumbnail_width, $thumbnail_height); + if ($thumb !== false) { + header('Content-Type: image/png'); + imagepng($thumb); + } else { + getStandardImage(); + OC_Log::write('contacts','Error resampling thumb image for '.$id.' '.$thumbnail_width.'x'.$thumbnail_height,OC_Log::ERROR); + //echo 'An error occurred resampling thumb.'; + } + imagedestroy($thumb); + imagedestroy($process); + imagedestroy($src_img); + } + else { + getStandardImage(); + } + exit(); + } +} +getStandardImage(); + +// Not found :-( +//echo $l10n->t('This card does not contain a photo.'); From a70fbcea287885c1b61c5f19ea078649e02267d2 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Wed, 28 Dec 2011 10:31:45 +0100 Subject: [PATCH 3/8] More missing js. --- apps/contacts/js/interface.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/contacts/js/interface.js b/apps/contacts/js/interface.js index 8e74cc7e9c..3190efae3c 100644 --- a/apps/contacts/js/interface.js +++ b/apps/contacts/js/interface.js @@ -108,6 +108,18 @@ Contacts={ }) $.each(contacts, function(idx, itm) { contactlist.append(itm); }); */ + setTimeout(Contacts.UI.Contacts.lazyupdate(), 500); + }, + lazyupdate:function(){ + //alert('lazyupdate'); + $('#contacts li').live('inview', function(){ + if (!$(this).attr('style')) { + //alert($(this).data('id') + ' has background: ' + $(this).attr('style')); + $(this).css('background','url(thumbnail.php?id='+$(this).data('id')+') no-repeat'); + }/* else { + alert($(this).data('id') + ' has style ' + $(this).attr('style').match('url')); + }*/ + }); } } } From 9b59bf40dff94c79cef45916c7ec6cf7d9835f14 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Wed, 28 Dec 2011 12:47:27 -0500 Subject: [PATCH 4/8] Fix encoding again and update the link after renaming files --- files/index.php | 2 +- files/js/filelist.js | 2 ++ files/templates/part.list.php | 10 +++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/files/index.php b/files/index.php index 189917150a..fc69a42bec 100644 --- a/files/index.php +++ b/files/index.php @@ -71,7 +71,7 @@ $breadcrumb = array(); $pathtohere = ""; foreach( explode( "/", $dir ) as $i ){ if( $i != "" ){ - $pathtohere .= "/".urlencode($i); + $pathtohere .= "/".str_replace('+','%20', urlencode($i)); $breadcrumb[] = array( "dir" => $pathtohere, "name" => $i ); } } diff --git a/files/js/filelist.js b/files/js/filelist.js index 16f73ed58d..c8720d5a43 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -136,6 +136,8 @@ FileList={ var newname=input.val(); tr.attr('data-file',newname); td.children('a.name').empty(); + var path = td.children('a.name').attr('href'); + td.children('a.name').attr('href', path.replace(encodeURIComponent(name), encodeURIComponent(newname))); if(newname.indexOf('.')>0){ basename=newname.substr(0,newname.lastIndexOf('.')); }else{ diff --git a/files/templates/part.list.php b/files/templates/part.list.php index 157ec4ef42..ae3f32b2e9 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -4,11 +4,15 @@ if($simple_size_color<0) $simple_size_color = 0; $relative_modified_date = relative_modified_date($file['mtime']); $relative_date_color = round((time()-$file['mtime'])/60/60/24*14); // the older the file, the brighter the shade of grey; days*14 - if($relative_date_color>200) $relative_date_color = 200; ?> - '> + if($relative_date_color>200) $relative_date_color = 200; + $name = str_replace('+','%20',urlencode($file['name'])); + $name = str_replace('%2F','/', $name); + $directory = str_replace('+','%20',urlencode($file['directory'])); + $directory = str_replace('%2F','/', $directory); ?> + '> - + From 86b65c269a858cfba953f49d7ac86a759865fcc3 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Wed, 28 Dec 2011 13:01:36 -0500 Subject: [PATCH 5/8] Keep the urls pretty, decode forward slashes for newly added directories --- files/js/filelist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/js/filelist.js b/files/js/filelist.js index c8720d5a43..35847e06df 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -40,7 +40,7 @@ FileList={ html = $('').attr({ "data-type": "dir", "data-size": size, "data-file": name}); td = $('').attr({"class": "filename", "style": 'background-image:url('+OC.imagePath('core', 'filetypes/folder.png')+')' }); td.append(''); - var link_elem = $('').attr({ "class": "name", "href": "index.php?dir="+ encodeURIComponent($('#dir').val()+'/'+name) }); + var link_elem = $('').attr({ "class": "name", "href": "index.php?dir="+ encodeURIComponent($('#dir').val()+'/'+name).replace(/%2F/g, '/') }); link_elem.append($('').addClass('nametext').text(name)); td.append(link_elem); html.append(td); From 2ea20862fcef773d4262c78835b16fb5827ecfe2 Mon Sep 17 00:00:00 2001 From: Bartek Przybylski Date: Fri, 30 Dec 2011 17:06:29 +0100 Subject: [PATCH 6/8] gallery fixes --- apps/gallery/css/styles.css | 7 +++++++ apps/gallery/lib/scanner.php | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/gallery/css/styles.css b/apps/gallery/css/styles.css index 09f9daeb6b..53c3c0901d 100644 --- a/apps/gallery/css/styles.css +++ b/apps/gallery/css/styles.css @@ -17,7 +17,14 @@ div#gallery_album_box { padding: 10px; border: solid 1px black; position: relative; + overflow: hidden; + color: #999; } + +div#gallery_album_box:hover { + color: black; +} + .leftcontent div#gallery_album_box { margin: 5px; } diff --git a/apps/gallery/lib/scanner.php b/apps/gallery/lib/scanner.php index ef21032796..59c34b8e69 100644 --- a/apps/gallery/lib/scanner.php +++ b/apps/gallery/lib/scanner.php @@ -21,7 +21,9 @@ class OC_Gallery_Scanner { public static function scanDir($path, &$albums) { $current_album = array('name'=> $path, 'imagesCount' => 0, 'images' => array()); $current_album['name'] = str_replace('/', '.', str_replace(OC::$CONFIG_DATADIRECTORY, '', $current_album['name'])); - $current_album['name'] = ($current_album['name']==='')?'main':$current_album['name']; + $current_album['name'] = ($current_album['name']==='') ? + 'main' : + trim($current_album['name'],'.'); if ($dh = OC_Filesystem::opendir($path)) { while (($filename = readdir($dh)) !== false) { From 31663cfff5c32b90bf41c6af46f3042db8699fe2 Mon Sep 17 00:00:00 2001 From: Bartek Przybylski Date: Fri, 30 Dec 2011 17:47:14 +0100 Subject: [PATCH 7/8] contacts entry duplication fix --- apps/contacts/templates/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php index 9e63b20198..90143f25fa 100644 --- a/apps/contacts/templates/index.php +++ b/apps/contacts/templates/index.php @@ -1,5 +1,5 @@ Date: Fri, 30 Dec 2011 20:38:56 +0100 Subject: [PATCH 8/8] Include PostgreSQL when checking for available database drivers. Signed-off-by: Brice Maron --- lib/util.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/util.php b/lib/util.php index 0f79948bc2..9cf78da6e9 100644 --- a/lib/util.php +++ b/lib/util.php @@ -175,8 +175,8 @@ class OC_Util { $errors=array(); //check for database drivers - if(!is_callable('sqlite_open') and !is_callable('mysql_connect')){ - $errors[]=array('error'=>'No database drivers (sqlite or mysql) installed.
','hint'=>'');//TODO: sane hint + if(!is_callable('sqlite_open') and !is_callable('mysql_connect') and !is_callable('pg_connect')){ + $errors[]=array('error'=>'No database drivers (sqlite, mysql, or postgresql) installed.
','hint'=>'');//TODO: sane hint } $CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" ); $CONFIG_DBNAME = OC_Config::getValue( "dbname", "owncloud" );