if ($.inArray(applicable, oldUsers) != -1) {
oldUsers.splice($.inArray(applicable, oldUsers), 1);
}
+ users.push(applicable);
}
- $.post(OC.filePath('files_external', 'ajax', 'addMountPoint.php'), { mountPoint: mountPoint, 'class': backendClass, classOptions: classOptions, mountType: mountType, applicable: applicable, isPersonal: isPersonal });
+ $.ajax({type: 'POST',
+ url: OC.filePath('files_external', 'ajax', 'addMountPoint.php'),
+ data: {
+ mountPoint: mountPoint,
- class: backendClass,
++ 'class': backendClass,
+ classOptions: classOptions,
+ mountType: mountType,
+ applicable: applicable,
+ isPersonal: isPersonal
+ },
+ async: false,
+ success: function(result) {
+ statusSpan.removeClass();
+ if (result && result.status == 'success' && result.data.message) {
+ status = true;
+ statusSpan.addClass('success');
+ } else {
+ statusSpan.addClass('error');
+ }
+ }
+ });
});
+ $(tr).find('.applicable').data('applicable-groups', groups);
+ $(tr).find('.applicable').data('applicable-users', users);
var mountType = 'group';
$.each(oldGroups, function(index, applicable) {
- $.post(OC.filePath('files_external', 'ajax', 'removeMountPoint.php'), { mountPoint: mountPoint, mountType: mountType, applicable: applicable, isPersonal: isPersonal });
+ $.ajax({type: 'POST',
+ url: OC.filePath('files_external', 'ajax', 'removeMountPoint.php'),
+ data: {
+ mountPoint: mountPoint,
+ class: backendClass,
+ classOptions: classOptions,
+ mountType: mountType,
+ applicable: applicable,
+ isPersonal: isPersonal
+ },
+ async: false
+ });
});
var mountType = 'user';
$.each(oldUsers, function(index, applicable) {
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 });
+ $.ajax({type: 'POST',
+ url: OC.filePath('files_external', 'ajax', 'addMountPoint.php'),
+ data: {
+ mountPoint: mountPoint,
- class: backendClass,
++ 'class': backendClass,
+ classOptions: classOptions,
+ mountType: mountType,
+ applicable: applicable,
+ isPersonal: isPersonal
+ },
+ async: false,
+ success: function(result) {
+ statusSpan.removeClass();
+ if (result && result.status == 'success' && result.data.message) {
+ status = true;
+ statusSpan.addClass('success');
+ } else {
+ statusSpan.addClass('error');
+ }
+ }
+ });
}
- return true;
+ return status;
}
}
};
private $share;
public function __construct($params) {
- $this->host=$params['host'];
- $this->user=$params['user'];
- $this->password=$params['password'];
- $this->share=$params['share'];
- $this->root=isset($params['root'])?$params['root']:'/';
- if ( ! $this->root || $this->root[0]!='/') {
- $this->root='/'.$this->root;
- }
- if (substr($this->root, -1, 1)!='/') {
- $this->root.='/';
- }
- if ( ! $this->share || $this->share[0]!='/') {
- $this->share='/'.$this->share;
- }
- if(substr($this->share, -1, 1)=='/') {
- $this->share = substr($this->share, 0, -1);
+ if (isset($params['host']) && isset($params['user']) && isset($params['password']) && isset($params['share'])) {
+ $this->host=$params['host'];
+ $this->user=$params['user'];
+ $this->password=$params['password'];
+ $this->share=$params['share'];
+ $this->root=isset($params['root'])?$params['root']:'/';
+ if ( ! $this->root || $this->root[0]!='/') {
+ $this->root='/'.$this->root;
+ }
+ if (substr($this->root, -1, 1)!='/') {
+ $this->root.='/';
+ }
+ if ( ! $this->share || $this->share[0]!='/') {
+ $this->share='/'.$this->share;
+ }
+ if (substr($this->share, -1, 1)=='/') {
- $this->share=substr($this->share, 0, -1);
++ $this->share = substr($this->share, 0, -1);
+ }
+ } else {
+ throw new \Exception();
}
}
<?php $_['mounts'] = array_merge($_['mounts'], array('' => array())); ?>
<?php foreach ($_['mounts'] as $mountPoint => $mount): ?>
<tr <?php echo ($mountPoint != '') ? 'class="'.$mount['class'].'"' : 'id="addMountPoint"'; ?>>
+ <td class="status">
+ <?php if (isset($mount['status'])): ?>
+ <span class="<?php echo ($mount['status']) ? 'success' : 'error'; ?>"></span>
+ <?php endif; ?>
+ </td>
<td class="mountPoint"><input type="text" name="mountPoint"
- value="<?php echo $mountPoint; ?>"
+ value="<?php p($mountPoint); ?>"
- placeholder="<?php echo $l->t('Mount point'); ?>" /></td>
+ placeholder="<?php echo $l->t('Folder name'); ?>" /></td>
<?php if ($mountPoint == ''): ?>
<td class="backend">
<select id="selectBackend" data-configurations='<?php echo json_encode($_['backends']); ?>'>