Announcement

Collapse
No announcement yet.

Asking for saving javascript inside DB

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Asking for saving javascript inside DB

    Dear yuri

    I'm planning to build my own custom plugin what It will semi-auto generate code after I create new module(list) of buttons/edit current module from FE.

    I want to ask you that can we save javascript functions into DB? shall it be not conflicted to any classes inside our framework? I'm using Wysiwyg field type for coding field.

    This is my demo:

    ​​​Click image for larger version

Name:	image.png
Views:	144
Size:	76.3 KB
ID:	108911
    Last edited by trungtvmso; 07-29-2024, 12:47 PM.

  • #2
    A code stored in a field won't be executed, unless you will call it explicitly. A user who can edit this code potentially can gain access to an account of another user, if the code will be executed in a browser of that user.

    Comment


    • #3
      Originally posted by yuri View Post
      A code stored in a field won't be executed, unless you will call it explicitly. A user who can edit this code potentially can gain access to an account of another user, if the code will be executed in a browser of that user.
      yea I understand that I just store it in a field and only Root User can use this plugin.

      Comment


      • #4
        yuri

        Hi yuri, I have a question that can I extend views/detail for adding custom mass button for all entity like "Star" button?

        I'm looking for threads about this question but have no clue. Can you help me to let me know also path to register it in autoload please?

        Thank you so much.

        Comment


        • esforim
          esforim commented
          Editing a comment
          Offtopic, but do you Github these code? Need to do a follow on you

      • #5
        trungtvmso

        Would you mind sharing your project? It looks really interesting.

        To add a detail/list button globally you can use the Global scope:

        clientDefs/Global.json


        PHP Code:
        {
            
        "menu": {
                
        "detail": {
                    
        "buttons": [
                        
        "__APPEND__",
                        {
                            
        "name""myGlobalButton",
                            
        "action""globalAction",
                            
        "style""default",
                            
        "acl""delete",
                            
        "aclScope""User",
                            
        "hidden"true,
                            
        "iconHtml""<span title='Global Action' class="icon fas fa-building"></span> ",
                            
        "data": {
                                
        "handler""my-extension:global-action"
                            
        },
                            
        "initFunction""init"
                        
        }
                    ]
                },
                
        "list": {
                    
        "buttons": [
                        
        "__APPEND__",
                        {
                            
        "name""myGlobalButton",
                            
        "action""globalAction",
                            
        "iconHtml""<span title='Global Action' class="icon fas fa-building"></span> ",
                            
        "style""default",
                            
        "acl""delete",
                            
        "aclScope""User",
                            
        "hidden"true,
                            
        "data": {
                                
        "handler""my-extension:global-action"
                            
        },
                            
        "initFunction""init"
                        
        }
                    ]
                }
            }
        }
        ​ 

        Comment


        • #6
          Kharg

          yes sure, do you have telegram to have conversation about this? I'm working on it but still take times to resolve some situations because of my limitation in reading and coding for Espo Framework.

          Comment


          • Kharg
            Kharg commented
            Editing a comment
            Yes, sure! Send me a message Kharg

          • trungtvmso
            trungtvmso commented
            Editing a comment
            Kharg I have sent mess to you already
        Working...
        X