From: Darren G. <dg...@us...> - 2004-09-17 18:56:16
|
Update of /cvsroot/phpwebsite-comm/modules/phpwsrssfeeds/class In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29516/class Modified Files: Multi_RSS.php RSSManager.php RSSObjManager.php backend.php Log Message: Added sorting option for multiview feeds Index: backend.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/phpwsrssfeeds/class/backend.php,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** backend.php 2 Aug 2004 20:14:19 -0000 1.25 --- backend.php 17 Sep 2004 18:55:23 -0000 1.26 *************** *** 314,402 **** } //END function _save ! /** ! * Asks for confirmation and, getting it, deletes the current position listing ! * ! * @author Wendall Cada <wen...@NO...> ! */ ! function _delete() { ! if (isset($_POST["YES_BUTTON"])) { ! foreach($_POST["PHPWS_MAN_ITEMS"] as $item){ ! $this->RSSFeeds_backend($item); ! //Standard error checking ! if (is_object($this->_error)) ! return FALSE; ! // delete feed from files ! unlink($GLOBALS['core']->home_dir.'files/phpwsrssfeeds/backend'.$this->_id.'.php'); ! // delete the current item ! $this->kill(); ! } ! if(isset($_POST["PHPWS_MAN_ITEMS"][1])) ! $content = RSS_common::_continueContent($_SESSION["translate"]->it("RSS Feeds deleted."), "list", "RSS_BACKEND_MAN_op"); ! else ! $content = RSS_common::_continueContent($_SESSION["translate"]->it("RSS Feed deleted."), "list", "RSS_BACKEND_MAN_op"); ! } elseif (isset($_POST["NO_BUTTON"])) { ! ! /* tell user all is still okay */ ! if(isset($_POST["PHPWS_MAN_ITEMS"][1])) ! $content = RSS_common::_continueContent($_SESSION["translate"]->it("RSS Feeds NOT deleted."), "list", "RSS_BACKEND_MAN_op"); ! else ! $content = RSS_common::_continueContent($_SESSION["translate"]->it("RSS Feed NOT deleted."), "list", "RSS_BACKEND_MAN_op"); ! ! } elseif (isset($_POST["PHPWS_MAN_ITEMS"]) ! && sizeof($_POST["PHPWS_MAN_ITEMS"]) > 0 ! && is_array($_POST["PHPWS_MAN_ITEMS"])) { ! require_once(PHPWS_SOURCE_DIR.'core/Form.php'); ! /* ask if the user is sure */ ! $form = new EZform("RSS_BACKEND_DELETE"); ! $form->add("YES_BUTTON", "submit", $_SESSION["translate"]->it("Yes")); ! $form->add("NO_BUTTON", "submit", $_SESSION["translate"]->it("No")); ! $form->add("module", "hidden", "phpwsrssfeeds"); ! $form->add("RSS_BACKEND_MAN_op", "hidden", "delete"); ! // note must indicate with [] that the id variable is in an array ! // I'll also build a sql query for the title list ! $num = 0; ! foreach($_POST["PHPWS_MAN_ITEMS"] as $id){ ! $man_item = "PHPWS_MAN_ITEMS[$num]"; ! $form->add($man_item, "hidden", $id); ! $num++; ! } ! $item_list = implode(" OR id = ", $_POST["PHPWS_MAN_ITEMS"]); ! $sql = "SELECT label FROM mod_phpwsrssfeeds_backend WHERE id = ".$item_list; ! $items = $GLOBALS["core"]->getAll($sql, TRUE); ! ! $tags = array(); ! $tags = $form->getTemplate(); ! $tags["MESSAGE"] = $_SESSION["translate"]->it("Delete "); ! foreach($items as $item){ ! $tags["MESSAGE"] .= $item['label'].", "; ! } ! $tags["MESSAGE"] = rtrim($tags["MESSAGE"], ", "); ! $tags["MESSAGE"] .= "?"; ! ! $content = PHPWS_Template::processTemplate($tags, "phpwsrssfeeds", "confirm.tpl"); ! ! } else { ! $content = RSS_common::_errorMessage("Sorry, there was a problem with that request."); ! } ! ! return $content; ! ! } //END function delete ! function _list(){ ! require_once(PHPWS_SOURCE_DIR.'mod/phpwsrssfeeds/class/RSSList.php'); ! $content = FALSE; ! $settings = array("_module" => "phpwsrssfeeds", ! "_table" => "mod_phpwsrssfeeds_backend", ! "_request" => "RSS_BACKEND_MAN_op"); ! $listObj = RSSList::getRSSList($settings); ! $listObj->init(); ! if ($_SESSION["OBJ_user"]->allow_access("phpwsrssfeeds")) ! $content = $listObj->getList("backend", $_SESSION["translate"]->it("Local RSS News Feeds")); ! ! return $content; ! }//End function _list() function CreateRDF($id = NULL){ $_REQUEST["lay_quiet"] = 1; --- 314,402 ---- } //END function _save ! /** ! * Asks for confirmation and, getting it, deletes the current position listing ! * ! * @author Wendall Cada <wen...@NO...> ! */ ! function _delete() { ! if (isset($_POST["YES_BUTTON"])) { ! foreach($_POST["PHPWS_MAN_ITEMS"] as $item){ ! $this->RSSFeeds_backend($item); ! //Standard error checking ! if (is_object($this->_error)) ! return FALSE; ! // delete feed from files ! unlink($GLOBALS['core']->home_dir.'files/phpwsrssfeeds/backend'.$this->_id.'.php'); ! // delete the current item ! $this->kill(); ! } ! if(isset($_POST["PHPWS_MAN_ITEMS"][1])) ! $content = RSS_common::_continueContent($_SESSION["translate"]->it("RSS Feeds deleted."), "list", "RSS_BACKEND_MAN_op"); ! else ! $content = RSS_common::_continueContent($_SESSION["translate"]->it("RSS Feed deleted."), "list", "RSS_BACKEND_MAN_op"); ! } elseif (isset($_POST["NO_BUTTON"])) { ! ! /* tell user all is still okay */ ! if(isset($_POST["PHPWS_MAN_ITEMS"][1])) ! $content = RSS_common::_continueContent($_SESSION["translate"]->it("RSS Feeds NOT deleted."), "list", "RSS_BACKEND_MAN_op"); ! else ! $content = RSS_common::_continueContent($_SESSION["translate"]->it("RSS Feed NOT deleted."), "list", "RSS_BACKEND_MAN_op"); ! ! } elseif (isset($_POST["PHPWS_MAN_ITEMS"]) ! && sizeof($_POST["PHPWS_MAN_ITEMS"]) > 0 ! && is_array($_POST["PHPWS_MAN_ITEMS"])) { ! require_once(PHPWS_SOURCE_DIR.'core/Form.php'); ! /* ask if the user is sure */ ! $form = new EZform("RSS_BACKEND_DELETE"); ! $form->add("YES_BUTTON", "submit", $_SESSION["translate"]->it("Yes")); ! $form->add("NO_BUTTON", "submit", $_SESSION["translate"]->it("No")); ! $form->add("module", "hidden", "phpwsrssfeeds"); ! $form->add("RSS_BACKEND_MAN_op", "hidden", "delete"); ! // note must indicate with [] that the id variable is in an array ! // I'll also build a sql query for the title list ! $num = 0; ! foreach($_POST["PHPWS_MAN_ITEMS"] as $id){ ! $man_item = "PHPWS_MAN_ITEMS[$num]"; ! $form->add($man_item, "hidden", $id); ! $num++; ! } ! $item_list = implode(" OR id = ", $_POST["PHPWS_MAN_ITEMS"]); ! $sql = "SELECT label FROM mod_phpwsrssfeeds_backend WHERE id = ".$item_list; ! $items = $GLOBALS["core"]->getAll($sql, TRUE); ! ! $tags = array(); ! $tags = $form->getTemplate(); ! $tags["MESSAGE"] = $_SESSION["translate"]->it("Delete "); ! foreach($items as $item){ ! $tags["MESSAGE"] .= $item['label'].", "; ! } ! $tags["MESSAGE"] = rtrim($tags["MESSAGE"], ", "); ! $tags["MESSAGE"] .= "?"; ! ! $content = PHPWS_Template::processTemplate($tags, "phpwsrssfeeds", "confirm.tpl"); ! ! } else { ! $content = RSS_common::_errorMessage("Sorry, there was a problem with that request."); ! } ! return $content; ! ! } //END function delete ! ! function _list(){ ! require_once(PHPWS_SOURCE_DIR.'mod/phpwsrssfeeds/class/RSSList.php'); ! $content = FALSE; ! $settings = array("_module" => "phpwsrssfeeds", ! "_table" => "mod_phpwsrssfeeds_backend", ! "_request" => "RSS_BACKEND_MAN_op"); ! $listObj = RSSList::getRSSList($settings); ! $listObj->init(); ! if ($_SESSION["OBJ_user"]->allow_access("phpwsrssfeeds")) ! $content = $listObj->getList("backend", $_SESSION["translate"]->it("Local RSS News Feeds")); + return $content; + }//End function _list() + function CreateRDF($id = NULL){ $_REQUEST["lay_quiet"] = 1; *************** *** 552,564 **** } }elseif($this->_type == "Calendar"){ ! ! for ($i = 0; $i <= count($result); $i++) ! for($n = 0;$n <= count($result[$i]['data']); $n++){ ! $id = $result[$i]['data'][$n]['id']; if($id){ ! $title = PHPWS_Text::parseOutput($result[$i]['data'][$n]['title']); $title = RSS_common::get_htmlentities($title, ENT_QUOTES); ! $title = $result[$i]['FullDate']." - ".$title; ! $description = PHPWS_Text::parseOutput($result[$i]['data'][$n]['description']); $description = RSS_common::get_htmlentities($description, ENT_QUOTES); $output .= "\n<item rdf:about=\"http://".$source_http."index.php?module=calendar&calendar[view]=event&id=$id\"> --- 552,564 ---- } }elseif($this->_type == "Calendar"){ ! ! foreach($result as $calFeed) { ! for($n = 0;$n <= count($calFeed['data']); $n++){ ! $id = $calFeed['data'][$n]['id']; if($id){ ! $title = PHPWS_Text::parseOutput($calFeed['data'][$n]['title']); $title = RSS_common::get_htmlentities($title, ENT_QUOTES); ! $title = $calFeed['FullDate']." - ".$title; ! $description = PHPWS_Text::parseOutput($calFeed['data'][$n]['description']); $description = RSS_common::get_htmlentities($description, ENT_QUOTES); $output .= "\n<item rdf:about=\"http://".$source_http."index.php?module=calendar&calendar[view]=event&id=$id\"> *************** *** 567,575 **** <description> $description"; ! $startDate = $result[$i]['data'][$n]['startDate']; ! $endDate = $result[$i]['data'][$n]['endDate']; ! $startTime = sprintf("%04d",$result[$i]['data'][$n]['startTime']); ! $endTime = sprintf("%04d",$result[$i]['data'][$n]['endTime']); ! $endRepeat = $result[$i]['data'][$n]['endRepeat']; $startYear = substr($startDate,0,4); $startMonth =substr($startDate,4,2); --- 567,575 ---- <description> $description"; ! $startDate = $calFeed['data'][$n]['startDate']; ! $endDate = $calFeed['data'][$n]['endDate']; ! $startTime = sprintf("%04d",$calFeed['data'][$n]['startTime']); ! $endTime = sprintf("%04d",$calFeed['data'][$n]['endTime']); ! $endRepeat = $calFeed['data'][$n]['endRepeat']; $startYear = substr($startDate,0,4); $startMonth =substr($startDate,4,2); *************** *** 586,591 **** $endHour = substr($endTime,0,2); ! if($result[$i]['data'][$n]["eventType"]=="allday"){ ! $output .= "<br /><br />".$result[$i]['FullDate']."<br />All Day Event"; $dcdate = $startYear."-".$startMonth."-".$startDay; }else{ --- 586,591 ---- $endHour = substr($endTime,0,2); ! if($calFeed['data'][$n]["eventType"]=="allday"){ ! $output .= "<br /><br />".$calFeed['FullDate']."<br />All Day Event"; $dcdate = $startYear."-".$startMonth."-".$startDay; }else{ *************** *** 603,611 **** $endHour = sprintf("%02d", $endHour==0 ? 12 : $endHour); $deadline = ltrim($endHour,"\0x00").":".$endMinute; ! if($result[$i]['data'][$n]["eventType"]=="deadline"){ $dcdate = $endYear."-".$endMonth."-".$endDay; ! $output .= "<br /><br />".$result[$i]['FullDate']."<br />Deadline: ".$deadline.$eampm; } ! if($result[$i]['data'][$n]["eventType"]=="interval" && ($endRepeat)){ $startHour = ($startHour + 1) > 12 ? $startHour - 12 : $startHour; $startHour = sprintf("%02d", $startHour==0 ? 12 : $startHour); --- 603,611 ---- $endHour = sprintf("%02d", $endHour==0 ? 12 : $endHour); $deadline = ltrim($endHour,"\0x00").":".$endMinute; ! if($calFeed['data'][$n]["eventType"]=="deadline"){ $dcdate = $endYear."-".$endMonth."-".$endDay; ! $output .= "<br /><br />".$calFeed['FullDate']."<br />Deadline: ".$deadline.$eampm; } ! if($calFeed['data'][$n]["eventType"]=="interval" && ($endRepeat)){ $startHour = ($startHour + 1) > 12 ? $startHour - 12 : $startHour; $startHour = sprintf("%02d", $startHour==0 ? 12 : $startHour); *************** *** 618,624 **** else $dcdate = $startYear."-".$startMonth."-".$startDay."/".$repeatYear."-".$repeatMonth."-".$repeatDay; ! $output .= "<br /><br />".$result[$i]['FullDate']."<br />".$starts.$sampm." - ".$ends.$eampm; } ! if($result[$i]['data'][$n]["eventType"]=="interval" && (!$endRepeat)){ $startHour = ($startHour + 1) > 12 ? $startHour - 12 : $startHour; $startHour = sprintf("%02d", $startHour==0 ? 12 : $startHour); --- 618,624 ---- else $dcdate = $startYear."-".$startMonth."-".$startDay."/".$repeatYear."-".$repeatMonth."-".$repeatDay; ! $output .= "<br /><br />".$calFeed['FullDate']."<br />".$starts.$sampm." - ".$ends.$eampm; } ! if($calFeed['data'][$n]["eventType"]=="interval" && (!$endRepeat)){ $startHour = ($startHour + 1) > 12 ? $startHour - 12 : $startHour; $startHour = sprintf("%02d", $startHour==0 ? 12 : $startHour); *************** *** 635,639 **** <b>To: </b>".$ends.$eampm.", ".$endYear."-".$endMonth."-".$endDay; } ! if($result[$i]['data'][$n]["eventType"]=="start"){ $startHour = ($startHour + 1) > 12 ? $startHour - 12 : $startHour; $startHour = sprintf("%02d", $startHour==0 ? 12 : $startHour); --- 635,639 ---- <b>To: </b>".$ends.$eampm.", ".$endYear."-".$endMonth."-".$endDay; } ! if($calFeed['data'][$n]["eventType"]=="start"){ $startHour = ($startHour + 1) > 12 ? $startHour - 12 : $startHour; $startHour = sprintf("%02d", $startHour==0 ? 12 : $startHour); *************** *** 652,655 **** --- 652,656 ---- } } + } } *************** *** 667,720 **** */ function daysAhead($year=NULL, $month=NULL, $day=NULL){ ! require_once (PHPWS_SOURCE_DIR . "/mod/calendar/class/Display.php"); ! require_once (PHPWS_SOURCE_DIR . "/mod/calendar/class/Calendar.php"); ! $GLOBALS["calendarSettings"] = PHPWS_Calendar::getSettings(); ! $settings = $GLOBALS["calendarSettings"]; ! if (!($viewAhead = $settings["daysAhead"])) ! return NULL; ! ! if (is_null($year)) ! $year = date("Y"); ! ! if (is_null($month)) ! $month = date("m"); ! ! if (is_null($day)) ! $day = date("d"); ! ! //stub for cache data return, will generate everything for now ! ! $date = new Date; ! $date->setMonth($month); ! $date->setYear($year); ! $date->setDay($day); ! $end = $date; ! $end->addSeconds(86400 * $viewAhead); ! $eventList = PHPWS_Calendar::loadEvents($date, $end); ! $eventCount = 0; ! $i = 0; ! $maxnum = 0; ! while($end->after($date)){ ! if ($events = PHPWS_Calendar::getEvents($date, $eventList)){ ! $thisdate = $date->format("%a. %e %b. %Y"); ! $num = 0; ! foreach ($events as $time=>$weekday){ ! foreach ($weekday as $itemid=>$event){ ! if($maxnum == $this->_numitems) ! return $eventdata; ! $eventdata[$i]['FullDate'] = $thisdate; ! $eventdata[$i]['data'][$num]= $event; ! $num++; ! $maxnum++; ! } ! } ! } ! $i++; ! $date = $date->getNextDay(); ! } ! return $eventdata; ! }//end function daysAhead() } --- 668,720 ---- */ function daysAhead($year=NULL, $month=NULL, $day=NULL){ ! require_once (PHPWS_SOURCE_DIR . "/mod/calendar/class/Display.php"); ! require_once (PHPWS_SOURCE_DIR . "/mod/calendar/class/Calendar.php"); ! $GLOBALS["calendarSettings"] = PHPWS_Calendar::getSettings(); ! $settings = $GLOBALS["calendarSettings"]; ! if (!($viewAhead = $settings["daysAhead"])) ! return NULL; ! ! if (is_null($year)) ! $year = date("Y"); ! if (is_null($month)) ! $month = date("m"); ! ! if (is_null($day)) ! $day = date("d"); ! //stub for cache data return, will generate everything for now ! $date = new Date; ! $date->setMonth($month); ! $date->setYear($year); ! $date->setDay($day); ! ! $end = $date; ! $end->addSeconds(86400 * $viewAhead); ! ! $eventList = PHPWS_Calendar::loadEvents($date, $end); ! $eventCount = 0; ! $i = 0; ! $maxnum = 0; ! while($end->after($date)){ ! if ($events = PHPWS_Calendar::getEvents($date, $eventList)){ ! $thisdate = $date->format("%a. %e %b. %Y"); ! $num = 0; ! foreach ($events as $time=>$weekday){ ! foreach ($weekday as $itemid=>$event){ ! if($maxnum == $this->_numitems) ! return $eventdata; ! $eventdata[$i]['FullDate'] = $thisdate; ! $eventdata[$i]['data'][$num]= $event; ! $num++; ! $maxnum++; ! } ! } ! } ! $i++; ! $date = $date->getNextDay(); ! } ! return $eventdata; ! }//end function daysAhead() } Index: RSSObjManager.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/phpwsrssfeeds/class/RSSObjManager.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RSSObjManager.php 21 Jun 2004 21:15:19 -0000 1.2 --- RSSObjManager.php 17 Sep 2004 18:55:23 -0000 1.3 *************** *** 63,72 **** /** ! * Current class object ! * ! * @var object ! * @access private ! */ ! var $_classObj; /** --- 63,72 ---- /** ! * Current class object ! * ! * @var object ! * @access private ! */ ! var $_classObj; /** *************** *** 96,128 **** var $_titles; ! /** ! * Constructor for RSS list manager object ! * var array $settings User defined settings for this class. * NOTE: Don't pass objects to this class. * ! */ ! function RSS_ObjManager($settings = NULL) { ! $this->_class = NULL; ! $this->_module = NULL; ! $this->_table = NULL; ! $this->_request = NULL; ! $this->_listFunction = "_list"; ! $this->_viewFunction = "_view"; ! $this->_editFunction = "_edit"; ! $this->_deleteFunction = "_delete"; ! $this->_saveFunction = "_save"; ! $this->_showFunction = "_show"; ! $this->_hideFunction = "_hide"; ! $this->_approveFunction = "_approve"; ! $this->_classObj = NULL; ! $this->_itemRequest = 'PHPWS_MAN_ITEMS'; ! $this->_checkPerms = array(); ! $this->_titles = array(); ! //Settings constructor ! if(is_array($settings)){ ! foreach ($settings as $setting => $value) ! $this->$setting = $value; ! } ! } // END function RSS_ListManager() function getRSS_ObjManager($settings = NULL) { --- 96,128 ---- var $_titles; ! /** ! * Constructor for RSS list manager object ! * var array $settings User defined settings for this class. * NOTE: Don't pass objects to this class. * ! */ ! function RSS_ObjManager($settings = NULL) { ! $this->_class = NULL; ! $this->_module = NULL; ! $this->_table = NULL; ! $this->_request = NULL; ! $this->_listFunction = "_list"; ! $this->_viewFunction = "_view"; ! $this->_editFunction = "_edit"; ! $this->_deleteFunction = "_delete"; ! $this->_saveFunction = "_save"; ! $this->_showFunction = "_show"; ! $this->_hideFunction = "_hide"; ! $this->_approveFunction = "_approve"; ! $this->_classObj = NULL; ! $this->_itemRequest = 'PHPWS_MAN_ITEMS'; ! $this->_checkPerms = array(); ! $this->_titles = array(); ! //Settings constructor ! if(is_array($settings)){ ! foreach ($settings as $setting => $value) ! $this->$setting = $value; ! } ! } // END function RSS_ListManager() function getRSS_ObjManager($settings = NULL) { *************** *** 146,313 **** */ function managerAction($action) { ! $function = NULL; ! $content = NULL; ! $list = FALSE; ! $doMassUpdate = FALSE; ! $error = FALSE; ! $debug_message = NULL; ! //Mandatory security check on every manager function ! if ($error == FALSE && isset($this->_checkPerms[$action])) { ! if($this->_checkPerms[$action] == 1) ! $perms = NULL; ! else ! $perms = $this->_checkPerms[$action]; ! ! if(!$_SESSION["OBJ_user"]->allow_access($this->_module,$perms)) ! return $this->accessDenied(); ! } ! //set action function based on type ! switch($action) { ! case "list": ! $function = $this->_listFunction; ! break; ! case "edit": ! $function = $this->_editFunction; ! break; ! case "delete": ! if (isset($_POST["YES_BUTTON"]) && isset($_POST[$this->_itemRequest])) { ! if(isset($_POST[$this->_itemRequest][1])) ! $content = $_SESSION["translate"]->it("Selected items deleted:"); ! else ! $content = $_SESSION["translate"]->it("Selected item deleted:"); ! $list = TRUE; ! $function = $this->_deleteFunction; ! } elseif (isset($_POST["NO_BUTTON"])) { ! // tell user all is still okay ! if(isset($_POST[$this->_itemRequest][1])) ! return RSS_common::_continueContent($_SESSION["translate"]->it("Selected items NOT deleted."), "list", $this->_request); ! else ! return RSS_common::_continueContent($_SESSION["translate"]->it("Selected item NOT deleted."), "list", $this->_request); ! } elseif (isset($_POST[$this->_itemRequest]) ! && sizeof($_POST[$this->_itemRequest]) > 0 ! && is_array($_POST[$this->_itemRequest])) { ! return $this->confirmDelete(); ! } else { ! $error = TRUE; ! //Check to see if delete was a get request. If so, display error. ! if (isset($_GET['module'])) ! $debug_message = "Only POST data can be used to delete items"; ! else ! $debug_message = "No delete parameters set."; ! } ! break; ! case "view": ! $function = $this->_viewFunction; ! break; ! ! case "add": ! $function = $this->_editFunction; ! break; ! ! case "sView": ! $function = $this->_viewFunction; ! break; ! ! case "save": ! //Check to see if save was a get request. If so, display error. ! if (isset($_GET['module'])) { ! $error = TRUE; ! $debug_message = "Only POST data can be used to save items"; ! } ! $function = $this->_saveFunction; ! break; ! ! case "menu_link": ! return $this->linkItem('list', 'menu_link'); ! case "link": ! return $this->linkItem('view','menu_link',$_REQUEST[$this->_itemRequest][0]); ! case "hide": ! $doMassUpdate = TRUE; ! $list = TRUE; ! $function = $this->_hideFunction; ! break; ! case "show": ! $doMassUpdate = TRUE; ! $list = TRUE; ! $function = $this->_showFunction; ! break; ! ! case "approve": ! $doMassUpdate = TRUE; ! $list = TRUE; ! $function = $this->_approveFunction; ! break; ! } ! if ($error == FALSE && is_null($function)) { ! $debug_message = $this->_class." ".$action." not set!"; ! $error = TRUE; ! } ! if ($error == FALSE && !is_callable(array($this->_class, $function))) { ! $debug_message = $this->_class."::".$function."() doesn't exist!"; ! $error = TRUE; ! } ! if($error == FALSE && $action == 'save') ! if(!$_SESSION["OBJ_user"]->allow_access($this->_module)) ! return $this->accessDenied(); ! ! if ($error == FALSE && isset($_REQUEST[$this->_itemRequest]) && sizeof($_REQUEST[$this->_itemRequest]) > 0) { ! if (!is_array($_REQUEST[$this->_itemRequest])) { ! $this->_classObj = new $this->_class($_REQUEST[$this->_itemRequest]); ! $return_item = $this->_classObj->$function(); ! if ($return_item == FALSE) ! $error = TRUE; ! $content .= $return_item; ! } elseif(is_array($_REQUEST[$this->_itemRequest])) { ! $this->_classObj = new $this->_class(); ! if(!$doMassUpdate){ ! $return_items = ''; ! foreach($_REQUEST[$this->_itemRequest] as $item) { ! $return_item = $this->_classObj->$function($item); ! if ($return_item == FALSE) { ! $error = TRUE; ! break; ! } else ! $return_items .= $return_item; ! } ! $content .= $return_items; ! } else { ! $return = $this->_classObj->$function($_REQUEST[$this->_itemRequest]); ! if ($return == FALSE) ! $error = TRUE; ! else ! $content .= $return; ! } ! } ! } elseif ($error == FALSE) { ! $this->_classObj = new $this->_class(); ! $return_item = $this->_classObj->$function(); ! if ($return_item == FALSE) ! $error = TRUE; ! $content .= $return_item; ! } ! if ($error == TRUE) { ! if ($_SESSION['PHPWS_Debug']->isActive() && is_object($this->_classObj->_error)) { ! $debug_message = $this->_classObj->_error->getMessage(); ! $content .= RSS_common::_errorMessage($debug_message,"Error",1,$this->_module,"RSS_ObjManager::managerAction"); ! } elseif ($_SESSION['PHPWS_Debug']->isActive() && !is_null($debug_message)) { ! $content .= RSS_common::_errorMessage($debug_message,"Error",1,$this->_module,"RSS_ObjManager::managerAction"); } else ! $content .= RSS_common::_errorMessage("Sorry, there was a problem with that request."); ! } ! if ($list == TRUE) { ! if (!is_object($this->_classObj)) ! $this->_classObj = new $this->_class(); $function = $this->_listFunction; $content .= $this->_classObj->$function(); ! } ! ! return $content; ! }// END FUNC managerAction() --- 146,322 ---- */ function managerAction($action) { ! $function = NULL; ! $content = NULL; ! $list = FALSE; ! $doMassUpdate = FALSE; ! $error = FALSE; ! $debug_message = NULL; ! //Mandatory security check on every manager function ! if ($error == FALSE && isset($this->_checkPerms[$action])) { ! if($this->_checkPerms[$action] == 1) ! $perms = NULL; ! else ! $perms = $this->_checkPerms[$action]; ! ! if(!$_SESSION["OBJ_user"]->allow_access($this->_module,$perms)) ! return $this->accessDenied(); ! } ! //set action function based on type ! switch($action) { ! case "list": ! $function = $this->_listFunction; ! break; ! ! case "edit": ! $function = $this->_editFunction; ! break; ! ! case "delete": ! if (isset($_POST["YES_BUTTON"]) && isset($_POST[$this->_itemRequest])) { ! if(isset($_POST[$this->_itemRequest][1])) ! $content = $_SESSION["translate"]->it("Selected items deleted:"); ! else ! $content = $_SESSION["translate"]->it("Selected item deleted:"); ! $list = TRUE; ! $function = $this->_deleteFunction; ! } elseif (isset($_POST["NO_BUTTON"])) { ! // tell user all is still okay ! if(isset($_POST[$this->_itemRequest][1])) ! return RSS_common::_continueContent($_SESSION["translate"]->it("Selected items NOT deleted."), "list", $this->_request); ! else ! return RSS_common::_continueContent($_SESSION["translate"]->it("Selected item NOT deleted."), "list", $this->_request); ! } elseif (isset($_POST[$this->_itemRequest]) ! && sizeof($_POST[$this->_itemRequest]) > 0 ! && is_array($_POST[$this->_itemRequest])) { ! return $this->confirmDelete(); ! } else { ! $error = TRUE; ! //Check to see if delete was a get request. If so, display error. ! if (isset($_GET['module'])) ! $debug_message = "Only POST data can be used to delete items"; ! else ! $debug_message = "No delete parameters set."; ! } ! break; ! case "view": ! $function = $this->_viewFunction; ! break; ! case "add": ! $function = $this->_editFunction; ! break; ! ! case "sView": ! $function = $this->_viewFunction; ! break; ! case "customSort": ! // only for multiview ! $function = "customSort"; ! break; ! case "saveCustomSort": ! $function = "saveCustomSort"; ! break; ! ! case "save": ! //Check to see if save was a get request. If so, display error. ! if (isset($_GET['module'])) { ! $error = TRUE; ! $debug_message = "Only POST data can be used to save items"; ! } ! $function = $this->_saveFunction; ! break; ! ! case "menu_link": ! return $this->linkItem('list', 'menu_link'); ! ! case "link": ! return $this->linkItem('view','menu_link',$_REQUEST[$this->_itemRequest][0]); ! case "hide": ! $doMassUpdate = TRUE; ! $list = TRUE; ! $function = $this->_hideFunction; ! break; ! ! case "show": ! $doMassUpdate = TRUE; ! $list = TRUE; ! $function = $this->_showFunction; ! break; ! ! case "approve": ! $doMassUpdate = TRUE; ! $list = TRUE; ! $function = $this->_approveFunction; ! break; ! } ! if ($error == FALSE && is_null($function)) { ! $debug_message = $this->_class." ".$action." not set!"; ! $error = TRUE; ! } ! if ($error == FALSE && !is_callable(array($this->_class, $function))) { ! $debug_message = $this->_class."::".$function."() doesn't exist!"; ! $error = TRUE; ! } ! if($error == FALSE && $action == 'save') ! if(!$_SESSION["OBJ_user"]->allow_access($this->_module)) ! return $this->accessDenied(); ! if ($error == FALSE && isset($_REQUEST[$this->_itemRequest]) && sizeof($_REQUEST[$this->_itemRequest]) > 0) { ! if (!is_array($_REQUEST[$this->_itemRequest])) { ! $this->_classObj = new $this->_class($_REQUEST[$this->_itemRequest]); ! $return_item = $this->_classObj->$function(); ! if ($return_item == FALSE) ! $error = TRUE; ! $content .= $return_item; ! } elseif(is_array($_REQUEST[$this->_itemRequest])) { ! $this->_classObj = new $this->_class(); ! if(!$doMassUpdate){ ! $return_items = ''; ! foreach($_REQUEST[$this->_itemRequest] as $item) { ! $return_item = $this->_classObj->$function($item); ! if ($return_item == FALSE) { ! $error = TRUE; ! break; ! } else ! $return_items .= $return_item; ! } ! $content .= $return_items; ! } else { ! $return = $this->_classObj->$function($_REQUEST[$this->_itemRequest]); ! if ($return == FALSE) ! $error = TRUE; ! else ! $content .= $return; ! } ! } ! } elseif ($error == FALSE) { ! $this->_classObj = new $this->_class(); ! $return_item = $this->_classObj->$function(); ! if ($return_item == FALSE) ! $error = TRUE; ! $content .= $return_item; ! } ! if ($error == TRUE) { ! if ($_SESSION['PHPWS_Debug']->isActive() && is_object($this->_classObj->_error)) { ! $debug_message = $this->_classObj->_error->getMessage(); ! $content .= RSS_common::_errorMessage($debug_message,"Error",1,$this->_module,"RSS_ObjManager::managerAction"); ! } elseif ($_SESSION['PHPWS_Debug']->isActive() && !is_null($debug_message)) { ! $content .= RSS_common::_errorMessage($debug_message,"Error",1,$this->_module,"RSS_ObjManager::managerAction"); } else ! $content .= RSS_common::_errorMessage("Sorry, there was a problem with that request."); ! } ! if ($list == TRUE) { ! if (!is_object($this->_classObj)) ! $this->_classObj = new $this->_class(); $function = $this->_listFunction; $content .= $this->_classObj->$function(); ! } ! ! return $content; ! }// END FUNC managerAction() Index: Multi_RSS.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/phpwsrssfeeds/class/Multi_RSS.php,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Multi_RSS.php 2 Sep 2004 17:48:57 -0000 1.22 --- Multi_RSS.php 17 Sep 2004 18:55:23 -0000 1.23 *************** *** 67,70 **** --- 67,71 ---- var $_show_anchor_links; var $_show_cat_link; + var $_sort_order; var $_expandedFeed; var $_content; *************** *** 84,87 **** --- 85,89 ---- $this->_error = NULL; $this->_show_empty_feeds = 1; + $this->_sort_order = 0; } *************** *** 114,121 **** if($this->_hidden || !$this->_approved) return FALSE; ! $feed_list = implode(" OR id = ", $this->_show_in_multiview); ! $sql = "SELECT id FROM mod_phpwsrssfeeds_feeds WHERE id = ".$feed_list . " ORDER BY label"; $feeds = $GLOBALS["core"]->getAllAssoc($sql, TRUE); ! $this->_availFeeds = $feeds; } --- 116,142 ---- if($this->_hidden || !$this->_approved) return FALSE; ! ! $feed_list = implode(" OR id = ", $this->_show_in_multiview); ! $sql = "SELECT id FROM mod_phpwsrssfeeds_feeds WHERE id = ".$feed_list; ! ! if(!isset($this->_sort_order) || $this->_sort_order == FALSE) ! $sql .= " ORDER BY label"; ! $feeds = $GLOBALS["core"]->getAllAssoc($sql, TRUE); ! ! if(isset($this->_sort_order) && $this->_sort_order == TRUE) { ! $customSorted = array(); ! foreach($this->_show_in_multiview as $feed) { ! foreach($feeds as $availFeeds) { ! if($feed == $availFeeds["id"]) { ! $customSorted[] = array("id"=>$feed); ! } ! } ! } ! $this->_availFeeds = $customSorted; ! } else { ! ! $this->_availFeeds = $feeds; ! } } *************** *** 218,222 **** function _view($id = NULL) { if(!is_null($id)) ! $this->Multi_RSS($id); //error checking --- 239,243 ---- function _view($id = NULL) { if(!is_null($id)) ! $this->Multi_RSS($id); //error checking *************** *** 262,265 **** --- 283,408 ---- }//End function _view() + function _sortMoveUp($upFeed) { + $sorted = array(); + + for($i =0; $i < count($this->_show_in_multiview); $i++) { + if($this->_show_in_multiview[$i] == $upFeed && $i != 0) + continue; + + if($this->_show_in_multiview[$i+1] == $upFeed) { + $sorted[] = $upFeed; + } + + $sorted[] = $this->_show_in_multiview[$i]; + } + + $this->_show_in_multiview = $sorted; + $this->_sort_order = 1; + $this->commit(); + } + + function _sortMoveDown($downFeed) { + $sorted = array(); + + $skipped = false; + for($i=0; $i < count($this->_show_in_multiview); $i++) { + if($this->_show_in_multiview[$i] == $downFeed && $i != count($this->_show_in_multiview)-1) { + $skipped = true; + if(count($this->_show_in_multiview) > $i) + $sorted[] = $this->_show_in_multiview[$i + 1]; + else + $sorted[] = $downFeed; + continue; + } + + if($skipped) { + $sorted[] = $downFeed; + $skipped = false; + } else + $sorted[] = $this->_show_in_multiview[$i]; + } + + $this->_show_in_multiview = $sorted; + $this->_sort_order = 1; + $this->commit(); + } + + function saveCustomSort($id) { + if(!is_null($id)) { + $this->Multi_RSS($id); + + if(isset($_REQUEST["sort_options"])) { + if($_REQUEST["sort_options"] == "custom") { + $this->_sort_order = 1; + } else if($_REQUEST["sort_options"] == "alpha") { + $this->_sort_order = 0; + } + $this->commit(); + if(isset($_REQUEST["update_sort"])) + return $this->customSort($id); + else if(isset($_REQUEST["edit"])) + return $this->_edit(); + else + return $this->_list(); + } + } + } + + function customSort($id) { + if(!is_null($id)) { + $this->Multi_RSS($id); + $allFeeds = $this->get_available_feeds(); + + if(isset($_REQUEST["MOVE_UP"])) { + $this->_sortMoveUp($_REQUEST["MOVE_UP"]); + } else if(isset($_REQUEST["MOVE_DOWN"])) { + $this->_sortMoveDown($_REQUEST["MOVE_DOWN"]); + } + + $listFeedTags["FEED_LISTING"] = ""; + $feedCount = 0; + foreach($this->_show_in_multiview as $feed) { + $rowTags = array(); + $feedCount++; + $rowTags["FEED_NAME"] = $allFeeds[$feed]; + if($feedCount != 1) + $rowTags["MOVE_UP_LINK"] = "./index.php?module=phpwsrssfeeds&RSS_MULTI_MAN_op=customSort&PHPWS_MAN_ITEMS[]=$id&MOVE_UP=$feed"; + + if($feedCount !== count($this->_show_in_multiview)) { + $rowTags["MOVE_DOWN_LINK"] = "./index.php?module=phpwsrssfeeds&RSS_MULTI_MAN_op=customSort&PHPWS_MAN_ITEMS[]=$id&MOVE_DOWN=$feed"; + } + $listFeedTags["FEED_LISTING"] .= PHPWS_Template::processTemplate($rowTags, "phpwsrssfeeds", "multi_rss/sort_ind_feed.tpl"); + + } + + $listFeedTags["ORDER_HDR"] = $_SESSION["translate"]->it("Order"); + $listFeedTags["FEED_NAME_HDR"] = $_SESSION["translate"]->it("Feeds"); + + $form = new EZform("multiview_sort"); + $form->add("module", "hidden", "phpwsrssfeeds"); + $form->add("RSS_MULTI_MAN_op", "hidden", "saveCustomSort"); + $form->add("PHPWS_MAN_ITEMS[]", "hidden", $this->_id); + $form->add("sort_options", "radio", array("alpha", "custom")); + if(isset($_REQUEST["edit"])) + $form->add("edit", "hidden", true); + $form->add("finished", "submit", $_SESSION["translate"]->it("Finished")); + + if(isset($this->_sort_order) && $this->_sort_order == 1) + $form->setMatch("sort_options", "custom"); + else + $form->setMatch("sort_options", "alpha"); + + $form->add("update_sort", "submit", $_SESSION["translate"]->it("Update")); + $tags = $form->getTemplate(); + + $tags["TITLE"] = $_SESSION["translate"]->it("Multiview Ordering for: ") . $this->_label . "."; + $tags["SORT_OPTION_ALPHA"] = $_SESSION["translate"]->it("Sort alphabetically by feed titles."); + $tags["SORT_OPTION_CUSTOM"] = $_SESSION["translate"]->it("Specify a custom ordering of feeds."); + + $tags["FEED_LISTING"] = PHPWS_Template::processTemplate($listFeedTags, "phpwsrssfeeds", "multi_rss/sort_list.tpl"); + return PHPWS_Template::processTemplate($tags, "phpwsrssfeeds", "multi_rss/sort.tpl"); + } + } + /** * Edit a RSS object's data *************** *** 269,273 **** function _edit($id = NULL) { if(!is_null($id)) ! $this->Multi_RSS($id); //Standard error checking if (is_object($this->_error)) --- 412,417 ---- function _edit($id = NULL) { if(!is_null($id)) ! $this->Multi_RSS($id); ! //Standard error checking if (is_object($this->_error)) *************** *** 285,289 **** $tab = 1; ! $form->add("TITLE", "text", PHPWS_Text::parseOutput($this->getLabel())); $form->setSize("TITLE", 33); --- 429,433 ---- $tab = 1; ! $form->add("TITLE", "text", PHPWS_Text::parseOutput($this->getLabel())); $form->setSize("TITLE", 33); *************** *** 296,305 **** $form->setTab("MAX_MULTI_ITEMS", $tab++); ! $form->add("SHOW_MULTIVIEW", "multiple", $feeds); ! if(is_array($this->_show_in_multiview)) ! $form->setMatch("SHOW_MULTIVIEW", $this->_show_in_multiview,FALSE); ! $form->setSize("SHOW_MULTIVIEW",10); ! $form->setTab("SHOW_MULTIVIEW", $tab++); ! $form->add("HOME", "checkbox"); $form->setMatch("HOME", $this->_home); --- 440,460 ---- $form->setTab("MAX_MULTI_ITEMS", $tab++); ! if(!is_array($this->_show_in_multiview)) ! $this->_show_in_multiview = array(); ! else { ! $selFeeds = array(); ! foreach($this->_show_in_multiview as $feed) { ! $selFeeds[$feed] = $feeds[$feed]; ! } ! } ! ! $sort = 1; ! if($this->_sort_order == 1) ! $sort = 0; ! ! $tags["SHOW_MULTIVIEW"] = PHPWS_WizardBag::js_insert("swapper", "MULTI_EDIT", NULL, 0, array("SHOW_MULTIVIEW_OPTIONS"=>$feeds, ! "SHOW_MULTIVIEW_SEL"=>$selFeeds, ! "sorting"=>$sort)); ! $form->add("HOME", "checkbox"); $form->setMatch("HOME", $this->_home); *************** *** 328,332 **** } } ! $fatcat = FALSE; if($GLOBALS['core']->moduleExists("fatcat")) { --- 483,487 ---- } } ! $fatcat = FALSE; if($GLOBALS['core']->moduleExists("fatcat")) { *************** *** 375,378 **** --- 530,537 ---- : $_SESSION["translate"]->it("Save")); $form->setTab("SUBMIT_BUTTON", $tab++); + $form->setExtra("SUBMIT_BUTTON", + "onClick=\"selectAll(this.form.elements['SHOW_MULTIVIEW_SEL[]'])\""); + + $form->add("module", "hidden", "phpwsrssfeeds"); $form->add("PHPWS_MAN_ITEMS[]", "hidden", $this->getId()); *************** *** 380,384 **** $tags = $form->getTemplate(true, true, $tags); ! // include category selection menu, with help if fatcat exists if($fatcat) { --- 539,546 ---- $tags = $form->getTemplate(true, true, $tags); ! ! if($this->getId()) ! $tags["UPDATE_BUTTON"] = $tags["SUBMIT_BUTTON"]; ! // include category selection menu, with help if fatcat exists if($fatcat) { *************** *** 395,405 **** $tags["EDIT_TITLE"] = $_SESSION["translate"]->it("Add RSS Feed"); } /* include help links also, to display help for each field to be completed */ $tags["TITLE_LABEL"] = $_SESSION['translate']->it("Channel Title"); $tags["TITLE_HELP"] = RSS_common::show_link("phpwsrssfeeds", "rssTitle"); ! $tags["MAX_MULTI_ITEMS_LABEL"] = $_SESSION['translate']->it("Max Number Items Multi-View"); $tags["MAX_MULTI_ITEMS_HELP"] = RSS_common::show_link("phpwsrssfeeds", "rssMaxMultiItems"); $tags["SHOW_MULTIVIEW_HELP"] = RSS_common::show_link("phpwsrssfeeds", "showMultiView"); ! $tags["SHOW_MULTIVIEW_LABEL"] = $_SESSION['translate']->it("Show feed in Multi-View RSS"); $tags["HOME_LABEL"] = $_SESSION['translate']->it("Show on Home Page"); $tags["HOME_HELP"] = RSS_common::show_link("phpwsrssfeeds", "showHome"); --- 557,571 ---- $tags["EDIT_TITLE"] = $_SESSION["translate"]->it("Add RSS Feed"); } + + if(isset($this->_id)) + $tags["SORT_OPTION"] = PHPWS_Text::moduleLink($_SESSION["translate"]->it("Order Feeds"), "phpwsrssfeeds", array("RSS_MULTI_MAN_op"=>"customSort", "PHPWS_MAN_ITEMS[]"=>$this->_id,"edit"=>TRUE)); + /* include help links also, to display help for each field to be completed */ $tags["TITLE_LABEL"] = $_SESSION['translate']->it("Channel Title"); $tags["TITLE_HELP"] = RSS_common::show_link("phpwsrssfeeds", "rssTitle"); ! $tags["MAX_MULTI_ITEMS_LABEL"] = $_SESSION['translate']->it("Max Number of Items in Multi-View"); $tags["MAX_MULTI_ITEMS_HELP"] = RSS_common::show_link("phpwsrssfeeds", "rssMaxMultiItems"); $tags["SHOW_MULTIVIEW_HELP"] = RSS_common::show_link("phpwsrssfeeds", "showMultiView"); ! $tags["SHOW_MULTIVIEW_LABEL"] = $_SESSION['translate']->it("Select feeds for Multi-View"); $tags["HOME_LABEL"] = $_SESSION['translate']->it("Show on Home Page"); $tags["HOME_HELP"] = RSS_common::show_link("phpwsrssfeeds", "showHome"); *************** *** 457,461 **** } // $_show_in_multiview must be an array or there is nothing to display ! if (!isset($_POST["SHOW_MULTIVIEW"]) || !is_array($_POST["SHOW_MULTIVIEW"])) { $message["SHOW_MULTIVIEW"] = $_SESSION['translate']->it("Please select feeds for inclusion."); $error = TRUE; --- 623,628 ---- } // $_show_in_multiview must be an array or there is nothing to display ! ! if (!isset($_POST["SHOW_MULTIVIEW_SEL"]) || !is_array($_POST["SHOW_MULTIVIEW_SEL"])) { $message["SHOW_MULTIVIEW"] = $_SESSION['translate']->it("Please select feeds for inclusion."); $error = TRUE; *************** *** 475,480 **** // note that parseInput called this way allows the global set of HTML tags to be included $this->setLabel(RSS_common::get_htmlentities(PHPWS_Text::parseInput(@$_POST["TITLE"]))); ! $this->_show_in_multiview = @$_POST["SHOW_MULTIVIEW"]; ! $current_home = $this->_home; $this->_home = trim(@$_POST["HOME"]); --- 642,647 ---- // note that parseInput called this way allows the global set of HTML tags to be included $this->setLabel(RSS_common::get_htmlentities(PHPWS_Text::parseInput(@$_POST["TITLE"]))); ! $this->_show_in_multiview = @$_POST["SHOW_MULTIVIEW_SEL"]; ! $current_home = $this->_home; $this->_home = trim(@$_POST["HOME"]); *************** *** 560,711 **** } //END function _save ! /** ! * Asks for confirmation and, getting it, deletes the current position listing ! * ! * @author Wendall Cada <wen...@NO...> ! */ ! function _delete($id) { ! if ($id == NULL) ! return FALSE; ! ! $this->Multi_RSS($id); ! //Standard error checking ! if (is_object($this->_error)) ! return FALSE; ! ! $id = $this->getId(); ! // have confirmation; remove category listing while we know the id ! $_SESSION['OBJ_fatcat']->deleteModuleElements("phpwsrssfeeds",$this->getLabel(),$id+5000); ! ! //remove layout boxes set up for this item ! if($this->_block == 1) ! PHPWS_Layout::dropBox("CNT_phpwsrssfeeds_".$id); ! if($this->_home == 1) ! PHPWS_Layout::dropBox("CNT_phpwsrssfeeds_home_".$id); ! ! // delete the current item ! $this->_error = $this->kill(); ! if(is_object($this->_error)) ! return FALSE; ! ! return " ".$this->getLabel(); ! ! } //END function _delete() ! function _list(){ ! require_once(PHPWS_SOURCE_DIR.'mod/phpwsrssfeeds/class/RSSList.php'); ! $content = FALSE; ! $settings = array("_module" => "phpwsrssfeeds", ! "_table" => "mod_phpwsrssfeeds_multi", ! "_request" => "RSS_MULTI_MAN_op"); ! $listObj = RSSList::getRSSList($settings); ! $listObj->init(); ! if ($_SESSION["OBJ_user"]->allow_access("phpwsrssfeeds")) ! $content = $listObj->getList("multi_admin", $_SESSION["translate"]->it("Multi-View RSS News Feeds")); ! else ! $content = $listObj->getList("multi", $_SESSION["translate"]->it("Multi-View News Feeds")); ! ! return $content; ! }//End function _list() ! function _hide($id = NULL) { ! require_once(PHPWS_SOURCE_DIR.'mod/phpwsrssfeeds/class/RSSList.php'); ! if(is_null($id)) ! return FALSE; ! $settings = array("_module" => "phpwsrssfeeds", ! "_table" => "mod_phpwsrssfeeds_multi"); ! $listObj = RSSList::getRSSList($settings); ! $hide = $listObj->_doMassUpdate("hidden", 1); ! if ($hide == FALSE) ! return FALSE; ! return $_SESSION['translate']->it('Items updated.'); ! }//End fuction _hide() ! function _show($id = NULL) { ! require_once(PHPWS_SOURCE_DIR.'mod/phpwsrssfeeds/class/RSSList.php'); ! if(is_null($id)) ! return FALSE; ! $settings = array("_module" => "phpwsrssfeeds", ! "_table" => "mod_phpwsrssfeeds_multi"); ! $listObj = RSSList::getRSSList($settings); ! $show = $listObj->_doMassUpdate("hidden", 0); ! if ($show == FALSE) ! return FALSE; ! return $_SESSION['translate']->it('Items updated.'); ! }//End fuction _show() ! /** ! * returns array of current feeds ! * ! * @author Wendall Cada <wen...@NO...> ! */ ! function get_available_feeds() { ! $sql = "SELECT id,label FROM mod_phpwsrssfeeds_feeds WHERE hidden='0' && approved='1'"; ! foreach($GLOBALS["core"]->getAssoc($sql, TRUE) as $key => $value) ! $feeds[$key] = PHPWS_Text::parseOutput($value); ! if(isset($feeds)) ! return $feeds; ! else ! return FALSE; ! }//End function get_available_feeds() ! ! function showHomeItems(){ ! $content = $this->_view(); ! $content_var = "CNT_phpwsrssfeeds_multi_home_" . $this->getId(); ! $GLOBALS[$content_var]['title'] = $_SESSION['translate']->it($this->_label); ! $GLOBALS[$content_var]['content'] = $content; ! return true; } ! /** ! * Sets up content for view in block ! * ! * @author Wendall Cada <wen...@NO...> ! * @ref RSS:showUserBox() ! * ! */ ! function showUserBox() { ! $RSSobj = new RSS($this->_show_in_multiview[0]); ! $confirm = FALSE; ! //Check to see if module allowed is current ! if(is_array($this->allow_view)){ ! $modules_allowed = $RSSobj->get_modules_allowed(); ! foreach($this->allow_view as $num){ ! if(((isset($_REQUEST['module']) && ($_REQUEST['module'] == $modules_allowed[$num])) ! || (!isset($_REQUEST['module']) && ("home" == $modules_allowed[$num])))) $confirm = TRUE; } } ! ! //Check to see if pagemaster page allowed is current ! if(!$confirm){ ! if(is_array($this->pm_allow)){ ! if(isset($_REQUEST['module']) && !$_REQUEST['module'] == 'pagemaster') ! return; ! foreach($this->pm_allow as $num){ ! if(isset($_REQUEST['PAGE_id']) && $_REQUEST['PAGE_id'] == $num) ! $confirm = TRUE; ! ! if(isset($_SESSION["SES_PM_page"]) && is_object($_SESSION["SES_PM_page"]) && ! is_a($_SESSION["SES_PM_page"], "PHPWS_page") && $_SESSION["SES_PM_page"]->id == $num) ! $confirm = TRUE; ! ! } ! if(!$confirm) ! return; ! }else{ ! return; ! } ! } ! ! if($confirm) { ! $content_var = 'CNT_phpwsrssfeeds_multi_'.$this->getId(); ! $GLOBALS[$content_var]['content'] = $this->_view(); ! $GLOBALS[$content_var]['title'] = $_SESSION['translate']->it($this->_label); ! return true; ! } ! ! }//End function showUserBox() }//End class Multi_RSS ?> \ No newline at end of file --- 727,878 ---- } //END function _save ! /** ! * Asks for confirmation and, getting it, deletes the current position listing ! * ! * @author Wendall Cada <wen...@NO...> ! */ ! function _delete($id) { ! if ($id == NULL) ! return FALSE; ! $this->Multi_RSS($id); ! //Standard error checking ! if (is_object($this->_error)) ! return FALSE; ! $id = $this->getId(); ! // have confirmation; remove category listing while we know the id ! $_SESSION['OBJ_fatcat']->deleteModuleElements("phpwsrssfeeds",$this->getLabel(),$id+5000); ! //remove layout boxes set up for this item ! if($this->_block == 1) ! PHPWS_Layout::dropBox("CNT_phpwsrssfeeds_".$id); ! if($this->_home == 1) ! PHPWS_Layout::dropBox("CNT_phpwsrssfeeds_home_".$id); ! // delete the current item ! $this->_error = $this->kill(); ! if(is_object($this->_error)) ! return FALSE; ! ! return " ".$this->getLabel(); ! ! } //END function _delete() ! ! function _list(){ ! require_once(PHPWS_SOURCE_DIR.'mod/phpwsrssfeeds/class/RSSList.php'); ! $content = FALSE; ! $settings = array("_module" => "phpwsrssfeeds", ! "_table" => "mod_phpwsrssfeeds_multi", ! "_request" => "RSS_MULTI_MAN_op"); ! $listObj = RSSList::getRSSList($settings); ! $listObj->init(); ! if ($_SESSION["OBJ_user"]->allow_access("phpwsrssfeeds")) ! $content = $listObj->getList("multi_admin", $_SESSION["translate"]->it("Multi-View RSS News Feeds")); ! else ! $content = $listObj->getList("multi", $_SESSION["translate"]->it("Multi-View News Feeds")); ! ! return $content; ! }//End function _list() ! ! function _hide($id = NULL) { ! require_once(PHPWS_SOURCE_DIR.'mod/phpwsrssfeeds/class/RSSList.php'); ! if(is_null($id)) ! return FALSE; ! $settings = array("_module" => "phpwsrssfeeds", ! "_table" => "mod_phpwsrssfeeds_multi"); ! $listObj = RSSList::getRSSList($settings); ! $hide = $listObj->_doMassUpdate("hidden", 1); ! if ($hide == FALSE) ! return FALSE; ! return $_SESSION['translate']->it('Items updated.'); ! }//End fuction _hide() ! ! function _show($id = NULL) { ! require_once(PHPWS_SOURCE_DIR.'mod/phpwsrssfeeds/class/RSSList.php'); ! if(is_null($id)) ! return FALSE; ! $settings = array("_module" => "phpwsrssfeeds", ! "_table" => "mod_phpwsrssfeeds_multi"); ! $listObj = RSSList::getRSSList($settings); ! $show = $listObj->_doMassUpdate("hidden", 0); ! if ($show == FALSE) ! return FALSE; ! return $_SESSION['translate']->it('Items updated.'); ! }//End fuction _show() ! ! /** ! * returns array of current feeds ! * ! * @author Wendall Cada <wen...@NO...> ! */ ! function get_available_feeds() { ! $sql = "SELECT id,label FROM mod_phpwsrssfeeds_feeds WHERE hidden='0' && approved='1'"; ! foreach($GLOBALS["core"]->getAssoc($sql, TRUE) as $key => $value) ! $feeds[$key] = PHPWS_Text::parseOutput($value); ! if(isset($feeds)) ! return $feeds; ! else ! return FALSE; ! }//End function get_available_feeds() ! ! function showHomeItems(){ ! $content = $this->_view(); ! $content_var = "CNT_phpwsrssfeeds_multi_home_" . $this->getId(); ! $GLOBALS[$content_var]['title'] = $_SESSION['translate']->it($this->_label); ! $GLOBALS[$content_var]['content'] = $content; ! return true; ! } ! ! /** ! * Sets up content for view in block ! * ! * @author Wendall Cada <wen...@NO...> ! * @ref RSS:showUserBox() ! * ! */ ! function showUserBox() { ! $RSSobj = new RSS($this->_show_in_multiview[0]); ! $confirm = FALSE; ! //Check to see if module allowed is current ! if(is_array($this->allow_view)){ ! $modules_allowed = $RSSobj->get_modules_allowed(); ! foreach($this->allow_view as $num){ ! if(((isset($_REQUEST['module']) && ($_REQUEST['module'] == $modules_allowed[$num])) ! || (!isset($_REQUEST['module']) && ("home" == $modules_allowed[$num])))) ! $confirm = TRUE; ! } } ! //Check to see if pagemaster page allowed is current ! if(!$confirm){ ! if(is_array($this->pm_allow)){ ! if(isset($_REQUEST['module']) && !$_REQUEST['module'] == 'pagemaster') ! return; ! foreach($this->pm_allow as $num){ ! if(isset($_REQUEST['PAGE_id']) && $_REQUEST['PAGE_id'] == $num) ! $confirm = TRUE; ! ! if(isset($_SESSION["SES_PM_page"]) && is_object($_SESSION["SES_PM_page"]) && ! is_a($_SESSION["SES_PM_page"], "PHPWS_page") && $_SESSION["SES_PM_page"]->id == $num) $confirm = TRUE; + } + if(!$confirm) + return; + }else{ + return; } ! } + if($confirm) { + $content_var = 'CNT_phpwsrssfeeds_multi_'.$this->getId(); + $GLOBALS[$content_var]['content'] = $this->_view(); + $GLOBALS[$content_var]['title'] = $_SESSION['translate']->it($this->_label); + return true; + } + + }//End function showUserBox() + }//End class Multi_RSS ?> \ No newline at end of file Index: RSSManager.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/phpwsrssfeeds/class/RSSManager.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** RSSManager.php 30 Jul 2004 19:40:35 -0000 1.18 --- RSSManager.php 17 Sep 2004 18:55:23 -0000 1.19 *************** *** 68,72 **** $this->_showMenu = array("edit"=>1, "add"=>1, "delete"=>1, "link"=>1, "menu_link"=>1, ! "show"=>1, "hide"=>1, "list"=>1, "save"=>1); $this->_menu = array(); $this->_manObj = NULL; --- 68,73 ---- $this->_showMenu = array("edit"=>1, "add"=>1, "delete"=>1, "link"=>1, "menu_link"=>1, ! "show"=>1, "hide"=>1, "list"=>1, "save"=>1, ! "customSort"=>1, "saveCustomSort"=>1); $this->_menu = array(); $this->_manObj = NULL; *************** *** 282,285 **** --- 283,287 ---- */ function action($request = NULL) { + $menuAction = NULL; $this->_request = $request; *************** *** 293,296 **** --- 295,299 ---- $action = $_REQUEST[$this->_request]; $content = NULL; + //Check for deprecated actions if(isset($action) && $action == 'Backend' && isset($_REQUEST["RSS_id"])) { *************** *** 308,311 **** --- 311,315 ---- if($action == 'delete' || $action == 'show' || $action == 'hide') $menuAction = 'list'; + if(isset($this->_showMenu[$action]) && $this->_showMenu[$action] == TRUE){ $this->initMenu(); |