diff --git a/.gitignore b/.gitignore index e0ea724f1a..33f8e0c524 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # the default generated dir + db file data owncloud +config/config.php # just sane ignores .*.sw[po] diff --git a/apps/bookmarks/ajax/addBookmark.php b/apps/bookmarks/ajax/addBookmark.php new file mode 100644 index 0000000000..b0d1a73089 --- /dev/null +++ b/apps/bookmarks/ajax/addBookmark.php @@ -0,0 +1,70 @@ +. +* +*/ + +//no apps or filesystem +$RUNTIME_NOSETUPFS=true; + +require_once('../../../lib/base.php'); + +// We send json data +header( "Content-Type: application/jsonrequest" ); + +// Check if we are a user +if( !OC_User::isLoggedIn()){ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); + exit(); +} + +$query = OC_DB::prepare(" + INSERT IGNORE INTO *PREFIX*bookmarks + (url, title, description, user_id, public, added, lastmodified) + VALUES (?, ?, ?, ?, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()) + "); + +$params=array( + urldecode($_GET["url"]), + urldecode($_GET["title"]), + urldecode($_GET["description"]), + OC_User::getUser() + ); +$query->execute($params); +$b_id = OC_DB::insertid(); + +if($b_id !== false) { + $query = OC_DB::prepare(" + INSERT INTO *PREFIX*bookmarks_tags + (bookmark_id, tag) + VALUES (?, ?) + "); + + $tags = explode(' ', urldecode($_GET["tags"])); + foreach ($tags as $tag) { + if(empty($tag)) { + //avoid saving blankspaces + continue; + } + $params = array($b_id, trim($tag)); + $query->execute($params); + } +} + diff --git a/apps/bookmarks/ajax/delBookmark.php b/apps/bookmarks/ajax/delBookmark.php new file mode 100644 index 0000000000..a47bd2b9ea --- /dev/null +++ b/apps/bookmarks/ajax/delBookmark.php @@ -0,0 +1,52 @@ +. +* +*/ + +//no apps or filesystem +$RUNTIME_NOSETUPFS=true; + +require_once('../../../lib/base.php'); + +// We send json data +header( "Content-Type: application/jsonrequest" ); + +// Check if we are a user +if( !OC_User::isLoggedIn()){ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); + exit(); +} + +$query = OC_DB::prepare(" + DELETE FROM *PREFIX*bookmarks + WHERE url LIKE ? + AND user_id = ? + "); + +$params=array( + urldecode($_GET["url"]), + OC_User::getUser() + ); +$result = $query->execute($params); + +// var_dump($params); + +echo json_encode( array( "status" => "success", "data" => array())); diff --git a/apps/bookmarks/ajax/recordClick.php b/apps/bookmarks/ajax/recordClick.php new file mode 100644 index 0000000000..4dcb0b4a0d --- /dev/null +++ b/apps/bookmarks/ajax/recordClick.php @@ -0,0 +1,47 @@ +. +* +*/ + +//no apps or filesystem +$RUNTIME_NOSETUPFS=true; + +require_once('../../../lib/base.php'); + +// Check if we are a user +if( !OC_User::isLoggedIn()){ + header( "Content-Type: application/jsonrequest" ); + echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); + exit(); +} + +$query = OC_DB::prepare(" + UPDATE *PREFIX*bookmarks + SET clickcount = clickcount + 1 + WHERE user_id = ? + AND url LIKE ? + "); + +$params=array(OC_User::getUser(), urldecode($_GET["url"])); +$bookmarks = $query->execute($params); + +header( "HTTP/1.1 204 No Content" ); + diff --git a/apps/bookmarks/ajax/updateList.php b/apps/bookmarks/ajax/updateList.php new file mode 100644 index 0000000000..d7cf05b7a6 --- /dev/null +++ b/apps/bookmarks/ajax/updateList.php @@ -0,0 +1,66 @@ +. +* +*/ + +//no apps or filesystem +$RUNTIME_NOSETUPFS=true; + +require_once('../../../lib/base.php'); + +// We send json data +header( "Content-Type: application/jsonrequest" ); + +// Check if we are a user +if( !OC_User::isLoggedIn()){ + echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); + exit(); +} + +$params=array(OC_User::getUser()); + +//Filter for tag? +$filterTag = isset($_GET["tag"]) ? urldecode($_GET["tag"]) : false; +if($filterTag){ + $sqlFilterTag = "HAVING INSTR (tags, ?) > 0"; + $params[] = $filterTag; +} else { + $sqlFilterTag = ''; +} + +$offset = isset($_GET["page"]) ? intval($_GET["page"]) * 10 : 0; +$params[] = $offset; + +//FIXME: bookmarks without tags are not being retrieved +$query = OC_DB::prepare(" + SELECT url, title, description, GROUP_CONCAT( tag SEPARATOR ' ' ) AS tags + FROM *PREFIX*bookmarks, *PREFIX*bookmarks_tags + WHERE *PREFIX*bookmarks.id = *PREFIX*bookmarks_tags.bookmark_id + AND *PREFIX*bookmarks.user_id = ? + GROUP BY url + $sqlFilterTag + ORDER BY *PREFIX*bookmarks.id DESC + LIMIT ?, 10"); + + +$bookmarks = $query->execute($params)->fetchAll(); + +echo json_encode( array( "status" => "success", "data" => $bookmarks)); diff --git a/apps/bookmarks/appinfo/app.php b/apps/bookmarks/appinfo/app.php new file mode 100644 index 0000000000..33b7ba6144 --- /dev/null +++ b/apps/bookmarks/appinfo/app.php @@ -0,0 +1,27 @@ +. +* +*/ + +OC_App::register( array( 'order' => 70, 'id' => 'bookmark', 'name' => 'Bookmarks' )); + +OC_App::addNavigationEntry( array( 'id' => 'bookmarks_index', 'order' => 70, 'href' => OC_Helper::linkTo( 'bookmarks', 'index.php' ), 'icon' => OC_Helper::imagePath( 'bookmarks', 'bookmarks.png' ), 'name' => 'Bookmarks' )); + diff --git a/apps/bookmarks/appinfo/database.xml b/apps/bookmarks/appinfo/database.xml new file mode 100644 index 0000000000..8bfb861fc5 --- /dev/null +++ b/apps/bookmarks/appinfo/database.xml @@ -0,0 +1,127 @@ + + + *dbname* + true + false + latin1 + + *dbprefix*bookmarks + + + id + integer + 1 + 0 + true + 64 + + + url + text + + true + 4096 + + + title + text + + true + 140 + + + description + text + + true + 255 + + + user_id + text + + true + 64 + + + public + integer + 0 + 1 + + + added + integer + + false + true + 4 + + + lastmodified + integer + + false + true + 4 + + + clickcount + integer + 0 + true + true + 4 + + + + id + true + + id + descending + + + + + + + + *dbprefix*bookmarks_tags + + + bookmark_id + integer + 64 + + + + tag + text + + true + 255 + + + bookmark_tag + true + + bookmark_id + ascending + + + tag + ascending + + + + + + \ No newline at end of file diff --git a/apps/bookmarks/appinfo/info.xml b/apps/bookmarks/appinfo/info.xml new file mode 100644 index 0000000000..23aa6c219a --- /dev/null +++ b/apps/bookmarks/appinfo/info.xml @@ -0,0 +1,10 @@ + + + bookmarks + Bookmarks + Bookmark manager for ownCloud + 0.1 + AGPL + Arthur Schiwon + 2 + \ No newline at end of file diff --git a/apps/bookmarks/css/bookmarks.css b/apps/bookmarks/css/bookmarks.css new file mode 100644 index 0000000000..aa28424c0b --- /dev/null +++ b/apps/bookmarks/css/bookmarks.css @@ -0,0 +1,63 @@ +#content { overflow: auto; } + +.bookmarks_headline { + font-size: large; + font-weight: bold; + margin-left: 2em; + padding: 2.5ex 0.5ex; +} + +.bookmarks_menu { + margin-left: 1.5em; + padding: 0.5ex; +} + +.bookmark_actions { + font-size: smaller; + color: #ff44ff; + padding-left: 4em; +} + +.bookmark_actions span:hover { + cursor: pointer; + text-decoration: underline; +} + +.bookmarks_add { + display: none; +} + +.bookmarks_label { + width: 7em; + display: inline-block; + text-align: right; +} + +.bookmarks_input { + width: 20em; +} + +.bookmark_single { + margin-left: 2em; + margin-top: 3ex; + padding: 0.5ex; +/* border-bottom: 1px solid black; */ +} + +.bookmark_single:hover { + background-color: #ccccff; +} + +.bookmark_title { + font-size: larger; + color: blue; + text-decoration: underline; +} + +.bookmark_url { + color: green; +} + +.bookmark_tags { + color: #ff3333; +} \ No newline at end of file diff --git a/apps/bookmarks/img/bookmarks.png b/apps/bookmarks/img/bookmarks.png new file mode 100644 index 0000000000..b92e4f50a4 Binary files /dev/null and b/apps/bookmarks/img/bookmarks.png differ diff --git a/apps/bookmarks/index.php b/apps/bookmarks/index.php new file mode 100644 index 0000000000..ba9f7cc0c6 --- /dev/null +++ b/apps/bookmarks/index.php @@ -0,0 +1,39 @@ +. +* +*/ + +require_once('../../lib/base.php'); + +// Check if we are a user +if( !OC_User::isLoggedIn()){ + header( "Location: ".OC_Helper::linkTo( '', 'index.php' )); + exit(); +} + +OC_App::setActiveNavigationEntry( 'bookmarks_index' ); + +OC_Util::addScript('bookmarks','bookmarks'); +OC_Util::addStyle('bookmarks', 'bookmarks'); + +$tmpl = new OC_Template( 'bookmarks', 'list', 'user' ); + +$tmpl->printPage(); \ No newline at end of file diff --git a/apps/bookmarks/js/bookmarks.js b/apps/bookmarks/js/bookmarks.js new file mode 100644 index 0000000000..7624ff5d39 --- /dev/null +++ b/apps/bookmarks/js/bookmarks.js @@ -0,0 +1,94 @@ +var bookmarks_page = 0; +var bookmarks_loading = false; + +$(document).ready(function() { + $('.bookmarks_addBtn').click(function(event){ + $('.bookmarks_add').slideToggle(); + }); + + $('#bookmark_add_submit').click(addBookmark); + $(window).scroll(updateOnBottom); + + $('.bookmarks_list').empty(); + getBookmarks(); +}); + +function getBookmarks() { + if(bookmarks_loading) { + //have patience :) + return; + } + $.ajax({ + url: 'ajax/updateList.php', + data: "tag=" + encodeURI($('#bookmarkFilterTag').val()) + "&page=" + bookmarks_page, + success: function(bookmarks){ + bookmarks_page += 1; + $('.bookmark_link').unbind('click', recordClick); + $('.bookmark_delete').unbind('click', delBookmark); + + for(var i in bookmarks.data) { + updateBookmarksList(bookmarks.data[i]); + } + $('.bookmark_link').click(recordClick); + $('.bookmark_delete').click(delBookmark); + bookmarks_loading = false; + } + }); +} + +function addBookmark(event) { + $.ajax({ + url: 'ajax/addBookmark.php', + data: "url=" + encodeURI($('#bookmark_add_url').val()) + "&title=" + encodeURI($('#bookmark_add_title').val()) + "&description=" + encodeURI($('#bookmark_add_description').val()) + "&tags=" + encodeURI($('#bookmark_add_tags').val()), + success: function(data){ $('.bookmarks_add').slideToggle(); $('.bookmarks_add').children('p').children('.bookmarks_input').val(''); } + }); +} + +function delBookmark(event) { + $.ajax({ + url: 'ajax/delBookmark.php', + data: "url=" + encodeURI($(this).parent().parent().children('.bookmark_url:first').text()), + success: function(data){ alert('deleted!'); } + }); +} + +function updateBookmarksList(bookmark) { + var tags = encodeEntities(bookmark.tags).split(" "); + var taglist = ""; + for ( var i=0, len=tags.length; i" + tags[i] + " "; + } + $('.bookmarks_list').append( + "" + + "" + encodeEntities(bookmark.title) + "" + + "" + encodeEntities(bookmark.url) + "" + + "" + encodeEntities(bookmark.description) + "" + + "" + taglist + "" + + "Delete" + + "" + ); +} + +function updateOnBottom() { + //check wether user is on bottom of the page + if ($('body').height() <= ($(window).height() + $(window).scrollTop())) { + getBookmarks(); + } +} + +function recordClick(event) { + $.ajax({ + url: 'ajax/recordClick.php', + data: "url=" + encodeURI($(this).attr('href')), + }); + return false; +} + +function encodeEntities(s){ + try { + return $("").text(s).html(); + + } catch (ex) { + return ""; + } +} diff --git a/apps/bookmarks/templates/list.php b/apps/bookmarks/templates/list.php new file mode 100644 index 0000000000..278a0db524 --- /dev/null +++ b/apps/bookmarks/templates/list.php @@ -0,0 +1,18 @@ + + + + + + + URL: + Title: + Description: + Tags: + + + + + JavaScript is needed to display your Bookmarks + + You have no bookmarks + \ No newline at end of file diff --git a/apps/contacts/css/styles.css b/apps/contacts/css/styles.css index c7680f4a71..1f95fdb2ad 100644 --- a/apps/contacts/css/styles.css +++ b/apps/contacts/css/styles.css @@ -1 +1,2 @@ -.contacts_propertyname {float:left;} +.contacts_details_left {text-align:right;vertical-align:top;padding:2px;} +.contacts_details_right {text-align:left;vertical-align:top;padding:2px;} diff --git a/apps/contacts/js/interface.js b/apps/contacts/js/interface.js index ef2179b372..b8a66d51aa 100644 --- a/apps/contacts/js/interface.js +++ b/apps/contacts/js/interface.js @@ -102,12 +102,12 @@ $(document).ready(function(){ return false; }); - $('.contacts_property [data-use="edit"]').live('click',function(){ + $('.contacts_details_property [data-use="edit"]').live('click',function(){ var id = $('#rightcontent').data('id'); var checksum = $(this).parent().parent().data('checksum'); $.getJSON('ajax/showsetproperty.php',{'id': id, 'checksum': checksum },function(jsondata){ if(jsondata.status == 'success'){ - $('.contacts_property[data-checksum="'+checksum+'"] .contacts_propertyvalue').html(jsondata.data.page); + $('.contacts_details_property[data-checksum="'+checksum+'"] .contacts_details_right').html(jsondata.data.page); } else{ alert(jsondata.data.message); @@ -119,7 +119,7 @@ $(document).ready(function(){ $('#contacts_setpropertyform input[type="submit"]').live('click',function(){ $.post('ajax/setproperty.php',$('#contacts_setpropertyform').serialize(),function(jsondata){ if(jsondata.status == 'success'){ - $('.contacts_property[data-checksum="'+jsondata.data.oldchecksum+'"]').replaceWith(jsondata.data.page); + $('.contacts_details_property[data-checksum="'+jsondata.data.oldchecksum+'"]').replaceWith(jsondata.data.page); } else{ alert(jsondata.data.message); @@ -128,12 +128,12 @@ $(document).ready(function(){ return false; }); - $('.contacts_property [data-use="delete"]').live('click',function(){ + $('.contacts_details_property [data-use="delete"]').live('click',function(){ var id = $('#rightcontent').data('id'); var checksum = $(this).parent().parent().data('checksum'); $.getJSON('ajax/deleteproperty.php',{'id': id, 'checksum': checksum },function(jsondata){ if(jsondata.status == 'success'){ - $('.contacts_property[data-checksum="'+checksum+'"]').remove(); + $('.contacts_details_property[data-checksum="'+checksum+'"]').remove(); } else{ alert(jsondata.data.message); @@ -143,11 +143,11 @@ $(document).ready(function(){ }); - $('.contacts_property').live('mouseenter',function(){ + $('.contacts_details_property').live('mouseenter',function(){ $(this).find('span').show(); }); - $('.contacts_property').live('mouseleave',function(){ + $('.contacts_details_property').live('mouseleave',function(){ $(this).find('span').hide(); }); }); diff --git a/apps/contacts/lib/addressbook.php b/apps/contacts/lib/addressbook.php index bab260840d..9a5dea6f45 100644 --- a/apps/contacts/lib/addressbook.php +++ b/apps/contacts/lib/addressbook.php @@ -167,7 +167,12 @@ class OC_Contacts_Addressbook{ $uri = $property->value.'.vcf'; } } - if(is_null($uri)) $uri = self::createUID().'.vcf'; + if(is_null($uri)){ + $uid = self::createUID(); + $uri = $uid.'.vcf'; + $card->add(new Sabre_VObject_Property('UID',$uid)); + $data = $card->serialize(); + }; $stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' ); $result = $stmt->execute(array($id,$fn,$data,$uri,time())); diff --git a/apps/contacts/templates/part.details.php b/apps/contacts/templates/part.details.php index 119c88486a..5048349abc 100644 --- a/apps/contacts/templates/part.details.php +++ b/apps/contacts/templates/part.details.php @@ -1,27 +1,33 @@ - - - - - inc('part.property', array('property' => $_['details']['FN'][0])); ?> - + + + + + + + + + + + inc('part.property', array('property' => $_['details']['FN'][0])); ?> + + + inc('part.property', array('property' => $_['details']['BDAY'][0])); ?> + - - inc('part.property', array('property' => $_['details']['BDAY'][0])); ?> - + + inc('part.property', array('property' => $_['details']['ORG'][0])); ?> + - - inc('part.property', array('property' => $_['details']['ORG'][0])); ?> - - - - - - - inc('part.property',array('property' => $property )); ?> + + + + inc('part.property',array('property' => $property )); ?> + + - - + + diff --git a/apps/contacts/templates/part.property.php b/apps/contacts/templates/part.property.php index cdb0306812..9e2a5cabad 100644 --- a/apps/contacts/templates/part.property.php +++ b/apps/contacts/templates/part.property.php @@ -1,49 +1,49 @@ - + - t('Name'); ?> - + t('Name'); ?> + - + - t('Birthday'); ?> - + t('Birthday'); ?> + l('date',new DateTime($_['property']['value'])); ?> - + - t('Organisation'); ?> - + t('Organisation'); ?> + - + - t('Email'); ?> - + t('Email'); ?> + - + - t('Telephone'); ?> - + t('Telephone'); ?> + (t('tel_'.strtolower($_['property']['parameters']['TYPE'])); ?>) - + - + t('Address'); ?> (t('adr_'.strtolower($_['property']['parameters']['TYPE'])); ?>) - - + + t('PO Box'); ?> t('Extended Address'); ?> t('Street Name'); ?> @@ -53,6 +53,6 @@ t('Country'); ?> - + - + diff --git a/config/.gitignore b/config/.gitignore deleted file mode 100755 index d09f42a238..0000000000 --- a/config/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -#autogenerated -config.php diff --git a/core/ajax/grouplist.php b/core/ajax/grouplist.php new file mode 100644 index 0000000000..9b6c4bfa8a --- /dev/null +++ b/core/ajax/grouplist.php @@ -0,0 +1,45 @@ +. +* +*/ + + +// We send json data +header( "Content-Type: application/jsonrequest" ); + +$RUNTIME_NOAPPS = TRUE; //no apps, yet +require_once('../../lib/base.php'); + +if(isset($_GET["user"]) && isset($_GET["password"])) +{ + if(!OC_User::checkPassword($_GET["user"], $_GET["password"])) + exit(); + + $groups = array(); + + foreach( OC_Group::getGroups() as $i ){ + // Do some more work here soon + $groups[] = array( "groupname" => $i ); + } + + echo json_encode($groups); +} +?> diff --git a/core/ajax/userlist.php b/core/ajax/userlist.php new file mode 100644 index 0000000000..16e89c2ee8 --- /dev/null +++ b/core/ajax/userlist.php @@ -0,0 +1,47 @@ +. +* +*/ + + +// We send json data +header( "Content-Type: application/jsonrequest" ); + +$RUNTIME_NOAPPS = TRUE; //no apps, yet +require_once('../../lib/base.php'); + +if(isset($_GET["user"]) && isset($_GET["password"])) +{ + if(!OC_User::checkPassword($_GET["user"], $_GET["password"])) + exit(); + + $users = array(); + + foreach( OC_User::getUsers() as $i ){ + $users[] = array( "username" => $i, "groups" => join( ", ", OC_Group::getUserGroups( $i ) )); + } + + echo json_encode($users); + + +} + +?> diff --git a/core/js/js.js b/core/js/js.js index 2f495321b8..3e53a8bbce 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -302,9 +302,7 @@ $(document).ready(function(){ // all the tipsy stuff needs to be here (in reverse order) to work $('.jp-controls .jp-previous').tipsy({gravity:'nw', fade:true, live:true}); $('.jp-controls .jp-next').tipsy({gravity:'n', fade:true, live:true}); - $('.remove .action').tipsy({gravity:'se', fade:true, live:true}); - $('.date .action').tipsy({gravity:'se', fade:true, live:true}); - $('.action').tipsy({gravity:'s', fade:true, live:true}); + $('.password .action').tipsy({gravity:'se', fade:true, live:true}); $('.selectedActions a.delete').tipsy({gravity: 'ne', fade:true, live:true}); $('.selectedActions a').tipsy({gravity:'n', fade:true, live:true}); $('.file_upload_button_wrapper').tipsy({gravity:'e', fade:true}); diff --git a/core/templates/layout.guest.php b/core/templates/layout.guest.php index 42c2539af1..04bb21896f 100644 --- a/core/templates/layout.guest.php +++ b/core/templates/layout.guest.php @@ -35,6 +35,6 @@ - +
" + encodeEntities(bookmark.title) + "
" + encodeEntities(bookmark.url) + "
" + encodeEntities(bookmark.description) + "
" + taglist + "
Delete
URL:
Title:
Description:
Tags: