Working UI for external storage mount configuration

This commit is contained in:
Michael Gapczynski 2012-06-08 11:42:00 -04:00
parent f70615106f
commit 4b3ae60558
9 changed files with 485 additions and 95 deletions

View File

@ -0,0 +1,13 @@
<?php
OCP\JSON::checkAppEnabled('files_external');
if ($_POST['isPersonal'] == 'true') {
OCP\JSON::checkLoggedIn();
$isPersonal = true;
} else {
OCP\JSON::checkAdminUser();
$isPersonal = false;
}
OC_Mount_Config::addMountPoint($_POST['mountPoint'], $_POST['class'], $_POST['classOptions'], $_POST['mountType'], $_POST['applicable'], $isPersonal);
?>

View File

@ -0,0 +1,13 @@
<?php
OCP\JSON::checkAppEnabled('files_external');
if ($_POST['isPersonal'] == 'true') {
OCP\JSON::checkLoggedIn();
$isPersonal = true;
} else {
OCP\JSON::checkAdminUser();
$isPersonal = false;
}
OC_Mount_Config::removeMountPoint($_POST['mountPoint'], $_POST['mountType'], $_POST['applicable'], $isPersonal);
?>

View File

@ -6,11 +6,16 @@
* See the COPYING-README file.
*/
OC::$CLASSPATH['OC_FileStorage_StreamWrapper']='apps/files_external/lib/streamwrapper.php';
OC::$CLASSPATH['OC_FileStorage_StreamWrapper']='apps/files_external/lib/streamwrapper.php';
OC::$CLASSPATH['OC_Filestorage_FTP']='apps/files_external/lib/ftp.php';
OC::$CLASSPATH['OC_Filestorage_DAV']='apps/files_external/lib/webdav.php';
OC::$CLASSPATH['OC_Filestorage_Google']='apps/files_external/lib/google.php';
OC::$CLASSPATH['OC_Filestorage_SWIFT']='apps/files_external/lib/swift.php';
OC::$CLASSPATH['OC_Filestorage_SMB']='apps/files_external/lib/smb.php';
OC::$CLASSPATH['OC_Filestorage_AmazonS3']='apps/files_external/lib/amazons3.php';
OC::$CLASSPATH['OC_Mount_Config']='apps/files_external/lib/config.php';
OCP\App::registerAdmin('files_external', 'settings');
if (OCP\Config::getAppValue('files_external', 'allow_user_mounting', 'yes') == 'yes') {
OCP\App::registerPersonal('files_external', 'personal');
}

View File

@ -1,6 +1,5 @@
.error { color: #FF3B3B; }
td.type { width:8em; }
td.mount, td.options, td.applicable { width:10em; }
#addStorage>td { border:none; }
#addStorage>td:not(.selectStorage) { visibility:hidden; }
#selectStorage { margin-left:-10px; }
td.mountPoint, td.backend { width:10em; }
#addMountPoint>td { border:none; }
#addMountPoint>td.applicable { visibility:hidden; }
#selectBackend { margin-left:-10px; }

View File

@ -1,59 +1,143 @@
$(document).ready(function(){
$(document).ready(function() {
function applicableChange(applicable) {
if (applicable == 'Global') {
}
console.log(applicable);
}
$('#selectStorage').live('change', function() {
$('.chzn-select').chosen();
$('#selectBackend').live('change', function() {
var tr = $(this).parent().parent();
$('#externalStorage tbody').last().append($(tr).clone());
var selected = $(this).val();
var selected = $(this).find('option:selected').text();
var backendClass = $(this).val();
$(this).parent().text(selected);
var backends = $(this).data('configurations').split(';');
var configuration = [];
// Find selected backend configuration parameters
$.each(backends, function(index, backend) {
if (backend.split(':')[0] == selected) {
configuration = backend.split(':')[1].split(',');
// break;
}
});
$(tr).find('.backend').data('class', $(this).val());
var configurations = $(this).data('configurations');
var td = $(tr).find('td.configuration');
$.each(configuration, function(index, config) {
if (config.indexOf('*') != -1) {
td.append('<input type="password" placeholder="'+config.substring(1)+'" />');
} else {
td.append('<input type="text" placeholder="'+config+'" />');
$.each(configurations, function(backend, parameters) {
if (backend == backendClass) {
$.each(parameters['configuration'], function(parameter, placeholder) {
if (placeholder.indexOf('*') != -1) {
td.append('<input type="password" data-parameter="'+parameter+'" placeholder="'+placeholder.substring(1)+'" />');
} else if (placeholder.indexOf('!') != -1) {
td.append('<label><input type="checkbox" data-parameter="'+parameter+'" />'+placeholder.substring(1)+'</label>');
} else if (placeholder.indexOf('&') != -1) {
td.append('<input type="text" class="optional" data-parameter="'+parameter+'" placeholder="'+placeholder.substring(1)+'" />');
} else {
td.append('<input type="text" data-parameter="'+parameter+'" placeholder="'+placeholder+'" />');
}
});
return false;
}
});
$('.chz-select').chosen();
$(tr).find('td').last().attr('class', 'remove');
$(tr).removeAttr('id');
$(this).remove();
});
$('td.remove>img').live('click', function() {
$(this).parent().parent().remove();
// TODO remove storage
});
$('#externalStorage select[multiple]').each(function(index,element){
applyMultiplySelect($(element));
});
function applyMultiplySelect(element) {
var checkHandeler=false;
element.multiSelect({
oncheck:applicableChange,
onuncheck:applicableChange,
minWidth: 120,
$('#externalStorage td').live('change', function() {
var tr = $(this).parent();
var mountPoint = $(tr).find('.mountPoint input').val();
if (mountPoint == '') {
return false;
}
var backendClass = $(tr).find('.backend').data('class');
var configuration = $(tr).find('.configuration input');
var addMountPoint = true;
if (configuration.length < 1) {
return false;
}
var classOptions = {};
$.each(configuration, function(index, input) {
if ($(input).val() == '' && !$(input).hasClass('optional')) {
addMountPoint = false;
return false;
}
if ($(input).is(':checkbox')) {
if ($(input).is(':checked')) {
classOptions[$(input).data('parameter')] = true;
} else {
classOptions[$(input).data('parameter')] = false;
}
} else {
classOptions[$(input).data('parameter')] = $(input).val();
}
});
}
if (addMountPoint) {
if ($('#externalStorage').data('admin')) {
var isPersonal = false;
var multiselect = $(tr).find('.chzn-select').val();
var oldGroups = $(tr).find('.applicable').data('applicable-groups');
var oldUsers = $(tr).find('.applicable').data('applicable-users');
$.each(multiselect, function(index, value) {
var pos = value.indexOf('(group)');
if (pos != -1) {
var mountType = 'group';
var applicable = value.substr(0, pos);
if ($.inArray(applicable, oldGroups) != -1) {
oldGroups.splice($.inArray(applicable, oldGroups), 1);
}
} else {
var mountType = 'user';
var applicable = value;
if ($.inArray(applicable, oldUsers) != -1) {
oldUsers.splice($.inArray(applicable, oldUsers), 1);
}
}
$.post(OC.filePath('files_external', 'ajax', 'addMountPoint.php'), { mountPoint: mountPoint, class: backendClass, classOptions: classOptions, mountType: mountType, applicable: applicable, isPersonal: isPersonal });
});
var mountType = 'group';
$.each(oldGroups, function(index, applicable) {
$.post(OC.filePath('files_external', 'ajax', 'removeMountPoint.php'), { mountPoint: mountPoint, mountType: mountType, applicable: applicable, isPersonal: isPersonal });
});
var mountType = 'user';
$.each(oldUsers, function(index, applicable) {
$.post(OC.filePath('files_external', 'ajax', 'removeMountPoint.php'), { mountPoint: mountPoint, mountType: mountType, applicable: applicable, isPersonal: isPersonal });
});
} else {
var isPersonal = true;
var mountType = 'user';
var applicable = OC.currentUser;
$.post(OC.filePath('files_external', 'ajax', 'addMountPoint.php'), { mountPoint: mountPoint, class: backendClass, classOptions: classOptions, mountType: mountType, applicable: applicable, isPersonal: isPersonal });
}
}
});
$('td.remove>img').live('click', function() {
var tr = $(this).parent().parent();
var mountPoint = $(tr).find('.mountPoint input').val();
if (mountPoint == '') {
return false;
}
if ($('#externalStorage').data('admin')) {
var isPersonal = false;
var multiselect = $(tr).find('.chzn-select').val();
$.each(multiselect, function(index, value) {
var pos = value.indexOf('(group)');
if (pos != -1) {
var mountType = 'group';
var applicable = value.substr(0, pos);
} else {
var mountType = 'user';
var applicable = value;
}
$.post(OC.filePath('files_external', 'ajax', 'removeMountPoint.php'), { mountPoint: mountPoint, mountType: mountType, applicable: applicable, isPersonal: isPersonal });
});
} else {
var mountType = 'user';
var applicable = OC.currentUser;
var isPersonal = true;
}
$.post(OC.filePath('files_external', 'ajax', 'removeMountPoint.php'), { mountPoint: mountPoint, mountType: mountType, applicable: applicable, isPersonal: isPersonal });
$(tr).remove();
});
$('#allowUserMounting').bind('change', function() {
// TODO save setting
if (this.checked) {
OC.AppConfig.setValue('files_external', 'allow_user_mounting', 'yes');
} else {
OC.AppConfig.setValue('files_external', 'allow_user_mounting', 'no');
}
});
});

View File

@ -0,0 +1,231 @@
<?php
/**
* ownCloud
*
* @author Michael Gapczynski
* @copyright 2012 Michael Gapczynski mtgap@owncloud.com
*
* 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/>.
*/
/**
* Class to configure the config/mount.php and data/$user/mount.php files
*/
class OC_Mount_Config {
const MOUNT_TYPE_GLOBAL = 'global';
const MOUNT_TYPE_GROUP = 'group';
const MOUNT_TYPE_USER = 'user';
/**
* Get details on each of the external storage backends, used for the mount config UI
* If the configuration parameter should be secret, add a '*' to the beginning of the value
* If the configuration parameter is a boolean, add a '!' to the beginning of the value
* If the configuration parameter is optional, add a '&' to the beginning of the value
* @return array
*/
public static function getBackends() {
return array(
'OC_Filestorage_Local' => array('backend' => 'Local', 'configuration' => array('datadir' => 'Location')),
'OC_Filestorage_AmazonS3' => array('backend' => 'Amazon S3', 'configuration' => array('key' => 'Key', 'secret' => '*Secret', 'bucket' => 'Bucket')),
'OC_Filestorage_FTP' => array('backend' => 'FTP', 'configuration' => array('host' => 'URL', 'user' => 'Username', 'password' => '*Password', 'root' => '&Root', 'secure' => '!Secure ftps://')),
'OC_Filestorage_SWIFT' => array('backend' => 'OpenStack Swift', 'configuration' => array('host' => 'URL', 'user' => 'Username', 'token' => '*Token', 'root' => '&Root', 'secure' => '!Secure ftps://')),
'OC_Filestorage_SMB' => array('backend' => 'SMB', 'configuration' => array('host' => 'URL', 'user' => 'Username', 'password' => '*Password', 'root' => '&Root')),
'OC_Filestorage_DAV' => array('backend' => 'WebDAV', 'configuration' => array('host' => 'URL', 'user' => 'Username', 'password' => '*Password', 'root' => '&Root', 'secure' => '!Secure https://'))
);
}
/**
* Get the system mount points
* The returned array is not in the same format as getUserMountPoints()
* @return array
*/
public static function getSystemMountPoints() {
$mountPoints = self::readData(false);
$backends = self::getBackends();
$system = array();
if (isset($mountPoints[self::MOUNT_TYPE_GROUP])) {
foreach ($mountPoints[self::MOUNT_TYPE_GROUP] as $group => $mounts) {
foreach ($mounts as $mountPoint => $mount) {
// Remove '/$user/files/' from mount point
$mountPoint = substr($mountPoint, 13);
// Merge the mount point into the current mount points
if (isset($system[$mountPoint]) && $system[$mountPoint]['configuration'] == $mount['options']) {
$system[$mountPoint]['applicable']['groups'] = array_merge($system[$mountPoint]['applicable']['groups'], array($group));
} else {
$system[$mountPoint] = array('class' => $mount['class'], 'backend' => $backends[$mount['class']]['backend'], 'configuration' => $mount['options'], 'applicable' => array('groups' => array($group), 'users' => array()));
}
}
}
}
if (isset($mountPoints[self::MOUNT_TYPE_USER])) {
foreach ($mountPoints[self::MOUNT_TYPE_USER] as $user => $mounts) {
foreach ($mounts as $mountPoint => $mount) {
// Remove '/$user/files/' from mount point
$mountPoint = substr($mountPoint, 13);
// Merge the mount point into the current mount points
if (isset($system[$mountPoint]) && $system[$mountPoint]['configuration'] == $mount['options']) {
$system[$mountPoint]['applicable']['users'] = array_merge($system[$mountPoint]['applicable']['users'], array($user));
} else {
$system[$mountPoint] = array('class' => $mount['class'], 'backend' => $backends[$mount['class']]['backend'], 'configuration' => $mount['options'], 'applicable' => array('groups' => array(), 'users' => array($user)));
}
}
}
}
return $system;
}
/**
* Get the personal mount points of the current user
* The returned array is not in the same format as getUserMountPoints()
* @return array
*/
public static function getPersonalMountPoints() {
$mountPoints = self::readData(true);
$backends = self::getBackends();
$uid = OCP\User::getUser();
$personal = array();
if (isset($mountPoints[self::MOUNT_TYPE_USER][$uid])) {
foreach ($mountPoints[self::MOUNT_TYPE_USER][$uid] as $mountPoint => $mount) {
// Remove '/$user/files/' from mount point
$personal[substr($mountPoint, 13)] = array('class' => $mount['class'], 'backend' => $backends[$mount['class']]['backend'], 'configuration' => $mount['options']);
}
}
return $personal;
}
/**
* Add a mount point to the filesystem
* @param string Mount point
* @param string Backend class
* @param array Backend parameters for the class
* @param string MOUNT_TYPE_GROUP | MOUNT_TYPE_USER
* @param string User or group to apply mount to
* @param bool Personal or system mount point i.e. is this being called from the personal or admin page
* @return bool
*/
public static function addMountPoint($mountPoint, $class, $classOptions, $mountType, $applicable, $isPersonal = false) {
if ($isPersonal) {
// Verify that the mount point applies for the current user
// Prevent non-admin users from mounting local storage
if ($applicable != OCP\User::getUser() || $class == 'OC_Filestorage_Local') {
return false;
}
}
$mount = array($applicable => array('/$user/files/'.$mountPoint => array('class' => $class, 'options' => $classOptions)));
$mountPoints = self::readData($isPersonal);
// Merge the new mount point into the current mount points
if (isset($mountPoints[$mountType])) {
if (isset($mountPoints[$mountType][$applicable])) {
$mountPoints[$mountType][$applicable] = array_merge($mountPoints[$mountType][$applicable], $mount[$applicable]);
} else {
$mountPoints[$mountType] = array_merge($mountPoints[$mountType], $mount);
}
} else {
$mountPoints[$mountType] = $mount;
}
self::writeData($isPersonal, $mountPoints);
return true;
}
/**
*
* @param string Mount point
* @param string MOUNT_TYPE_GROUP | MOUNT_TYPE_USER
* @param string User or group to remove mount from
* @param bool Personal or system mount point
* @return bool
*/
public static function removeMountPoint($mountPoint, $mountType, $applicable, $isPersonal = false) {
// Verify that the mount point applies for the current user
if ($isPersonal && $applicable != OCP\User::getUser()) {
return false;
}
$mountPoints = self::readData($isPersonal);
// Remove mount point
unset($mountPoints[$mountType][$applicable]['/$user/files/'.$mountPoint]);
// Unset parent arrays if empty
if (empty($mountPoints[$mountType][$applicable])) {
unset($mountPoints[$mountType][$applicable]);
if (empty($mountPoints[$mountType])) {
unset($mountPoints[$mountType]);
}
}
self::writeData($isPersonal, $mountPoints);
return true;
}
/**
* Read the mount points in the config file into an array
* @param bool Personal or system config file
* @return array
*/
private static function readData($isPersonal) {
if ($isPersonal) {
$file = OC::$SERVERROOT.'/data/'.OCP\User::getUser().'/mount.php';
} else {
$file = OC::$SERVERROOT.'/config/mount.php';
}
if (is_file($file)) {
$mountPoints = include($file);
if (is_array($mountPoints)) {
return $mountPoints;
}
}
return array();
}
/**
* Write the mount points to the config file
* @param bool Personal or system config file
* @param array Mount points
*/
private static function writeData($isPersonal, $data) {
if ($isPersonal) {
$file = OC::$SERVERROOT.'/data/'.OCP\User::getUser().'/mount.php';
} else {
$file = OC::$SERVERROOT.'/config/mount.php';
}
$content = "<?php return array (\n";
if (isset($data[self::MOUNT_TYPE_GROUP])) {
$content .= "\t'group' => array (\n";
foreach ($data[self::MOUNT_TYPE_GROUP] as $group => $mounts) {
$content .= "\t\t'".$group."' => array (\n";
foreach ($mounts as $mountPoint => $mount) {
$content .= "\t\t\t'".$mountPoint."' => ".str_replace("\n", '', var_export($mount, true)).",\n";
}
$content .= "\t\t),\n";
}
$content .= "\t),\n";
}
if (isset($data[self::MOUNT_TYPE_USER])) {
$content .= "\t'user' => array (\n";
foreach ($data[self::MOUNT_TYPE_USER] as $user => $mounts) {
$content .= "\t\t'".$user."' => array (\n";
foreach ($mounts as $mountPoint => $mount) {
$content .= "\t\t\t'".$mountPoint."' => ".str_replace("\n", '', var_export($mount, true)).",\n";
}
$content .= "\t\t),\n";
}
$content .= "\t),\n";
}
$content .= ");\n?>";
@file_put_contents($file, $content);
}
}
?>

View File

@ -0,0 +1,34 @@
<?php
/**
* ownCloud
*
* @author Michael Gapczynski
* @copyright 2012 Michael Gapczynski mtgap@owncloud.com
*
* 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\Util::addScript('files_external', 'settings');
OCP\Util::addStyle('files_external', 'settings');
$backends = OC_Mount_Config::getBackends();
// Remove local storage
unset($backends['OC_Filestorage_Local']);
$tmpl = new OCP\Template('files_external', 'settings');
$tmpl->assign('isAdminPage', false);
$tmpl->assign('mounts', OC_Mount_Config::getPersonalMountPoints());
$tmpl->assign('backends', $backends);
return $tmpl->fetchPage();
?>

View File

@ -20,16 +20,15 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
OCP\Util::addscript('files_external', 'settings');
OCP\Util::addstyle('files_external', 'settings');
OCP\Util::addScript('files_external', 'settings');
OCP\Util::addStyle('files_external', 'settings');
$tmpl = new OCP\Template('files_external', 'settings');
$tmpl->assign('allowUserMounting', 'yes');
$tmpl->assign('isAdminPage', true);
$tmpl->assign('storage', array());
$tmpl->assign('mounts', OC_Mount_Config::getSystemMountPoints());
$tmpl->assign('backends', OC_Mount_Config::getBackends());
$tmpl->assign('groups', OC_Group::getGroups());
$tmpl->assign('backends', array('Amazon S3', 'FTP', 'Google Drive', 'SWIFT', 'WebDAV'));
$tmpl->assign('configurations', '');
$tmpl->assign('options', array('Encrypt', 'Version control', 'Allow sharing'));
$tmpl->assign('users', OCP\User::getUsers());
$tmpl->assign('allowUserMounting', OCP\Config::getAppValue('files_external', 'allow_user_mounting', 'yes'));
return $tmpl->fetchPage();
?>

View File

@ -1,70 +1,82 @@
<form id="files_external">
<fieldset class="personalblock">
<legend><strong><?php echo $l->t('External Storage'); ?></strong></legend>
<?php if (isset($_['storage'])): ?>
<table id="externalStorage">
<table id="externalStorage" data-admin="<?php echo json_encode($_['isAdminPage']); ?>">
<thead>
<tr>
<th><?php echo $l->t('Type'); ?></th>
<th><?php echo $l->t('Mount point'); ?></th>
<th><?php echo $l->t('Backend'); ?></th>
<th><?php echo $l->t('Configuration'); ?></th>
<th><?php echo $l->t('Mount Location'); ?></th>
<th><?php echo $l->t('Options'); ?></th>
<?php if ($_['isAdminPage'] == true) echo '<th>'.$l->t('Applicable').'</th>'; ?>
<!--<th><?php echo $l->t('Options'); ?></th> -->
<?php if ($_['isAdminPage']) echo '<th>'.$l->t('Applicable').'</th>'; ?>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<?php $_['storage'] = array_merge($_['storage'], array(array('id' => 'addStorage', 'mount' => ''))); ?>
<?php foreach($_['storage'] as $storage): ?>
<tr <?php if ($storage['id'] == 'addStorage') echo 'id="addStorage"'; ?> data-storage-id="<?php echo $storage['id']; ?>">
<?php if ($storage['id'] == 'addStorage'): ?>
<td class="selectStorage">
<select id="selectStorage" data-configurations="<?php echo $_['configurations']; ?>">
<option value="" disabled selected style="display:none;"><?php echo $l->t('Add storage'); ?></option>
<?php foreach($_['backends'] as $backend): ?>
<option value="<?php echo $backend; ?>"><?php echo $backend; ?></option>
<tbody width="100%">
<?php $_['mounts'] = array_merge($_['mounts'], array('' => array())); ?>
<?php foreach ($_['mounts'] as $mountPoint => $mount): ?>
<tr <?php if ($mountPoint == '') echo 'id="addMountPoint"'; ?>>
<td class="mountPoint"><input type="text" name="mountPoint" value="<?php echo $mountPoint; ?>" placeholder="<?php echo $l->t('Mount point'); ?>" /></td>
<?php if ($mountPoint == ''): ?>
<td class="backend">
<select id="selectBackend" data-configurations='<?php echo json_encode($_['backends']); ?>'>
<option value="" disabled selected style="display:none;"><?php echo $l->t('Add mount point'); ?></option>
<?php foreach ($_['backends'] as $class => $backend): ?>
<option value="<?php echo $class; ?>"><?php echo $backend['backend']; ?></option>
<?php endforeach; ?>
</select>
</td>
<?php else: ?>
<td class="type" <?php if ($storage['status'] == 'error') echo 'class="error"'; ?>><?php echo $storage['type']; ?></td>
<?php endif; ?>
<td class ="configuration">
<?php if (isset($storage['configuration'])): ?>
<?php foreach($storage['configuration'] as $parameter => $value): ?>
<?php if (strpos($parameter, '*') !== false): ?>
<input type="password" value="<?php echo $value; ?>" placeholder="<?php echo $l->t(substr($parameter, 1)); ?>" />
<?php else: ?>
<input type="text" value="<?php echo $value; ?>" placeholder="<?php echo $l->t($parameter); ?>" />
<?php endif; ?>
<?php endforeach; ?>
<td class="backend" data-class="<?php echo $mount['class']; ?>"><?php echo $mount['backend']; ?></td>
<?php endif; ?>
<td class ="configuration" width="100%">
<?php if (isset($mount['configuration'])): ?>
<?php foreach ($mount['configuration'] as $parameter => $value): ?>
<?php if (isset($_['backends'][$mount['class']]['configuration'][$parameter])): ?>
<?php $placeholder = $_['backends'][$mount['class']]['configuration'][$parameter]; ?>
<?php if (strpos($placeholder, '*') !== false): ?>
<input type="password" data-parameter="<?php echo $parameter; ?>" value="<?php echo $value; ?>" placeholder="<?php echo substr($placeholder, 1); ?>" />
<?php elseif(strpos($placeholder, '!') !== false): ?>
<label><input type="checkbox" data-parameter="<?php echo $parameter; ?>" <?php if ($value == 'true') echo ' checked="checked"'; ?> /><?php echo substr($placeholder, 1); ?></label>
<?php elseif (strpos($placeholder, '&') !== false): ?>
<input type="text" class="optional" data-parameter="<?php echo $parameter; ?>" value="<?php echo $value; ?>" placeholder="<?php echo substr($placeholder, 1); ?>" />
<?php else: ?>
<input type="text" data-parameter="<?php echo $parameter; ?>" value="<?php echo $value; ?>" placeholder="<?php echo $placeholder; ?>" />
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
</td>
<td class="mount"><input type="text" name="storageMountLocation" value="<?php echo $storage['mount']; ?>" placeholder="<?php echo $l->t('Mount Location'); ?>" /></td>
<td class="options">
<select class="selectOptions" title="<?php echo $l->t('None set')?>" multiple="multiple">
<!--<td class="options">
<select class="selectOptions" title="<?php echo $l->t('None set')?>" multiple="multiple" disabled>
<?php if (OCP\App::isEnabled('files_encryption')) echo '<option value="Encrypt">Encrypt</option>'; ?>
<?php if (OCP\App::isEnabled('files_versions')) echo '<option value="Version control">Version control</option>'; ?>
<?php if (OCP\App::isEnabled('files_sharing')) echo '<option value="Allow sharing">Allow sharing</option>'; ?>
</select>
</td>
<?php if ($_['isAdminPage'] == true): ?>
<td class="applicable">
<select class="selectApplicable" data-storage-applicable="<?php echo $storage['applicable']; ?>" title="<?php echo $l->t('None set'); ?>" multiple="multiple">
<option value="Global"><?php echo $l->t('Global'); ?></option>
<?php foreach($_['groups'] as $group): ?>
<option value="<?php echo $group; ?>"><?php echo $group; ?></option>
<?php endforeach; ?>
</td>-->
<?php if ($_['isAdminPage']): ?>
<td class="applicable" align="right" data-applicable-groups='<?php if (isset($mount['applicable']['groups'])) echo json_encode($mount['applicable']['groups']); ?>' data-applicable-users='<?php if (isset($mount['applicable']['users'])) echo json_encode($mount['applicable']['users']); ?>'>
<select class="chzn-select" multiple style="width:20em;" data-placeholder="<?php echo $l->t('None set'); ?>">
<option value="all"><?php echo $l->t('All Users'); ?></option>
<optgroup label="<?php echo $l->t('Groups'); ?>">
<?php foreach ($_['groups'] as $group): ?>
<option value="<?php echo $group; ?>(group)" <?php if (isset($mount['applicable']['groups']) && in_array($group, $mount['applicable']['groups'])) echo 'selected="selected"'; ?>><?php echo $group; ?></option>
<?php endforeach; ?>
</optgroup>
<optgroup label="<?php echo $l->t('Users'); ?>">
<?php foreach ($_['users'] as $user): ?>
<option value="<?php echo $user; ?>" <?php if (isset($mount['applicable']['users']) && in_array($user, $mount['applicable']['users'])) echo 'selected="selected"'; ?>"><?php echo $user; ?></option>
<?php endforeach; ?>
</optgroup>
</select>
</td>
<?php endif; ?>
<td <?php if ($storage['id'] != 'addStorage') echo 'class="remove"'; ?>><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>
<td <?php if ($mountPoint != '') echo 'class="remove"'; ?>><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>
<?php endif; ?>
<?php if ($_['isAdminPage'] == true): ?>
<?php if ($_['isAdminPage']): ?>
<br />
<input type="checkbox" name="allowUserMounting" id="allowUserMounting" value="1" <?php if ($_['allowUserMounting'] == 'yes') echo ' checked="checked"'; ?> />
<label for="allowUserMounting"><?php echo $l->t('Enable User External Storage'); ?></label><br/>