'New' button, needs some css work
This commit is contained in:
parent
122fa190c6
commit
d46288b0ab
|
@ -32,12 +32,12 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#35537a', end
|
||||||
|
|
||||||
/* INPUTS */
|
/* INPUTS */
|
||||||
input[type="text"], input[type="password"] { cursor:text; }
|
input[type="text"], input[type="password"] { cursor:text; }
|
||||||
input, select, .button, #quota, div.jp-progress, .pager li a { font-size:1em; width:10em; margin:.3em; padding:.6em .5em .4em; background:#fff; color:#333; border:1px solid #ddd; -moz-box-shadow:0 1px 1px #fff, 0 2px 0 #bbb inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; outline:none; }
|
input, select, button, .button, #quota, div.jp-progress, .pager li a { font-size:1em; width:10em; margin:.3em; padding:.6em .5em .4em; background:#fff; color:#333; border:1px solid #ddd; -moz-box-shadow:0 1px 1px #fff, 0 2px 0 #bbb inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; box-shadow:0 1px 1px #fff, 0 1px 0 #bbb inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; outline:none; }
|
||||||
input[type="text"], input[type="password"], input[type="search"] { background:#f8f8f8; color:#555; cursor:text; }
|
input[type="text"], input[type="password"], input[type="search"] { background:#f8f8f8; color:#555; cursor:text; }
|
||||||
input[type="text"], input[type="password"], input[type="search"] { -webkit-appearance:textfield; -webkit-box-sizing:content-box; }
|
input[type="text"], input[type="password"], input[type="search"] { -webkit-appearance:textfield; -webkit-box-sizing:content-box; }
|
||||||
input[type="text"]:hover, input[type="text"]:focus, input[type="password"]:hover, input[type="password"]:focus, input[type="search"]:hover, input[type="search"]:focus { background:#fff; color:#333; }
|
input[type="text"]:hover, input[type="text"]:focus, input[type="password"]:hover, input[type="password"]:focus, input[type="search"]:hover, input[type="search"]:focus { background:#fff; color:#333; }
|
||||||
|
|
||||||
input[type="submit"], input[type="button"], .button, #quota, div.jp-progress, .pager li a { width:auto; padding:.4em; border:1px solid #ddd; font-weight:bold; cursor:pointer; background:#f8f8f8; color:#555; text-shadow:#fff 0 1px 0; -moz-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; }
|
input[type="submit"], input[type="button"], button, .button, #quota, div.jp-progress, .pager li a { width:auto; padding:.4em; border:1px solid #ddd; font-weight:bold; cursor:pointer; background:#f8f8f8; color:#555; text-shadow:#fff 0 1px 0; -moz-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -webkit-box-shadow:0 1px 1px #fff, 0 1px 1px #fff inset; -moz-border-radius:.5em; -webkit-border-radius:.5em; border-radius:.5em; }
|
||||||
input[type="submit"]:hover, input[type="submit"]:focus, input[type="button"]:hover, input[type="button"]:focus, .button:hover { background:#fff; color:#333; }
|
input[type="submit"]:hover, input[type="submit"]:focus, input[type="button"]:hover, input[type="button"]:focus, .button:hover { background:#fff; color:#333; }
|
||||||
input[type="checkbox"] { width:auto; }
|
input[type="checkbox"] { width:auto; }
|
||||||
#quota { cursor:default; }
|
#quota { cursor:default; }
|
||||||
|
|
|
@ -365,7 +365,7 @@ $(document).ready(function(){
|
||||||
$('.jp-controls .jp-previous').tipsy({gravity:'nw', fade:true, live:true});
|
$('.jp-controls .jp-previous').tipsy({gravity:'nw', fade:true, live:true});
|
||||||
$('.jp-controls .jp-next').tipsy({gravity:'n', fade:true, live:true});
|
$('.jp-controls .jp-next').tipsy({gravity:'n', fade:true, live:true});
|
||||||
$('.password .action').tipsy({gravity:'se', fade:true, live:true});
|
$('.password .action').tipsy({gravity:'se', fade:true, live:true});
|
||||||
$('.file_upload_button_wrapper').tipsy({gravity:'e', fade:true});
|
$('.file_upload_button_wrapper').tipsy({gravity:'w', fade:true});
|
||||||
$('.selectedActions a.delete').tipsy({gravity: 'se', fade:true, live:true});
|
$('.selectedActions a.delete').tipsy({gravity: 'se', fade:true, live:true});
|
||||||
$('.selectedActions a').tipsy({gravity:'s', fade:true, live:true});
|
$('.selectedActions a').tipsy({gravity:'s', fade:true, live:true});
|
||||||
$('#headerSize').tipsy({gravity:'s', fade:true, live:true});
|
$('#headerSize').tipsy({gravity:'s', fade:true, live:true});
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Init owncloud
|
||||||
|
require_once('../../lib/base.php');
|
||||||
|
|
||||||
|
OC_JSON::checkLoggedIn();
|
||||||
|
|
||||||
|
// Get the params
|
||||||
|
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
|
||||||
|
$filename = isset( $_GET['filename'] ) ? $_GET['filename'] : '';
|
||||||
|
$content = isset( $_GET['content'] ) ? $_GET['content'] : '';
|
||||||
|
|
||||||
|
if($filename == '') {
|
||||||
|
OC_JSON::error(array("data" => array( "message" => "Empty Filename" )));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(OC_Files::newFile($dir, $filename, 'file')) {
|
||||||
|
if($content){
|
||||||
|
OC_Filesystem::file_put_contents($dir.'/'.$filename,$content);
|
||||||
|
}
|
||||||
|
OC_JSON::success(array("data" => array('content'=>$content)));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
OC_JSON::error(array("data" => array( "message" => "Error when creating the file" )));
|
|
@ -7,11 +7,17 @@
|
||||||
.actions input { margin:0; }
|
.actions input { margin:0; }
|
||||||
#file_menu { right:0; position:absolute; top:0; }
|
#file_menu { right:0; position:absolute; top:0; }
|
||||||
#file_menu a { display:block; float:left; background-image:none; text-decoration:none; }
|
#file_menu a { display:block; float:left; background-image:none; text-decoration:none; }
|
||||||
.file_upload_form, #file_newfolder_form { display:inline; float: left; margin-left:.5em; }
|
.file_upload_form, #file_newfolder_form { display:inline; float: left; margin-left:0; }
|
||||||
#fileSelector, #file_upload_submit, #file_newfolder_submit { display:none; }
|
#fileSelector, #file_upload_submit, #file_newfolder_submit { display:none; }
|
||||||
.file_upload_wrapper, #file_newfolder_name { background-repeat:no-repeat; background-position:.5em .5em; padding-left:2em; }
|
.file_upload_wrapper, #file_newfolder_name { background-repeat:no-repeat; background-position:.5em .5em; padding-left:2em; }
|
||||||
.file_upload_wrapper { font-weight:bold; display:-moz-inline-box; /* fallback for older firefox versions*/ display:inline-block; padding-left:0; overflow:hidden; position:relative; margin:.1em .1em .1em 0em;}
|
.file_upload_wrapper { font-weight:bold; display:-moz-inline-box; /* fallback for older firefox versions*/ display:inline-block; padding-left:0; overflow:hidden; position:relative; margin:0;}
|
||||||
.file_upload_wrapper .file_upload_button_wrapper { position:absolute; top:0; left:0; width:100%; height:100%; cursor:pointer; z-index:1000; }
|
.file_upload_wrapper .file_upload_button_wrapper { position:absolute; top:0; left:0; width:100%; height:100%; cursor:pointer; z-index:1000; }
|
||||||
|
#new { float:left; border-top-right-radius:0; border-bottom-right-radius:0; margin-top:-0.075em; margin-right:0; border-right:none }
|
||||||
|
#new.active { border-bottom-left-radius:0; border-bottom:none; }
|
||||||
|
#new>a{ padding-left:1em; padding-right:1em; }
|
||||||
|
#new>ul { display:none; position:fixed; text-align:left; padding:0.5em; background:#f8f8f8; margin-top:0.4em; border:1px solid #ddd; min-width:7em; margin-left:-0.5em; }
|
||||||
|
#new>ul>li { margin:0.3em; padding-left:1.3em; background-repeat:no-repeat; cursor:pointer; }
|
||||||
|
#new>ul>li>p { cursor:pointer; }
|
||||||
|
|
||||||
#file_newfolder_name { background-image:url('../../core/img/places/folder.svg'); font-weight:normal; width:7em; }
|
#file_newfolder_name { background-image:url('../../core/img/places/folder.svg'); font-weight:normal; width:7em; }
|
||||||
.file_upload_start, .file_upload_filename { font-size:1em; }
|
.file_upload_start, .file_upload_filename { font-size:1em; }
|
||||||
|
@ -19,7 +25,8 @@
|
||||||
.file_upload_target { display:none; }
|
.file_upload_target { display:none; }
|
||||||
|
|
||||||
.file_upload_start { opacity:0; filter:alpha(opacity=0); z-index:1; position:absolute; left:0; top:0; width:100%; cursor:pointer;}
|
.file_upload_start { opacity:0; filter:alpha(opacity=0); z-index:1; position:absolute; left:0; top:0; width:100%; cursor:pointer;}
|
||||||
.file_upload_filename { z-index:100; cursor:pointer;}
|
input.file_upload_filename.active { border-bottom-right-radius:0 }
|
||||||
|
input.file_upload_filename { z-index:100; cursor:pointer; border-top-left-radius:0; border-bottom-left-radius:0; }
|
||||||
|
|
||||||
.file_upload_form, .file_upload_wrapper, .file_upload_start, .file_upload_filename, #file_upload_submit { cursor:pointer; }
|
.file_upload_form, .file_upload_wrapper, .file_upload_start, .file_upload_filename, #file_upload_submit { cursor:pointer; }
|
||||||
|
|
||||||
|
|
|
@ -255,32 +255,77 @@ $(document).ready(function() {
|
||||||
text=text.substr(0,text.length-6)+'...';
|
text=text.substr(0,text.length-6)+'...';
|
||||||
crumb.text(text);
|
crumb.text(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(window).click(function(){
|
||||||
|
$('#new>ul').hide();
|
||||||
|
$('#new').removeClass('active');
|
||||||
|
$('input.file_upload_filename').removeClass('active');
|
||||||
|
$('#new li').each(function(i,element){
|
||||||
|
if($(element).children('p').length==0){
|
||||||
|
$(element).children('input').remove();
|
||||||
|
$(element).append('<p>'+$(element).data('text')+'</p>');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$('#new').click(function(event){
|
||||||
|
event.stopPropagation();
|
||||||
|
});
|
||||||
|
$('#new>a').click(function(){
|
||||||
|
$('#new>ul').toggle();
|
||||||
|
$('#new').toggleClass('active');
|
||||||
|
$('input.file_upload_filename').toggleClass('active');
|
||||||
|
});
|
||||||
|
$('#new li').click(function(){
|
||||||
|
if($(this).children('p').length==0){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#new li').each(function(i,element){
|
||||||
|
if($(element).children('p').length==0){
|
||||||
|
$(element).children('input').remove();
|
||||||
|
$(element).append('<p>'+$(element).data('text')+'</p>');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var type=$(this).data('type');
|
||||||
|
var text=$(this).children('p').text();
|
||||||
|
$(this).data('text',text);
|
||||||
|
$(this).children('p').remove();
|
||||||
|
var input=$('<input>');
|
||||||
|
$(this).append(input);
|
||||||
|
input.focus();
|
||||||
|
input.change(function(){
|
||||||
|
var name=$(this).val();
|
||||||
|
switch(type){
|
||||||
|
case 'file':
|
||||||
|
$.ajax({
|
||||||
|
url: OC.filePath('files','ajax','newfile.php'),
|
||||||
|
data: "dir="+encodeURIComponent($('#dir').val())+"&filename="+encodeURIComponent(name)+'&content=%20%0A',
|
||||||
|
complete: function(data){boolOperationFinished(data, function(){
|
||||||
|
var date=new Date();
|
||||||
|
FileList.addFile(name,0,date);
|
||||||
|
});}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 'folder':
|
||||||
|
$.ajax({
|
||||||
|
url: OC.filePath('files','ajax','newfolder.php'),
|
||||||
|
data: "dir="+encodeURIComponent($('#dir').val())+"&foldername="+encodeURIComponent(name),
|
||||||
|
complete: function(data){boolOperationFinished(data, function(){
|
||||||
|
var date=new Date();
|
||||||
|
FileList.addDir(name,0,date);
|
||||||
|
});}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
var li=$(this).parent();
|
||||||
|
$(this).remove();
|
||||||
|
li.append('<p>'+li.data('text')+'</p>');
|
||||||
|
$('#new>a').click();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var adjustNewFolderSize = function() {
|
|
||||||
if($('#file_newfolder_name').val() != '') {
|
|
||||||
splitSize($('#file_newfolder_name'),$('#file_newfolder_submit'));
|
|
||||||
$('#file_newfolder_name').unbind('keyup', adjustNewFolderSize);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function splitSize(existingEl, appearingEl) {
|
|
||||||
nw = parseInt($(existingEl).css('width')) - parseInt($(appearingEl).css('width'));
|
|
||||||
$(existingEl).css('width', nw + 'px');
|
|
||||||
$(appearingEl).fadeIn(250);
|
|
||||||
}
|
|
||||||
|
|
||||||
function unsplitSize(stayingEl, vanishingEl) {
|
|
||||||
nw = parseInt($(stayingEl).css('width')) + parseInt($(vanishingEl).css('width'));
|
|
||||||
$(stayingEl).css('width', nw + 'px');
|
|
||||||
$(vanishingEl).fadeOut(250);
|
|
||||||
}
|
|
||||||
|
|
||||||
function resetFileActionPanel() {
|
|
||||||
$('#file_action_panel form').css({"display":"none"});
|
|
||||||
$('#file_action_panel').attr('activeAction', false);
|
|
||||||
}
|
|
||||||
|
|
||||||
function boolOperationFinished(data, callback) {
|
function boolOperationFinished(data, callback) {
|
||||||
result = jQuery.parseJSON(data.responseText);
|
result = jQuery.parseJSON(data.responseText);
|
||||||
if(result.status == 'success'){
|
if(result.status == 'success'){
|
||||||
|
|
|
@ -2,20 +2,27 @@
|
||||||
<?php echo($_['breadcrumb']); ?>
|
<?php echo($_['breadcrumb']); ?>
|
||||||
<?php if (!isset($_['readonly']) || !$_['readonly']) {?>
|
<?php if (!isset($_['readonly']) || !$_['readonly']) {?>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<form data-upload-id='1' class="file_upload_form" action="ajax/upload.php" method="post" enctype="multipart/form-data" target="file_upload_target_1">
|
<button id='new'>
|
||||||
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_['uploadMaxFilesize'] ?>" id="max_upload">
|
<a>
|
||||||
<input type="hidden" class="max_human_file_size" value="(max <?php echo $_['uploadMaxHumanFilesize']; ?>)">
|
<?php echo $l->t('New');?>
|
||||||
<input type="hidden" name="dir" value="<?php echo $_['dir'] ?>" id="dir">
|
</a>
|
||||||
<div class="file_upload_wrapper svg">
|
<ul class="popup popupTop">
|
||||||
<input type="submit" class="file_upload_filename" value="<?php echo $l->t('Upload'); ?>"/>
|
<li style="background:url('<?php echo mimetype_icon('text/plain') ?>')" data-type='file'><p><?php echo $l->t('File');?></p></li>
|
||||||
|
<li style="background:url('<?php echo mimetype_icon('dir') ?>')" data-type='folder'><p><?php echo $l->t('Folder');?></p></li>
|
||||||
|
<!-- <li style="background:url('<?php echo mimetype_icon('dir') ?>')" data-type='web'><p><?php echo $l->t('From the web');?></p></li> -->
|
||||||
|
</ul>
|
||||||
|
</button>
|
||||||
|
<div class="file_upload_wrapper svg">
|
||||||
|
<form data-upload-id='1' class="file_upload_form" action="ajax/upload.php" method="post" enctype="multipart/form-data" target="file_upload_target_1">
|
||||||
|
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_['uploadMaxFilesize'] ?>" id="max_upload">
|
||||||
|
<input type="hidden" class="max_human_file_size" value="(max <?php echo $_['uploadMaxHumanFilesize']; ?>)">
|
||||||
|
<input type="hidden" name="dir" value="<?php echo $_['dir'] ?>" id="dir">
|
||||||
|
<input type="submit" class="file_upload_filename" value="^"/>
|
||||||
<input class="file_upload_start" type="file" name='files[]'/>
|
<input class="file_upload_start" type="file" name='files[]'/>
|
||||||
<a href="#" class="file_upload_button_wrapper" onclick="return false;" title="<?php echo 'max. '.$_['uploadMaxHumanFilesize'] ?>"></a>
|
<a href="#" class="file_upload_button_wrapper" onclick="return false;" title="Upload. <?php echo 'max. '.$_['uploadMaxHumanFilesize'] ?>"></a>
|
||||||
</div>
|
<iframe name="file_upload_target_1" class='file_upload_target' src=""></iframe>
|
||||||
<iframe name="file_upload_target_1" class='file_upload_target' src=""></iframe>
|
</form>
|
||||||
</form>
|
</div>
|
||||||
<form id="file_newfolder_form">
|
|
||||||
<input class="svg" type="text" name="file_newfolder_name" id="file_newfolder_name" value="" placeholder="<?php echo $l->t('New Folder')?>" />
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
<div id="file_action_panel">
|
<div id="file_action_panel">
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue