Grammalecte  Check-in [50fe201fc1]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[fx] dictionaries manager: update
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fx | comdic
Files: files | file ages | folders
SHA3-256:50fe201fc1722849f6447ee6f732ef32b4bf608a0105805fb8f34b3711c8ad5f
User & Date: olr 2019-02-13 19:53:24
Context
2019-02-13
21:37
merge trunk check-in: 12dd6264d6 user: olr tags: comdic
19:53
[fx] dictionaries manager: update check-in: 50fe201fc1 user: olr tags: fx, comdic
2019-02-12
19:58
[fx] dictionaries manager: update check-in: fd372b5786 user: olr tags: fx, comdic
Changes

Changes to gc_lang/fr/webext/panel/dictionaries.css.

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
    display: none;
    position: fixed;
    top: 33%;
    left: calc(50% - 325px);
}
#message {
    display: inline-block;
    padding: 1px 10px;
    width: 600px;
    background-color: hsl(0, 50%, 50%);
    color: hsl(0, 50%, 98%);
    border-style: solid;
    border-width: 2px 0 2px 2px;
    border-color: hsl(0, 50%, 40%);
    border-radius: 3px 0 0 3px;
}
#message_close_button {
    display: inline-block;
    padding: 1px 5px;
    background-color: hsl(0, 50%, 40%);
    color: hsl(0, 90%, 90%);
    border-style: solid;
    border-width: 2px 2px 2px 0;
    border-color: hsl(0, 50%, 30%);
    border-radius: 0 3px 3px 0;
    cursor: pointer;
}


h1 {
    margin: 5px 0 5px 0;
    color: hsl(210, 50%, 50%);







|




|
|
|



|



|
|
|







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
    display: none;
    position: fixed;
    top: 33%;
    left: calc(50% - 325px);
}
#message {
    display: inline-block;
    padding: 5px 20px;
    width: 600px;
    background-color: hsl(0, 50%, 50%);
    color: hsl(0, 50%, 98%);
    border-style: solid;
    border-width: 3px 0 3px 3px;
    border-color: hsla(0, 50%, 40%, .5);
    border-radius: 5px 0 0 5px;
}
#message_close_button {
    display: inline-block;
    padding: 5px 10px;
    background-color: hsl(0, 50%, 40%);
    color: hsl(0, 90%, 90%);
    border-style: solid;
    border-width: 3px 3px 3px 0;
    border-color: hsla(0, 50%, 30%, .5);
    border-radius: 0 5px 5px 0;
    cursor: pointer;
}


h1 {
    margin: 5px 0 5px 0;
    color: hsl(210, 50%, 50%);

Changes to gc_lang/fr/webext/panel/dictionaries.html.

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
    <div class="inbox">
      <h1>Grammalecte · Dictionnaires communautaires</h1>

      <div id="connect_panel">
        <form id="connect_form" method="post" enctype="multipart/form-data">
          <p>
            Non connecté.
            <label for="email">E-mail : </label> <input type="text" id="email" name="email" />
            <label for="password">Mot de passe : </label> <input type="password" id="pw" name="pw" />
            <span id="submit_button">Se connecter</span>
            |
            <a href="http://dic.grammalecte.net" target="_blank">Inscription</a>
          </p>
        </form>
        <div id="connect_info">







|







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
    <div class="inbox">
      <h1>Grammalecte · Dictionnaires communautaires</h1>

      <div id="connect_panel">
        <form id="connect_form" method="post" enctype="multipart/form-data">
          <p>
            Non connecté.
            <label for="email">E-mail : </label> <input type="email" id="email" name="email" />
            <label for="password">Mot de passe : </label> <input type="password" id="pw" name="pw" />
            <span id="submit_button">Se connecter</span>
            |
            <a href="http://dic.grammalecte.net" target="_blank">Inscription</a>
          </p>
        </form>
        <div id="connect_info">

Changes to gc_lang/fr/webext/panel/dictionaries.js.

103
104
105
106
107
108
109




110
111
112
113
114
115
116
117
118
119

120
121
122
123
124
125
126




127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148


















149
150
151
152
153
154
155
    },

    listen: function () {
        document.getElementById("submit_button").addEventListener("click", (xEvent) => { this.connect(); });
    },

    connect: function () {




        let xForm = new FormData(document.getElementById('connect_form'));
        for (let [k, v] of xForm.entries()) {
            console.log("* ", k, v);
        }
        oMessage.show("TEST");
        fetch("http://localhost/connect/", {
            method: "POST", // *GET, POST, PUT, DELETE, etc.
            //mode: "cors", // no-cors, cors, *same-origin
            //cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
            /*headers: {

                "Content-Type": "multipart/form-data",  // text/plain, application/json
            },*/
            credentials: "omit", // include, *same-origin, omit
            body: xForm
        })
        .then((response) => {
            if (response.ok) {




                for (let param in response) {
                    console.log(param, response[param]);
                }
                console.log(response.body);
                return response.json();
            } else {
                for (let param in response) {
                    console.log(param, response[param]);
                }
                return null;
            }
        })
        .then((response) => {
            if (response) {
                console.log(response);
            } else {
                console.log(response);
            }
        })
        .catch((e) => {
            showError(e);
        });


















    }
}


class Table {

    constructor (sNodeId, lColumn, sProgressBarId, sResultId="", bDeleteButtons=true, bActionButtons) {







>
>
>
>




<




|
>
|
|





>
>
>
>






|
<
<





|
<
<





>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







103
104
105
106
107
108
109
110
111
112
113
114
115
116
117

118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141


142
143
144
145
146
147


148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
    },

    listen: function () {
        document.getElementById("submit_button").addEventListener("click", (xEvent) => { this.connect(); });
    },

    connect: function () {
        if (!this.checkValues()) {
            oMessage.show("Les valeurs des champs du formulaire ne sont pas conformes.");
            return;
        }
        let xForm = new FormData(document.getElementById('connect_form'));
        for (let [k, v] of xForm.entries()) {
            console.log("* ", k, v);
        }

        fetch("http://localhost/connect/", {
            method: "POST", // *GET, POST, PUT, DELETE, etc.
            //mode: "cors", // no-cors, cors, *same-origin
            //cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
            headers: {
                "Accept-Charset": "utf-8"
                //"Content-Type": "multipart/form-data",  // text/plain, application/json
            },
            credentials: "omit", // include, *same-origin, omit
            body: xForm
        })
        .then((response) => {
            if (response.ok) {
                if (response.status == 204) {
                    oMessage.show("Échec d’identification. Vérifiez l’e-mail et le mot de passe envoyés…");
                    return null;
                }
                for (let param in response) {
                    console.log(param, response[param]);
                }
                console.log(response.body);
                return response.json();
            } else {
                oMessage.show("Erreur. Le serveur ne semble pas en état de répondre. Veuillez réessayer ultérieurement.");


                return null;
            }
        })
        .then((response) => {
            if (response) {
                console.log("response: ", response);


            }
        })
        .catch((e) => {
            showError(e);
        });
    },

    checkValues () {
        if (document.getElementById("email").value === "") {
            return false;
        }
        let sEmail = document.getElementById("email").value;
        if (sEmail.search(/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$/) === -1) {
            return false;
        }
        return true;
    },

    showId (sLogin, sEmail) {
        document.getElementById("login_label").textContent = sLogin;
        document.getElementById("email_label").textContent = sEmail;
        hideElement("connect_form");
        showElement("connect_info");
    }
}


class Table {

    constructor (sNodeId, lColumn, sProgressBarId, sResultId="", bDeleteButtons=true, bActionButtons) {