var response = jQuery.parseJSON(response);
console.log('status: ' + status + ', response: ' + response + ', response.status:' + response.status);
if(response.status == 'error'){
- alert(response.data.message);
+ OC.dialogs.alert(response.data.message, 'Error');
} else {
- alert(response);
+ OC.dialogs.alert(response, 'Error');
}
} catch(e) {
$('#edit_categories_dialog').dialog({
if(jsondata.status == 'success'){
Categories._update(jsondata.data.categories);
} else {
- alert(jsondata.data.message);
+ OC.dialogs.alert(jsondata.data.message, 'Error');
}
});
},
if(jsondata.status == 'success'){
Categories._update(jsondata.data.categories);
} else {
- alert(jsondata.data.message);
+ OC.dialogs.alert(jsondata.data.message, 'Error');
}
});
return false;
if(jsondata.status == 'success'){
Categories._update(jsondata.data.categories);
} else {
- alert(jsondata.data.message);
+ OC.dialogs.alert(jsondata.data.message, 'Error');
}
});
},
Contacts={
UI:{
notImplemented:function() {
- Contacts.UI.messageBox(t('contacts', 'Not implemented'), t('contacts', 'Sorry, this functionality has not been implemented yet'));
+ OC.dialogs.alert(t('contacts', 'Sorry, this functionality has not been implemented yet'), t('contacts', 'Not implemented'));
},
searchOSM:function(obj) {
var adr = Contacts.UI.propertyContainerFor(obj).find('.adr').val();
console.log('adr 1: ' + adr);
if(adr == undefined) {
- Contacts.UI.messageBox(t('contacts', 'Error'), t('contacts', 'Couldn\'t get a valid address.'));
+ OC.dialogs.alert(t('contacts', 'Couldn\'t get a valid address.'), t('contacts', 'Error'));
return;
}
// FIXME: I suck at regexp. /Tanghus
mailTo:function(obj) {
var adr = Contacts.UI.propertyContainerFor($(obj)).find('input[type="email"]').val().trim();
if(adr == '') {
- Contacts.UI.messageBox(t('contacts', 'Error'), t('contacts', 'Please enter an email address.'));
+ OC.dialogs.alert(t('contacts', 'Please enter an email address.'), t('contacts', 'Error'));
return;
}
window.location.href='mailto:' + adr;
$('#carddav_url').show();
$('#carddav_url_close').show();
},
- messageBox:function(title, msg) {
- if(msg.toLowerCase().indexOf('auth') != -1) {
- // fugly hack, I know
- alert(msg);
- }
- if($('#messagebox').dialog('isOpen') == true){
- // NOTE: Do we ever get here?
- $('#messagebox').dialog('moveToTop');
- }else{
- $('#dialog_holder').load(OC.filePath('contacts', 'ajax', 'messagebox.php'), function(jsondata){
- if(jsondata.status != 'error'){
- $('#messagebox').dialog(
- {
- autoOpen: true,
- title: title,
- buttons: [{
- text: "Ok",
- click: function() { $(this).dialog("close"); }
- }],
- close: function(event, ui) {
- $(this).dialog('destroy').remove();
- },
- open: function(event, ui) {
- $('#messagebox_msg').html(msg);
- }
- });
- } else {
- alert(jsondata.data.message);
- }
- });
- };
- },
loadListHandlers:function() {
//$('.add,.delete').hide();
$('.globe,.mail,.delete,.edit').tipsy();
if(jsondata.status == 'success'){
Contacts.UI.Card.loadContact(jsondata.data);
} else{
- Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
+ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
}
});
}
} else{
- Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
+ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
}
});
}
$('#rightcontent').data('id','');
$('#rightcontent').html(jsondata.data.page);
} else {
- Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
+ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
}
});
}
}
else{
- Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
+ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
//alert(jsondata.data.message);
}
});
// TODO: Add to contacts list.
}
else{
- Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
+ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
//alert(jsondata.data.message);
}
});
$('#rightcontent').html(jsondata.data.page);
}
else{
- Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
+ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
}
});
}
}
else{
- Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
+ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
//alert(jsondata.data.message);
}
});
console.log('Setting checksum: ' + jsondata.data.checksum);
$('#categories_value').data('checksum', jsondata.data.checksum);
} else {
- Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
+ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
}
});
},
$('#rightcontent').html(jsondata.data.page);
Contacts.UI.Card.editName();
} else {
- Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
+ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
//alert(jsondata.data.message);
}
});
return false;
}
if($(obj).hasClass('nonempty') && $(obj).val().trim() == '') {
- Contacts.UI.messageBox(t('contacts', 'Error'), t('contacts', 'This property has to be non-empty.'));
+ OC.dialogs.alert(t('contacts', 'This property has to be non-empty.'), t('contacts', 'Error'));
return false;
}
container = $(obj).parents('.propertycontainer').first(); // get the parent holding the metadata.
return true;
}
else{
- Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
+ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
Contacts.UI.loading(container, false);
$(obj).removeAttr('disabled');
return false;
return true;
}
else{
- Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
+ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
Contacts.UI.loading(container, false);
$(obj).removeAttr('disabled');
return false;
$('#contacts_propertymenu a[data-type="'+proptype+'"]').parent().show();
Contacts.UI.loading(obj, false);
} else {
- Contacts.UI.messageBox(t('contacts', 'Error'), t('contacts', '\'deleteProperty\' called without type argument. Please report at bugs.owncloud.org'));
+ OC.dialogs.alert(t('contacts', '\'deleteProperty\' called without type argument. Please report at bugs.owncloud.org'), t('contacts', 'Error'));
Contacts.UI.loading(obj, false);
}
}
else{
Contacts.UI.loading(obj, false);
- Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
+ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
}
});
} else { // Property hasn't been saved so there's nothing to delete.
$('#contacts_propertymenu a[data-type="'+proptype+'"]').parent().show();
Contacts.UI.loading(obj, false);
} else {
- Contacts.UI.messageBox(t('contacts', 'Error'), t('contacts', '\'deleteProperty\' called without type argument. Please report at bugs.owncloud.org'));
+ OC.dialogs.alert(t('contacts', '\'deleteProperty\' called without type argument. Please report at bugs.owncloud.org'), t('contacts', 'Error'));
}
}
},
},
uploadPhoto:function(filelist) {
if(!filelist) {
- Contacts.UI.messageBox(t('contacts', 'Error'), t('contacts','No files selected for upload.'));
+ OC.dialogs.alert(t('contacts','No files selected for upload.'), t('contacts', 'Error'));
return;
}
//var file = filelist.item(0);
var form = $('#file_upload_form');
var totalSize=0;
if(file.size > $('#max_upload').val()){
- Contacts.UI.messageBox(t('Upload too large'), t('contacts','The file you are trying to upload exceed the maximum size for file uploads on this server.'));
+ OC.dialogs.alert(t('contacts','The file you are trying to upload exceed the maximum size for file uploads on this server.'), t('contacts', 'Error'));
return;
} else {
target.load(function(){
Contacts.UI.Card.editPhoto(response.data.id, response.data.tmp);
//alert('File: ' + file.tmp + ' ' + file.name + ' ' + file.mime);
}else{
- Contacts.UI.messageBox(t('contacts', 'Error'), response.data.message);
+ OC.dialogs.alert(response.data.message, t('contacts', 'Error'));
}
});
form.submit();
$('#contacts_details_photo_wrapper').html(jsondata.data.page);
}
else{
- Contacts.UI.messageBox(jsondata.data.message);
+ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
}
});
$('#file_upload_form').show();
$('#edit_photo_dialog_img').html(jsondata.data.page);
}
else{
- Contacts.UI.messageBox(jsondata.data.message);
+ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
}
});
if($('#edit_photo_dialog').dialog('isOpen') == true){
// load cropped photo.
$('#contacts_details_photo_wrapper').html(response.data.page);
}else{
- Contacts.UI.messageBox(t('contacts','Error'), response.data.message);
+ OC.dialogs.alert(response.data.message, t('contacts', 'Error'));
}
});
$('#contacts [data-id="'+this.id+'"]').find('a').css('background','url(thumbnail.php?id='+this.id+'&refresh=1'+Math.random()+') no-repeat');
Contacts.UI.Contacts.update();
Contacts.UI.Addressbooks.overview();
} else {
- Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
+ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
//alert('Error: ' + data.message);
}
});
var description = $("#description_"+bookid).val();
if(displayname.length == 0) {
- Contacts.UI.messageBox(t('contacts', 'Error'), t('contacts', 'Displayname cannot be empty.'));
+ OC.dialogs.alert(t('contacts', 'Displayname cannot be empty.'), t('contacts', 'Error'));
return false;
}
var url;
$(button).closest('tr').prev().html(jsondata.page).show().next().remove();
Contacts.UI.Contacts.update();
} else {
- Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
+ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
}
});
},
Contacts.UI.Card.update();
}
else{
- Contacts.UI.messageBox(t('contacts', 'Error'),jsondata.data.message);
+ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
//alert(jsondata.data.message);
}
});
Contacts.UI.Card.loadContact(jsondata.data);
}
else{
- Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
+ OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
//alert(jsondata.data.message);
}
});
var file = files[0];
console.log('size: '+file.size);
if(file.size > $('#max_upload').val()){
- Contacts.UI.messageBox(t('contacts','Upload too large'), t('contacts','The file you are trying to upload exceed the maximum size for file uploads on this server.'));
+ OC.dialogs.alert(t('contacts','The file you are trying to upload exceed the maximum size for file uploads on this server.'), t('contacts','Upload too large'));
return;
}
if (file.type.indexOf("image") != 0) {
- Contacts.UI.messageBox(t('contacts','Wrong file type'), t('contacts','Only image files can be used as profile picture.'));
+ OC.dialogs.alert(t('contacts','Only image files can be used as profile picture.'), t('contacts','Wrong file type'));
return;
}
var xhr = new XMLHttpRequest();
if (!xhr.upload) {
- Contacts.UI.messageBox(t('contacts', 'Error'), t('contacts', 'Your browser doesn\'t support AJAX upload. Please click on the profile picture to select a photo to upload.'))
+ OC.dialogs.alert(t('contacts', 'Your browser doesn\'t support AJAX upload. Please click on the profile picture to select a photo to upload.'), t('contacts', 'Error'))
}
fileUpload = xhr.upload,
xhr.onreadystatechange = function() {
if(xhr.status == 200) {
Contacts.UI.Card.editPhoto(response.data.id, response.data.tmp);
} else {
- Contacts.UI.messageBox(t('contacts', 'Error'), xhr.status + ': ' + xhr.responseText);
+ OC.dialogs.alert(xhr.status + ': ' + xhr.responseText, t('contacts', 'Error'));
}
} else {
//alert(xhr.responseText);
- Contacts.UI.messageBox(t('contacts', 'Error'), response.data.message);
+ OC.dialogs.alert(response.data.message, t('contacts', 'Error'));
}
// stop loading indicator
//$('#contacts_details_photo_progress').hide();