Merge pull request #11453 from owncloud/enc_visual_improvements
[encryption] some visual improvements
This commit is contained in:
commit
6d94a88476
|
@ -16,8 +16,28 @@ use OCA\Encryption;
|
||||||
$l = \OC::$server->getL10N('files_encryption');
|
$l = \OC::$server->getL10N('files_encryption');
|
||||||
|
|
||||||
$return = false;
|
$return = false;
|
||||||
// Enable recoveryAdmin
|
$errorMessage = $l->t("Unknown error");
|
||||||
|
|
||||||
|
//check if both passwords are the same
|
||||||
|
if (empty($_POST['recoveryPassword'])) {
|
||||||
|
$errorMessage = $l->t('Missing recovery key password');
|
||||||
|
\OCP\JSON::error(array('data' => array('message' => $errorMessage)));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($_POST['confirmPassword'])) {
|
||||||
|
$errorMessage = $l->t('Please repeat the recovery key password');
|
||||||
|
\OCP\JSON::error(array('data' => array('message' => $errorMessage)));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_POST['recoveryPassword'] !== $_POST['confirmPassword']) {
|
||||||
|
$errorMessage = $l->t('Repeated recovery key password does not match the provided recovery key password');
|
||||||
|
\OCP\JSON::error(array('data' => array('message' => $errorMessage)));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable recoveryAdmin
|
||||||
$recoveryKeyId = \OC::$server->getAppConfig()->getValue('files_encryption', 'recoveryKeyId');
|
$recoveryKeyId = \OC::$server->getAppConfig()->getValue('files_encryption', 'recoveryKeyId');
|
||||||
|
|
||||||
if (isset($_POST['adminEnableRecovery']) && $_POST['adminEnableRecovery'] === '1') {
|
if (isset($_POST['adminEnableRecovery']) && $_POST['adminEnableRecovery'] === '1') {
|
||||||
|
@ -26,14 +46,9 @@ if (isset($_POST['adminEnableRecovery']) && $_POST['adminEnableRecovery'] === '1
|
||||||
|
|
||||||
// Return success or failure
|
// Return success or failure
|
||||||
if ($return) {
|
if ($return) {
|
||||||
\OCP\JSON::success(array('data' => array('message' => $l->t('Recovery key successfully enabled'))));
|
$successMessage = $l->t('Recovery key successfully enabled');
|
||||||
} else {
|
} else {
|
||||||
\OCP\JSON::error(array(
|
$errorMessage = $l->t('Could not disable recovery key. Please check your recovery key password!');
|
||||||
'data' => array(
|
|
||||||
'message' => $l->t(
|
|
||||||
'Could not enable recovery key. Please check your recovery key password!')
|
|
||||||
)
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable recoveryAdmin
|
// Disable recoveryAdmin
|
||||||
|
@ -43,17 +58,16 @@ if (isset($_POST['adminEnableRecovery']) && $_POST['adminEnableRecovery'] === '1
|
||||||
) {
|
) {
|
||||||
$return = \OCA\Encryption\Helper::adminDisableRecovery($_POST['recoveryPassword']);
|
$return = \OCA\Encryption\Helper::adminDisableRecovery($_POST['recoveryPassword']);
|
||||||
|
|
||||||
// Return success or failure
|
|
||||||
if ($return) {
|
if ($return) {
|
||||||
\OCP\JSON::success(array('data' => array('message' => $l->t('Recovery key successfully disabled'))));
|
$successMessage = $l->t('Recovery key successfully disabled');
|
||||||
} else {
|
} else {
|
||||||
\OCP\JSON::error(array(
|
$errorMessage = $l->t('Could not disable recovery key. Please check your recovery key password!');
|
||||||
'data' => array(
|
|
||||||
'message' => $l->t(
|
|
||||||
'Could not disable recovery key. Please check your recovery key password!')
|
|
||||||
)
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return success or failure
|
||||||
|
if ($return) {
|
||||||
|
\OCP\JSON::success(array('data' => array('message' => $successMessage)));
|
||||||
|
} else {
|
||||||
|
\OCP\JSON::error(array('data' => array('message' => $errorMessage)));
|
||||||
|
}
|
||||||
|
|
|
@ -21,6 +21,32 @@ $return = false;
|
||||||
|
|
||||||
$oldPassword = $_POST['oldPassword'];
|
$oldPassword = $_POST['oldPassword'];
|
||||||
$newPassword = $_POST['newPassword'];
|
$newPassword = $_POST['newPassword'];
|
||||||
|
$confirmPassword = $_POST['confirmPassword'];
|
||||||
|
|
||||||
|
//check if both passwords are the same
|
||||||
|
if (empty($_POST['oldPassword'])) {
|
||||||
|
$errorMessage = $l->t('Please provide the old recovery password');
|
||||||
|
\OCP\JSON::error(array('data' => array('message' => $errorMessage)));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($_POST['newPassword'])) {
|
||||||
|
$errorMessage = $l->t('Please provide a new recovery password');
|
||||||
|
\OCP\JSON::error(array('data' => array('message' => $errorMessage)));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($_POST['confirmPassword'])) {
|
||||||
|
$errorMessage = $l->t('Please repeat the new recovery password');
|
||||||
|
\OCP\JSON::error(array('data' => array('message' => $errorMessage)));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_POST['newPassword'] !== $_POST['confirmPassword']) {
|
||||||
|
$errorMessage = $l->t('Repeated recovery key password does not match the provided recovery key password');
|
||||||
|
\OCP\JSON::error(array('data' => array('message' => $errorMessage)));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
$view = new \OC\Files\View('/');
|
$view = new \OC\Files\View('/');
|
||||||
$util = new \OCA\Encryption\Util(new \OC\Files\View('/'), \OCP\User::getUser());
|
$util = new \OCA\Encryption\Util(new \OC\Files\View('/'), \OCP\User::getUser());
|
||||||
|
|
|
@ -13,6 +13,8 @@ use OCA\Encryption;
|
||||||
\OCP\JSON::checkAppEnabled('files_encryption');
|
\OCP\JSON::checkAppEnabled('files_encryption');
|
||||||
\OCP\JSON::callCheck();
|
\OCP\JSON::callCheck();
|
||||||
|
|
||||||
|
$l = \OC::$server->getL10N('files_encryption');
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isset($_POST['userEnableRecovery'])
|
isset($_POST['userEnableRecovery'])
|
||||||
&& (0 == $_POST['userEnableRecovery'] || '1' === $_POST['userEnableRecovery'])
|
&& (0 == $_POST['userEnableRecovery'] || '1' === $_POST['userEnableRecovery'])
|
||||||
|
@ -38,4 +40,8 @@ if (
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return success or failure
|
// Return success or failure
|
||||||
($return) ? \OCP\JSON::success() : \OCP\JSON::error();
|
if ($return) {
|
||||||
|
\OCP\JSON::success(array('data' => array('message' => $l->t('File recovery settings updated'))));
|
||||||
|
} else {
|
||||||
|
\OCP\JSON::error(array('data' => array('message' => $l->t('Could not update file recovery'))));
|
||||||
|
}
|
||||||
|
|
|
@ -9,32 +9,21 @@
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
$('input:password[name="encryptionRecoveryPassword"]').keyup(function(event) {
|
|
||||||
var recoveryPassword = $( '#encryptionRecoveryPassword' ).val();
|
|
||||||
var recoveryPasswordRepeated = $( '#repeatEncryptionRecoveryPassword' ).val();
|
|
||||||
var checkedButton = $('input:radio[name="adminEnableRecovery"]:checked').val();
|
|
||||||
var uncheckedValue = (1+parseInt(checkedButton)) % 2;
|
|
||||||
if (recoveryPassword !== '' && recoveryPassword === recoveryPasswordRepeated) {
|
|
||||||
$('input:radio[name="adminEnableRecovery"][value="'+uncheckedValue.toString()+'"]').removeAttr("disabled");
|
|
||||||
} else {
|
|
||||||
$('input:radio[name="adminEnableRecovery"][value="'+uncheckedValue.toString()+'"]').attr("disabled", "true");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$( 'input:radio[name="adminEnableRecovery"]' ).change(
|
$( 'input:radio[name="adminEnableRecovery"]' ).change(
|
||||||
function() {
|
function() {
|
||||||
var recoveryStatus = $( this ).val();
|
var recoveryStatus = $( this ).val();
|
||||||
var oldStatus = (1+parseInt(recoveryStatus)) % 2;
|
var oldStatus = (1+parseInt(recoveryStatus)) % 2;
|
||||||
var recoveryPassword = $( '#encryptionRecoveryPassword' ).val();
|
var recoveryPassword = $( '#encryptionRecoveryPassword' ).val();
|
||||||
|
var confirmPassword = $( '#repeatEncryptionRecoveryPassword' ).val();
|
||||||
|
OC.msg.startSaving('#encryptionSetRecoveryKey .msg');
|
||||||
$.post(
|
$.post(
|
||||||
OC.filePath( 'files_encryption', 'ajax', 'adminrecovery.php' )
|
OC.filePath( 'files_encryption', 'ajax', 'adminrecovery.php' )
|
||||||
, { adminEnableRecovery: recoveryStatus, recoveryPassword: recoveryPassword }
|
, { adminEnableRecovery: recoveryStatus, recoveryPassword: recoveryPassword, confirmPassword: confirmPassword }
|
||||||
, function( result ) {
|
, function( result ) {
|
||||||
|
OC.msg.finishedSaving('#encryptionSetRecoveryKey .msg', result);
|
||||||
if (result.status === "error") {
|
if (result.status === "error") {
|
||||||
OC.Notification.show(t('admin', result.data.message));
|
|
||||||
$('input:radio[name="adminEnableRecovery"][value="'+oldStatus.toString()+'"]').attr("checked", "true");
|
$('input:radio[name="adminEnableRecovery"][value="'+oldStatus.toString()+'"]').attr("checked", "true");
|
||||||
} else {
|
} else {
|
||||||
OC.Notification.hide();
|
|
||||||
if (recoveryStatus === "0") {
|
if (recoveryStatus === "0") {
|
||||||
$('p[name="changeRecoveryPasswordBlock"]').addClass("hidden");
|
$('p[name="changeRecoveryPasswordBlock"]').addClass("hidden");
|
||||||
} else {
|
} else {
|
||||||
|
@ -49,33 +38,17 @@ $(document).ready(function(){
|
||||||
|
|
||||||
// change recovery password
|
// change recovery password
|
||||||
|
|
||||||
$('input:password[name="changeRecoveryPassword"]').keyup(function(event) {
|
|
||||||
var oldRecoveryPassword = $('#oldEncryptionRecoveryPassword').val();
|
|
||||||
var newRecoveryPassword = $('#newEncryptionRecoveryPassword').val();
|
|
||||||
var newRecoveryPasswordRepeated = $('#repeatedNewEncryptionRecoveryPassword').val();
|
|
||||||
|
|
||||||
if (newRecoveryPassword !== '' && oldRecoveryPassword !== '' && newRecoveryPassword === newRecoveryPasswordRepeated) {
|
|
||||||
$('button:button[name="submitChangeRecoveryKey"]').removeAttr("disabled");
|
|
||||||
} else {
|
|
||||||
$('button:button[name="submitChangeRecoveryKey"]').attr("disabled", "true");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$('button:button[name="submitChangeRecoveryKey"]').click(function() {
|
$('button:button[name="submitChangeRecoveryKey"]').click(function() {
|
||||||
var oldRecoveryPassword = $('#oldEncryptionRecoveryPassword').val();
|
var oldRecoveryPassword = $('#oldEncryptionRecoveryPassword').val();
|
||||||
var newRecoveryPassword = $('#newEncryptionRecoveryPassword').val();
|
var newRecoveryPassword = $('#newEncryptionRecoveryPassword').val();
|
||||||
OC.msg.startSaving('#encryption .msg');
|
var confirmNewPassword = $('#repeatedNewEncryptionRecoveryPassword').val();
|
||||||
|
OC.msg.startSaving('#encryptionChangeRecoveryKey .msg');
|
||||||
$.post(
|
$.post(
|
||||||
OC.filePath( 'files_encryption', 'ajax', 'changeRecoveryPassword.php' )
|
OC.filePath( 'files_encryption', 'ajax', 'changeRecoveryPassword.php' )
|
||||||
, { oldPassword: oldRecoveryPassword, newPassword: newRecoveryPassword }
|
, { oldPassword: oldRecoveryPassword, newPassword: newRecoveryPassword, confirmPassword: confirmNewPassword }
|
||||||
, function( data ) {
|
, function( data ) {
|
||||||
if (data.status == "error") {
|
OC.msg.finishedSaving('#encryptionChangeRecoveryKey .msg', data);
|
||||||
OC.msg.finishedSaving('#encryption .msg', data);
|
|
||||||
} else {
|
|
||||||
OC.msg.finishedSaving('#encryption .msg', data);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -26,36 +26,27 @@ $(document).ready(function(){
|
||||||
// Trigger ajax on recoveryAdmin status change
|
// Trigger ajax on recoveryAdmin status change
|
||||||
$( 'input:radio[name="userEnableRecovery"]' ).change(
|
$( 'input:radio[name="userEnableRecovery"]' ).change(
|
||||||
function() {
|
function() {
|
||||||
|
|
||||||
// Hide feedback messages in case they're already visible
|
|
||||||
$('#recoveryEnabledSuccess').hide();
|
|
||||||
$('#recoveryEnabledError').hide();
|
|
||||||
|
|
||||||
var recoveryStatus = $( this ).val();
|
var recoveryStatus = $( this ).val();
|
||||||
|
OC.msg.startAction('#userEnableRecovery .msg', 'Updating recovery keys. This can take some time...');
|
||||||
$.post(
|
$.post(
|
||||||
OC.filePath( 'files_encryption', 'ajax', 'userrecovery.php' )
|
OC.filePath( 'files_encryption', 'ajax', 'userrecovery.php' )
|
||||||
, { userEnableRecovery: recoveryStatus }
|
, { userEnableRecovery: recoveryStatus }
|
||||||
, function( data ) {
|
, function( data ) {
|
||||||
if ( data.status == "success" ) {
|
OC.msg.finishedAction('#userEnableRecovery .msg', data);
|
||||||
$('#recoveryEnabledSuccess').show();
|
|
||||||
} else {
|
|
||||||
$('#recoveryEnabledError').show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
// Ensure page is not reloaded on form submit
|
// Ensure page is not reloaded on form submit
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
$("#encryptAll").click(
|
$("#encryptAll").click(
|
||||||
function(){
|
function(){
|
||||||
|
|
||||||
// Hide feedback messages in case they're already visible
|
// Hide feedback messages in case they're already visible
|
||||||
$('#encryptAllSuccess').hide();
|
$('#encryptAllSuccess').hide();
|
||||||
$('#encryptAllError').hide();
|
$('#encryptAllError').hide();
|
||||||
|
|
||||||
var userPassword = $( '#userPassword' ).val();
|
var userPassword = $( '#userPassword' ).val();
|
||||||
var encryptAll = $( '#encryptAll' ).val();
|
var encryptAll = $( '#encryptAll' ).val();
|
||||||
|
|
||||||
|
@ -73,7 +64,7 @@ $(document).ready(function(){
|
||||||
// Ensure page is not reloaded on form submit
|
// Ensure page is not reloaded on form submit
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// update private key password
|
// update private key password
|
||||||
|
|
|
@ -4,8 +4,9 @@
|
||||||
<?php if($_["initStatus"] === \OCA\Encryption\Session::NOT_INITIALIZED): ?>
|
<?php if($_["initStatus"] === \OCA\Encryption\Session::NOT_INITIALIZED): ?>
|
||||||
<?php p($l->t("Encryption App is enabled but your keys are not initialized, please log-out and log-in again")); ?>
|
<?php p($l->t("Encryption App is enabled but your keys are not initialized, please log-out and log-in again")); ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<p>
|
<p id="encryptionSetRecoveryKey">
|
||||||
<?php p($l->t("Enable recovery key (allow to recover users files in case of password loss):")); ?>
|
<?php p($l->t("Enable recovery key (allow to recover users files in case of password loss):")); ?>
|
||||||
|
<span class="msg"></span>
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
<input type="password" name="encryptionRecoveryPassword" id="encryptionRecoveryPassword"/>
|
<input type="password" name="encryptionRecoveryPassword" id="encryptionRecoveryPassword"/>
|
||||||
|
@ -19,7 +20,7 @@
|
||||||
id='adminEnableRecovery'
|
id='adminEnableRecovery'
|
||||||
name='adminEnableRecovery'
|
name='adminEnableRecovery'
|
||||||
value='1'
|
value='1'
|
||||||
<?php echo($_["recoveryEnabled"] === '1' ? 'checked="checked"' : 'disabled'); ?> />
|
<?php echo($_["recoveryEnabled"] === '1' ? 'checked="checked"' : ''); ?> />
|
||||||
<label for="adminEnableRecovery"><?php p($l->t("Enabled")); ?></label>
|
<label for="adminEnableRecovery"><?php p($l->t("Enabled")); ?></label>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
@ -28,13 +29,14 @@
|
||||||
id='adminDisableRecovery'
|
id='adminDisableRecovery'
|
||||||
name='adminEnableRecovery'
|
name='adminEnableRecovery'
|
||||||
value='0'
|
value='0'
|
||||||
<?php echo($_["recoveryEnabled"] === '0' ? 'checked="checked"' : 'disabled'); ?> />
|
<?php echo($_["recoveryEnabled"] === '0' ? 'checked="checked"' : ''); ?> />
|
||||||
<label for="adminDisableRecovery"><?php p($l->t("Disabled")); ?></label>
|
<label for="adminDisableRecovery"><?php p($l->t("Disabled")); ?></label>
|
||||||
</p>
|
</p>
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
|
|
||||||
<p name="changeRecoveryPasswordBlock" <?php if ($_['recoveryEnabled'] === '0') print_unescaped('class="hidden"');?>>
|
<p name="changeRecoveryPasswordBlock" id="encryptionChangeRecoveryKey" <?php if ($_['recoveryEnabled'] === '0') print_unescaped('class="hidden"');?>>
|
||||||
<strong><?php p($l->t("Change recovery key password:")); ?></strong>
|
<strong><?php p($l->t("Change recovery key password:")); ?></strong>
|
||||||
|
<span class="msg"></span>
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
<input
|
<input
|
||||||
type="password"
|
type="password"
|
||||||
|
@ -57,10 +59,9 @@
|
||||||
<br/>
|
<br/>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
name="submitChangeRecoveryKey"
|
name="submitChangeRecoveryKey">
|
||||||
disabled><?php p($l->t("Change Password")); ?>
|
<?php p($l->t("Change Password")); ?>
|
||||||
</button>
|
</button>
|
||||||
<span class="msg"></span>
|
|
||||||
</p>
|
</p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -39,8 +39,9 @@
|
||||||
|
|
||||||
<?php elseif ( $_["recoveryEnabled"] && $_["privateKeySet"] && $_["initialized"] === \OCA\Encryption\Session::INIT_SUCCESSFUL ): ?>
|
<?php elseif ( $_["recoveryEnabled"] && $_["privateKeySet"] && $_["initialized"] === \OCA\Encryption\Session::INIT_SUCCESSFUL ): ?>
|
||||||
<br />
|
<br />
|
||||||
<p>
|
<p id="userEnableRecovery">
|
||||||
<label for="userEnableRecovery"><?php p( $l->t( "Enable password recovery:" ) ); ?></label>
|
<label for="userEnableRecovery"><?php p( $l->t( "Enable password recovery:" ) ); ?></label>
|
||||||
|
<span class="msg"></span>
|
||||||
<br />
|
<br />
|
||||||
<em><?php p( $l->t( "Enabling this option will allow you to reobtain access to your encrypted files in case of password loss" ) ); ?></em>
|
<em><?php p( $l->t( "Enabling this option will allow you to reobtain access to your encrypted files in case of password loss" ) ); ?></em>
|
||||||
<br />
|
<br />
|
||||||
|
@ -60,8 +61,6 @@
|
||||||
value='0'
|
value='0'
|
||||||
<?php echo ( $_["recoveryEnabledForUser"] === false ? 'checked="checked"' : '' ); ?> />
|
<?php echo ( $_["recoveryEnabledForUser"] === false ? 'checked="checked"' : '' ); ?> />
|
||||||
<label for="userDisableRecovery"><?php p( $l->t( "Disabled" ) ); ?></label>
|
<label for="userDisableRecovery"><?php p( $l->t( "Disabled" ) ); ?></label>
|
||||||
<div id="recoveryEnabledSuccess"><?php p( $l->t( 'File recovery settings updated' ) ); ?></div>
|
|
||||||
<div id="recoveryEnabledError"><?php p( $l->t( 'Could not update file recovery' ) ); ?></div>
|
|
||||||
</p>
|
</p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -198,7 +198,7 @@ var OC={
|
||||||
linkTo:function(app,file){
|
linkTo:function(app,file){
|
||||||
return OC.filePath(app,'',file);
|
return OC.filePath(app,'',file);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a relative url for remote use
|
* Creates a relative url for remote use
|
||||||
* @param {string} service id
|
* @param {string} service id
|
||||||
|
@ -300,7 +300,7 @@ var OC={
|
||||||
}
|
}
|
||||||
return link;
|
return link;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redirect to the target URL, can also be used for downloads.
|
* Redirect to the target URL, can also be used for downloads.
|
||||||
* @param {string} targetURL URL to redirect to
|
* @param {string} targetURL URL to redirect to
|
||||||
|
@ -308,10 +308,10 @@ var OC={
|
||||||
redirect: function(targetURL) {
|
redirect: function(targetURL) {
|
||||||
window.location = targetURL;
|
window.location = targetURL;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the absolute path to an image file
|
* get the absolute path to an image file
|
||||||
* if no extension is given for the image, it will automatically decide
|
* if no extension is given for the image, it will automatically decide
|
||||||
* between .png and .svg based on what the browser supports
|
* between .png and .svg based on what the browser supports
|
||||||
* @param {string} app the app id to which the image belongs
|
* @param {string} app the app id to which the image belongs
|
||||||
* @param {string} file the name of the image file
|
* @param {string} file the name of the image file
|
||||||
|
@ -323,9 +323,9 @@ var OC={
|
||||||
}
|
}
|
||||||
return OC.filePath(app,'img',file);
|
return OC.filePath(app,'img',file);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a script for the server and load it. If the script is already loaded,
|
* Load a script for the server and load it. If the script is already loaded,
|
||||||
* the event handler will be called directly
|
* the event handler will be called directly
|
||||||
* @param {string} app the app id to which the script belongs
|
* @param {string} app the app id to which the script belongs
|
||||||
* @param {string} script the filename of the script
|
* @param {string} script the filename of the script
|
||||||
|
@ -364,21 +364,21 @@ var OC={
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo Write the documentation
|
* @todo Write the documentation
|
||||||
*/
|
*/
|
||||||
basename: function(path) {
|
basename: function(path) {
|
||||||
return path.replace(/\\/g,'/').replace( /.*\//, '' );
|
return path.replace(/\\/g,'/').replace( /.*\//, '' );
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo Write the documentation
|
* @todo Write the documentation
|
||||||
*/
|
*/
|
||||||
dirname: function(path) {
|
dirname: function(path) {
|
||||||
return path.replace(/\\/g,'/').replace(/\/[^\/]*$/, '');
|
return path.replace(/\\/g,'/').replace(/\/[^\/]*$/, '');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do a search query and display the results
|
* Do a search query and display the results
|
||||||
* @param {string} query the search query
|
* @param {string} query the search query
|
||||||
|
@ -393,7 +393,7 @@ var OC={
|
||||||
}
|
}
|
||||||
}, 500),
|
}, 500),
|
||||||
dialogs:OCdialogs,
|
dialogs:OCdialogs,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a URL query string into a JS map
|
* Parses a URL query string into a JS map
|
||||||
* @param {string} queryString query string in the format param1=1234¶m2=abcde¶m3=xyz
|
* @param {string} queryString query string in the format param1=1234¶m2=abcde¶m3=xyz
|
||||||
|
@ -604,7 +604,7 @@ OC.msg={
|
||||||
startSaving:function(selector){
|
startSaving:function(selector){
|
||||||
OC.msg.startAction(selector, t('core', 'Saving...'));
|
OC.msg.startAction(selector, t('core', 'Saving...'));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param selector
|
* @param selector
|
||||||
* @param data
|
* @param data
|
||||||
|
@ -613,7 +613,7 @@ OC.msg={
|
||||||
finishedSaving:function(selector, data){
|
finishedSaving:function(selector, data){
|
||||||
OC.msg.finishedAction(selector, data);
|
OC.msg.finishedAction(selector, data);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param selector
|
* @param selector
|
||||||
* @param {string} message Message to display
|
* @param {string} message Message to display
|
||||||
|
@ -627,7 +627,7 @@ OC.msg={
|
||||||
.stop(true, true)
|
.stop(true, true)
|
||||||
.show();
|
.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param selector
|
* @param selector
|
||||||
* @param data
|
* @param data
|
||||||
|
@ -636,12 +636,17 @@ OC.msg={
|
||||||
finishedAction:function(selector, data){
|
finishedAction:function(selector, data){
|
||||||
if( data.status === "success" ){
|
if( data.status === "success" ){
|
||||||
$(selector).html( data.data.message )
|
$(selector).html( data.data.message )
|
||||||
.addClass('success')
|
.addClass('success')
|
||||||
.stop(true, true)
|
.removeClass('error')
|
||||||
.delay(3000)
|
.stop(true, true)
|
||||||
.fadeOut(900);
|
.delay(3000)
|
||||||
|
.fadeOut(900)
|
||||||
|
.show();
|
||||||
}else{
|
}else{
|
||||||
$(selector).html( data.data.message ).addClass('error');
|
$(selector).html( data.data.message )
|
||||||
|
.addClass('error')
|
||||||
|
.removeClass('success')
|
||||||
|
.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -652,7 +657,7 @@ OC.msg={
|
||||||
OC.Notification={
|
OC.Notification={
|
||||||
queuedNotifications: [],
|
queuedNotifications: [],
|
||||||
getDefaultNotificationFunction: null,
|
getDefaultNotificationFunction: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param callback
|
* @param callback
|
||||||
* @todo Write documentation
|
* @todo Write documentation
|
||||||
|
@ -660,7 +665,7 @@ OC.Notification={
|
||||||
setDefault: function(callback) {
|
setDefault: function(callback) {
|
||||||
OC.Notification.getDefaultNotificationFunction = callback;
|
OC.Notification.getDefaultNotificationFunction = callback;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hides a notification
|
* Hides a notification
|
||||||
* @param callback
|
* @param callback
|
||||||
|
@ -683,7 +688,7 @@ OC.Notification={
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows a notification as HTML without being sanitized before.
|
* Shows a notification as HTML without being sanitized before.
|
||||||
* If you pass unsanitized user input this may lead to a XSS vulnerability.
|
* If you pass unsanitized user input this may lead to a XSS vulnerability.
|
||||||
|
@ -699,7 +704,7 @@ OC.Notification={
|
||||||
OC.Notification.queuedNotifications.push(html);
|
OC.Notification.queuedNotifications.push(html);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows a sanitized notification
|
* Shows a sanitized notification
|
||||||
* @param {string} text Message to display
|
* @param {string} text Message to display
|
||||||
|
@ -713,9 +718,9 @@ OC.Notification={
|
||||||
OC.Notification.queuedNotifications.push($('<div/>').text(text).html());
|
OC.Notification.queuedNotifications.push($('<div/>').text(text).html());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether a notification is hidden.
|
* Returns whether a notification is hidden.
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
isHidden: function() {
|
isHidden: function() {
|
||||||
|
@ -779,7 +784,7 @@ OC.Breadcrumb={
|
||||||
this._push(container, leafname, leaflink);
|
this._push(container, leafname, leaflink);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo Write documentation
|
* @todo Write documentation
|
||||||
* @param {string} name
|
* @param {string} name
|
||||||
|
@ -809,7 +814,7 @@ OC.Breadcrumb={
|
||||||
}
|
}
|
||||||
return crumb;
|
return crumb;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo Write documentation
|
* @todo Write documentation
|
||||||
*/
|
*/
|
||||||
|
@ -820,7 +825,7 @@ OC.Breadcrumb={
|
||||||
this.container.find('div.crumb').last().remove();
|
this.container.find('div.crumb').last().remove();
|
||||||
this.container.find('div.crumb').last().addClass('last');
|
this.container.find('div.crumb').last().addClass('last');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo Write documentation
|
* @todo Write documentation
|
||||||
*/
|
*/
|
||||||
|
@ -841,7 +846,7 @@ if(typeof localStorage !=='undefined' && localStorage !== null){
|
||||||
*/
|
*/
|
||||||
OC.localStorage={
|
OC.localStorage={
|
||||||
namespace:'oc_'+OC.currentUser+'_'+OC.webroot+'_',
|
namespace:'oc_'+OC.currentUser+'_'+OC.webroot+'_',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the storage contains items
|
* Whether the storage contains items
|
||||||
* @param {string} name
|
* @param {string} name
|
||||||
|
@ -850,7 +855,7 @@ if(typeof localStorage !=='undefined' && localStorage !== null){
|
||||||
hasItem:function(name){
|
hasItem:function(name){
|
||||||
return OC.localStorage.getItem(name)!==null;
|
return OC.localStorage.getItem(name)!==null;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an item to the storage
|
* Add an item to the storage
|
||||||
* @param {string} name
|
* @param {string} name
|
||||||
|
@ -859,7 +864,7 @@ if(typeof localStorage !=='undefined' && localStorage !== null){
|
||||||
setItem:function(name,item){
|
setItem:function(name,item){
|
||||||
return localStorage.setItem(OC.localStorage.namespace+name,JSON.stringify(item));
|
return localStorage.setItem(OC.localStorage.namespace+name,JSON.stringify(item));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes an item from the storage
|
* Removes an item from the storage
|
||||||
* @param {string} name
|
* @param {string} name
|
||||||
|
@ -868,7 +873,7 @@ if(typeof localStorage !=='undefined' && localStorage !== null){
|
||||||
removeItem:function(name,item){
|
removeItem:function(name,item){
|
||||||
return localStorage.removeItem(OC.localStorage.namespace+name);
|
return localStorage.removeItem(OC.localStorage.namespace+name);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an item from the storage
|
* Get an item from the storage
|
||||||
* @param {string} name
|
* @param {string} name
|
||||||
|
@ -1248,7 +1253,7 @@ function formatDate(timestamp){
|
||||||
return OC.Util.formatDate(timestamp);
|
return OC.Util.formatDate(timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
/**
|
/**
|
||||||
* Get the value of a URL parameter
|
* Get the value of a URL parameter
|
||||||
* @link http://stackoverflow.com/questions/1403888/get-url-parameter-with-jquery
|
* @link http://stackoverflow.com/questions/1403888/get-url-parameter-with-jquery
|
||||||
|
|
Loading…
Reference in New Issue