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