From 3bae8c29fe7e4a0baf0cebc0396ae02ccecb6dd5 Mon Sep 17 00:00:00 2001 From: xevidos Date: Fri, 21 Dec 2018 11:43:51 -0500 Subject: [PATCH 1/2] Added initial mobile touchpunch, Added a loading gif for when saving settings, fixed issue where password dialog would not close when saving password, Removed settings no longer used, Fixed sidebar setting not being loaded, added a double click of sidebar to reset default position, --- components/install/process.php | 3 +- components/settings/dialog.php | 12 +- components/settings/init.js | 4 +- components/settings/settings.system.php | 24 --- components/user/class.user.php | 3 +- index.php | 1 + js/jquery.ui.touch-punch.min.js | 11 + js/modal.js | 265 +++++++++++++----------- js/sidebars.js | 49 +++-- themes/default/screen.css | 9 + 10 files changed, 211 insertions(+), 170 deletions(-) create mode 100755 js/jquery.ui.touch-punch.min.js diff --git a/components/install/process.php b/components/install/process.php index 2043e0b..615a18d 100755 --- a/components/install/process.php +++ b/components/install/process.php @@ -305,6 +305,7 @@ ALTER TABLE `user_options` + /** * Create sessions path. */ @@ -318,7 +319,7 @@ ALTER TABLE `user_options` // Create Active file ////////////////////////////////////////////////////////////////// - saveJSON($active, array('')); + saveJSON( $active, array( '' ) ); ////////////////////////////////////////////////////////////////// // Create Config diff --git a/components/settings/dialog.php b/components/settings/dialog.php index c0645e8..089d99a 100755 --- a/components/settings/dialog.php +++ b/components/settings/dialog.php @@ -20,7 +20,7 @@ switch($_GET['action']) { case "settings": -?> + ?>
@@ -74,6 +74,7 @@
+
- + ?> -' ); //Load Settings - //this.load(); + this.load(); }, get_option: async function( option ) { @@ -80,7 +80,7 @@ load: function() { - amplify.publish( 'settings.loaded', null ); + amplify.publish( 'settings.loaded', {} ); codiad.editor.getSettings(); }, diff --git a/components/settings/settings.system.php b/components/settings/settings.system.php index 052870b..3553182 100755 --- a/components/settings/settings.system.php +++ b/components/settings/settings.system.php @@ -53,28 +53,4 @@ - - - - - - - - - - - - - - - - - - diff --git a/components/user/class.user.php b/components/user/class.user.php index 971cc96..ae1560f 100755 --- a/components/user/class.user.php +++ b/components/user/class.user.php @@ -318,9 +318,10 @@ class User { if( sql::check_sql_error( $return ) ) { + echo formatJSEND( "success", null ); } else { - echo formatJSEND( "success", null ); + echo( $return ); } } diff --git a/index.php b/index.php index 3daea4c..9062ae5 100755 --- a/index.php +++ b/index.php @@ -101,6 +101,7 @@ if( defined( "SITE_NAME" ) && ! ( SITE_NAME === "" || SITE_NAME === null ) ) { + diff --git a/js/jquery.ui.touch-punch.min.js b/js/jquery.ui.touch-punch.min.js new file mode 100755 index 0000000..e0b85c0 --- /dev/null +++ b/js/jquery.ui.touch-punch.min.js @@ -0,0 +1,11 @@ +/*! + * jQuery UI Touch Punch 0.2.3 + * + * Copyright 2011–2014, Dave Furfero + * Dual licensed under the MIT or GPL Version 2 licenses. + * + * Depends: + * jquery.ui.widget.js + * jquery.ui.mouse.js + */ +!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery); \ No newline at end of file diff --git a/js/modal.js b/js/modal.js index 6caead4..243725e 100755 --- a/js/modal.js +++ b/js/modal.js @@ -1,120 +1,149 @@ (function(global, $){ - var codiad = global.codiad; - - ////////////////////////////////////////////////////////////////////// - // Modal - ////////////////////////////////////////////////////////////////////// - - codiad.modal = { - - load: function(width, url, data) { - data = data || {}; - var bounds = this._getBounds(width); - $('#modal') - .css({ - 'top': bounds.top, - 'left': bounds.left, - 'min-width': width + 'px', - 'margin-left': '-' + Math.ceil(width / 2) + 'px' - }) - .draggable({ - handle: '#drag-handle' - }); - $('#modal-content') - .html(''); - this.load_process = $.get(url, data, function(data) { - $('#modal-content').html(data); - // Fix for Firefox autofocus goofiness - $('input[autofocus="autofocus"]') - .focus(); - }); - var event = {animationPerformed: false}; - amplify.publish('modal.onLoad', event); - // If no plugin has provided a custom load animation - if(!event.animationPerformed) { - $('#modal, #modal-overlay') - .fadeIn(200); - } - codiad.sidebars.modalLock = true; - }, - - hideOverlay: function() { - $('#modal-overlay') - .hide(); - }, - - unload: function() { - this._setBounds(); - $('#modal-content form') - .die('submit'); // Prevent form bubbling - var event = { animationPerformed : false }; - amplify.publish('modal.onUnload', event); - // If no plugin has provided a custom unload animation - if(!event.animationPerformed) { - $('#modal, #modal-overlay') - .fadeOut(200); - $('#modal-content') - .html(''); - } - codiad.sidebars.modalLock = false; - if (!codiad.sidebars.leftLock) { // Slide sidebar back - $('#sb-left') - .animate({ - 'left': '-290px' - }, 300, 'easeOutQuart'); - $('#editor-region') - .animate({ - 'margin-left': '10px' - }, 300, 'easeOutQuart'); - } - codiad.editor.focus(); - }, - - _setBounds: function(bounds) { - if (typeof(bounds) == 'undefined') { - if ($('#modal').is(':visible')) { - bounds = {}; - bounds.top = Math.floor($('#modal').offset().top); - bounds.left = Math.floor($('#modal').offset().left); - } else { - return false; - } - } - //Save bounds - localStorage.setItem("codiad.modal.top", bounds.top); - localStorage.setItem("codiad.modal.left", bounds.left); - }, - - _getBounds: function(width) { - if (localStorage.getItem("codiad.modal.top") !== null && localStorage.getItem("codiad.modal.left") !== null && codiad.editor.settings.persistentModal) { - var top = parseInt(localStorage.getItem('codiad.modal.top'), 10), - left = parseInt(localStorage.getItem('codiad.modal.left'), 10); - //Check if modal is out of window - if ((top + 40) > $(window).height()) { - top = "15%"; - } else { - top += "px"; - } - if ((left + width + 40) > $(window).width()) { - left = "50%"; - } else { - left += Math.ceil(width / 2); - left += "px"; - } - return { - top: top, - left: left - }; - } else { - return { - top: "15%", - left: "50%" - }; - } - } - - }; - -})(this, jQuery); - + var codiad = global.codiad; + + ////////////////////////////////////////////////////////////////////// + // Modal + ////////////////////////////////////////////////////////////////////// + + codiad.modal = { + + hide_loading: function() { + + let loading = document.getElementById( 'modal' ).getElementsByClassName( 'loading' )[0]; + loading.style.display = "none"; + }, + + hideOverlay: function() { + + $('#modal-overlay') + .hide(); + }, + + load: function( width, url, data ) { + + data = data || {}; + var bounds = this._getBounds( width ); + $('#modal') + .css({ + 'top': bounds.top, + 'left': bounds.left, + 'min-width': width + 'px', + 'margin-left': '-' + Math.ceil( width / 2 ) + 'px' + }) + .draggable({ + handle: '#drag-handle' + }); + $('#modal-content') + .html(''); + this.load_process = $.get( url, data, function( data ) { + $('#modal-content').html( data ); + // Fix for Firefox autofocus goofiness + $('input[autofocus="autofocus"]') + .focus(); + }); + var event = {animationPerformed: false}; + amplify.publish( 'modal.onLoad', event ); + // If no plugin has provided a custom load animation + if( ! event.animationPerformed ) { + + $('#modal, #modal-overlay') + .fadeIn(200); + } + codiad.sidebars.modalLock = true; + }, + + show_loading: function() { + + let loading = document.getElementById( 'modal' ).getElementsByClassName( 'loading' )[0]; + loading.style.display = "inline-block"; + }, + + unload: function() { + + this._setBounds(); + $('#modal-content form') + .die('submit'); // Prevent form bubbling + var event = { animationPerformed : false }; + amplify.publish( 'modal.onUnload', event ); + // If no plugin has provided a custom unload animation + if( ! event.animationPerformed ) { + + $('#modal, #modal-overlay') + .fadeOut( 200 ); + $('#modal-content') + .html( '' ); + } + codiad.sidebars.modalLock = false; + if ( ! codiad.sidebars.leftLock ) { + + // Slide sidebar back + $('#sb-left') + .animate({ + + 'left': '-290px' + }, 300, 'easeOutQuart'); + $('#editor-region') + .animate({ + + 'margin-left': '10px' + }, 300, 'easeOutQuart'); + } + codiad.editor.focus(); + }, + + _setBounds: function( bounds ) { + + if ( typeof( bounds ) == 'undefined' ) { + + if ( $( '#modal' ).is( ':visible' ) ) { + + bounds = {}; + bounds.top = Math.floor( $( '#modal' ).offset().top ); + bounds.left = Math.floor( $( '#modal' ).offset().left ); + } else { + + return false; + } + } + //Save bounds + localStorage.setItem( "codiad.modal.top", bounds.top ); + localStorage.setItem( "codiad.modal.left", bounds.left ); + }, + + _getBounds: function( width ) { + + if (localStorage.getItem( "codiad.modal.top" ) !== null && localStorage.getItem( "codiad.modal.left" ) !== null && codiad.editor.settings.persistentModal ) { + var top = parseInt( localStorage.getItem( 'codiad.modal.top' ), 10 ), + left = parseInt( localStorage.getItem( 'codiad.modal.left' ), 10 ); + //Check if modal is out of window + if ( (top + 40) > $(window).height() ) { + + top = "15%"; + } else { + + top += "px"; + } + if ( ( left + width + 40 ) > $(window).width() ) { + + left = "50%"; + } else { + + left += Math.ceil( width / 2 ); + left += "px"; + } + return { + + top: top, + left: left + }; + } else { + return { + + top: "15%", + left: "50%" + }; + } + } + }; +})( this, jQuery ); diff --git a/js/sidebars.js b/js/sidebars.js index d12fce0..234c7f4 100755 --- a/js/sidebars.js +++ b/js/sidebars.js @@ -15,15 +15,15 @@ isLeftSidebarOpen: true, isRightSidebarOpen: false, - init: function() { + init: async function() { var _this = this; amplify.subscribe('settings.loaded', async function( settings ) { - var sbWidth = codiad.settings.get_option( 'codiad.sidebars.sb-left-width' ); - var lock_left = codiad.settings.get_option( 'codiad.sidebars.lock-left-sidebar' ); - var lock_right = codiad.settings.get_option( 'codiad.sidebars.lock-right-sidebar' ); - + var sbWidth = await codiad.settings.get_option( 'codiad.sidebars.sb-left-width' ); + var lock_left = await codiad.settings.get_option( 'codiad.sidebars.lock-left-sidebar' ); + var lock_right = await codiad.settings.get_option( 'codiad.sidebars.lock-right-sidebar' ); + console.log( "Sidebar width", sbWidth ); if (sbWidth !== null) { $('#sb-left').width(sbWidth); $(window).resize(); @@ -111,20 +111,31 @@ }); $("#sb-left .sidebar-handle") - .draggable({ - axis: 'x', - drag: function(event, ui) { - newWidth = ui.position.left; - $("#sb-left") - .width(newWidth + 10); - }, - stop: function() { - $(window).resize(); - $('#editor-region') - .trigger('h-resize-init'); - codiad.settings.update_option( 'codiad.sidebars.sb-left-width', $('#sb-left').width() ); - } - }); + .draggable({ + axis: 'x', + drag: function(event, ui) { + newWidth = ui.position.left; + $("#sb-left") + .width(newWidth + 10); + }, + stop: function() { + $(window).resize(); + $('#editor-region') + .trigger('h-resize-init'); + codiad.settings.update_option( 'codiad.sidebars.sb-left-width', $('#sb-left').width() ); + } + }); + + $("#sb-left .sidebar-handle") + .dblclick(function() { + + let default_width = 300; + $("#sb-left").width( default_width ); + $(window).resize(); + $('#editor-region').trigger('h-resize-init'); + $("#sb-left .sidebar-handle").css( "left", 288 ); + codiad.settings.update_option( 'codiad.sidebars.sb-left-width', default_width ); + }); }, closeLeftSidebar: function() { diff --git a/themes/default/screen.css b/themes/default/screen.css index d82c8b7..97a8fb0 100755 --- a/themes/default/screen.css +++ b/themes/default/screen.css @@ -809,3 +809,12 @@ table [class^="icon-"], [class*=" icon-"] { #download { display: none; } + +.loading { + + background: url(loading.gif) no-repeat center; + display: none; + height: 25px; + vertical-align: middle; + width: 25px; +} \ No newline at end of file From 359297af7b0fa7b485c444208945e23264c15efb Mon Sep 17 00:00:00 2001 From: xevidos Date: Mon, 7 Jan 2019 17:51:14 -0500 Subject: [PATCH 2/2] Remove file extensions modifier until recode due to issues with module, Switched to Ace\'s module detection system, Added a multi line option for find and replace, Fixed Delete contents button --- README.md | 23 +- components/active/init.js | 10 +- components/editor/dialog.php | 19 +- components/editor/init.js | 198 +++------- .../class.fileextension_textmode.php | 353 ------------------ components/fileext_textmode/controller.php | 15 - components/fileext_textmode/dialog.php | 79 ---- components/fileext_textmode/init.js | 136 ------- components/filemanager/context_menu.json | 8 +- components/settings/dialog.php | 9 - components/update/class.update.php | 2 +- index.php | 2 + 12 files changed, 89 insertions(+), 765 deletions(-) delete mode 100755 components/fileext_textmode/class.fileextension_textmode.php delete mode 100755 components/fileext_textmode/controller.php delete mode 100755 components/fileext_textmode/dialog.php delete mode 100755 components/fileext_textmode/init.js diff --git a/README.md b/README.md index e83aab7..bafcb40 100755 --- a/README.md +++ b/README.md @@ -25,8 +25,8 @@ Current Tasks: Task List: -* Add ability to login with LDAP. -* Add custom market. +* Add ability to login with LDAP +* Add custom market * Add in new admin interface - Group Management - Permissions Management @@ -34,18 +34,19 @@ Task List: - Project Management - System Settings - User Management -* Add if file could not be saved 5 times close the open file. +* Add if file could not be saved 5 times close the open file * Add multi level users. ( Projects for only certain groups, Permission levels ) -* Add mobile compatibility. -* Clean up update script. +* Add mobile compatibility +* Clean up update script +* Re Add the language recognition system after recode Completed: * Add Auto Save. -* Add ability to center bottom of code. -* Add updating script. -* Add site renaming. -* Fix JS errors already showing. -* Remove Codiad autocomplete in favor of Ace's. -* Updated for PHP 7.2. \ No newline at end of file +* Add ability to center bottom of code +* Add updating script +* Add site renaming +* Fix JS errors already showing +* Remove Codiad autocomplete in favor of Ace's +* Updated for PHP 7.2 \ No newline at end of file diff --git a/components/active/init.js b/components/active/init.js index 7e725ab..0c210b1 100755 --- a/components/active/init.js +++ b/components/active/init.js @@ -66,8 +66,8 @@ return; } var ext = codiad.filemanager.getExtension(path); - var mode = codiad.editor.selectMode(ext); - + var mode = codiad.editor.selectMode( path ); + var fn = function() { //var Mode = require('ace/mode/' + mode) // .Mode; @@ -82,7 +82,7 @@ //var session = new EditSession(content, new Mode()); var session = new EditSession(content); - session.setMode("ace/mode/" + mode); + session.setMode(mode.mode); session.setUndoManager(new UndoManager()); session.path = path; @@ -98,7 +98,7 @@ }; // Assuming the mode file has no dependencies - $.loadScript('components/editor/ace-editor/mode-' + mode + '.js', + $.loadScript('components/editor/ace-editor/mode-' + mode.name + '.js', fn); }, @@ -674,7 +674,7 @@ } newSession.on("changeMode", fn); - newSession.setMode("ace/mode/" + mode); + newSession.setMode( mode.mode ); } else { // A folder was renamed var newKey; diff --git a/components/editor/dialog.php b/components/editor/dialog.php index 594360f..d31c198 100755 --- a/components/editor/dialog.php +++ b/components/editor/dialog.php @@ -28,16 +28,18 @@ switch($_GET['action']){ $type = $_GET['type']; ?> - + + - + + - + @@ -52,8 +54,15 @@ switch($_GET['action']){ + +