#new>ul>li>p { cursor:pointer; }
#new>ul>li>form>input { padding:0.3em; margin:-0.3em; }
-#trash { height:17px; margin: 0 1em; z-index:1010; float: right; }
+#trash { margin: 0 1em; z-index:1010; float: right; }
#upload {
height:27px; padding:0; margin-left:0.2em; overflow:hidden;
$publicUploadEnabled = 'no';
}
+ $trashEnabled = \OCP\App::isEnabled('files_trashbin');
+ $trashEmpty = true;
+ if ($trashEnabled) {
+ $trashEmpty = \OCA\Files_Trashbin\Trashbin::isEmpty($user);
+ }
+
OCP\Util::addscript('files', 'fileactions');
OCP\Util::addscript('files', 'files');
OCP\Util::addscript('files', 'keyboardshortcuts');
$tmpl->assign('isCreatable', \OC\Files\Filesystem::isCreatable($dir . '/'));
$tmpl->assign('permissions', $permissions);
$tmpl->assign('files', $files);
- $tmpl->assign('trash', \OCP\App::isEnabled('files_trashbin'));
+ $tmpl->assign('trash', $trashEnabled);
+ $tmpl->assign('trashEmpty', $trashEmpty);
$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize);
$tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize));
$tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true)));
files.removeClass('selected');
});
procesSelection();
+ checkTrashStatus();
} else {
$.each(files,function(index,file) {
var deleteAction = $('tr').filterAttr('data-file',file).children("td.date").children(".move2trash");
});
// Show trash bin
- $('#trash a').live('click', function() {
+ $('#trash').on('click', function() {
window.location=OC.filePath('files_trashbin', '', 'index.php');
});
-
+
var lastChecked;
// Sets the file link behaviour :
}
return name;
}
+
+function checkTrashStatus() {
+ $.post(OC.filePath('files_trashbin', 'ajax', 'isEmpty.php'), function(result){
+ if (result.data.isEmpty === false) {
+ $("input[type=button][id=trash]").removeAttr("disabled");
+ }
+ });
+}
\ No newline at end of file
</form>
</div>
<?php if ($_['trash'] ): ?>
- <div id="trash" class="button">
- <a><?php p($l->t('Deleted files'));?></a>
- </div>
+ <input id="trash" type="button" value="<?php p($l->t('Deleted Files'));?>" class="button" <?php $_['trashEmpty'] ? p('disabled') : '' ?>></input>
<?php endif; ?>
<div id="uploadprogresswrapper">
<div id="uploadprogressbar"></div>
//Listen to delete user signal
\OCP\Util::connectHook('OC_User', 'pre_deleteUser', "OCA\Files_Trashbin\Hooks", "deleteUser_hook");
}
+
+ /**
+ * @brief check if trash bin is empty for a given user
+ * @param string $user
+ */
+ public static function isEmpty($user) {
+
+ $trashSize = self::getTrashbinSize($user);
+
+ if ($trashSize !== false && $trashSize > 0) {
+ return false;
+ }
+
+ return true;
+ }
}