From: <ada...@us...> - 2003-07-19 18:08:11
|
Update of /cvsroot/phpwebsite-comm/modules/article/class In directory sc8-pr-cvs1:/tmp/cvs-serv1829/class Modified Files: Article.php ArticleManager.php Log Message: popboxes removed - now compatible with ver0.93 More bugs caught & fixed Interface Adjusted - Deleting articles & sections (without javascript enabled) now takes you to a separate confirmation screen. Printable version can now show site header & footer if set in the Configuration menu Index: Article.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/article/class/Article.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Article.php 17 Jul 2003 22:16:07 -0000 1.6 --- Article.php 19 Jul 2003 18:08:04 -0000 1.7 *************** *** 209,212 **** --- 209,213 ---- $copyright = '<a href="'.$rights[rand(0,2)].'"><img src="http://'.PHPWS_SOURCE_HTTP . 'mod/article/img/mark.gif" border="0" title="Article Manager module by by George! Software." alt="Article Manager module by by George! Software."></a>'; + $article_link = 'index.php?module=article&view='.$this->id; $article_tags = array(); *************** *** 242,245 **** --- 243,247 ---- if ($Fullpage) /* Full article display */ { + $printAll = $_REQUEST['page_num']=='all' || isset($_REQUEST['lay_quiet']); /* Keep track of any sub-page titles for the NavBar */ $page_list[] = $this->title; *************** *** 260,264 **** /* If this section is in the requested page range, print it */ if (is_object($this->sections[$value]) ! && ($page_count==$page_wanted || $_REQUEST['page_num']=='all')) $article_tags['BODYTEXT'] .= $this->sections[$value]->view_section(0,$this->id ,$this->created_username,$this->created_date,$this->updated_username --- 262,266 ---- /* If this section is in the requested page range, print it */ if (is_object($this->sections[$value]) ! && ($page_count==$page_wanted || $printAll)) $article_tags['BODYTEXT'] .= $this->sections[$value]->view_section(0,$this->id ,$this->created_username,$this->created_date,$this->updated_username *************** *** 267,271 **** } /* Show multi-article navigation list & bar */ ! if ($this->pages > 1) { for ($page_count = 1; ($page_count <= $this->pages); $page_count++) --- 269,273 ---- } /* Show multi-article navigation list & bar */ ! if ($this->pages>1 && !$printAll) { for ($page_count = 1; ($page_count <= $this->pages); $page_count++) *************** *** 309,313 **** else /* Summary Display */ { - $article_link = 'index.php?module=article&view='.$this->id; $article_tags['READMORE'] = '['.'<a href="'. $article_link. '">'. $_SESSION['translate']->it('Read More'). ' </a>]'; $article_tags['LINK'] = 'http://'.$GLOBALS['core']->home_http.$article_link; --- 311,314 ---- *************** *** 343,347 **** if ($_SESSION['SES_ART_master']->can('edit',$this->created_username)) /* If someone else is editing this page... */ ! if ($this->isLocked(&$this->editlock, &$this->edituser)) $article_tags['EDIT'] = '['. $_SESSION['translate']->it('Locked') . ']'; else --- 344,348 ---- if ($_SESSION['SES_ART_master']->can('edit',$this->created_username)) /* If someone else is editing this page... */ ! if ($this->isLocked($this->editlock, $this->edituser)) $article_tags['EDIT'] = '['. $_SESSION['translate']->it('Locked') . ']'; else *************** *** 382,385 **** --- 383,396 ---- if ($GLOBALS['module'] != "home") $GLOBALS['CNT_article']['content'] .= $copyright; + /* If we need a printable version... */ + if (isset($_REQUEST['lay_quiet'])) + { + if ($_SESSION['SES_ART_master']->val['brand_printable']) + $_SESSION['SES_ART_master']->displayPrintTheme('CNT_article'); + else + echo '<h2>'.$GLOBALS['CNT_article']['title'].'</h2>'.$GLOBALS['CNT_article']['content']; + return; + } + /* Article Comments */ if(isset($_SESSION['PHPWS_CommentManager']) && $this->allow_comments && !$this->mainarticle) *************** *** 408,412 **** { /* Make sure someone else isn't editing this page */ ! if ($timeleft = $this->isLocked(&$this->editlock, &$this->edituser)) { /* Display an error messase & exit*/ --- 419,423 ---- { /* Make sure someone else isn't editing this page */ ! if ($timeleft = $this->isLocked($this->editlock, $this->edituser)) { /* Display an error messase & exit*/ Index: ArticleManager.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/article/class/ArticleManager.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ArticleManager.php 17 Jul 2003 22:13:13 -0000 1.5 --- ArticleManager.php 19 Jul 2003 18:08:04 -0000 1.6 *************** *** 250,254 **** if ($this->can("edit",$value['created_username'])) /* If someone else is not editing this page... */ ! if (!PHPWS_Article::isLocked(&$value['editlock'], &$value['edituser'])) $row['EDIT'] = '<input type="submit" name="ARTICLE_vars[edit:' .$value['id'].']" value="'.$Fedit.'" />'; --- 250,254 ---- if ($this->can("edit",$value['created_username'])) /* If someone else is not editing this page... */ ! if (!PHPWS_Article::isLocked($value['editlock'], $value['edituser'])) $row['EDIT'] = '<input type="submit" name="ARTICLE_vars[edit:' .$value['id'].']" value="'.$Fedit.'" />'; *************** *** 787,790 **** --- 787,860 ---- $GLOBALS['CNT_article']['content'] .= '<h3>' . $title . '</h3>' . $content; } + + /** + * Prints the theme and a specified block + * + * This is a modification of Matthew McNaney's Layout.php->displayTheme() + * that displays a printable version of a web page with a page header & + * footer for proper site branding. + * + * @author Eloi George <el...@NO...> + * @module Article Manager + * @param string contentVar : The content variable that will be displayed + * @return none + */ + function displayPrintTheme($contentVar) + { + include_once(PHPWS_SOURCE_DIR . "mod/layout/conf/config.php"); + if ($_SESSION["OBJ_user"]->isUser()) + { + $newTheme = $_SESSION["OBJ_user"]->getUserVar("theme"); + if($newTheme != $_SESSION['OBJ_layout']->current_theme) + $_SESSION['OBJ_layout']->initializeLayout($newTheme); + } + + $THEME["THEME_DIRECTORY"] = $_SESSION['OBJ_layout']->theme_address; + + $extraInfoFile = PHPWS_HOME_DIR . "themes/" . $_SESSION['OBJ_layout']->current_theme . "/theme.php"; + if ((defined("ALLOW_THEME_PHP_INSERTION") && ALLOW_THEME_PHP_INSERTION == TRUE) && is_file($extraInfoFile)) + include($extraInfoFile); + + if (!is_array($_SESSION['OBJ_layout']->ordered_list)) + $_SESSION['OBJ_layout']->loadBoxInfo(); + + $templateDir = $_SESSION['OBJ_layout']->box_dir . $_SESSION['OBJ_layout']->content_array[$contentVar]["box_file"]; + + foreach ($GLOBALS[$contentVar] as $tag=>$tagLabel) + if (!empty($tagLabel)) + $boxTemplate[strtoupper($tag)] = $tagLabel; + + $boxTemplate["HOME_ADDRESS"] = $GLOBALS["core"]->home_http; + $boxTemplate["THEME_DIRECTORY"] = $_SESSION['OBJ_layout']->theme_address; + $boxTemplate["BOX_DIRECTORY"] = $_SESSION['OBJ_layout']->box_address; + + $themeData = $GLOBALS["core"]->processTemplate($boxTemplate, "layout", $templateDir, FALSE); + $THEME['BODY'] = (isset($THEME['BODY'])) ? $THEME['BODY'] . $themeData : $themeData; + + if (isset($GLOBALS["Layout_title"])) + $THEME["TITLE"] = $GLOBALS["Layout_title"]; + else + $THEME["TITLE"] = $_SESSION['OBJ_layout']->page_title; + + $THEME["METATAGS"] = $_SESSION['OBJ_layout']->getMetaTags(); + $THEME["JAVASCRIPT"] = $GLOBALS["core"]->load_js_funcs(); + + if($_SESSION['OBJ_layout']->_js !== NULL) + $THEME["DYN_JAVASCRIPT"] = $_SESSION['OBJ_layout']->_js; + + $THEME["STYLE"] = $_SESSION['OBJ_layout']->pickCSS(); + + if($_SESSION['OBJ_layout']->_style !== NULL) + $THEME["DYN_STYLE"] = $_SESSION['OBJ_layout']->_style; + + if (is_file($_SESSION['OBJ_layout']->theme_dir . "theme.tpl")) + echo $GLOBALS["core"]->processTemplate($THEME, "layout", $_SESSION['OBJ_layout']->theme_dir . "theme.tpl", FALSE); + else + { + $_SESSION['OBJ_layout']->_changeDefault("Default"); + header("location:."); + exit(); + } + } } ?> |