$cgiDir = $nof_rootDir ."/". $nof_scriptDir . "/";
$componentid = $nof_componentId;
$xml_file = $nof_scriptInterfaceFile;
if (NOF_fileExists($cgiDir . "nw_lib.php")) {
include_once($cgiDir."nw_lib.php");
} else {
exit();
}
$conf = parseXmlFile($cgiDir.$xml_file);
$SNCompIdent = "view" . "." . $componentid . ".";
$showdate = $conf[$SNCompIdent."showDate"];
$dateformat = $conf[$SNCompIdent."dateFormat"];
$timeformat = $conf[$SNCompIdent."timeFormat"];
$timezone = $conf[$SNCompIdent."timeZone"];
$timezone = $timezone*3600;
$newsTitle = $conf[$SNCompIdent."newsTitle"];
$linkTitle = $conf[$SNCompIdent."linkHeadline"];
$readmoreLink = $conf[$SNCompIdent."detailsLink"];
$showDetailsLink = $conf[$SNCompIdent."detailsLink.show"];
$pageSize = $conf[$SNCompIdent.'pageSize'];
$dbPath = $conf[$SNCompIdent.'dbPath'];
$fullStoryLocation = $conf[$SNCompIdent.'detailsPage'];
$openInNew = $conf[$SNCompIdent.'detailsPage.popup'];
$labels = explode(",", $conf[$SNCompIdent."fields"]);
$showtitle = substr($labels[0],0,1) == "1" ? true : false;
$titlereq = substr($labels[0],1,1) == "1" ? true : false;
$titlelabel = substr($labels[0],2);
$showshortmessage = substr($labels[1],0,1) == "1" ? true : false;
$shortmessagereq = substr($labels[1],1,1) == "1" ? true : false;
$shortmessagelabel = substr($labels[1],2);
$showfullmessage = substr($labels[2],0,1) == "1" ? true : false;
$fullmessagereq = substr($labels[2],1,1) == "1" ? true : false;
$fullmessagelabel = substr($labels[2],2);
$showauthor = substr($labels[3],0,1) == "1" ? true : false;
$authorreq = substr($labels[3],1,1) == "1" ? true : false;
$authorlabel = substr($labels[3],2);
$showpicture = substr($labels[4],0,1) == "1" ? true : false;
$picturereq = substr($labels[4],1,1) == "1" ? true : false;
$picturelabel = substr($labels[4],2);
$flag_emptydb=0;
$lines_array=array();
$numberoflines=0;
if (!file_exists($cgiDir.$dbPath)) {
$flag_emptydb=1;
}else{
$lines_array=nwgetdb($cgiDir.$dbPath,1);
$numberoflines = sizeof($lines_array);
if ( $pageSize == 0 ) {
$pageSize = $numberoflines;
}
$picture_pos="";
foreach($fields_array as $key => $value){
if(trim($value)=="validation"){
$validation_pos=$key;
}
if(trim($value)=="title"){
$title_pos=$key;
}
if(trim($value)=="shortmessage"){
$shortmessage_pos=$key;
}
if(trim($value)=="fullmessage"){
$fullmessage_pos=$key;
}
if(trim($value)=="author"){
$author_pos=$key;
}
if(trim($value)=="image"){
$picture_pos=$key;
}
if(trim($value)=="date"){
$date_pos=$key;
}
if(trim($value)=="id"){
$id_pos=$key;
}
}
}
$offset=1;
if ( GetGVariable('nwoffset') != '' ) { $offset = GetGVariable('nwoffset'); }
$extraVars = '';
?>
|
|
if ( $flag_emptydb==0 and $numberoflines!=0 ) {
displaypages($offset,$numberoflines,$pageSize,5,$extraVars);
}
?>
|
$start=$offset-1;
$inc=1;
while($start>=0 and $start<$numberoflines and $inc<=$pageSize and $lines_array[$start]){
$fullStoryLink = GetServerVariable('PHP_SELF') . "?nwoffset=" . strval($start+1) . "&vw=item";
$onClickAction = "";
if ( $openInNew == "true" ) {
$fullStoryLink = "javascript:void(0);";
$onClickAction = "javascript:window.open('".$cgiDir."nw_viewitempopup.php?nwoffset=".strval(strval($start+1))."','detailsWindow','left=' + window.screen.availWidth*20/100 + ',top=' + window.screen.availHeight*20/100 + ',width=500,toolbar=0,resizable=1,scrollbars=1,location=0');";
} elseif ( $fullStoryLocation != "" ) {
$fullStoryLink = $fullStoryLocation."?nwoffset=" . strval($start+1);
}
?>
if ( $showdate == "true" ) {
echo ''.displayDate($lines_array[$start][$date_pos], $dateformat, $timeformat, $timezone).'';
echo '
';
echo ' ';
}
?>
if ( $linkTitle == "true" ) {
echo ''
.htmlspecialchars($lines_array[$start][$title_pos]).'';
} else {
echo htmlspecialchars($lines_array[$start][$title_pos]);
}
?>
=htmlEncode(htmlspecialchars($lines_array[$start][$shortmessage_pos]))?>
if ( $showDetailsLink == "true" ) { ?>
=$readmoreLink?>
} ?>
if ( $showauthor ) { ?>
=htmlspecialchars($lines_array[$start][$author_pos])?>
} ?>
|
$inc++;
$start++;
}
if(sizeof($lines_array)==0){
?>
| =$GLOBALS['nof_resources']->get('nw.Text.NoNews')?> |
}
?>
|
|