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

use specific branch

This commit is contained in:
Nicolas Mora 2013-08-11 20:41:02 -04:00
parent 95f71ba510
commit 6f75041b58
5 changed files with 0 additions and 347 deletions

View File

@ -1,48 +0,0 @@
<?php
/**
* ownCloud - contacts personal settings
*
* @author Nicolas Mora
* @copyright 2013 Nicolas Mora mail@babelouest.org
*
* 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 Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Contacts\Ajax;
// Check user and app status
\OCP\User::checkLoggedIn();
\OCP\App::checkAppEnabled('contacts');
\OCP\JSON::callCheck();
switch($_GET['function']) {
case 'list':
$ldap = new OCA\Contacts\Backend\Ldap();
$addressbooks = $ldap->getAllAddressBooksForUser(\OCP\User::getUser());
\OCP\JSON::success(array('ldapArray' => $addressbooks));
break;
case 'details':
$ldap = new OCA\Contacts\Backend\Ldap();
$addressbooks = $ldap->getAllAddressBooksForUser(\OCP\User::getUser());
\OCP\JSON::success(array('ldapArray' => $addressbooks));
break
case 'save':
break;
case 'delete':
break;
case 'test':
break;
}

View File

@ -1,17 +0,0 @@
#contactsldap fieldset p label {
width: 20%;
max-width: 200px;
display: inline-block;
vertical-align: top;
padding-top: 9px;
}
#contactsldap fieldset input, #contactsldap fieldset textarea {
width: 70%;
display: inline-block;
}
.ldapwarning {
margin-left: 1.4em;
color: #FF3B3B;
}

View File

@ -1,177 +0,0 @@
var LdapConfiguration = {
refreshConfig: function() {
if($('#ldap_addressbook_chooser option').length < 2) {
LdapConfiguration.addConfiguration(true);
return;
}
$.post(
OC.filePath('contacts','ajax','personalsettings.php?function=list'),
$('#ldap_addressbook_chooser').serialize(),
function (result) {
if(result.status == 'success') {
$.each(result.ldapArray, function(configkey, configvalue) {
elementID = '#'+configkey;
//deal with Checkboxes
if($(elementID).is('input[type=checkbox]')) {
if(configvalue == 1) {
$(elementID).attr('checked', 'checked');
} else {
$(elementID).removeAttr('checked');
}
return;
}
//On Textareas, Multi-Line Settings come as array
if($(elementID).is('textarea') && $.isArray(configvalue)) {
configvalue = configvalue.join("\n");
}
// assign the value
$('#'+configkey).val(configvalue);
});
}
}
);
},
resetDefaults: function() {
$('#ldap').find('input[type=text], input[type=number], input[type=password], textarea, select').each(function() {
if($(this).attr('id') == 'ldap_serverconfig_chooser') {
return;
}
$(this).val($(this).attr('data-default'));
});
$('#ldap').find('input[type=checkbox]').each(function() {
if($(this).attr('data-default') == 1) {
$(this).attr('checked', 'checked');
} else {
$(this).removeAttr('checked');
}
});
},
deleteConfiguration: function() {
$.post(
OC.filePath('contacts','ajax','deleteConfiguration.php'),
$('#ldap_serverconfig_chooser').serialize(),
function (result) {
if(result.status == 'success') {
$('#ldap_serverconfig_chooser option:selected').remove();
$('#ldap_serverconfig_chooser option:first').select();
LdapConfiguration.refreshConfig();
} else {
OC.dialogs.alert(
result.message,
t('contacts', 'Deletion failed')
);
}
}
);
},
addConfiguration: function(doNotAsk) {
$.post(
OC.filePath('contacts','ajax','getNewServerConfigPrefix.php'),
function (result) {
if(result.status == 'success') {
if(doNotAsk) {
LdapConfiguration.resetDefaults();
} else {
OC.dialogs.confirm(
t('contacts', 'Take over settings from recent server configuration?'),
t('contacts', 'Keep settings?'),
function(keep) {
if(!keep) {
LdapConfiguration.resetDefaults();
}
}
);
}
$('#ldap_serverconfig_chooser option:selected').removeAttr('selected');
var html = '<option value="'+result.configPrefix+'" selected="selected">'+$('#ldap_serverconfig_chooser option').length+'. Server</option>';
$('#ldap_serverconfig_chooser option:last').before(html);
} else {
OC.dialogs.alert(
result.message,
t('contacts', 'Cannot add server configuration')
);
}
}
);
}
}
$(document).ready(function() {
$('#ldapAdvancedAccordion').accordion({ heightStyle: 'content', animate: 'easeInOutCirc'});
$('#ldap_submit').button();
$('#ldap_action_test_connection').button();
$('#ldap_action_delete_configuration').button();
LdapConfiguration.refreshConfig();
$('#ldap_action_test_connection').click(function(event){
event.preventDefault();
$.post(
OC.filePath('contacts','ajax','personalsettings.php?function=test'),
$('#ldap').serialize(),
function (result) {
if (result.status == 'success') {
OC.dialogs.alert(
result.message,
t('contacts', 'Connection test succeeded')
);
} else {
OC.dialogs.alert(
result.message,
t('contacts', 'Connection test failed')
);
}
}
);
});
$('#ldap_action_delete_configuration').click(function(event) {
event.preventDefault();
OC.dialogs.confirm(
t('contacts', 'Do you really want to delete the current Server Configuration?'),
t('contacts', 'Confirm Deletion'),
function(deleteConfiguration) {
if(deleteConfiguration) {
LdapConfiguration.deleteConfiguration();
}
}
);
});
$('#ldap_submit').click(function(event) {
event.preventDefault();
$.post(
OC.filePath('contacts','ajax','setConfiguration.php'),
$('#ldap').serialize(),
function (result) {
bgcolor = $('#ldap_submit').css('background');
if (result.status == 'success') {
//the dealing with colors is a but ugly, but the jQuery version in use has issues with rgba colors
$('#ldap_submit').css('background', '#fff');
$('#ldap_submit').effect('highlight', {'color':'#A8FA87'}, 5000, function() {
$('#ldap_submit').css('background', bgcolor);
});
} else {
$('#ldap_submit').css('background', '#fff');
$('#ldap_submit').effect('highlight', {'color':'#E97'}, 5000, function() {
$('#ldap_submit').css('background', bgcolor);
});
}
}
);
});
$('#ldap_addressbook_chooser').change(function(event) {
value = $('#ldap_addressbook_chooser option:selected:first').attr('value');
if(value == 'NEW') {
LdapConfiguration.addConfiguration(false);
} else {
LdapConfiguration.refreshConfig();
}
});
});

View File

@ -1,38 +0,0 @@
<?php
/**
* ownCloud - user_ldap
*
* @author Nicolas Mora
* @copyright 2013 Nicolas Mora mail@babelouest.org
*
* 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 Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
\OCP\User::checkLoggedIn();
\OCP\App::checkAppEnabled('contacts');
OCP\Util::addscript('contacts', 'personalsettings');
OCP\Util::addstyle('contacts', 'personalsettings');
// fill template
$tmpl = new OCP\Template('contacts', 'personalsettings');
$ldap = new OCA\Contacts\Backend\Ldap();
//$ldapArray = $ldap->getAllAddressBooksForUser(\OCP\User::getUser());
$tmpl->assign('ldapArray', $ldapArray);
return $tmpl->fetchPage();

View File

@ -1,67 +0,0 @@
<form id="contactsLdap" action="#" method="post">
<div id="contactsldap" class="personalblock">
<ul>
<li><?php p($l->t('LDAP Directories for Contacts'));?></li>
</ul>
<fieldset id="contactsLdap">
<p><label for="ldap_addressbook_chooser"><?php p($l->t('Server configuration'));?></label>
<select id="ldap_addressbook_chooser" name="ldap_addressbook_chooser">
<?php
foreach($_['ldapArray'] as $ldapArray) {
?>
<option value="<?php p($ldapArray['uri']); ?>"><?php p($ldapArray['displayname']); ?></option>
<?php
}
?>
<option value="NEW"><?php p($l->t('Add LDAP addressbook'));?></option>
</select>
<button id="ldap_action_delete_configuration"
name="ldap_action_delete_configuration"><?php p($l->t('Delete Addressbook'));?></button>
</p>
<input type="hidden" id="ldapid" name="ldapid" />
<p><label for="displayname"><?php p($l->t('Addressbook name'));?></label>
<input type="text" id="displayname" name="displayname" title="<?php p($l->t('Name of the addressbook'));?>"></p>
<p><label for="description"><?php p($l->t('Addressbook description'));?></label>
<input type="text" id="description" name="description" /></p>
<p><label for="uri"><?php p($l->t('Addressbook uri'));?></label>
<input type="text" id="uri" name="uri"
title="<?php p($l->t('Must be unique'));?>"></p>
<p><label for="ldapurl"><?php p($l->t('LDAP Server'));?></label>
<input type="text" id="ldapurl" name="ldapurl"
title="<?php p($l->t('URL of the LDAP server (ldap:// or ldaps://)'));?>" /></p>
<p><label for="ldapbasednsearch"><?php p($l->t('Base DN for search'));?></label>
<input type="text" id="ldapbasednsearch" name="ldapbasednsearch"
title="<?php p($l->t('Search is recursive'));?>" /></p>
<p><label for="ldapreadonly"><?php p($l->t('Read only'));?></label>
<input type="checkbox" id="ldapreadonly" name="ldapreadonly"
title="<?php p($l->t(''));?>" /></p>
<p><label for="ldapbasednmodify"><?php p($l->t('Base DN for modification'));?></label>
<input type="text" id="ldapbasednmodify" name="ldapbasednmodify"
title="<?php p($l->t('All new contacts will be saved in this directory'));?>" /></p>
<p><label for="ldapanonymous"><?php p($l->t('Anonymous'));?></label>
<input type="checkbox" id="ldapanonymous" name="ldapanonymous"
title="<?php p($l->t(''));?>" /></p>
<p><label for="ldapuser"><?php p($l->t('User'));?></label>
<input type="text" id="ldapuser" name="ldapuser"
title="<?php p($l->t(''));?>" /></p>
<p><label for="ldappass"><?php p($l->t('Password'));?></label>
<input type="password" id="ldappass" name="ldappass"
title="<?php p($l->t(''));?>" /></p>
<p><label for="ldap_vcard_connector"><?php p($l->t('LDAP to VCard connector XML'));?></label>
<textarea id="ldap_vcard_connector" name="ldap_vcard_connector"></textarea></p>
</fieldset>
<input id="ldap_submit" type="submit" value="Save" /> <button id="ldap_action_test_connection" name="ldap_action_test_connection"><?php p($l->t('Test connection'));?></button> <a href="#" target="_blank"><img src="<?php print_unescaped(OCP\Util::imagePath('', 'actions/info.png')); ?>" style="height:1.75ex" /> <?php p($l->t('Help'));?></a>
</div>
</form>