From: <ma...@us...> - 2012-12-02 16:21:04
|
Revision: 10299 http://sourceforge.net/p/xoops/svn/10299 Author: mageg Date: 2012-12-02 16:21:02 +0000 (Sun, 02 Dec 2012) Log Message: ----------- add printer page in page module Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/css/styles.css XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/language/english/main.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_viewpage.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/xoops_version.php Added Paths: ----------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/print.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_print.html Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/css/styles.css =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/css/styles.css 2012-12-02 15:44:57 UTC (rev 10298) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/css/styles.css 2012-12-02 16:21:02 UTC (rev 10299) @@ -87,4 +87,21 @@ padding-top: 5px; } +#page-print { + width: 640px; + border: 1px solid #575757; + padding: 10px; + margin: 2px +} +#page-logo-print { + text-align: center; + margin: 20px; +} + +#page-footer-print { + width: 640px; + padding: 1px; + text-align: center; + margin: 20px 2px 20px 2px; +} Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/language/english/main.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/language/english/main.php 2012-12-02 15:44:57 UTC (rev 10298) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/language/english/main.php 2012-12-02 16:21:02 UTC (rev 10299) @@ -34,9 +34,15 @@ define("_MD_PAGE_VIEWPAGE_RATING","Rating"); define("_MD_PAGE_VIEWPAGE_VOTE","votes"); define("_MD_PAGE_VIEWPAGE_SUMMARY","Summary"); +define("_MD_PAGE_VIEWPAGE_PRINT","Printer page"); // rating.php define("_MD_PAGE_RATING_DONOTVOTE","Do not vote for your own files."); define("_MD_PAGE_RATING_VOTEONCE","Please do not vote for the same resource more than once."); define("_MD_PAGE_RATING_CONFIRM","Are you sure you want to give the note %s for page '%s'?"); -define("_MD_PAGE_RATING_THANKS","Thank you for your vote"); \ No newline at end of file +define("_MD_PAGE_RATING_THANKS","Thank you for your vote"); + +// print.php +define("_MD_PAGE_PRINT","Print"); +define("_MD_PAGE_PRINT_COMES","This article comes from"); +define("_MD_PAGE_PRINT_URL","The URL for this page is: "); \ No newline at end of file Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/print.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/print.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/print.php 2012-12-02 16:21:02 UTC (rev 10299) @@ -0,0 +1,96 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +/** + * page module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package page + * @since 2.6.0 + * @author Mage Gr\xE9gory (AKA Mage) + * @version $Id$ + */ + +include_once 'header.php'; +$tpl = new XoopsTpl(); + +// Get ID +$content_id = $system->cleanVars($_REQUEST, 'id', 0, 'int'); +// Get handler +$content_Handler = $xoops->getModuleHandler('page_content'); +$related_Handler = $xoops->getModuleHandler('page_related'); + +$view_content = $content_Handler->get($content_id); + +// Test if the page exist +if (count($view_content) == 0 || $view_content->getVar('content_status') == 0){ + $xoops->redirect('index.php', 3, _MD_PAGE_VIEWPAGE_NOPAGE); + exit(); +} + +// Permission to view +$perm_view = ($gperm_handler->checkRight('page_view_item', $content_id, $groups, $xoopsModule->getVar('mid'), false)) ? true : false ; +if(!$perm_view || $view_content->getVar('content_doprint') == false) { + $xoops->redirect("javascript:history.go(-1)", 2, _NOPERM); + exit(); +} + +$tpl->assign('content_id' , $content_id); +$tpl->assign('content_title' , $view_content->getVar('content_title')); +$tpl->assign('content_shorttext' , $view_content->getVar('content_shorttext')); +$tpl->assign('content_text' , $view_content->getVar('content_text')); +$tpl->assign('content_author' , XoopsUser::getUnameFromId($view_content->getVar('content_author'))); +$tpl->assign('content_authorid' , $view_content->getVar('content_author')); +$tpl->assign('content_hits' , sprintf(_MD_PAGE_VIEWPAGE_HITS, $view_content->getVar('content_hits'))); +$tpl->assign('content_date' , XoopsLocal::formatTimestamp($view_content->getVar('content_create'), $xoops->getModuleConfig('page_dateformat'))); +$tpl->assign('content_time' , XoopsLocal::formatTimestamp($view_content->getVar('content_create'), $xoops->getModuleConfig('page_timeformat'))); +$tpl->assign('content_comments' , $view_content->getVar('content_comments')); +$tpl->assign('content_rating' , number_format($view_content->getVar('content_rating'), 1)); +$tpl->assign('content_votes' , $view_content->getVar('content_votes')); +$tpl->assign('content_doauthor', $view_content->getVar('content_doauthor')); +$tpl->assign('content_dodate', $view_content->getVar('content_dodate')); +$tpl->assign('content_domail', $view_content->getVar('content_domail')); +$tpl->assign('content_dohits', $view_content->getVar('content_dohits')); +$tpl->assign('content_dorating', $view_content->getVar('content_dorating')); +$tpl->assign('content_dotitle', $view_content->getVar('content_dotitle')); +if ($view_content->getVar('content_docoms') == false){ + $ncoms = false; +} elseif ($view_content->getVar('content_doncoms') == false){ + $ncoms = false; +} else { + $ncoms = true; +} +$tpl->assign('content_doncoms', $ncoms); +if ($view_content->getVar('content_dotitle') == false && $view_content->getVar('content_dorating') == false) { + $header = false; +} else { + $header = true; +} +$tpl->assign('content_doheader', $header); +if ($view_content->getVar('content_doauthor') == false && $view_content->getVar('content_dodate') == false && $view_content->getVar('content_dohits') == false && $ncoms == false) { + $footer = false; +} else { + $footer = true; +} +$tpl->assign('content_dofooter', $footer); + +$page = new Page(); + +$related = $page->menu_related($content_id); + +if ($related['domenu'] ) { + $tpl->assign('summary', $related['summary']); +} +$tpl->assign('xoops_sitename', $xoops->getConfig('sitename')); +// Meta +$tpl->assign('xoops_pagetitle', strip_tags($view_content->getVar('content_title') . ' - ' . _MD_PAGE_PRINT . ' - ' . $xoopsModule->name())); +$tpl->display(dirname(__FILE__) . '/templates/page_print.html'); \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/print.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_print.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_print.html (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_print.html 2012-12-02 16:21:02 UTC (rev 10299) @@ -0,0 +1,91 @@ +<!DOCTYPE html> +<html lang="<{$xoops_langcode}>"> +<head> + <!-- Title and meta --> + <meta http-equiv="content-type" content="text/html; charset=<{$xoops_charset}>" /> + <title><{$xoops_pagetitle}> - <{$xoops_sitename}></title> + <meta name="robots" content="noindex,nofollow" /> + + <meta name="generator" content="XOOPS" /> + + <!-- Xoops style sheet --> + <link rel="stylesheet" type="text/css" media="screen" href="<{xoAppUrl xoops.css}>" /> + <link rel="stylesheet" type="text/css" media="screen" href="<{xoAppUrl media/xoops/css/icons.css}>" /> + <link rel="stylesheet" type="text/css" media="screen" href="<{xoAppUrl media/bootstrap/css/bootstrap.min.css}>" /> + <link rel="stylesheet" type="text/css" media="screen" href="<{xoImgUrl media/bootstrap/css/xoops.bootstrap.css}>" /> + <link rel="stylesheet" type="text/css" media="screen" href="<{$xoops_url}>/modules/page/css/styles.css" /> + <!--<link rel="stylesheet" type="text/css" media="screen" href="<{xoAppUrl media/bootstrap/css/bootstrap-responsive.min.css}>" />--> + <!-- Theme style sheet --> + <link rel="stylesheet" type="text/css" media="screen" href="<{xoImgUrl css/style.css}>" /> + <!--[if lte IE 8]> + <link rel="stylesheet" href="<{xoImgUrl styleIE8.css}>" type="text/css" /> + <![endif]--> + + <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements --> + <!--[if lt IE 9]> + <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> + <![endif]--> + +</head> +<!--<body class="<{$xoops_langcode}>" onload="window.print()">--> +<body class="<{$xoops_langcode}>"> + <div id="page-print"> + <div id="page-logo-print"> + <img src="<{$xoops_url}>/images/logo.png" alt="<{$xoops_sitename}>" /> + </div> + <{if $content_doheader}> + <div class="page_header"> + + <{if $content_dotitle}> + <div class="page_headerleft"> + <{$content_title}> + </div> + <{/if}> + </div> + <{if $content_dorating}> + <div class="page_vote"> + <{$smarty.const._MD_PAGE_VIEWPAGE_RATING}>: <{$content_rating}> (<{$content_votes}> <{$smarty.const._MD_PAGE_VIEWPAGE_VOTE}>) + </div> + <{/if}> + <{/if}> + <div class="page_content"> + <{if $summary}> + <h4><{$smarty.const._MD_PAGE_VIEWPAGE_SUMMARY}>:</h4> + <div> + <ul> + <{foreach item=summary from=$summary}> + <li><{$summary}></li> + <{/foreach}> + </ul> + </div> + <{/if}> + <{$content_shorttext}> + <br /> + <{$content_text}> + </div> + <{if $content_dofooter}> + <div class="page_footer"> + + <div class="page_footerleft"> + <{if $content_doauthor}><{$smarty.const._MD_PAGE_VIEWPAGE_POSTEDBY}> <a href="<{$xoops_url}>/userinfo.php?uid=<{$content_authorid}>"><{$content_author}></a> <{/if}><{if $content_dodate}><{$smarty.const._MD_PAGE_VIEWPAGE_ON}> <{$content_date}> <{$content_time}> <{/if}><{if $content_dohits}><{$content_hits}><{/if}> + </div> + <{if $content_doncoms}> + <div class="page_footerright"> + <img src="<{$xoops_url}>/modules/page/images/comments.png" alt="<{$content_comments}>"/> (<{$content_comments}> <{$smarty.const._MD_PAGE_VIEWPAGE_COMMENTS}>) + </div> + <{/if}> + </div> + <{/if}> + </div> + <div id="page-footer-print"> + <{$smarty.const._MD_PAGE_PRINT_COMES}> <{$xoops_sitename}> + <br /> + <a href="<{$xoops_url}>" title="<{$xoops_sitename}>"><{$xoops_url}></a> + <br /> + <br /> + <{$smarty.const._MD_PAGE_PRINT_URL}> + <br /> + <a href="<{$xoops_url}>/modules/page/viewpage.php?id=<{$content_id}>" title="<{$xoops_sitename}>"><{$xoops_url}>/modules/page/viewpage.php?id=<{$content_id}></a> + </div> +</body> +</html> \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_viewpage.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_viewpage.html 2012-12-02 15:44:57 UTC (rev 10298) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_viewpage.html 2012-12-02 16:21:02 UTC (rev 10299) @@ -48,6 +48,12 @@ <{includeq file="module:page|page_navigation.html"}> <div class="clear"></div> <{/if}> + + <div class="right"> + <{if $content_doprint}> + <a href="<{$xoops_url}>/modules/page/print.php?id=<{$content_id}>" title="<{$smarty.const._MD_PAGE_VIEWPAGE_PRINT}>"><img src="<{xoAppUrl media/xoops/images/icons/16/printer.png}>" alt="<{$smarty.const._MD_PAGE_VIEWPAGE_PRINT}>" /></a> + <{/if}> + </div> </div> <{if $content_dofooter}> <div class="page_footer"> Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/xoops_version.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/xoops_version.php 2012-12-02 15:44:57 UTC (rev 10298) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/xoops_version.php 2012-12-02 16:21:02 UTC (rev 10299) @@ -83,6 +83,7 @@ // Templates $modversion['templates'][] = array( 'file' => 'page_index.html', 'description' => '' ); $modversion['templates'][] = array( 'file' => 'page_viewpage.html', 'description' => '' ); +$modversion['templates'][] = array( 'file' => 'page_print.html', 'description' => '' ); // blocks $i = 0; |