Current time: 11-25-2024, 04:31 PM Hello There, Guest! (LoginRegister)


Thread Closed 
[HowTO] add cronjob on Debian Lenny Improved
Author Message
koko92_national Offline
Junior Member
*

Posts: 70
Joined: Jul 2008
Reputation: 0
Post: #4
RE: [HowTO] add cronjob on Debian Lenny Improved
Ok i have made modifications for the "edit & delete" when no cron jobs:

Open cronjob_overview.php and replace with:
PHP Code:
<?php
/*
* (с) 2009, Russia, Moscow
* Serge Obookhoff AKA Hong Lee
* www.data-stream.ru && www.veterinars.ru
* Last Revision at 01/2009
*     Written for ispCP Team (www.isp-control.net) ONLY.
*     Written using the old, dead blanks VHCS.
* All Functions rewritten.
*
* Notice: If you use this script you have own risks.
*
*
* Modified on 29-12-2009 by xtc007
* Functionality added : fixed white square display in top on 1.0.3
* RT Media Inc ~ www.rtmedia.ca

*/

require '../include/ispcp-lib.php';

check_login(__FILE__);

$tpl = new pTemplate();
$tpl->define_dynamic('page'Config::get('CLIENT_TEMPLATE_PATH') . '/cronjobs_overview.tpl');
$tpl->define_dynamic('page_message''page');
$tpl->define_dynamic('logged_from''page');
$tpl->define_dynamic('cronjobs''page');

$theme_color Config::get('USER_INITIAL_THEME');

$tpl->assign(
    array(
'TR_CLIENT_CRONJOBS_TITLE' => tr('ispCP - Client/Cronjob Manager'),
        
'THEME_COLOR_PATH' => "../themes/$theme_color",
        
'THEME_CHARSET' => tr('encoding'),
        
'ISP_LOGO' => get_logo($_SESSION['user_id'])
        )
    );

# Getting user's right to reading and using  the Jobs





function gen_cron_user(&$tpl, &$sql$domain) {

}

function 
gen_cron_jobs(&$tpl, &$sql$user_id) {

    
$query = <<<SQL_QUERY
        SELECT
            id, name, lastrun, activ, coment, domain
        FROM
            hcrondtab
        WHERE
            domain = 
$user_id
        ORDER BY
            id
SQL_QUERY;

    
$rs exec_query($sql$query, array($user_id));

    if (
$rs->RecordCount() == 0) {
        
$tpl->assign(
            array(
'NAME' => tr('Jobs list is empty!'),
                
'DESCRIPTION' => '',
                
'ACTIVE' => '',
                
'LASTRUN' => '',
                
'EDIT' => '',
                
'DELETE' => ''
                
)
            );

    } else {

        
$counter 0;
        while (!
$rs->EOF) {
            if (
$counter == 0) {
                
$tpl->assign('ITEM_CLASS''content');
            } else {
                
$tpl->assign('ITEM_CLASS''content2');
            }

            if (
$rs->fields['activ'] == 1) {$activ 'Yes';}
            else {
$activ 'No';};
            
$lastrun $rs->fields['lastrun'];
            if (
$lastrun == ) {$lastrun '';}
                else {
$lastrun date("Y-m-d H:i:s",$lastrun);}
            
$tpl->assign(
                array(
'NAME' => $rs->fields['name'],
                    
'DESCRIPTION' => $rs->fields['coment'],
                    
'LASTRUN' => $lastrun,
                    
'ACTIVE' => $activ,
                    
'ID'  => $rs->fields['id'],
                    
'EDIT' => '<img src="{THEME_COLOR_PATH}/images/icons/edit.png" width="16" height="16" align="absmiddle"> <a href="cronjobs_edit.php?cron_id={ID}" class="link">{TR_EDIT}</a>',
                    
'DELETE' => '<img src="{THEME_COLOR_PATH}/images/icons/delete.png" width="16" height="16" border="0" align="absmiddle"> <a href="#" class="link" onclick="action_delete(\'cronjobs_delete.php?cron_id={ID}\', \'{NAME}\')">{TR_DELETE}</a>'
                    
)
                );
            
$tpl->parse('CRONJOBS''.cronjobs');
            
$rs->MoveNext();
            
$counter++;
        }

    }

// End of gen_cron_job();

/*
 *
 * static page messages.
 *
 */

gen_client_mainmenu($tplConfig::get('CLIENT_TEMPLATE_PATH') . '/main_menu_webtools.tpl');
gen_client_menu($tplConfig::get('CLIENT_TEMPLATE_PATH') . '/menu_webtools.tpl');

gen_logged_from($tpl);

check_permissions($tpl);

gen_cron_jobs($tpl$sql$_SESSION['user_id']);

$tpl->assign(
    array(
'TR_CRON_MANAGER' => tr('Cronjob Manager'),
        
'TR_MESSAGE_DELETE' => tr('Are you sure you want to delete %s?'true'%s'),
        
'TR_CRONJOBS' => tr('Cronjobs'),
        
'TR_ACTIVE' => tr('Active'),
        
'TR_ACTION' => tr('Active'),
        
'TR_EDIT' => tr('Edit'),
        
'TR_DELETE' => tr('Delete'),
        
'TR_ADD' => tr('Add Cronjob')
        )
    );

gen_page_message($tpl);

$tpl->parse('PAGE''page');
$tpl->prnt();

if (
Config::get('DUMP_GUI_DEBUG'))
    
dump_gui_debug();

unset_messages();

?>

Open cronjobs_overview.tpl and replace with:
PHP Code:
<html>
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset={THEME_CHARSET}">
<
title>{TR_CLIENT_CRONJOBS_TITLE}</title>
  <
meta name="robots" content="noindex">
  <
meta name="robots" content="nofollow">
<
link href="{THEME_COLOR_PATH}/css/ispcp.css" rel="stylesheet" type="text/css">
<
script type="text/javascript" src="{THEME_COLOR_PATH}/css/ispcp.js"></script>
<script type="text/javascript">
<!--
function action_delete(url, name) {
    if (!confirm(sprintf("{TR_MESSAGE_DELETE}", name)))
        return false;
    location = url;
}
//-->
</script>
</head>

<body onload="MM_preloadImages('{THEME_COLOR_PATH}/images/icons/database_a.gif','{THEME_COLOR_PATH}/images/icons/domains_a.gif','{THEME_COLOR_PATH}/images/icons/ftp_a.gif','{THEME_COLOR_PATH}/images/icons/general_a.gif' ,'{THEME_COLOR_PATH}/images/icons/email_a.gif','{THEME_COLOR_PATH}/images/icons/webtools_a.gif','{THEME_COLOR_PATH}/images/icons/statistics_a.gif','{THEME_COLOR_PATH}/images/icons/support_a.gif')">
<!-- BDP: logged_from --><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="20" nowrap="nowrap" class="backButton">&nbsp;&nbsp;&nbsp;<a href="change_user_interface.php?action=go_back"><img src="{THEME_COLOR_PATH}/images/icons/close_interface.png" width="16" height="16" border="0" align="absmiddle"></a> {YOU_ARE_LOGGED_AS}</td>
      </tr>
    </table>
    <!-- EDP: logged_from -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%" style="border-collapse: collapse;padding:0;margin:0;">
<tr>
<td align="left" valign="top" style="vertical-align: top; width: 195px; height: 56px;"><img src="{THEME_COLOR_PATH}/images/top/top_left.jpg" border="0"></td>
<td style="height: 56px; width:100%; background-color: #0f0f0f"><img src="{THEME_COLOR_PATH}/images/top/top_left_bg.jpg" width="582"border="0"></td>
<td style="width: 73px; height: 56px;"><img src="{THEME_COLOR_PATH}/images/top/top_right.jpg" border="0"></td>
</tr>
    <tr>
        <td style="width: 195px; vertical-align: top;">{MENU}</td>
        <td colspan="2" style="vertical-align: top;"><table style="width: 100%; border-collapse: collapse;padding:0;margin:0;">
          <tr height="95">
            <td style="padding-left:30px; width: 100%; background-image: url({THEME_COLOR_PATH}/images/top/middle_bg.jpg);">{MAIN_MENU}</td>
            <td style="padding:0;margin:0;text-align: right; width: 73px;vertical-align: top;"><img src="{THEME_COLOR_PATH}/images/top/middle_right.jpg" border="0"></td>
          </tr>
          <tr>
            <td colspan="3"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="left"><table width="100%" cellpadding="5" cellspacing="5">
                    <tr>
                      <td width="25"><img src="{THEME_COLOR_PATH}/images/content/table_icon_tools.png" width="25" height="25"></td>
                      <td colspan="2" class="title">{TR_CRON_MANAGER}</td>
                    </tr>
                </table></td>
                <td width="27" align="right">&nbsp;</td>
              </tr>
              <tr>
                <td><table width="100%" cellpadding="5" cellspacing="5">
                    <!-- BDP: page_message -->
                    <tr>
                      <td width="25">&nbsp;</td>
                      <td colspan="3" class="title"><span class="message">{MESSAGE}</span></td>
                    </tr>
                    <!-- EDP: page_message -->
                    <tr>
                      <td width="25">&nbsp;</td>
                      <td class="content3"><strong>{TR_CRONJOBS}</strong></td>
                      <td align="center" class="content3"><strong>{TR_ACTIVE}</strong></td>
                      <td align="center" class="content3"><strong>Last Run</strong></td>
                      <td colspan="2" align="center" class="content3"><strong>{TR_ACTION}</strong></td>
                    </tr>
                    
                      <!-- BDP: cronjobs -->
            <tr>
                      <td nowrap="nowrap">&nbsp;</td>
                      <td nowrap="nowrap" class="{ITEM_CLASS}"><strong>{NAME}</strong><br>
                        {DESCRIPTION}</td>
                      <td width="100" align="center" nowrap="nowrap" class="{ITEM_CLASS}">{ACTIVE}</td>
                      <td width="150" align="center" nowrap="nowrap" class="{ITEM_CLASS}">{LASTRUN}</td>
                      <td width="100" nowrap="nowrap" class="{ITEM_CLASS}">{EDIT}</td>
                      <td width="100" nowrap="nowrap" class="{ITEM_CLASS}">{DELETE}</td>
                    </tr>
                      <!-- EDP: cronjobs -->
                    <tr>
                      <td nowrap="nowrap">&nbsp;</td>
                      <td colspan="4"><input name="button" type="button" class="button" onclick="MM_goToURL('parent','cronjobs_add.php');return document.MM_returnValue" value="{TR_ADD}"></td>
                    </tr>
                </table></td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
            </table></td>
          </tr>
        </table></td>
    </tr>
</table>
</body>
</html> 
12-31-2009 10:47 PM
Find all posts by this user
Thread Closed 


Messages In This Thread
blank page after instalation - pandjie - 06-05-2011, 11:43 AM
RE: blank page after instalation - mr.x - 06-05-2011, 04:20 PM
RE: [HowTO] add cronjob on Debian Lenny Improved - koko92_national - 12-31-2009 10:47 PM

Forum Jump:


User(s) browsing this thread: 14 Guest(s)