diff options
| author | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-05-05 04:07:05 +0300 |
|---|---|---|
| committer | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-05-05 04:07:05 +0300 |
| commit | 537673748f0b01539fc5839c2af1bacbefafc86d (patch) | |
| tree | c2032ff9efb06257bbf70f3329524d86bc2cb6e3 /public/app | |
| parent | 63f714d5a78b765c117ebf6bbdfdbd748dd45644 (diff) | |
| download | gyraf1gov-537673748f0b01539fc5839c2af1bacbefafc86d.tar.gz gyraf1gov-537673748f0b01539fc5839c2af1bacbefafc86d.tar.bz2 gyraf1gov-537673748f0b01539fc5839c2af1bacbefafc86d.zip | |
the penalty form (input, new record)
Diffstat (limited to 'public/app')
| -rw-r--r-- | public/app/config/app_constants.php | 43 | ||||
| -rw-r--r-- | public/app/controllers/Auth.php | 19 | ||||
| -rw-r--r-- | public/app/controllers/JsonToForm.php | 4 | ||||
| -rw-r--r-- | public/app/controllers/Office.php | 7 | ||||
| -rw-r--r-- | public/app/views/components/header_includes.php | 20 | ||||
| -rw-r--r-- | public/app/views/templates/course.php | 93 | ||||
| -rw-r--r-- | public/app/views/templates/lesson.php | 82 | ||||
| -rw-r--r-- | public/app/views/templates/page.php | 64 | ||||
| -rw-r--r-- | public/app/views/templates/penalty.php | 227 | ||||
| -rw-r--r-- | public/app/views/user/invitation.php | 166 | ||||
| -rw-r--r-- | public/app/views/user/login.php | 82 |
11 files changed, 380 insertions, 427 deletions
diff --git a/public/app/config/app_constants.php b/public/app/config/app_constants.php index 262a727..3404033 100644 --- a/public/app/config/app_constants.php +++ b/public/app/config/app_constants.php @@ -23,7 +23,7 @@ if (file_exists("../core/auth/.env")) { // WEB-APP name and url // --- -- -- - - - define('SITE_TITLE', 'Classroom'); -define('SITE_URL', 'http://localhost'); +define('SITE_URL', $env['ANOM_HOSTNAME']); // Session and cookie names // --- -- -- - - - @@ -31,6 +31,19 @@ define('SESSION_NAME', 'offticket'); // cookie for session (office ticket) define('CONNECTION_COOKIE', 'con'); // cookie for connection define('MAX_SESSION_LIFE', 2*60*60); // maximum session lifetime (2 hours) +// Cookie Policy +// --- -- -- - - - +# define('COOKIE_DOMAIN', $env['ANOM_HOSTNAME']); // domain to be visible on +define('COOKIE_SECURE', false); // Secure cookie policy [true|false] +define('COOKIE_SAMESITE', 'Strict'); // SameSite cookie policy [Strict|Lax|None] + // recomended values: + // COOKIE_SECURE=true, COOKIE_SAMESITE='Strict' + // --- -- -- - - - + // for more info about cookie policy read: + // https://www.php.net/manual/en/function.session-set-cookie-params.php + + + // email setup // --- -- -- - - - // SMTP @@ -180,7 +193,7 @@ define('REGISTRATION_FORM', [ ], [ 'name' => 'email', - 'label' => 'e-mail', + 'label' => 'Email', 'type' => 'email', 'value' => 'auto', 'attributes' => ['required'] @@ -284,6 +297,11 @@ define('COMMON_REQUEST_FORM', [ ], 'form' => [ [ + 'name' => 'subject', + 'label' => 'Θέμα (χαρακτηριστικός τίτλος για αναφορά)', + 'attributes' => ['required'] + ], + [ 'name' => 'first_name', 'label' => 'Όνομα', 'attributes' => ['auto'] @@ -364,12 +382,21 @@ define('PENALTY_FORM', [ ], 'form' => [ [ + 'name' => 'subject', + 'label' => 'Θέμα (χαρακτηριστικός τίτλος για αναφορά)', + 'attributes' => ['required'] + ], + [ + 'label' => '', + 'type' => 'label' + ], + [ 'label' => 'Πειθαρχική υπόθεση', 'type' => 'label' ], [ 'name' => 'of_article', - 'label' => 'του/της...', + 'label' => 'του/της/των...', 'type' => 'select', 'options' => [ 'του μαθητή', @@ -377,33 +404,33 @@ define('PENALTY_FORM', [ 'των μαθητών', 'των μαθητριών' ], - 'class' => 'col-4', + 'class' => 'col-md-4', 'attributes' => ['required'] ], [ 'name' => 'student_names', 'label' => '(ονοματεπώνυ-μο/μα, πτώση γενική)', 'type' => 'textarea', - 'class' => 'col-8', + 'class' => 'col-md-8', 'attributes' => ['required'] ], [ 'name' => 'of_department', 'label' => 'του τμήματος...', - 'class' => 'col-4', + 'class' => 'col-md-4', 'attributes' => ['required'] ], [ 'name' => 'date', 'label' => 'Ημερομηνία', 'type' => 'date', - 'class' => 'col-4', + 'class' => 'col-md-4', 'attributes' => ['required'] ], [ 'name' => 'time', 'label' => 'Ώρα', - 'class' => 'col-4', + 'class' => 'col-md-4', 'attributes' => ['required'] ], [ diff --git a/public/app/controllers/Auth.php b/public/app/controllers/Auth.php index 118b4d0..f1e9819 100644 --- a/public/app/controllers/Auth.php +++ b/public/app/controllers/Auth.php @@ -62,9 +62,17 @@ class Auth { // set cookie for connected user setcookie( CONNECTION_COOKIE, - 'connected;'. $user->getName(), - time()+60*60*10, // 10 hours - '/' + rawurlencode(json_encode( + [ 'rid' => $record['role_id'], 'name' => $user->getName() ], + JSON_UNESCAPED_UNICODE + )), + [ + 'expires' =>time()+60*60*10, // 10 hours + 'path' => '/', + // 'domain' => COOKIE_DOMAIN, + 'secure' => COOKIE_SECURE, + 'samesite' => COOKIE_SAMESITE + ] ); // login OK, set Token in session @@ -174,7 +182,10 @@ class Auth { ]); - Render::view('user/invitation', ['form' => $form]); + Render::view('user/invitation', [ + 'form' => $form, + 'invitation_number' => $user->invitation + ]); } diff --git a/public/app/controllers/JsonToForm.php b/public/app/controllers/JsonToForm.php index 5df650d..7df8098 100644 --- a/public/app/controllers/JsonToForm.php +++ b/public/app/controllers/JsonToForm.php @@ -219,7 +219,7 @@ class JsonToForm // print_r([ $set_value, $name, ($default_values->$name ?? 'none') ]); $appendKey = in_array('append-key', $attributes) ? true : false; // append key (for selects) - $required = in_array('required', $attributes) ? '' : ''; // required + $required = in_array('required', $attributes) ? 'required' : ''; // required $asterisk = in_array('required', $attributes) ? '*' : ''; // asterisk in label if required $html .= " @@ -239,7 +239,7 @@ class JsonToForm // prepare initialization of select2 (multiple) $initSelectsJS .= " var {$name} = $('#{$name}'); - {$name}.select2({ width: '100%', placeholde: '{$label}' });"; + {$name}.select2({ width: '100%' });"; if ($set_value) { // if default value is set $initSelectsJS .= " diff --git a/public/app/controllers/Office.php b/public/app/controllers/Office.php index cfadde3..44428af 100644 --- a/public/app/controllers/Office.php +++ b/public/app/controllers/Office.php @@ -160,6 +160,11 @@ class Office { } + private static function render_common_petition($opts) + { + + } + private static function render_penalty_form($opts) { $user_id = $opts['user']->getID(); @@ -193,7 +198,7 @@ class Office { // get Form's HTML and Jsvascript $form = JsonToForm::json_form($form_setup, [ - ['name' => 'id', 'value' => $user_id] // pass user identity + ['name' => 'user_id', 'value' => $user_id] // pass user identity ]); Render::view('templates/penalty', ['form' => $form]); diff --git a/public/app/views/components/header_includes.php b/public/app/views/components/header_includes.php index 433cc4e..15685b5 100644 --- a/public/app/views/components/header_includes.php +++ b/public/app/views/components/header_includes.php @@ -4,14 +4,24 @@ } ?> -<!-- fonts (CDN) --> +<!-- FONTS (CDN) --> + +<!-- Roboto slab <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> -<link href="https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@400&display=swap" rel="stylesheet"> +<link href="https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@400&display=swap" rel="stylesheet"> --> + +<!-- Fira Sans --> +<link rel="preconnect" href="https://fonts.googleapis.com"> +<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> +<link href="https://fonts.googleapis.com/css2?family=Fira+Sans:wght@300;400;500&display=swap" rel="stylesheet"> <!-- fontawesome icons (CDN) --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw==" crossorigin="anonymous" referrerpolicy="no-referrer" /> + +<!-- LIBRARY (dependencies) CSS --> + <!-- bootstap (CDN) --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-aFq/bzH65dt+w6FI2ooMVUpc+21e0SRygnTpmBvdBgSdnuTN7QbdgL+OapgHtvPp" crossorigin="anonymous"> @@ -21,6 +31,7 @@ <!-- select2 css --> <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" /> +<!-- CUSTOM CSS --> <!-- main css --> <link href="/assets/css/class.css" rel="stylesheet"> @@ -28,11 +39,11 @@ <!-- overides --> <link href="/assets/css/overides.css" rel="stylesheet"> - - <!-- bootstrap javascript (CDN) --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha2/dist/js/bootstrap.bundle.min.js" integrity="sha384-qKXV1j0HvMUeCBQ+QVp7JcfGl760yU08IQ+GpUo5hlbpg51QRiuqHAJz8+BrxE/N" crossorigin="anonymous"></script> +<!-- JAVASCRIPT --> + <!-- jQuery (CDN) --> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.4/jquery.min.js" integrity="sha512-pumBsjNRGGqkPzKHndZMaAG+bir374sORyzM3uulLV14lN5LyykqNk8eEeUlUkB3U0M4FApyaHraT65ihJhDpQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> @@ -51,7 +62,6 @@ <script src="/assets/js/marked/marked.min.js"></script> - <!-- date handling ... https://stackoverflow.com/questions/27267565/javascript-returning-incorrect-date-from-an-input-type-date diff --git a/public/app/views/templates/course.php b/public/app/views/templates/course.php deleted file mode 100644 index 1d212b8..0000000 --- a/public/app/views/templates/course.php +++ /dev/null @@ -1,93 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - <meta charset="utf-8"> - <title><?=SITE_TITLE?> - <?=$title?></title> - - <?php // header includes - //////////////////////////////////////////////////////////////////////// - Render::view('components/header_includes'); - ?> - -</head> -<body class="classroom"> - - <?php // top-bar - //////////////////////////////////////////////////////////////////////// - Render::view('components/top_bar', [ - 'id' => $id, - 'label' => $breadcrumbs[ $id ]['rec']['label'], - 'parents' => $breadcrumbs[ $id ]['parents'] - ]); - ?> - - -<div class="main-content container"> - <div class="row"> - - <div class="col col-md-5 col-lg-4 d-sm-none d-md-block side-bar"> - - <?php // tree of courses - //////////////////////////////////////////////////////////////////////// - Render::view('components/courses_menu', [ - 'categories' => $categories, - 'open_path' => $course_path - ]); - ?> - - </div> - - <div class="col col-sm-12 col-md-7 col-lg-8 course-view"> - - <!-- Category Title --> - <h3> - <?=$breadcrumbs[ $id ]['rec']['label']?> - </h3> - - - <!-- Sub-Categories --> - <?php - Render::view('components/subcategories',[ - 'id' => $id, - 'breadcrumbs' => $breadcrumbs - ]) - ?> - - - <!-- Articles List --> - <?php if ($lessons) : ?> - - <h5>Μαθήματα</h5> - - <?php // list of posts/articles - //////////////////////////////////////////////////// - Render::view("components/lessons_list", [ - 'lessons' => $lessons, - 'fieldset' => ['intro', 'level'] // ['intro', 'date'] - ]); - ?> - <?php endif; ?> - - - - - </div> - - </div> - </div> - - <footer> - <div class="container"> - - <?php // render footer - //////////////////////////////////////////////////////////////// - Render::view('components/footer', [ 'entity' => $entity ]); - ?> - - </div> - </footer> - - - <script src="/assets/js/classroom.js"></script> -</body> -</html> diff --git a/public/app/views/templates/lesson.php b/public/app/views/templates/lesson.php deleted file mode 100644 index 0867cd3..0000000 --- a/public/app/views/templates/lesson.php +++ /dev/null @@ -1,82 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - <meta charset="utf-8"> - <title><?=SITE_TITLE?> - <?=$title?></title> - - <?php // header includes - //////////////////////////////////////////////////////////////////////// - Render::view('components/header_includes'); - ?> - -</head> -<body class="classroom"> - - <?php // top-bar - //////////////////////////////////////////////////////////////////////// - Render::view('components/top_bar', [ - 'id' => $id, - 'label' => $breadcrumbs[ $course_id ]['rec']['label'], - 'parents' => $breadcrumbs[ $course_id ]['parents'] - ]); - ?> - - -<div class="main-content container"> - <div class="row"> - - <div class="col col-md-5 col-lg-4 d-sm-none d-md-block side-bar"> - - <?php // tree of courses - //////////////////////////////////////////////////////////////////////// - Render::view('components/courses_menu', [ - 'categories' => $categories, - 'open_path' => $course_path - ]); - ?> - - </div> - - <div class="col col-sm-12 col-md-7 col-lg-8 lesson-view"> - - <!-- Lesson Title --> - <h3> - <?=$title?> - </h3> - - <!-- intro --> - <?php if ($lesson['intro'] != "") : ?> - <p class="intro"><?=$lesson['intro']?></p> - <?php endif; ?> - - <!-- body --> - <div class="article-body"> - <?php - - $parsedown = new Parsedown(); - echo $parsedown->text($lesson['body']); - - ?> - </div> - - - </div> - - </div> - </div> - - <footer> - <div class="container"> - - <?php // render footer - //////////////////////////////////////////////////////////////// - Render::view('components/footer', [ 'entity' => $entity ]); - ?> - - </div> - </footer> - - <script src="/assets/js/classroom.js"></script> - <script src="/assets/js/lesson-features.js"></script> -</body> -</html> diff --git a/public/app/views/templates/page.php b/public/app/views/templates/page.php deleted file mode 100644 index 6afe45e..0000000 --- a/public/app/views/templates/page.php +++ /dev/null @@ -1,64 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - <meta charset="utf-8"> - <title><?=SITE_TITLE?> - <?=$page['title']?></title> - - <?php // header includes - //////////////////////////////////////////////////////////////////////// - Render::view('components/header_includes'); - ?> - -</head> -<body class="classroom"> - - <?php // top-bar - //////////////////////////////////////////////////////////////////////// - Render::view('components/top_bar', [ - 'id' => 0, - 'label' => '', - 'parents' => [] - ]); - ?> - - - <div class="main-content container page-container"> - - - <div class="lesson-view"> - - <!-- page Title --> - <h3> - <?=$page['title']?> - </h3> - - <!-- page body --> - <div class="article-body"> - <?php - - $parsedown = new Parsedown(); - echo $parsedown->text($page['body']); - - ?> - </div> - - - </div> - - </div> - - <footer> - <div class="container"> - - <?php // render footer - //////////////////////////////////////////////////////////////// - Render::view('components/footer', [ 'entity' => $entity ]); - ?> - - </div> - </footer> - - <script src="/assets/js/classroom.js"></script> - <script src="/assets/js/lesson-features.js"></script> -</body> -</html> diff --git a/public/app/views/templates/penalty.php b/public/app/views/templates/penalty.php index bbd7b4a..17e5426 100644 --- a/public/app/views/templates/penalty.php +++ b/public/app/views/templates/penalty.php @@ -9,115 +9,198 @@ Render::view('components/header_includes'); ?> - <style> - html,body{ - padding:0; margin:0; - font-size:1.25em; - color: #037; background: #f6f6f6; - line-height:1.2em; - } - h3 { - font-size: 2em; font-style: normal; - font-weight: 400; - color: #05a; - margin: 0; padding: 5px; - opacity: 0.27; - border-bottom: 1px solid #05a; - } - .container { display: flex; height: 100vh; align-items:center; } - .content { position: relative; - max-width: 800px; width: 100%; - margin: auto auto; padding: .5em; - justify-center: center; - font-size: .78em; - } - .content-form { - padding: 1.5em; - background: #eee; - border-radius: 8px; - box-shadow: 1px 5px 7px #7777; - } - .content .info { padding: 1.5em; font-size: .92em; } - .content .info p { padding: .5em; color: #444; font-size: .82em } - .form-label { margin-bottom: .25rem; } - - .select2-container--default .select2-selection--multiple { font-size: 15px; } - .select2-container--default.select2-container--focus .select2-selection--multiple { line-height: 100%; } - label { font-size: 14px; } - </style> </head> -<body class="classroom"> - <div class='container'> - <div class="content"> - <div class="info"> - <!--<h4>1o Γυμνάσιο Ραφήνας</h4> - <p>1o Γυμνάσιο Ραφήνας: Πλατφόρμα ηλεκτρονικών αιτήσεων και δημιουργίας εγγράφων</p>--> - </div> +<body class="office central-form"> + +<div class='container'> + <div class="content max720px"> + <div class='content-form'> <form method="post"> <div> - <h2>Πρακτικό Πειθαρχικής Υπόθεσης</h2> + <h4>Πρακτικό Πειθαρχικής Υπόθεσης</h4> + <hr /> <?=$form['html']?> <br /> - <button type="submit" class="btn btn-primary btn-sm col-12">Εγγραφή</button> + <button type="submit" class="btn btn-primary btn-sm col-12">Καταχώριση</button> </div> </form> </div> - <div class="info"> - <p>Απαιτείται η συμπλήρωση όλων των στοιχείων προκειμένου να γίνεται γρήγορα η σύνταξη των εγγράφων. Τα στοιχεία σας δεν πρόκειται να δημοσιοποιηθούν και προστατεύονται κατά την εισαγωγή τους με κρυπτογράφιση AES. Παράλληλα η σύνδεση στο site γίνεται με χρήση πιστοποιητικού SSL (RSA 2048 bits).</p> - <p>Αν έχετε ενεργοποιήσει ήδη το λογαρισμό σας <a href="/login">μπορείτε να συνδεθείτε</a>.</p> - </div> </div> -</body> +</body> <script> +var values = {}; +var empty = ''; + +$(document).ready(function() { + + // supplementary functions to select2 control + //////////////////////////////////////////////////////////////////////////// + + /** getValues + * --- -- -- - - - + * Get selected value(s) of Select2 control + * + * @param arg: source-element + * @return (string) value(s) comma-separated + */ + function getValues(srcElm) { + var res; + var obj = srcElm.select2('data'); // get delected data array + + if (obj.length === 0) return ''; // if empty list then nothig is selected + else { + var i = 0; + obj.forEach(function(elm){ // loop through object elements array + + if (i) res += ',' + elm.id; // if not first item, prepend ',' befor value(id) + else res = elm.id; // else set (first) checked value + + i++; + }); + } + return res; + } + + /** select2_set_text + * --- -- -- - - - + * select an (select2-)option by text + * onto a (single) select2 control + * + * @param control = jquery selector, + * @param t (string) = text of option + */ + function select2_set_text(control, t) { + opts = control.select2()[0].options; + var id; + for(i=0; i<opts.length; i++) { if (opts[i].text == t) id = i; } + control.val(id).trigger('change'); + } + + /** get_id_of_text + * --- -- -- - - - + * get id (=value) of an option with `t` as text + * onto a select2 control; + * + * Can be used on single or multiple select2 contols + * + * @param control = jquery selector, + * @param t (string) = text of option + */ + function get_id_of_text( control , t) { + opts = control.select2()[0].options; + var id = false; + for(i=0; i<opts.length; i++) { if (opts[i].text == t) id = i; } + return id; + } + + /** select2_set_multi_text + * --- -- -- - - - + * select several (select2-)options by text + * + * @param control = jquery selector, + * @param t_list (string) = list of selected texts + */ + function select2_set_multi_text(control, t_list) { /* define function */ + var ids = []; + t_list.forEach (t => { let id = get_id_of_text(control, t); + if (id !== false) ids.push(id); + }) + control.val(ids).change(); + } + + /** + * get selected text of a select2 control + */ + function selected_text(control) { + if (typeof control.select2('data') === 'undefined') return false; + else if (control.select2('data').length == 0) return false; + else return control.select2('data')[0].text; + } + + /** + * get all selected texts from a multi-select2 contol + */ + function selected_multitexts(control) { + if (typeof control.select2('data') === 'undefined') return false; + else if (control.select2('data').length == 0) return false; + else { + var result = []; + control.select2('data').forEach( item => { result.push(item.text); }); + return result; + } + } + + // intializations from form-definition + //////////////////////////////////////////////////////////////////////////// + + <?=$form['init_js']?> + + + // track empty values + //////////////////////////////////////////////////////////////////////////// + + + + + // When form is submited - // ------------------------------------------------------------------------- + //////////////////////////////////////////////////////////////////////////// $('.content-form form').submit( event => { event.preventDefault(); - if ($('input[name=password]').val() != $('input[name=password2]').val()) { + if (false) { alert('Τα δυο passrods δεν ταιριάζουν!'); } else { - // prepare data to POST - var data = { - first_name: $('input[name=first_name]').val(), - last_name: $('input[name=last_name]').val(), - email: $('input[name=email]').val(), - registration_number: $('input[name=registration_number]').val(), - sector: $('input[name=sector]').val(), - belonging_school: $('input[name=belonging_school]').val(), - working_shcool: $('input[name=working_shcool]').val(), - position_type_id: $('input[name=position_type_id]').val(), - phone: $('input[name=phone]').val(), - password: $('input[name=password]').val() + var data = { // select content data + of_article: selected_text($('select[name=of_article]')), + student_names: $('textarea[name=student_names]').val(), + of_department: $('input[name=of_department]').val(), + date: $('input[name=date]').val(), + time: $('input[name=time]').val(), + place: selected_text($('select[name=place]')), + rapporteur: selected_text($('select[name=rapporteur]')), + charge: $('textarea[name=charge]').val(), + apology: $('textarea[name=apology]').val(), + decision_reasoning: $('textarea[name=decision_reasoning]').val(), + decision: selected_text($('select[name=decision]')), + decision_more: $('input[name=decision_more]').val(), + president: selected_text($('select[name=president]')), + members: selected_multitexts($('select[name="members[]"]')) }; + var form_data = { // prepare data to post + subject: $('input[name=of_department]').val(), + content: JSON.stringify(data), + on_date: $('input[name=date]').val(), + user_id: $('input[name=id]').val() + } + // select action url (add or update) - var request = '/account/register'; + // var request = '/account/register'; + console.log(data); // send POST request - $.post(request, data) - .done(function( data ) { - $('.classroom .content-form').html(data.message) - }); + // $.post(request, form_data) + // .done(function( data ) { + // $('.classroom .content-form').html(data.message) + // }); } }); - <?=$form['init_js']?> - - <?=$form['values_js']?> + }); </script> </html> diff --git a/public/app/views/user/invitation.php b/public/app/views/user/invitation.php index eb34bc4..564b722 100644 --- a/public/app/views/user/invitation.php +++ b/public/app/views/user/invitation.php @@ -8,71 +8,55 @@ //////////////////////////////////////////////////////////////////////// Render::view('components/header_includes'); ?> - - <style> - html,body{ - padding:0; margin:0; - font-size:1.25em; - color: #037; background: #f6f6f6; - line-height:1.2em; - } - h3 { - font-size: 2em; font-style: normal; - font-weight: 400; - color: #05a; - margin: 0; padding: 5px; - opacity: 0.27; - border-bottom: 1px solid #05a; - } - .container { display: flex; height: 100vh; align-items:center; } - .content { position: relative; - max-width: 540px; width: 100%; - margin: auto auto; padding: .5em; - justify-center: center; - font-size: .78em; - } - .content-form { - padding: 1.5em; - background: #eee; - border-radius: 8px; - box-shadow: 1px 5px 7px #7777; - } - .content .info { padding: 1.5em; font-size: .92em; } - .content .info p { padding: .5em; color: #444; font-size: .82em } - .form-label { margin-bottom: .25rem; } - label { font-size: 14px; } - </style> </head> -<body class="office"> +<body class="office central-form"> + <div class='container'> - <div class="content"> + <div class="content max540px"> + <div class="info"> - <!--<h4>1o Γυμνάσιο Ραφήνας</h4> - <p>1o Γυμνάσιο Ραφήνας: Πλατφόρμα ηλεκτρονικών αιτήσεων και δημιουργίας εγγράφων</p>--> + <h4>1o Γυμνάσιο Ραφήνας</h4> + <p> + Πλατφόρμα ηλεκτρονικών αιτήσεων + και δημιουργίας διαδικαστικών εγγράφων. + </p> </div> + <div class='content-form'> <form method="post"> <div> - <p>1o Γυμνάσιο Ραφήνας /<br /> - Πλατφόρμα ηλεκτρονικών αιτήσεων και δημιουργίας διαδικαστικών εγγράφων</p> - - <h2>Πρόσκληση #</h2> + <h4>Πρόσκληση #<?=$invitation_number?></h4> + <hr/> <?=$form['html']?> <br /> - <button type="submit" class="btn btn-primary btn-sm col-12">Εγγραφή</button> + <button type="submit" class="btn btn-primary btn-sm col-12">Ενεργοποίηση Λογαριασμού</button> </div> </form> </div> <div class="info"> - <p>Απαιτείται η συμπλήρωση όλων των στοιχείων προκειμένου να γίνεται γρήγορα η σύνταξη των εγγράφων. Τα στοιχεία σας δεν πρόκειται να δημοσιοποιηθούν και προστατεύονται κατά την εισαγωγή τους με κρυπτογράφιση AES. Παράλληλα η σύνδεση στο site γίνεται με χρήση πιστοποιητικού SSL (RSA 2048 bits).</p> - <p>Αν έχετε ενεργοποιήσει ήδη το λογαρισμό σας <a href="/login">μπορείτε να συνδεθείτε</a>.</p> + <p> + Απαιτείται η συμπλήρωση όλων των στοιχείων + προκειμένου να γίνεται γρήγορα η σύνταξη των εγγράφων. + </p> + <p> + Αν έχετε ενεργοποιήσει ήδη το λογαρισμό σας + <a href="/login">μπορείτε να συνδεθείτε</a>. + </p> + <p> + Τα στοιχεία σας δεν πρόκειται να δημοσιοποιηθούν και προστατεύονται + κατά την μεταφορά τους στον server με ισχυρή κρυπτογράφιση. + Η ασφάλεια της σύνδεσης με το site πιστοποιείται από την + <a href="https://letsencrypt.org/" target="_blanc">Let's Encrypt</a>. + </p> + </div> </div> </div> + </body> <script> @@ -81,13 +65,44 @@ var empty = ''; $(document).ready(function() { + // supplementary functions to select2 control + //////////////////////////////////////////////////////////////////////////// + + /** getValues + * --- -- -- - - - + * Get selected value(s) of Select2 control + * + * @param arg: source-element + * @return (string) value(s) comma-separated + */ + function getValues(srcElm) { + var res; + var obj = srcElm.select2('data'); // get delected data array + + if (obj.length === 0) return ''; // if empty list then nothig is selected + else { + var i = 0; + obj.forEach(function(elm){ // loop through object elements array + + if (i) res += ',' + elm.id; // if not first item, prepend ',' befor value(id) + else res = elm.id; // else set (first) checked value + + i++; + }); + } + return res; + } + + /** select2_set_text + * --- -- -- - - - * select an (select2-)option by text + * onto a (single) select2 control * * @param control = jquery selector, * @param t (string) = text of option */ - function select2_set_text(control, t) { /* define function */ + function select2_set_text(control, t) { opts = control.select2()[0].options; var id; for(i=0; i<opts.length; i++) { if (opts[i].text == t) id = i; } @@ -95,23 +110,28 @@ $(document).ready(function() { } /** get_id_of_text - * get id (=value) of an option with `t` text + * --- -- -- - - - + * get id (=value) of an option with `t` as text + * onto a select2 control; + * + * Can be used on single or multiple select2 contols * * @param control = jquery selector, * @param t (string) = text of option */ - function get_id_of_text( control , t) { /* define id from text */ + function get_id_of_text( control , t) { opts = control.select2()[0].options; var id = false; for(i=0; i<opts.length; i++) { if (opts[i].text == t) id = i; } return id; } - /** select2_set_multi_text + /** select2_set_multi_text + * --- -- -- - - - * select several (select2-)options by text * * @param control = jquery selector, - * #param t_list (string) = list of selected texts + * @param t_list (string) = list of selected texts */ function select2_set_multi_text(control, t_list) { /* define function */ var ids = []; @@ -122,12 +142,40 @@ $(document).ready(function() { } + /** + * get selected text of a select2 control + */ + function selected_text(control) { + if (control.select2('data').lenght == 0) return false + else return control.select2('data')[0].text; + } + + /** + * get all selected texts from a multi-select2 contol + */ + function selected_multitexts(control) { + if (control.select2('data').legth == 0) return false; + else { + var result = []; + control.select2('data').forEach( item => { result.push(item.text); }); + return result; + } + } + + // intializations from form-definition + //////////////////////////////////////////////////////////////////////////// + <?=$form['init_js']?> + + // track empty values + //////////////////////////////////////////////////////////////////////////// + <?=$form['values_js']?> + // When form is submited - // ------------------------------------------------------------------------- + //////////////////////////////////////////////////////////////////////////// $('form').submit( event => { event.preventDefault(); @@ -161,15 +209,15 @@ $(document).ready(function() { // access verification password: $('input[name=password]').val() }; - // console.log('post:', data); + console.log(data); - var request = '/account/activate'; // set action url - - // send POST request - $.post(request, data) - .done(function( data ) { - $('.office .content-form').html(data.message) - }); +// var request = '/account/activate'; // set action url +// +// // send POST request +// $.post(request, data) +// .done(function( data ) { +// $('.office .content-form').html(data.message) +// }); } }); diff --git a/public/app/views/user/login.php b/public/app/views/user/login.php index 58bfdbb..871e501 100644 --- a/public/app/views/user/login.php +++ b/public/app/views/user/login.php @@ -2,58 +2,66 @@ <html lang="en"> <head> <meta charset="utf-8"> - <title><?=SITE_TITLE?> - Είσοδος Χρήστη</title> + <title><?=SITE_TITLE?> - Είσοδος Χρήστη</title> - <?php // header includes + <?php // header includes //////////////////////////////////////////////////////////////////////// Render::view('components/header_includes'); ?> - - <style> - html,body{ - padding:0; margin:0; - font-size:1.25em; - color: #037; background: #eee; - line-height:1.2em; - } - h3 { - font-size: 2em; font-style: normal; - font-weight: 400; - color: #05a; - margin: 0; padding: 5px; - opacity: 0.27; - border-bottom: 1px solid #05a; - } - .container { display: flex; height: 100vh; align-items:center; } - .content { position: relative; - max-width:480px; width: 100%; - margin: auto auto; padding: 1.5em; - justify-center: center; - background: #e3e3e3; - border-radius: 8px; - box-shadow: 1px 5px 7px #7777; - } - </style> +<style> +:root { /* login-form overides */ + --form-content-font-size: 1rem; + --form-input-height: 34px; + --select2-arrow-top: 1px; +} +</style> </head> -<body class="classroom"> +<body class="office central-form"> + <div class='container'> - <div class='content'> - <h4>Είσοδος Χρήστη</h4> + <div class='content max420px'> + + <div class="info"> + <h4>1o Γυμνάσιο Ραφήνας</h4> + <p>Πλατφόρμα ηλεκτρονικών αιτήσεων και δημιουργίας διαδικαστικών εγγράφων.</p> + </div> + + <div class="content-form"> + <h4>Είσοδος</h4> <hr /> <form method="post"> - <div class="mb-3"> - <label for="exampleInputEmail1" class="form-label">Email</label> + <div class="form-group"> + <label for="exampleInputEmail1">Email</label> <input type="email" class="form-control form-control-sm" name="email" aria-describedby="emailHelp" required> </div> - <div class="mb-3"> - <label for="exampleInputPassword1" class="form-label">Κωδικός Πρόσβασης</label> + <div class="form-group"> + <label for="exampleInputPassword1">Κωδικός πρόσβασης</label> <input type="password" class="form-control form-control-sm" name="password" required> </div> <br /> - <button type="submit" class="btn btn-primary btn-sm col-12">Επιβεβαίωση και Είσοδος</button> + <div class="row justify-content-center"><div class="col-6"> + <button type="submit" class="btn btn-primary btn-sm col-12">Σύνδεση</button> + </div></div> </form> + </div> + + <div class="info"> + <!-- + <p>Αν ξεχάσατε τον κωδικό πρόσβασης μπορείτε να δημιουργήσετε ένα νέο (υπο κατασκευή).</p> + --> + <p> + Εαν δικαιούστε αλλά δεν έχετε πρόσβαση στο site, παρακαλούμε επικοινωνήστε + με τη διεύθυνση του σχολείου προκειμένου να σας αποσταλεί σχετική πρόσκληση. + </p> + <p> + Ο ιστότοπος χρησιμοποιεί cookies τα οποία έχουν αποκλειστικά λειτουργικό ρόλο. + Η χρήση των υπηρεσιών του site συνεπάγεται την αποδοχή διατήρησης αυτών των cookies. + </p> + </div> + </div> </div> + </body> <script> @@ -80,7 +88,7 @@ window.location.href = data.status.goto; } else { - alert('Wrong credentials; please try again'); + alert('Τα στοιχεία πρόσβασης που δώσατε είναι λάθος. Παρακαλώ προσπαθήστε ξανά.'); } }); |
