[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 116/323: Improve progress_bar : add a blockin
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 116/323: Improve progress_bar : add a blocking div |
Date: |
Wed, 14 Mar 2018 17:38:35 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 78fd828aa4241ea9e91f43a796154f92e568c3e8
Author: Dany De Bontridder <address@hidden>
Date: Sat Feb 3 15:28:27 2018 +0100
Improve progress_bar : add a blocking div
---
html/js/scripts.js | 26 ++++++++++++++++++++++----
include/lib/progress_bar.class.php | 14 +++++++++++++-
2 files changed, 35 insertions(+), 5 deletions(-)
diff --git a/html/js/scripts.js b/html/js/scripts.js
index a212591..6595ca9 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -3405,10 +3405,19 @@ var progressIdx = 0;
* @param {string} p_taskid id to monitor
* @param {int} p_dossier
*/
-function progress_bar_start(p_taskid)
+function progress_bar_start(p_taskid,p_message)
{
try {
progressIdx++;
+ // block the window
+ var message="Un instant svp";
+ if ( p_message) {
+ message=p_message;
+ }
+ add_div({id:"blocking"+progressIdx,cssclass:"smoke-base smoke-visible
"});
+
+
add_div({id:"message"+progressIdx,cssclass:"inner_box",style:"z-index:1000;position:fixed;top:30%;width:40%;left:30%"});
+ $("message"+progressIdx).update(message);
// Create a div
add_div({id: "progressDiv" + progressIdx, cssclass: "progressbar",
html: '<span id="progressValue">0</span>'});
// Check status every sec.
@@ -3433,8 +3442,14 @@ function progress_bar_check(p_idx, p_taskid)
try
{
var answer=req.responseText.evalJSON();
-
- var progressValue = $('progressValue');
+ var progress_div=$("progressDiv"+progressIdx);
+ var a_child=progress_div.childNodes;
+ var i=0;
+ for ( i=0;i< a_child.length;i++) {
+ if ( a_child[i].id="progressValue") {
+ var progressValue = a_child[i];
+ }
+ }
var progress = parseFloat(progressValue.innerHTML);
if ( answer.value <= progress ) {
return;
@@ -3445,7 +3460,10 @@ function progress_bar_check(p_idx, p_taskid)
if (answer.value== 100) {
clearInterval(progressBar[p_idx]);
progressValue.innerHTML="Success";
-
Effect.BlindUp("progressDiv"+progressIdx,{duration:1.0,scaleContent:false})
+
Effect.BlindUp("progressDiv"+p_idx,{duration:1.0,scaleContent:false})
+ $("message"+p_idx).remove();
+ $("blocking"+p_idx).remove();
+ setTimeout(function() {
$("progressDiv"+progressIdx).remove } , 1100);
}
} catch (e) {
clearInterval(progressBar[p_idx]);
diff --git a/include/lib/progress_bar.class.php
b/include/lib/progress_bar.class.php
index 04e6f24..50b1d08 100644
--- a/include/lib/progress_bar.class.php
+++ b/include/lib/progress_bar.class.php
@@ -108,8 +108,20 @@ class Progress_Bar
header('Content-Type: application/json');
echo json_encode(["value"=>$this->value]);
if ($this->value>=100) {
- $this->db->exec_sql("delete from progress where
p_id=$1",[$this->task_id])
+ $this->db->exec_sql("delete from progress where
p_id=$1",[$this->task_id]);
}
return;
}
+ /**
+ * increment value with $p_step
+ * @param int $p_step
+ */
+ function increment($p_step)
+ {
+ if ($this->value+$p_step > 100 ) {
+ $this->set_value(100);
+ return;
+ }
+ $this->set_value($this->value+$p_step);
+ }
}
- [Noalyss-commit] [noalyss] 101/323: Fix bug from merge, (continued)
- [Noalyss-commit] [noalyss] 101/323: Fix bug from merge, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 104/323: remove debug, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 102/323: correct bug created by the merge, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 94/323: Merge branch 'dev-6919.8', Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 108/323: Remove grant / revoke command, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 107/323: Add licence + template name, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 106/323: fix: cannot create new folder due to a typo error, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 91/323: FollowUp : improve esthetic, use inplace_edit for commenting on files, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 112/323: Change theme : corner for menu2 , no more border-radius for menu1, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 110/323: Correction couleur pour Inswitch_place Correction couleur pour Module sécurité, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 116/323: Improve progress_bar : add a blocking div,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 115/323: translate, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 119/323: Missing lib, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 118/323: Progress Bar : use GET , which is faster than POST, use 2 decimal in progress because if the step is < 1 , it doesn't work, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 117/323: Export PDF from ANC , add a progress_bar, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 16/323: Bug 1516 : réécriture du module période, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 111/323: History of analytic account the same way as the history for card or accounting, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 120/323: New LOGO, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 122/323: cosmetic menu level2, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 124/323: Fix : logo and new style by default, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 125/323: fix : managetable correct position, Dany De Bontridder, 2018/03/14