Current File : /home/inlingua/www/decay_sym/root/var/softaculous/apps/perl/themes/admin/perl_modules_theme.php
<?php

//////////////////////////////////////////////////////////////
//===========================================================
// WEBUZO CONTROL PANEL
// Inspired by the DESIRE to be the BEST OF ALL
// ----------------------------------------------------------
// Started by: Mamta Malvi
// Date:       07 th April 2022
// Time:       21:00 hrs
// Site:       https://webuzo.com/ (WEBUZO)
// ----------------------------------------------------------
// Please Read the Terms of Use at https://webuzo.com/terms
// ----------------------------------------------------------
//===========================================================
// (c) Softaculous Ltd.
//===========================================================
//////////////////////////////////////////////////////////////

if(!defined('SOFTACULOUS')){
	die('Hacking Attempt');
}

function perl_modules_theme(){
	
	global $theme, $globals, $user, $PerlModList;

    $meta_cpan_doc_url = 'https://metacpan.org/pod/';
    echo'
    <style>
        .cpanLink { color : #000 !important; }
    </style>
    <div class="soft-smbox p-3">
			
		<div class="sai_main_head">
			<i class="fas fa-th-list me-2"></i>
			'.__('Install a Perl Module').'
			<span class="search_btn float-end">
				<a href="javascript:void(0);" class="text-dark" data-bs-toggle="collapse" data-bs-target="#search_queue" aria-expanded="true" aria-controls="search_queue" title="'.__('Search').'"><i class="fas fa-search"></i></a>
			</span>
		</div>
		<div class="mb-2 mt-2" style="background-color:#e9ecef;">
			<div class="collapse '.(!empty(optREQ('query')) ? 'show' : '').'" id="search_queue">
				<form accept-charset="'.$globals['charset'].'" name="search" id="search" method="post" action="'.$globals['ind'].'act=perl_modules" class="form-horizontal">
				<div class="row p-3 col-md-12 d-flex">
					<div class="col-12 col-md-4">
						&nbsp;<label class="sai_head">'.__('Available for installation').'</label>
						<input type="text" class="form-control mb-2" name="query" id="query" value="'.POSTval('query').'" placeholder="'.__('Find A Perl Module').'" s2-query="query" style="width: 100%">
					</div>
                    <div class="col-12 col-md-1">
                        <label class="sai_head"> </label>
                        <input class="btn btn-primary" type="submit" value="'.__('Find').'" style="margin-top:30px;">
                    </div>
				</div>
				</form>
			</div>
		</div>
	</div>	
    <div class="soft-smbox p-4 mt-4">    
        <div class="row my-3">
            <div class="col-md-3" style="width:100%;">
                <a href="'.$globals['ind'].'act=perl_module_install">
					<button style="float: right;" class="btn btn-primary">'.__('Installed Perl Modules').'</button>
				</a>
            </div>
        </div>';
        
        page_links();

        echo'
		<div class="table-responsive">
			<table class="table sai_form webuzo-table" >			
				<thead class="sai_head2" style="background-color: #EFEFEF;">
					<tr>
						<th class="align-middle">'.__('Module Name').'</th>
						<th class="align-middle">'.__('Description').'</th>
						<th class="align-middle text-center" colspan="2">'.__('Action').'</th>
					</tr>			
				</thead>
				<tbody>';

				if(!empty($PerlModList)){

					foreach($PerlModList as $k => $v){
						// $v = explode("|",$v);
						$ModuleName = $v[0];
						$ModuleVer = $v[1];
						$ModuleDown = $v[2];
						echo '
						<tr>
							<td>'.$ModuleName.' ('.$ModuleVer.')</td>
							<td>'.$ModuleDown.'</td>
							<td width="10%" onclick="submitit(\'module_name='.$ModuleName.'&action=install\')" style="cursor:pointer"><i class="fas fa-download"></i>&nbsp;'.__('Install').'</td>
							<td width="15%"><i class="fas fa-book"></i><a class="btn cpanLink" href='.$meta_cpan_doc_url.$ModuleName.' target="_blank">'.__('Show Docs').'</a></td>
						</tr>';
					}
				}else{
					echo '
					<tr>
						<td colspan="3" class="text-center">'.__('No Module Found...!').'</td>
					</tr>';
				}
				echo '
				</tbody>
			</table>
		</div>';		
	page_links();
    echo '
	</div>
	
	<script>
        $("#search").submit(function( event ) {
            let modName = $("#query").val();
            if(modName == "" || modName == "undefined"){
				var a = show_message_r("'.__js('Error').'", "'.__js('Please enter some Perl Module').'");
				a.alert = "alert-danger"
				show_message(a);
				return false;
				event.preventDefault();
            }
            else{
                form.submit();
            }
        });
    </script>';
	
}