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/>" %}
{% 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 %}
<input type="checkbox" name="field[]" value="{{ fieldname }}" {% if checked %}checked{% endif %} ck0="{% if checked %}1{% else %}0{% endif %}" onclick="return(ckField());">{{ fieldname }}<br/>
{% endfor %}

View File

@@ -38,7 +38,7 @@
{{ prop_label }}
<br/>
<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="pid" value="{{ pid }}">
<div class='x3Dbox' style='margin:15px; height:100px; overflow:auto;'>
@@ -56,25 +56,18 @@
</form>
</center>
{% 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 %}
{% else %}
{% set prop_label = 'thesaurus:: n\'est pas present dans les candidats' | trans %}
{% endif %}
<br/>
<br/>
<br/>
<br/>
<br/>
{{ zterm }}
<br/>
<br/>
{{ prop_label }}
<br/>
<br/>
<br/>
<br/>
<form>
<form class="thesaurus_confirm_bottom_block">
<input type="button" id="cancel_button" value="{{ 'boutton::annuler' | trans }}" onclick="clkBut('cancel');" style="width:100px;">
&nbsp;&nbsp;&nbsp;
<input type="button" id="submit_button" value="{{ 'boutton::valider' | trans }}" onclick="clkBut('submit');" style="width:100px;">
@@ -163,17 +156,18 @@
switch(refresh.item(i).getAttribute("type"))
{
case "CT":
{{ opener }}.reloadCtermsBranch(refresh.item(i).getAttribute("id"));
$("#NEWSY_DLG_CONFIRM").dialog('close');
reloadCtermsBranch(refresh.item(i).getAttribute("id"));
break;
case "TH":
{{ opener }}.reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
$("#NEWSY_DLG_CONFIRM").dialog('close');
reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
break;
}
}
self.close();
break;
case "cancel":
self.close();
$("#NEWSY_DLG_CONFIRM").dialog('close');
break;
}
}

View File

@@ -115,13 +115,15 @@
</div>
<center>
<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>
</center>
<script type="text/javascript">
$(".close_button").on("click", function(){
$('.close-dialog').trigger('click');
});
// gui callback du menu des drapeaux
var nsy = {{ synonyms | length }};
function cbME_flags(action, cbParm, menuelem_id)
{
if(action != "SELECT" || !menuelem_id) {
@@ -148,12 +150,12 @@
switch(refresh.item(i).getAttribute("type"))
{
case "CT":
{{ opener }}.reloadCtermsBranch(refresh.item(i).getAttribute("id"));
{{ opener }}.myGUI.select({{ opener }}.document.getElementById("THE_{{ id }}"));
reloadCtermsBranch(refresh.item(i).getAttribute("id"));
myGUI.select(document.getElementById("THE_{{ id }}"));
break;
case "TH":
{{ opener }}.reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
{{ opener }}.myGUI.select({{ opener }}.document.getElementById("THE_{{ id }}"));
reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
myGUI.select(document.getElementById("THE_{{ id }}"));
break;
}
}
@@ -224,12 +226,12 @@
switch(refresh.item(i).getAttribute("type"))
{
case "CT":
{{ opener }}.reloadCtermsBranch(refresh.item(i).getAttribute("id"));
{{ opener }}.myGUI.select({{ opener }}.document.getElementById("THE_{{ id }}"));
reloadCtermsBranch(refresh.item(i).getAttribute("id"));
myGUI.select(document.getElementById("THE_{{ id }}"));
break;
case "TH":
{{ opener }}.reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
{{ opener }}.myGUI.select({{ opener }}.document.getElementById("THE_{{ id }}"));
reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
myGUI.select(document.getElementById("THE_{{ id }}"));
break;
}
}
@@ -368,12 +370,12 @@
switch(refresh.item(i).getAttribute("type"))
{
case "CT":
{{ opener }}.reloadCtermsBranch(refresh.item(i).getAttribute("id"));
{{ opener }}.myGUI.select({{ opener }}.document.getElementById("THE_{{ id }}"));
reloadCtermsBranch(refresh.item(i).getAttribute("id"));
myGUI.select(document.getElementById("THE_{{ id }}"));
break;
case "TH":
{{ opener }}.reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
{{ opener }}.myGUI.select({{ opener }}.document.getElementById("THE_{{ id }}"));
reloadThesaurusBranch(refresh.item(i).getAttribute("id"));
myGUI.select(document.getElementById("THE_{{ id }}"));
break;
}
}

View File

@@ -54,9 +54,11 @@
t = t.replace(/</g, "&lt;");
t = t.replace(/>/g, "&gt;");
// 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.document.write("<pre>"+t+"</pre>");
w.document.close();
// 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.close();
// w = loadDataAjax(url, 500 , 340);
}
var o_thbox_bck = null;
@@ -300,6 +302,12 @@
</div>
<!-- ------------------------- 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>
<br/>
@@ -315,6 +323,29 @@
<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(){
return false;
@@ -581,7 +612,8 @@
url += "&id=" + o.id.substr(4);
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;
case "kcterm_search":
$("#SEARCH_DLG").dialog("option", "buttons",
@@ -628,7 +660,8 @@
url += "&piv={{ piv }}";
url += "&id=" + o.id.substr(4);
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;
}
@@ -690,7 +723,8 @@
url += "&id=" + o.id.substr(4);
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;
}
@@ -926,7 +960,6 @@
{
if(tid=='')
tid='T';
return(reloadbranch(document.getElementById("THB_"+tid), tid, "TH"))
}
@@ -1009,7 +1042,6 @@
var lng = zdialog.find("[name=lng]:checked").val();
zdialog.dialog("close");
url = "newterm.php";
url += "?bid={{ bid }}";
url += "&piv={{ piv }}";
@@ -1018,7 +1050,8 @@
url += "&typ=" + typ;
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 += "&piv={{ piv }}";
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;
case "kterm_properties":
var myObj = { "win":window };
@@ -1084,7 +1118,9 @@
url += "&id=" + o.id.substr(4);
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;
case "kterm_search":
$("#SEARCH_DLG").dialog("option", "buttons",
@@ -1131,7 +1167,8 @@
url += "&piv={{ piv }}";
url += "&id=" + o.id.substr(4);
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;
case "kterm_topics":
var myObj = { "win":window };
@@ -1141,7 +1178,8 @@
url += "&id=" + o.id.substr(4);
url += "&typ=TH";
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;
@@ -1245,7 +1283,8 @@
url += "&piv={{ piv }}";
url += "&id=" + o.id.substr(4);
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;
@@ -1318,7 +1357,8 @@
url += "&piv={{ piv }}";
url += "&src=" + eventObj.Src0.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;
@@ -1372,7 +1412,8 @@
url += "?piv={{ piv }}";
url += "&bid={{ bid }}";
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;