|
From: Verdon V. <ve...@us...> - 2008-07-22 15:19:03
|
Update of /cvsroot/phpwebsite-comm/modules/whatsnew/class In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2685/class Modified Files: Whatsnew.php Whatsnew_Forms.php Log Message: tweaks and fixes to prepare for release Index: Whatsnew.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/whatsnew/class/Whatsnew.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Whatsnew.php 22 Jul 2008 12:24:39 -0000 1.1.1.1 --- Whatsnew.php 22 Jul 2008 15:18:39 -0000 1.2 *************** *** 93,99 **** switch($action) { ! case 'view_whatsnew': ! $this->title = $this->ballot->getTitle(true); ! $this->content = $this->ballot->view(); break; --- 93,99 ---- switch($action) { ! case 'view': ! $this->title = PHPWS_Settings::get('whatsnew', 'title'); ! $this->content = $this->whatsnewBlock(); break; *************** *** 143,163 **** - /* - function loadBallot($id=0) - { - PHPWS_Core::initModClass('whatsnew', 'Whatsnew_Ballot.php'); - - if ($id) { - $this->ballot = new Whatsnew_Ballot($id); - } elseif (isset($_REQUEST['ballot_id'])) { - $this->ballot = new Whatsnew_Ballot($_REQUEST['ballot_id']); - } elseif (isset($_REQUEST['id'])) { - $this->ballot = new Whatsnew_Ballot($_REQUEST['id']); - } else { - $this->ballot = new Whatsnew_Ballot; - } - } - */ - function loadPanel() { --- 143,146 ---- *************** *** 187,190 **** --- 170,179 ---- PHPWS_Settings::set('whatsnew', 'homeonly', 0); + if (!empty($_POST['title'])) { + PHPWS_Settings::set('whatsnew', 'title', strip_tags(PHPWS_Text::parseInput($_POST['title']))); + } else { + PHPWS_Settings::reset('whatsnew', 'title'); + } + if (!empty($_POST['text'])) { PHPWS_Settings::set('whatsnew', 'text', PHPWS_Text::parseInput($_POST['text'])); *************** *** 276,291 **** function showBlock() { if (PHPWS_Settings::get('whatsnew', 'homeonly')) { $key = Key::getCurrent(); if (!empty($key) && $key->isHomeKey()) { ! Whatsnew::showWhatsnewBlock(); } } else { ! Whatsnew::showWhatsnewBlock(); } } ! function showWhatsnewBlock() { $final = null; --- 265,289 ---- function showBlock() { + PHPWS_Core::initModClass('layout', 'Layout.php'); if (PHPWS_Settings::get('whatsnew', 'homeonly')) { $key = Key::getCurrent(); if (!empty($key) && $key->isHomeKey()) { ! Layout::add(Whatsnew::whatsnewBlock(), 'whatsnew', 'whatsnew_sidebox'); } } else { ! Layout::add(Whatsnew::whatsnewBlock(), 'whatsnew', 'whatsnew_sidebox'); } } ! function whatsnewBlock() { ! ! if (PHPWS_Settings::get('whatsnew', 'cache_timeout') > 0) { ! $cache_key = 'whatsnew_cache_key'; ! $content = PHPWS_Cache::get($cache_key, PHPWS_Settings::get('whatsnew', 'cache_timeout')); ! if (!empty($content)) { ! return $content; ! } ! } $final = null; *************** *** 307,324 **** $result = $db->select(); if (!PHPWS_Error::logIfError($result) && !empty($result)) { - $tpl['TITLE'] = dgettext('whatsnew', 'What\'s New'); - $tpl['TEXT'] = PHPWS_Settings::get('whatsnew', 'text'); foreach ($result as $link) { $final = '<a href="' . $link['url'] . '">' . $link['title'] . '</a>'; $tpl['new-links'][] = array('LINK'=>$final); } ! PHPWS_Core::initModClass('layout', 'Layout.php'); ! Layout::add(PHPWS_Template::process($tpl, 'whatsnew', 'block.tpl'), 'whatsnew', 'whatsnew_sidebox'); } } } ?> \ No newline at end of file --- 305,329 ---- $result = $db->select(); + $tpl['TITLE'] = PHPWS_Text::parseOutput(PHPWS_Settings::get('whatsnew', 'title')); + $tpl['TEXT'] = PHPWS_Text::parseOutput(PHPWS_Settings::get('whatsnew', 'text')); if (!PHPWS_Error::logIfError($result) && !empty($result)) { foreach ($result as $link) { $final = '<a href="' . $link['url'] . '">' . $link['title'] . '</a>'; $tpl['new-links'][] = array('LINK'=>$final); } ! } else { ! $tpl['new-links'][] = array('LINK'=>dgettext('whatsnew', 'Sorry, no results')); } + $content = PHPWS_Template::process($tpl, 'whatsnew', 'block.tpl'); + if (PHPWS_Settings::get('whatsnew', 'cache_timeout') > 0) { + PHPWS_Cache::save($cache_key, $content); + } + + return $content; } + } ?> \ No newline at end of file Index: Whatsnew_Forms.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/whatsnew/class/Whatsnew_Forms.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Whatsnew_Forms.php 22 Jul 2008 12:24:39 -0000 1.1.1.1 --- Whatsnew_Forms.php 22 Jul 2008 15:18:40 -0000 1.2 *************** *** 60,63 **** --- 60,67 ---- $form->setLabel('homeonly', dgettext('whatsnew', 'Show whatsnew sidebox on home page only')); + $form->addTextField('title', PHPWS_Settings::get('whatsnew', 'title')); + $form->setLabel('title', dgettext('whatsnew', 'Sidebox title')); + $form->setSize('title', 30); + $form->addTextArea('text', PHPWS_Settings::get('whatsnew', 'text')); $form->setRows('text', '4'); *************** *** 90,96 **** $tpl['TITLE'] = dgettext('whatsnew', 'Important Information'); $tpl['INFO_1_LABEL'] = dgettext('whatsnew', 'About this module:'); ! $tpl['INFO_1'] = dgettext('whatsnew', 'This is the first release of whatsnew for the new 1.x series phpwebsite. It\'s pretty simple and there may not be any further releases, unless bugs are found. I wrote this for a specific need I had and thought it may be of use to others also.'); ! $tpl['INFO_2_LABEL'] = dgettext('whatsnew', 'Caution'); ! $tpl['INFO_2'] = dgettext('whatsnew', 'This module could be dangerous. You are expected to have some idea of what you are doing, if you are going to use it. It could be used to do nasty or stupid things. I have intentionally not included file upload abilites to it. If you do not have access to the server, you should not be using this.'); $tpl['INFO_3_LABEL'] = null; $tpl['INFO_3'] = null; --- 94,100 ---- $tpl['TITLE'] = dgettext('whatsnew', 'Important Information'); $tpl['INFO_1_LABEL'] = dgettext('whatsnew', 'About this module:'); ! $tpl['INFO_1'] = dgettext('whatsnew', 'This is the first release of whatsnew. It\'s pretty simple and there may not be any need further releases, unless bugs are found. That said, I am considering further setup options. I wrote this for a specific need I had and thought it may be of use to others also.'); ! $tpl['INFO_2_LABEL'] = null; ! $tpl['INFO_2'] = null; $tpl['INFO_3_LABEL'] = null; $tpl['INFO_3'] = null; |