1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2025-01-30 19:52:17 +01:00

Forgot to fix one file...

This commit is contained in:
Thomas Tanghus 2012-05-06 00:38:24 +02:00
parent afffd44ef5
commit 7127bb1840

View File

@ -1,83 +1,83 @@
/** /**
* Copyright (c) 2012 Georg Ehrke <ownclouddev at georgswebsite dot de> * Copyright (c) 2012 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or * This file is licensed under the Affero General Public License version 3 or
* later. * later.
* See the COPYING-README file. * See the COPYING-README file.
*/ */
Contacts_Import={ Contacts_Import={
importdialog: function(filename){ importdialog: function(filename){
var path = $('#dir').val(); var path = $('#dir').val();
$('body').append('<div id="contacts_import"></div>'); $('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);}); $('#contacts_import').load(OC.filePath('contacts', 'ajax', 'importdialog.php'), {filename:filename, path:path}, function(){Contacts_Import.initdialog(filename);});
}, },
initdialog: function(filename){ initdialog: function(filename){
$('#contacts_import_dialog').dialog({ $('#contacts_import_dialog').dialog({
width : 500, width : 500,
close : function() { close : function() {
$(this).dialog('destroy').remove(); $(this).dialog('destroy').remove();
$('#contacts_import').remove(); $('#contacts_import').remove();
} }
}); });
$('#import_done_button').click(function(){ $('#import_done_button').click(function(){
$('#contacts_import_dialog').dialog('destroy').remove(); $('#contacts_import_dialog').dialog('destroy').remove();
$('#contacts_import').remove(); $('#contacts_import').remove();
}); });
$('#progressbar').progressbar({value: 0}); $('#progressbar').progressbar({value: 0});
$('#startimport').click(function(){ $('#startimport').click(function(){
var filename = $('#filename').val(); var filename = $('#filename').val();
var path = $('#path').val(); var path = $('#path').val();
var addressbookid = $('#contacts option:selected').val(); var addressbookid = $('#leftcontent option:selected').val();
if($('#contacts option:selected').val() == 'newaddressbook'){ if($('#leftcontent option:selected').val() == 'newaddressbook'){
var method = 'new'; var method = 'new';
var addressbookname = $('#newaddressbook').val(); var addressbookname = $('#newaddressbook').val();
var addressbookname = $.trim(addressbookname); var addressbookname = $.trim(addressbookname);
if(newaddressbook == ''){ if(newaddressbook == ''){
$('#newaddressbook').css('background-color', '#FF2626'); $('#newaddressbook').css('background-color', '#FF2626');
$('#newaddressbook').focus(function(){ $('#newaddressbook').focus(function(){
$('#newaddressbook').css('background-color', '#F8F8F8'); $('#newaddressbook').css('background-color', '#F8F8F8');
}); });
return false; return false;
} }
}else{ }else{
var method = 'old'; var method = 'old';
} }
$('#newaddressbook').attr('readonly', 'readonly'); $('#newaddressbook').attr('readonly', 'readonly');
$('#contacts').attr('disabled', 'disabled'); $('#leftcontent').attr('disabled', 'disabled');
var progressfile = $('#progressfile').val(); var progressfile = $('#progressfile').val();
$.post(OC.filePath('contacts', '', 'import.php'), {method: String (method), addressbookname: String (addressbookname), path: String (path), file: String (filename), id: String (addressbookid)}, function(data){ $.post(OC.filePath('contacts', '', 'import.php'), {method: String (method), addressbookname: String (addressbookname), path: String (path), file: String (filename), id: String (addressbookid)}, function(data){
if(data.status == 'success'){ if(data.status == 'success'){
$('#progressbar').progressbar('option', 'value', 100); $('#progressbar').progressbar('option', 'value', 100);
$('#import_done').css('display', 'block'); $('#import_done').css('display', 'block');
} }
}); });
$('#form_container').css('display', 'none'); $('#form_container').css('display', 'none');
$('#progressbar_container').css('display', 'block'); $('#progressbar_container').css('display', 'block');
window.setTimeout('Contacts_Import.getimportstatus(\'' + progressfile + '\')', 500); window.setTimeout('Contacts_Import.getimportstatus(\'' + progressfile + '\')', 500);
}); });
$('#contacts').change(function(){ $('#leftcontent').change(function(){
if($('#contacts option:selected').val() == 'newaddressbook'){ if($('#leftcontent option:selected').val() == 'newaddressbook'){
$('#newaddressbookform').slideDown('slow'); $('#newaddressbookform').slideDown('slow');
}else{ }else{
$('#newaddressbookform').slideUp('slow'); $('#newaddressbookform').slideUp('slow');
} }
}); });
}, },
getimportstatus: function(progressfile){ getimportstatus: function(progressfile){
$.get(OC.filePath('contacts', 'import_tmp', progressfile), function(percent){ $.get(OC.filePath('contacts', 'import_tmp', progressfile), function(percent){
$('#progressbar').progressbar('option', 'value', parseInt(percent)); $('#progressbar').progressbar('option', 'value', parseInt(percent));
if(percent < 100){ if(percent < 100){
window.setTimeout('Contacts_Import.getimportstatus(\'' + progressfile + '\')', 500); window.setTimeout('Contacts_Import.getimportstatus(\'' + progressfile + '\')', 500);
}else{ }else{
$('#import_done').css('display', 'block'); $('#import_done').css('display', 'block');
} }
}); });
} }
} }
$(document).ready(function(){ $(document).ready(function(){
if(typeof FileActions !== 'undefined'){ if(typeof FileActions !== 'undefined'){
FileActions.register('text/vcard','importaddressbook', '', Contacts_Import.importdialog); FileActions.register('text/vcard','importaddressbook', '', Contacts_Import.importdialog);
FileActions.setDefault('text/vcard','importaddressbook'); FileActions.setDefault('text/vcard','importaddressbook');
FileActions.register('text/x-vcard','importaddressbook', '', Contacts_Import.importdialog); FileActions.register('text/x-vcard','importaddressbook', '', Contacts_Import.importdialog);
FileActions.setDefault('text/x-vcard','importaddressbook'); FileActions.setDefault('text/x-vcard','importaddressbook');
}; };
}); });