PHRAS-3148 Thesaurus : change new window to modals

This commit is contained in:
Harrys Ravalomanana
2020-06-22 19:57:19 +04:00
parent 013c0c8dac
commit 7cc8817447
4 changed files with 92 additions and 55 deletions

View File

@@ -50,7 +50,7 @@
{% set branch = "<br/><b>" ~ fullBranch ~ "</b><br/>" %} {% set branch = "<br/><b>" ~ fullBranch ~ "</b><br/>" %}
{% trans with {'%branch%' : branch} %}thesaurus:: Lier la branche de thesaurus au champ %branch%{% endtrans %} {% trans with {'%branch%' : branch} %}thesaurus:: Lier la branche de thesaurus au champ %branch%{% endtrans %}
<div style="width:70%; height:200px; overflow:scroll;" class="x3Dbox"> <div style="width:100%; height:270px; overflow:scroll;" class="x3Dbox">
{% for fieldname, checked in fieldnames %} {% for fieldname, checked in fieldnames %}
<input type="checkbox" name="field[]" value="{{ fieldname }}" {% if checked %}checked{% endif %} ck0="{% if checked %}1{% else %}0{% endif %}" onclick="return(ckField());">{{ fieldname }}<br/> <input type="checkbox" name="field[]" value="{{ fieldname }}" {% if checked %}checked{% endif %} ck0="{% if checked %}1{% else %}0{% endif %}" onclick="return(ckField());">{{ fieldname }}<br/>
{% endfor %} {% endfor %}

View File

@@ -38,7 +38,7 @@
{{ prop_label }} {{ prop_label }}
<br/> <br/>
<center> <center>
<form onsubmit="return(false);"> <form onsubmit="return(false);" class="thesaurus_confirm_bottom_block">
<input type="hidden" name="bid" value="{{ bid }} "> <input type="hidden" name="bid" value="{{ bid }} ">
<input type="hidden" name="pid" value="{{ pid }}"> <input type="hidden" name="pid" value="{{ pid }}">
<div class='x3Dbox' style='margin:15px; height:100px; overflow:auto;'> <div class='x3Dbox' style='margin:15px; height:100px; overflow:auto;'>
@@ -56,25 +56,18 @@
</form> </form>
</center> </center>
{% else %} {% else %}
{% if nb_candidates_bad > 0 %} {% if nb_candidates_bad > 0 %}t
{% set prop_label = 'thesaurus:: est candidat en provenance des champs mais ne peut etre accepte a cet emplacement du thesaurus' | trans %} {% set prop_label = 'thesaurus:: est candidat en provenance des champs mais ne peut etre accepte a cet emplacement du thesaurus' | trans %}
{% else %} {% else %}
{% set prop_label = 'thesaurus:: n\'est pas present dans les candidats' | trans %} {% set prop_label = 'thesaurus:: n\'est pas present dans les candidats' | trans %}
{% endif %} {% endif %}
<br/>
<br/>
<br/>
<br/>
<br/> <br/>
{{ zterm }} {{ zterm }}
<br/> <br/>
<br/>
{{ prop_label }} {{ prop_label }}
<br/> <br/>
<br/> <form class="thesaurus_confirm_bottom_block">
<br/>
<br/>
<form>
<input type="button" id="cancel_button" value="{{ 'boutton::annuler' | trans }}" onclick="clkBut('cancel');" style="width:100px;"> <input type="button" id="cancel_button" value="{{ 'boutton::annuler' | trans }}" onclick="clkBut('cancel');" style="width:100px;">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
<input type="button" id="submit_button" value="{{ 'boutton::valider' | trans }}" onclick="clkBut('submit');" style="width:100px;"> <input type="button" id="submit_button" value="{{ 'boutton::valider' | trans }}" onclick="clkBut('submit');" style="width:100px;">
@@ -141,18 +134,18 @@
switch(button) switch(button)
{ {
case "submit": case "submit":
{% if typ == "TS" %} {% if typ == "TS" %}
url = "xmlhttp/newts.x.php"; url = "xmlhttp/newts.x.php";
{% else %} {% else %}
url = "xmlhttp/newsy.x.php"; url = "xmlhttp/newsy.x.php";
{% endif %} {% endif %}
parms = "bid={{ bid }}"; parms = "bid={{ bid }}";
parms += "&piv={{ piv }}"; parms += "&piv={{ piv }}";
parms += "&pid={{ pid }}"; parms += "&pid={{ pid }}";
parms += "&t={{ term | url_encode }}"; parms += "&t={{ term | url_encode }}";
{% if context is not none %} {% if context is not none %}
parms += "&k={{ context | url_encode }}"; parms += "&k={{ context | url_encode }}";
{% endif %} {% endif %}
parms += "&sylng={{ sylng }}"; parms += "&sylng={{ sylng }}";
parms += "&reindex=0"; parms += "&reindex=0";
@@ -163,17 +156,18 @@
switch(refresh.item(i).getAttribute("type")) switch(refresh.item(i).getAttribute("type"))
{ {
case "CT": case "CT":
{{ opener }}.reloadCtermsBranch(refresh.item(i).getAttribute("id")); $("#NEWSY_DLG_CONFIRM").dialog('close');
reloadCtermsBranch(refresh.item(i).getAttribute("id"));
break; break;
case "TH": case "TH":
{{ opener }}.reloadThesaurusBranch(refresh.item(i).getAttribute("id")); $("#NEWSY_DLG_CONFIRM").dialog('close');
reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
break; break;
} }
} }
self.close();
break; break;
case "cancel": case "cancel":
self.close(); $("#NEWSY_DLG_CONFIRM").dialog('close');
break; break;
} }
} }

View File

@@ -115,13 +115,15 @@
</div> </div>
<center> <center>
<form onsubmit="return(false);"> <form onsubmit="return(false);">
<input style="position:relative; z-index:2" type="button" id="close_button" value="{{ 'boutton::fermer' | trans }}" onclick="self.close();"> <input style="position:relative; z-index:2" type="button" id="close_button" class="close_button" value="{{ 'boutton::fermer' | trans }}" >
</form> </form>
</center> </center>
<script type="text/javascript"> <script type="text/javascript">
$(".close_button").on("click", function(){
$('.close-dialog').trigger('click');
});
// gui callback du menu des drapeaux // gui callback du menu des drapeaux
var nsy = {{ synonyms | length }}; var nsy = {{ synonyms | length }};
function cbME_flags(action, cbParm, menuelem_id) function cbME_flags(action, cbParm, menuelem_id)
{ {
if(action != "SELECT" || !menuelem_id) { if(action != "SELECT" || !menuelem_id) {
@@ -148,12 +150,12 @@
switch(refresh.item(i).getAttribute("type")) switch(refresh.item(i).getAttribute("type"))
{ {
case "CT": case "CT":
{{ opener }}.reloadCtermsBranch(refresh.item(i).getAttribute("id")); reloadCtermsBranch(refresh.item(i).getAttribute("id"));
{{ opener }}.myGUI.select({{ opener }}.document.getElementById("THE_{{ id }}")); myGUI.select(document.getElementById("THE_{{ id }}"));
break; break;
case "TH": case "TH":
{{ opener }}.reloadThesaurusBranch(refresh.item(i).getAttribute("id")); reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
{{ opener }}.myGUI.select({{ opener }}.document.getElementById("THE_{{ id }}")); myGUI.select(document.getElementById("THE_{{ id }}"));
break; break;
} }
} }
@@ -224,12 +226,12 @@
switch(refresh.item(i).getAttribute("type")) switch(refresh.item(i).getAttribute("type"))
{ {
case "CT": case "CT":
{{ opener }}.reloadCtermsBranch(refresh.item(i).getAttribute("id")); reloadCtermsBranch(refresh.item(i).getAttribute("id"));
{{ opener }}.myGUI.select({{ opener }}.document.getElementById("THE_{{ id }}")); myGUI.select(document.getElementById("THE_{{ id }}"));
break; break;
case "TH": case "TH":
{{ opener }}.reloadThesaurusBranch(refresh.item(i).getAttribute("id")); reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
{{ opener }}.myGUI.select({{ opener }}.document.getElementById("THE_{{ id }}")); myGUI.select(document.getElementById("THE_{{ id }}"));
break; break;
} }
} }
@@ -368,12 +370,12 @@
switch(refresh.item(i).getAttribute("type")) switch(refresh.item(i).getAttribute("type"))
{ {
case "CT": case "CT":
{{ opener }}.reloadCtermsBranch(refresh.item(i).getAttribute("id")); reloadCtermsBranch(refresh.item(i).getAttribute("id"));
{{ opener }}.myGUI.select({{ opener }}.document.getElementById("THE_{{ id }}")); myGUI.select(document.getElementById("THE_{{ id }}"));
break; break;
case "TH": case "TH":
{{ opener }}.reloadThesaurusBranch(refresh.item(i).getAttribute("id")); reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
{{ opener }}.myGUI.select({{ opener }}.document.getElementById("THE_{{ id }}")); myGUI.select(document.getElementById("THE_{{ id }}"));
break; break;
} }
} }

View File

@@ -53,10 +53,12 @@
t = t.replace(/&/g, "&amp;"); t = t.replace(/&/g, "&amp;");
t = t.replace(/</g, "&lt;"); t = t.replace(/</g, "&lt;");
t = t.replace(/>/g, "&gt;"); t = t.replace(/>/g, "&gt;");
// t = escape(t); // t = escape(t);
w = window.open("about:blank", div+"wSRC", "left=2, top=2, directories=yes, width=1000, height=800, location=yes, menubar=yes, toolbar=yes, help=yes, status=yes, resizable=yes, scrollbars=yes", true); // w = window.open("about:blank", div+"wSRC", "left=2, top=2, directories=yes, width=1000, height=800, location=yes, menubar=yes, toolbar=yes, help=yes, status=yes, resizable=yes, scrollbars=yes", true);
w.document.write("<pre>"+t+"</pre>"); // w.document.write("<pre>"+t+"</pre>");
w.document.close(); //w.document.close();
// w = loadDataAjax(url, 500 , 340);
} }
var o_thbox_bck = null; var o_thbox_bck = null;
@@ -300,6 +302,12 @@
</div> </div>
<!-- ------------------------- end "new term/synonym" dialog ---------------------- --> <!-- ------------------------- end "new term/synonym" dialog ---------------------- -->
<!-- ------------------------ the "new term/synonym" dialog ----------------------- -->
<div id="NEWSY_DLG_CONFIRM">
<div class="inner"></div>
</div>
<!-- ------------------------- end "new term/synonym" dialog ---------------------- -->
</div> </div>
<br/> <br/>
@@ -315,6 +323,29 @@
<script type="text/javascript"> <script type="text/javascript">
//Ajax function to get data
function loadDataAjax(urls, width, height) {
$("#NEWSY_DLG_CONFIRM").dialog({
title: '{{ 'thesaurus:dialog:: confirm' | trans }}',
width: width,
height: height,
create:function () {
$(this).closest(".ui-dialog")
.find(".ui-button:first") // the first button
.addClass("close-dialog");
}
});
$.ajax({
type: "GET",
url: `${urls}`,
success: function(data){
$("#NEWSY_DLG_CONFIRM .inner").html('');
$("#NEWSY_DLG_CONFIRM .inner").append(data);
}
});
}
document.body.oncontextmenu = function(){ document.body.oncontextmenu = function(){
return false; return false;
@@ -581,7 +612,8 @@
url += "&id=" + o.id.substr(4); url += "&id=" + o.id.substr(4);
url += "&typ=CT"; url += "&typ=CT";
w = window.open(url, "PROPERTIES", "directories=no, height=340, width=500, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, toolbar=no"); // w = window.open(url, "PROPERTIES", "directories=no, height=340, width=500, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, toolbar=no");
w = loadDataAjax(url, 500 , 340);
break; break;
case "kcterm_search": case "kcterm_search":
$("#SEARCH_DLG").dialog("option", "buttons", $("#SEARCH_DLG").dialog("option", "buttons",
@@ -628,7 +660,8 @@
url += "&piv={{ piv }}"; url += "&piv={{ piv }}";
url += "&id=" + o.id.substr(4); url += "&id=" + o.id.substr(4);
url += "&typ=CT"; url += "&typ=CT";
w = window.open(url, "EXPORT", "directories=no, height=300, width=700, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, toolbar=no"); // w = window.open(url, "EXPORT", "directories=no, height=300, width=700, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, toolbar=no");
w = loadDataAjax(url, 700 , 340);
break; break;
break; break;
} }
@@ -690,7 +723,8 @@
url += "&id=" + o.id.substr(4); url += "&id=" + o.id.substr(4);
url += "&typ=CT"; url += "&typ=CT";
w = window.open(url, "PROPERTIES", "directories=no, height=340, width=500, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, toolbar=no"); //w = window.open(url, "PROPERTIES", "directories=no, height=340, width=500, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, toolbar=no");
w = loadDataAjax(url, 500 , 340);
} }
break; break;
} }
@@ -926,7 +960,6 @@
{ {
if(tid=='') if(tid=='')
tid='T'; tid='T';
return(reloadbranch(document.getElementById("THB_"+tid), tid, "TH")) return(reloadbranch(document.getElementById("THB_"+tid), tid, "TH"))
} }
@@ -1009,7 +1042,6 @@
var lng = zdialog.find("[name=lng]:checked").val(); var lng = zdialog.find("[name=lng]:checked").val();
zdialog.dialog("close"); zdialog.dialog("close");
url = "newterm.php"; url = "newterm.php";
url += "?bid={{ bid }}"; url += "?bid={{ bid }}";
url += "&piv={{ piv }}"; url += "&piv={{ piv }}";
@@ -1018,7 +1050,8 @@
url += "&typ=" + typ; url += "&typ=" + typ;
url += "&sylng=" + encodeURIComponent(lng); url += "&sylng=" + encodeURIComponent(lng);
w = window.open(url, "NEWTERM", "directories=no, height=290, width=490, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, toolbar=no"); // w = window.open(url, "NEWTERM", "directories=no, height=290, width=490, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, toolbar=no");
w = loadDataAjax(url,490, 290);
} }
} }
] ]
@@ -1074,7 +1107,8 @@
url += "?bid={{ bid }}"; url += "?bid={{ bid }}";
url += "&piv={{ piv }}"; url += "&piv={{ piv }}";
url += "&tid=" + o.id.substr(4); url += "&tid=" + o.id.substr(4);
w = window.open(url, "LINK", "directories=no, height=340, width=500, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, toolbar=no"); // w = window.open(url, "LINK", "directories=no, height=340, width=500, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, toolbar=no");
w = loadDataAjax(url,700, 400);
break; break;
case "kterm_properties": case "kterm_properties":
var myObj = { "win":window }; var myObj = { "win":window };
@@ -1084,7 +1118,9 @@
url += "&id=" + o.id.substr(4); url += "&id=" + o.id.substr(4);
url += "&typ=TH"; url += "&typ=TH";
w = window.open(url, "PROPERTIES", "directories=no, height=300, width=500, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, toolbar=no"); //w = window.open(url, "PROPERTIES", "directories=no, height=300, width=500, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, toolbar=no");
w = loadDataAjax(url,700, 400);
break; break;
case "kterm_search": case "kterm_search":
$("#SEARCH_DLG").dialog("option", "buttons", $("#SEARCH_DLG").dialog("option", "buttons",
@@ -1131,7 +1167,8 @@
url += "&piv={{ piv }}"; url += "&piv={{ piv }}";
url += "&id=" + o.id.substr(4); url += "&id=" + o.id.substr(4);
url += "&typ=TH"; url += "&typ=TH";
w = window.open(url, "EXPORT", "directories=no, height=300, width=700, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, toolbar=no"); //w = window.open(url, "EXPORT", "directories=no, height=300, width=700, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, toolbar=no");
w = loadDataAjax(url, 700, 400);
break; break;
case "kterm_topics": case "kterm_topics":
var myObj = { "win":window }; var myObj = { "win":window };
@@ -1141,7 +1178,8 @@
url += "&id=" + o.id.substr(4); url += "&id=" + o.id.substr(4);
url += "&typ=TH"; url += "&typ=TH";
url += "&obr=" + list_opened_branches(o.parentNode); url += "&obr=" + list_opened_branches(o.parentNode);
w = window.open(url, "EXPORT", "directories=no, height=400, width=550, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, toolbar=no"); //w = window.open(url, "EXPORT", "directories=no, height=400, width=550, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, toolbar=no");
w = loadDataAjax(url, 700, 400);
break; break;
} }
break; break;
@@ -1245,7 +1283,8 @@
url += "&piv={{ piv }}"; url += "&piv={{ piv }}";
url += "&id=" + o.id.substr(4); url += "&id=" + o.id.substr(4);
url += "&typ=TH"; url += "&typ=TH";
w = window.open(url, "PROPERTIES", "directories=no, height=340, width=500, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, toolbar=no"); // w = window.open(url, "PROPERTIES", "directories=no, height=340, width=500, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, toolbar=no");
w = loadDataAjax(url, 500 , 340);
} }
} }
break; break;
@@ -1318,7 +1357,8 @@
url += "&piv={{ piv }}"; url += "&piv={{ piv }}";
url += "&src=" + eventObj.Src0.id.substr(4); url += "&src=" + eventObj.Src0.id.substr(4);
url += "&tgt=" + tgt0.id.substr(4); url += "&tgt=" + tgt0.id.substr(4);
w = window.open(url, "ACCEPT", "directories=no, height=300, width=500, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, toolbar=no"); //w = window.open(url, "ACCEPT", "directories=no, height=300, width=500, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, toolbar=no");
w = loadDataAjax(url, 500 , 340);
} }
} }
break; break;
@@ -1372,7 +1412,8 @@
url += "?piv={{ piv }}"; url += "?piv={{ piv }}";
url += "&bid={{ bid }}"; url += "&bid={{ bid }}";
url += "&id="; url += "&id=";
w = window.open(url, "IMPORT", "directories=no, height=400, width=600, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, toolbar=no"); // w = window.open(url, "IMPORT", "directories=no, height=400, width=600, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, toolbar=no");
w = loadDataAjax(url, 600 , 400);
break; break;
} }
break; break;