setName('files:object:put') ->setDescription('Write a file to the object store') ->addArgument('input', InputArgument::REQUIRED, 'Source local path, use - to read from STDIN') ->addArgument('object', InputArgument::REQUIRED, 'Object to write') ->addOption('bucket', 'b', InputOption::VALUE_REQUIRED, "Bucket where to store the object, only required in cases where it can't be determined from the config"); ; } public function execute(InputInterface $input, OutputInterface $output): int { $object = $input->getArgument('object'); $inputName = (string)$input->getArgument('input'); $objectStore = $this->objectUtils->getObjectStore($input->getOption('bucket'), $output); if (!$objectStore) { return -1; } if ($fileId = $this->objectUtils->objectExistsInDb($object)) { $output->writeln("Warning, object $object belongs to an existing file, overwriting the object contents can lead to unexpected behavior."); $output->writeln("You can use occ files:put $inputName $fileId to write to the file safely."); $output->writeln(''); /** @var QuestionHelper $helper */ $helper = $this->getHelper('question'); $question = new ConfirmationQuestion('Write to the object anyway? [y/N] ', false); if (!$helper->ask($input, $output, $question)) { return -1; } } $source = $inputName === '-' ? STDIN : fopen($inputName, 'r'); if (!$source) { $output->writeln("Failed to open $inputName"); return self::FAILURE; } $objectStore->writeObject($object, $source, $this->mimeTypeDetector->detectPath($inputName)); return self::SUCCESS; } } ions The official jQuery user interface library: https://github.com/jquery/jquery-uiwww-data
aboutsummaryrefslogtreecommitdiffstats
path: root/demos/droppable/revert.html
blob: eed45c56c0123bb28ff9395f1cca7942c4597aa2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!doctype html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>jQuery UI Droppable - Revert draggable position</title>
	<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
	<script src="../../jquery-1.8.3.js"></script>
	<script src="../../ui/jquery.ui.core.js"></script>
	<script src="../../ui/jquery.ui.widget.js"></script>
	<script src="../../ui/jquery.ui.mouse.js"></script>
	<script src="../../ui/jquery.ui.draggable.js"></script>
	<script src="../../ui/jquery.ui.droppable.js"></script>
	<link rel="stylesheet" href="../demos.css">
	<style>
	#draggable, #draggable2 { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 10px 10px 10px 0; }
	#droppable { width: 150px; height: 150px; padding: 0.5em; float: left; margin: 10px; }
	</style>
	<script>
	$(function() {
		$( "#draggable" ).draggable({ revert: "valid" });
		$( "#draggable2" ).draggable({ revert: "invalid" });

		$( "#droppable" ).droppable({
			activeClass: "ui-state-hover",
			hoverClass: "ui-state-active",
			drop: function( event, ui ) {
				$( this )
					.addClass( "ui-state-highlight" )
					.find( "p" )
						.html( "Dropped!" );
			}
		});
	});
	</script>
</head>
<body>

<div id="draggable" class="ui-widget-content">
	<p>I revert when I'm dropped</p>
</div>

<div id="draggable2" class="ui-widget-content">
	<p>I revert when I'm not dropped</p>
</div>

<div id="droppable" class="ui-widget-header">
	<p>Drop me here</p>
</div>

<div class="demo-description">
<p>Return the draggable (or it's helper) to its original location when dragging stops with the boolean <code>revert</code> option set on the draggable.</p>
</div>
</body>
</html>