From: <ma...@us...> - 2012-11-30 20:44:26
|
Revision: 10292 http://sourceforge.net/p/xoops/svn/10292 Author: mageg Date: 2012-11-30 20:44:24 +0000 (Fri, 30 Nov 2012) Log Message: ----------- add plugin "xoosocialnetwork" in page module 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/templates/page_viewpage.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/viewpage.php 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-11-30 20:27:36 UTC (rev 10291) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/index.php 2012-11-30 20:44:24 UTC (rev 10292) @@ -46,13 +46,8 @@ $admin_page->addInfoBoxLine(sprintf(_AM_PAGE_INDEX_TOTALDISPLAY, '<span class="green">' . $content_display . '</span>'), 'content'); $admin_page->addInfoBoxLine(sprintf(_AM_PAGE_INDEX_TOTALNOTDISPLAY, '<span class="red">' . $content_notdisplay . '</span>'), 'content'); -// configs -/*$admin_page->addConfigBoxLine($folder_path, 'folder'); -$admin_page->addConfigBoxLine(array($folder_path, '777'), 'chmod'); -$admin_page->addConfigBoxLine($folder_path . '/images', 'folder'); -$admin_page->addConfigBoxLine(array($folder_path . '/images', '777'), 'chmod'); -$admin_page->addConfigBoxLine($folder_path . '/images/category', 'folder'); -$admin_page->addConfigBoxLine(array($folder_path . '/images/category', '777'), 'chmod');*/ +// extension +$admin_page->addConfigBoxLine(array('xoosocialnetwork', 'warning'), 'extension'); $admin_page->renderIndex(); $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-11-30 20:27:36 UTC (rev 10291) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/form/page_content.php 2012-11-30 20:44:24 UTC (rev 10292) @@ -122,7 +122,9 @@ $checkbox->addOption('pdf', _AM_PAGE_CONTENT_DOPDF); $checkbox->addOption('print', _AM_PAGE_CONTENT_DOPRINT); $checkbox->addOption('mail', _AM_PAGE_CONTENT_DOMAIL); - $checkbox->addOption('social', _AM_PAGE_CONTENT_DOSOCIAL); + if ($xoops->isActiveModule('xoosocialnetwork') == true) { + $checkbox->addOption('social', _AM_PAGE_CONTENT_DOSOCIAL); + } $checkbox->setDescription(_AM_PAGE_CONTENT_OPTIONS_DSC); $this->addElement($checkbox); //maindisplay 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-11-30 20:27:36 UTC (rev 10291) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_viewpage.html 2012-11-30 20:44:24 UTC (rev 10292) @@ -43,7 +43,11 @@ <{$content_shorttext}> <br /> <{$content_text}> - + <{if $navigation}> + <div class="clear"></div> + <{includeq file="module:page|page_navigation.html"}> + <div class="clear"></div> + <{/if}> </div> <{if $content_dofooter}> <div class="page_footer"> @@ -58,8 +62,6 @@ <{/if}> </div> <{/if}> -<{if $navigation}> - <div class="clear"></div> - <{includeq file="module:page|page_navigation.html"}> - <div class="clear"></div> +<{if $content_dosocial}> +<{includeq file='module:xoosocialnetwork|xoosocialnetwork.html'}> <{/if}> \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/viewpage.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/viewpage.php 2012-11-30 20:27:36 UTC (rev 10291) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/viewpage.php 2012-11-30 20:44:24 UTC (rev 10292) @@ -108,6 +108,7 @@ $xoopsTpl->assign('content_dohits', $view_content->getVar('content_dohits')); $xoopsTpl->assign('content_dorating', $view_content->getVar('content_dorating')); $xoopsTpl->assign('content_dotitle', $view_content->getVar('content_dotitle')); +$xoopsTpl->assign('content_dosocial', $view_content->getVar('content_dosocial')); $xoopsTpl->assign('content_donotifications', $view_content->getVar('content_donotifications')); $xoopsTpl->assign('content_docoms', $view_content->getVar('content_docoms')); if ($view_content->getVar('content_docoms') == false){ |
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; |
From: <ma...@us...> - 2012-12-02 21:34:53
|
Revision: 10309 http://sourceforge.net/p/xoops/svn/10309 Author: mageg Date: 2012-12-02 21:34:50 +0000 (Sun, 02 Dec 2012) Log Message: ----------- Update page module Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/content.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/class/form/page_related.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/page.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/admin/content.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/content.php 2012-12-02 21:18:49 UTC (rev 10308) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/content.php 2012-12-02 21:34:50 UTC (rev 10309) @@ -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'; @@ -188,7 +188,7 @@ } if (preg_match('/^\d+$/', $_POST["content_weight"]) == false){ $error = true; - $error_message .= _AM_PAGE_CATEGORY_ERROR_WEIGHT . '<br />'; + $error_message .= _AM_PAGE_CONTENT_ERROR_WEIGHT . '<br />'; $obj->setVar("content_weight", ''); } else { $obj->setVar("content_weight", $_POST["content_weight"]); 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-02 21:18:49 UTC (rev 10308) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/form/page_content.php 2012-12-02 21:34:50 UTC (rev 10309) @@ -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$ */ @@ -25,7 +25,7 @@ class PagePage_contentForm extends XoopsThemeForm { /** - * @param XoopsPagePage_content|XoopsObject $obj + * @param PagePage_content|XoopsObject $obj */ public function __construct(PagePage_content &$obj) { @@ -80,7 +80,7 @@ $content_option = array('title', 'author', 'date', 'hits', 'rating', 'coms', 'ncoms', 'notifications', 'pdf', 'print', 'mail', 'social'); $content_status = 1; $content_maindisplay = 1; - } + } //title $this->addElement(new XoopsFormText(_AM_PAGE_CONTENT_TITLE, 'content_title', 6, 255, $obj->getVar('content_title'), ''), true); //short text @@ -131,7 +131,7 @@ $this->addElement(new XoopsFormRadioYN(_AM_PAGE_CONTENT_MAINDISPLAY, 'content_maindisplay', $content_maindisplay)); //active $this->addElement(new XoopsFormRadioYN(_AM_PAGE_CONTENT_STATUS, 'content_status', $content_status)); - + if ( $xoops->user->isAdmin($xoops->module->mid()) ) { //author if ($obj->isNew()) { Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/form/page_related.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/form/page_related.php 2012-12-02 21:18:49 UTC (rev 10308) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/form/page_related.php 2012-12-02 21:34:50 UTC (rev 10309) @@ -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$ */ @@ -25,7 +25,7 @@ class PagePage_relatedForm extends XoopsThemeForm { /** - * @param XoopsPagePage_content|XoopsObject $obj + * @param PagePage_related|XoopsObject $obj */ public function __construct(PagePage_related &$obj) { @@ -37,7 +37,7 @@ $title = $obj->isNew() ? sprintf( _AM_PAGE_RELATED_ADD ) : sprintf( _AM_PAGE_RELATED_EDIT ); parent::__construct($title, 'form', 'related.php', 'post', true); - + $secondary_max = 10; $this->addElement(new XoopsFormHidden( 'secondary_max', $secondary_max ) ); $criteria_related = new CriteriaCompo(); @@ -64,7 +64,7 @@ for ($i = 1; $i <= $secondary_max; $i++) { $related_secondary[$i] = 0; } - + } $compare_related_arr = $related_Handler->getall($criteria_related); if (count($compare_related_arr) > 0) { Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/page.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/page.php 2012-12-02 21:18:49 UTC (rev 10308) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/page.php 2012-12-02 21:34:50 UTC (rev 10309) @@ -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$ */ @@ -28,7 +28,6 @@ { $xoops = Xoops::getInstance(); // Get handler - $content_Handler = $xoops->getModuleHandler('page_content'); $related_Handler = $xoops->getModuleHandler('page_related'); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('related_contentid', $content_id)); 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-02 21:18:49 UTC (rev 10308) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_print.html 2012-12-02 21:34:50 UTC (rev 10309) @@ -27,8 +27,7 @@ <![endif]--> </head> -<!--<body class="<{$xoops_langcode}>" onload="window.print()">--> -<body class="<{$xoops_langcode}>"> +<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}>" /> |
From: <ma...@us...> - 2012-12-16 20:10:17
|
Revision: 10420 http://sourceforge.net/p/xoops/svn/10420 Author: mageg Date: 2012-12-16 20:10:15 +0000 (Sun, 16 Dec 2012) Log Message: ----------- change search to use search module. Modified Paths: -------------- 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/class/plugin/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/search.php Removed Paths: ------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/include/search.php Copied: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/index.html (from rev 10417, XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/index.html) =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/index.html (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/index.html 2012-12-16 20:10:15 UTC (rev 10420) @@ -0,0 +1 @@ + <script>history.go(-1);</script> \ No newline at end of file Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/search.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/search.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/search.php 2012-12-16 20:10:15 UTC (rev 10420) @@ -0,0 +1,62 @@ +<?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: $ + */ + +defined("XOOPS_ROOT_PATH") or die("XOOPS root path not defined"); + +class PageSearchPlugin extends Xoops_Plugin_Abstract implements SearchPluginInterface +{ + public function search($queries, $andor, $limit, $start, $uid) + { + $xoops = Xoops::getInstance(); + $sql = "SELECT content_id, content_title, content_shorttext, content_text, content_author, content_create FROM " . $xoops->db()->prefix("page_content") . " WHERE content_status != 0"; + + if ( $uid != 0 ) { + $sql .= " AND content_author=" . intval($uid); + } + + if ( is_array($queries) && $count = count($queries) ) + { + $sql .= " AND ((content_title LIKE '%$queries[0]%' OR content_text LIKE '%$queries[0]%' OR content_shorttext LIKE '%$queries[0]%')"; + + for ($i=1; $i < $count; $i++) { + $sql .= " $andor "; + $sql .= "(content_title LIKE '%$queries[$i]%' OR content_text LIKE '%$queries[$i]%' OR content_shorttext LIKE '%$queries[$i]%')"; + } + $sql .= ")"; + } + $sql .= " ORDER BY content_create DESC"; + $result = $xoops->db()->queryF($sql, $limit, $start); + + $ret = array(); + $i = 0; + while($myrow = $xoops->db()->fetchArray($result)) { + $ret[$i]["image"] = "images/logo_small.png"; + $ret[$i]["link"] = "viewpage.php?id=" . $myrow["content_id"]; + $ret[$i]["title"] = $myrow["content_title"]; + $ret[$i]["time"] = $myrow["content_create"]; + $ret[$i]["content"] = $myrow["content_text"] . $myrow["content_shorttext"]; + $ret[$i]["uid"] = $myrow["content_author"]; + $i++; + } + return $ret; + return $res; + } +} \ No newline at end of file Deleted: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/include/search.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/include/search.php 2012-12-16 19:57:47 UTC (rev 10419) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/include/search.php 2012-12-16 20:10:15 UTC (rev 10420) @@ -1,57 +0,0 @@ -<?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$ - */ - -function page_search($queryarray, $andor, $limit, $offset, $userid) -{ - $xoops = Xoops::getInstance(); - $sql = "SELECT content_id, content_title, content_shorttext, content_text, content_author, content_create FROM " . $xoops->db()->prefix("page_content") . " WHERE content_status != 0"; - - if ( $userid != 0 ) { - $sql .= " AND content_author=" . intval($userid); - } - - if ( is_array($queryarray) && $count = count($queryarray) ) - { - $sql .= " AND ((content_title LIKE '%$queryarray[0]%' OR content_text LIKE '%$queryarray[0]%' OR content_shorttext LIKE '%$queryarray[0]%')"; - - for ($i=1; $i < $count; $i++) { - $sql .= " $andor "; - $sql .= "(content_title LIKE '%$queryarray[$i]%' OR content_text LIKE '%$queryarray[$i]%' OR content_shorttext LIKE '%$queryarray[$i]%')"; - } - $sql .= ")"; - } - $sql .= " ORDER BY content_create DESC"; - $result = $xoops->db()->queryF($sql, $limit, $offset); - - $ret = array(); - $i = 0; - while($myrow = $xoops->db()->fetchArray($result)) { - $ret[$i]["image"] = "images/logo_small.png"; - $ret[$i]["link"] = "viewpage.php?id=" . $myrow["content_id"]; - $ret[$i]["title"] = $myrow["content_title"]; - $ret[$i]["time"] = $myrow["content_create"]; - $ret[$i]["content"] = $myrow["content_text"] . $myrow["content_shorttext"]; - $ret[$i]["uid"] = $myrow["content_author"]; - $i++; - } - return $ret; -} \ No newline at end of file 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-16 19:57:47 UTC (rev 10419) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/xoops_version.php 2012-12-16 20:10:15 UTC (rev 10420) @@ -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$ */ $modversion = array(); @@ -57,21 +57,16 @@ $modversion['hasAdmin'] = 1; $modversion['adminindex'] = 'admin/index.php'; $modversion['adminmenu'] = 'admin/menu.php'; - + // Scripts to run upon installation or update $modversion['onInstall'] = 'include/install.php'; // JQuery $modversion['jquery'] = 1; - -// Menu + +// Menu $modversion['hasMain'] = 1; -// Search -$modversion['hasSearch'] = 1; -$modversion['search']['file'] = 'include/search.php'; -$modversion['search']['func'] = 'page_search'; - // Mysql file $modversion['sqlfile']['mysql'] = "sql/mysql.sql"; @@ -84,6 +79,7 @@ $modversion['templates'][] = array( 'file' => 'page_index.html', 'description' => '' ); $modversion['templates'][] = array( 'file' => 'page_viewpage.html', 'description' => '' ); $modversion['templates'][] = array( 'file' => 'page_print.html', 'description' => '' ); +$modversion['templates'][] = array( 'file' => 'page_pdf.html', 'description' => '' ); // blocks $i = 0; @@ -93,7 +89,7 @@ $modversion['blocks'][$i]['show_func'] = 'page_blocks_show'; $modversion['blocks'][$i]['edit_func'] = 'page_blocks_edit'; $modversion['blocks'][$i]['options'] = 'random|5|19|0'; -$modversion['blocks'][$i]['template'] = 'page_blocks_random.html'; +$modversion['blocks'][$i]['template'] = 'page_blocks_random.html'; $i++; /*$modversion['blocks'][$i]['file'] = 'page_blocks.php'; $modversion['blocks'][$i]['name'] = _MI_PAGE_BLOCKS_ID; @@ -137,7 +133,6 @@ $modversion['config'][$i]['valuetype'] = 'text'; $modversion['config'][$i]['default'] = 'dhtmltextarea'; $modversion['config'][$i]['options'] = $editors; -$modversion['config'][$i]['category'] = 'global'; $i++; $modversion['config'][$i]['name'] = 'page_adminpager'; $modversion['config'][$i]['title'] = '_MI_PAGE_PREFERENCE_ADMINPAGER'; |
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}> |
From: <ma...@us...> - 2012-12-18 20:43:22
|
Revision: 10449 http://sourceforge.net/p/xoops/svn/10449 Author: mageg Date: 2012-12-18 20:43:19 +0000 (Tue, 18 Dec 2012) Log Message: ----------- some errors in page module Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/search.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/admin/page_admin_related.html Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/search.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/search.php 2012-12-18 20:36:41 UTC (rev 10448) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/search.php 2012-12-18 20:43:19 UTC (rev 10449) @@ -57,6 +57,5 @@ $i++; } return $ret; - return $res; } } \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/admin/page_admin_related.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/admin/page_admin_related.html 2012-12-18 20:36:41 UTC (rev 10448) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/admin/page_admin_related.html 2012-12-18 20:43:19 UTC (rev 10449) @@ -53,7 +53,7 @@ <!--Pop-pup--> <{foreach item=related from=$popup_related}> <div id="dialog<{$related.id}>" title="<{$related.name}>" style='display:none;'> - <b><{$smarty.const._AM_PAGE_RELATED_MAIN}>:</b> + <strong><{$smarty.const._AM_PAGE_RELATED_MAIN}>:</strong> <ul> <li> <a href="content.php?op=edit&id=<{$related.main_contentid}>" title="<{$smarty.const._AM_PAGE_EDIT}>"> @@ -61,7 +61,7 @@ </a> </li> </ul> - <b><{$smarty.const._AM_PAGE_RELATED_SECONDARY}>:</b> + <strong><{$smarty.const._AM_PAGE_RELATED_SECONDARY}>:</strong> <{$related.secondary}> </div> <{/foreach}> |
From: <ma...@us...> - 2012-12-24 18:14:13
|
Revision: 10541 http://sourceforge.net/p/xoops/svn/10541 Author: mageg Date: 2012-12-24 18:14:10 +0000 (Mon, 24 Dec 2012) Log Message: ----------- add comments in page module Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/notifications.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/search.php 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/class/plugin/comments.php Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/comments.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/comments.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/comments.php 2012-12-24 18:14:10 UTC (rev 10541) @@ -0,0 +1,113 @@ +<?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) + * @since 2.6.0 + * @author Mage Grégory (AKA Mage) + * @version $Id$ + */ + +defined("XOOPS_ROOT_PATH") or die("XOOPS root path not defined"); + +class PageCommentsPlugin extends Xoops_Plugin_Abstract implements CommentsPluginInterface +{ + /** + * @return string + */ + public function itemName() + { + return 'id'; + } + + /** + * @return string + */ + public function pageName() + { + return 'viewpage.php'; + } + + /** + * @return array + */ + public function extraParams() + { + return array(); + } + + /** + * This method will be executed upon successful post of an approved comment. + * This includes comment posts by administrators, and change of comment status from 'pending' to 'active' state. + * An CommentsComment object that has been approved will be passed as the first and only parameter. + * This should be useful for example notifying the item submitter of a comment post. + * + * @param CommentsComment $comment + * + * @return void + */ + public function approve(CommentsComment $comment) + { + //Where are you looking at? + } + + /** + * This method will be executed whenever the total number of 'active' comments for an item is changed. + * + * @param int $item_id The unique ID of an item + * @param int $total_num The total number of active comments + * + * @return void + */ + public function update($item_id, $total_num) + { + $db = Xoops::getInstance()->db(); + $sql = 'UPDATE ' . $db->prefix('page_content') . ' SET content_comments = ' . intval($total_num) . ' WHERE content_id = ' . intval($item_id); + $db->query($sql); + } + + /** + * This method will be executed whenever a new comment form is displayed. + * You can set a default title for the comment and a header to be displayed on top of the form + * ex: return array( + * 'title' => 'My Article Title', + * 'text' => 'Content of the article'); + * 'timestamp' => time(); //Date of the article in unix format + * 'uid' => Id of the article author + * + * @param int $item_id The unique ID of an item + * + * @return array + */ + public function itemInfo($item_id) + { + + $ret = array(); + + $xoops = Xoops::getInstance(); + // Get handler + $content_Handler = $xoops->getModuleHandler('page_content', 'page'); + $view_content = $content_Handler->get($item_id); + if (count($view_content) == 0 || $view_content->getVar('content_status') == 0){ + return $ret; + } else { + $ret['title'] = $view_content->getVar('content_title'); + $ret['text'] = $view_content->getVar('content_shorttext') . $view_content->getVar('content_text'); + $ret['uid'] = $view_content->getVar('content_author'); + $ret['timestamp'] = $view_content->getVar('content_create'); + } + return $ret; + } +} + Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/comments.php ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/notifications.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/notifications.php 2012-12-24 17:07:42 UTC (rev 10540) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/notifications.php 2012-12-24 18:14:10 UTC (rev 10541) @@ -10,7 +10,7 @@ */ /** - * menu module + * 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) Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/search.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/search.php 2012-12-24 17:07:42 UTC (rev 10540) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/search.php 2012-12-24 18:14:10 UTC (rev 10541) @@ -10,7 +10,7 @@ */ /** - * XXX + * 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) 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-24 17:07:42 UTC (rev 10540) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_viewpage.html 2012-12-24 18:14:10 UTC (rev 10541) @@ -74,6 +74,9 @@ <{if $content_dosocial}> <{includeq file='module:xoosocialnetwork|xoosocialnetwork.html'}> <{/if}> +<{if $content_docoms == 1}> +<{include file='module:comments|comments.html'}> +<{/if}> <{if $content_donotifications}> <{include file='module:notifications|select.html'}> <{/if}> \ No newline at end of file |
From: <ma...@us...> - 2012-12-25 09:54:03
|
Revision: 10546 http://sourceforge.net/p/xoops/svn/10546 Author: mageg Date: 2012-12-25 09:54:00 +0000 (Tue, 25 Dec 2012) Log Message: ----------- update page module 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 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-25 09:21:53 UTC (rev 10545) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/index.php 2012-12-25 09:54:00 UTC (rev 10546) @@ -48,9 +48,11 @@ $admin_page->addInfoBoxLine(sprintf(_AM_PAGE_INDEX_TOTALNOTDISPLAY, '<span class="red">' . $content_notdisplay . '</span>'), 'content'); // extension + +$admin_page->addConfigBoxLine(array('comments', 'warning'), 'extension'); +$admin_page->addConfigBoxLine(array('notifications', 'warning'), 'extension'); +$admin_page->addConfigBoxLine(array('pdf', 'warning'), 'extension'); $admin_page->addConfigBoxLine(array('xoosocialnetwork', 'warning'), 'extension'); -$admin_page->addConfigBoxLine(array('pdf', 'warning'), 'extension'); -$admin_page->addConfigBoxLine(array('notifications', '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-25 09:21:53 UTC (rev 10545) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/form/page_content.php 2012-12-25 09:54:00 UTC (rev 10546) @@ -116,9 +116,13 @@ $checkbox->addOption('date', _AM_PAGE_CONTENT_DODATE); $checkbox->addOption('hits', _AM_PAGE_CONTENT_DOHITS); $checkbox->addOption('rating', _AM_PAGE_CONTENT_DORATING); - $checkbox->addOption('coms', _AM_PAGE_CONTENT_DOCOMS); - $checkbox->addOption('ncoms', _AM_PAGE_CONTENT_DONCOMS); - $checkbox->addOption('notifications', _AM_PAGE_CONTENT_DONOTIFICATIONS); + if ($xoops->isActiveModule('comments') == true) { + $checkbox->addOption('coms', _AM_PAGE_CONTENT_DOCOMS); + $checkbox->addOption('ncoms', _AM_PAGE_CONTENT_DONCOMS); + } + if ($xoops->isActiveModule('notifications') == true) { + $checkbox->addOption('notifications', _AM_PAGE_CONTENT_DONOTIFICATIONS); + } $checkbox->addOption('pdf', _AM_PAGE_CONTENT_DOPDF); if ($xoops->isActiveModule('pdf') == true) { $checkbox->addOption('print', _AM_PAGE_CONTENT_DOPRINT); |
From: <ma...@us...> - 2012-12-26 20:39:03
|
Revision: 10567 http://sourceforge.net/p/xoops/svn/10567 Author: mageg Date: 2012-12-26 20:39:00 +0000 (Wed, 26 Dec 2012) Log Message: ----------- error with pagnav in page module Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/content.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/index.php Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/content.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/content.php 2012-12-26 20:38:15 UTC (rev 10566) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/content.php 2012-12-26 20:39:00 UTC (rev 10567) @@ -76,7 +76,7 @@ // Display Page Navigation if ($content_count > $nb_content) { $nav = new XoopsPageNav($content_count, $nb_content, $start, 'start'); - $xoops->tpl()->assign('nav_menu', $nav->renderNav(4)); + $xoops->tpl()->assign('nav_menu', $nav->renderNav(4, 'small')); } } else { $xoops->tpl()->assign('error_message', _AM_PAGE_CONTENT_ERROR_NOCONTENT); Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/index.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/index.php 2012-12-26 20:38:15 UTC (rev 10566) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/index.php 2012-12-26 20:39:00 UTC (rev 10567) @@ -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$ */ @@ -24,7 +24,7 @@ $xoops = Xoops::getInstance(); $xoops->header('page_index.html'); // Parameters -$nb_content = $xoops->getModuleConfig('page_adminpager'); +$nb_content = $xoops->getModuleConfig('page_userpager'); // Get handler $content_Handler = $xoops->getModuleHandler('page_content'); // add module css @@ -69,7 +69,7 @@ } else { $xoops->tpl()->assign('error_message', _AM_PAGE_CONTENT_ERROR_NOCONTENT); } -// r\xE9f\xE9rencement +// r�f�rencement //description $xoTheme->addMeta('meta', 'description', strip_tags($xoops->module->name())); //keywords |
From: <ma...@us...> - 2012-12-27 20:46:15
|
Revision: 10574 http://sourceforge.net/p/xoops/svn/10574 Author: mageg Date: 2012-12-27 20:46:10 +0000 (Thu, 27 Dec 2012) Log Message: ----------- add a block in page module Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/blocks/page_blocks.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/language/english/blocks.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/rating.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/page_blocks_id.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/xoops_version.php Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/blocks/page_blocks.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/blocks/page_blocks.php 2012-12-27 20:21:42 UTC (rev 10573) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/blocks/page_blocks.php 2012-12-27 20:46:10 UTC (rev 10574) @@ -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$ */ function page_blocks_show($options) { @@ -33,9 +33,6 @@ case 'random': $criteria->setSort('RAND()'); break; - case 'id': - $criteria->setSort('RAND()'); - break; case 'rating': $criteria->setSort('content_rating'); $criteria->setOrder('DESC'); @@ -69,24 +66,144 @@ $content[$i]['rating'] = number_format($content_arr[$i]->getVar('content_rating'), 1); $content[$i]['votes'] = $content_arr[$i]->getVar('content_votes'); } + } else { + $content_id = $options[1]; + $view_content = $content_Handler->get($content_id); + // Test if the page exist + if (count($view_content) == 0 || $view_content->getVar('content_status') == 0){ + $content = array(); + } else { + $parsed = parse_url(XOOPS_URL); + $url = isset($parsed['scheme']) ? $parsed['scheme'] . '://' : 'http://'; + if (isset($parsed['host'])) { + $url .= $parsed['host']; + if (isset($parsed['port'])) { + $url .= ':' . $parsed['port']; + } + } else { + $url .= $_SERVER['HTTP_HOST']; + } + $url = $url . $_SERVER['REQUEST_URI']; + // add module css + $xoops->theme()->addStylesheet( $xoops->url('/modules/page/css/styles.css'), null ); + $xoops->theme()->addStylesheet( $xoops->url('/modules/page/css/rating.css'), null ); + // Javascript + $xoops->theme()->addScript( XOOPS_URL . '/modules/page/js/rating.js' ); + $xoops->theme()->addScript( XOOPS_URL . '/modules/page/js/MetaData.js' ); + $xoops->theme()->addScript( XOOPS_URL . '/modules/page/js/rating.pack.js' ); + //Rating form + $content_rating = $view_content->getVar('content_rating'); + $rating_form = '<form id="rating" action="' . XOOPS_URL . '/modules/page/rating.php">'; + for($i=0.5; $i <= 6;){ + if ($content_rating >= ($i - 0.25) && $content_rating < ($i + 0.25)){ + $rating_form .= '<input name="rating" type="radio" class="star_rating {split:2}" value="' . $i . '" checked="checked"/>'; + }else{ + $rating_form .= '<input name="rating" type="radio" class="star_rating {split:2}" value="' . $i . '"/>'; + } + $i += 0.5; + } + $rating_form .= '<input name="content_id" type="hidden" id="content_id" value="' . $content_id .'" />'; + $rating_form .= '<input name="extra_url" type="hidden" id="extra_url" value="' . $url .'" />'; + $rating_form .= '</form>'; + $content['rating_form'] = $rating_form; + + // content + $content['content_id'] = $content_id; + $content['content_title'] = $view_content->getVar('content_title'); + $content['content_shorttext'] = $view_content->getVar('content_shorttext'); + $content['content_text'] = $view_content->getVar('content_text'); + $content['content_author'] = XoopsUser::getUnameFromId($view_content->getVar('content_author')); + $content['content_authorid'] = $view_content->getVar('content_author'); + $content['content_hits'] = sprintf(_MD_PAGE_VIEWPAGE_HITS, $view_content->getVar('content_hits')); + $content['content_date'] = XoopsLocal::formatTimestamp($view_content->getVar('content_create'), $xoops->getModuleConfig('page_dateformat', 'page')); + $content['content_time'] = XoopsLocal::formatTimestamp($view_content->getVar('content_create'), $xoops->getModuleConfig('page_timeformat', 'page')); + $content['content_comments'] = $view_content->getVar('content_comments'); + $content['content_rating'] = number_format($view_content->getVar('content_rating'), 1); + $content['content_votes'] = $view_content->getVar('content_votes'); + $content['content_dopdf'] = $view_content->getVar('content_dopdf'); + $content['content_doprint'] = $view_content->getVar('content_doprint'); + $content['content_dosocial'] = $view_content->getVar('content_dosocial'); + $content['content_doauthor'] = $view_content->getVar('content_doauthor'); + $content['content_dodate'] = $view_content->getVar('content_dodate'); + $content['content_domail'] = $view_content->getVar('content_domail'); + $content['content_dohits'] = $view_content->getVar('content_dohits'); + $content['content_dorating'] = $view_content->getVar('content_dorating'); + $content['content_dotitle'] = $view_content->getVar('content_dotitle'); + $content['content_dosocial'] = $view_content->getVar('content_dosocial'); + $content['content_donotifications'] = $view_content->getVar('content_donotifications'); + $content['content_docoms'] = $view_content->getVar('content_docoms'); + if ($view_content->getVar('content_docoms') == false){ + $ncoms = false; + } elseif ($view_content->getVar('content_doncoms') == false){ + $ncoms = false; + } else { + $ncoms = true; + } + $content['content_doncoms'] = $ncoms; + if ($view_content->getVar('content_dotitle') == false && $view_content->getVar('content_dorating') == false) { + $header = false; + } else { + $header = true; + } + $content['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; + } + $content['content_dofooter'] = $footer; + + /*$page = new Page(); + + $related = $page->menu_related($content_id); + + if ($related['domenu'] ) { + $content['summary'] = $related['summary']; + } + if ($related['navigation'] != '' ) { + $content['navigation'] = $related['navigation']; + $content['related'] = $related; + }*/ + } } return $content; } function page_blocks_edit($options) { $form = ''; - $form .= _MB_PAGE_DISPLAY . " \n"; - $form .= "<input type=\"hidden\" name=\"options[0]\" value=\"" . $options[0] . "\" />\n"; - $form .= "<input class=\"span1\" name=\"options[1]\" size=\"5\" maxlength=\"255\" value=\"" . $options[1] . "\" type=\"text\" pattern=\"^\d+$\" /> " . _MB_PAGE_CONTENTS . "<br />\n"; - $form .= _MB_PAGE_TLENGTH . " <input class=\"span1\" name=\"options[2]\" size=\"5\" maxlength=\"255\" value=\"" . $options[2] . "\" type=\"text\" pattern=\"^\d+$\" /><br />\n"; - if ($options[3] == false){ - $checked_yes = ''; - $checked_no = 'checked="checked"'; - }else{ - $checked_yes = 'checked="checked"'; - $checked_no = ''; + if ($options[0] != 'id') { + $form .= _MB_PAGE_DISPLAY . " \n"; + $form .= "<input type=\"hidden\" name=\"options[0]\" value=\"" . $options[0] . "\" />\n"; + $form .= "<input class=\"span1\" name=\"options[1]\" size=\"5\" maxlength=\"255\" value=\"" . $options[1] . "\" type=\"text\" pattern=\"^\d+$\" /> " . _MB_PAGE_CONTENTS . "<br />\n"; + $form .= _MB_PAGE_TLENGTH . " <input class=\"span1\" name=\"options[2]\" size=\"5\" maxlength=\"255\" value=\"" . $options[2] . "\" type=\"text\" pattern=\"^\d+$\" /><br />\n"; + if ($options[3] == false){ + $checked_yes = ''; + $checked_no = 'checked="checked"'; + }else{ + $checked_yes = 'checked="checked"'; + $checked_no = ''; + } + $form .= _MB_PAGE_ALLCONTENT . ": <input name=\"options[3]\" value=\"1\" type=\"radio\" " . $checked_yes . "/>" . _YES . " \n"; + $form .= "<input name=\"options[3]\" value=\"0\" type=\"radio\" " . $checked_no . "/>" . _NO . "<br />\n"; + } else { + $xoops = Xoops::getInstance(); + $content_Handler = $xoops->getModuleHandler('page_content', 'page'); + $form .= _MB_PAGE_CONTENTDISPLAY . " \n"; + $form .= "<input type=\"hidden\" name=\"options[0]\" value=\"" . $options[0] . "\" />\n"; + $form .= "<select class=\"span2\" name=\"options[1]\">\n"; + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('content_status', 0, '!=')); + $criteria->setSort('content_title'); + $criteria->setOrder('ASC'); + $content_arr = $content_Handler->getAll($criteria); + foreach (array_keys($content_arr) as $i) { + if ($content_arr[$i]->getVar('content_id') == $options[1]){ + $form .= "<option value=\"" . $content_arr[$i]->getVar('content_id') . "\" selected=\"selected\">" . $content_arr[$i]->getVar('content_title') . "</option>\n"; + } else { + $form .= "<option value=\"" . $content_arr[$i]->getVar('content_id') . "\">" . $content_arr[$i]->getVar('content_title') . "</option>\n"; + } + } + $form .= "</select>\n"; } - $form .= _MB_PAGE_ALLCONTENT . ": <input name=\"options[3]\" value=\"1\" type=\"radio\" " . $checked_yes . "/>" . _YES . " \n"; - $form .= "<input name=\"options[3]\" value=\"0\" type=\"radio\" " . $checked_no . "/>" . _NO . "<br />\n"; return $form; } \ 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-27 20:21:42 UTC (rev 10573) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/form/page_content.php 2012-12-27 20:46:10 UTC (rev 10574) @@ -76,10 +76,12 @@ } $content_status = $obj->getVar('content_status'); $content_maindisplay = $obj->getVar('content_maindisplay'); + $content_weight = $obj->getVar('content_weight', 'e'); } else { $content_option = array('title', 'author', 'date', 'hits', 'rating', 'coms', 'ncoms', 'notifications', 'pdf', 'print', 'mail', 'social'); $content_status = 1; $content_maindisplay = 1; + $content_weight = '0'; } //title $this->addElement(new XoopsFormText(_AM_PAGE_CONTENT_TITLE, 'content_title', 6, 255, $obj->getVar('content_title'), ''), true); @@ -106,7 +108,7 @@ //content_mdescription $this->addElement(new XoopsFormTextArea(_AM_PAGE_CONTENT_MDESCRIPTION, 'content_mdescription', $obj->getVar('content_mdescription'), 2, 5)); //Weight - $weight = new XoopsFormText(_AM_PAGE_CONTENT_WEIGHT, 'content_weight', 1, 5, $obj->getVar('content_weight', 'e'), ''); + $weight = new XoopsFormText(_AM_PAGE_CONTENT_WEIGHT, 'content_weight', 1, 5, $content_weight, ''); $weight->setPattern('^\d+$', _AM_PAGE_CONTENT_ERROR_WEIGHT); $this->addElement($weight, true); //options Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/language/english/blocks.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/language/english/blocks.php 2012-12-27 20:21:42 UTC (rev 10573) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/language/english/blocks.php 2012-12-27 20:46:10 UTC (rev 10574) @@ -16,10 +16,11 @@ * @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$ */ define("_MB_PAGE_DISPLAY","Display"); define("_MB_PAGE_CONTENTS","contents"); define("_MB_PAGE_TLENGTH","Title Length"); -define("_MB_PAGE_ALLCONTENT","Display all de content"); \ No newline at end of file +define("_MB_PAGE_ALLCONTENT","Display all de content"); +define("_MB_PAGE_CONTENTDISPLAY","Content to display"); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/rating.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/rating.php 2012-12-27 20:21:42 UTC (rev 10573) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/rating.php 2012-12-27 20:46:10 UTC (rev 10574) @@ -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$ */ @@ -33,6 +33,8 @@ $content_id = $system->cleanVars($_REQUEST, 'content_id', 0, 'int'); // Get rating $rating = $system->cleanVars($_REQUEST, 'rating', 0, 'string'); +// Get extra url +$extra_url = $system->cleanVars($_REQUEST, 'extra_url', '', 'string'); $view_content = $content_Handler->get($content_id); // Test if the page exist @@ -43,7 +45,11 @@ //pemissions $perm_rate = ($gperm_handler->checkRight('page_global', 4, $groups, $xoops->module->getVar('mid'), false)) ? true : false ; if ($perm_rate == false || $view_content->getVar('content_dorating') == false){ - $xoops->redirect('viewpage.php?id=' . $content_id, 1, _NOPERM); + if ($extra_url != '') { + $xoops->redirect($extra_url, 1, _NOPERM); + } else { + $xoops->redirect('viewpage.php?id=' . $content_id, 1, _NOPERM); + } } if (is_object($xoops->user)) { @@ -54,7 +60,11 @@ if ($uid != 0) { if ($uid == $view_content->getVar('content_author')){ - $xoops->redirect('viewpage.php?id=' . $content_id, 2, _MD_PAGE_RATING_DONOTVOTE); + if ($extra_url != '') { + $xoops->redirect($extra_url, 2, _MD_PAGE_RATING_DONOTVOTE); + } else { + $xoops->redirect('viewpage.php?id=' . $content_id, 2, _MD_PAGE_RATING_DONOTVOTE); + } exit(); } // Vote for the same resource more than once @@ -64,6 +74,11 @@ $rating_count = $rating_Handler->getCount($criteria); if ($rating_count >= 1) { $xoops->redirect('viewpage.php?id=' . $content_id, 2, _MD_PAGE_RATING_VOTEONCE); + if ($extra_url != '') { + $xoops->redirect($extra_url, 2, _MD_PAGE_RATING_VOTEONCE); + } else { + $xoops->redirect('viewpage.php?id=' . $content_id, 2, _MD_PAGE_RATING_VOTEONCE); + } exit(); } } else { @@ -76,7 +91,11 @@ $criteria->add(new Criteria('rating_date', $yesterday, '>')); $rating_count = $rating_Handler->getCount($criteria); if ($rating_count >= 1) { - $xoops->redirect('viewpage.php?id=' . $content_id, 2, _MD_PAGE_RATING_VOTEONCE); + if ($extra_url != '') { + $xoops->redirect($extra_url, 2, _MD_PAGE_RATING_VOTEONCE); + } else { + $xoops->redirect('viewpage.php?id=' . $content_id, 2, _MD_PAGE_RATING_VOTEONCE); + } exit(); } } @@ -105,7 +124,11 @@ $objcontent->setVar('content_rating', number_format($rating, 1)); $objcontent->setVar('content_votes', $total_vote); if ($content_Handler->insert($objcontent)) { - $xoops->redirect('viewpage.php?id=' . $content_id, 2, _MD_PAGE_RATING_THANKS); + if ($extra_url != '') { + $xoops->redirect($extra_url, 2, _MD_PAGE_RATING_THANKS); + } else { + $xoops->redirect('viewpage.php?id=' . $content_id, 2, _MD_PAGE_RATING_THANKS); + } } echo $objdownloads->getHtmlErrors(); } else { Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/page_blocks_id.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/page_blocks_id.html 2012-12-27 20:21:42 UTC (rev 10573) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/page_blocks_id.html 2012-12-27 20:46:10 UTC (rev 10574) @@ -1 +1,76 @@ -<{$block.contents}> \ No newline at end of file +<script> +$(function(){ + $('.star_rating').rating({ + callback: function(value, link){ + //if (confirm("The value selected was '" + value + "'\n <{$title}>")) { + this.form.submit(); + //} + } + }); +}); +</script> +<{if $block.content_doheader}> +<div class="page_header"> + + <{if $block.content_dotitle}> + <div class="page_headerleft"> + <{$block.content_title}> + </div> + <{/if}> + <{if $block.content_dorating}> + <div class="page_headerright"> + <{$block.rating_form}> + </div> + <{/if}> +</div> +<{if $block.content_dorating}> +<div class="page_vote"> + <{$smarty.const._MD_PAGE_VIEWPAGE_RATING}>: <{$block.content_rating}> (<{$block.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}> + <{$block.content_shorttext}> + <br /> + <{$block.content_text}> + <{if $navigation}> + <div class="clear"></div> + <{includeq file="module:page|page_navigation.html"}> + <div class="clear"></div> + <{/if}> + + <div class="right"> + <{if $block.content_doprint}> + <a href="<{$xoops_url}>/modules/page/print.php?id=<{$block.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 $block.content_dopdf}> + <a href="<{$xoops_url}>/modules/page/pdf.php?id=<{$block.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 $block.content_dofooter}> +<div class="page_footer"> + + <div class="page_footerleft"> + <{if $block.content_doauthor}><{$smarty.const._MD_PAGE_VIEWPAGE_POSTEDBY}> <a href="<{$xoops_url}>/userinfo.php?uid=<{$block.content_authorid}>"><{$block.content_author}></a> <{/if}><{if $block.content_dodate}><{$smarty.const._MD_PAGE_VIEWPAGE_ON}> <{$block.content_date}> <{$block.content_time}> <{/if}><{if $block.content_dohits}><{$block.content_hits}><{/if}> + </div> + <{if $block.content_doncoms}> + <div class="page_footerright"> + <img src="<{$xoops_url}>/modules/page/images/comments.png" alt="<{$block.content_comments}>"/> (<{$block.content_comments}> <{$smarty.const._MD_PAGE_VIEWPAGE_COMMENTS}>) + </div> + <{/if}> +</div> +<{/if}> +<{if $block.content_dosocial}> +<{includeq file='module:xoosocialnetwork|xoosocialnetwork.html'}> +<{/if}> \ No newline at end of file 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-27 20:21:42 UTC (rev 10573) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/xoops_version.php 2012-12-27 20:46:10 UTC (rev 10574) @@ -75,12 +75,6 @@ $modversion['tables'][2] = "page_related"; $modversion['tables'][3] = "page_rating"; -// 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' => '' ); -$modversion['templates'][] = array( 'file' => 'page_pdf.html', 'description' => '' ); - // blocks $i = 0; $modversion['blocks'][$i]['file'] = 'page_blocks.php'; @@ -91,14 +85,14 @@ $modversion['blocks'][$i]['options'] = 'random|5|19|0'; $modversion['blocks'][$i]['template'] = 'page_blocks_random.html'; $i++; -/*$modversion['blocks'][$i]['file'] = 'page_blocks.php'; +$modversion['blocks'][$i]['file'] = 'page_blocks.php'; $modversion['blocks'][$i]['name'] = _MI_PAGE_BLOCKS_ID; $modversion['blocks'][$i]['description'] = _MI_PAGE_BLOCKS_IDDSC; $modversion['blocks'][$i]['show_func'] = 'page_blocks_show'; $modversion['blocks'][$i]['edit_func'] = 'page_blocks_edit'; -$modversion['blocks'][$i]['options'] = 'id|5|19|1'; +$modversion['blocks'][$i]['options'] = 'id|0|0|0'; $modversion['blocks'][$i]['template'] = 'page_blocks_id.html'; -$i++;*/ +$i++; $modversion['blocks'][$i]['file'] = 'page_blocks.php'; $modversion['blocks'][$i]['name'] = _MI_PAGE_BLOCKS_RATING; $modversion['blocks'][$i]['description'] = _MI_PAGE_BLOCKS_RATINGDSC; |
From: <ma...@us...> - 2013-01-01 14:16:12
|
Revision: 10618 http://sourceforge.net/p/xoops/svn/10618 Author: mageg Date: 2013-01-01 14:16:08 +0000 (Tue, 01 Jan 2013) Log Message: ----------- update page module Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/blocks/page_blocks.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/page.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/docs/changelog.txt XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/page_blocks_id.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_navigation.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/xoops_version.php Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/blocks/page_blocks.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/blocks/page_blocks.php 2012-12-31 19:08:35 UTC (rev 10617) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/blocks/page_blocks.php 2013-01-01 14:16:08 UTC (rev 10618) @@ -73,17 +73,8 @@ if (count($view_content) == 0 || $view_content->getVar('content_status') == 0){ $content = array(); } else { - $parsed = parse_url(XOOPS_URL); - $url = isset($parsed['scheme']) ? $parsed['scheme'] . '://' : 'http://'; - if (isset($parsed['host'])) { - $url .= $parsed['host']; - if (isset($parsed['port'])) { - $url .= ':' . $parsed['port']; - } - } else { - $url .= $_SERVER['HTTP_HOST']; - } - $url = $url . $_SERVER['REQUEST_URI']; + $request = Xoops_Request::getInstance(); + $url = $request->getUrl(); // add module css $xoops->theme()->addStylesheet( $xoops->url('/modules/page/css/styles.css'), null ); $xoops->theme()->addStylesheet( $xoops->url('/modules/page/css/rating.css'), null ); @@ -153,7 +144,8 @@ } $content['content_dofooter'] = $footer; - /*$page = new Page(); + include_once XOOPS_ROOT_PATH. '/modules/page/class/page.php'; + $page = new Page(); $related = $page->menu_related($content_id); @@ -163,7 +155,7 @@ if ($related['navigation'] != '' ) { $content['navigation'] = $related['navigation']; $content['related'] = $related; - }*/ + } } } return $content; Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/page.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/page.php 2012-12-31 19:08:35 UTC (rev 10617) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/page.php 2013-01-01 14:16:08 UTC (rev 10618) @@ -28,7 +28,7 @@ { $xoops = Xoops::getInstance(); // Get handler - $related_Handler = $xoops->getModuleHandler('page_related'); + $related_Handler = $xoops->getModuleHandler('page_related', 'page'); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('related_contentid', $content_id)); $criteria->setLimit(1); @@ -63,7 +63,7 @@ $previous = $save_previous; $save_next = true; } else { - $summary[] = '<a href="viewpage.php?id=' . $related_arr[$i]->getVar('related_contentid') . '" title="' . $related_arr[$i]->getVar('content_title') . '">' . $related_arr[$i]->getVar('content_title') . '</a>'; + $summary[] = '<a href="' . XOOPS_URL . '/modules/page/viewpage.php?id=' . $related_arr[$i]->getVar('related_contentid') . '" title="' . $related_arr[$i]->getVar('content_title') . '">' . $related_arr[$i]->getVar('content_title') . '</a>'; if ($save_next == true){ $next = $related_arr[$i]->getVar('related_contentid'); $save_next = false; Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/docs/changelog.txt =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/docs/changelog.txt 2012-12-31 19:08:35 UTC (rev 10617) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/docs/changelog.txt 2013-01-01 14:16:08 UTC (rev 10618) @@ -1,4 +1,4 @@ Version 0.1 ------------------- -Create module page +Create page module Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/page_blocks_id.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/page_blocks_id.html 2012-12-31 19:08:35 UTC (rev 10617) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/page_blocks_id.html 2013-01-01 14:16:08 UTC (rev 10618) @@ -30,11 +30,11 @@ <{/if}> <{/if}> <div class="page_content"> - <{if $summary}> + <{if $block.summary}> <h4><{$smarty.const._MD_PAGE_VIEWPAGE_SUMMARY}>:</h4> <div> <ul> - <{foreach item=summary from=$summary}> + <{foreach item=summary from=$block.summary}> <li><{$summary}></li> <{/foreach}> </ul> @@ -43,8 +43,9 @@ <{$block.content_shorttext}> <br /> <{$block.content_text}> - <{if $navigation}> + <{if $block.navigation}> <div class="clear"></div> + <{assign var='related' value=$block.related}> <{includeq file="module:page|page_navigation.html"}> <div class="clear"></div> <{/if}> Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_navigation.html =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_navigation.html 2012-12-31 19:08:35 UTC (rev 10617) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_navigation.html 2013-01-01 14:16:08 UTC (rev 10618) @@ -15,7 +15,7 @@ <{/if}> <{if $related.navigation == 2}> <div class="page_navigation"> - <form class="form-inline" name='nav_form' id='nav_form' action='viewpage.php' method='get'> + <form class="form-inline" name='nav_form' id='nav_form' action='<{$xoops_url}>/modules/page/viewpage.php' method='get'> <{if $related.previous_id != 0}> <a href="<{$xoops_url}>/modules/page/viewpage.php?id=<{$related.previous_id}>" title="<{$related.previous_title}>"><img src="<{$xoops_url}>/modules/page/images/previous.png" alt="<{$related.previous_title}>"/></a> <{/if}> @@ -27,7 +27,7 @@ <option value="<{$id}>"><{$title}></option> <{/if}> <{/foreach}> - </select> + </select> <{if $related.next_id != 0}> <a href="<{$xoops_url}>/modules/page/viewpage.php?id=<{$related.next_id}>" title="<{$related.next_title}>"><img src="<{$xoops_url}>/modules/page/images/next.png" alt="<{$related.next_title}>"/></a> <{/if}> @@ -50,7 +50,7 @@ <{/if}> <{if $related.navigation == 4}> <div class="page_navigation" style="width: 250px;"> - <form class="form-inline" name='nav_form' id='nav_form' action='viewpage.php' method='get'> + <form class="form-inline" name='nav_form' id='nav_form' action='<{$xoops_url}>/modules/page/viewpage.php' method='get'> <select class="span2" size="1" onchange="document.forms.nav_form.submit()" name="id" id="select_nav" title=""> <{foreach item=title key=id from=$related.select}> <{if $id == $content_id}> @@ -64,16 +64,16 @@ </div> <{/if}> <{if $related.navigation == 5}> -<div class="page_navigation"> +<ul class="pager"> <{if $related.previous_id != 0}> - <div class="page_navigationL"> + <li class="previous"> <a href="<{$xoops_url}>/modules/page/viewpage.php?id=<{$related.previous_id}>" title="<{$related.previous_title}>"><{$related.previous_title}></a> - </div> + </li> <{/if}> <{if $related.next_id != 0}> - <div class="page_navigationR"> + <li class="next"> <a href="<{$xoops_url}>/modules/page/viewpage.php?id=<{$related.next_id}>" title="<{$related.next_title}>"><{$related.next_title}></a> - </div> + </li> <{/if}> -</div> +</ul> <{/if}> \ No newline at end of file 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-31 19:08:35 UTC (rev 10617) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/xoops_version.php 2013-01-01 14:16:08 UTC (rev 10618) @@ -34,10 +34,10 @@ $modversion['dirname'] = 'page'; //about -$modversion['release_date'] = '2012/11/25'; +$modversion['release_date'] = '2013/01/01'; $modversion['module_website_url'] = 'http://www.xoops.org/'; $modversion['module_website_name'] = 'XOOPS'; -$modversion['module_status'] = 'ALPHA 1'; +$modversion['module_status'] = 'Final'; $modversion['min_php'] = '5.2'; $modversion['min_xoops'] = '2.6.0'; $modversion['min_db'] = array('mysql'=>'5.0.7', 'mysqli'=>'5.0.7'); |
From: <du...@us...> - 2013-01-29 16:25:10
|
Revision: 10944 http://sourceforge.net/p/xoops/svn/10944 Author: dugris Date: 2013-01-29 16:25:04 +0000 (Tue, 29 Jan 2013) Log Message: ----------- Refactoring page module : use : - Xoops_Module_Helper - Xoops_Request - Xoops_Locale Add plugins for : - Waiting blocks - backend Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/content.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/header.php 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/menu.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/permissions.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/related.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/blocks/page_blocks.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/class/form/page_related.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/page_content.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/page_rating.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/page_related.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/comments.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/notifications.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/search.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/plugin/system.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/css/rating.css 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/docs/credits.txt XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/header.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/include/install.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/index.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/pdf.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/sql/mysql.sql XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/admin/page_admin_content.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/admin/page_admin_permissions.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/admin/page_admin_related.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/page_blocks_id.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_navigation.html 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_print.html 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/viewpage.php 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/class/groupperm.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/helper.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/page_related_link.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/icons/16/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/icons/16/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/icons/16/star_d.png XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/icons/16/star_o.png XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/icons/16/star_u.png XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/jquery_rating.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/locale/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/locale/en_US/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/locale/en_US/en_US.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/locale/en_US/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/locale/en_US/locale.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/locale/en_US/templates/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/locale/en_US/templates/help.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/locale/en_US/templates/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/locale/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/multi-select-init.js XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/multi-select.0.3-7/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/multi-select.0.3-7/css/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/multi-select.0.3-7/css/application.css XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/multi-select.0.3-7/css/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/multi-select.0.3-7/css/multi-select.css XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/multi-select.0.3-7/img/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/multi-select.0.3-7/img/arrow.png XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/multi-select.0.3-7/img/check.gif XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/multi-select.0.3-7/img/delete.png XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/multi-select.0.3-7/img/download.png XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/multi-select.0.3-7/img/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/multi-select.0.3-7/img/minus.png XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/multi-select.0.3-7/img/plus.png XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/multi-select.0.3-7/img/switch.png XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/multi-select.0.3-7/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/multi-select.0.3-7/js/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/multi-select.0.3-7/js/application.js XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/multi-select.0.3-7/js/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/multi-select.0.3-7/js/jquery.js XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/multi-select.0.3-7/js/jquery.multi-select.js XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/media/jquery/multi-select.0.3-7/js/jquery.quicksearch.js XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/preloads/core.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/page_blocks.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/page_blocks_content.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/page_blocks_list.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/page_rating.html Removed Paths: ------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/class/page.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/images/rating/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/js/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/language/english/admin.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/language/english/blocks.php 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/modinfo.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/rating.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/page_blocks_hits.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/page_blocks_random.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/page_blocks_rating.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/templates/blocks/page_blocks_recent.html Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/content.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/content.php 2013-01-29 13:28:01 UTC (rev 10943) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/content.php 2013-01-29 16:25:04 UTC (rev 10944) @@ -20,21 +20,9 @@ * @version $Id$ */ include dirname(__FILE__) . '/header.php'; -// Get main instance -$system = System::getInstance(); -$xoops = Xoops::getInstance(); -// Parameters -$nb_content = $xoops->getModuleConfig('page_adminpager'); -// Get Action type -$op = $system->cleanVars($_REQUEST, 'op', 'default', 'string'); -// Get handler -$content_Handler = $xoops->getModuleHandler('page_content'); -$related_Handler = $xoops->getModuleHandler('page_related'); -$gperm_handler = $xoops->getHandler('groupperm'); + // Call header $xoops->header('page_admin_content.html'); -// Get start pager -$start = $system->cleanVars($_REQUEST, 'start', 0, 'int'); $admin_page = new XoopsModuleAdmin(); $admin_page->renderNavigation('content.php'); @@ -43,257 +31,175 @@ case 'list': default: - // Add Scripts - $xoops->theme()->addScript('media/xoops/xoops.js'); - $admin_page->addTips(_AM_PAGE_CONTENT_TIPS); - $admin_page->addItemButton(_AM_PAGE_CONTENT_ADD, 'content.php?op=new', 'add'); + $admin_page->addTips(PageLocale::CONTENT_TIPS); + $admin_page->addItemButton(PageLocale::A_ADD_CONTENT, 'content.php?op=new', 'add'); $admin_page->renderTips(); $admin_page->renderButton(); - // Criteria - $criteria = new CriteriaCompo(); - $criteria->setSort('content_weight ASC, content_title'); - $criteria->setOrder('ASC'); - $criteria->setStart($start); - $criteria->setLimit($nb_content); - $content_count = $content_Handler->getCount($criteria); - $content_arr = $content_Handler->getAll($criteria); + // Content + $content_count = $content_Handler->countPage(); + $content_arr = $content_Handler->getPage($start, $nb_limit); + // Assign Template variables $xoops->tpl()->assign('content_count', $content_count); if ($content_count > 0) { foreach (array_keys($content_arr) as $i) { - $content_id = $content_arr[$i]->getVar('content_id'); - $content['id'] = $content_id; - $content['title'] = $content_arr[$i]->getVar('content_title'); - $content['maindisplay'] = $content_arr[$i]->getVar('content_maindisplay'); - $content['weight'] = $content_arr[$i]->getVar('content_weight'); - $content['status'] = $content_arr[$i]->getVar('content_status'); - $content['hits'] = $content_arr[$i]->getVar('content_hits'); - $content['rating'] = number_format($content_arr[$i]->getVar('content_rating'), 1); + $content = $content_arr[$i]->getValues(); $xoops->tpl()->append_by_ref('content', $content); unset($content); } // Display Page Navigation - if ($content_count > $nb_content) { - $nav = new XoopsPageNav($content_count, $nb_content, $start, 'start'); + if ($content_count > $nb_limit) { + $nav = new XoopsPageNav($content_count, $nb_limit, $start, 'start'); $xoops->tpl()->assign('nav_menu', $nav->renderNav(4, 'small')); } } else { - $xoops->tpl()->assign('error_message', _AM_PAGE_CONTENT_ERROR_NOCONTENT); + $xoops->tpl()->assign('error_message', PageLocale::E_NO_CONTENT); } break; case 'new': - $admin_page->addItemButton(_AM_PAGE_CONTENT_LIST, 'content.php', 'application-view-detail'); + $admin_page->addItemButton(PageLocale::A_LIST_CONTENT, 'content.php', 'application-view-detail'); $admin_page->renderButton(); $obj = $content_Handler->create(); - $form = $xoops->getModuleForm($obj, 'page_content'); + $form = $helper->getForm($obj, 'page_content'); $xoops->tpl()->assign('form', $form->render()); break; case 'edit': - $admin_page->addItemButton(_AM_PAGE_CONTENT_LIST, 'content.php', 'application-view-detail'); - $admin_page->addItemButton(_AM_PAGE_CONTENT_ADD, 'content.php?op=new', 'add'); + $admin_page->addItemButton(PageLocale::A_LIST_CONTENT, 'content.php', 'application-view-detail'); + $admin_page->addItemButton(PageLocale::A_ADD_CONTENT, 'content.php?op=new', 'add'); $admin_page->renderButton(); // Create form - $obj = $content_Handler->get($system->cleanVars($_REQUEST, 'id', 0, 'int')); - $form = $xoops->getModuleForm($obj, 'page_content'); + $content_id = $request->asInt('content_id', 0); + $obj = $content_Handler->get($content_id); + $form = $helper->getForm($obj, 'page_content'); $xoops->tpl()->assign('form', $form->render()); break; case 'save': if (!$xoops->security()->check()) { - $xoops->redirect("content.php", 3, implode(",", $xoops->security()->getErrors())); + $xoops->redirect('content.php', 3, implode(',', $xoops->security()->getErrors())); } - $content_id = $system->cleanVars($_REQUEST, 'content_id', 0, 'int'); + + $content_id = $request->asInt('content_id', 0); if ($content_id > 0) { $obj = $content_Handler->get($content_id); - if ($_POST["date_update"] == 'Y'){ - $obj->setVar("content_create", strtotime($_POST["content_create"])); - } } else { $obj = $content_Handler->create(); - $obj->setVar("content_create", time()); } + $error_message = ''; $error = false; - $obj->setVar("content_title", $_POST["content_title"]); - $obj->setVar("content_shorttext", $_POST["content_shorttext"]); - $obj->setVar("content_text", $_POST["content_text"]); - $obj->setVar("content_mkeyword", $_POST["content_mkeyword"]); - $obj->setVar("content_mdescription", $_POST["content_mdescription"]); - $obj->setVar("content_author", $_POST["content_author"]); - $obj->setVar("content_status", $_POST["content_status"]); - $obj->setVar("content_maindisplay", $_POST["content_maindisplay"]); - $obj->setVar("content_dopdf", 0); - $obj->setVar("content_doprint", 0); - $obj->setVar("content_domail", 0); - $obj->setVar("content_doauthor", 0); - $obj->setVar("content_dodate", 0); - $obj->setVar("content_dohits", 0); - $obj->setVar("content_dorating", 0); - $obj->setVar("content_doncoms", 0); - $obj->setVar("content_docoms", 0); - $obj->setVar("content_dosocial", 0); - $obj->setVar("content_dotitle", 0); - $obj->setVar("content_donotifications", 0); - if (isset($_POST["content_option"])) { - $content_option = $_POST["content_option"]; - foreach (array_keys($content_option) as $i) { - switch ($content_option[$i]) { - case 'pdf': - $obj->setVar("content_dopdf", 1); - break; - case 'print': - $obj->setVar("content_doprint", 1); - break; - case 'mail': - $obj->setVar("content_domail", 1); - break; - case 'author': - $obj->setVar("content_doauthor", 1); - break; - case 'date': - $obj->setVar("content_dodate", 1); - break; - case 'hits': - $obj->setVar("content_dohits", 1); - break; - case 'rating': - $obj->setVar("content_dorating", 1); - break; - case 'coms': - $obj->setVar("content_docoms", 1); - break; - case 'ncoms': - $obj->setVar("content_doncoms", 1); - break; - case 'social': - $obj->setVar("content_dosocial", 1); - break; - case 'title': - $obj->setVar("content_dotitle", 1); - break; - case 'notifications': - $obj->setVar("content_donotifications", 1); - break; - } - } + $obj->setVar('content_title', $request->asStr('content_title', '')); + $obj->setVar('content_shorttext', $request->asStr('content_shorttext', '')); + $obj->setVar('content_text', $request->asStr('content_text', '')); + $obj->setVar('content_mkeyword', $request->asStr('content_mkeyword', '')); + $obj->setVar('content_mdescription', $request->asStr('content_mdescription', '')); + + $date_create = $request->asArray('content_create', array()); + if (count($date_create) == 1) { + $content_create = strtotime($date_create['date']); + } elseif (count($date_create) == 2) { + $content_create = strtotime($date_create['date']) + $date_create['time']; + } else { + $content_create = time(); } - if (preg_match('/^\d+$/', $_POST["content_weight"]) == false){ + $obj->setVar('content_create', $content_create); + + $obj->setVar('content_author', $request->asInt('content_author', $helper->xoops()->user->getVar('uid'))); + $obj->setVar('content_status', $request->asInt('content_status', 1)); + $obj->setVar('content_maindisplay', $request->asInt('content_maindisplay', 1)); + + $content_option = $request->asArray('content_option', array()); + $obj->setVar('content_dopdf', in_array('pdf', $content_option)); + $obj->setVar('content_doprint', in_array('print', $content_option)); + $obj->setVar('content_domail', in_array('mail', $content_option)); + $obj->setVar('content_doauthor', in_array('author', $content_option)); + $obj->setVar('content_dodate', in_array('date', $content_option)); + $obj->setVar('content_dohits', in_array('hits', $content_option)); + $obj->setVar('content_dorating', in_array('rating', $content_option)); + $obj->setVar('content_doncoms', in_array('ncoms', $content_option)); + $obj->setVar('content_docoms', in_array('coms', $content_option)); + $obj->setVar('content_dosocial', in_array('social', $content_option)); + $obj->setVar('content_dotitle', in_array('title', $content_option)); + $obj->setVar('content_donotifications', in_array('notifications', $content_option)); + + if (preg_match('/^\d+$/', $request->asInt('content_weight', 0)) == false){ $error = true; - $error_message .= _AM_PAGE_CONTENT_ERROR_WEIGHT . '<br />'; - $obj->setVar("content_weight", ''); + $error_message .= PageLocale::E_WEIGHT . '<br />'; + $obj->setVar('content_weight', 0); } else { - $obj->setVar("content_weight", $_POST["content_weight"]); + $obj->setVar('content_weight', $request->asInt('content_weight', 0)); } if ($error == true){ $xoops->tpl()->assign('error_message', $error_message); } else { - if ($content_Handler->insert($obj)) { - $newcontent_id = $obj->get_new_id(); - $perm_id = isset($_REQUEST['content_id']) ? $content_id : $newcontent_id; - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('gperm_itemid', $perm_id, '=')); - $criteria->add(new Criteria('gperm_modid', $xoops->module->getVar('mid'),'=')); - $criteria->add(new Criteria('gperm_name', 'page_view_item', '=')); - $gperm_handler->deleteAll($criteria); - //permissions view - if(isset($_POST['groups_view_item'])) { - foreach($_POST['groups_view_item'] as $onegroup_id) { - $gperm_handler->addRight('page_view_item', $perm_id, $onegroup_id, $xoops->module->getVar('mid')); - } - } + if ($newcontent_id = $content_Handler->insert($obj)) { + // update permissions + $perm_id = $content_id > 0 ? $content_id : $newcontent_id; + $groups_view_item = $request->asArray('groups_view_item', array()); + $gperm_Handler->updatePerms($perm_id, $groups_view_item); + //notifications - if ($content_id == 0) { - if ($xoops->isActiveModule('notifications')) { - $notification_handler = Notifications::getInstance()->getHandlerNotification(); - $tags = array(); - $tags['MODULE_NAME'] = 'page'; - $tags['ITEM_NAME'] = $_POST["content_title"]; - $tags['ITEM_URL'] = XOOPS_URL . '/modules/page/viewpage.php?id=' . $newcontent_id; - $notification_handler->triggerEvent('global', 0, 'newcontent', $tags); - $notification_handler->triggerEvent('item', $newcontent_id, 'newcontent', $tags); - } + if ($content_id == 0 && $xoops->isActiveModule('notifications')) { + $notification_handler = Notifications::getInstance()->getHandlerNotification(); + $tags = array(); + $tags['MODULE_NAME'] = 'page'; + $tags['ITEM_NAME'] = $request->asStr('content_title', ''); + $tags['ITEM_URL'] = XOOPS_URL . '/modules/page/viewpage.php?id=' . $newcontent_id; + $notification_handler->triggerEvent('global', 0, 'newcontent', $tags); + $notification_handler->triggerEvent('item', $newcontent_id, 'newcontent', $tags); } - $xoops->redirect("content.php", 2, _AM_PAGE_DBUPDATED); + $xoops->redirect('content.php', 2, XoopsLocale::S_DATABASE_UPDATED); } echo $xoops->alert('error', $obj->getHtmlErrors()); } - $form = $xoops->getModuleForm($obj, 'page_content'); + $form = $helper->getForm($obj, 'page_content'); $xoops->tpl()->assign('form', $form->render()); break; case 'delete': - $admin_page->addItemButton(_AM_PAGE_CONTENT_LIST, 'content.php', 'application-view-detail'); - $admin_page->addItemButton(_AM_PAGE_CONTENT_ADD, 'content.php?op=new', 'add'); + $admin_page->addItemButton(PageLocale::A_LIST_CONTENT, 'content.php', 'application-view-detail'); + $admin_page->addItemButton(PageLocale::A_ADD_CONTENT, 'content.php?op=new', 'add'); $admin_page->renderButton(); - // Define Stylesheet - $xoops->theme()->addStylesheet('modules/system/css/admin.css'); - $content_id = $system->cleanVars($_REQUEST, 'id', 0, 'int'); + + $content_id = $request->asInt('content_id', 0); + $ok = $request->asInt('ok', 0); + $obj = $content_Handler->get($content_id); - if (isset($_POST["ok"]) && $_POST["ok"] == 1) { + if ($ok == 1) { if (!$xoops->security()->check()) { - $xoops->redirect("content.php", 3, implode(",", $xoops->security()->getErrors())); + $xoops->redirect('content.php', 3, implode(',', $xoops->security()->getErrors())); } // Deleting the content - if ($content_Handler->delete($obj)) { - // deleting permissions + if ($content_Handler->delete($obj)) { + // update permissions + $gperm_Handler->updatePerms($content_id); + + // deleting page_related_link $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('gperm_itemid', $content_id, '=')); - $criteria->add(new Criteria('gperm_modid', $xoops->module->getVar('mid'),'=')); - $criteria->add(new Criteria('gperm_name', 'page_view_item', '=')); - $gperm_handler->deleteAll($criteria); - // deleting secondary - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('related_group', 0, '!=')); - $criteria->add(new Criteria('related_contentid', $content_id)); - $related_Handler->deleteAll($criteria); + $criteria->add(new Criteria('link_content_id', $content_id)); + $link_Handler->deleteAll($criteria); + // deleting comments - if ($xoops->isActiveModule('comments')) { - $comment_handler = Comments::getInstance()->getHandlerComment()->deleteByItemId($xoops->module->getVar('mid'), $content_id); - } - // deleting main and secondary - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('related_group', 0)); - $criteria->add(new Criteria('related_contentid', $content_id)); - $related_arr = $related_Handler->getAll($criteria); - if (count($related_arr) > 0) { - foreach (array_keys($related_arr) as $i) { - $obj_related = $related_Handler->get($related_arr[$i]->getVar("related_id")); - $related_Handler->delete($obj_related); - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('related_group', $related_arr[$i]->getVar("related_id"))); - $related_Handler->deleteAll($criteria); - } - } - $xoops->redirect("content.php", 2, _AM_PAGE_DBUPDATED); + if ($xoops->isActiveModule('comments')) { + $comment_handler = Comments::getInstance()->getHandlerComment()->deleteByItemId($helper->getModule()->getVar('mid'), $content_id); } + + $xoops->redirect('content.php', 2, XoopsLocale::S_DATABASE_UPDATED); } else { echo $xoops->alert('error', $obj->getHtmlErrors()); } } else { // deleting main and secondary - $related_name = ''; - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('related_group', 0)); - $criteria->add(new Criteria('related_contentid', $content_id)); - $related_arr = $related_Handler->getAll($criteria); - if (count($related_arr) > 0) { - $related_name .= '<br />' . _AM_PAGE_RELATED_DELMAIN . '<br />'; - foreach (array_keys($related_arr) as $i) { - $related_name .= '<span style="color : Red">'; - $related_name .= $related_arr[$i]->getVar("related_name"); - $related_name .= '</span>'; - $related_name .= '<br />'; - } - } - $xoops->confirm(array("ok" => 1, "id" => $content_id, "op" => "delete"), 'content.php', sprintf(_AM_PAGE_SUREDEL, $obj->getvar('content_title')) . '<br />' . $related_name); + $xoops->confirm(array('ok' => 1, 'content_id' => $content_id, 'op' => 'delete'), 'content.php', + XoopsLocale::Q_ARE_YOU_SURE_YOU_WANT_TO_DELETE_THIS_ITEM . '<br /><span class="red">' . $obj->getvar('content_title') . '<span>'); } break; case 'update_status': - $content_id = $system->cleanVars($_POST, 'content_id', 0, 'int'); + $content_id = $request->asInt('content_id', 0); if ($content_id > 0) { $obj = $content_Handler->get($content_id); $old = $obj->getVar('content_status'); @@ -306,7 +212,7 @@ break; case 'update_display': - $content_id = $system->cleanVars($_POST, 'content_id', 0, 'int'); + $content_id = $request->asInt('content_id', 0); if ($content_id > 0) { $obj = $content_Handler->get($content_id); $old = $obj->getVar('content_maindisplay'); @@ -319,47 +225,15 @@ break; case 'clone': - $content_id = $system->cleanVars($_REQUEST, 'id', 0, 'int'); - $content = $content_Handler->get($content_id); - $obj = $content_Handler->create(); - $obj->setVar("content_title", _AM_PAGE_CONTENT_COPY . $content->getVar("content_title")); - $obj->setVar("content_weight", 0); - $obj->setVar("content_create", time()); - $obj->setVar("content_shorttext", $content->getVar("content_shorttext")); - $obj->setVar("content_text", $content->getVar("content_text")); - $obj->setVar("content_mkeyword", $content->getVar("content_mkeyword")); - $obj->setVar("content_mdescription", $content->getVar("content_mdescription")); - $obj->setVar("content_author", $content->getVar("content_author")); - $obj->setVar("content_status", $content->getVar("content_status")); - $obj->setVar("content_maindisplay", $content->getVar("content_maindisplay")); - $obj->setVar("content_dopdf", $content->getVar("content_dopdf")); - $obj->setVar("content_doprint", $content->getVar("content_doprint")); - $obj->setVar("content_domail", $content->getVar("content_domail")); - $obj->setVar("content_doauthor", $content->getVar("content_doauthor")); - $obj->setVar("content_dodate", $content->getVar("content_dodate")); - $obj->setVar("content_dohits", $content->getVar("content_dohits")); - $obj->setVar("content_dorating", $content->getVar("content_dorating")); - $obj->setVar("content_docoms", $content->getVar("content_docoms")); - $obj->setVar("content_doncoms", $content->getVar("content_doncoms")); - $obj->setVar("content_dosocial", $content->getVar("content_dosocial")); - $obj->setVar("content_dotitle", $content->getVar("content_dotitle")); - $obj->setVar("content_donotifications", $content->getVar("content_donotifications")); - if ($content_Handler->insert($obj)) { - $newcontent_id = $obj->get_new_id(); - $gperm_handler = $xoops->getHandler('groupperm'); - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('gperm_itemid', $content_id, '=')); - $criteria->add(new Criteria('gperm_modid', $xoops->module->getVar('mid'),'=')); - $criteria->add(new Criteria('gperm_name', 'page_view_item', '=')); - $gperm_arr = $gperm_handler->getall($criteria); - //permissions view - foreach (array_keys($gperm_arr) as $i) { - $gperm_handler->addRight('page_view_item', $newcontent_id, $gperm_arr[$i]->getVar("gperm_groupid"), $xoopsModule->getVar('mid')); - } - $xoops->redirect("content.php", 2, _AM_PAGE_DBUPDATED); + $content_id = $request->asInt('content_id', 0); + $obj = $content_Handler->getClone($content_id); + + if ($newcontent_id = $content_Handler->insert($obj)) { + $gperm_arr = $gperm_Handler->getGroupIds('page_view_item', $content_id, $module_id); + $gperm_Handler->updatePerms($newcontent_id, array_values($gperm_arr)); + $xoops->redirect('content.php', 2, XoopsLocale::S_DATABASE_UPDATED); } echo $xoops->alert('error', $obj->getHtmlErrors()); - break; } $xoops->footer(); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/header.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/header.php 2013-01-29 13:28:01 UTC (rev 10943) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/header.php 2013-01-29 16:25:04 UTC (rev 10944) @@ -21,5 +21,31 @@ */ require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/include/cp_header.php'; -$xoops = Xoops::getInstance(); -XoopsLoad::load('system', 'system'); \ No newline at end of file +// Get main instance +XoopsLoad::load('system', 'system'); +$system = System::getInstance(); + +$request = Xoops_Request::getInstance(); +$helper = Page::getInstance(); +$xoops = $helper->xoops(); + +// Get handler +$content_Handler = $helper->getContentHandler(); +$related_Handler = $helper->getRelatedHandler(); +$link_Handler = $helper->getLinkHandler(); +$rating_Handler = $helper->getRatingHandler(); +$gperm_Handler = $helper->getGrouppermHandler(); + +// Get $_POST, $_GET, $_REQUEST +$op = $request->asStr('op', 'list'); +$start = $request->asInt('start', 0); + +// Parameters +$nb_limit = $helper->getConfig('page_adminpager'); +$module_id = $helper->getModule()->getVar('mid'); + +// Define Stylesheet +$xoops->theme()->addStylesheet('modules/system/css/admin.css'); + +// Add Scripts +$xoops->theme()->addScript('media/xoops/xoops.js'); 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 2013-01-29 13:28:01 UTC (rev 10943) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/index.php 2013-01-29 16:25:04 UTC (rev 10944) @@ -20,39 +20,39 @@ * @version $Id$ */ include dirname(__FILE__) . '/header.php'; + // heaser -$xoops = Xoops::getInstance(); $xoops->header(); -// Get page handler -$content_Handler = $xoops->getModuleHandler('page_content'); // content not display $criteria = new CriteriaCompo(); $criteria->add(new Criteria('content_status', 0)); $content_notdisplay = $content_Handler->getCount($criteria); + // content display $criteria = new CriteriaCompo(); $criteria->add(new Criteria('content_status', 0, '!=')); $content_display = $content_Handler->getCount($criteria); -// folder path -//$folder_path = XOOPS_ROOT_PATH . '/uploads/page'; - $admin_page = new XoopsModuleAdmin(); $admin_page->displayNavigation('index.php'); // content -$admin_page->addInfoBox(_MI_PAGE_CONTENT, 'content'); -$admin_page->addInfoBoxLine(sprintf(_AM_PAGE_INDEX_TOTALCONTENT, $content_notdisplay + $content_display), 'content'); -$admin_page->addInfoBoxLine(sprintf(_AM_PAGE_INDEX_TOTALDISPLAY, '<span class="green">' . $content_display . '</span>'), 'content'); -$admin_page->addInfoBoxLine(sprintf(_AM_PAGE_INDEX_TOTALNOTDISPLAY, '<span class="red">' . $content_notdisplay . '</span>'), 'content'); +$admin_page->addInfoBox(XoopsLocale::CONTENT, 'content'); +$admin_page->addInfoBoxLine(sprintf(PageLocale::TOTALCONTENT, $content_notdisplay + $content_display), 'content'); +$admin_page->addInfoBoxLine(sprintf(PageLocale::TOTALDISPLAY, $content_display), 'content'); +$admin_page->addInfoBoxLine(sprintf(PageLocale::TOTALNOTDISPLAY, $content_notdisplay), 'content'); // extension +$extensions = array('comments' => 'extension', + 'notifications' => 'extension', + 'pdf' => 'extension', + 'xoosocialnetwork' => 'extension', + ); -$admin_page->addConfigBoxLine(array('comments', 'warning'), 'extension'); -$admin_page->addConfigBoxLine(array('notifications', 'warning'), 'extension'); -$admin_page->addConfigBoxLine(array('pdf', 'warning'), 'extension'); -$admin_page->addConfigBoxLine(array('xoosocialnetwork', 'warning'), 'extension'); +foreach ($extensions as $module => $type) { + $admin_page->addConfigBoxLine(array($module, 'warning'), $type); +} $admin_page->displayIndex(); $xoops->footer(); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/menu.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/menu.php 2013-01-29 13:28:01 UTC (rev 10943) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/menu.php 2013-01-29 16:25:04 UTC (rev 10944) @@ -22,22 +22,22 @@ $adminmenu = array(); $i = 1; -$adminmenu[$i]['title'] = _MI_PAGE_INDEX; +$adminmenu[$i]['title'] = XoopsLocale::HOME; $adminmenu[$i]['link'] = 'admin/index.php'; $adminmenu[$i]['icon'] = 'home.png'; $i++; -$adminmenu[$i]['title'] = _MI_PAGE_CONTENT; +$adminmenu[$i]['title'] = PageLocale::SYSTEM_CONTENT; $adminmenu[$i]['link'] = 'admin/content.php'; $adminmenu[$i]['icon'] = 'content.png'; $i++; -$adminmenu[$i]['title'] = _MI_PAGE_RELATED; +$adminmenu[$i]['title'] = PageLocale::SYSTEM_RELATED; $adminmenu[$i]['link'] = 'admin/related.php'; $adminmenu[$i]['icon'] = 'groupmod.png'; $i++; -$adminmenu[$i]['title'] = _MI_PAGE_PERMISSIONS; +$adminmenu[$i]['title'] =PageLocale::SYSTEM_PERMISSIONS; $adminmenu[$i]['link'] = 'admin/permissions.php'; $adminmenu[$i]['icon'] = 'permissions.png'; $i++; -$adminmenu[$i]['title'] = _MI_PAGE_ABOUT; +$adminmenu[$i]['title'] = PageLocale::SYSTEM_ABOUT; $adminmenu[$i]['link'] = 'admin/about.php'; $adminmenu[$i]['icon'] = 'about.png'; \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/permissions.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/permissions.php 2013-01-29 13:28:01 UTC (rev 10943) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/permissions.php 2013-01-29 16:25:04 UTC (rev 10944) @@ -19,42 +19,32 @@ * @author Mage Gr�gory (AKA Mage) * @version $Id$ */ + include dirname(__FILE__) . '/header.php'; -// Get main instance -$system = System::getInstance(); -$xoops = Xoops::getInstance(); -// Parameters -$nb_content = $xoops->getModuleConfig('page_adminpager'); + // Get Action type -$op = $system->cleanVars($_REQUEST, 'op', 'global', 'string'); -// Get handler -$content_Handler = $xoops->getModuleHandler('page_content'); -$gperm_handler = $xoops->getHandler('groupperm'); +$op = $request->asStr('op', 'global'); + // Call header $xoops->header('page_admin_permissions.html'); -// Get start pager -$start = $system->cleanVars($_REQUEST, 'start', 0, 'int'); - $admin_page = new XoopsModuleAdmin(); $admin_page->renderNavigation('permissions.php'); $opform = new XoopsSimpleForm('', 'opform', 'permissions.php', 'get'); -$op_select = new XoopsFormSelect("", 'op', $op); +$op_select = new XoopsFormSelect('', 'op', $op); $op_select->setExtra('onchange="document.forms.opform.submit()"'); -$op_select->addOption('global', _AM_PAGE_PERMISSIONS_GLOBAL); -$op_select->addOption('view', _AM_PAGE_PERMISSIONS_VIEW); +$op_select->addOption('global', PageLocale::PERMISSIONS_RATE); +$op_select->addOption('view', PageLocale::PERMISSIONS_VIEW); $opform->addElement($op_select); $xoops->tpl()->assign('form', $opform->render()); -$module_id = $xoops->module->getVar('mid'); - switch ($op) { case 'global': - default: - $global_perm_array = array('4' => _AM_PAGE_PERMISSIONS_GLOBAL_RATE); - $form = new XoopsGroupPermForm(_AM_PAGE_PERMISSIONS_GLOBAL, $module_id, "page_global", _AM_PAGE_PERMISSIONS_GLOBAL_DSC, 'admin/permissions.php', true); + default: + $global_perm_array = array('1' => PageLocale::PERMISSIONS_RATE); + $form = new XoopsGroupPermForm('', $module_id, 'page_global', '', 'admin/permissions.php', true); foreach( $global_perm_array as $perm_id => $perm_name ) { $form->addItem($perm_id , $perm_name) ; } @@ -62,55 +52,44 @@ break; case 'view': - // View permission + // Content + $content_count = $content_Handler->countPage($start, $nb_limit); + $content_arr = $content_Handler->getPage($start, $nb_limit); - // Add Scripts - $xoops->theme()->addScript('media/xoops/xoops.js'); - // Criteria - $criteria = new CriteriaCompo(); - $criteria->setSort('content_weight ASC, content_title'); - $criteria->setOrder('ASC'); - $criteria->setStart($start); - $criteria->setLimit($nb_content); - $content_count = $content_Handler->getCount($criteria); - $content_arr = $content_Handler->getAll($criteria); // Assign Template variables $xoops->tpl()->assign('content_count', $content_count); + if ($content_count > 0) { - $member_handler = $xoops->getHandler('member'); - $group_list = $member_handler->getGroupList(); + $group_list = $xoops->getHandler('member')->getGroupList(); - $module_id = $xoops->isModule() ? $xoops->module->getVar('mid', 'n') : 1; - $xoops->tpl()->assign('groups', $group_list); foreach (array_keys($content_arr) as $i) { - $content_id = $content_arr[$i]->getVar("content_id"); + $content_id = $content_arr[$i]->getVar('content_id'); $perms = ''; - $groups_ids_view = $gperm_handler->getGroupIds('page_view_item', $content_id, $module_id); + $groups_ids_view = $gperm_Handler->getGroupIds('page_view_item', $content_id, $module_id); $groups_ids_view = array_values($groups_ids_view); foreach (array_keys($group_list) as $j) { $perms .= '<img id="loading_display' . $content_id . '_' . $j .'" src="' . $xoops->url('media/xoops/images/spinner.gif') . '" style="display:none;" alt="' . _AM_SYSTEM_LOADING . '" />'; if (in_array($j, $groups_ids_view)) { - $perms .= "<img class=\"cursorpointer\" id=\"display" . $content_id . "_" . $j . "\" onclick=\"Xoops.changeStatus( 'permissions.php', { op: 'update_view', content_id: " . $content_id . ", group: " . $j . ", status: 'no' }, 'display" . $content_id . "_" . $j ."', 'permissions.php' )\" src=\"" . $xoops->url('modules/system/images/icons/default/success.png') . "\" alt=\"" . _AM_PAGE_OFF . "\" title=\"" . _AM_PAGE_OFF . "\" />"; + $perms .= "<img class=\"cursorpointer\" id=\"display" . $content_id . "_" . $j . "\" onclick=\"Xoops.changeStatus( 'permissions.php', { op: 'update_view', content_id: " . $content_id . ", group: " . $j . ", status: 'no' }, 'display" . $content_id . "_" . $j ."', 'permissions.php' )\" src=\"" . $xoops->url('modules/system/images/icons/default/success.png') . "\" alt=\"" . XoopsLocale::A_DISABLE . "\" title=\"" . XoopsLocale::A_DISABLE . "\" />"; } else { - $perms .= "<img class=\"cursorpointer\" id=\"display" . $content_id . "_" . $j . "\" onclick=\"Xoops.changeStatus( 'permissions.php', { op: 'update_view', content_id: " . $content_id . ", group: " . $j . ", status: 'yes' }, 'display" . $content_id . "_" . $j ."', 'permissions.php' )\" src=\"" . $xoops->url('modules/system/images/icons/default/cancel.png') . "\" alt=\"" . _AM_PAGE_ON . "\" title=\"" . _AM_PAGE_ON . "\" />"; - + $perms .= "<img class=\"cursorpointer\" id=\"display" . $content_id . "_" . $j . "\" onclick=\"Xoops.changeStatus( 'permissions.php', { op: 'update_view', content_id: " . $content_id . ", group: " . $j . ", status: 'yes' }, 'display" . $content_id . "_" . $j ."', 'permissions.php' )\" src=\"" . $xoops->url('modules/system/images/icons/default/cancel.png') . "\" alt=\"" . XoopsLocale::A_ENABLE . "\" title=\"" . XoopsLocale::A_ENABLE . "\" />"; } $perms .= $group_list[$j] . '<br />'; } $content['id'] = $content_id; - $content['title'] = $content_arr[$i]->getVar("content_title"); + $content['title'] = $content_arr[$i]->getVar('content_title'); $content['permissions'] = $perms; $xoops->tpl()->append_by_ref('content', $content); unset($content); } // Display Page Navigation - if ($content_count > $nb_content) { - $nav = new XoopsPageNav($content_count, $nb_content, $start, 'start', 'op=view'); + if ($content_count > $nb_limit) { + $nav = new XoopsPageNav($content_count, $nb_limit, $start, 'start', 'op=view'); $xoops->tpl()->assign('nav_menu', $nav->renderNav(4)); } } else { - $xoops->tpl()->assign('error_message', _AM_PAGE_CONTENT_ERROR_NOCONTENT); + $xoops->tpl()->assign('error_message', PageLocale::E_NO_CONTENT); } break; @@ -122,17 +101,16 @@ if ($status == 'no') { // deleting permissions $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('gperm_groupid', $group, '=')); - $criteria->add(new Criteria('gperm_itemid', $content_id, '=')); - $criteria->add(new Criteria('gperm_modid', $xoopsModule->getVar('mid'),'=')); - $criteria->add(new Criteria('gperm_name', 'page_view_item', '=')); - $gperm_handler->deleteAll($criteria); + $criteria->add(new Criteria('gperm_groupid', $group)); + $criteria->add(new Criteria('gperm_itemid', $content_id)); + $criteria->add(new Criteria('gperm_modid', $module_id)); + $criteria->add(new Criteria('gperm_name', 'page_view_item')); + $gperm_Handler->deleteAll($criteria); } else { // add permissions - $gperm_handler->addRight('page_view_item', $content_id, $group, $xoopsModule->getVar('mid')); + $gperm_Handler->addRight('page_view_item', $content_id, $group, $module_id); } } break; } - $xoops->footer(); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/related.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/related.php 2013-01-29 13:28:01 UTC (rev 10943) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/page/admin/related.php 2013-01-29 16:25:04 UTC (rev 10944) @@ -20,20 +20,9 @@ * @version $Id$ */ include dirname(__FILE__) . '/header.php'; -// Get main instance -$system = System::getInstance(); -$xoops = Xoops::getInstance(); -// Parameters -$nb_related = $xoops->getModuleConfig('page_adminpager'); -// Get Action type -$op = $system->cleanVars($_REQUEST, 'op', 'default', 'string'); -// Get handler -$related_Handler = $xoops->getModuleHandler('page_related'); -$content_Handler = $xoops->getModuleHandler('page_content'); + // Call header $xoops->header('page_admin_related.html'); -// Get start pager -$start = $system->cleanVars($_REQUEST, 'start', 0, 'int'); $admin_page = new XoopsModuleAdmin(); $admin_page->renderNavigation('related.php'); @@ -42,186 +31,148 @@ case 'list': default: - // Define Stylesheet - $xoops->theme()->addStylesheet('media/jquery/ui/' . $xoops->getModuleConfig('jquery_theme', 'system') . '/ui.all.css'); - // Define scripts - $xoops->theme()->addScript('media/xoops/xoops.js'); - $xoops->theme()->addScript($xoops->url('/media/jquery/ui/jquery.ui.js')); - $xoops->theme()->addScript('modules/system/js/admin.js'); - - $admin_page->addTips(_AM_PAGE_RELATED_TIPS); - $admin_page->addItemButton(_AM_PAGE_RELATED_ADD, 'related.php?op=new', 'add'); + $admin_page->addTips(PageLocale::RELATED_TIPS); + $admin_page->addItemButton(PageLocale::A_ADD_RELATED, 'related.php?op=new', 'add'); $admin_page->renderTips(); $admin_page->renderButton(); - //joint - $criteria = new CriteriaCompo(); - $criteria->setSort('related_name'); - $criteria->setOrder('ASC'); - $criteria->setStart($start); - $criteria->setLimit($nb_related); - $criteria->add(new Criteria('related_name', '/', '!=')); - $related_Handler->table_link = $related_Handler->db->prefix('page_content'); - $related_Handler->field_link = 'content_id'; // champ de la table en jointure - $related_Handler->field_object = 'related_contentid'; // champ de la table courante - $related_arr = $related_Handler->getByLink($criteria); - $related_count = $related_Handler->getCount($criteria); - // Assign Template variables + $related_count = $related_Handler->countRelated($start, $nb_limit); + $related_arr = $related_Handler->getRelated($start, $nb_limit); + $xoops->tpl()->assign('related_count', $related_count); + $xoops->tpl()->assign('related', $related_arr); + if ($related_count > 0) { - foreach (array_keys($related_arr) as $i) { - $related_id = $related_arr[$i]->getVar("related_id"); - $related['id'] = $related_id; - $related['name'] = $related_arr[$i]->getVar("related_name"); - $related['main_name'] = $related_arr[$i]->getVar("content_title"); - $related['main_contentid'] = $related_arr[$i]->getVar("related_contentid"); - $related['domenu'] = $related_arr[$i]->getVar("related_domenu"); - switch ($related_arr[$i]->getVar("related_navigation")) { - case 1: - default: - $related['navigation'] = _AM_PAGE_RELATED_NAVIGATION_OPTION1; - break; - case 2: - $related['navigation'] = _AM_PAGE_RELATED_NAVIGATION_OPTION2; - break; - case 3: - $related['navigation'] = _AM_PAGE_RELATED_NAVIGATION_OPTION3; - break; - case 4: - $related['navigation'] = _AM_PAGE_RELATED_NAVIGATION_OPTION4; - break; - case 5: - $related['navigation'] = _AM_PAGE_RELATED_NAVIGATION_OPTION5; - break; - } - //joint - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('related_group', $related_arr[$i]->getVar("related_contentid"))); - $criteria->setSort('related_weight'); - $criteria->setOrder('ASC'); - $related_Handler->table_link = $related_Handler->db->prefix('page_content'); - $related_Handler->field_link = 'content_id'; // champ de la table en jointure - $related_Handler->field_object = 'related_contentid'; // champ de la table courante - $secondary_arr = $related_Handler->getByLink($criteria); - $related['secondary'] = ''; - if (count($secondary_arr) != 0) { - - $related['secondary'] .= '<ul>'; - foreach (array_keys($secondary_arr) as $j) { - if ($secondary_arr[$j]->getVar("related_name") == '/') { - $related['secondary'] .= '<li><a href="content.php?op=edit&id=' . $secondary_arr[$j]->getVar("related_contentid") . '" title="' . _AM_PAGE_EDIT . '">' . $secondary_arr[$j]->getVar("content_title") . '</a></li>'; - } - } - $related['secondary'] .= '</ul>'; - } - $xoops->tpl()->append_by_ref('related', $related); - $xoops->tpl()->append_by_ref('popup_related', $related); - unset($related); - } // Display Page Navigation - if ($related_count > $nb_related) { - $nav = new XoopsPageNav($related_count, $nb_related, $start, 'start'); + if ($related_count > $nb_limit) { + $nav = new XoopsPageNav($related_count, $nb_limit, $start, 'start'); $xoops->tpl()->assign('nav_menu', $nav->renderNav(4)); } } else { - $xoops->tpl()->assign('error_message', _AM_PAGE_RELATED_ERROR_NORELATED); + $xoops->tpl()->assign('error_message', PageLocale::E_NO_RELATED); } break; case 'new': if ($related_Handler->getCount() == $content_Handler->getCount()) { - $xoops->tpl()->assign('error_message', _AM_PAGE_RELATED_ERROR_NOFREECONTENT); + $xoops->tpl()->assign('error_message', PageLocale::E_NO_FREE_CONTENT); } else { - $admin_page->addItemButton(_AM_PAGE_CONTENT_LIST, 'related.php', 'application-view-detail'); + $admin_page->addItemButton(PageLocale::A_LIST_CONTENT, 'related.php', 'application-view-detail'); $admin_page->renderButton(); $obj = $related_Handler->create(); - $form = $xoops->getModuleForm($obj, 'page_related'); + $form = $helper->getForm($obj, 'page_related'); $xoops->tpl()->assign('form', $form->render()); } break; case 'edit': - $admin_page->addItemButton(_AM_PAGE_CONTENT_LIST, 'related.php', 'application-view-detail'); - $admin_page->addItemButton(_AM_PAGE_CONTENT_ADD, 'related.php?op=new', 'add'); + $admin_page->addItemButton(PageLocale::A_LIST_CONTENT, 'related.php', 'application-view-detail'); + $admin_page->addItemButton(PageLocale::A_ADD_CONTENT, 'related.php?op=new', 'add'); $admin_page->renderButton(); // Create form - $obj = $related_Handler->get($system->cleanVars($_REQUEST, 'id', 0, 'int')); - $form = $xoops->getModuleForm($obj, 'page_related'); + $related_id = $request->asInt('related_id', 0); + $obj = $related_Handler->get($related_id); + $form = $helper->getForm($obj, 'page_related'); $xoops->tpl()->assign('form', $form->render()); break; case 'save': if (!$xoops->security()->check()) { - $xoops->redirect("related.php", 3, implode(",", $xoops->security()->getErrors())); + $xoops->redirect('related.php', 3, implode(',', $xoops->security()->getErrors())); } - $related_id = $system->cleanVars($_REQUEST, 'related_id', 0, 'int'); + + $related_id = $request->asInt('related_id', 0); if ($related_id > 0) { $obj = $related_Handler->get($related_id); - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('related_group', $obj->getVar('related_group'))); - $criteria->add(new Criteria('related_name', '/')); - $related_Handler->deleteAll($criteria); } else { $obj = $related_Handler->create(); } + //main - $obj->setVar("related_name", $_POST["related_name"]); - $obj->setVar("related_group", $_POST["related_main"]); - $obj->setVar("related_contentid", $_POST["related_main"]); - $obj->setVar("related_domenu", $_POST["related_domenu"]); - $obj->setVar("related_navigation", $_POST["related_navigation"]); - if ($related_Handler->insert($obj)) { - //secondary - $secondary_max = 10; - for ($i = 1; $i <= $secondary_max; $i++) { - if ($_POST["related_secondary" . $i] != 0 && $_POST["related_secondary" . $i] != $_POST["related_main"]) { - $obj = $related_Handler->create(); - $obj->setVar("related_name", "/"); - $obj->setVar("related_group", $_POST["related_main"]); - $obj->setVar("related_contentid", $_POST["related_secondary" . $i]); - $obj->setVar("related_domenu", $_POST["related_domenu"]); - $obj->setVar("related_navigation", $_POST["related_navigation"]); - $obj->setVar("related_weight", $i); - $related_Handler->insert($obj); - unset($obj); + $obj->setVar('related_name', $request->asStr('related_name', '')); + $obj->setVar('related_domenu', $request->asInt('related_domenu', 1)); + $obj->setVar('related_navigation', $request->asInt('related_navigation', 1)); + + if ( $related_newid = $related_Handler->insert($obj)) { + $related_id = $related_id != 0 ? $related_id : $related_newid; + $datas = $request->asArray('datas'); + $datas_exists = $link_Handler->getContentByRelated($related_newid); + $datas_delete = array_diff(array_values($datas_exists), $datas); + $datas_add = array_diff($datas, array_values($datas_exists)); + + // delete + if (count($datas_delete) != 0 ) { + $criteria = $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('link_related_id', $related_id)); + $criteria->add(new Criteria('link_content_id', '(' . implode(', ', $datas_delete) . ')', 'IN')); + $links_ids = $link_Handler->getIds($criteria); + if (!$link_Handler->DeleteByIds($links_ids)) { } } - $xoops->redirect("related.php", 2, _AM_PAGE_DBUPDATED); + // Add + if (count($datas_add) != 0 ) { + foreach ($datas_add as $weight => $content_id) { + $obj = $link_Handler->create(); + $obj->setVar('link_related_id', $related_id); + $obj->setVar('link_content_id', $content_id); + $obj->setVar('link_weight', $weight); + if (!$link_Handler->insert($obj)) { + } + } + } + //update + if (count($datas) != 0 ) { + foreach ($datas as $weight => $content_id) { + $criteria = $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('link_related_id', $related_id)); + $criteria->add(new Criteria('link_content_id', $content_id)); + $links_ids = $link_Handler->getIds($criteria); + + $obj = $link_Handler->get($links_ids[0]); + $obj->setVar('link_weight', $weight); + if (!$link_Handler->insert($obj)) { + } + } + } + + $xoops->redirect('related.php', 2, XoopsLocale::S_DATABASE_UPDATED); } else { echo $xoops->alert('error', $obj->getHtmlErrors()); } - $form = $xoops->getModuleForm($obj, 'page_related'); + $form = $helper->getForm($obj, 'page_related'); $xoops->tpl()->assign('form', $form->render()); break; case 'delete': - $admin_page->addItemButton(_AM_PAGE_CONTENT_LIST, 'related.php', 'application-view-detail'); - $admin_page->addItemButton(_AM_PAGE_CONTENT_ADD, 'related.php?op=new', 'add'); + $admin_page->addItemButton(PageLocale::A_LIST_CONTENT, 'related.php', 'application-view-detail'); + $admin_page->addItemButton(PageLocale::A_ADD_CONTENT, 'related.php?op=new', 'add'); $admin_page->renderButton(); - // Define Stylesheet - $xoops->theme()->addStylesheet('modules/system/css/admin.css'); - $related_id = $system->cleanVars($_REQUEST, 'id', 0, 'int'); + + $related_id = $request->asInt('related_id', 0); + $ok = $request->asInt('ok', 0); + $obj = $related_Handler->get($related_id); - if (isset($_POST["ok"]) && $_POST["ok"] == 1) { + if ($ok == 1) { if (!$xoops->security()->check()) { - $xoops->redirect("related.php", 3, implode(",", $xoops->security()->getErrors())); + $xoops->redirect('related.php', 3, implode(',', $xoops->security()->getErrors())); } ... [truncated message content] |