help.anubis 2.04 KB
/*
 * Created by PyramIDE.
 * User: フランスのトトロ aka (David RENÉ) 
 * Date: 13/02/2016
 * Time: 10:12
 * © David RENÉ
 */

transmit tools/basis.anubis
transmit system/muscle.anubis
transmit calexium_lib/CXM_message_constants.anubis
transmit calexium_lib/web/CXM_json.anubis
transmit hayamiki_lib/model/types/hk_help_text.anubis


public define String
/* Return the Anubis source of the type component
*/
  to_Anubis_source
  (
    HK_Help_Text help
  )=
  if help is
  {
    no_help_text        then  "no_help_text",
    help_text_TAG(tag)  then  "help_text_TAG(\""+tag+"\")",
    help_text(str)      then  "help_text(\""+str+"\")"
  }.

 /* *
  _HK_HELP_TEXT message format:
  =============================
  +----------------+-----------+--------------------------------
  |  name          |  type     |      description
  +----------------+-----------+--------------------------------
  | "hk_help_text" | String    | type of the help text. It sould be 
                                 "no_help"
                                 "TAG"  ____
                                 "text" __  |
    ______________________________________|_|
   |
   --> TAG or text:
      +---------+-----------+--------------------------------
      |  name   |  type     |      description
      +---------+-----------+--------------------------------
      | "value" | String    | String name of the 16x16 icon. 

*/



public define JsonValue
  to_JSON
  (    
    HK_Help_Text hk_help
  )=
  with members = 
  if hk_help is
  {
    no_help_text        then  [ json_member("hk_help_text", json_string("no_help"))
                              ],
    help_text_TAG(tag)  then  [ json_member("hk_help_text", json_string("TAG")),
                                json_member("value",        json_string(tag))
                              ]
    help_text(value)    then  [ json_member("hk_help_text", json_string("text")),
                                json_member("value",        json_string(value))
                              ]
  },
  json_object("_HK_HELP_TEXT", members).