1
0
mirror of https://github.com/misterunknown/ifm.git synced 2025-08-10 10:04:01 +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 // output files and common attrs
define( "IFM_CDN", true ); 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_RELEASE_DIR", "dist/");
define( "IFM_STANDALONE", "ifm.php" ); define( "IFM_STANDALONE", "ifm.php" );
define( "IFM_STANDALONE_GZ", "ifm.min.php" ); define( "IFM_STANDALONE_GZ", "ifm.min.php" );

View File

@@ -129,7 +129,7 @@ function IFM(params) {
} }
item.rowclasses = "isDir"; item.rowclasses = "isDir";
} else { } else {
if( self.config.download && self.config.zipnload ) { if( self.config.download ) {
item.download.action = "download"; item.download.action = "download";
item.download.icon = "icon icon-download"; item.download.icon = "icon icon-download";
} }
@@ -484,7 +484,7 @@ function IFM(params) {
// $(ihatethisfuckingpopoverworkaround.tip).find( '.popover-body' ).empty(); // $(ihatethisfuckingpopoverworkaround.tip).find( '.popover-body' ).empty();
var aceSession = self.editor.getSession(); var aceSession = self.editor.getSession();
var content = self.getNodesFromString( var content = self.getNodeFromString(
Mustache.render( Mustache.render(
self.templates.file_editoroptions, self.templates.file_editoroptions,
{ {
@@ -499,28 +499,32 @@ function IFM(params) {
} }
) )
); );
content.forEach( function( el ) { if( el = content.querySelector("#editor-wordwrap" )) {
if( el.id == "editor-wordwrap" ) el.addEventListener( 'change', function( e ) {
el.addEventListener( 'change', function( e ) { aceSession.setOption( 'wrap', e.srcElement.checked );
self.editor.setOption( 'wrap', e.srcElement.checked ); });
}); }
else if( el.id == "editor-softtabs" ) if( el = content.querySelector("#editor-softtabs" ))
el.addEventListener( 'change', function( e ) { el.addEventListener( 'change', function( e ) {
self.editor.setOption( 'useSoftTabs', e.srcElement.checked ); aceSession.setOption( 'useSoftTabs', e.srcElement.checked );
}); });
else if( el.lastChild && el.lastChild.id == "editor-tabsize" ) if( el = content.querySelector("#editor-tabsize" )) {
el.lastChild.addEventListener( 'keydown', function( e ) { console.log("Found tabSize");
if( e.key == 'Enter' ) { el.addEventListener( 'keydown', function( e ) {
e.preventDefault(); console.log("Got keydown");
self.editor.setOption( 'tabSize', e.srcElement.value ); console.log("Set tabsize to "+e.srcElement.value);
} if( e.key == 'Enter' ) {
}); console.log("Saw ENTER key");
else if( el.id == "editor-syntax" ) e.preventDefault();
el.addEventListener( 'change', function( e ) { aceSession.setOption( 'tabSize', e.srcElement.value );
self.editor.getSession().setMode( e.target.value ); }
}); });
}); }
return $(content); 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() { private function getConfig() {
$ret = $this->config; $ret = $this->config;
$ret['inline'] = ( $this->mode == "inline" ) ? true : false; $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) { foreach (array("auth_source", "root_dir") as $field) {
unset($ret[$field]); unset($ret[$field]);
} }
@@ -1233,13 +1234,12 @@ IFM_ASSETS
} }
// combines two parts to a valid path // combines two parts to a valid path
private function pathCombine( $a, $b ) { private function pathCombine(...$parts) {
if( trim( $a ) == "" && trim( $b ) == "" ) $ret = "";
return ""; foreach($parts as $part)
elseif( trim( $a ) == "" ) if (trim($part) != "")
return ltrim( $b, '/' ); $ret .= (empty($ret)?rtrim($part,"/"):trim($part, '/'))."/";
else return rtrim($ret, "/");
return rtrim( $a, '/' ) . '/' . trim( $b, '/' );
} }
// check if filename is allowed // check if filename is allowed

View File

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

View File

@@ -21,27 +21,27 @@
<ul class="navbar-nav"> <ul class="navbar-nav">
{{#config.showrefresh}} {{#config.showrefresh}}
<li class="nav-item"> <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> </li>
{{/config.showrefresh}} {{/config.showrefresh}}
{{#config.search}} {{#config.search}}
<li class="nav-item"> <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> </li>
{{/config.search}} {{/config.search}}
{{#config.upload}} {{#config.upload}}
<li class="nav-item"> <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> </li>
{{/config.upload}} {{/config.upload}}
{{#config.createfile}} {{#config.createfile}}
<li class="nav-item"> <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> </li>
{{/config.createfile}} {{/config.createfile}}
{{#config.createdir}} {{#config.createdir}}
<li class="nav-item"> <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> </li>
{{/config.createdir}} {{/config.createdir}}
<li class="nav-item dropdown"> <li class="nav-item dropdown">
@@ -82,13 +82,13 @@
<th class="th-size">{{i18n.size}}</th> <th class="th-size">{{i18n.size}}</th>
{{/config.showfilesize}} {{/config.showfilesize}}
{{#config.showpermissions}} {{#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.showpermissions}}
{{#config.showowner}} {{#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.showowner}}
{{#config.showgroup}} {{#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}} {{/config.showgroup}}
<th class="th-buttons buttons"></th> <th class="th-buttons buttons"></th>
</tr> </tr>
@@ -105,4 +105,4 @@
</div> </div>
</div> </div>
</div> </div>
</main> </main>

View File

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

View File

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