@@ -28,19 +28,6 @@ OC_Util::checkLoggedIn(); | |||
OC_Util::checkAppEnabled('bookmarks'); | |||
require_once('bookmarksHelper.php'); | |||
addBookmark($_GET['url'], '', 'Read-Later'); | |||
OC_App::setActiveNavigationEntry( 'bookmarks_index' ); | |||
OC_Util::addScript('bookmarks','addBm'); | |||
OC_Util::addStyle('bookmarks', 'bookmarks'); | |||
$tmpl = new OC_Template( 'bookmarks', 'addBm', 'user' ); | |||
$url = isset($_GET['url']) ? urldecode($_GET['url']) : ''; | |||
$metadata = getURLMetadata($url); | |||
$tmpl->assign('URL', htmlentities($metadata['url'],ENT_COMPAT,'utf-8')); | |||
$title = isset($metadata['title']) ? $metadata['title'] : (isset($_GET['title']) ? $_GET['title'] : ''); | |||
$tmpl->assign('TITLE', htmlentities($title,ENT_COMPAT,'utf-8')); | |||
$tmpl->printPage(); | |||
include 'templates/addBm.php'; |
@@ -30,50 +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) | |||
"); | |||
$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)); |
@@ -1,39 +0,0 @@ | |||
<?php | |||
/** | |||
* ownCloud - bookmarks plugin | |||
* | |||
* @author Arthur Schiwon | |||
* @copyright 2011 Arthur Schiwon blizzz@arthur-schiwon.de | |||
* | |||
* This library is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE | |||
* License as published by the Free Software Foundation; either | |||
* version 3 of the License, or any later version. | |||
* | |||
* This library is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with this library. If not, see <http://www.gnu.org/licenses/>. | |||
* | |||
*/ | |||
//no apps or filesystem | |||
$RUNTIME_NOSETUPFS=true; | |||
require_once('../../../lib/base.php'); | |||
// Check if we are a user | |||
OC_JSON::checkLoggedIn(); | |||
OC_JSON::checkAppEnabled('bookmarks'); | |||
// $metadata = array(); | |||
require '../bookmarksHelper.php'; | |||
$metadata = getURLMetadata(htmlspecialchars_decode($_GET["url"])); | |||
OC_JSON::success(array('data' => $metadata)); |
@@ -1,6 +1,6 @@ | |||
<?php | |||
/** | |||
* Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de> | |||
* Copyright (c) 2011 Marvin Thomas Rabe <mrabe@marvinrabe.de> | |||
* Copyright (c) 2011 Arthur Schiwon <blizzz@arthur-schiwon.de> | |||
* This file is licensed under the Affero General Public License version 3 or | |||
* later. |
@@ -75,14 +75,6 @@ | |||
<sorting>descending</sorting> | |||
</field> | |||
</index> | |||
<!-- <index> | |||
<name>url</name> | |||
<unique>true</unique> | |||
<field> | |||
<name>url</name> | |||
<sorting>ascending</sorting> | |||
</field> | |||
</index>--> | |||
</declaration> | |||
</table> | |||
@@ -3,8 +3,8 @@ | |||
<id>bookmarks</id> | |||
<name>Bookmarks</name> | |||
<description>Bookmark manager for ownCloud</description> | |||
<version>0.1</version> | |||
<version>0.2</version> | |||
<licence>AGPL</licence> | |||
<author>Arthur Schiwon</author> | |||
<author>Arthur Schiwon, Marvin Thomas Rabe</author> | |||
<require>2</require> | |||
</info> |
@@ -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; | |||
} | |||
} |
@@ -1,4 +1,8 @@ | |||
#content { overflow: auto; } | |||
#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; 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; | |||
@@ -12,11 +16,6 @@ | |||
padding: 0.5ex; | |||
} | |||
.bookmarks_add { | |||
display: none; | |||
margin-top: 45px; | |||
} | |||
.bookmarks_list { | |||
margin-top: 36px; | |||
} | |||
@@ -32,7 +31,7 @@ | |||
} | |||
.bookmarks_input { | |||
width: 20em; | |||
width: 8em; | |||
} | |||
.bookmark_actions { | |||
@@ -84,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 | |||
} |
@@ -4,13 +4,12 @@ $(document).ready(function() { | |||
function addBookmark(event) { | |||
var url = $('#bookmark_add_url').val(); | |||
var title = $('#bookmark_add_title').val(); | |||
var tags = $('#bookmark_add_tags').val(); | |||
$.ajax({ | |||
url: 'ajax/addBookmark.php', | |||
data: 'url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags), | |||
data: 'url=' + encodeURI(url) + '&tags=' + encodeURI(tags), | |||
success: function(data){ | |||
location.href='index.php'; | |||
window.close(); | |||
} | |||
}); | |||
} |
@@ -3,19 +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); | |||
$('#bookmark_add_url').focusout(getMetadata); | |||
$('.bookmarks_list').empty(); | |||
getBookmarks(); | |||
}); | |||
function getBookmarks() { | |||
@@ -35,6 +28,10 @@ function getBookmarks() { | |||
for(var i in bookmarks.data) { | |||
updateBookmarksList(bookmarks.data[i]); | |||
$("#firstrun").hide(); | |||
} | |||
if($('.bookmarks_list').is(':empty')) { | |||
$("#firstrun").show(); | |||
} | |||
$('.bookmark_link').click(recordClick); | |||
@@ -46,20 +43,6 @@ function getBookmarks() { | |||
}); | |||
} | |||
function getMetadata() { | |||
var url = encodeEntities($('#bookmark_add_url').val()); | |||
$('.loading_meta').css('display','inline'); | |||
$.ajax({ | |||
url: 'ajax/getMeta.php', | |||
data: 'url=' + encodeURIComponent(url), | |||
success: function(pageinfo){ | |||
$('#bookmark_add_url').val(pageinfo.data.url); | |||
$('#bookmark_add_title').val(pageinfo.data.title); | |||
$('.loading_meta').css('display','none'); | |||
} | |||
}); | |||
} | |||
// function addBookmark() { | |||
// Instead of creating editBookmark() function, Converted the one above to | |||
// addOrEditBookmark() to make .js file more compact. | |||
@@ -69,35 +52,17 @@ 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 = ''; | |||
for ( var i=0, len=taglist.length; i<len; ++i ){ | |||
tagshtml += '<a class="bookmark_tag" href="?tag=' + encodeURI(taglist[i]) + '">' + taglist[i] + '</a> '; | |||
} | |||
$("#firstrun").hide(); | |||
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_list').prepend( | |||
'<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> ' + | |||
'<span class="bookmark_edit">' + | |||
'<img class="svg" src="'+OC.imagePath('core', 'actions/rename')+'" title="Edit">' + | |||
'</span>' + | |||
'</p>' + | |||
'<p class="bookmark_title"><a href="' + url + '" target="_blank" class="bookmark_link">' + title + '</a></p>' + | |||
'<p class="bookmark_tags">' + tagshtml + '</p>' + | |||
'<p class="bookmark_url">' + url + '</p>' + | |||
'</div>' | |||
); | |||
$('.bookmarks_input').val(''); | |||
$('.bookmarks_list').empty(); | |||
bookmarks_page = 0; | |||
getBookmarks(); | |||
} | |||
}); | |||
} | |||
@@ -106,18 +71,11 @@ 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'); | |||
var record = $('.bookmark_single[data-id = "' + id + '"]'); | |||
record.children('.bookmark_url:first').text(url); | |||
var record_title = record.children('.bookmark_title:first').children('a:first'); | |||
record_title.attr('href', url); | |||
record_title.text(title); | |||
record.children('.bookmark_tags:first').html(tagshtml); | |||
$('.bookmarks_list').empty(); | |||
bookmarks_page = 0; | |||
getBookmarks(); | |||
} | |||
}); | |||
} | |||
@@ -129,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(); | |||
} | |||
} | |||
}); | |||
} | |||
@@ -159,15 +122,16 @@ function updateBookmarksList(bookmark) { | |||
if(!hasProtocol(bookmark.url)) { | |||
bookmark.url = 'http://' + bookmark.url; | |||
} | |||
if(bookmark.title == '') bookmark.title = bookmark.url; | |||
$('.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> ' + | |||
'<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> ' + | |||
'</p>' + | |||
'<p class="bookmark_title">'+ | |||
'<a href="' + encodeEntities(bookmark.url) + '" target="_blank" class="bookmark_link">' + encodeEntities(bookmark.title) + '</a>' + |
@@ -1,6 +1,6 @@ | |||
<?php | |||
/** | |||
* Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de> | |||
* Copyright (c) 2011 Marvin Thomas Rabe <mrabe@marvinrabe.de> | |||
* This file is licensed under the Affero General Public License version 3 or | |||
* later. | |||
* See the COPYING-README file. | |||
@@ -8,6 +8,4 @@ | |||
$tmpl = new OC_Template( 'bookmarks', 'settings'); | |||
//OC_Util::addScript('bookmarks','settings'); | |||
return $tmpl->fetchPage(); |
@@ -1,7 +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('Title'); ?></label><input type="text" id="bookmark_add_title" class="bookmarks_input" value="<?php echo $_['TITLE']; ?>" /></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> |
@@ -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>'; | |||
} |
@@ -1,6 +1,6 @@ | |||
<?php | |||
/** | |||
* Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de> | |||
* Copyright (c) 2011 Marvin Thomas Rabe <mrabe@marvinrabe.de> | |||
* Copyright (c) 2011 Arthur Schiwon <blizzz@arthur-schiwon.de> | |||
* This file is licensed under the Affero General Public License version 3 or | |||
* later. | |||
@@ -9,21 +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"> | |||
<?php echo $l->t('You have no bookmarks'); ?> | |||
</div> | |||
<div id="footer"> | |||
Bookmark pages more easily. Drag this bookmarklet to the Bookmarks bar of your browser: | |||
<a style='background-color:#dddddd;border:1px groove #999; padding:5px;padding-top:0px;padding-bottom:2px; text-decoration:none; margin-top:5px' 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)})();'>ownCloud bookmark</a> | |||
<div id="firstrun" style="display: none;"> | |||
<?php | |||
echo $l->t('You have no bookmarks'); | |||
require_once('bookmarklet.php'); | |||
createBookmarklet(); | |||
?> | |||
</div> |
@@ -1,6 +1,6 @@ | |||
<?php | |||
/** | |||
* Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de> | |||
* Copyright (c) 2011 Marvin Thomas Rabe <mrabe@marvinrabe.de> | |||
* This file is licensed under the Affero General Public License version 3 or | |||
* later. | |||
* See the COPYING-README file. | |||
@@ -8,7 +8,10 @@ | |||
?> | |||
<form id="bookmarks"> | |||
<fieldset class="personalblock"> | |||
<span class="bold"><?php echo $l->t('Bookmarklet:');?></span> <a class="bookmarks_addBml" href="javascript:(function(){url=encodeURIComponent(location.href);window.open('<?php echo OC_Helper::linkToAbsolute('bookmarks', 'addBm.php'); ?>?url='+url, 'owncloud-bookmarks') })()"><?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> |
@@ -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']; |
@@ -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'); |
@@ -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'); | |||
@@ -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(); | |||
?> |
@@ -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'); |
@@ -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(); |
@@ -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'); |
@@ -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); |
@@ -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(); | |||
?> |
@@ -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'); | |||
@@ -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(); | |||
?> | |||
?> |
@@ -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'); | |||
@@ -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']; |
@@ -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>'); |
@@ -6,7 +6,7 @@ | |||
* See the COPYING-README file. | |||
*/ | |||
require_once('../../../lib/base.php'); | |||
require_once('../../../../lib/base.php'); | |||
$l10n = new OC_L10N('calendar'); | |||
@@ -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']; |
@@ -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(); |
@@ -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'); |
@@ -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(); |
@@ -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'))); |
@@ -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'); |
@@ -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"]); |
@@ -7,7 +7,7 @@ | |||
*/ | |||
// Init owncloud | |||
require_once('../../../lib/base.php'); | |||
require_once('../../../../lib/base.php'); | |||
$l=new OC_L10N('calendar'); | |||
@@ -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)); |
@@ -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'){ |
@@ -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(); |
@@ -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(); |
@@ -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; | |||
} |
@@ -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; | |||
} |
@@ -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){ |
@@ -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); |
@@ -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'); | |||
}; | |||
}); | |||
}); |
@@ -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'); | |||
} |
@@ -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> |
@@ -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> |
@@ -51,7 +51,7 @@ $checksum = isset($_POST['checksum'])?$_POST['checksum']:null; | |||
// } | |||
// } | |||
if(is_array($value)){ // FIXME: How to strip_tags for compound values? | |||
if(is_array($value)){ | |||
$value = array_map('strip_tags', $value); | |||
ksort($value); // NOTE: Important, otherwise the compound value will be set in the order the fields appear in the form! | |||
$value = OC_VObject::escapeSemicolons($value); |
@@ -17,8 +17,8 @@ | |||
#contacts_propertymenu li a:hover { color: #fff } | |||
#actionbar { height: 30px; width: 200px; position: fixed; right: 0px; top: 75px; margin: 0 0 0 0; padding: 0 0 0 0;} | |||
#card { /*max-width: 70em; border: thin solid lightgray; display: block;*/ } | |||
#firstrun { /*border: thin solid lightgray;*/ width: 80%; margin: 5em auto auto auto; text-align: center; font-weight:bold; font-size:1.5em; color:#777;} | |||
#firstrun #selections { /*border: thin solid lightgray;*/ font-size:0.8em; width: 100%; margin: 2em auto auto auto; clear: both; } | |||
#firstrun { width: 100%; position: absolute; top: 5em; left: 0; text-align: center; font-weight:bold; font-size:1.5em; color:#777; } | |||
#firstrun #selections { font-size:0.8em; margin: 2em auto auto auto; clear: both; } | |||
#card input[type="text"].contacts_property,input[type="email"].contacts_property { width: 16em; } | |||
#card input[type="text"],input[type="email"],input[type="tel"],input[type="date"], select { background-color: #f8f8f8; border: 0 !important; -webkit-appearance:none !important; -moz-appearance:none !important; -webkit-box-sizing:none !important; -moz-box-sizing:none !important; box-sizing:none !important; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; -moz-border-radius: 0px; -webkit-border-radius: 0px; border-radius: 0px; float: left; } |
@@ -8,7 +8,7 @@ String.prototype.strip_tags = function(){ | |||
tags = this; | |||
stripped = tags.replace(/[\<\>]/gi, ""); | |||
return stripped; | |||
} | |||
}; | |||
Contacts={ | |||
@@ -142,7 +142,7 @@ Contacts={ | |||
} | |||
}); | |||
}); | |||
} | |||
}; | |||
}, | |||
loadListHandlers:function() { | |||
//$('.add,.delete').hide(); | |||
@@ -323,7 +323,7 @@ Contacts={ | |||
} | |||
}); | |||
}, | |||
delete:function() { | |||
delete: function() { | |||
$('#contacts_deletecard').tipsy('hide'); | |||
$.getJSON('ajax/deletecard.php',{'id':this.id},function(jsondata){ | |||
if(jsondata.status == 'success'){ | |||
@@ -1076,7 +1076,7 @@ Contacts={ | |||
$.post(url, { id: bookid, name: displayname, active: active, description: description }, | |||
function(jsondata){ | |||
if(jsondata.status == 'success'){ | |||
$(button).closest('tr').prev().html(data.page).show().next().remove(); | |||
$(button).closest('tr').prev().html(jsondata.page).show().next().remove(); | |||
Contacts.UI.Contacts.update(); | |||
} else { | |||
Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message); |
@@ -103,6 +103,118 @@ class OC_Contacts_VCard{ | |||
return $result->fetchRow(); | |||
} | |||
/** | |||
* @brief Format property TYPE parameters for upgrading from v. 2.1 | |||
* @param $property Reference to a Sabre_VObject_Property. | |||
* In version 2.1 e.g. a phone can be formatted like: TEL;HOME;CELL:123456789 | |||
* This has to be changed to either TEL;TYPE=HOME,CELL:123456789 or TEL;TYPE=HOME;TYPE=CELL:123456789 - both are valid. | |||
*/ | |||
public static function formatPropertyTypes(&$property) { | |||
foreach($property->parameters as $key=>&$parameter){ | |||
$types = OC_Contacts_App::getTypesOfProperty($property->name); | |||
if(is_array($types) && in_array(strtoupper($parameter->name), array_keys($types)) || strtoupper($parameter->name) == 'PREF') { | |||
$property->parameters[] = new Sabre_VObject_Parameter('TYPE', $parameter->name); | |||
} | |||
unset($property->parameters[$key]); | |||
} | |||
} | |||
/** | |||
* @brief Decode properties for upgrading from v. 2.1 | |||
* @param $property Reference to a Sabre_VObject_Property. | |||
* The only encoding allowed in version 3.0 is 'b' for binary. All encoded strings | |||
* must therefor be decoded and the parameters removed. | |||
*/ | |||
public static function decodeProperty(&$property) { | |||
// Check out for encoded string and decode them :-[ | |||
foreach($property->parameters as $key=>&$parameter){ | |||
if(strtoupper($parameter->name) == 'ENCODING') { | |||
if(strtoupper($parameter->value) == 'QUOTED-PRINTABLE') { // what kind of other encodings could be used? | |||
$property->value = quoted_printable_decode($property->value); | |||
unset($property->parameters[$key]); | |||
} | |||
} elseif(strtoupper($parameter->name) == 'CHARSET') { | |||
unset($property->parameters[$key]); | |||
} | |||
} | |||
} | |||
/** | |||
* @brief Tries to update imported VCards to adhere to rfc2426 (VERSION: 3.0) | |||
* @param vcard An OC_VObject of type VCARD (passed by reference). | |||
*/ | |||
protected static function updateValuesFromAdd(&$vcard) { // any suggestions for a better method name? ;-) | |||
$stringprops = array('N', 'FN', 'ORG', 'NICK', 'ADR', 'NOTE'); | |||
$typeprops = array('ADR', 'TEL', 'EMAIL'); | |||
$upgrade = false; | |||
$fn = $n = $uid = $email = null; | |||
$version = $vcard->getAsString('VERSION'); | |||
// Add version if needed | |||
if($version && $version < '3.0') { | |||
$upgrade = true; | |||
OC_Log::write('contacts','OC_Contacts_VCard::updateValuesFromAdd. Updating from version: '.$version,OC_Log::DEBUG); | |||
} | |||
foreach($vcard->children as &$property){ | |||
// Decode string properties and remove obsolete properties. | |||
if($upgrade && in_array($property->name, $stringprops)) { | |||
self::decodeProperty($property); | |||
} | |||
// Fix format of type parameters. | |||
if($upgrade && in_array($property->name, $typeprops)) { | |||
OC_Log::write('contacts','OC_Contacts_VCard::updateValuesFromAdd. before: '.$property->serialize(),OC_Log::DEBUG); | |||
self::formatPropertyTypes($property); | |||
OC_Log::write('contacts','OC_Contacts_VCard::updateValuesFromAdd. after: '.$property->serialize(),OC_Log::DEBUG); | |||
} | |||
if($property->name == 'FN'){ | |||
$fn = $property->value; | |||
} | |||
if($property->name == 'N'){ | |||
$n = $property->value; | |||
} | |||
if($property->name == 'UID'){ | |||
$uid = $property->value; | |||
} | |||
if($property->name == 'EMAIL' && is_null($email)){ // only use the first email as substitute for missing N or FN. | |||
$email = $property->value; | |||
} | |||
} | |||
// Check for missing 'N', 'FN' and 'UID' properties | |||
if(!$fn) { | |||
if($n && $n != ';;;;'){ | |||
$fn = join(' ', array_reverse(array_slice(explode(';', $n), 0, 2))); | |||
} elseif($email) { | |||
$fn = $email; | |||
} else { | |||
$fn = 'Unknown Name'; | |||
} | |||
$vcard->setString('FN', $fn); | |||
OC_Log::write('contacts','OC_Contacts_VCard::updateValuesFromAdd. Added missing \'FN\' field: '.$fn,OC_Log::DEBUG); | |||
} | |||
if(!$n || $n = ';;;;'){ // Fix missing 'N' field. Ugly hack ahead ;-) | |||
$slice = array_reverse(array_slice(explode(' ', $fn), 0, 2)); // Take 2 first name parts of 'FN' and reverse. | |||
if(count($slice) < 2) { // If not enought, add one more... | |||
$slice[] = ""; | |||
} | |||
$n = implode(';', $slice).';;;'; | |||
$vcard->setString('N', $n); | |||
OC_Log::write('contacts','OC_Contacts_VCard::updateValuesFromAdd. Added missing \'N\' field: '.$n,OC_Log::DEBUG); | |||
} | |||
if(!$uid) { | |||
$vcard->setUID(); | |||
OC_Log::write('contacts','OC_Contacts_VCard::updateValuesFromAdd. Added missing \'UID\' field: '.$uid,OC_Log::DEBUG); | |||
} | |||
$vcard->setString('VERSION','3.0'); | |||
// Add product ID is missing. | |||
$prodid = trim($vcard->getAsString('PRODID')); | |||
if(!$prodid) { | |||
$appinfo = OC_App::getAppInfo('contacts'); | |||
$prodid = '-//ownCloud//NONSGML '.$appinfo['name'].' '.$appinfo['version'].'//EN'; | |||
$vcard->setString('PRODID', $prodid); | |||
} | |||
$now = new DateTime; | |||
$vcard->setString('REV', $now->format(DateTime::W3C)); | |||
} | |||
/** | |||
* @brief Adds a card | |||
* @param integer $id Addressbook id | |||
@@ -114,58 +226,17 @@ class OC_Contacts_VCard{ | |||
$card = OC_VObject::parse($data); | |||
if(!is_null($card)){ | |||
$fn = $card->getAsString('FN'); | |||
if(!$fn){ // Fix missing 'FN' field. | |||
$n = $card->getAsString('N'); | |||
if(!is_null($n)){ | |||
$fn = join(' ', array_reverse(array_slice(explode(';', $n), 0, 2))); | |||
$card->setString('FN', $fn); | |||
OC_Log::write('contacts','OC_Contacts_VCard::add. Added missing \'FN\' field: '.$fn,OC_Log::DEBUG); | |||
} else { | |||
$fn = 'Unknown Name'; | |||
} | |||
} | |||
$n = $card->getAsString('N'); | |||
if(!$n){ // Fix missing 'N' field. | |||
$n = implode(';', array_reverse(array_slice(explode(' ', $fn), 0, 2))).';;;'; | |||
$card->setString('N', $n); | |||
OC_Log::write('contacts','OC_Contacts_VCard::add. Added missing \'N\' field: '.$n,OC_Log::DEBUG); | |||
} | |||
$uid = $card->getAsString('UID'); | |||
if(!$uid){ | |||
$card->setUID(); | |||
$uid = $card->getAsString('UID'); | |||
}; | |||
$uri = $uid.'.vcf'; | |||
// Add product ID. | |||
$prodid = trim($card->getAsString('PRODID')); | |||
if(!$prodid) { | |||
$appinfo = OC_App::getAppInfo('contacts'); | |||
$prodid = '//ownCloud//NONSGML '.$appinfo['name'].' '.$appinfo['version'].'//EN'; | |||
$card->setString('PRODID', $prodid); | |||
} | |||
// VCARD must have a version | |||
$version = $card->getAsString('VERSION'); | |||
// Add version if needed | |||
if(!$version){ | |||
$card->add(new Sabre_VObject_Property('VERSION','3.0')); | |||
//$data = $card->serialize(); | |||
}/* else { | |||
OC_Log::write('contacts','OC_Contacts_VCard::add. Version already set as: '.$version,OC_Log::DEBUG); | |||
}*/ | |||
$now = new DateTime; | |||
$card->setString('REV', $now->format(DateTime::W3C)); | |||
self::updateValuesFromAdd($card); | |||
$data = $card->serialize(); | |||
} | |||
else{ | |||
// that's hard. Creating a UID and not saving it | |||
OC_Log::write('contacts','OC_Contacts_VCard::add. Error parsing VCard: '.$data,OC_Log::ERROR); | |||
return null; // Ditch cards that can't be parsed by Sabre. | |||
//$uid = self::createUID(); | |||
//$uri = $uid.'.vcf'; | |||
}; | |||
$fn = $card->getAsString('FN'); | |||
$uid = $card->getAsString('UID'); | |||
$uri = $uid.'.vcf'; | |||
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' ); | |||
$result = $stmt->execute(array($id,$fn,$data,$uri,time())); | |||
$newid = OC_DB::insertid('*PREFIX*contacts_cards'); | |||
@@ -183,54 +254,23 @@ class OC_Contacts_VCard{ | |||
* @return insertid | |||
*/ | |||
public static function addFromDAVData($id,$uri,$data){ | |||
$fn = $n = $uid = null; | |||
$email = null; | |||
$card = OC_VObject::parse($data); | |||
if(!is_null($card)){ | |||
foreach($card->children as $property){ | |||
if($property->name == 'FN'){ | |||
$fn = $property->value; | |||
} | |||
if($property->name == 'N'){ | |||
$n = $property->value; | |||
} | |||
if($property->name == 'UID'){ | |||
$uid = $property->value; | |||
} | |||
if($property->name == 'EMAIL' && is_null($email)){ | |||
$email = $property->value; | |||
} | |||
} | |||
} | |||
if(!$fn) { | |||
if($n){ | |||
$fn = join(' ', array_reverse(array_slice(explode(';', $n), 0, 2))); | |||
} elseif($email) { | |||
$fn = $email; | |||
} else { | |||
$fn = 'Unknown Name'; | |||
} | |||
$card->addProperty('FN', $fn); | |||
$data = $card->serialize(); | |||
OC_Log::write('contacts','OC_Contacts_VCard::add. Added missing \'FN\' field: '.$n,OC_Log::DEBUG); | |||
} | |||
if(!$n){ // Fix missing 'N' field. | |||
$n = implode(';', array_reverse(array_slice(explode(' ', $fn), 0, 2))).';;;'; | |||
$card->setString('N', $n); | |||
$data = $card->serialize(); | |||
OC_Log::write('contacts','OC_Contacts_VCard::add. Added missing \'N\' field: '.$n,OC_Log::DEBUG); | |||
} | |||
if(!$uid) { | |||
$card->setUID(); | |||
self::updateValuesFromAdd($card); | |||
$data = $card->serialize(); | |||
} | |||
} else { | |||
OC_Log::write('contacts','OC_Contacts_VCard::addFromDAVData. Error parsing VCard: '.$data, OC_Log::ERROR); | |||
return null; // Ditch cards that can't be parsed by Sabre. | |||
}; | |||
$fn = $card->getAsString('FN'); | |||
$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' ); | |||
$result = $stmt->execute(array($id,$fn,$data,$uri,time())); | |||
$newid = OC_DB::insertid('*PREFIX*contacts_cards'); | |||
OC_Contacts_Addressbook::touch($id); | |||
return OC_DB::insertid('*PREFIX*contacts_cards'); | |||
return $newid; | |||
} | |||
/** | |||
@@ -304,7 +344,7 @@ class OC_Contacts_VCard{ | |||
* @return boolean | |||
*/ | |||
public static function delete($id){ | |||
// FIXME: Add error checking. Touch addressbook. | |||
// FIXME: Add error checking. | |||
$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE id = ?' ); | |||
$stmt->execute(array($id)); | |||
@@ -381,10 +421,14 @@ class OC_Contacts_VCard{ | |||
'checksum' => md5($property->serialize())); | |||
foreach($property->parameters as $parameter){ | |||
// Faulty entries by kaddressbook | |||
// Actually TYPE=PREF is correct according to RFC 2426 | |||
// but this way is more handy in the UI. Tanghus. | |||
if($parameter->name == 'TYPE' && $parameter->value == 'PREF'){ | |||
$parameter->name = 'PREF'; | |||
$parameter->value = '1'; | |||
} | |||
// NOTE: Apparently Sabre_VObject_Reader can't always deal with value list parameters | |||
// like TYPE=HOME,CELL,VOICE. Tanghus. | |||
if ($property->name == 'TEL' && $parameter->name == 'TYPE'){ | |||
if (isset($temp['parameters'][$parameter->name])){ | |||
$temp['parameters'][$parameter->name][] = $parameter->value; |
@@ -1,8 +1,8 @@ | |||
#editor{ | |||
position: absoloute; | |||
position: fixed; | |||
display: block; | |||
top: 80px; | |||
left: 160px; | |||
top: 6.5em; | |||
left: 12.5em; | |||
} | |||
#editorwrapper{ | |||
position: absoloute; |
@@ -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); | |||
}); |
@@ -1,8 +1,8 @@ | |||
div#gallery_list { margin: 70pt 20pt 0 20pt; } | |||
div#gallery_list { margin: 4.5em 2em 0 2em; } | |||
div#gallery_list.leftcontent { padding-top: 15pt; margin: 0; position: absolute; bottom:0px; text-align: center; overflow: auto; } | |||
div.gallery_album_box { width: 200px; position:relative; text-align: center; border: 0; display: inline-block; margin: 5pt; vertical-align: top; padding: 20px 5px 5px 5px; position: relative; -webkit-transition: color 0.5s ease-in-out; -o-transition: color 0.5s ease-in-out; -moz-transition: color 0.5s ease-in-out;color: #BBB;} | |||
div.gallery_album_box { width: 200px; position:relative; text-align: center; border: 0; display: inline-block; margin: 5pt; vertical-align: top; padding: 5px 5px 5px 5px; position: relative; -webkit-transition: color 0.5s ease-in-out; -o-transition: color 0.5s ease-in-out; -moz-transition: color 0.5s ease-in-out;color: #BBB;} | |||
div.gallery_album_box h1 { font-size: 9pt; font-family: Verdana; } | |||
div.gallery_album_decoration { width: 200px; position: absolute; border: 0; height: 20px; top: 20px; text-align:right; vertical-align:middle; background-color: #eee; opacity: 0; -webkit-transition: opacity 0.5s ease-in-out; -moz-transition: opacity 0.5s ease-in-out; -o-transition: opacity 0.5s ease-in-out; border-bottom-right-radius: 7px; border-bottom-left-radius: 7px; -moz-border-radius-bottomright: 7px; -moz-border-radius-bottomleft:7px;} | |||
div.gallery_album_decoration { width: 200px; position: absolute; border: 0; height: 20px; top: 5px; text-align:right; vertical-align:middle; background-color: #eee; opacity: 0; -webkit-transition: opacity 0.5s ease-in-out; -moz-transition: opacity 0.5s ease-in-out; -o-transition: opacity 0.5s ease-in-out; border-bottom-right-radius: 7px; border-bottom-left-radius: 7px; -moz-border-radius-bottomright: 7px; -moz-border-radius-bottomleft:7px;} | |||
div.gallery_album_box:hover { color: black; } | |||
div.gallery_album_box:hover div.gallery_album_decoration { opacity: 0.7;} | |||
div.gallery_album_decoration a {padding: 0 4pt; cursor: pointer;} |
@@ -1,3 +1,5 @@ | |||
var initScanned = false; | |||
Collection={ | |||
artists:[], | |||
albums:[], | |||
@@ -68,10 +70,10 @@ Collection={ | |||
for(var i=0;i<Collection.loadedListeners.length;i++){ | |||
Collection.loadedListeners[i](); | |||
} | |||
if(data.songs.length==0){ | |||
if(data.songs.length==0 && initScanned == false){ | |||
$('#scan input.start').click(); | |||
initScanned = true; | |||
} | |||
} | |||
}); | |||
} | |||
@@ -81,13 +83,11 @@ Collection={ | |||
Collection.parent.show(); | |||
} | |||
if(!Collection.loaded){ | |||
Collection.load(Collection.display) | |||
Collection.load(Collection.display); | |||
}else{ | |||
if(Collection.parent){ | |||
Collection.parent.find('tr:not(.template)').remove(); | |||
var template=Collection.parent.find('tr.template'); | |||
var lastArtist=''; | |||
var lastAlbum=''; | |||
$.each(Collection.artists,function(i,artist){ | |||
if(artist.name && artist.songs.length>0){ | |||
var tr=template.clone().removeClass('template'); | |||
@@ -108,7 +108,7 @@ Collection={ | |||
$('tr[data-artist="'+artist.name+'"]').addClass('active'); | |||
}); | |||
if(artist.songs.length>1){ | |||
var expander=$('<a class="expander">></a>'); | |||
expander=$('<a class="expander">></a>'); | |||
expander.data('expanded',false); | |||
expander.click(function(event){ | |||
var tr=$(this).parent().parent(); | |||
@@ -136,10 +136,11 @@ Collection={ | |||
var first=true; | |||
$.each(artist.albums,function(j,album){ | |||
$.each(album.songs,function(i,song){ | |||
var newRow; | |||
if(first){ | |||
newRow=tr; | |||
}else{ | |||
var newRow=tr.clone(); | |||
newRow=tr.clone(); | |||
newRow.find('td.artist').text(''); | |||
newRow.find('.expander').remove(); | |||
} | |||
@@ -221,13 +222,14 @@ Collection={ | |||
tr.find('td.album-expander a.expander').addClass('expanded'); | |||
tr.find('td.album-expander a.expander').text('v'); | |||
$.each(albumData.songs,function(i,song){ | |||
var newRow; | |||
if(i>0){ | |||
var newRow=tr.clone(); | |||
newRow=tr.clone(); | |||
newRow.find('a.expander').remove(); | |||
newRow.find('td.album a').text(''); | |||
newRow.find('td.artist a').text(''); | |||
}else{ | |||
var newRow=tr; | |||
newRow=tr; | |||
} | |||
newRow.find('td.title a').text(song.name); | |||
newRow.find('td.title a').click(function(event){ | |||
@@ -339,11 +341,11 @@ Collection={ | |||
path:song.song_path, | |||
playCount:song.song_playcount, | |||
}; | |||
album.songs.push(songData) | |||
album.songs.push(songData); | |||
artist.songs.push(songData); | |||
Collection.songs.push(songData); | |||
} | |||
} | |||
}; | |||
$(document).ready(function(){ | |||
Collection.parent=$('#collection'); |
@@ -1,7 +1,7 @@ | |||
function musicTypeFromFile(file){ | |||
var extention=file.substr(file.indexOf('.')+1); | |||
if(extention=='ogg'){ | |||
return 'oga' | |||
return 'oga'; | |||
} | |||
//TODO check for more specific cases | |||
return extention; | |||
@@ -39,7 +39,7 @@ function loadPlayer(type,ready){ | |||
} | |||
$(document).ready(function() { | |||
loadPlayer.done=false | |||
loadPlayer.done=false; | |||
// FileActions.register('audio','Add to playlist','',addAudio); | |||
// FileActions.register('application/ogg','Add to playlist','',addAudio); |
@@ -16,7 +16,7 @@ $(document).ready(function(){ | |||
PlayList.render(); | |||
}); | |||
var button=$('<input type="button" title="'+t('media','Add album to playlist')+'" class="add"></input>'); | |||
button.css('background-image','url('+OC.imagePath('core','actions/play-add')+')') | |||
button.css('background-image','url('+OC.imagePath('core','actions/play-add')+')'); | |||
button.click(function(event){ | |||
event.stopPropagation(); | |||
PlayList.add(media); | |||
@@ -24,7 +24,7 @@ $(document).ready(function(){ | |||
}); | |||
row.find('div.name').append(button); | |||
button.tipsy({gravity:'n', fade:true, delayIn: 400, live:true}); | |||
} | |||
}; | |||
Collection.display(); | |||
Collection.load(function(){ | |||
@@ -34,11 +34,9 @@ $(document).ready(function(){ | |||
PlayList.add(song); | |||
PlayList.play(0); | |||
} | |||
}) | |||
}); | |||
}); | |||
function getUrlVars(){ | |||
var vars = {}, hash; | |||
var hashes = window.location.hash.substr(1).split('&'); | |||
@@ -52,8 +50,8 @@ function getUrlVars(){ | |||
function musicTypeFromFile(file){ | |||
var extention=file.split('.').pop(); | |||
if(extention=='ogg'){ | |||
return 'oga' | |||
return 'oga'; | |||
} | |||
//TODO check for more specific cases | |||
return extention; | |||
} | |||
} |
@@ -26,19 +26,19 @@ PlayList.render=function(){ | |||
li.click(function(event){ | |||
PlayList.play($(this).data('index')); | |||
}); | |||
li.append(img) | |||
li.append(img); | |||
li.data('index',i); | |||
li.addClass('song'); | |||
PlayList.parent.append(li); | |||
} | |||
$(".jp-playlist-" + PlayList.current).addClass("collection_playing"); | |||
} | |||
}; | |||
PlayList.getSelected=function(){ | |||
return $('tbody td.name input:checkbox:checked').parent().parent(); | |||
} | |||
}; | |||
PlayList.hide=function(){ | |||
$('#playlist').hide(); | |||
} | |||
}; | |||
$(document).ready(function(){ | |||
PlayList.parent=$('#leftcontent'); |
@@ -6,7 +6,7 @@ Scanner={ | |||
$.getJSON(OC.linkTo('media','ajax/api.php')+'?action=find_music',function(songs){ | |||
Scanner.songsFound=songs.length; | |||
if(ready){ | |||
ready(songs) | |||
ready(songs); | |||
} | |||
}); | |||
}, | |||
@@ -24,13 +24,13 @@ Scanner={ | |||
Scanner.songsScanned=data.count; | |||
$('#scan span.songCount').text(Scanner.songsScanned); | |||
var progress=(Scanner.songsScanned/Scanner.songsFound)*100; | |||
$('#scanprogressbar').progressbar('value',progress) | |||
$('#scanprogressbar').progressbar('value',progress); | |||
}); | |||
Scanner.eventSource.listen('done',function(count){ | |||
$('#scan input.start').show(); | |||
$('#scan input.stop').hide(); | |||
$('#scanprogressbar').hide(); | |||
Collection.load(Collection.display) | |||
Collection.load(Collection.display); | |||
if(ready){ | |||
ready(); | |||
} | |||
@@ -41,4 +41,4 @@ Scanner={ | |||
Scanner.close(); | |||
}, | |||
} | |||
}; |
@@ -13,6 +13,8 @@ $CONFIG = array( | |||
"forcessl" => false, | |||
"enablebackup" => false, | |||
"theme" => "", | |||
"3rdpartyroot" => "", | |||
"3rdpartyurl" => "", | |||
// "datadirectory" => "" | |||
); | |||
?> |
@@ -3,6 +3,7 @@ | |||
See the COPYING-README file. */ | |||
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, dialog, figure, footer, header, hgroup, nav, section { margin:0; padding:0; border:0; outline:0; font-weight:inherit; font-size:100%; font-family:inherit; vertical-align:baseline; cursor:default; } | |||
html, body { height: 100%; } | |||
article, aside, dialog, figure, footer, header, hgroup, nav, section { display:block; } | |||
body { line-height:1.5; } | |||
table { border-collapse:separate; border-spacing:0; white-space:nowrap; } | |||
@@ -55,11 +56,11 @@ input[type="submit"].highlight{ background:#ffc100; border:1px solid #db0; text- | |||
/* CONTENT ------------------------------------------------------------------ */ | |||
#controls { padding: 0 0.5em; width:100%; top:3.5em; height:2.8em; margin:0; background:#f7f7f7; border-bottom:1px solid #eee; position:fixed; z-index:50; -moz-box-shadow:0 -3px 7px #000; -webkit-box-shadow:0 -3px 7px #000; box-shadow:0 -3px 7px #000; } | |||
#controls .button { display:inline-block; } | |||
#content { margin:3.5em 0 0 12.5em; } | |||
#content { top: 3.5em; left: 12.5em; position: absolute; } | |||
#leftcontent, .leftcontent { position:fixed; overflow: auto; top:6.4em; width:20em; background:#f8f8f8; border-right:1px solid #ddd; } | |||
#leftcontent li, .leftcontent li { background:#f8f8f8; padding:.3em .8em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; -webkit-transition:background-color 500ms; -moz-transition:background-color 500ms; -o-transition:background-color 500ms; transition:background-color 500ms; } | |||
#leftcontent li:hover, #leftcontent li:active, #leftcontent li.active, .leftcontent li:hover, .leftcontent li:active, .leftcontent li.active { background:#eee; } | |||
#rightcontent, .rightcontent { position:absolute; top:6.4em; left:33em; } | |||
#rightcontent, .rightcontent { position:fixed; top: 6.4em; left: 32.5em; } | |||
/* LOG IN & INSTALLATION ------------------------------------------------------------ */ | |||
@@ -113,8 +114,8 @@ table:not(.nostyle) tr { -webkit-transition:background-color 500ms; -moz-transit | |||
tbody tr:hover, tr:active { background-color:#f8f8f8; } | |||
#body-settings .personalblock, #body-settings .helpblock { padding:.5em 1em; margin:1em; background:#f8f8f8; color:#555; text-shadow:#fff 0 1px 0; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; } | |||
#body-settings .personalblock#quota { position:relative; margin-top:4.5em; padding:0; } | |||
#body-settings #controls+.helpblock { position:relative; margin-top:7.3em; } | |||
#body-settings .personalblock#quota { position:relative; padding:0; } | |||
#body-settings #controls+.helpblock { position:relative; margin-top: 3em; } | |||
.personalblock > legend { margin-top:2em; } | |||
#quota div, div.jp-play-bar, div.jp-seek-bar { padding:0; background:#e6e6e6; font-weight:normal; white-space:nowrap; -moz-border-radius-bottomleft:.4em; -webkit-border-bottom-left-radius:.4em; border-bottom-left-radius:.4em; -moz-border-radius-topleft:.4em; -webkit-border-top-left-radius:.4em; border-top-left-radius:.4em; } |
@@ -13,7 +13,7 @@ function t(app,text){ | |||
success:function(jsondata){ | |||
t.cache[app] = jsondata.data; | |||
}, | |||
}) | |||
}); | |||
// Bad answer ... | |||
if( !( app in t.cache )){ | |||
@@ -58,7 +58,7 @@ OC={ | |||
} | |||
link+=app; | |||
if(type){ | |||
link+=type+'/' | |||
link+=type+'/'; | |||
} | |||
link+=file; | |||
return link; | |||
@@ -73,7 +73,7 @@ OC={ | |||
*/ | |||
imagePath:function(app,file){ | |||
if(file.indexOf('.')==-1){//if no extention is given, use png or svg depending on browser support | |||
file+=(SVGSupport())?'.svg':'.png' | |||
file+=(SVGSupport())?'.svg':'.png'; | |||
} | |||
return OC.filePath(app,'img',file); | |||
}, | |||
@@ -126,7 +126,7 @@ OC={ | |||
}); | |||
} | |||
} | |||
} | |||
}; | |||
OC.search.customResults={}; | |||
OC.search.currentResult=-1; | |||
OC.search.lastQuery=''; | |||
@@ -147,7 +147,7 @@ if(typeof localStorage !='undefined'){ | |||
getItem:function(name){ | |||
return JSON.parse(localStorage.getItem(OC.localStorage.namespace+name)); | |||
} | |||
} | |||
}; | |||
}else{ | |||
//dummy localstorage | |||
OC.localStorage={ | |||
@@ -160,7 +160,7 @@ if(typeof localStorage !='undefined'){ | |||
getItem:function(name){ | |||
return null; | |||
} | |||
} | |||
}; | |||
} | |||
/** | |||
@@ -182,7 +182,7 @@ if (!Array.prototype.filter) { | |||
} | |||
} | |||
return res; | |||
} | |||
}; | |||
} | |||
/** | |||
* implement Array.indexOf for browsers without native support | |||
@@ -235,11 +235,11 @@ SVGSupport.checkMimeType=function(){ | |||
}); | |||
if(headers["Content-Type"]!='image/svg+xml'){ | |||
replaceSVG(); | |||
SVGSupport.checkMimeType.correct=false | |||
SVGSupport.checkMimeType.correct=false; | |||
} | |||
} | |||
}); | |||
} | |||
}; | |||
SVGSupport.checkMimeType.correct=true; | |||
//replace all svg images with png for browser compatibility | |||
@@ -305,11 +305,12 @@ $(document).ready(function(){ | |||
$(window).resize(function () { | |||
fillHeight($('#leftcontent')); | |||
fillWindow($('#content')); | |||
fillWindow($('#rightcontent')); | |||
}); | |||
$(window).trigger('resize'); | |||
if(!SVGSupport()){//replace all svg images with png images for browser that dont support svg | |||
if(!SVGSupport()){ //replace all svg images with png images for browser that dont support svg | |||
replaceSVG(); | |||
}else{ | |||
SVGSupport.checkMimeType(); | |||
@@ -379,7 +380,6 @@ $(document).ready(function(){ | |||
} | |||
}); | |||
if($('body').attr("id")=="body-user") { $('#settings #expanddiv').hide(); } | |||
$('#settings #expand').click(function(event) { | |||
$('#settings #expanddiv').slideToggle(); | |||
event.stopPropagation(); |
@@ -44,8 +44,8 @@ | |||
<ul id="settings" class="svg"> | |||
<img id="expand" class="svg" alt="<?php echo $l->t('Settings');?>" src="<?php echo image_path('', 'actions/settings.svg'); ?>" /> | |||
<span style="display:none"><?php echo $l->t('Settings');?></span> | |||
<div id="expanddiv"> | |||
<span style="display:none;"><?php echo $l->t('Settings');?></span> | |||
<div id="expanddiv" <?php if($_['bodyid'] == 'body-user') echo 'style="display:none;"'; ?>> | |||
<?php foreach($_['settingsnavigation'] as $entry):?> | |||
<li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry["active"] ): ?> class="active"<?php endif; ?>><?php echo $entry['name'] ?></a></li> | |||
<?php endforeach; ?> |
@@ -54,6 +54,14 @@ class OC{ | |||
* the folder that stores the data for the root filesystem (e.g. /srv/http/owncloud/data) | |||
*/ | |||
public static $CONFIG_DATADIRECTORY_ROOT = ''; | |||
/** | |||
* The installation path of the 3rdparty folder on the server (e.g. /srv/http/owncloud/3rdparty) | |||
*/ | |||
public static $THIRDPARTYROOT = ''; | |||
/** | |||
* the root path of the 3rdparty folder for http requests (e.g. owncloud/3rdparty) | |||
*/ | |||
public static $THIRDPARTYWEBROOT = ''; | |||
/** | |||
* SPL autoload | |||
@@ -138,12 +146,35 @@ class OC{ | |||
} | |||
OC::$WEBROOT=substr($scriptName,0,strlen($scriptName)-strlen(OC::$SUBURI)); | |||
if(OC::$WEBROOT!='' and OC::$WEBROOT[0]!=='/'){ | |||
OC::$WEBROOT='/'.OC::$WEBROOT; | |||
} | |||
// search the 3rdparty folder | |||
if(OC_Config::getValue('3rdpartyroot', '')<>'' and OC_Config::getValue('3rdpartyurl', '')<>''){ | |||
OC::$THIRDPARTYROOT=OC_Config::getValue('3rdpartyroot', ''); | |||
OC::$THIRDPARTYWEBROOT=OC_Config::getValue('3rdpartyurl', ''); | |||
}elseif(file_exists(OC::$SERVERROOT.'/3rdparty')){ | |||
OC::$THIRDPARTYROOT=OC::$SERVERROOT; | |||
OC::$THIRDPARTYWEBROOT=OC::$WEBROOT; | |||
}elseif(file_exists(OC::$SERVERROOT.'/../3rdparty')){ | |||
$url_tmp=explode('/',OC::$WEBROOT); | |||
$length=count($url_tmp); | |||
unset($url_tmp[$length-1]); | |||
OC::$THIRDPARTYWEBROOT=implode('/',$url_tmp); | |||
$root_tmp=explode('/',OC::$SERVERROOT); | |||
$length=count($root_tmp); | |||
unset($root_tmp[$length-1]); | |||
OC::$THIRDPARTYROOT=implode('/',$root_tmp); | |||
}else{ | |||
echo("3rdparty directory not found! Please put the ownCloud 3rdparty folder in the ownCloud folder or the folder above. You can also configure the location in the config.php file."); | |||
exit; | |||
} | |||
// set the right include path | |||
set_include_path(OC::$SERVERROOT.'/lib'.PATH_SEPARATOR.OC::$SERVERROOT.'/config'.PATH_SEPARATOR.OC::$SERVERROOT.'/3rdparty'.PATH_SEPARATOR.get_include_path().PATH_SEPARATOR.OC::$SERVERROOT); | |||
set_include_path(OC::$SERVERROOT.'/lib'.PATH_SEPARATOR.OC::$SERVERROOT.'/config'.PATH_SEPARATOR.OC::$THIRDPARTYROOT.'/3rdparty'.PATH_SEPARATOR.get_include_path().PATH_SEPARATOR.OC::$SERVERROOT); | |||
// Redirect to installer if not installed | |||
if (!OC_Config::getValue('installed', false) && OC::$SUBURI != '/index.php') { |
@@ -318,6 +318,9 @@ class OC_DB { | |||
// Make changes and save them to a temporary file | |||
$file2 = tempnam( get_temp_dir(), 'oc_db_scheme_' ); | |||
if($file2 == ''){ | |||
die('could not create tempfile in get_temp_dir() - aborting'); | |||
} | |||
$content = str_replace( '*dbname*', $CONFIG_DBNAME, $content ); | |||
$content = str_replace( '*dbprefix*', $CONFIG_DBTABLEPREFIX, $content ); | |||
if( $CONFIG_DBTYPE == 'pgsql' ){ //mysql support it too but sqlite doesn't |
@@ -266,7 +266,7 @@ class OC_FileCache{ | |||
if(is_array($result)){ | |||
return $result['id']; | |||
}else{ | |||
OC_Log::write('getFieldId(): file not found in cache ('.$path.')','core',OC_Log::DEBUG); | |||
OC_Log::write('getFileId(): file not found in cache ('.$path.')','core',OC_Log::DEBUG); | |||
return -1; | |||
} | |||
} |
@@ -346,31 +346,41 @@ class OC_Template{ | |||
// Add the core js files or the js files provided by the selected theme | |||
foreach(OC_Util::$scripts as $script){ | |||
if(is_file(OC::$SERVERROOT."/themes/$theme/apps/$script$fext.js" )){ | |||
// Is it in 3rd party? | |||
if(is_file(OC::$THIRDPARTYROOT."/$script.js" )){ | |||
$page->append( "jsfiles", OC::$THIRDPARTYWEBROOT."/$script.js" ); | |||
// Is it in apps and overwritten by the theme? | |||
}elseif(is_file(OC::$SERVERROOT."/themes/$theme/apps/$script$fext.js" )){ | |||
$page->append( "jsfiles", OC::$WEBROOT."/themes/$theme/apps/$script$fext.js" ); | |||
}elseif(is_file(OC::$SERVERROOT."/themes/$theme/apps/$script.js" )){ | |||
$page->append( "jsfiles", OC::$WEBROOT."/themes/$theme/apps/$script.js" ); | |||
// Is it part of an app? | |||
}elseif(is_file(OC::$SERVERROOT."/apps/$script$fext.js" )){ | |||
$page->append( "jsfiles", OC::$WEBROOT."/apps/$script$fext.js" ); | |||
}elseif(is_file(OC::$SERVERROOT."/apps/$script.js" )){ | |||
$page->append( "jsfiles", OC::$WEBROOT."/apps/$script.js" ); | |||
// Is it in the owncloud root but overwritten by the theme? | |||
}elseif(is_file(OC::$SERVERROOT."/themes/$theme/$script$fext.js" )){ | |||
$page->append( "jsfiles", OC::$WEBROOT."/themes/$theme/$script$fext.js" ); | |||
}elseif(is_file(OC::$SERVERROOT."/themes/$theme/$script.js" )){ | |||
$page->append( "jsfiles", OC::$WEBROOT."/themes/$theme/$script.js" ); | |||
// Is it in the owncloud root ? | |||
}elseif(is_file(OC::$SERVERROOT."/$script$fext.js" )){ | |||
$page->append( "jsfiles", OC::$WEBROOT."/$script$fext.js" ); | |||
}elseif(is_file(OC::$SERVERROOT."/$script.js" )){ | |||
$page->append( "jsfiles", OC::$WEBROOT."/$script.js" ); | |||
// Is in core but overwritten by a theme? | |||
}elseif(is_file(OC::$SERVERROOT."/themes/$theme/core/$script$fext.js" )){ | |||
$page->append( "jsfiles", OC::$WEBROOT."/themes/$theme/core/$script$fext.js" ); | |||
}elseif(is_file(OC::$SERVERROOT."/themes/$theme/core/$script.js" )){ | |||
$page->append( "jsfiles", OC::$WEBROOT."/themes/$theme/core/$script.js" ); | |||
// Is it in core? | |||
}elseif(is_file(OC::$SERVERROOT."/core/$script$fext.js" )){ | |||
$page->append( "jsfiles", OC::$WEBROOT."/core/$script$fext.js" ); | |||
}else{ | |||
@@ -380,14 +390,20 @@ class OC_Template{ | |||
} | |||
// Add the css files | |||
foreach(OC_Util::$styles as $style){ | |||
if(is_file(OC::$SERVERROOT."/apps/$style$fext.css" )){ | |||
// is it in 3rdparty? | |||
if(is_file(OC::$THIRDPARTYROOT."/$style.css" )){ | |||
$page->append( "cssfiles", OC::$THIRDPARTYWEBROOT."/$style.css" ); | |||
// or in apps? | |||
}elseif(is_file(OC::$SERVERROOT."/apps/$style$fext.css" )){ | |||
$page->append( "cssfiles", OC::$WEBROOT."/apps/$style$fext.css" ); | |||
}elseif(is_file(OC::$SERVERROOT."/apps/$style.css" )){ | |||
$page->append( "cssfiles", OC::$WEBROOT."/apps/$style.css" ); | |||
// or in the owncloud root? | |||
}elseif(is_file(OC::$SERVERROOT."/$style$fext.css" )){ | |||
$page->append( "cssfiles", OC::$WEBROOT."/$style$fext.css" ); | |||
}elseif(is_file(OC::$SERVERROOT."/$style.css" )){ | |||
$page->append( "cssfiles", OC::$WEBROOT."/$style.css" ); | |||
// or in core ? | |||
}elseif(is_file(OC::$SERVERROOT."/core/$style$fext.css" )){ | |||
$page->append( "cssfiles", OC::$WEBROOT."/core/$style$fext.css" ); | |||
}else{ |
@@ -26,9 +26,9 @@ tr:hover>td.password>span { margin:0; cursor:pointer; } | |||
tr:hover>td.remove>img, tr:hover>td.password>img, tr:hover>td.quota>img { visibility:visible; cursor:pointer; } | |||
tr:hover>td.remove>img { float:right; } | |||
li.selected { background-color:#ddd; } | |||
#content>table:not(.nostyle) { margin-top:6.5em; } | |||
#content>table:not(.nostyle) { margin-top:3em; } | |||
table:not(.nostyle) { width:100%; } | |||
#rightcontent { padding-left: 1em; } | |||
/* APPS */ | |||
li { color:#888; } |
@@ -12,15 +12,14 @@ foreach($_["groups"] as $group) { | |||
<div id="controls"> | |||
<form id="newuser"> | |||
<th class="name"><input id="newusername" placeholder="<?php echo $l->t('Name')?>" /></th> | |||
<th class="password"><input type="password" id="newuserpassword" placeholder="<?php echo $l->t('Password')?>" /></th> | |||
<th class="groups"><select id="newusergroups" data-placeholder="groups" title="<?php echo $l->t('Groups')?>" multiple="multiple"> | |||
<input id="newusername" placeholder="<?php echo $l->t('Name')?>" /> | |||
<input type="password" id="newuserpassword" placeholder="<?php echo $l->t('Password')?>" /> | |||
<select id="newusergroups" data-placeholder="groups" title="<?php echo $l->t('Groups')?>" multiple="multiple"> | |||
<?php foreach($_["groups"] as $group): ?> | |||
<option value="<?php echo $group['name'];?>"><?php echo $group['name'];?></option> | |||
<?php endforeach;?> | |||
</select></th> | |||
<th class="quota"></th> | |||
<th><input type="submit" value="<?php echo $l->t('Create')?>" /></th> | |||
</select> | |||
<input type="submit" value="<?php echo $l->t('Create')?>" /> | |||
</form> | |||
</div> | |||