Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x
Author Message
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Sat Jan 21, 2012 3:11 am Reply with quote

The Project Tracking block contains malformed URI's
Here is the code block with fixes for that and additional enhancements for US Section 508 and WCAG accessibility compliance.
Block copyrights removed only for brevity.
Code:


if (!defined('BLOCK_FILE')) {
    Header('Location: ../index.php');
    die();
}

global $prefix, $db, $bgcolor1, $bgcolor2, $textcolor1;
//No way of autodetecting this short of a database entry
$module_name = 'Project_Tracking';
$content = '';

if (file_exists('modules/' . $module_name . '/includes/nsnpj_func.php')) {
    include_once('modules/' . $module_name . '/includes/nsnpj_func.php');

    $content = '<table style="margin-left:auto; margin-right:auto; border:1px; border-style:solid; width:100%;" cellpadding="2" cellspacing="0">' . "\n";
    $content .= '<tr>' . "\n";
    $content .= '<td style="width:100%; background-color:' . $bgcolor2 . '; text-align:center;" colspan="2" class="thick">' . _PJ_PROJECTNAME . '</td>' . "\n";
    $content .= '<td style="margin-left:auto; margin-right:auto; background-color:' . $bgcolor2 . '; white-space:nowrap;" class="thick">' . _PJ_SITE . '</td>' . "\n";
    $content .= '<td style="margin-left:auto; margin-right:auto; background-color:' . $bgcolor2 . '; white-space:nowrap;" class="thick">' . _PJ_TASKS . '</td>' . "\n";
    $content .= '<td style="margin-left:auto; margin-right:auto; background-color:' . $bgcolor2 . '; white-space:nowrap;" class="thick">' . _PJ_REPORTS . '</td>' . "\n";
    $content .= '<td style="margin-left:auto; margin-right:auto; background-color:' . $bgcolor2 . '; white-space:nowrap;" class="thick">' . _PJ_REQUESTS . '</td>' . "\n";
    $content .= '<td style="margin-left:auto; margin-right:auto; background-color:' . $bgcolor2 . '; white-space:nowrap;" class="thick">' . _PJ_STATUS . '</td>' . "\n";
    $content .= '<td style="margin-left:auto; margin-right:auto; background-color:' . $bgcolor2 . '; white-space:nowrap;" class="thick">' . _PJ_PROGRESSBAR . '</td>' . "\n";
    $content .= '</tr>' . "\n";

    $projectresult = $db->sql_query('SELECT project_id FROM ' . $prefix . '_nsnpj_projects WHERE featured ="1" ORDER BY weight');
    while (list($project_id) = $db->sql_fetchrow($projectresult)) {
        $project = pjprojectpercent_info($project_id);
        $projectstatus = pjprojectstatus_info($project['status_id']);
        $pjimage = pjimage('project.png', $module_name);
        $content .= '<tr>
            <td style="margin-left:auto; margin-right:auto; border:0.2px; border-style:solid; border-color:' . $textcolor1 . ';"><img src="' . $pjimage . '" alt="' . $project['project_name'] . '" title="" /></td>' . "\n";
        $content .= '<td style="width:100%; border:0.2px; border-style:solid; border-color:' . $textcolor1 . ';"><a href="modules.php?name=' . $module_name . '&amp;op=PJProject&amp;project_id=' . $project_id . '">' . $project['project_name'] . '</a></td>' . "\n";

        if ($project['project_site'] > '') {
            $pjimage = pjimage('demo.png', $module_name);
            $demo = ' <a href="' . $project['project_site'] . '" target="_blank" title="' . $project['project_name'] . '">
                <img src="' . $pjimage . '" alt="' . $project['project_name'] . '"  /></a>';
        } else {
            $demo = '&nbsp;';
        }

        $content .= '<td style="margin-left:auto; margin-right:auto; border:0.2px; border-style:solid; border-color:' . $textcolor1 . ';">' . $demo . '</td>' . "\n";
        $numtasks = $db->sql_numrows($db->sql_query('SELECT * FROM ' . $prefix . '_nsnpj_tasks WHERE project_id=' . $project_id));

        if (!$numtasks) {
            $numtasks = 0;
        }

        $content .= '<td style="text-align:center; margin-left:auto; margin-right:auto; border:0.2px; border-style:solid; border-color:' . $textcolor1 . ';">' . $numtasks . '</td>' . "\n";
        if ($project['allowreports'] > 0) {
            $numreports = $db->sql_numrows($db->sql_query('SELECT * FROM ' . $prefix . '_nsnpj_reports WHERE project_id=' . $project_id));
            if (!$numreports) {
                $numreports = 0;
            }

            $content .= '<td style="text-align:center; margin-left:auto; margin-right:auto; border:0.2px; border-style:solid; border-color:' . $textcolor1 . ';">' . $numreports . '</td>' . "\n";
        } else {
            $content .= '<td style="margin-left:auto; margin-right:auto; border:0.2px; border-style:solid; border-color:' . $textcolor1 . ';">----</td>' . "\n";
        }

        if ($project['allowrequests'] > 0) {
            $numrequests = $db->sql_numrows($db->sql_query('SELECT * FROM ' . $prefix . '_nsnpj_requests WHERE project_id=' . $project_id));

            if (!$numrequests) {
                $numrequests = 0;
            }

            $content .= '<td style="text-align:center; margin-left:auto; margin-right:auto; border:0.2px; border-style:solid; border-color:' . $textcolor1 . ';">' . $numrequests . '</td>' . "\n";
        } else {
            $content .= '<td style="margin-left:auto; margin-right:auto; border:0.2px; border-style:solid; border-color:' . $textcolor1 . ';">----</td>' . "\n";
        }

        if ($projectstatus['status_name'] == "") {
            $projectstatus['status_name'] = _PJ_NA;
        }

        $content .= '<td style="margin-left:auto; margin-right:auto; border:0.2px; border-style:solid; border-color:' . $textcolor1 . ';">' . $projectstatus['status_name'] . '</td>' . "\n";
        $pjimage = pjimage('bar_left.png', $module_name);
        $content .= '<td style="border:0.2px; border-style:solid; border-color:' . $textcolor1 . '; white-space:nowrap;"><img src="' . $pjimage . '" height="7" width="1" alt="" title="" />';
        if ($project['project_percent'] == 0) {
            $pjimage = pjimage('bar_center_red.png', $module_name);
            $content .= '<img src="' . $pjimage . '" height="7" width="100" alt="0' . _PJ_PERCENT . ' ' . _PJ_COMPLETED . '" title="0' . _PJ_PERCENT . ' ' . _PJ_COMPLETED . '" />';
        } else {
            if ($project['project_percent'] > 100) {
                $project_percent = 100;
            } else {
                $project_percent = $project['project_percent'];
            }

            $pjimage = pjimage('bar_center_grn.png', $module_name);
            $content .= '<img src="' . $pjimage . '" height="7" width="' . $project_percent . '" alt="' . $project_percent . _PJ_PERCENT . ' ' . _PJ_COMPLETED . '" title="' . $project_percent . _PJ_PERCENT . ' ' . _PJ_COMPLETED . '" />';

            if ($project_percent < 100) {
                $percent_incomplete = 100 - $project_percent;
                $pjimage = pjimage('bar_center_red.png', $module_name);
                $content .= '<img src="' . $pjimage . '" height="7" width="' . $percent_incomplete . '" alt="' . $project_percent . _PJ_PERCENT . ' ' . _PJ_COMPLETED . '" title="' . $project_percent . _PJ_PERCENT . ' ' . _PJ_COMPLETED . '" />';
            }
        }

        $pjimage = pjimage('bar_right.png', $module_name);
        $content .= '<img src="' . $pjimage . '" height="7" width="1" alt="" title="" /></td>' . "\n";
        $content .= '</tr>' . "\n";
    }

    $content .= '</table>' . "\n";
} else {
    $content = 'The module ' . $module_name . 'could not be found.';
}
 
View user's profile Send private message Send e-mail
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sat Jan 21, 2012 4:51 pm Reply with quote

Thanks! I made this a sticky.
 
View user's profile Send private message
Raven







PostPosted: Sat Jan 21, 2012 4:54 pm Reply with quote

Please open a Mantis issue on this.
 
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Sat Jan 28, 2012 5:01 pm Reply with quote

This has been corrected.

_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©