You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2017-09-28 07:28:56

lexcorp
Guest
Registered: 2014-09-17
Posts: 64

Login with modal info

In the login page (index.php), when an incorrect username or password is entered, the application redirects to the page (login.php) to display the wrong User or password message, reconnect.

https://localhost/glpi/index.php
login1.jpg

https://localhost/glpi/front/login.php
wrongpassword.jpg

I have the need to display this message in a modal window, without the application redirecting me to the login.php page.
login2.jpg

In the ajax.class.php class there is the function: createModalWindow($name, $url, $options=array())

/**
    * Create modal window
    * After display it using $name.dialog("open");
    *
    * @since version 0.84
    *
    * @param $name            name of the js object
    * @param $url             URL to display in modal
    * @param $options array   of possible options:
    *     - width      (default 800)
    *     - height     (default 400)
    *     - modal      is a modal window ? (default true)
    *     - container  specify a html element to render (default empty to html.body)
    *     - title      window title (default empty)
    *     - display    display or get string ? (default true)
   **/
   static function createModalWindow($name, $url, $options=array() ) {

      $param = array('width'           => 800,
                     'height'          => 400,
                     'modal'           => true,
                     'container'       => '',
                     'title'           => '',
                     'extraparams'     => array(),
                     'display'         => true,
                     'js_modal_fields' => '');

...

How can I use this function to create the modal window with the wrong user message and password?

Please provide an example...

Offline

#2 2017-09-29 07:02:04

lexcorp
Guest
Registered: 2014-09-17
Posts: 64

Re: Login with modal info

I have analyzed some classes

Load Bookmarks in html.class.php

<script type="text/javascript">
            $('#loadbookmark').dialog({
               modal: true,
               autoOpen: false,
               height: 500,
               width: 1050,
               draggable: true,
               resizeable: true,
               open: function(ev, ui){
               $('#Iframeloadbookmark').attr('src','/glpi914/front/bookmark.php?action=load&_in_modal=1');},close: function(ev, ui) { window.location.reload() },title: "Cargar un marcador"});
</script>


<a href="#" onclick="$('#loadbookmark').dialog('open');"><span id="bookmark_icon" title="Cargar un marcador" alt="Cargar un marcador" class="button-icon"></span></a>



Ajax::createIframeModalWindow('loadbookmark',
                                    $CFG_GLPI["root_doc"]."/front/bookmark.php?action=load",
                                    array('title'         => __('Load a bookmark'),
                                          'reloadonclose' => true));
echo "<a href='#' onClick=\"".Html::jsGetElementbyID('loadbookmark').".dialog('open');\">";

Show menu in html.class.php

<script type="text/javascript">
//<![CDATA[

$( document ).ready(function() {
$('#show_all_menu').dialog({
         height: 'auto',
         width: 'auto',
         modal: true,
         autoOpen: false
         });
});

//]]>
</script>

<a href="#" onclick="$('#show_all_menu').dialog('open');" id="menu_all_button" class="button-icon"></a>

Add dropdown in Knowledge Base

<img alt="" title="Añadir" src="/glpi914/pics/add_dropdown.png" style="cursor:pointer; margin-left:2px;" onclick="$('#add_dropdown1843132794').dialog('open');">

<script type="text/javascript">
            $('#add_dropdown1843132794').dialog({
               modal: true,
               autoOpen: false,
               height: 500,
               width: 1050,
               draggable: true,
               resizeable: true,
               open: function(ev, ui){
               $('#Iframeadd_dropdown1843132794').attr('src','/glpi914/front/knowbaseitemcategory.form.php?_in_modal=1');},title: ""});
</script>

In ajax.class.php exist 3 functions:

static function createModalWindow($name, $url, $options=array() ) { ... }

static function createFixedModalWindow($name, $options=array() ) { ... }

static function createIframeModalWindow($domid, $url, $options=array() ) { ... }

Could you share an example?

Offline

#3 2017-10-02 07:15:47

lexcorp
Guest
Registered: 2014-09-17
Posts: 64

Re: Login with modal info

Anyone?

Offline

#4 2017-10-05 05:44:04

lexcorp
Guest
Registered: 2014-09-17
Posts: 64

Re: Login with modal info

A little help here please!..

Offline

Board footer

Powered by FluxBB