Extend "Email Mailbox" with a new Tab

Discussion in 'Developers' Forum' started by CubAfull, Jul 30, 2024.

  1. CubAfull

    CubAfull Member

    Hello @till and other dev users.
    I want to extend the Mail module and add a new tab inside "Email Mailbox" with additional options to use with an external APP, in this case Nextcloud, but I want to do this without modifying the core files, so, mi question is:

    Is it possible to do that? I can't find any info/tutorial in the ISPConfig documentation or hook in the code to do that. I know I can make a new module outside the Mail module and implement this functions, but what I want is a tab inside the Email Mailbox, so when I create a new email for a user I can add options like cloud quota etc. and get that information using the remote API with a modded version of the Nextcloud-ISPConfig module developed by @theWeird

    Thank you!
     
    ahrasis likes this.
  2. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    There is a custom module created by our member that eases a creation of new sites in a single tab without modifying ISPConfig core but I think it was quite old and was added to the main menu tab instead of any sub menu tab. However, I can't remember where the module thread is for now as I am on mobile, but may be other can help you to find it.
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

  4. CubAfull

    CubAfull Member

    ahrasis and till like this.
  5. CubAfull

    CubAfull Member

    Update. The plugin is finished and work ok. Some SS at the end. I'm going to post the plugin when I finish the Nextcloud part (working right now in this).
    Continuing with the core files and my comment here:
    https://forum.howtoforge.com/thread...-integrated-upstream.92752/page-2#post-459307

    This isn't true, all the custom fields are loaded from the db and sent to the remote API call, so, no problem here, but I modded the loadFormDef function in the core file remoting_lib.inc.php to allow the plugins "fields" to be loaded. I don't see where this fields are used, but if the code say it must be loaded, well, the custom fields must be loaded to, right?
    Captura desde 2024-08-11 02-34-31.png Captura desde 2024-08-11 02-36-42.png Captura desde 2024-08-11 02-37-08.png
    PHP:
        //* Load the form definition from file. - special version for remoting
        // module parameter is only for compatibility with base class
        
    function loadFormDef($file$module '') {
            global 
    $app;

            include 
    $file;

            
    // Search for module name by path because $_SESSION['s']['module']['name']
            // isn't set in a remote call.
            
    $module_path array_reverse(explode('/'$file));
            
    $module_name = isset($module_path[2]) && $module_path[1] == 'form' && preg_match("/^[a-z]{2,20}$/i"$module_path[2]) ? $module_path[2] : '';

            
    // Allow plugins to be loaded
            
    if ($module_name) {
                
    $app->plugin->raiseEvent($module_name.':'.$form['name'] . ':on_remote_before_formdef'$this);
            }

            
    $this->formDef $form;

            unset(
    $this->formDef['tabs']);

            
    //* Copy all fields from all tabs into one form definition
            
    foreach($form['tabs'] as $tab) {
                foreach(
    $tab['fields'] as $key => $value) {
                    
    $this->formDef['fields'][$key] = $value;
                }
            }
            unset(
    $form);

            
    // Allow plugins to be loaded
            
    if ($module_name) {
                
    $app->plugin->raiseEvent($module_name.':'.$this->formDef['name'] . ':on_remote_after_formdef'$this);
            }

            
    $this->dateformat 'Y-m-d'//$app->lng('conf_format_dateshort');
            
    $this->datetimeformat 'Y-m-d H:i:s'//$app->lng('conf_format_datetime');

            
    return true;
        }
     
    ahrasis likes this.
  6. CubAfull

    CubAfull Member

    till and ahrasis like this.
  7. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Thank you for sharing.
     
    CubAfull likes this.
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    By the way, I find it a bit sad that you have chosen a license that is incompatible with ISPConfig's BSD license. GPL infects other code with its license policy, so it is incompatible with more free licenses like the BSD license, which ISPConfig uses. I hope you consider to change the license of your code to BSD too.
     
    ahrasis likes this.
  9. till

    till Super Moderator Staff Member ISPConfig Developer

  10. CubAfull

    CubAfull Member

    @till I did not pay attention to the license. :(
    Sure I can change it. I think I must do this just for the ISPConfig plug-in, or both?

    Thank you for the blog post!!!
     
    till likes this.
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    This would be great if you could change it just for the ISPConfig plugin.
     
  12. CubAfull

    CubAfull Member

    Perfect. I do this today.

    @till I made a lot of changes before release. Please update the images in the blog with this:
    Captura desde 2024-09-06 10-15-11.png Captura desde 2024-09-06 10-17-11.png Captura desde 2024-09-06 10-17-30.png
     
    till likes this.
  13. till

    till Super Moderator Staff Member ISPConfig Developer

    Thanks for the new screenshots. I'll update the blog post.
     
    CubAfull likes this.
  14. CubAfull

    CubAfull Member

    pyte and till like this.
  15. till

    till Super Moderator Staff Member ISPConfig Developer

    CubAfull likes this.

Share This Page