1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-01 13:24:10 +01:00

Fix whitespace in contacts

This commit is contained in:
Bart Visscher 2012-09-07 14:32:45 +02:00
parent 0986558df2
commit b179feeea2
29 changed files with 221 additions and 221 deletions

View File

@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
@ -23,7 +23,7 @@ foreach($vcard->children as $property){
$checksum = md5($property->serialize());
OCP\JSON::success(array(
'data' => array(
'value' => $property->value,
'value' => $property->value,
'checksum' => $checksum,
)));
exit();

View File

@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
OCP\JSON::callCheck();
@ -28,7 +28,7 @@ if(count($addressbooks) == 0) {
$addressbookids = array();
foreach($addressbooks as $addressbook) {
$addressbookids[] = $addressbook['id'];
}
}
$contacts = OC_Contacts_VCard::all($addressbookids);
if(count($contacts) == 0) {
bailOut(OC_Contacts_App::$l10n->t('No contacts found.'));
@ -37,7 +37,7 @@ if(count($contacts) == 0) {
$cards = array();
foreach($contacts as $contact) {
$cards[] = array($contact['id'], $contact['carddata']);
}
}
debug('Before delete: '.print_r($categories, true));

View File

@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');

View File

@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
OCP\JSON::callCheck();

View File

@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');

View File

@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');
require_once 'loghandler.php';

View File

@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
OCP\JSON::checkLoggedIn();
OCP\App::checkAppEnabled('contacts');
$tmpl = new OCP\Template('contacts', 'part.import');

View File

@ -20,14 +20,14 @@
*
*/
function bailOut($msg, $tracelevel=1, $debuglevel=OCP\Util::ERROR)
function bailOut($msg, $tracelevel=1, $debuglevel=OCP\Util::ERROR)
{
OCP\JSON::error(array('data' => array('message' => $msg)));
debug($msg, $tracelevel, $debuglevel);
exit();
}
function debug($msg, $tracelevel=0, $debuglevel=OCP\Util::DEBUG)
function debug($msg, $tracelevel=0, $debuglevel=OCP\Util::DEBUG)
{
if(PHP_VERSION >= "5.4") {
$call = debug_backtrace(false, $tracelevel+1);
@ -37,8 +37,8 @@ function debug($msg, $tracelevel=0, $debuglevel=OCP\Util::DEBUG)
error_log('trace: '.print_r($call, true));
$call = $call[$tracelevel];
if($debuglevel !== false) {
OCP\Util::writeLog('contacts',
$call['file'].'. Line: '.$call['line'].': '.$msg,
OCP\Util::writeLog('contacts',
$call['file'].'. Line: '.$call['line'].': '.$msg,
$debuglevel);
}
}

View File

@ -50,8 +50,8 @@ if($image->width() > 400 || $image->height() > 400) {
$image->resize(400); // Prettier resizing than with browser and saves bandwidth.
}
if(!$image->fixOrientation()) { // No fatal error so we don't bail out.
OCP\Util::writeLog('contacts',
'ajax/oc_photo.php: Couldn\'t save correct image orientation: '.$localpath,
OCP\Util::writeLog('contacts',
'ajax/oc_photo.php: Couldn\'t save correct image orientation: '.$localpath,
OCP\Util::DEBUG);
}
if(OC_Cache::set($tmpkey, $image->data(), 600)) {

View File

@ -5,7 +5,7 @@
* later.
* See the COPYING-README file.
*/
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('contacts');

View File

@ -48,7 +48,7 @@ if($fn) {
// File input transfers are handled here
if (!isset($_FILES['importfile'])) {
OCP\Util::writeLog('contacts',
'ajax/uploadphoto.php: No file was uploaded. Unknown error.',
'ajax/uploadphoto.php: No file was uploaded. Unknown error.',
OCP\Util::DEBUG);
OCP\JSON::error(array('
data' => array(

View File

@ -1,6 +1,6 @@
<?php
class OC_Migration_Provider_Contacts extends OC_Migration_Provider{
// Create the xml for the user supplied
function export( ) {
$options = array(
@ -16,19 +16,19 @@ class OC_Migration_Provider_Contacts extends OC_Migration_Provider{
'matchcol'=>'addressbookid',
'matchval'=>$ids
);
// Export tags
$ids2 = $this->content->copyRows( $options );
// If both returned some ids then they worked
if(is_array($ids) && is_array($ids2)) {
return true;
} else {
return false;
}
}
// Import function for contacts
function import( ) {
switch( $this->appinfo->version ) {
@ -38,7 +38,7 @@ class OC_Migration_Provider_Contacts extends OC_Migration_Provider{
$results = $query->execute( array( $this->olduid ) );
$idmap = array();
while( $row = $results->fetchRow() ) {
// Import each addressbook
// Import each addressbook
$addressbookquery = OCP\DB::prepare( 'INSERT INTO `*PREFIX*contacts_addressbooks` (`userid`, `displayname`, `uri`, `description`, `ctag`) VALUES (?, ?, ?, ?, ?)' );
$addressbookquery->execute( array( $this->uid, $row['displayname'], $row['uri'], $row['description'], $row['ctag'] ) );
// Map the id
@ -48,22 +48,22 @@ class OC_Migration_Provider_Contacts extends OC_Migration_Provider{
}
// Now tags
foreach($idmap as $oldid => $newid) {
$query = $this->content->prepare( 'SELECT * FROM `contacts_cards` WHERE `addressbookid` LIKE ?' );
$results = $query->execute( array( $oldid ) );
while( $row = $results->fetchRow() ){
// Import the contacts
$contactquery = OCP\DB::prepare( 'INSERT INTO `*PREFIX*contacts_cards` (`addressbookid`, `fullname`, `carddata`, `uri`, `lastmodified`) VALUES (?, ?, ?, ?, ?)' );
$contactquery->execute( array( $newid, $row['fullname'], $row['carddata'], $row['uri'], $row['lastmodified'] ) );
}
$contactquery->execute( array( $newid, $row['fullname'], $row['carddata'], $row['uri'], $row['lastmodified'] ) );
}
}
// All done!
break;
}
return true;
}
}
// Load the provider

View File

@ -5,11 +5,11 @@ if (version_compare($installedVersion, '0.2.3', '<')) {
// First set all address books in-active.
$stmt = OCP\DB::prepare( 'UPDATE `*PREFIX*contacts_addressbooks` SET `active`=0' );
$result = $stmt->execute(array());
// Then get all the active address books.
$stmt = OCP\DB::prepare( 'SELECT `userid`,`configvalue` FROM `*PREFIX*preferences` WHERE `appid`=\'contacts\' AND `configkey`=\'openaddressbooks\'' );
$result = $stmt->execute(array());
// Prepare statement for updating the new 'active' field.
$stmt = OCP\DB::prepare( 'UPDATE `*PREFIX*contacts_addressbooks` SET `active`=? WHERE `id`=? AND `userid`=?' );
while( $row = $result->fetchRow()) {
@ -18,7 +18,7 @@ if (version_compare($installedVersion, '0.2.3', '<')) {
$r = $stmt->execute(array(1, $id, $row['userid']));
}
}
// Remove the old preferences.
$stmt = OCP\DB::prepare( 'DELETE FROM `*PREFIX*preferences` WHERE `appid`=\'contacts\' AND `configkey`=\'openaddressbooks\'' );
$result = $stmt->execute(array());

View File

@ -44,7 +44,7 @@
}
.jcrop-tracker {
height: 100%;
height: 100%;
-webkit-tap-highlight-color: transparent; /* "turn off" link highlight */
-webkit-touch-callout: none; /* disable callout, image save panel */
-webkit-user-select: none; /* disable cut copy paste */

View File

@ -1,3 +1,3 @@
.combo-button { background:url('../../../core/img/actions/triangle-s.svg') no-repeat center; margin-left: -1px; float: left; border: none; }
.ui-button-icon-only .ui-button-text { padding: 0.35em; }
.ui-button-icon-only .ui-button-text { padding: 0.35em; }
.ui-autocomplete-input { margin: 0; padding: 0.48em 0 0.47em 0.45em; }

View File

@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('contacts');
$bookid = isset($_GET['bookid']) ? $_GET['bookid'] : null;
@ -16,12 +16,12 @@ if(isset($bookid)) {
$addressbook = OC_Contacts_App::getAddressbook($bookid);
//$cardobjects = OC_Contacts_VCard::all($bookid);
header('Content-Type: text/directory');
header('Content-Disposition: inline; filename='
. str_replace(' ', '_', $addressbook['displayname']) . '.vcf');
header('Content-Disposition: inline; filename='
. str_replace(' ', '_', $addressbook['displayname']) . '.vcf');
$start = 0;
$batchsize = OCP\Config::getUserValue(OCP\User::getUser(),
'contacts',
$batchsize = OCP\Config::getUserValue(OCP\User::getUser(),
'contacts',
'export_batch_size', 20);
while($cardobjects = OC_Contacts_VCard::all($bookid, $start, $batchsize)){
foreach($cardobjects as $card) {
@ -32,7 +32,7 @@ if(isset($bookid)) {
}elseif(isset($contactid)) {
$data = OC_Contacts_App::getContactObject($contactid);
header('Content-Type: text/vcard');
header('Content-Disposition: inline; filename='
. str_replace(' ', '_', $data['fullname']) . '.vcf');
header('Content-Disposition: inline; filename='
. str_replace(' ', '_', $data['fullname']) . '.vcf');
echo $data['carddata'];
}

View File

@ -7,7 +7,7 @@
*/
//check for addressbooks rights or create new one
ob_start();
OCP\JSON::checkLoggedIn();
OCP\App::checkAppEnabled('contacts');
session_write_close();
@ -39,7 +39,7 @@ if(!$file) {
exit();
}
if(isset($_POST['method']) && $_POST['method'] == 'new') {
$id = OC_Contacts_Addressbook::add(OCP\USER::getUser(),
$id = OC_Contacts_Addressbook::add(OCP\USER::getUser(),
$_POST['addressbookname']);
if(!$id) {
OCP\JSON::error(
@ -56,7 +56,7 @@ if(isset($_POST['method']) && $_POST['method'] == 'new') {
OCP\JSON::error(
array(
'data' => array(
'message' => 'Error getting the ID of the address book.',
'message' => 'Error getting the ID of the address book.',
'file'=>$_POST['file']
)
)
@ -95,15 +95,15 @@ if(!count($parts) > 0) {
array(
'data' => array(
'message' => 'No contacts to import in '
. $_POST['file'].'. Please check if the file is corrupted.',
. $_POST['file'].'. Please check if the file is corrupted.',
'file'=>$_POST['file']
)
)
);
if(isset($_POST['fstype']) && $_POST['fstype'] == 'OC_FilesystemView') {
if(!$view->unlink('/imports/' . $_POST['file'])) {
OCP\Util::writeLog('contacts',
'Import: Error unlinking OC_FilesystemView ' . '/' . $_POST['file'],
OCP\Util::writeLog('contacts',
'Import: Error unlinking OC_FilesystemView ' . '/' . $_POST['file'],
OCP\Util::ERROR);
}
}
@ -113,8 +113,8 @@ foreach($parts as $part){
$card = OC_VObject::parse($part);
if (!$card) {
$failed += 1;
OCP\Util::writeLog('contacts',
'Import: skipping card. Error parsing VCard: ' . $part,
OCP\Util::writeLog('contacts',
'Import: skipping card. Error parsing VCard: ' . $part,
OCP\Util::ERROR);
continue; // Ditch cards that can't be parsed by Sabre.
}
@ -122,8 +122,8 @@ foreach($parts as $part){
OC_Contacts_VCard::add($id, $card);
$imported += 1;
} catch (Exception $e) {
OCP\Util::writeLog('contacts',
'Error importing vcard: ' . $e->getMessage() . $nl . $card,
OCP\Util::writeLog('contacts',
'Error importing vcard: ' . $e->getMessage() . $nl . $card,
OCP\Util::ERROR);
$failed += 1;
}
@ -134,16 +134,16 @@ sleep(3);
OC_Cache::remove($progresskey);
if(isset($_POST['fstype']) && $_POST['fstype'] == 'OC_FilesystemView') {
if(!$view->unlink('/imports/' . $_POST['file'])) {
OCP\Util::writeLog('contacts',
'Import: Error unlinking OC_FilesystemView ' . '/' . $_POST['file'],
OCP\Util::writeLog('contacts',
'Import: Error unlinking OC_FilesystemView ' . '/' . $_POST['file'],
OCP\Util::ERROR);
}
}
OCP\JSON::success(
array(
'data' => array(
'imported'=>$imported,
'failed'=>$failed,
'imported'=>$imported,
'failed'=>$failed,
'file'=>$_POST['file'],
)
)

View File

@ -2154,7 +2154,7 @@ $(document).ready(function(){
retries = aid = 0;
$('#uploadprogressbar').fadeOut();
} else {
setTimeout(function() { //
setTimeout(function() { //
waitForImport();
}, 1000);
}

View File

@ -17,13 +17,13 @@
resize: function() { }
}
}, $.expandingTextarea || {});
var cloneCSSProperties = [
'lineHeight', 'textDecoration', 'letterSpacing',
'fontSize', 'fontFamily', 'fontStyle',
'fontWeight', 'textTransform', 'textAlign',
'direction', 'wordSpacing', 'fontSizeAdjust',
'wordWrap',
'fontSize', 'fontFamily', 'fontStyle',
'fontWeight', 'textTransform', 'textAlign',
'direction', 'wordSpacing', 'fontSizeAdjust',
'wordWrap',
'borderLeftWidth', 'borderRightWidth',
'borderTopWidth','borderBottomWidth',
'paddingLeft', 'paddingRight',
@ -32,87 +32,87 @@
'marginTop','marginBottom',
'boxSizing', 'webkitBoxSizing', 'mozBoxSizing', 'msBoxSizing'
];
var textareaCSS = {
position: "absolute",
height: "100%",
resize: "none"
};
var preCSS = {
visibility: "hidden",
border: "0 solid",
whiteSpace: "pre-wrap"
whiteSpace: "pre-wrap"
};
var containerCSS = {
position: "relative"
};
function resize() {
$(this).closest('.expandingText').find("div").text(this.value + ' ');
$(this).trigger("resize.expanding");
}
$.fn.expandingTextarea = function(o) {
var opts = $.extend({ }, $.expandingTextarea.opts, o);
if (o === "resize") {
return this.trigger("input.expanding");
}
if (o === "destroy") {
this.filter(".expanding-init").each(function() {
var textarea = $(this).removeClass('expanding-init');
var container = textarea.closest('.expandingText');
container.before(textarea).remove();
textarea
.attr('style', textarea.data('expanding-styles') || '')
.removeData('expanding-styles');
});
return this;
}
this.filter("textarea").not(".expanding-init").addClass("expanding-init").each(function() {
var textarea = $(this);
textarea.wrap("<div class='expandingText'></div>");
textarea.after("<pre class='textareaClone'><div></div></pre>");
var container = textarea.parent().css(containerCSS);
var pre = container.find("pre").css(preCSS);
// Store the original styles in case of destroying.
textarea.data('expanding-styles', textarea.attr('style'));
textarea.css(textareaCSS);
$.each(cloneCSSProperties, function(i, p) {
var val = textarea.css(p);
// Only set if different to prevent overriding percentage css values.
if (pre.css(p) !== val) {
pre.css(p, val);
}
});
textarea.bind("input.expanding propertychange.expanding", resize);
resize.apply(this);
if (opts.resize) {
textarea.bind("resize.expanding", opts.resize);
}
});
return this;
};
$(function () {
if ($.expandingTextarea.autoInitialize) {
$($.expandingTextarea.initialSelector).expandingTextarea();
}
});
}));

View File

@ -1,7 +1,7 @@
/**
* jquery.Jcrop.js v0.9.9 {{{
*
* jQuery Image Cropping Plugin - released under MIT License
* jQuery Image Cropping Plugin - released under MIT License
* Author: Kelly Hallman <khallman@gmail.com>
* http://github.com/tapmodo/Jcrop
*
@ -171,7 +171,7 @@
if ((ord === 'move') && !options.allowMove) {
return false;
}
// Fix position of crop area when dragged the very first time.
// Necessary when crop image is in a hidden element when page is loaded.
docOffset = getPos($img);
@ -307,12 +307,12 @@
$origimg.width($origimg[0].width);
$origimg.height($origimg[0].height);
} else {
// Obtain dimensions from temporary image in case the original is not loaded yet (e.g. IE 7.0).
// Obtain dimensions from temporary image in case the original is not loaded yet (e.g. IE 7.0).
var tempImage = new Image();
tempImage.src = $origimg[0].src;
$origimg.width(tempImage.width);
$origimg.height(tempImage.height);
}
}
var $img = $origimg.clone().removeAttr('id').css(img_css).show();
@ -330,8 +330,8 @@
var boundx = $img.width(),
boundy = $img.height(),
$div = $('<div />').width(boundx).height(boundy).addClass(cssClass('holder')).css({
position: 'relative',
backgroundColor: options.bgColor
@ -343,24 +343,24 @@
var $img2 = $('<div />'),
$img_holder = $('<div />')
$img_holder = $('<div />')
.width('100%').height('100%').css({
zIndex: 310,
position: 'absolute',
overflow: 'hidden'
}),
$hdl_holder = $('<div />')
.width('100%').height('100%').css('zIndex', 320),
$hdl_holder = $('<div />')
.width('100%').height('100%').css('zIndex', 320),
$sel = $('<div />')
$sel = $('<div />')
.css({
position: 'absolute',
zIndex: 600
}).dblclick(function(){
var c = Coords.getFixed();
options.onDblClick.call(api,c);
}).insertBefore($img).append($img_holder, $hdl_holder);
}).insertBefore($img).append($img_holder, $hdl_holder);
if (img_mode) {
@ -396,7 +396,7 @@
// }}}
// }}}
// Internal Modules {{{
// Touch Module {{{
// Touch Module {{{
var Touch = (function () {
// Touch support detection function adapted (under MIT License)
// from code by Jeffrey Sambells - http://github.com/iamamused/
@ -532,8 +532,8 @@
// This function could use some optimization I think...
var aspect = options.aspectRatio,
min_x = options.minSize[0] / xscale,
//min_y = options.minSize[1]/yscale,
max_x = options.maxSize[0] / xscale,
max_y = options.maxSize[1] / yscale,
@ -1105,7 +1105,7 @@
{
seehandles = false;
$hdl_holder.hide();
}
}
//}}}
function animMode(v) //{{{
{
@ -1114,13 +1114,13 @@
} else {
enableHandles();
}
}
}
//}}}
function done() //{{{
{
animMode(false);
refresh();
}
}
//}}}
/* Insert draggable elements {{{*/
@ -1191,7 +1191,7 @@
done: done
};
}());
//}}}
// Tracker Module {{{
var Tracker = (function () {
@ -1214,7 +1214,7 @@
.bind('mousemove.jcrop',trackMove)
.bind('mouseup.jcrop',trackUp);
}
}
}
//}}}
function toBack() //{{{
{
@ -1222,13 +1222,13 @@
zIndex: 290
});
$(document).unbind('.jcrop');
}
}
//}}}
function trackMove(e) //{{{
{
onMove(mouseAbs(e));
return false;
}
}
//}}}
function trackUp(e) //{{{
{

View File

@ -4,7 +4,7 @@
(function( $ ) {
$.widget('ui.combobox', {
options: {
options: {
id: null,
name: null,
showButton: false,
@ -84,7 +84,7 @@
// pass empty string as value to search for, displaying all results
input.autocomplete('search', '');
});
if(this.options['showButton']) {
this.button = $('<button type="button">&nbsp;</button>')
.attr('tabIndex', -1 )

View File

@ -1,86 +1,86 @@
/**
* 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.
*/
Contacts_Import={
importdialog: function(filename){
var path = $('#dir').val();
$('body').append('<div id="contacts_import"></div>');
$('#contacts_import').load(OC.filePath('contacts', 'ajax', 'importdialog.php'), {filename:filename, path:path}, function(){Contacts_Import.initdialog(filename);});
},
initdialog: function(filename){
$('#contacts_import_dialog').dialog({
width : 500,
close : function() {
$(this).dialog('destroy').remove();
$('#contacts_import').remove();
}
});
$('#import_done_button').click(function(){
$('#contacts_import_dialog').dialog('destroy').remove();
$('#contacts_import').remove();
});
$('#progressbar').progressbar({value: 0});
$('#startimport').click(function(){
var filename = $('#filename').val();
var path = $('#path').val();
var method = 'old';
var addressbookid = $('#contacts option:selected').val();
if($('#contacts option:selected').val() == 'newaddressbook'){
var method = 'new';
var addressbookname = $('#newaddressbook').val();
var addressbookname = $.trim(addressbookname);
if(addressbookname == ''){
$('#newaddressbook').css('background-color', '#FF2626');
$('#newaddressbook').focus(function(){
$('#newaddressbook').css('background-color', '#F8F8F8');
});
return false;
}
}
$('#newaddressbook').attr('readonly', 'readonly');
$('#contacts').attr('disabled', 'disabled');
var progresskey = $('#progresskey').val();
$.post(OC.filePath('contacts', '', 'import.php') + '?progresskey='+progresskey, {method: String (method), addressbookname: String (addressbookname), path: String (path), file: String (filename), id: String (addressbookid)}, function(jsondata){
if(jsondata.status == 'success'){
$('#progressbar').progressbar('option', 'value', 100);
$('#import_done').find('p').html(t('contacts', 'Result: ') + jsondata.data.imported + t('contacts', ' imported, ') + jsondata.data.failed + t('contacts', ' failed.'));
} else {
$('#import_done').find('p').html(jsondata.message);
}
$('#import_done').show().find('p').addClass('bold');
$('#progressbar').fadeOut('slow');
});
$('#form_container').css('display', 'none');
$('#progressbar_container').css('display', 'block');
window.setTimeout('Contacts_Import.getimportstatus(\'' + progresskey + '\')', 500);
});
$('#contacts').change(function(){
if($('#contacts option:selected').val() == 'newaddressbook'){
$('#newaddressbookform').slideDown('slow');
}else{
$('#newaddressbookform').slideUp('slow');
}
});
},
getimportstatus: function(progresskey){
$.get(OC.filePath('contacts', '', 'import.php') + '?progress=1&progresskey=' + progresskey, function(percent){
$('#progressbar').progressbar('option', 'value', parseInt(percent));
if(percent < 100){
window.setTimeout('Contacts_Import.getimportstatus(\'' + progresskey + '\')', 500);
}else{
$('#import_done').css('display', 'block');
}
});
}
}
$(document).ready(function(){
if(typeof FileActions !== 'undefined'){
FileActions.register('text/vcard','importaddressbook', OC.PERMISSION_READ, '', Contacts_Import.importdialog);
FileActions.setDefault('text/vcard','importaddressbook');
FileActions.register('text/x-vcard','importaddressbook', OC.PERMISSION_READ, '', Contacts_Import.importdialog);
FileActions.setDefault('text/x-vcard','importaddressbook');
};
/**
* 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.
*/
Contacts_Import={
importdialog: function(filename){
var path = $('#dir').val();
$('body').append('<div id="contacts_import"></div>');
$('#contacts_import').load(OC.filePath('contacts', 'ajax', 'importdialog.php'), {filename:filename, path:path}, function(){Contacts_Import.initdialog(filename);});
},
initdialog: function(filename){
$('#contacts_import_dialog').dialog({
width : 500,
close : function() {
$(this).dialog('destroy').remove();
$('#contacts_import').remove();
}
});
$('#import_done_button').click(function(){
$('#contacts_import_dialog').dialog('destroy').remove();
$('#contacts_import').remove();
});
$('#progressbar').progressbar({value: 0});
$('#startimport').click(function(){
var filename = $('#filename').val();
var path = $('#path').val();
var method = 'old';
var addressbookid = $('#contacts option:selected').val();
if($('#contacts option:selected').val() == 'newaddressbook'){
var method = 'new';
var addressbookname = $('#newaddressbook').val();
var addressbookname = $.trim(addressbookname);
if(addressbookname == ''){
$('#newaddressbook').css('background-color', '#FF2626');
$('#newaddressbook').focus(function(){
$('#newaddressbook').css('background-color', '#F8F8F8');
});
return false;
}
}
$('#newaddressbook').attr('readonly', 'readonly');
$('#contacts').attr('disabled', 'disabled');
var progresskey = $('#progresskey').val();
$.post(OC.filePath('contacts', '', 'import.php') + '?progresskey='+progresskey, {method: String (method), addressbookname: String (addressbookname), path: String (path), file: String (filename), id: String (addressbookid)}, function(jsondata){
if(jsondata.status == 'success'){
$('#progressbar').progressbar('option', 'value', 100);
$('#import_done').find('p').html(t('contacts', 'Result: ') + jsondata.data.imported + t('contacts', ' imported, ') + jsondata.data.failed + t('contacts', ' failed.'));
} else {
$('#import_done').find('p').html(jsondata.message);
}
$('#import_done').show().find('p').addClass('bold');
$('#progressbar').fadeOut('slow');
});
$('#form_container').css('display', 'none');
$('#progressbar_container').css('display', 'block');
window.setTimeout('Contacts_Import.getimportstatus(\'' + progresskey + '\')', 500);
});
$('#contacts').change(function(){
if($('#contacts option:selected').val() == 'newaddressbook'){
$('#newaddressbookform').slideDown('slow');
}else{
$('#newaddressbookform').slideUp('slow');
}
});
},
getimportstatus: function(progresskey){
$.get(OC.filePath('contacts', '', 'import.php') + '?progress=1&progresskey=' + progresskey, function(percent){
$('#progressbar').progressbar('option', 'value', parseInt(percent));
if(percent < 100){
window.setTimeout('Contacts_Import.getimportstatus(\'' + progresskey + '\')', 500);
}else{
$('#import_done').css('display', 'block');
}
});
}
}
$(document).ready(function(){
if(typeof FileActions !== 'undefined'){
FileActions.register('text/vcard','importaddressbook', OC.PERMISSION_READ, '', Contacts_Import.importdialog);
FileActions.setDefault('text/vcard','importaddressbook');
FileActions.register('text/x-vcard','importaddressbook', OC.PERMISSION_READ, '', Contacts_Import.importdialog);
FileActions.setDefault('text/x-vcard','importaddressbook');
};
});

View File

@ -62,9 +62,9 @@ class OC_Contacts_Addressbook {
$addressbooks = array();
while( $row = $result->fetchRow()) {
$row['permissions'] = OCP\Share::PERMISSION_CREATE
| OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_UPDATE
| OCP\Share::PERMISSION_DELETE | OCP\Share::PERMISSION_SHARE;
$row['permissions'] = OCP\Share::PERMISSION_CREATE
| OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_UPDATE
| OCP\Share::PERMISSION_DELETE | OCP\Share::PERMISSION_SHARE;
$addressbooks[] = $row;
}
$addressbooks = array_merge($addressbooks, OCP\Share::getItemsSharedWith('addressbook', OC_Share_Backend_Addressbook::FORMAT_ADDRESSBOOKS));
@ -84,7 +84,7 @@ class OC_Contacts_Addressbook {
if(is_null($uid)) {
$uid = OCP\USER::getUser();
}
// query all addressbooks to force creation of default if it desn't exist.
$activeaddressbooks = self::all($uid);
$ids = array();
@ -141,9 +141,9 @@ class OC_Contacts_Addressbook {
}
$row['permissions'] = $sharedAddressbook['permissions'];
} else {
$row['permissions'] = OCP\Share::PERMISSION_CREATE
| OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_UPDATE
| OCP\Share::PERMISSION_DELETE | OCP\Share::PERMISSION_SHARE;
$row['permissions'] = OCP\Share::PERMISSION_CREATE
| OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_UPDATE
| OCP\Share::PERMISSION_DELETE | OCP\Share::PERMISSION_SHARE;
}
return $row;
}
@ -324,9 +324,9 @@ class OC_Contacts_Addressbook {
try {
OC_Contacts_VCard::delete($card['id']);
} catch(Exception $e) {
OCP\Util::writeLog('contacts',
OCP\Util::writeLog('contacts',
__METHOD__.', exception deleting vCard '.$card['id'].': '
. $e->getMessage(),
. $e->getMessage(),
OCP\Util::ERROR);
}
}
@ -337,7 +337,7 @@ class OC_Contacts_Addressbook {
} catch(Exception $e) {
OCP\Util::writeLog('contacts',
__METHOD__.', exception for ' . $id . ': '
. $e->getMessage(),
. $e->getMessage(),
OCP\Util::ERROR);
throw new Exception(
OC_Contacts_App::$l10n->t(
@ -348,11 +348,11 @@ class OC_Contacts_Addressbook {
// TODO: Unshare all when that method is created
//OCP\Share::unshare('addressbook', $id);
if(count(self::all(OCP\User::getUser())) == 0) {
self::addDefault();
}
return true;
}

View File

@ -22,7 +22,7 @@
/**
* The following signals are being emitted:
*
*
* OC_Contacts_VCard::post_moveToAddressbook(array('aid' => $aid, 'id' => $id))
* OC_Contacts_VCard::pre_deleteVCard(array('aid' => $aid, 'id' => $id, 'uri' = $uri)); (NOTE: the values can be null depending on which method emits them)
* OC_Contacts_VCard::post_updateVCard($id)
@ -61,7 +61,7 @@ class OC_Contacts_Hooks{
static public function getCalenderSources($parameters) {
$base_url = OCP\Util::linkTo('calendar', 'ajax/events.php').'?calendar_id=';
foreach(OC_Contacts_Addressbook::all(OCP\USER::getUser()) as $addressbook) {
$parameters['sources'][]
$parameters['sources'][]
= array(
'url' => $base_url.'birthday_'. $addressbook['id'],
'backgroundColor' => '#cccccc',
@ -91,14 +91,14 @@ class OC_Contacts_Hooks{
$date = new DateTime($birthday);
$vevent = new OC_VObject('VEVENT');
//$vevent->setDateTime('LAST-MODIFIED', new DateTime($vcard->REV));
$vevent->setDateTime('DTSTART', $date,
$vevent->setDateTime('DTSTART', $date,
Sabre_VObject_Element_DateTime::DATE);
$vevent->setString('DURATION', 'P1D');
$vevent->setString('UID', substr(md5(rand().time()), 0, 10));
// DESCRIPTION?
$vevent->setString('RRULE', 'FREQ=YEARLY');
$title = str_replace('{name}',
$vcard->getAsString('FN'),
$vcard->getAsString('FN'),
OC_Contacts_App::$l10n->t('{name}\'s Birthday'));
$parameters['events'][] = array(
'id' => 0,//$card['id'],
@ -106,8 +106,8 @@ class OC_Contacts_Hooks{
'repeating' => true,
'summary' => $title,
'calendardata' => "BEGIN:VCALENDAR\nVERSION:2.0\n"
. "PRODID:ownCloud Contacts "
. OCP\App::getAppVersion('contacts') . "\n"
. "PRODID:ownCloud Contacts "
. OCP\App::getAppVersion('contacts') . "\n"
. $vevent->serialize() . "END:VCALENDAR"
);
}

View File

@ -32,12 +32,12 @@ class OC_Share_Backend_Contact implements OCP\Share_Backend {
}
return false;
}
public function generateTarget($itemSource, $shareWith, $exclude = null) {
// TODO Get default addressbook and check for conflicts
return self::$contact['fullname'];
}
public function formatItems($items, $format, $parameters = null) {
$contacts = array();
if ($format == self::FORMAT_CONTACT) {

View File

@ -152,8 +152,8 @@ class OC_Contacts_VCard {
// Decode quoted-printable and strip any control chars
// except \n and \r
$property->value = preg_replace(
'/[\x00-\x09\x0B\x0C\x0E-\x1F\x7F]/',
'',
'/[\x00-\x09\x0B\x0C\x0E-\x1F\x7F]/',
'',
quoted_printable_decode($property->value)
);
unset($property->parameters[$key]);
@ -506,7 +506,7 @@ class OC_Contacts_VCard {
if(!$addressbook) {
throw new Exception(
OC_Contacts_App::$l10n->t(
'Could not find the Addressbook with ID: '
'Could not find the Addressbook with ID: '
. $card['addressbookid']
)
);

View File

@ -1,4 +1,4 @@
<?php
<?php
$id = $_['id'];
$tmpkey = $_['tmpkey'];
$requesttoken = $_['requesttoken'];
@ -61,6 +61,6 @@ $requesttoken = $_['requesttoken'];
<iframe name="crop_target" id='crop_target' src=""></iframe>
</form>
<?php
} else {
} else {
echo $l->t('The temporary image has been removed from cache.');
}

View File

@ -8,7 +8,7 @@ $addressbooks = isset($_['addressbooks'])?$_['addressbooks']:null;
<form>
<fieldset>
<dl class="form">
<?php if(!is_null($addressbooks)) {
<?php if(!is_null($addressbooks)) {
if(count($_['addressbooks'])==1) {
?>
<input type="hidden" id="aid" name="aid" value="<?php echo $_['addressbooks'][0]['id']; ?>">

View File

@ -10,7 +10,7 @@
<dd class="addressbooks-settings hidden">
<table>
<?php foreach($_['addressbooks'] as $addressbook) { ?>
<tr class="addressbook" data-id="<?php echo $addressbook['id'] ?>"
<tr class="addressbook" data-id="<?php echo $addressbook['id'] ?>"
data-uri="<?php echo $addressbook['uri'] ?>"
data-owner="<?php echo $addressbook['userid'] ?>"
>
@ -29,9 +29,9 @@
</td>
<td class="action">
<?php if($addressbook['permissions'] & OCP\Share::PERMISSION_SHARE) { ?>
<a class="svg action share" data-item-type="addressbook"
data-item="<?php echo $addressbook['id'] ?>"
data-possible-permissions="<?php echo $addressbook['permissions'] ?>"
<a class="svg action share" data-item-type="addressbook"
data-item="<?php echo $addressbook['id'] ?>"
data-possible-permissions="<?php echo $addressbook['permissions'] ?>"
title="<?php echo $l->t("Share"); ?>"></a>
<?php } ?>
</td>