1
0
mirror of https://github.com/misterunknown/ifm.git synced 2025-08-09 09:36:29 +02:00

12 июн 2020 г. 3:11:40 merge original project modifications

This commit is contained in:
Anton Baranov
2020-06-12 03:11:40 +03:00
parent 49f2bd176d
commit b0a9a34da8
8 changed files with 125 additions and 78 deletions

View File

@@ -10,7 +10,7 @@ chdir( realpath( dirname( __FILE__ ) ) );
// output files and common attrs
define( "IFM_CDN", true );
define( "IFM_VERSION", "<a href='https://github.com/cryol/ifm/tree/2.6.1' target=_blank>v2.6.1</a>" );
define( "IFM_VERSION", "<a href='https://github.com/misterunknown/ifm/tree/cryol-2.6.1' target=_blank>v2.6.1</a>" );
define( "IFM_RELEASE_DIR", "dist/");
define( "IFM_STANDALONE", "ifm.php" );
define( "IFM_STANDALONE_GZ", "ifm.min.php" );

View File

@@ -129,7 +129,7 @@ function IFM(params) {
}
item.rowclasses = "isDir";
} else {
if( self.config.download && self.config.zipnload ) {
if( self.config.download ) {
item.download.action = "download";
item.download.icon = "icon icon-download";
}
@@ -484,7 +484,7 @@ function IFM(params) {
// $(ihatethisfuckingpopoverworkaround.tip).find( '.popover-body' ).empty();
var aceSession = self.editor.getSession();
var content = self.getNodesFromString(
var content = self.getNodeFromString(
Mustache.render(
self.templates.file_editoroptions,
{
@@ -499,28 +499,32 @@ function IFM(params) {
}
)
);
content.forEach( function( el ) {
if( el.id == "editor-wordwrap" )
el.addEventListener( 'change', function( e ) {
self.editor.setOption( 'wrap', e.srcElement.checked );
});
else if( el.id == "editor-softtabs" )
el.addEventListener( 'change', function( e ) {
self.editor.setOption( 'useSoftTabs', e.srcElement.checked );
});
else if( el.lastChild && el.lastChild.id == "editor-tabsize" )
el.lastChild.addEventListener( 'keydown', function( e ) {
if( e.key == 'Enter' ) {
e.preventDefault();
self.editor.setOption( 'tabSize', e.srcElement.value );
}
});
else if( el.id == "editor-syntax" )
el.addEventListener( 'change', function( e ) {
self.editor.getSession().setMode( e.target.value );
});
});
return $(content);
if( el = content.querySelector("#editor-wordwrap" )) {
el.addEventListener( 'change', function( e ) {
aceSession.setOption( 'wrap', e.srcElement.checked );
});
}
if( el = content.querySelector("#editor-softtabs" ))
el.addEventListener( 'change', function( e ) {
aceSession.setOption( 'useSoftTabs', e.srcElement.checked );
});
if( el = content.querySelector("#editor-tabsize" )) {
console.log("Found tabSize");
el.addEventListener( 'keydown', function( e ) {
console.log("Got keydown");
console.log("Set tabsize to "+e.srcElement.value);
if( e.key == 'Enter' ) {
console.log("Saw ENTER key");
e.preventDefault();
aceSession.setOption( 'tabSize', e.srcElement.value );
}
});
}
if( el = content.querySelector("#editor-syntax" ))
el.addEventListener( 'change', function( e ) {
aceSession.getSession().setMode( e.target.value );
});
return content;
}
});

File diff suppressed because one or more lines are too long

View File

@@ -396,7 +396,8 @@ IFM_ASSETS
private function getConfig() {
$ret = $this->config;
$ret['inline'] = ( $this->mode == "inline" ) ? true : false;
$ret['isDocroot'] = ( $this->getRootDir() == $this->getScriptRoot() ) ? true : false;
$ret['isDocroot'] = ($this->getRootDir() == $this->getScriptRoot());
foreach (array("auth_source", "root_dir") as $field) {
unset($ret[$field]);
}
@@ -1233,13 +1234,12 @@ IFM_ASSETS
}
// combines two parts to a valid path
private function pathCombine( $a, $b ) {
if( trim( $a ) == "" && trim( $b ) == "" )
return "";
elseif( trim( $a ) == "" )
return ltrim( $b, '/' );
else
return rtrim( $a, '/' ) . '/' . trim( $b, '/' );
private function pathCombine(...$parts) {
$ret = "";
foreach($parts as $part)
if (trim($part) != "")
$ret .= (empty($ret)?rtrim($part,"/"):trim($part, '/'))."/";
return rtrim($ret, "/");
}
// check if filename is allowed

View File

@@ -2,10 +2,47 @@ body {
padding-top: 70px;
overflow-y: scroll !important;
}
a { cursor: pointer !important; }
a.ifmitem:focus { outline: 0 }
img.imgpreview { max-width: 100%; }
div#content { width: 100%; height: 350px; } /* is for the ACE editor */
label {
display: inline-block;
margin-bottom: .5rem;
font-weight: 700;
}
/* Make tables more compact (overwrites bootstrap default of 0.75rem) */
.table td, .table th {
padding: 0.25rem;
}
/* narrow navbar */
.navbar {
padding: 0.3rem;
}
/*
* Icon size
*/
.icon {
font-size: 14pt;
}
@media (max-width: 768px) {
.icon { font-size: 12pt; }
#filetable tr th.buttons { min-width: 85px !important; }
}
/*
* Filetable related settings
*/
#filetable th {
border-top: 0;
}
#filetable td:nth-child(5), #filetable th:nth-child(5) {
text-align: center;
}
@@ -18,15 +55,12 @@ body {
#filetable td:last-child a:hover {
text-decoration: none;
}
.td-permissions { width: 1px; }
a { cursor: pointer !important; }
a.ifmitem:focus { outline: 0 }
img.imgpreview { max-width: 100%; }
div#content { width: 100%; height: 350px; }
input[name=newpermissions] { padding: 6px 8px; }
input[name=newpermissions] {
padding: 6px 8px;
width: 6.5rem;
}
#filetable tr th.buttons { min-width: 95px; }
#filetable tbody tr.highlightedItem { box-shadow: 0px 0px 10px 2px #337ab7; }
@@ -35,16 +69,12 @@ input[name=newpermissions] { padding: 6px 8px; }
#filetable tbody tr.selectedItem * a { color: #FFF; }
#filetable tbody tr td { vertical-align: inherit; }
#navbar { max-width: 100%; }
div.ifminfo { color: #adadad; font-size: 10pt; }
div.ifminfo div.panel div.panel-body { padding: 0px !important; text-align: center; }
@media (max-width: 768px) {
.icon { font-size: 12pt; }
#filetable tr th.buttons { min-width: 85px !important; }
}
/*
* Footer / Task-Queue settings
*/
footer {
position: fixed;
padding-top: 1em;
@@ -53,11 +83,11 @@ footer {
bottom: 0;
width: 100%;
max-height: 6em;
overflow:hidden;
overflow: hidden;
}
#waitqueue .progress {
position:relative;
position: relative;
margin-bottom: 0;
}
#waitqueue .progbarlabel {
@@ -67,6 +97,9 @@ footer {
font-weight: bold;
}
/*
* File drop overlay
*/
#filedropoverlay {
display: none;
position: fixed;
@@ -92,28 +125,40 @@ footer {
pointer-events: none;
}
.td-permissions { width: 1px; }
/* datatables */
/*
* Datatables related settings
*/
table.dataTable thead th {
position: relative;
background-image: none !important;
}
/* remove original sort icons */
table.dataTable thead .sorting:before,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_desc:before,
table.dataTable thead .sorting_asc_disabled:before,
table.dataTable thead .sorting_desc_disabled:before {
right: 0 !important;
content: "" !important;
}
/* custom sort icons */
table.dataTable thead th.sorting:after,
table.dataTable thead th.sorting_asc:after,
table.dataTable thead th.sorting_desc:after {
position: absolute;
top: 12px;
top: 6px;
right: 8px;
display: block;
font-family: fontello;
font-size: 0.8em;
opacity: 1;
color: #000;
}
table.dataTable thead th.sorting:after {
content: "\F0DC";
font-size: 0.8em;
padding-top: 0.12em;
color: #ddd;
}
table.dataTable thead th.sorting_asc:after {
content: "\f0de";
@@ -122,6 +167,9 @@ table.dataTable thead th.sorting_desc:after {
content: "\f0dd";
}
/*
* Modal related settings
*/
#copyMoveTree {
max-height: 80vh;
overflow: auto;
@@ -139,9 +187,3 @@ table.dataTable thead th.sorting_desc:after {
max-width: 800px;
}
}
label {
display: inline-block;
margin-bottom: .5rem;
font-weight: 700;
}

View File

@@ -21,27 +21,27 @@
<ul class="navbar-nav">
{{#config.showrefresh}}
<li class="nav-item">
<a id="refresh" class="nav-link"><span title="{{i18n.refresh}}" class="icon icon-arrows-cw" href="#"></span> <span class="d-block d-sm-none">{{i18n.refresh}}</span></a>
<a id="refresh" class="nav-link"><span title="{{i18n.refresh}}" class="icon icon-arrows-cw" href="#"></span> <span class="d-inline d-sm-none">{{i18n.refresh}}</span></a>
</li>
{{/config.showrefresh}}
{{#config.search}}
<li class="nav-item">
<a id="search" class="nav-link"><span title="{{i18n.search}}" class="icon icon-search" href="#"></span> <span class="d-block d-sm-none">{{i18n.search}}</span></a>
<a id="search" class="nav-link"><span title="{{i18n.search}}" class="icon icon-search" href="#"></span> <span class="d-inline d-sm-none">{{i18n.search}}</span></a>
</li>
{{/config.search}}
{{#config.upload}}
<li class="nav-item">
<a id="upload" class="nav-link"><span title="{{i18n.upload}}" class="icon icon-upload" href="#"></span> <span class="d-block d-sm-none">{{i18n.upload}}</span></a>
<a id="upload" class="nav-link"><span title="{{i18n.upload}}" class="icon icon-upload" href="#"></span> <span class="d-inline d-sm-none">{{i18n.upload}}</span></a>
</li>
{{/config.upload}}
{{#config.createfile}}
<li class="nav-item">
<a id="createFile" class="nav-link"><span title="{{i18n.file_new}}" class="icon icon-doc-inv" href="#"></span> <span class="d-block d-sm-none">{{i18n.file_new}}</span></a>
<a id="createFile" class="nav-link"><span title="{{i18n.file_new}}" class="icon icon-doc-inv" href="#"></span> <span class="d-inline d-sm-none">{{i18n.file_new}}</span></a>
</li>
{{/config.createfile}}
{{#config.createdir}}
<li class="nav-item">
<a id="createDir" class="nav-link"><span title="{{i18n.folder_new}}" class="icon icon-folder" href="#"></span> <span class="d-block d-sm-none">{{i18n.folder_new}}</span></a>
<a id="createDir" class="nav-link"><span title="{{i18n.folder_new}}" class="icon icon-folder" href="#"></span> <span class="d-inline d-sm-none">{{i18n.folder_new}}</span></a>
</li>
{{/config.createdir}}
<li class="nav-item dropdown">
@@ -82,13 +82,13 @@
<th class="th-size">{{i18n.size}}</th>
{{/config.showfilesize}}
{{#config.showpermissions}}
<th class="th-permissions d-none d-sm-block">{{i18n.permissions}}</th>
<th class="th-permissions d-none d-md-table-cell">{{i18n.permissions}}</th>
{{/config.showpermissions}}
{{#config.showowner}}
<th class="th-owner d-none d-md-block">{{i18n.owner}}</th>
<th class="th-owner d-none d-lg-table-cell">{{i18n.owner}}</th>
{{/config.showowner}}
{{#config.showgroup}}
<th class="th-group d-none d-lg-block">{{i18n.group}}</th>
<th class="th-group d-none d-xl-table-cell">{{i18n.group}}</th>
{{/config.showgroup}}
<th class="th-buttons buttons"></th>
</tr>
@@ -105,4 +105,4 @@
</div>
</div>
</div>
</main>
</main>

View File

@@ -24,17 +24,17 @@
<td data-order="{{size_raw}}">{{size}}</td>
{{/config.showfilesize}}
{{#config.showpermissions}}
<td class="d-xs-none td-permissions">
<td class="d-none d-md-table-cell">
<input type="text" size="11" name="newpermissions" class="form-control {{filepermmode}}" value="{{fileperms}}" data-filename="{{name}}" {{readonly}}>
</td>
{{/config.showpermissions}}
{{#config.showowner}}
<td class="d-xs-none d-sm-none">
<td class="d-none d-lg-table-cell">
{{owner}}
</td>
{{/config.showowner}}
{{#config.showgroup}}
<td class="d-xs-none d-sm-none d-md-none">
<td class="d-none d-xl-table-cell">
{{group}}
</td>
{{/config.showgroup}}

View File

@@ -1,3 +1,4 @@
<div>
<div class="form-check p-0">
<input type="checkbox" id="editor-wordwrap"
{{#wordwrap}}
@@ -23,3 +24,4 @@
{{/modes}}
</select>
{{/ace_includes}}
</div>