aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMichiel de Jong <michiel@unhosted.org>2012-02-25 21:58:59 +0000
committerMichiel de Jong <michiel@unhosted.org>2012-02-25 21:58:59 +0000
commita1d03de6662c84944dacc4ff357ddf3e5f53949e (patch)
tree691ca3408ffee5e69e15df7f03c26c646078f6cd /apps
parent3f87c2cedb271d498f5e198ce90df4948bc032fa (diff)
parent8fe5251029c9e3c711660abcb58c7e60f6b88f97 (diff)
downloadnextcloud-server-a1d03de6662c84944dacc4ff357ddf3e5f53949e.tar.gz
nextcloud-server-a1d03de6662c84944dacc4ff357ddf3e5f53949e.zip
Merge branch 'master' of gitorious.org:owncloud/owncloud
Diffstat (limited to 'apps')
-rw-r--r--apps/bookmarks/addBm.php13
-rw-r--r--apps/bookmarks/ajax/addBookmark.php53
-rw-r--r--apps/bookmarks/bookmarksHelper.php52
-rw-r--r--apps/bookmarks/css/bookmarks.css25
-rw-r--r--apps/bookmarks/js/bookmarks.js36
-rw-r--r--apps/bookmarks/templates/addBm.php17
-rw-r--r--apps/bookmarks/templates/bookmarklet.php8
-rw-r--r--apps/bookmarks/templates/list.php25
-rw-r--r--apps/bookmarks/templates/settings.php7
-rw-r--r--apps/calendar/ajax/calendar/activation.php (renamed from apps/calendar/ajax/activation.php)2
-rw-r--r--apps/calendar/ajax/calendar/delete.php (renamed from apps/calendar/ajax/deletecalendar.php)2
-rw-r--r--apps/calendar/ajax/calendar/edit.form.php (renamed from apps/calendar/ajax/editcalendar.php)2
-rw-r--r--apps/calendar/ajax/calendar/edit.php20
-rw-r--r--apps/calendar/ajax/calendar/new.form.php (renamed from apps/calendar/ajax/newcalendar.php)2
-rw-r--r--apps/calendar/ajax/calendar/new.php (renamed from apps/calendar/ajax/createcalendar.php)2
-rw-r--r--apps/calendar/ajax/calendar/overview.php (renamed from apps/calendar/ajax/choosecalendar.php)2
-rw-r--r--apps/calendar/ajax/calendar/update.php (renamed from apps/calendar/ajax/updatecalendar.php)12
-rw-r--r--apps/calendar/ajax/changeview.php13
-rw-r--r--apps/calendar/ajax/event/delete.php (renamed from apps/calendar/ajax/deleteevent.php)2
-rw-r--r--apps/calendar/ajax/event/edit.form.php (renamed from apps/calendar/ajax/editeventform.php)14
-rw-r--r--apps/calendar/ajax/event/edit.php (renamed from apps/calendar/ajax/editevent.php)2
-rw-r--r--apps/calendar/ajax/event/move.php (renamed from apps/calendar/ajax/moveevent.php)2
-rw-r--r--apps/calendar/ajax/event/new.form.php (renamed from apps/calendar/ajax/neweventform.php)2
-rw-r--r--apps/calendar/ajax/event/new.php (renamed from apps/calendar/ajax/newevent.php)2
-rw-r--r--apps/calendar/ajax/event/resize.php (renamed from apps/calendar/ajax/resizeevent.php)2
-rwxr-xr-xapps/calendar/ajax/events.php2
-rw-r--r--apps/calendar/ajax/import/dialog.php (renamed from apps/calendar/ajax/importdialog.php)2
-rw-r--r--apps/calendar/ajax/import/import.php120
-rw-r--r--apps/calendar/ajax/settings/gettimezonedetection.php (renamed from apps/calendar/ajax/gettimezonedetection.php)2
-rwxr-xr-xapps/calendar/ajax/settings/guesstimezone.php (renamed from apps/calendar/ajax/guesstimezone.php)2
-rw-r--r--apps/calendar/ajax/settings/settimeformat.php (renamed from apps/calendar/ajax/settimeformat.php)2
-rw-r--r--apps/calendar/ajax/settings/settimezone.php (renamed from apps/calendar/ajax/settimezone.php)2
-rw-r--r--apps/calendar/ajax/settings/timeformat.php (renamed from apps/calendar/ajax/timeformat.php)2
-rw-r--r--apps/calendar/ajax/settings/timezonedetection.php (renamed from apps/calendar/ajax/timezonedetection.php)2
-rw-r--r--apps/calendar/ajax/share/changepermission.php40
-rw-r--r--apps/calendar/ajax/share/dropdown.php18
-rw-r--r--apps/calendar/ajax/share/share.php51
-rw-r--r--apps/calendar/ajax/share/unshare.php44
-rw-r--r--apps/calendar/js/calendar.js22
-rwxr-xr-xapps/calendar/js/geo.js2
-rw-r--r--apps/calendar/js/loader.js6
-rw-r--r--apps/calendar/js/settings.js10
-rw-r--r--apps/calendar/templates/part.editevent.php4
-rw-r--r--apps/calendar/templates/part.eventform.php7
-rw-r--r--apps/calendar/templates/part.newevent.php2
-rwxr-xr-xapps/files_pdfviewer/appinfo/info.xml3
-rw-r--r--apps/files_sharing/css/sharing.css3
-rw-r--r--apps/files_sharing/js/share.js2
-rw-r--r--apps/files_texteditor/css/style.css5
-rw-r--r--apps/files_texteditor/js/editor.js5
-rw-r--r--apps/gallery/ajax/galleryOp.php3
-rw-r--r--apps/gallery/ajax/getAlbums.php2
-rw-r--r--apps/gallery/js/albums.js6
-rw-r--r--apps/gallery/lib/photo.php1
54 files changed, 486 insertions, 205 deletions
diff --git a/apps/bookmarks/addBm.php b/apps/bookmarks/addBm.php
index d3d6ab0b1a2..861b677222d 100644
--- a/apps/bookmarks/addBm.php
+++ b/apps/bookmarks/addBm.php
@@ -27,14 +27,7 @@ require_once('../../lib/base.php');
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('bookmarks');
-OC_App::setActiveNavigationEntry( 'bookmarks_index' );
+require_once('bookmarksHelper.php');
+addBookmark($_GET['url'], '', 'Read-Later');
-OC_Util::addScript('bookmarks','addBm');
-OC_Util::addStyle('bookmarks', 'bookmarks');
-
-$tmpl = new OC_Template( 'bookmarks', 'addBm', 'user' );
-
-$url = isset($_GET['url']) ? urldecode($_GET['url']) : '';
-$tmpl->assign('URL', htmlentities($url,ENT_COMPAT,'utf-8'));
-
-$tmpl->printPage();
+include 'templates/addBm.php';
diff --git a/apps/bookmarks/ajax/addBookmark.php b/apps/bookmarks/ajax/addBookmark.php
index 89446564110..8cda7f0f060 100644
--- a/apps/bookmarks/ajax/addBookmark.php
+++ b/apps/bookmarks/ajax/addBookmark.php
@@ -30,53 +30,6 @@ require_once('../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('bookmarks');
-$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
-if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
- $_ut = "strftime('%s','now')";
-} elseif($CONFIG_DBTYPE == 'pgsql') {
- $_ut = 'date_part(\'epoch\',now())::integer';
-} else {
- $_ut = "UNIX_TIMESTAMP()";
-}
-
-//FIXME: Detect when user adds a known URL
-$query = OC_DB::prepare("
- INSERT INTO *PREFIX*bookmarks
- (url, title, user_id, public, added, lastmodified)
- VALUES (?, ?, ?, 0, $_ut, $_ut)
- ");
-
-if(empty($_GET["title"])) {
- require_once('../bookmarksHelper.php');
- $metadata = getURLMetadata($_GET["url"]);
- $_GET["title"] = $metadata['title'];
-}
-
-$params=array(
- htmlspecialchars_decode($_GET["url"]),
- htmlspecialchars_decode($_GET["title"]),
- OC_User::getUser()
- );
-$query->execute($params);
-
-$b_id = OC_DB::insertid('*PREFIX*bookmarks');
-
-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);
- }
-
- OC_JSON::success(array('data' => $b_id));
-}
+require_once('../bookmarksHelper.php');
+$id = addBookmark($_GET['url'], $_GET['title'], $_GET['tags']);
+OC_JSON::success(array('data' => $id)); \ No newline at end of file
diff --git a/apps/bookmarks/bookmarksHelper.php b/apps/bookmarks/bookmarksHelper.php
index ac512fbc241..8def7401e2f 100644
--- a/apps/bookmarks/bookmarksHelper.php
+++ b/apps/bookmarks/bookmarksHelper.php
@@ -70,3 +70,55 @@ function getURLMetadata($url) {
return $metadata;
}
+
+function addBookmark($url, $title='', $tags='') {
+ $CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
+ if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
+ $_ut = "strftime('%s','now')";
+ } elseif($CONFIG_DBTYPE == 'pgsql') {
+ $_ut = 'date_part(\'epoch\',now())::integer';
+ } else {
+ $_ut = "UNIX_TIMESTAMP()";
+ }
+
+ //FIXME: Detect when user adds a known URL
+ $query = OC_DB::prepare("
+ INSERT INTO *PREFIX*bookmarks
+ (url, title, user_id, public, added, lastmodified)
+ VALUES (?, ?, ?, 0, $_ut, $_ut)
+ ");
+
+ if(empty($title)) {
+ $metadata = getURLMetadata($url);
+ $title = $metadata['title'];
+ }
+
+ $params=array(
+ htmlspecialchars_decode($url),
+ htmlspecialchars_decode($title),
+ OC_User::getUser()
+ );
+ $query->execute($params);
+
+ $b_id = OC_DB::insertid('*PREFIX*bookmarks');
+
+ if($b_id !== false) {
+ $query = OC_DB::prepare("
+ INSERT INTO *PREFIX*bookmarks_tags
+ (bookmark_id, tag)
+ VALUES (?, ?)
+ ");
+
+ $tags = explode(' ', urldecode($tags));
+ foreach ($tags as $tag) {
+ if(empty($tag)) {
+ //avoid saving blankspaces
+ continue;
+ }
+ $params = array($b_id, trim($tag));
+ $query->execute($params);
+ }
+
+ return $b_id;
+ }
+} \ No newline at end of file
diff --git a/apps/bookmarks/css/bookmarks.css b/apps/bookmarks/css/bookmarks.css
index 499a4e9c53e..b1139f2c346 100644
--- a/apps/bookmarks/css/bookmarks.css
+++ b/apps/bookmarks/css/bookmarks.css
@@ -1,7 +1,8 @@
#content { overflow: auto; height: 100%; }
#firstrun { width: 80%; margin: 5em auto auto auto; text-align: center; font-weight:bold; font-size:1.5em; color:#777;}
-#firstrun small { display: block; font-weight: normal; font-size: 0.5em; }
-#firstrun #selections { font-size:0.8em; width: 100%; margin: 2em auto auto auto; clear: both; }
+#firstrun small { display: block; font-weight: normal; font-size: 0.5em; margin-bottom: 1.5em; }
+#firstrun .button { font-size: 0.7em; }
+#firstrun #selections { font-size:0.8em; font-weight: normal; width: 100%; margin: 2em auto auto auto; clear: both; }
.bookmarks_headline {
font-size: large;
@@ -15,11 +16,6 @@
padding: 0.5ex;
}
-.bookmarks_add {
- display: none;
- margin-top: 45px;
-}
-
.bookmarks_list {
margin-top: 36px;
}
@@ -35,7 +31,7 @@
}
.bookmarks_input {
- width: 20em;
+ width: 8em;
}
.bookmark_actions {
@@ -87,16 +83,3 @@
display: none;
margin-left: 5px;
}
-
-#footer {
- color: #999;
- font-size: medium;
- text-align: center;
- position: absolute;
- bottom: 10px;
- left: 0px;
- width: 100%;
- height: 20px;
- visibility: visible;
- display: block
-}
diff --git a/apps/bookmarks/js/bookmarks.js b/apps/bookmarks/js/bookmarks.js
index 6db0969a2bb..7317a154a76 100644
--- a/apps/bookmarks/js/bookmarks.js
+++ b/apps/bookmarks/js/bookmarks.js
@@ -3,17 +3,12 @@ var bookmarks_loading = false;
var bookmarks_sorting = 'bookmarks_sorting_recent';
-$(document).ready(function() {
- $('.bookmarks_addBtn').click(function(event){
- $('.bookmarks_add').slideToggle();
- });
-
+$(document).ready(function() {
$('#bookmark_add_submit').click(addOrEditBookmark);
$(window).scroll(updateOnBottom);
$('.bookmarks_list').empty();
getBookmarks();
-
});
function getBookmarks() {
@@ -35,6 +30,9 @@ function getBookmarks() {
updateBookmarksList(bookmarks.data[i]);
$("#firstrun").hide();
}
+ if($('.bookmarks_list').is(':empty')) {
+ $("#firstrun").show();
+ }
$('.bookmark_link').click(recordClick);
$('.bookmark_delete').click(delBookmark);
@@ -54,22 +52,14 @@ function addOrEditBookmark(event) {
var url = encodeEntities($('#bookmark_add_url').val());
var title = encodeEntities($('#bookmark_add_title').val());
var tags = encodeEntities($('#bookmark_add_tags').val());
- var taglist = tags.split(' ');
- var tagshtml = '';
$("#firstrun").hide();
-
- for ( var i=0, len=taglist.length; i<len; ++i ){
- tagshtml += '<a class="bookmark_tag" href="?tag=' + encodeURI(taglist[i]) + '">' + taglist[i] + '</a> ';
- }
if (id == 0) {
$.ajax({
url: 'ajax/addBookmark.php',
data: 'url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags),
success: function(response){
- var bookmark_id = response.data;
- $('.bookmarks_add').slideToggle();
- $('.bookmarks_add').children('p').children('.bookmarks_input').val('');
+ $('.bookmarks_input').val('');
$('.bookmarks_list').empty();
bookmarks_page = 0;
getBookmarks();
@@ -81,8 +71,7 @@ function addOrEditBookmark(event) {
url: 'ajax/editBookmark.php',
data: 'id=' + id + '&url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags),
success: function(){
- $('.bookmarks_add').slideToggle();
- $('.bookmarks_add').children('p').children('.bookmarks_input').val('');
+ $('.bookmarks_input').val('');
$('#bookmark_add_id').val('0');
$('.bookmarks_list').empty();
bookmarks_page = 0;
@@ -98,7 +87,12 @@ function delBookmark(event) {
$.ajax({
url: 'ajax/delBookmark.php',
data: 'url=' + encodeURI($(this).parent().parent().children('.bookmark_url:first').text()),
- success: function(data){ record.animate({ opacity: 'hide' }, 'fast'); }
+ success: function(data){
+ record.remove();
+ if($('.bookmarks_list').is(':empty')) {
+ $("#firstrun").show();
+ }
+ }
});
}
@@ -132,12 +126,12 @@ function updateBookmarksList(bookmark) {
$('.bookmarks_list').append(
'<div class="bookmark_single" data-id="' + bookmark.id +'" >' +
'<p class="bookmark_actions">' +
- '<span class="bookmark_delete">' +
- '<img class="svg" src="'+OC.imagePath('core', 'actions/delete')+'" title="Delete">' +
- '</span>&nbsp;' +
'<span class="bookmark_edit">' +
'<img class="svg" src="'+OC.imagePath('core', 'actions/rename')+'" title="Edit">' +
'</span>' +
+ '<span class="bookmark_delete">' +
+ '<img class="svg" src="'+OC.imagePath('core', 'actions/delete')+'" title="Delete">' +
+ '</span>&nbsp;' +
'</p>' +
'<p class="bookmark_title">'+
'<a href="' + encodeEntities(bookmark.url) + '" target="_blank" class="bookmark_link">' + encodeEntities(bookmark.title) + '</a>' +
diff --git a/apps/bookmarks/templates/addBm.php b/apps/bookmarks/templates/addBm.php
index 9067d3481a3..dbe673f53a8 100644
--- a/apps/bookmarks/templates/addBm.php
+++ b/apps/bookmarks/templates/addBm.php
@@ -1,6 +1,11 @@
-<div class="bookmarks_addBm">
- <p><label class="bookmarks_label"><?php echo $l->t('Address'); ?></label><input type="text" id="bookmark_add_url" class="bookmarks_input" value="<?php echo $_['URL']; ?>"/></p>
- <p><label class="bookmarks_label"><?php echo $l->t('Tags'); ?></label><input type="text" id="bookmark_add_tags" class="bookmarks_input" /></p>
- <p><label class="bookmarks_label"> </label><label class="bookmarks_hint"><?php echo $l->t('Hint: Use space to separate tags.'); ?></label></p>
- <p><label class="bookmarks_label"></label><input type="submit" value="<?php echo $l->t('Add bookmark'); ?>" id="bookmark_add_submit" /></p>
-</div>
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>Read later - ownCloud</title>
+ <link rel="stylesheet" href="css/readlater.css">
+ </head>
+ <body>
+ <div class="message"><h1>Saved!</h1></div>
+ </body>
+</html> \ No newline at end of file
diff --git a/apps/bookmarks/templates/bookmarklet.php b/apps/bookmarks/templates/bookmarklet.php
new file mode 100644
index 00000000000..3d8bbcc7b31
--- /dev/null
+++ b/apps/bookmarks/templates/bookmarklet.php
@@ -0,0 +1,8 @@
+<?php
+
+function createBookmarklet() {
+ $l = new OC_L10N('bookmarks');
+ echo '<small>' . $l->t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage quickly:') . '</small>'
+ . '<a class="button" href="javascript:(function(){var a=window,b=document,c=encodeURIComponent,d=a.open(\'' . OC_Helper::linkToAbsolute('bookmarks', 'addBm.php') . '?output=popup&url=\'+c(b.location),\'bkmk_popup\',\'left=\'+((a.screenX||a.screenLeft)+10)+\',top=\'+((a.screenY||a.screenTop)+10)+\',height=230px,width=230px,resizable=1,alwaysRaised=1\');a.setTimeout(function(){d.focus()},300);})();">'
+ . $l->t('Read later') . '</a>';
+}
diff --git a/apps/bookmarks/templates/list.php b/apps/bookmarks/templates/list.php
index d772cb905aa..1abdbb7f838 100644
--- a/apps/bookmarks/templates/list.php
+++ b/apps/bookmarks/templates/list.php
@@ -9,23 +9,18 @@
?>
<input type="hidden" id="bookmarkFilterTag" value="<?php if(isset($_GET['tag'])) echo htmlentities($_GET['tag']); ?>" />
<div id="controls">
- <input type="button" class="bookmarks_addBtn" value="<?php echo $l->t('Add bookmark'); ?>"/>
-</div>
-<div class="bookmarks_add">
<input type="hidden" id="bookmark_add_id" value="0" />
- <p><label class="bookmarks_label"><?php echo $l->t('Address'); ?></label><input type="text" id="bookmark_add_url" class="bookmarks_input" /></p>
- <p><label class="bookmarks_label"><?php echo $l->t('Title'); ?></label><input type="text" id="bookmark_add_title" class="bookmarks_input" />
- <img class="loading_meta" src="<?php echo OC_Helper::imagePath('core', 'loading.gif'); ?>" /></p>
- <p><label class="bookmarks_label"><?php echo $l->t('Tags'); ?></label><input type="text" id="bookmark_add_tags" class="bookmarks_input" /></p>
- <p><label class="bookmarks_label"> </label><label class="bookmarks_hint"><?php echo $l->t('Hint: Use space to separate tags.'); ?></label></p>
- <p><label class="bookmarks_label"></label><input type="submit" value="<?php echo $l->t('Add bookmark'); ?>" id="bookmark_add_submit" /></p>
+ <input type="text" id="bookmark_add_url" placeholder="<?php echo $l->t('Address'); ?>" class="bookmarks_input" />
+ <input type="text" id="bookmark_add_title" placeholder="<?php echo $l->t('Title'); ?>" class="bookmarks_input" />
+ <input type="text" id="bookmark_add_tags" placeholder="<?php echo $l->t('Tags'); ?>" class="bookmarks_input" />
+ <input type="submit" value="<?php echo $l->t('Add bookmark'); ?>" id="bookmark_add_submit" />
</div>
<div class="bookmarks_list">
</div>
-<div id="firstrun">
- <?php echo $l->t('You have no bookmarks'); ?>
- <small><?php echo $l->t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage.'); ?></small>
- <div id="selections">
- <a class="button" href='javascript:(function(){var a=window,b=document,c=encodeURIComponent,d=a.open("<?php echo OC_Helper::linkToAbsolute('bookmarks', 'addBm.php') ?>?output=popup&url="+c(b.location)+"&title="+c(b.title),"bkmk_popup","left="+((a.screenX||a.screenLeft)+10)+",top="+((a.screenY||a.screenTop)+10)+",height=510px,width=550px,resizable=1,alwaysRaised=1");a.setTimeout(function(){d.focus()},300)})();'><?php echo $l->t('Add page to ownCloud'); ?></a>
- </div>
+<div id="firstrun" style="display: none;">
+ <?php
+ echo $l->t('You have no bookmarks');
+ require_once('bookmarklet.php');
+ createBookmarklet();
+ ?>
</div>
diff --git a/apps/bookmarks/templates/settings.php b/apps/bookmarks/templates/settings.php
index b787e31f3c5..31edf7478bf 100644
--- a/apps/bookmarks/templates/settings.php
+++ b/apps/bookmarks/templates/settings.php
@@ -8,7 +8,10 @@
?>
<form id="bookmarks">
<fieldset class="personalblock">
- <span class="bold"><?php echo $l->t('Bookmarklet:');?></span>&nbsp;<a class="bookmarks_addBml" href='javascript:(function(){var a=window,b=document,c=encodeURIComponent,d=a.open("<?php echo OC_Helper::linkToAbsolute('bookmarks', 'addBm.php') ?>?output=popup&url="+c(b.location)+"&title="+c(b.title),"bkmk_popup","left="+((a.screenX||a.screenLeft)+10)+",top="+((a.screenY||a.screenTop)+10)+",height=510px,width=550px,resizable=1,alwaysRaised=1");a.setTimeout(function(){d.focus()},300)})();'><?php echo $l->t('Add page to ownCloud'); ?></a>
- <br/><em><?php echo $l->t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage.'); ?></em><br />
+ <span class="bold"><?php echo $l->t('Bookmarklet <br />');?></span>
+ <?php
+ require_once('bookmarklet.php');
+ createBookmarklet();
+ ?>
</fieldset>
</form>
diff --git a/apps/calendar/ajax/activation.php b/apps/calendar/ajax/calendar/activation.php
index ada2e44547b..7677d85aff3 100644
--- a/apps/calendar/ajax/activation.php
+++ b/apps/calendar/ajax/calendar/activation.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once ("../../../lib/base.php");
+require_once('../../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$calendarid = $_POST['calendarid'];
diff --git a/apps/calendar/ajax/deletecalendar.php b/apps/calendar/ajax/calendar/delete.php
index 901cbbfcb08..a2f5311731c 100644
--- a/apps/calendar/ajax/deletecalendar.php
+++ b/apps/calendar/ajax/calendar/delete.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+require_once('../../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
diff --git a/apps/calendar/ajax/editcalendar.php b/apps/calendar/ajax/calendar/edit.form.php
index 7aeb5bbe305..8922b3eba4e 100644
--- a/apps/calendar/ajax/editcalendar.php
+++ b/apps/calendar/ajax/calendar/edit.form.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+require_once('../../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
diff --git a/apps/calendar/ajax/calendar/edit.php b/apps/calendar/ajax/calendar/edit.php
new file mode 100644
index 00000000000..8922b3eba4e
--- /dev/null
+++ b/apps/calendar/ajax/calendar/edit.php
@@ -0,0 +1,20 @@
+<?php
+/**
+ * Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+require_once('../../../../lib/base.php');
+OC_JSON::checkLoggedIn();
+OC_JSON::checkAppEnabled('calendar');
+
+$calendarcolor_options = OC_Calendar_Calendar::getCalendarColorOptions();
+$calendar = OC_Calendar_App::getCalendar($_GET['calendarid']);
+$tmpl = new OC_Template("calendar", "part.editcalendar");
+$tmpl->assign('new', false);
+$tmpl->assign('calendarcolor_options', $calendarcolor_options);
+$tmpl->assign('calendar', $calendar);
+$tmpl->printPage();
+?>
diff --git a/apps/calendar/ajax/newcalendar.php b/apps/calendar/ajax/calendar/new.form.php
index af3ba4fbbea..6e7423cbe92 100644
--- a/apps/calendar/ajax/newcalendar.php
+++ b/apps/calendar/ajax/calendar/new.form.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+require_once('../../../../lib/base.php');
$l10n = new OC_L10N('calendar');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
diff --git a/apps/calendar/ajax/createcalendar.php b/apps/calendar/ajax/calendar/new.php
index 8d7b12f9b89..228e6247724 100644
--- a/apps/calendar/ajax/createcalendar.php
+++ b/apps/calendar/ajax/calendar/new.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+require_once('../../../../lib/base.php');
// Check if we are a user
OC_JSON::checkLoggedIn();
diff --git a/apps/calendar/ajax/choosecalendar.php b/apps/calendar/ajax/calendar/overview.php
index 9281c8edbdc..2f73f5d0710 100644
--- a/apps/calendar/ajax/choosecalendar.php
+++ b/apps/calendar/ajax/calendar/overview.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+require_once('../../../../lib/base.php');
$l10n = new OC_L10N('calendar');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
diff --git a/apps/calendar/ajax/updatecalendar.php b/apps/calendar/ajax/calendar/update.php
index 20c225d8a29..f400c8c14b4 100644
--- a/apps/calendar/ajax/updatecalendar.php
+++ b/apps/calendar/ajax/calendar/update.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+require_once('../../../../lib/base.php');
// Check if we are a user
OC_JSON::checkLoggedIn();
@@ -25,16 +25,8 @@ foreach($calendars as $cal){
}
$calendarid = $_POST['id'];
-$calendarcolor = $_POST['color'];
-if (preg_match('/^#?([0-9a-f]{6})/', $calendarcolor, $matches)) {
- $calendarcolor = '#'.$matches[1];
-}
-else {
- $calendarcolor = null;
-}
-
$calendar = OC_Calendar_App::getCalendar($calendarid);//access check
-OC_Calendar_Calendar::editCalendar($calendarid, strip_tags($_POST['name']), null, null, null, $calendarcolor);
+OC_Calendar_Calendar::editCalendar($calendarid, strip_tags($_POST['name']), null, null, null, $_POST['color']);
OC_Calendar_Calendar::setCalendarActive($calendarid, $_POST['active']);
$calendar = OC_Calendar_App::getCalendar($calendarid);
diff --git a/apps/calendar/ajax/changeview.php b/apps/calendar/ajax/changeview.php
index ef05c7cd496..ae48b229b16 100644
--- a/apps/calendar/ajax/changeview.php
+++ b/apps/calendar/ajax/changeview.php
@@ -9,7 +9,16 @@
require_once ("../../../lib/base.php");
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
-$currentview = $_GET["v"];
-OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", $currentview);
+$view = $_GET['v'];
+switch($view){
+ case 'agendaWeek':
+ case 'month';
+ case 'list':
+ break;
+ default:
+ OC_JSON::error(array('message'=>'unexspected parameter: ' . $view));
+ exit;
+}
+OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'currentview', $view);
OC_JSON::success();
?>
diff --git a/apps/calendar/ajax/deleteevent.php b/apps/calendar/ajax/event/delete.php
index b25a5af1a29..862dec6bf5b 100644
--- a/apps/calendar/ajax/deleteevent.php
+++ b/apps/calendar/ajax/event/delete.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+require_once('../../../../lib/base.php');
$l10n = new OC_L10N('calendar');
diff --git a/apps/calendar/ajax/editeventform.php b/apps/calendar/ajax/event/edit.form.php
index 19f6a80a167..837edbbbf05 100644
--- a/apps/calendar/ajax/editeventform.php
+++ b/apps/calendar/ajax/event/edit.form.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+require_once('../../../../lib/base.php');
if(!OC_USER::isLoggedIn()) {
die('<script type="text/javascript">document.location = oc_webroot;</script>');
@@ -243,16 +243,6 @@ if($repeat['repeat'] != 'doesnotrepeat'){
$tmpl->assign('repeat_bymonth', $repeat['bymonth']);
$tmpl->assign('repeat_byweekno', $repeat['byweekno']);
}
-else {
- $tmpl->assign('repeat_month', 'monthday');
- $tmpl->assign('repeat_weekdays', array());
- $tmpl->assign('repeat_interval', 1);
- $tmpl->assign('repeat_end', 'never');
- $tmpl->assign('repeat_count', '10');
- $tmpl->assign('repeat_weekofmonth', 'auto');
- $tmpl->assign('repeat_date', '');
- $tmpl->assign('repeat_year', 'bydate');
-}
$tmpl->printpage();
-?>
+?> \ No newline at end of file
diff --git a/apps/calendar/ajax/editevent.php b/apps/calendar/ajax/event/edit.php
index 5a487da1758..64daffddef0 100644
--- a/apps/calendar/ajax/editevent.php
+++ b/apps/calendar/ajax/event/edit.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+require_once('../../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
diff --git a/apps/calendar/ajax/moveevent.php b/apps/calendar/ajax/event/move.php
index f2256d4eee6..8150fdbaa32 100644
--- a/apps/calendar/ajax/moveevent.php
+++ b/apps/calendar/ajax/event/move.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+require_once('../../../../lib/base.php');
OC_JSON::checkLoggedIn();
$id = $_POST['id'];
diff --git a/apps/calendar/ajax/neweventform.php b/apps/calendar/ajax/event/new.form.php
index 3870c879b0e..c19928a727e 100644
--- a/apps/calendar/ajax/neweventform.php
+++ b/apps/calendar/ajax/event/new.form.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+require_once('../../../../lib/base.php');
if(!OC_USER::isLoggedIn()) {
die('<script type="text/javascript">document.location = oc_webroot;</script>');
diff --git a/apps/calendar/ajax/newevent.php b/apps/calendar/ajax/event/new.php
index c7c4d29943a..59fda79da73 100644
--- a/apps/calendar/ajax/newevent.php
+++ b/apps/calendar/ajax/event/new.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+require_once('../../../../lib/base.php');
$l10n = new OC_L10N('calendar');
diff --git a/apps/calendar/ajax/resizeevent.php b/apps/calendar/ajax/event/resize.php
index 68347906529..aa2d420e77d 100644
--- a/apps/calendar/ajax/resizeevent.php
+++ b/apps/calendar/ajax/event/resize.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+require_once('../../../../lib/base.php');
OC_JSON::checkLoggedIn();
$id = $_POST['id'];
diff --git a/apps/calendar/ajax/events.php b/apps/calendar/ajax/events.php
index 7734129bd95..1436f634316 100755
--- a/apps/calendar/ajax/events.php
+++ b/apps/calendar/ajax/events.php
@@ -7,7 +7,7 @@
*/
require_once ('../../../lib/base.php');
-require_once('../../../3rdparty/when/When.php');
+require_once('when/When.php');
function create_return_event($event, $vevent){
$return_event = array();
diff --git a/apps/calendar/ajax/importdialog.php b/apps/calendar/ajax/import/dialog.php
index f6b8453fc22..2e002092150 100644
--- a/apps/calendar/ajax/importdialog.php
+++ b/apps/calendar/ajax/import/dialog.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+require_once('../../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_Util::checkAppEnabled('calendar');
$l10n = new OC_L10N('calendar');
diff --git a/apps/calendar/ajax/import/import.php b/apps/calendar/ajax/import/import.php
new file mode 100644
index 00000000000..96d7af48341
--- /dev/null
+++ b/apps/calendar/ajax/import/import.php
@@ -0,0 +1,120 @@
+<?php
+/**
+ * Copyright (c) 2012 Georg Ehrke <ownclouddev at georgswebsite dot de>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+//check for calendar rights or create new one
+ob_start();
+require_once('../../../../lib/base.php');
+OC_JSON::checkLoggedIn();
+OC_Util::checkAppEnabled('calendar');
+$nl = "\n";
+$progressfile = OC::$SERVERROOT . '/apps/calendar/import_tmp/' . md5(session_id()) . '.txt';
+if(is_writable('import_tmp/')){
+ $progressfopen = fopen($progressfile, 'w');
+ fwrite($progressfopen, '10');
+ fclose($progressfopen);
+}
+$file = OC_Filesystem::file_get_contents($_POST['path'] . '/' . $_POST['file']);
+if($_POST['method'] == 'new'){
+ $id = OC_Calendar_Calendar::addCalendar(OC_User::getUser(), $_POST['calname']);
+ OC_Calendar_Calendar::setCalendarActive($id, 1);
+}else{
+ $calendar = OC_Calendar_App::getCalendar($_POST['id']);
+ if($calendar['userid'] != OC_USER::getUser()){
+ OC_JSON::error();
+ exit();
+ }
+ $id = $_POST['id'];
+}
+//analyse the calendar file
+if(is_writable('import_tmp/')){
+ $progressfopen = fopen($progressfile, 'w');
+ fwrite($progressfopen, '20');
+ fclose($progressfopen);
+}
+$searchfor = array('VEVENT', 'VTODO', 'VJOURNAL');
+$parts = $searchfor;
+$filearr = explode($nl, $file);
+$inelement = false;
+$parts = array();
+$i = 0;
+foreach($filearr as $line){
+ foreach($searchfor as $search){
+ if(substr_count($line, $search) == 1){
+ list($attr, $val) = explode(':', $line);
+ if($attr == 'BEGIN'){
+ $parts[]['begin'] = $i;
+ $inelement = true;
+ }
+ if($attr == 'END'){
+ $parts[count($parts) - 1]['end'] = $i;
+ $inelement = false;
+ }
+ }
+ }
+ $i++;
+}
+//import the calendar
+if(is_writable('import_tmp/')){
+ $progressfopen = fopen($progressfile, 'w');
+ fwrite($progressfopen, '40');
+ fclose($progressfopen);
+}
+$start = '';
+for ($i = 0; $i < $parts[0]['begin']; $i++) {
+ if($i == 0){
+ $start = $filearr[0];
+ }else{
+ $start .= $nl . $filearr[$i];
+ }
+}
+$end = '';
+for($i = $parts[count($parts) - 1]['end'] + 1;$i <= count($filearr) - 1; $i++){
+ if($i == $parts[count($parts) - 1]['end'] + 1){
+ $end = $filearr[$parts[count($parts) - 1]['end'] + 1];
+ }else{
+ $end .= $nl . $filearr[$i];
+ }
+}
+if(is_writable('import_tmp/')){
+ $progressfopen = fopen($progressfile, 'w');
+ fwrite($progressfopen, '50');
+ fclose($progressfopen);
+}
+$importready = array();
+foreach($parts as $part){
+ for($i = $part['begin']; $i <= $part['end'];$i++){
+ if($i == $part['begin']){
+ $content = $filearr[$i];
+ }else{
+ $content .= $nl . $filearr[$i];
+ }
+ }
+ $importready[] = $start . $nl . $content . $nl . $end;
+}
+if(is_writable('import_tmp/')){
+ $progressfopen = fopen($progressfile, 'w');
+ fwrite($progressfopen, '70');
+ fclose($progressfopen);
+}
+if(count($parts) == 1){
+ OC_Calendar_Object::add($id, $file);
+}else{
+ foreach($importready as $import){
+ OC_Calendar_Object::add($id, $import);
+ }
+}
+//done the import
+if(is_writable('import_tmp/')){
+ $progressfopen = fopen($progressfile, 'w');
+ fwrite($progressfopen, '100');
+ fclose($progressfopen);
+}
+sleep(3);
+if(is_writable('import_tmp/')){
+ unlink($progressfile);
+}
+OC_JSON::success(); \ No newline at end of file
diff --git a/apps/calendar/ajax/gettimezonedetection.php b/apps/calendar/ajax/settings/gettimezonedetection.php
index ae58370712d..11255fe8ef3 100644
--- a/apps/calendar/ajax/gettimezonedetection.php
+++ b/apps/calendar/ajax/settings/gettimezonedetection.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once ("../../../lib/base.php");
+require_once('../../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
OC_JSON::success(array('detection' => OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezonedetection'))); \ No newline at end of file
diff --git a/apps/calendar/ajax/guesstimezone.php b/apps/calendar/ajax/settings/guesstimezone.php
index 41aea26985f..cfa92e1aee8 100755
--- a/apps/calendar/ajax/guesstimezone.php
+++ b/apps/calendar/ajax/settings/guesstimezone.php
@@ -18,7 +18,7 @@ function make_array_out_of_xml ($xml){
}
return $returnarray;
}
-require_once ("../../../lib/base.php");
+require_once('../../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$l = new OC_L10N('calendar');
diff --git a/apps/calendar/ajax/settimeformat.php b/apps/calendar/ajax/settings/settimeformat.php
index 7805120ba5e..8f65447065c 100644
--- a/apps/calendar/ajax/settimeformat.php
+++ b/apps/calendar/ajax/settings/settimeformat.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+require_once('../../../../lib/base.php');
OC_JSON::checkLoggedIn();
if(isset($_POST["timeformat"])){
OC_Preferences::setValue(OC_User::getUser(), 'calendar', 'timeformat', $_POST["timeformat"]);
diff --git a/apps/calendar/ajax/settimezone.php b/apps/calendar/ajax/settings/settimezone.php
index c726a11471d..c639753fe2f 100644
--- a/apps/calendar/ajax/settimezone.php
+++ b/apps/calendar/ajax/settings/settimezone.php
@@ -7,7 +7,7 @@
*/
// Init owncloud
-require_once('../../../lib/base.php');
+require_once('../../../../lib/base.php');
$l=new OC_L10N('calendar');
diff --git a/apps/calendar/ajax/timeformat.php b/apps/calendar/ajax/settings/timeformat.php
index 3533adcf8e0..e0dbe8d3cd7 100644
--- a/apps/calendar/ajax/timeformat.php
+++ b/apps/calendar/ajax/settings/timeformat.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once('../../../lib/base.php');
+require_once('../../../../lib/base.php');
OC_JSON::checkLoggedIn();
$timeformat = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'timeformat', "24");
OC_JSON::encodedPrint(array("timeformat" => $timeformat));
diff --git a/apps/calendar/ajax/timezonedetection.php b/apps/calendar/ajax/settings/timezonedetection.php
index 77e4c4f6ebe..f67bab901e7 100644
--- a/apps/calendar/ajax/timezonedetection.php
+++ b/apps/calendar/ajax/settings/timezonedetection.php
@@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
-require_once ("../../../lib/base.php");
+require_once('../../../../lib/base.php');
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
if($_POST['timezonedetection'] == 'on'){
diff --git a/apps/calendar/ajax/share/changepermission.php b/apps/calendar/ajax/share/changepermission.php
new file mode 100644
index 00000000000..d91f87b613f
--- /dev/null
+++ b/apps/calendar/ajax/share/changepermission.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Copyright (c) 2012 Georg Ehrke <ownclouddev@georgswebsite.de>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+require_once('../../../../lib/base.php');
+$id = strip_tags($_GET['id']);
+$idtype = strip_tags($_GET['idtype']);
+$permission = (int) strip_tags($_GET['permission']);
+switch($idtype){
+ case 'calendar':
+ case 'event':
+ break;
+ default:
+ OC_JSON::error(array('message'=>'unexspected parameter'));
+ exit;
+}
+$sharewith = $_GET['sharewith'];
+$sharetype = strip_tags($_GET['sharetype']);
+switch($sharetype){
+ case 'user':
+ case 'group':
+ case 'public':
+ break;
+ default:
+ OC_JSON::error(array('message'=>'unexspected parameter'));
+ exit;
+}
+if($sharetype == 'user' && !OC_User::userExists($sharewith)){
+ OC_JSON::error(array('message'=>'user not found'));
+ exit;
+}
+if($sharetype == 'group' && !OC_Group::groupExists($sharewith)){
+ OC_JSON::error(array('message'=>'group not found'));
+ exit;
+}
+$success = OC_Calendar_Share::changepermission($sharewith, $sharetype, $id, $permission, (($idtype=='calendar') ? OC_Calendar_Share::CALENDAR : OC_Calendar_Share::Event));
+OC_JSON::success(); \ No newline at end of file
diff --git a/apps/calendar/ajax/share/dropdown.php b/apps/calendar/ajax/share/dropdown.php
new file mode 100644
index 00000000000..eb396d38fd9
--- /dev/null
+++ b/apps/calendar/ajax/share/dropdown.php
@@ -0,0 +1,18 @@
+<?php
+/**
+ * Copyright (c) 2012 Georg Ehrke <ownclouddev@georgswebsite.de>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+require_once('../../../../lib/base.php');
+$user = OC_USER::getUser();
+$calid = $_GET['calid'];
+$calendar = OC_Calendar_Calendar::find($calid);
+if($calendar['userid'] != $user){
+ OC_JSON::error();
+ exit;
+}
+$tmpl = new OC_Template('calendar', 'share.dropdown');
+$tmpl->assign('calid', $calid);
+$tmpl->printPage(); \ No newline at end of file
diff --git a/apps/calendar/ajax/share/share.php b/apps/calendar/ajax/share/share.php
new file mode 100644
index 00000000000..d892727701a
--- /dev/null
+++ b/apps/calendar/ajax/share/share.php
@@ -0,0 +1,51 @@
+<?php
+/**
+ * Copyright (c) 2012 Georg Ehrke <ownclouddev@georgswebsite.de>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+require_once('../../../../lib/base.php');
+$id = strip_tags($_GET['id']);
+$idtype = strip_tags($_GET['idtype']);
+switch($idtype){
+ case 'calendar':
+ case 'event':
+ break;
+ default:
+ OC_JSON::error(array('message'=>'unexspected parameter'));
+ exit;
+}
+$sharewith = $_GET['sharewith'];
+$sharetype = strip_tags($_GET['sharetype']);
+switch($sharetype){
+ case 'user':
+ case 'group':
+ case 'public':
+ break;
+ default:
+ OC_JSON::error(array('message'=>'unexspected parameter'));
+ exit;
+}
+if($sharetype == 'user' && !OC_User::userExists($sharewith)){
+ OC_JSON::error(array('message'=>'user not found'));
+ exit;
+}
+if($sharetype == 'group' && !OC_Group::groupExists($sharewith)){
+ OC_JSON::error(array('message'=>'group not found'));
+ exit;
+}
+if($sharetype == 'user' && OC_User::getUser() == $sharewith){
+ OC_JSON::error(array('meesage'=>'you can not share with yourself'));
+}
+$success = OC_Calendar_Share::share(OC_User::getUser(), $sharewith, $sharetype, $id, (($idtype=='calendar') ? OC_Calendar_Share::CALENDAR : OC_Calendar_Share::Event));
+if($success){
+ if($sharetype == 'public'){
+ OC_JSON::success(array('message'=>$success));
+ }else{
+ OC_JSON::success(array('message'=>'shared'));
+ }
+}else{
+ OC_JSON::error(array('message'=>'can not share'));
+ exit;
+} \ No newline at end of file
diff --git a/apps/calendar/ajax/share/unshare.php b/apps/calendar/ajax/share/unshare.php
new file mode 100644
index 00000000000..ec3150a89aa
--- /dev/null
+++ b/apps/calendar/ajax/share/unshare.php
@@ -0,0 +1,44 @@
+<?php
+/**
+ * Copyright (c) 2012 Georg Ehrke <ownclouddev@georgswebsite.de>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+require_once('../../../../lib/base.php');
+$id = strip_tags($_GET['id']);
+$idtype = strip_tags($_GET['idtype']);
+switch($idtype){
+ case 'calendar':
+ case 'event':
+ break;
+ default:
+ OC_JSON::error(array('message'=>'unexspected parameter'));
+ exit;
+}
+$sharewith = $_GET['sharewith'];
+$sharetype = strip_tags($_GET['sharetype']);
+switch($sharetype){
+ case 'user':
+ case 'group':
+ case 'public':
+ break;
+ default:
+ OC_JSON::error(array('message'=>'unexspected parameter'));
+ exit;
+}
+if($sharetype == 'user' && !OC_User::userExists($sharewith)){
+ OC_JSON::error(array('message'=>'user not found'));
+ exit;
+}
+if($sharetype == 'group' && !OC_Group::groupExists($sharewith)){
+ OC_JSON::error(array('message'=>'group not found'));
+ exit;
+}
+$success = OC_Calendar_Share::unshare(OC_User::getUser(), $sharewith, $sharetype, $id, (($idtype=='calendar') ? OC_Calendar_Share::CALENDAR : OC_Calendar_Share::Event));
+if($success){
+ OC_JSON::success();
+}else{
+ OC_JSON::error(array('message'=>'can not unshare'));
+ exit;
+} \ No newline at end of file
diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js
index ba8e293819a..84b76a3c88f 100644
--- a/apps/calendar/js/calendar.js
+++ b/apps/calendar/js/calendar.js
@@ -69,7 +69,7 @@ Calendar={
$('#event').dialog('destroy').remove();
}else{
Calendar.UI.loading(true);
- $('#dialog_holder').load(OC.filePath('calendar', 'ajax', 'neweventform.php'), {start:start, end:end, allday:allday?1:0}, Calendar.UI.startEventDialog);
+ $('#dialog_holder').load(OC.filePath('calendar', 'ajax/event', 'new.form.php'), {start:start, end:end, allday:allday?1:0}, Calendar.UI.startEventDialog);
}
},
editEvent:function(calEvent, jsEvent, view){
@@ -79,7 +79,7 @@ Calendar={
$('#event').dialog('destroy').remove();
}else{
Calendar.UI.loading(true);
- $('#dialog_holder').load(OC.filePath('calendar', 'ajax', 'editeventform.php') + '?id=' + id, Calendar.UI.startEventDialog);
+ $('#dialog_holder').load(OC.filePath('calendar', 'ajax/event', 'edit.form.php') + '?id=' + id, Calendar.UI.startEventDialog);
}
},
submitDeleteEventForm:function(url){
@@ -141,7 +141,7 @@ Calendar={
moveEvent:function(event, dayDelta, minuteDelta, allDay, revertFunc){
$('.tipsy').remove();
Calendar.UI.loading(true);
- $.post(OC.filePath('calendar', 'ajax', 'moveevent.php'), { id: event.id, dayDelta: dayDelta, minuteDelta: minuteDelta, allDay: allDay?1:0, lastmodified: event.lastmodified},
+ $.post(OC.filePath('calendar', 'ajax/event', 'move.php'), { id: event.id, dayDelta: dayDelta, minuteDelta: minuteDelta, allDay: allDay?1:0, lastmodified: event.lastmodified},
function(data) {
Calendar.UI.loading(false);
if (data.status == 'success'){
@@ -156,7 +156,7 @@ Calendar={
resizeEvent:function(event, dayDelta, minuteDelta, revertFunc){
$('.tipsy').remove();
Calendar.UI.loading(true);
- $.post(OC.filePath('calendar', 'ajax', 'resizeevent.php'), { id: event.id, dayDelta: dayDelta, minuteDelta: minuteDelta, lastmodified: event.lastmodified},
+ $.post(OC.filePath('calendar', 'ajax/event', 'resize.php'), { id: event.id, dayDelta: dayDelta, minuteDelta: minuteDelta, lastmodified: event.lastmodified},
function(data) {
Calendar.UI.loading(false);
if (data.status == 'success'){
@@ -373,7 +373,7 @@ Calendar={
$('#choosecalendar_dialog').dialog('moveToTop');
}else{
Calendar.UI.loading(true);
- $('#dialog_holder').load(OC.filePath('calendar', 'ajax', 'choosecalendar.php'), function(){
+ $('#dialog_holder').load(OC.filePath('calendar', 'ajax/calendar', 'overview.php'), function(){
$('#choosecalendar_dialog').dialog({
width : 600,
close : function(event, ui) {
@@ -387,7 +387,7 @@ Calendar={
activation:function(checkbox, calendarid)
{
Calendar.UI.loading(true);
- $.post(OC.filePath('calendar', 'ajax', 'activation.php'), { calendarid: calendarid, active: checkbox.checked?1:0 },
+ $.post(OC.filePath('calendar', 'ajax/calendar', 'activation.php'), { calendarid: calendarid, active: checkbox.checked?1:0 },
function(data) {
Calendar.UI.loading(false);
if (data.status == 'success'){
@@ -402,13 +402,13 @@ Calendar={
},
newCalendar:function(object){
var tr = $(document.createElement('tr'))
- .load(OC.filePath('calendar', 'ajax', 'newcalendar.php'),
+ .load(OC.filePath('calendar', 'ajax/calendar', 'new.form.php'),
function(){Calendar.UI.Calendar.colorPicker(this)});
$(object).closest('tr').after(tr).hide();
},
edit:function(object, calendarid){
var tr = $(document.createElement('tr'))
- .load(OC.filePath('calendar', 'ajax', 'editcalendar.php') + "?calendarid="+calendarid,
+ .load(OC.filePath('calendar', 'ajax/calendar', 'edit.form.php') + "?calendarid="+calendarid,
function(){Calendar.UI.Calendar.colorPicker(this)});
$(object).closest('tr').after(tr).hide();
},
@@ -417,7 +417,7 @@ Calendar={
if(check == false){
return false;
}else{
- $.post(OC.filePath('calendar', 'ajax', 'deletecalendar.php'), { calendarid: calid},
+ $.post(OC.filePath('calendar', 'ajax/calendar', 'delete.php'), { calendarid: calid},
function(data) {
if (data.status == 'success'){
var url = 'ajax/events.php?calendar_id='+calid;
@@ -442,9 +442,9 @@ Calendar={
var url;
if (calendarid == 'new'){
- url = OC.filePath('calendar', 'ajax', 'createcalendar.php');
+ url = OC.filePath('calendar', 'ajax/calendar', 'new.php');
}else{
- url = OC.filePath('calendar', 'ajax', 'updatecalendar.php');
+ url = OC.filePath('calendar', 'ajax/calendar', 'update.php');
}
$.post(url, { id: calendarid, name: displayname, active: active, description: description, color: calendarcolor },
function(data){
diff --git a/apps/calendar/js/geo.js b/apps/calendar/js/geo.js
index ae6a971e938..c9cc5dd0955 100755
--- a/apps/calendar/js/geo.js
+++ b/apps/calendar/js/geo.js
@@ -6,7 +6,7 @@
*/
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
- $.getJSON(OC.filePath('calendar', 'ajax', 'guesstimezone.php?lat=' + position.coords.latitude + '&long=' + position.coords.longitude + ''),
+ $.getJSON(OC.filePath('calendar', 'ajax/settings', 'guesstimezone.php?lat=' + position.coords.latitude + '&long=' + position.coords.longitude + ''),
function(data){
if (data.status == 'success' && typeof(data.message) != 'undefined'){
$('#notification').html(data.message);
diff --git a/apps/calendar/js/loader.js b/apps/calendar/js/loader.js
index 4e483f9864e..54003879759 100644
--- a/apps/calendar/js/loader.js
+++ b/apps/calendar/js/loader.js
@@ -8,7 +8,7 @@ Calendar_Import={
importdialog: function(filename){
var path = $('#dir').val();
$('body').append('<div id="calendar_import"></div>');
- $('#calendar_import').load(OC.filePath('calendar', 'ajax', 'importdialog.php'), {filename:filename, path:path}, function(){Calendar_Import.initdialog(filename);});
+ $('#calendar_import').load(OC.filePath('calendar', 'ajax/import', 'dialog.php'), {filename:filename, path:path}, function(){Calendar_Import.initdialog(filename);});
},
initdialog: function(filename){
$('#calendar_import_dialog').dialog({
@@ -68,7 +68,7 @@ Calendar_Import={
if(percent < 100){
window.setTimeout('Calendar_Import.getimportstatus(\'' + progressfile + '\')', 500);
}else{
- $('#import_done').css('display', 'block');
+ $('#import_done').css('display', 'block');
}
});
}
@@ -78,4 +78,4 @@ $(document).ready(function(){
FileActions.register('text/calendar','importcal', '', Calendar_Import.importdialog);
FileActions.setDefault('text/calendar','importcal');
};
-}); \ No newline at end of file
+});
diff --git a/apps/calendar/js/settings.js b/apps/calendar/js/settings.js
index 73300885565..fcbfc423db3 100644
--- a/apps/calendar/js/settings.js
+++ b/apps/calendar/js/settings.js
@@ -3,7 +3,7 @@ $(document).ready(function(){
OC.msg.startSaving('#calendar .msg')
// Serialize the data
var post = $( '#timezone' ).serialize();
- $.post( OC.filePath('calendar', 'ajax', 'settimezone.php'), post, function(data){
+ $.post( OC.filePath('calendar', 'ajax/settings', 'settimezone.php'), post, function(data){
//OC.msg.finishedSaving('#calendar .msg', data);
});
return false;
@@ -11,7 +11,7 @@ $(document).ready(function(){
$('#timezone').chosen();
$('#timeformat').change( function(){
var data = $('#timeformat').serialize();
- $.post( OC.filePath('calendar', 'ajax', 'settimeformat.php'), data, function(data){
+ $.post( OC.filePath('calendar', 'ajax/settings', 'settimeformat.php'), data, function(data){
if(data == 'error'){
console.log('saving timeformat failed');
}
@@ -19,15 +19,15 @@ $(document).ready(function(){
});
$('#timezonedetection').change( function(){
var post = $('#timezonedetection').serialize();
- $.post( OC.filePath('calendar', 'ajax', 'timezonedetection.php'), post, function(data){
+ $.post( OC.filePath('calendar', 'ajax/settings', 'timezonedetection.php'), post, function(data){
});
});
- $.getJSON(OC.filePath('calendar', 'ajax', 'timeformat.php'), function(jsondata, status) {
+ $.getJSON(OC.filePath('calendar', 'ajax/settings', 'timeformat.php'), function(jsondata, status) {
$('#' + jsondata.timeformat).attr('selected',true);
$('#timeformat').chosen();
});
- $.getJSON(OC.filePath('calendar', 'ajax', 'gettimezonedetection.php'), function(jsondata, status){
+ $.getJSON(OC.filePath('calendar', 'ajax/settings', 'gettimezonedetection.php'), function(jsondata, status){
if(jsondata.detection == 'true'){
$('#timezonedetection').attr('checked', 'checked');
}
diff --git a/apps/calendar/templates/part.editevent.php b/apps/calendar/templates/part.editevent.php
index b3acfc4a072..6e319e1b4e0 100644
--- a/apps/calendar/templates/part.editevent.php
+++ b/apps/calendar/templates/part.editevent.php
@@ -5,8 +5,8 @@
<?php echo $this->inc("part.eventform"); ?>
<div style="width: 100%;text-align: center;color: #FF1D1D;" id="errorbox"></div>
<span id="actions">
- <input type="button" class="submit" style="float: left;" value="<?php echo $l->t("Submit");?>" onclick="Calendar.UI.validateEventForm('ajax/editevent.php');">
- <input type="button" class="submit" style="float: left;" name="delete" value="<?php echo $l->t("Delete");?>" onclick="Calendar.UI.submitDeleteEventForm('ajax/deleteevent.php');">
+ <input type="button" class="submit" style="float: left;" value="<?php echo $l->t("Submit");?>" onclick="Calendar.UI.validateEventForm('ajax/event/edit.php');">
+ <input type="button" class="submit" style="float: left;" name="delete" value="<?php echo $l->t("Delete");?>" onclick="Calendar.UI.submitDeleteEventForm('ajax/event/delete.php');">
<input type="button" class="submit" style="float: right;" name="export" value="<?php echo $l->t("Export");?>" onclick="window.location='export.php?eventid=<?php echo $_['id'] ?>';">
</span>
</form>
diff --git a/apps/calendar/templates/part.eventform.php b/apps/calendar/templates/part.eventform.php
index 49214aca77c..8a8f420f846 100644
--- a/apps/calendar/templates/part.eventform.php
+++ b/apps/calendar/templates/part.eventform.php
@@ -17,6 +17,7 @@
?>
</select>
</td>
+ <?php if(count($_['calendar_options']) > 1) { ?>
<th width="75px">&nbsp;&nbsp;&nbsp;<?php echo $l->t("Calendar");?>:</th>
<td>
<select style="width:140px;" name="calendar">
@@ -26,6 +27,12 @@
?>
</select>
</td>
+ <?php } else { ?>
+ <th width="75px">&nbsp;</th>
+ <td>
+ <input type="hidden" name="calendar" value="<?php echo $_['calendar_options'][0]['id'] ?>">
+ </td>
+ <?php } ?>
</tr>
</table>
<hr>
diff --git a/apps/calendar/templates/part.newevent.php b/apps/calendar/templates/part.newevent.php
index b1e2a5eab84..11416260344 100644
--- a/apps/calendar/templates/part.newevent.php
+++ b/apps/calendar/templates/part.newevent.php
@@ -3,7 +3,7 @@
<?php echo $this->inc("part.eventform"); ?>
<div style="width: 100%;text-align: center;color: #FF1D1D;" id="errorbox"></div>
<span id="actions">
- <input type="button" class="submit" style="float: left;" value="<?php echo $l->t("Submit");?>" onclick="Calendar.UI.validateEventForm('ajax/newevent.php');">
+ <input type="button" class="submit" style="float: left;" value="<?php echo $l->t("Submit");?>" onclick="Calendar.UI.validateEventForm('ajax/event/new.php');">
</span>
</form>
</div>
diff --git a/apps/files_pdfviewer/appinfo/info.xml b/apps/files_pdfviewer/appinfo/info.xml
index 86a6c3f22f7..f133f1900d7 100755
--- a/apps/files_pdfviewer/appinfo/info.xml
+++ b/apps/files_pdfviewer/appinfo/info.xml
@@ -1,7 +1,8 @@
<?xml version="1.0"?>
<info>
<id>files_pdfviewer</id>
- <name>PDF viewer (pdfjs-based)</name>
+ <name>PDF Viewer</name>
+ <description>Inline PDF viewer (pdfjs-based)</description>
<version>0.1</version>
<licence>GPL</licence>
<author>Joan Creus</author>
diff --git a/apps/files_sharing/css/sharing.css b/apps/files_sharing/css/sharing.css
index 0759af2c274..db59a3d340b 100644
--- a/apps/files_sharing/css/sharing.css
+++ b/apps/files_sharing/css/sharing.css
@@ -5,4 +5,5 @@
#shared_list { padding:0.5em; list-style-type: none; }
#public { border-top:1px solid #ddd; padding-top:0.5em; }
a.unshare { float:right; display:inline; margin:0 .5em; padding:.3em .3em 0 .3em !important; opacity:.5; }
-a.unshare:hover { opacity:1; } \ No newline at end of file
+a.unshare:hover { opacity:1; }
+#share_with { width: 16em; } \ No newline at end of file
diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index d01a07447a6..fc9e17c25c7 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -174,7 +174,7 @@ $(document).ready(function() {
function createDropdown(filename, files) {
var html = '<div id="dropdown" class="drop" data-file="'+files+'">';
html += '<div id="private">';
- html += '<select data-placeholder="User or Group" style="width:220px;" id="share_with" class="chzen-select">';
+ html += '<select data-placeholder="User or Group" id="share_with" class="chzen-select">';
html += '<option value=""></option>';
html += '</select>';
html += '<ul id="shared_list"></ul>';
diff --git a/apps/files_texteditor/css/style.css b/apps/files_texteditor/css/style.css
index bc238c1f40f..e260ab0dd46 100644
--- a/apps/files_texteditor/css/style.css
+++ b/apps/files_texteditor/css/style.css
@@ -1,7 +1,8 @@
#editor{
- position: absoloute;
+ position: fixed;
display: block;
- top: 2em;
+ top: 6.5em;
+ left: 12.5em;
}
#editorwrapper{
position: absoloute;
diff --git a/apps/files_texteditor/js/editor.js b/apps/files_texteditor/js/editor.js
index 7473d532304..e45652b6ef3 100644
--- a/apps/files_texteditor/js/editor.js
+++ b/apps/files_texteditor/js/editor.js
@@ -172,6 +172,7 @@ function giveEditorFocus(){
function showFileEditor(dir,filename){
if(!editorIsShown()){
// Loads the file editor and display it.
+ $('#content').append('<div id="editor"></div>');
var data = $.getJSON(
OC.filePath('files_texteditor','ajax','loadfile.php'),
{file:filename,dir:dir},
@@ -273,10 +274,10 @@ $(document).ready(function(){
var dir=text.substr(0,text.length-file.length-1);
showFileEditor(dir,file);
});
- }
+ };
// Binds the file save and close editor events, and gotoline button
bindControlEvents();
-
+ $('#editor').remove();
// Binds the save keyboard shortcut events
//$(document).unbind('keydown').bind('keydown',checkForSaveKeyPress);
});
diff --git a/apps/gallery/ajax/galleryOp.php b/apps/gallery/ajax/galleryOp.php
index 5ac6d295108..f07814056a3 100644
--- a/apps/gallery/ajax/galleryOp.php
+++ b/apps/gallery/ajax/galleryOp.php
@@ -41,7 +41,8 @@ function handleRemove($name) {
function handleGetThumbnails($albumname) {
OC_Response::enableCaching(3600 * 24); // 24 hour
- $thumbnail = OC::$CONFIG_DATADIRECTORY.'/../gallery/'.$albumname.'.png';
+ error_log(htmlentities($albumname));
+ $thumbnail = OC::$CONFIG_DATADIRECTORY.'/../gallery/'.urldecode($albumname).'.png';
header('Content-Type: '.OC_Image::getMimeTypeForFile($thumbnail));
OC_Response::sendFile($thumbnail);
}
diff --git a/apps/gallery/ajax/getAlbums.php b/apps/gallery/ajax/getAlbums.php
index 9e9c6ef496c..be87af2abd3 100644
--- a/apps/gallery/ajax/getAlbums.php
+++ b/apps/gallery/ajax/getAlbums.php
@@ -33,7 +33,7 @@ while ($r = $result->fetchRow()) {
$album_name = $r['album_name'];
$tmp_res = OC_Gallery_Photo::find($r['album_id']);
- $a[] = array('name' => $album_name, 'numOfItems' => min($tmp_res->numRows(), 10), 'bgPath' => OC::$WEBROOT.'/data/'.OC_User::getUser().'/gallery/'.$album_name.'.png');
+ $a[] = array('name' => utf8_encode($album_name), 'numOfItems' => min($tmp_res->numRows(), 10), 'bgPath' => OC::$WEBROOT.'/data/'.OC_User::getUser().'/gallery/'.$album_name.'.png');
}
OC_JSON::success(array('albums'=>$a));
diff --git a/apps/gallery/js/albums.js b/apps/gallery/js/albums.js
index 987412f28e0..adecd24cc75 100644
--- a/apps/gallery/js/albums.js
+++ b/apps/gallery/js/albums.js
@@ -54,9 +54,9 @@ Albums={
event.preventDefault();
galleryRemove(event.data.name);
});
- $("a.view", local).attr('href','?view='+escape(a.name));
- $('h1',local).text(a.name);
- $(".gallery_album_cover", local).attr('title',a.name);
+ $("a.view", local).attr('href','?view='+decodeURIComponent(escape(a.name)));
+ $('h1',local).text(decodeURIComponent(escape(a.name)));
+ $(".gallery_album_cover", local).attr('title',decodeURIComponent(escape(a.name)));
$(".gallery_album_cover", local).css('background-repeat', 'no-repeat');
$(".gallery_album_cover", local).css('background-position', '0');
$(".gallery_album_cover", local).css('background-image','url("ajax/galleryOp.php?operation=get_covers&albumname='+escape(a.name)+'")');
diff --git a/apps/gallery/lib/photo.php b/apps/gallery/lib/photo.php
index 4eb313bfc33..872ecc9488a 100644
--- a/apps/gallery/lib/photo.php
+++ b/apps/gallery/lib/photo.php
@@ -69,7 +69,6 @@ class OC_Gallery_Photo {
public static function getThumbnail($image_name) {
$save_dir = OC_Config::getValue("datadirectory").'/'. OC_User::getUser() .'/gallery/';
$save_dir .= dirname($image_name). '/';
- $image_name = basename($image_name);
$thumb_file = $save_dir . $image_name;
if (file_exists($thumb_file)) {
$image = new OC_Image($thumb_file);