Merge branch 'master' into calendar_import

This commit is contained in:
Georg Ehrke 2012-07-04 21:15:32 +02:00
commit 7ec2d6ce85
11 changed files with 183 additions and 37 deletions

View File

@ -15,10 +15,10 @@
#bottomcontrols img { margin-top: 0.35em; }
#contacts_newcontact { float: left; margin: 0.2em 0 0 1em; }
#chooseaddressbook { float: right; margin: 0.2em 1em 0 0; }
#actionbar { height: 30px; width: 60px; position: fixed; right: 0px; top: 4em; margin: 0 0 0 0; padding: 0 0 0 0; z-index: 1000; }
#actionbar { position: relative; clear: both; height: 30px;}
#contacts_deletecard {position:relative; float:left; background:url('%webroot%/core/img/actions/delete.svg') no-repeat center; }
#contacts_downloadcard {position:relative; float:left; background:url('%webroot%/core/img/actions/download.svg') no-repeat center; }
#contacts_propertymenu { clear: both; max-width: 15em; margin: 2em; }
#contacts_propertymenu { clear: left; float:left; max-width: 15em; margin: 2em; }
#contacts_propertymenu_button { position:relative;top:0;left:0; margin: 0; }
#contacts_propertymenu_dropdown { background-color: #fff; position:relative; right:0; overflow:hidden; text-overflow:ellipsis; border: thin solid #1d2d44; box-shadow: 0 3px 5px #bbb; /* -moz-box-shadow:0 0 10px #000; -webkit-box-shadow:0 0 10px #000; box-shadow:0 0 10px #000; -moz-border-radius:0.5em; -webkit-border-radius:0.5em; border-radius:0.5em; -moz-border-radius:0.5em; -webkit-border-radius:0.5em;*/ border-radius: 3px; }
#contacts_propertymenu li { display: block; font-weight: bold; height: 20px; }

View File

@ -14,13 +14,17 @@ $contactid = isset($_GET['contactid']) ? $_GET['contactid'] : NULL;
$nl = "\n";
if(isset($bookid)){
$addressbook = OC_Contacts_App::getAddressbook($bookid);
$cardobjects = OC_Contacts_VCard::all($bookid);
//$cardobjects = OC_Contacts_VCard::all($bookid);
header('Content-Type: text/directory');
header('Content-Disposition: inline; filename=' . str_replace(' ', '_', $addressbook['displayname']) . '.vcf');
$start = 0;
while($cardobjects = OC_Contacts_VCard::all($bookid, $start, 20)){
foreach($cardobjects as $card) {
echo $card['carddata'] . $nl;
}
$start += 20;
}
}elseif(isset($contactid)){
$data = OC_Contacts_App::getContactObject($contactid);
header('Content-Type: text/vcard');

View File

@ -9,10 +9,6 @@ $id = isset($_['id']) ? $_['id'] : '';
<input type="hidden" class="max_human_file_size" value="(max <?php echo $_['uploadMaxHumanFilesize']; ?>)">
<input id="file_upload_start" type="file" accept="image/*" name="imagefile" />
</form>
<div id="actionbar">
<button class="svg action" id="contacts_downloadcard" title="<?php echo $l->t('Download contact');?>"></button>
<button class="svg action" id="contacts_deletecard" title="<?php echo $l->t('Delete contact');?>"></button>
</div>
<div id="contact_photo" class="contactsection">
@ -108,6 +104,7 @@ $id = isset($_['id']) ? $_['id'] : '';
</form>
</div> <!-- contact_note -->
<div id="actionbar">
<div id="contacts_propertymenu">
<button class="button" id="contacts_propertymenu_button"><?php echo $l->t('Add field'); ?></button>
<ul id="contacts_propertymenu_dropdown" role="menu" class="hidden">
@ -122,6 +119,9 @@ $id = isset($_['id']) ? $_['id'] : '';
<li><a role="menuitem" data-type="CATEGORIES"><?php echo $l->t('Groups'); ?></a></li>
</ul>
</div>
<button class="svg action" id="contacts_downloadcard" title="<?php echo $l->t('Download contact');?>"></button>
<button class="svg action" id="contacts_deletecard" title="<?php echo $l->t('Delete contact');?>"></button>
</div>
</div> <!-- card -->
<div id="edit_photo_dialog" title="Edit photo">

View File

@ -0,0 +1,12 @@
<?php
OCP\JSON::checkAppEnabled('files_external');
$view = \OCP\Files::getStorage("files_external");
$from = $_FILES['rootcert_import']['tmp_name'];
$to = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath("").$_FILES['rootcert_import']['name'];
move_uploaded_file($from, $to);
header("Location: settings/personal.php");
exit;
?>

View File

@ -0,0 +1,9 @@
<?php
OCP\JSON::checkAppEnabled('files_external');
$view = \OCP\Files::getStorage("files_external");
$cert = $_POST['cert'];
$file = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath("").$cert;
unlink($file);
?>

View File

@ -68,7 +68,6 @@ OC.MountConfig={
}
$(document).ready(function() {
$('.chzn-select').chosen();
$('#selectBackend').live('change', function() {
@ -116,8 +115,11 @@ $(document).ready(function() {
$('td.remove>img').live('click', function() {
var tr = $(this).parent().parent();
var mountPoint = $(tr).find('.mountPoint input').val();
if (mountPoint == '') {
return false;
if (!mountPoint) {
var row=this.parentNode.parentNode;
$.post(OC.filePath('files_external', 'ajax', 'removeRootCertificate.php'), { cert: row.id });
$(tr).remove();
return true;
}
if ($('#externalStorage').data('admin') === true) {
var isPersonal = false;

View File

@ -238,6 +238,21 @@ class OC_Mount_Config {
@file_put_contents($file, $content);
}
/**
* Returns all user uploaded ssl root certificates
* @return array
*/
public static function getCertificates() {
$view = \OCP\Files::getStorage('files_external');
$path=\OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath("");
$result = array();
$handle = opendir($path);
while (false !== ($file = readdir($handle))) {
if($file != '.' && $file != '..') $result[] = $file;
}
return $result;
}
}
?>

View File

@ -28,6 +28,7 @@ unset($backends['OC_Filestorage_Local']);
$tmpl = new OCP\Template('files_external', 'settings');
$tmpl->assign('isAdminPage', false, false);
$tmpl->assign('mounts', OC_Mount_Config::getPersonalMountPoints());
$tmpl->assign('certs', OC_Mount_Config::getCertificates());
$tmpl->assign('backends', $backends);
return $tmpl->fetchPage();

View File

@ -1,4 +1,4 @@
<form id="files_external">
<form id="files_external" method="post" enctype="multipart/form-data" action="/owncloud/?app=files_external&getfile=ajax%2FaddRootCertificate.php">
<fieldset class="personalblock">
<legend><strong><?php echo $l->t('External Storage'); ?></strong></legend>
<table id="externalStorage" data-admin='<?php echo json_encode($_['isAdminPage']); ?>'>
@ -79,6 +79,29 @@
<?php endforeach; ?>
</tbody>
</table>
<br />
<?php if (!$_['isAdminPage']): ?>
<table id="sslCertificate" data-admin='<?php echo json_encode($_['isAdminPage']); ?>'>
<thead>
<tr>
<th><?php echo $l->t('SSL root certificates'); ?></th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody width="100%">
<?php foreach ($_['certs'] as $rootCert): ?>
<tr id="<?php echo $rootCert ?>">
<td class="rootCert"><?php echo $rootCert ?></td>
<td <?php echo ($rootCert != '') ? 'class="remove"' : 'style="visibility:hidden;"'; ?>><img alt="<?php echo $l->t('Delete'); ?>" title="<?php echo $l->t('Delete'); ?>" class="svg action" src="<?php echo image_path('core', 'actions/delete.svg'); ?>" /></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<input type="file" id="rootcert_import" name="rootcert_import" style="width:230px;">
<input type="submit" name="cert_import" value="<?php echo $l->t('Import Root Certificate'); ?>" />
<?php endif; ?>
<?php if ($_['isAdminPage']): ?>
<br />
<input type="checkbox" name="allowUserMounting" id="allowUserMounting" value="1" <?php if ($_['allowUserMounting'] == 'yes') echo ' checked="checked"'; ?> />

View File

@ -4,6 +4,72 @@
* See the COPYING-README file.
*/
UserList={
useUndo:true,
/**
* @brief Initiate user deletion process in UI
* @param string uid the user ID to be deleted
*
* Does not actually delete the user; it sets them for
* deletion when the current page is unloaded, at which point
* finishDelete() completes the process. This allows for 'undo'.
*/
do_delete:function( uid ) {
UserList.deleteUid = uid;
// Set undo flag
UserList.deleteCanceled = false;
// Hide user in table to reflect deletion
$(this).parent().parent().hide();
$('tr').filterAttr( 'data-uid', UserList.deleteUid ).hide();
// Provide user with option to undo
$('#notification').text(t('files','undo delete user'));
$('#notification').data('deleteuser',true);
$('#notification').fadeIn();
},
/**
* @brief Delete a user via ajax
* @param bool ready whether to use ready() upon completion
*
* Executes deletion via ajax of user identified by property deleteUid
* if 'undo' has not been used. Completes the user deletion procedure
* and reflects success in UI.
*/
finishDelete:function( ready ){
// Check deletion has not been undone
if( !UserList.deleteCanceled && UserList.deleteUid ){
// Delete user via ajax
$.post(
OC.filePath('settings','ajax','removeuser.php'),
{username:UserList.deleteUid},
function(result){
// Remove undo option, & remove user from table
boolOperationFinished(
data, function(){
$('#notification').fadeOut();
$('tr').filterAttr( 'data-uid', username ).remove();
UserList.deleteCanceled=true;
UserList.deleteFiles=null;
if( ready ){
ready();
}
}
);
}
);
}
}
}
$(document).ready(function(){
function setQuota(uid,quota,ready){
$.post(
@ -61,15 +127,12 @@ $(document).ready(function(){
});
$('td.remove>img').live('click',function(event){
var uid=$(this).parent().parent().data('uid');
$.post(
OC.filePath('settings','ajax','removeuser.php'),
{username:uid},
function(result){
}
);
$(this).parent().parent().remove();
var uid = $(this).parent().parent().data('uid');
// Call function for handling delete/undo
UserList.do_delete( uid );
});
$('td.password>img').live('click',function(event){
@ -222,4 +285,19 @@ $(document).ready(function(){
}
);
});
// Handle undo notifications
$('#notification').hide();
$('#notification').click(function(){
if($('#notification').data('deleteuser'))
{
$( 'tr' ).filterAttr( 'data-uid', UserList.deleteUid ).show();
UserList.deleteCanceled=true;
UserList.deleteFiles=null;
}
$('#notification').fadeOut();
});
UserList.useUndo=('onbeforeunload' in window)
$(window).bind('beforeunload', function (){
UserList.finishDelete(null);
});
});

View File

@ -52,6 +52,8 @@ foreach($_["groups"] as $group) {
</div>
</div>
<div id='notification'></div>
<table data-groups="<?php echo implode(', ',$allGroups);?>">
<thead>
<tr>