noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 78/219: InPlace_Switch : add a supplemental j


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 78/219: InPlace_Switch : add a supplemental javascript command
Date: Mon, 18 Dec 2017 13:22:41 -0500 (EST)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 2c96ce0c68518ce6a1411c4bb48b81932252a7af
Author: Dany De Bontridder <address@hidden>
Date:   Tue Oct 10 15:31:15 2017 +0200

    InPlace_Switch : add a supplemental javascript command
---
 include/lib/inplace_switch.class.php | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/include/lib/inplace_switch.class.php 
b/include/lib/inplace_switch.class.php
index ab3401f..96bae13 100644
--- a/include/lib/inplace_switch.class.php
+++ b/include/lib/inplace_switch.class.php
@@ -39,7 +39,9 @@ class Inplace_Switch
     private $json;
     /// callback
     private $callback;
-
+    /// Supplemental javascript command, execute after the ajax script
+    private $jscript;
+    
     function __construct($p_name, $p_value)
     {
         $this->name=$p_name;
@@ -48,6 +50,7 @@ class Inplace_Switch
         $this->iconoff='<img src="image/icon-off.png"/>';
         $this->json=json_encode(['name'=>$p_name,"value"=>$p_value], 
JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_NUMERIC_CHECK);
         $this->callback="ajax.php";
+        $this->jscript="";
     }
 
     function input()
@@ -68,12 +71,23 @@ class Inplace_Switch
         echo '</span>';
         echo <<<EOF
         <script>
-{$this->name}.onclick=function() {new 
Ajax.Updater({$this->name},'{$this->callback}',{method:"get",parameters:{$this->json},evalScripts:true}
 );}
+{$this->name}.onclick=function() {new 
Ajax.Updater({$this->name},'{$this->callback}',{method:"get",parameters:{$this->json},evalScripts:true}
 );
+   {$this->jscript} 
+   }
 </script>
 EOF;
     }
+    public function get_jscript()
+    {
+        return $this->jscript;
+    }
+
+    public function set_jscript($jscript)
+    {
+        $this->jscript=$jscript;
+    }
 
-    public function get_json()
+        public function get_json()
     {
         return $this->json;
     }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]