|
|
| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* @file RTSharingHandler.inc.php |
| 5 |
* |
| 6 |
* Copyright (c) 2003-2009 John Willinsky |
| 7 |
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING. |
| 8 |
* |
| 9 |
* @class RTSharingHandler |
| 10 |
* @ingroup pages_rtadmin |
| 11 |
* |
| 12 |
* @brief Handle Reading Tools sharing requests -- setup section. |
| 13 |
*/ |
| 14 |
|
| 15 |
// $Id: RTSharingHandler.inc.php,v 1.23 2009/04/08 19:54:33 asmecher Exp $ |
| 16 |
|
| 17 |
|
| 18 |
import('rt.ojs.JournalRTAdmin'); |
| 19 |
import('rtadmin.RTAdminHandler'); |
| 20 |
import('rt.ojs.SharingRT'); |
| 21 |
|
| 22 |
class RTSharingHandler { |
| 23 |
function settings() { |
| 24 |
RTAdminHandler::validate(); |
| 25 |
$journal = Request::getJournal(); |
| 26 |
if ($journal) { |
| 27 |
RTAdminHandler::setupTemplate(true); |
| 28 |
$templateMgr = &TemplateManager::getManager(); |
| 29 |
|
| 30 |
$rtDao = &DAORegistry::getDAO('RTDAO'); |
| 31 |
$rt = $rtDao->getJournalRTByJournal($journal); |
| 32 |
|
| 33 |
$templateMgr->assign("sharingEnabled", $rt->getSharingEnabled()); |
| 34 |
$templateMgr->assign("sharingUserName", $rt->getSharingUserName()); |
| 35 |
$templateMgr->assign("sharingButtonStyle", $rt->getSharingButtonStyle()); |
| 36 |
$templateMgr->assign_by_ref("sharingButtonStyleOptions", array_keys(SharingRT::$btnStyles)); |
| 37 |
$templateMgr->assign("sharingDropDownMenu", $rt->getSharingDropDownMenu()); |
| 38 |
$templateMgr->assign("sharingBrand", $rt->getSharingBrand()); |
| 39 |
$templateMgr->assign("sharingDropDown", $rt->getSharingDropDown()); |
| 40 |
$templateMgr->assign("sharingLanguage", $rt->getSharingLanguage()); |
| 41 |
$templateMgr->assign_by_ref("sharingLanguageOptions", SharingRT::$languages); |
| 42 |
$templateMgr->assign("sharingLogo", $rt->getSharingLogo()); |
| 43 |
$templateMgr->assign("sharingLogoBackground", $rt->getSharingLogoBackground()); |
| 44 |
$templateMgr->assign("sharingLogoColor", $rt->getSharingLogoColor()); |
| 45 |
|
| 46 |
$templateMgr->assign('helpTopicId', 'journal.managementPages.readingTools.addthisSettings'); |
| 47 |
$templateMgr->display('rtadmin/addthis.tpl'); |
| 48 |
} else { |
| 49 |
Request::redirect(null, Request::getRequestedPage()); |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
function saveSettings() { |
| 54 |
RTAdminHandler::validate(); |
| 55 |
|
| 56 |
$journal = Request::getJournal(); |
| 57 |
|
| 58 |
if ($journal) { |
| 59 |
$rtDao = &DAORegistry::getDAO('RTDAO'); |
| 60 |
$rt = $rtDao->getJournalRTByJournal($journal); |
| 61 |
|
| 62 |
$rt->setSharingEnabled(Request::getUserVar("sharingEnabled")); |
| 63 |
$rt->setSharingUserName(Request::getUserVar("sharingUserName")); |
| 64 |
$rt->setSharingButtonStyle(Request::getUserVar("sharingButtonStyle")); |
| 65 |
$rt->setSharingDropDownMenu(Request::getUserVar("sharingDropDownMenu")); |
| 66 |
$rt->setSharingBrand(Request::getUserVar("sharingBrand")); |
| 67 |
$rt->setSharingDropDown(Request::getUserVar("sharingDropDown")); |
| 68 |
$rt->setSharingLanguage(Request::getUserVar("sharingLanguage")); |
| 69 |
$rt->setSharingLogo(Request::getUserVar("sharingLogo")); |
| 70 |
$rt->setSharingLogoBackground(Request::getUserVar("sharingLogoBackground")); |
| 71 |
$rt->setSharingLogoColor(Request::getUserVar("sharingLogoColor")); |
| 72 |
|
| 73 |
$rtDao->updateJournalRT($rt); |
| 74 |
} |
| 75 |
Request::redirect(null, Request::getRequestedPage()); |
| 76 |
} |
| 77 |
} |
| 78 |
|
| 79 |
?> |