From: <ma...@us...> - 2012-12-18 19:57:29
|
Revision: 10446 http://sourceforge.net/p/xoops/svn/10446 Author: mageg Date: 2012-12-18 19:57:26 +0000 (Tue, 18 Dec 2012) Log Message: ----------- add conversion to pdf and somes bugs in module page Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/index.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/form/page_content.php 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/print.php 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_viewpage.html Added Paths: ----------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/pdf.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_pdf.html Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/index.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/index.php 2012-12-18 19:54:45 UTC (rev 10445) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/index.php 2012-12-18 19:57:26 UTC (rev 10446) @@ -16,7 +16,7 @@ * @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) + * @author Mage Gr�gory (AKA Mage) * @version $Id$ */ include dirname(__FILE__) . '/header.php'; @@ -49,6 +49,7 @@ // extension $admin_page->addConfigBoxLine(array('xoosocialnetwork', 'warning'), 'extension'); +$admin_page->addConfigBoxLine(array('pdf', 'warning'), 'extension'); $admin_page->displayIndex(); $xoops->footer(); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/form/page_content.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/form/page_content.php 2012-12-18 19:54:45 UTC (rev 10445) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/form/page_content.php 2012-12-18 19:57:26 UTC (rev 10446) @@ -120,7 +120,9 @@ $checkbox->addOption('ncoms', _AM_PAGE_CONTENT_DONCOMS); $checkbox->addOption('notifications', _AM_PAGE_CONTENT_DONOTIFICATIONS); $checkbox->addOption('pdf', _AM_PAGE_CONTENT_DOPDF); - $checkbox->addOption('print', _AM_PAGE_CONTENT_DOPRINT); + if ($xoops->isActiveModule('pdf') == true) { + $checkbox->addOption('print', _AM_PAGE_CONTENT_DOPRINT); + } $checkbox->addOption('mail', _AM_PAGE_CONTENT_DOMAIL); if ($xoops->isActiveModule('xoosocialnetwork') == true) { $checkbox->addOption('social', _AM_PAGE_CONTENT_DOSOCIAL); 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-18 19:54:45 UTC (rev 10445) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/css/styles.css 2012-12-18 19:57:26 UTC (rev 10446) @@ -93,15 +93,3 @@ 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-18 19:54:45 UTC (rev 10445) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/language/english/main.php 2012-12-18 19:57:26 UTC (rev 10446) @@ -16,7 +16,7 @@ * @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) + * @author Mage Gr�gory (AKA Mage) * @version $Id$ */ //generic @@ -35,6 +35,7 @@ define("_MD_PAGE_VIEWPAGE_VOTE","votes"); define("_MD_PAGE_VIEWPAGE_SUMMARY","Summary"); define("_MD_PAGE_VIEWPAGE_PRINT","Printer page"); +define("_MD_PAGE_VIEWPAGE_PDF","PDF page"); // rating.php define("_MD_PAGE_RATING_DONOTVOTE","Do not vote for your own files."); Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/pdf.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/pdf.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/pdf.php 2012-12-18 19:57:26 UTC (rev 10446) @@ -0,0 +1,97 @@ +<?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. +*/ + +/** + * XXX + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @since 2.6.0 + * @author Mage Grégory (AKA Mage) + * @version $Id$ + */ +include_once 'header.php'; +$xoops = Xoops::getInstance(); +$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, $xoops->module->getVar('mid'), false)) ? true : false ; +if(!$perm_view || $view_content->getVar('content_dopdf') == false) { + $xoops->redirect("index.php", 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']); +} + +$content = $tpl->fetch('module:page|page_pdf.html'); + +$pdf = new Pdf(); +$pdf->writeHtml($content, false); +$pdf->Output('example.pdf'); \ No newline at end of file Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/pdf.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Modified: 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 2012-12-18 19:54:45 UTC (rev 10445) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/print.php 2012-12-18 19:57:26 UTC (rev 10446) @@ -16,7 +16,7 @@ * @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) + * @author Mage Gr�gory (AKA Mage) * @version $Id$ */ @@ -41,7 +41,7 @@ // Permission to view $perm_view = ($gperm_handler->checkRight('page_view_item', $content_id, $groups, $xoops->module->getVar('mid'), false)) ? true : false ; if(!$perm_view || $view_content->getVar('content_doprint') == false) { - $xoops->redirect("javascript:history.go(-1)", 2, _NOPERM); + $xoops->redirect("index.php", 2, _NOPERM); exit(); } Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_pdf.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_pdf.html (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_pdf.html 2012-12-18 19:57:26 UTC (rev 10446) @@ -0,0 +1,73 @@ +<page backtop="20mm" backleft="15mm" backright="15mm" backbottom="20mm"> + <page_footer> + <table style="width: 100%;"> + <tr> + <td style="border-top:1px;text-align: center;width: 100%;"> + <{$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> + </td> + </tr> + </table> + </page_footer> + <table style="width: 100%;"> + <tr > + <td colspan="2" style="text-align: center;"> + <img src="<{$xoops_url}>/images/logo.png" alt="<{$xoops_sitename}>" /> + <br /> + <br /> + <br /> + <br /> + </td> + </tr> + <{if $content_doheader}> + <tr> + <td style="border-bottom:1px;width:50%;text-align: left;"> + <{if $content_dotitle}> + <h3><{$content_title}></h3> + <{/if}> + </td> + <td style="border-bottom:1px;width:50%;text-align: right;"> + <{if $content_dorating}> + <{$smarty.const._MD_PAGE_VIEWPAGE_RATING}>: <{$content_rating}> (<{$content_votes}> <{$smarty.const._MD_PAGE_VIEWPAGE_VOTE}>) + <{/if}> + </td> + </tr> + <{/if}> + <tr > + <td colspan="2"> + <{if $summary}> + <h4><{$smarty.const._MD_PAGE_VIEWPAGE_SUMMARY}>:</h4> + <ul> + <{foreach item=summary from=$summary}> + <li><{$summary}></li> + <{/foreach}> + </ul> + <{/if}> + <{$content_shorttext}> + <br /> + <{$content_text}> + <br /> + <br /> + </td> + </tr> + <{if $content_dofooter}> + <tr> + <td style="border-top:1px;width:50%;text-align: left;"> + <em><{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}></em> + </td> + <td style="border-top:1px;width:50%;text-align: right;"> + <{if $content_doncoms}> + <em><img src="<{$xoops_url}>/modules/page/images/comments.png" alt="<{$content_comments}>"/> (<{$content_comments}> <{$smarty.const._MD_PAGE_VIEWPAGE_COMMENTS}>)</em> + <{/if}> + </td> + </tr> + <{/if}> + </table> +</page> + Modified: 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 2012-12-18 19:54:45 UTC (rev 10445) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_print.html 2012-12-18 19:57:26 UTC (rev 10446) @@ -25,66 +25,83 @@ <!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> - + </head> <body class="<{$xoops_langcode}>" onload="window.print()"> <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> + <table style="width: 100%;"> + <tr > + <td colspan="2" style="text-align: center;"> + <img src="<{$xoops_url}>/images/logo.png" alt="<{$xoops_sitename}>" /> + <br /> + <br /> + <br /> + <br /> + </td> + </tr> + <{if $content_doheader}> + <tr> + <td style="border-bottom:1px;width:50%;text-align: left;"> + <{if $content_dotitle}> + <h3><{$content_title}></h3> + <{/if}> + </td> + <td style="border-bottom:1px;width:50%;text-align: right;"> + <{if $content_dorating}> + <{$smarty.const._MD_PAGE_VIEWPAGE_RATING}>: <{$content_rating}> (<{$content_votes}> <{$smarty.const._MD_PAGE_VIEWPAGE_VOTE}>) + <{/if}> + </td> + </tr> <{/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> + <tr > + <td colspan="2"> + <{if $summary}> + <h4><{$smarty.const._MD_PAGE_VIEWPAGE_SUMMARY}>:</h4> + <ul> + <{foreach item=summary from=$summary}> + <li><{$summary}></li> + <{/foreach}> + </ul> + <{/if}> + <{$content_shorttext}> + <br /> + <{$content_text}> + <br /> + <br /> + </td> + </tr> + <{if $content_dofooter}> + <tr> + <td style="border-top:1px;width:50%;text-align: left;"> + <em><{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}></em> + </td> + <td style="border-top:1px;width:50%;text-align: right;"> + <{if $content_doncoms}> + <em><img src="<{$xoops_url}>/modules/page/images/comments.png" alt="<{$content_comments}>"/> (<{$content_comments}> <{$smarty.const._MD_PAGE_VIEWPAGE_COMMENTS}>)</em> + <{/if}> + </td> + </tr> <{/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}> + </table> <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> + <br /> + <table style="width: 100%;"> + <tr> + <td style="border-top:1px;text-align: center;width: 100%;"> + <{$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> + </td> + </tr> + </table> </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-18 19:54:45 UTC (rev 10445) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_viewpage.html 2012-12-18 19:57:26 UTC (rev 10446) @@ -1,7 +1,7 @@ <script> $(function(){ $('.star_rating').rating({ - callback: function(value, link){ + callback: function(value, link){ //if (confirm("The value selected was '" + value + "'\n <{$title}>")) { this.form.submit(); //} @@ -48,11 +48,14 @@ <{includeq file="module:page|page_navigation.html"}> <div class="clear"></div> <{/if}> - + <div class="right"> - <{if $content_doprint}> + <{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}> + <{if $content_dopdf}> + <a href="<{$xoops_url}>/modules/page/pdf.php?id=<{$content_id}>" title="<{$smarty.const._MD_PAGE_VIEWPAGE_PDF}>"><img src="<{xoAppUrl media/xoops/images/icons/16/pdf.png}>" alt="<{$smarty.const._MD_PAGE_VIEWPAGE_PDF}>" /></a> + <{/if}> </div> </div> <{if $content_dofooter}> |