diff --git a/db_objects/abstract_note.class.php b/db_objects/abstract_note.class.php index bbe3d784..03b03c32 100644 --- a/db_objects/abstract_note.class.php +++ b/db_objects/abstract_note.class.php @@ -76,7 +76,8 @@ protected static function _getFields() 'editable' => false, 'references' => 'person', 'visible' => false, - 'default' => 0, + 'default' => NULL, + 'allow_empty' => TRUE, ), 'edited' => Array( 'type' => 'datetime', diff --git a/include/init.php b/include/init.php index cac70fb5..14ae084d 100644 --- a/include/init.php +++ b/include/init.php @@ -17,14 +17,6 @@ error_reporting($error_level); @ini_set('display_errors', 1); -// If max length is set, set the cookie timeout - this will allow sessions to outlast browser invocations -$expiryTime = defined('SESSION_MAXLENGTH_MINS') ? SESSION_MAXLENGTH_MINS * 60 : NULL; -session_set_cookie_params($expiryTime, parse_url(BASE_URL, PHP_URL_PATH)); - -if (session_id() == '') { - session_name('JethroSession'); - session_start(); -} require_once JETHRO_ROOT.'/include/general.php'; strip_all_slashes(); @@ -56,6 +48,14 @@ Config_Manager::init(); +// If max length is set, set the cookie timeout - this will allow sessions to outlast browser invocations +$expiryTime = defined('SESSION_MAXLENGTH_MINS') ? SESSION_MAXLENGTH_MINS * 60 : NULL; +session_set_cookie_params($expiryTime, parse_url(BASE_URL, PHP_URL_PATH)); +if (session_id() == '') { + session_name('JethroSession'); + session_start(); +} + if (defined('TIMEZONE') && constant('TIMEZONE')) { date_default_timezone_set(constant('TIMEZONE')); $res = $GLOBALS['db']->query('SET time_zone = "'.date('P').'"'); diff --git a/resources/js/jethro.js b/resources/js/jethro.js index ef02417f..40ed98fa 100644 --- a/resources/js/jethro.js +++ b/resources/js/jethro.js @@ -4,7 +4,22 @@ $(document).ready(function() { // Make standalone safari stay standalone if (("standalone" in window.navigator) && window.navigator.standalone) { + // http://www.andymercer.net/blog/2016/02/full-screen-web-apps-on-ios/ + var insideApp = sessionStorage.getItem('insideApp'), location = window.location, stop = /^(a|html)$/i; + if (insideApp) { + localStorage.setItem('returnToPage', location); + } else { + var returnToPage = localStorage.getItem('returnToPage'); + if (returnToPage) { + window.location = returnToPage; + } + sessionStorage.setItem('insideApp', true); + } + + // add a back button $('a.brand').parent().prepend('') + + // stay inside the app, avoid linking out to mobile safari $("a").click(function (event) { if ((!$(this).attr('target')) && (!$(this).attr('data-toggle')) @@ -19,6 +34,9 @@ $(document).ready(function() { } }); } + if (("standalone" in window.navigator) && !window.navigator.standalone) { + // Opportunity to tell them to save to home screen + } // This needs to be first! // https://github.com/twitter/bootstrap/issues/3217 diff --git a/templates/main.template.php b/templates/main.template.php index 48c89812..24ef1af7 100644 --- a/templates/main.template.php +++ b/templates/main.template.php @@ -26,11 +26,11 @@