Fixed duplication of open files when reloading, Added goto function, Started new Market functions, Fixed file Icons

This commit is contained in:
xevidos 2019-10-19 16:32:23 -04:00
parent 5af37cbce3
commit c8c971b509
7 changed files with 69 additions and 12 deletions

View File

@ -115,6 +115,16 @@ class Active extends Common {
public function Add() { public function Add() {
global $sql; global $sql;
<<<<<<< HEAD
$query = "SELECT focused FROM active WHERE path=? AND user=? LIMIT 1;";
$bind_variables = array( $this->path, $_SESSION["user_id"] );
$result = $sql->query( $query, $bind_variables, array() );
if( count( $result ) == 0 ) {
=======
$query = "UPDATE active SET focused=false WHERE user=? AND path=?;"; $query = "UPDATE active SET focused=false WHERE user=? AND path=?;";
$bind_variables = array( $_SESSION["user_id"], $this->path ); $bind_variables = array( $_SESSION["user_id"], $this->path );
$result = $sql->query( $query, $bind_variables, 0, "rowCount" ); $result = $sql->query( $query, $bind_variables, 0, "rowCount" );
@ -122,6 +132,7 @@ class Active extends Common {
if( $result == 0 ) { if( $result == 0 ) {
global $sql; global $sql;
>>>>>>> 5af37cbce3326f97b4d3ff7eb50e88feb1fc8063
$query = "INSERT INTO active( user, path, focused ) VALUES ( ?, ?, ? );"; $query = "INSERT INTO active( user, path, focused ) VALUES ( ?, ?, ? );";
$bind_variables = array( $_SESSION["user_id"], $this->path, false ); $bind_variables = array( $_SESSION["user_id"], $this->path, false );
$result = $sql->query( $query, $bind_variables, 0, "rowCount" ); $result = $sql->query( $query, $bind_variables, 0, "rowCount" );
@ -175,8 +186,8 @@ class Active extends Common {
public function MarkFileAsFocused() { public function MarkFileAsFocused() {
global $sql; global $sql;
$query = "UPDATE active SET focused=? WHERE user=?;UPDATE active SET focused=? WHERE path=? AND user=?;"; $query = "UPDATE active SET focused=? WHERE path=? AND user=?;";
$bind_variables = array( false, $_SESSION["user_id"], true, $this->path, $_SESSION["user_id"] ); $bind_variables = array( true, $this->path, $_SESSION["user_id"] );
$return = $sql->query( $query, $bind_variables, 0, "rowCount" ); $return = $sql->query( $query, $bind_variables, 0, "rowCount" );
if( $return > 0 ) { if( $return > 0 ) {

View File

@ -362,6 +362,9 @@
session.listThumb = listThumb; session.listThumb = listThumb;
$( '#list-active-files' ).append( listThumb ); $( '#list-active-files' ).append( listThumb );
/* If the tab list would overflow with the new tab. Move the /* If the tab list would overflow with the new tab. Move the
* first tab to dropdown, then add a new tab. */ * first tab to dropdown, then add a new tab. */
if( this.isTabListOverflowed( true ) ) { if( this.isTabListOverflowed( true ) ) {
@ -375,7 +378,10 @@
this.updateTabDropdownVisibility(); this.updateTabDropdownVisibility();
$.get( this.controller + '?action=add&path=' + encodeURIComponent( path ) ); $.get( this.controller + '?action=add&path=' + encodeURIComponent( path ), function( data ) {
//console.log( data );
});
if( focus ) { if( focus ) {
this.focus( path ); this.focus( path );

View File

@ -23,7 +23,11 @@ checkSession();
?> ?>
<label><?php i18n("Goto Line:"); ?></label> <label><?php i18n("Goto Line:"); ?></label>
<<<<<<< HEAD
<input name="goto_line" type="number" autofocus="autofocus" autocomplete="off">
=======
<input name="goto_line" autofocus="autofocus" autocomplete="off"> <input name="goto_line" autofocus="autofocus" autocomplete="off">
>>>>>>> 5af37cbce3326f97b4d3ff7eb50e88feb1fc8063
<button class="btn-left" onclick="codiad.editor.goto_line();return false;"><?php i18n("Goto"); ?></button> <button class="btn-left" onclick="codiad.editor.goto_line();return false;"><?php i18n("Goto"); ?></button>
<button class="btn-right" onclick="codiad.modal.unload(); return false;"><?php i18n("Cancel"); ?></button> <button class="btn-right" onclick="codiad.modal.unload(); return false;"><?php i18n("Cancel"); ?></button>
<?php <?php

View File

@ -1329,6 +1329,28 @@
i.commands.addCommand( m ); i.commands.addCommand( m );
}); });
<<<<<<< HEAD
},
open_goto: function() {
if( this.getActive() ) {
codiad.modal.load( 400, 'components/editor/dialog.php?action=line' );
codiad.modal.hideOverlay();
} else {
codiad.message.error( 'No Open Files' );
}
},
goto_line: function() {
let line = $( '#modal input[name="goto_line"]' ).val();
this.gotoLine( line );
codiad.modal.unload();
=======
>>>>>>> 5af37cbce3326f97b4d3ff7eb50e88feb1fc8063
}, },
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////

View File

@ -520,7 +520,7 @@
if( files[index].type == 'file' ) { if( files[index].type == 'file' ) {
let ext = ' ext-' + name.split( '.' ).pop(); ext = 'ext-' + name.split( '.' ).pop();
} else { } else {
link.droppable({ link.droppable({
@ -544,7 +544,8 @@
span.addClass( nodeClass ); span.addClass( nodeClass );
link.addClass( files[index].type + ext ); link.addClass( files[index].type );
link.addClass( ext );
link.attr( "data-type", files[index].type ); link.attr( "data-type", files[index].type );
link.attr( "data-path", files[index].name ); link.attr( "data-path", files[index].name );
link.text( name ); link.text( name );
@ -569,8 +570,6 @@
node.removeClass( 'loading' ); node.removeClass( 'loading' );
console.log( "rescanChildren", _this.rescanChildren )
if( rescan && _this.rescanChildren.length > _this.rescanCounter ) { if( rescan && _this.rescanChildren.length > _this.rescanCounter ) {
_this.rescan( _this.rescanChildren[_this.rescanCounter++] ); _this.rescan( _this.rescanChildren[_this.rescanCounter++] );
@ -691,7 +690,6 @@
let path = drag_path; let path = drag_path;
let newPath = `${drop_path}/` + path.split( "/" ).pop(); let newPath = `${drop_path}/` + path.split( "/" ).pop();
console.log( path, newPath );
_this.rename( path, newPath ); _this.rename( path, newPath );
}, },
@ -968,11 +966,9 @@
parent.pop(); parent.pop();
newParent.pop(); newParent.pop();
console.log( parent.join( '/' ) );
console.log( newParent.join( '/' ) );
codiad.filemanager.rescan( parent.join( '/' ) ); codiad.filemanager.rescan( parent.join( '/' ) );
codiad.filemanager.rescan( newParent.join( '/' ) ); codiad.filemanager.rescan( newParent.join( '/' ) );
/* Notify listeners. */ /* Notify listeners. */
amplify.publish( 'filemanager.onRename', { amplify.publish( 'filemanager.onRename', {
path: path, path: path,
@ -1071,7 +1067,6 @@
}; };
$.post( this.controller + '?action=modify&path=' + encodeURIComponent( path ), post, function( resp ) { $.post( this.controller + '?action=modify&path=' + encodeURIComponent( path ), post, function( resp ) {
console.log( resp );
resp = $.parseJSON( resp ); resp = $.parseJSON( resp );
if( resp.status == 'success' ) { if( resp.status == 'success' ) {
if( messages === true ) { if( messages === true ) {

View File

@ -52,6 +52,20 @@
} }
}, },
{ {
<<<<<<< HEAD
name: 'Goto Line',
bindKey: {
win: 'Ctrl-L',
mac: 'Command-L'
},
exec: function( e ) {
codiad.editor.open_goto();
}
},
{
=======
>>>>>>> 5af37cbce3326f97b4d3ff7eb50e88feb1fc8063
name: 'Move Down', name: 'Move Down',
bindKey: { bindKey: {
win: 'Ctrl-down', win: 'Ctrl-down',

View File

@ -18,8 +18,13 @@
controller: 'components/market/controller.php', controller: 'components/market/controller.php',
dialog: 'components/market/dialog.php', dialog: 'components/market/dialog.php',
plugins: [],
themes: [],
init: function() {}, init: function() {},
get_all: function() {},
get_installed_plugins: function() {}, get_installed_plugins: function() {},
get_installed_themes: function() {}, get_installed_themes: function() {},