noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 22/119: ManageTable : you can set the style o


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 22/119: ManageTable : you can set the style of the dialog box
Date: Mon, 26 Oct 2020 18:27:07 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 298121f99956f2fbf9e1db1790dfd2566967ddfd
Author: Dany De Bontridder <dany@alchimerys.be>
AuthorDate: Tue Sep 29 18:04:56 2020 +0200

    ManageTable  : you can set the style of the dialog box
---
 html/js/managetable.js                 |  7 +++++--
 include/lib/manage_table_sql.class.php | 25 ++++++++++++++++++++++++-
 2 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/html/js/managetable.js b/html/js/managetable.js
index 916ba0e..b6f2795 100644
--- a/html/js/managetable.js
+++ b/html/js/managetable.js
@@ -74,9 +74,12 @@ var ManageTable = function (p_table_name)
 {
     this.callback = "ajax.php"; //!< File to call
     this.control = "dtr"; //<! Prefix Id of dialog box, table, row
-    
+    this.mt_style={position: "fixed", top:  '15%', width: "auto", 
"margin-left": "20%"};
     this.sort_column=0;
     this.param = {"table": p_table_name, "ctl_id": this.control}; //<! default 
value to pass
+    this.set_style=function(p_json) {
+        this.mt_style=p_json;
+    };
     /**
      * Set the sort , 
      * @param {string} p_column  column number start from 0
@@ -308,7 +311,7 @@ var ManageTable = function (p_table_name)
                     var obj = {id: control, "cssclass": "inner_box", "html": 
loading()};
                     add_div(obj);
                     var pos = calcy(250);
-                    $(obj.id).setStyle({position: "fixed", top:  '15%', width: 
"auto", "margin-left": "20%"});
+                    $(obj.id).setStyle(here.mt_style);
                     $(obj.id).update(x['html']);
                 } catch (e) {
                     smoke.alert(content[48] + e.message);
diff --git a/include/lib/manage_table_sql.class.php 
b/include/lib/manage_table_sql.class.php
index 2047942..2078430 100644
--- a/include/lib/manage_table_sql.class.php
+++ b/include/lib/manage_table_sql.class.php
@@ -86,7 +86,7 @@ class Manage_Table_SQL
 
     private $icon_mod; //!< place of right or left the icon update or mod, 
default right, accepted value=left,right,first column for mod
     private $icon_del; //!< place of right or left the icon update or mod, 
default right, accepted value=left,right
-
+    private $dialogbox_style;
     /**
      * @brief Constructor : set the label to the column name,
      * the order of the column , set the properties and the
@@ -123,6 +123,7 @@ class Manage_Table_SQL
         // By default no js sort
         $this->sort_column="";
         $this->dialog_box="dtr";
+        $this->dialogbox_style=array("position"=> "fixed", "top"=>  
'15%',"width"=> "auto", "margin-left"=> "20%");
     }
     /**
      * send the XML headers for the ajax call 
@@ -133,6 +134,26 @@ class Manage_Table_SQL
     }
 
     /**
+     * return the db_style
+     * @return array
+     */
+    public function get_dialogbox_style()
+    {
+        return $this->dialogbox_style;
+    }
+
+    /**
+     * Dialog box style , by default {position: "fixed", top:  '15%', width: 
"auto", "margin-left": "20%"}
+     *
+     * @param array $db_style , will be transformed into a json object
+     */
+    public function set_dialogbox_style($db_style)
+    {
+        $this->dialogbox_style = $db_style;
+        return $this;
+    }
+
+    /**
      * @return mixed
      */
     public function get_dialog_box()
@@ -378,6 +399,7 @@ function check()
      */
     function create_js_script()
     {
+        $style=json_encode($this->dialogbox_style);
         echo "
                <script>
                var {$this->object_name}=new 
ManageTable(\"{$this->table->table}\");
@@ -385,6 +407,7 @@ function check()
                {$this->object_name}.param_add({$this->json_parameter});
                {$this->object_name}.set_sort({$this->get_col_sort()});
                {$this->object_name}.set_control(\"{$this->get_dialog_box()}\");
+               {$this->object_name}.set_style($style);
                </script>
 
        ";



reply via email to

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