Author Topic: How to add custom built module to left menu?  (Read 29510 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
How to add custom built module to left menu?
« on: November 02, 2013, 03:45:05 PM »
How can i add my custom builded module to the Web Panel left drop down menu under settings?

Offline
*
Re: How to add custom built module to left menu?
« Reply #1 on: November 02, 2013, 09:35:24 PM »
You can add modules only under 3rdParty!

How to new module to CentOS-WebPanel menu?
It’s easy, go to /etc/webpanel/panel/include folder and make new file named 3rdparty.php ,in this file you add links one per line.
eg.
<a href=”index.php?module=test2″>TEST 2</a>
<a href=”index.php?module=test3″>TEST 3</a>

reload web panel and module will be added to the menu.

Mudule file needs to uploaded in /etc/webpanel/panel/modules folder
if filename is my_module.php then in menu you need to set link as this example without extension
<a href=”index.php?module=my_module″>TEST 3</a>
« Last Edit: November 30, 2013, 04:53:47 PM by Administrator »
AntiDDoS Protection (web + mail)
http://centos-webpanel.com/website-ddos-protection-proxy

Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp


Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor


Do you need Fast and FREE Support included for your CWP linux server?
http://centos-webpanel.com/noc-partner-list
Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services

Offline
*
Re: How to add custom built module to left menu?
« Reply #2 on: November 30, 2013, 05:37:20 AM »
Does this apply to WordPress installation as well?
Does the Panel have existing Wordpress modules or we have to custom build it; any guidelines how to do that?

I need to use Wordpress hence I am looking for the most compatible Control Panel with my VPS.
I am getting rid of my old panel... zpanelcp is too buggy!

Thank you!

Offline
*
Re: How to add custom built module to left menu?
« Reply #3 on: November 30, 2013, 02:36:22 PM »
For now there is no script installer this will be added later.
You can install manual wordpress or if you have some knowlage of php you can make script/wordpress installer.

For script installer you will need to use root/mysql password for making database & database user/pwd, wget latest wordpress installation and extract it and then run installer.

AntiDDoS Protection (web + mail)
http://centos-webpanel.com/website-ddos-protection-proxy

Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp


Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor


Do you need Fast and FREE Support included for your CWP linux server?
http://centos-webpanel.com/noc-partner-list
Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services

Offline
***
Re: How to add custom built module to left menu?
« Reply #4 on: September 18, 2014, 03:01:26 PM »
It’s easy, go to /etc/webpanel/panel/include folder and make new file named 3rdparty.php ,in this file you add links one per line.
eg.
<a href=”index.php?module=test2″>TEST 2</a>
<a href=”index.php?module=test3″>TEST 3</a>

reload web panel and module will be added to the menu.

I cant find the location of the 3rdparty.php file.

Module is located /usr/local/cwpsrv/htdocs/resources/admin/modules and works fine.
Tried to create the 3rdparty.php file under /usr/local/cwpsrv/htdocs/resources/admin/include but didn't work,

Do not figure where to put.
8==D it's a function that try to compare 8 (int) against D (string) which returns True or False depending on the asker.

Offline
*
Re: How to add custom built module to left menu?
« Reply #5 on: November 17, 2014, 04:58:21 PM »
/usr/local/cwpsrv/htdocs/resources/admin/include/menu.php add include("3rdparty.php"); befor ?>

and upload 3rdparty.php to
/usr/local/cwpsrv/htdocs/resources/admin/include  Menu is work fine :)

Offline
*
Re: How to add custom built module to left menu?
« Reply #6 on: November 18, 2014, 12:24:42 AM »
the new CWP will have few more addons so we will add a new include menu option.
AntiDDoS Protection (web + mail)
http://centos-webpanel.com/website-ddos-protection-proxy

Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp


Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor


Do you need Fast and FREE Support included for your CWP linux server?
http://centos-webpanel.com/noc-partner-list
Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services

Offline
***
Re: How to add custom built module to left menu?
« Reply #7 on: November 27, 2014, 03:26:37 PM »
/usr/local/cwpsrv/htdocs/resources/admin/include/menu.php add include("3rdparty.php"); befor ?>

and upload 3rdparty.php to
/usr/local/cwpsrv/htdocs/resources/admin/include  Menu is work fine :)

Thank you.

Due to inhability to recreate menú, i have put mine by hand, avoiding subelements and using right arrow.
Also, the include on menu.php it's out of mainnav div, so menú from 3rdparty breaks.

I have added static element:
Code: [Select]
<div class="mainnav">
    <li>
        <a href="index.php?module=dns_commit" class="hasUl"><span class="icon16 wpzoom-cord blue"></span>DNS auto-commit<span class="hasDrop icon16 icomoon-icon-arrow-right-3 blue"></span></a>
    </li>
</div>



Waiting for the new developer menú system :P
8==D it's a function that try to compare 8 (int) against D (string) which returns True or False depending on the asker.

Offline
*
Re: How to add custom built module to left menu?
« Reply #8 on: November 27, 2014, 08:57:49 PM »
great, if you build something useful send it to support contact and it can be checked for adding into the new release of the CWP.
AntiDDoS Protection (web + mail)
http://centos-webpanel.com/website-ddos-protection-proxy

Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp


Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor


Do you need Fast and FREE Support included for your CWP linux server?
http://centos-webpanel.com/noc-partner-list
Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services

Offline
***
Re: How to add custom built module to left menu?
« Reply #9 on: December 01, 2014, 11:40:34 PM »
Of course.

Just delayed with it, cuz i've find a cleaner way to it so i've started again.
No one is waiting more than me :D
8==D it's a function that try to compare 8 (int) against D (string) which returns True or False depending on the asker.

Offline
*
Re: How to add custom built module to left menu?
« Reply #10 on: May 13, 2015, 06:46:38 PM »
Simple solution to adding custom built menu's to CWP 0.9.8.6 without needing to use the developer menu

Step #1 - Build your module, and add it to module directory for the admin panel.

ifconfig.php:
Code: [Select]
<?php
if(!isset($include_path)){
    echo(
"invalid access");
}else{
    
$ifconfig shell_exec("ifconfig");
    echo(
"<h3>IFCONFIG</h3><pre>".$ifconfig."</pre>");
}
?>

save your module into the admin modules directory.
/usr/local/cwpsrv/htdocs/resources/admin/modules/ifconfig.php

Step #2 - create a file named 3rdparty.php in /usr/local/cwpsrv/htdocs/resources/admin/include

The default way this file works is meant to let users add modules to the submenu Developer Menu.

The file expects modules to be added as list items like the following:
Code: [Select]
<li><a href="index.php?module=ifconfig"><span class="icon16 icomoon-icon-arrow-right-3"></span>Network Interface</a></li>
However with some minor changes we can create our own menu to use instead of the Developer Menu.

3rdparty.php:
Code: [Select]
<?php
/* File: /usr/local/cwpsrv/htdocs/resources/admin/include/3rdparty.php */
?>

</ul></li> <!-- This line closes the opened submenu tag and menu item for the Developer menu -->

<li class="custom-menu"> <!-- this class "custom-menu" was added so you can remove the Developer Menu easily if you want -->
    <a class="hasUl" href="#"><span class="icon16 icomoon-icon-hammer"></span>MY CUSTOM MENU<span class="hasDrop icon16 icomoon-icon-arrow-down-2"></span></a>
    <ul class="sub">
        <li><a href="index.php?module=ifconfig"><span class="icon16 icomoon-icon-arrow-right-3"></span>Network Interface</a></li>
    </ul>
</li>

<li style="display:none;"><ul> <!-- This line opens a new menu item and submenu that's hidden because CWP will add closing ul and li tags to the end of this file -->
<?php
/* End 3rdparty.php */
?>

Now we have added a new menu with the title "MY CUSTOM MENU" and have added the ifconfig module we built to it.

If you want to add more menus then you simply create another menu block in 3rdparty.php like so:
3rdparty.php:
Code: [Select]
<?php
/* File: /usr/local/cwpsrv/htdocs/resources/admin/include/3rdparty.php */
?>

</ul></li> <!-- This line closes the opened submenu tag and menu item for the Developer menu -->

<li class="custom-menu"> <!-- this class "custom-menu" was added so you can remove the Developer Menu easily if you want -->
    <a class="hasUl" href="#"><span class="icon16 icomoon-icon-hammer"></span>MY CUSTOM MENU<span class="hasDrop icon16 icomoon-icon-arrow-down-2"></span></a>
    <ul class="sub">
        <li><a href="index.php?module=ifconfig"><span class="icon16 icomoon-icon-arrow-right-3"></span>Network Interface</a></li>
    </ul>
</li>

<li>
    <a class="hasUl" href="#"><span class="icon16 icomoon-icon-hammer"></span>IM ANOTHER MENU<span class="hasDrop icon16 icomoon-icon-arrow-down-2"></span></a>
    <ul class="sub">
        <li><a href="index.php?module=ifconfig"><span class="icon16 icomoon-icon-arrow-right-3"></span>Network Interface</a></li>
    </ul>
</li>

<li style="display:none;"><ul> <!-- This line opens a new menu item and submenu that's hidden because CWP will add closing ul and li tags to the end of this file -->
<?php
/* End 3rdparty.php */
?>

And now there is a second new menu titled "IM ANOTHER MENU" now you can organize your modules better.
But I will write a proper module to handle menu modification to handle the menu from the UI.

If you would like to hide the Developer Menu because you aren't using it like me then you may hide it with a little jquery.
You can add this script to the end of the /usr/local/cwpsrv/htdocs/resources/admin/include/3rdparty.php
Code: [Select]
<script type='text/javascript'>$(document).ready(function(){$(".custom-menu").prev("LI").css("display","none");});</script>
That's all for now I hope you enjoyed this and can make use of it.
I have just begun to play with CentOS WebPanel but I have so many ideas of how to add some really cool stuff. it's just too bad a lot of the code is obfuscated because I would love to help build some of this stuff.
« Last Edit: May 13, 2015, 09:21:21 PM by cyberxwolf »
System Stats
 Memory RAM: 1.63GB / 127GB ( 1.3%)
 Swap Memory: 0GB / 4GB ( 0% )
 Disk Space: 7.2TB

System Info
 CPU Model:  Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz 
 CPU Details: 12 Core (2100 MHz)
 Distro Name: CentOS release 6.6 (Final) 
 Kernel Version: 2.6.32-504.16.2.el6.x86_64 
 Platform: x86_64 [Dedicated]
 Server Time: Thu May 14 02:01:13 EDT 2015

Offline
*
Re: How to add custom built module to left menu?
« Reply #11 on: May 14, 2015, 04:49:30 AM »
Here is another easier way to add new menus.

create /usr/local/cwpsrv/htdocs/resources/admin/include/3rdparty.php

Code: [Select]
<li>
<script type="text/javascript">
function add_custom_menu($icon_class,$menu_title,$sub_menu_items){
    $the_submenus = "";
    $.each($sub_menu_items,function(ind,itm){
    $the_submenus += "<li><a href='"+itm.link+"'><span class='icon16 icomoon-icon-arrow-right-3'></span>"+itm.link_title+"</a></li>";   
    });
    $(".mainnav > ul").append("<li><a href='#' onmousedown='javascript:return false;'><span class='icon16 "+$icon_class+"'></span>"+$menu_title+"<span class='hasDrop icon16 icomoon-icon-arrow-down-2'></span></a><ul class='sub'>"+$the_submenus+"</ul></li>");
}

//Add your menu items with the add_custom_menu function.

$(function(){
    add_custom_menu("icomoon-icon-hammer","MY NEW MENU 1",[{"link":"index.php?module=example","link_title":"TEST LINK 1"},{"link":"index.php?module=example","link_title":"TEST LINK 2"},{"link":"index.php?module=example","link_title":"TEST LINK 3"}]);
    add_custom_menu("icomoon-icon-hammer","MY NEW MENU 2",[{"link":"index.php?module=example","link_title":"TEST LINK 4"},{"link":"index.php?module=example","link_title":"TEST LINK 5"},{"link":"index.php?module=example","link_title":"TEST LINK 6"}]);

});
</script>
</li>
« Last Edit: May 14, 2015, 04:58:49 AM by cyberxwolf »
System Stats
 Memory RAM: 1.63GB / 127GB ( 1.3%)
 Swap Memory: 0GB / 4GB ( 0% )
 Disk Space: 7.2TB

System Info
 CPU Model:  Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz 
 CPU Details: 12 Core (2100 MHz)
 Distro Name: CentOS release 6.6 (Final) 
 Kernel Version: 2.6.32-504.16.2.el6.x86_64 
 Platform: x86_64 [Dedicated]
 Server Time: Thu May 14 02:01:13 EDT 2015

Offline
**
Re: How to add custom built module to left menu?
« Reply #12 on: October 24, 2017, 03:29:28 PM »
Much easier and faster way to add custom menu to the left mainnav using jQuery.
Just paste that js code in 3rdparty.php and it will be activated once whole page is completely loaded.

Example 1 (with submenus, number of sub menus as many as you want):
Code: (javascript) [Select]
<script type="text/javascript">
$(document).ready(function() {
var newButtons = ''
+' <li>'
+' <a href="#" class="hasUl"><span aria-hidden="true" class="icon16 icomoon-icon-question"></span>Custom Menu<span class="hasDrop icon16 icomoon-icon-arrow-down-2"></span></a>'
+' <ul class="sub">'
+' <li><a href="#1"><span class="icon16 icomoon-icon-arrow-right-3"></span>Sub 1</a></li>'
+' <li><a href="#2"><span class="icon16 icomoon-icon-arrow-right-3"></span>Sub 2</a></li>'
+' <li><a href="#3"><span class="icon16 icomoon-icon-arrow-right-3"></span>Sub 3</a></li>'
+' </ul>'
+'</li>';
$(".mainnav > ul").append(newButtons);
});
</script>

Example 2 (without submenus, direct link):
Code: (javascript) [Select]
<script type="text/javascript">
$(document).ready(function() {
var newButtons = ''
+'<li><a href="#your_link_here"><span aria-hidden="true" class="icon16 icomoon-icon-question"></span>Custom Menu 2</a></li>'
+'<li><a href="#your_link_here"><span aria-hidden="true" class="icon16 icomoon-icon-question"></span>Custom Menu 3</a></li>'
+'<li><a href="#your_link_here"><span aria-hidden="true" class="icon16 icomoon-icon-question"></span>Custom Menu 4</a></li>'
;
$(".mainnav > ul").append(newButtons);
});
</script>
« Last Edit: October 24, 2017, 03:56:44 PM by Gogo »