attempt to preserve on the merry go round of forms and link in rss feed creation

This commit is contained in:
dhawes
2005-07-31 20:04:19 +00:00
parent e792d664dd
commit d721fbd036
3 changed files with 17 additions and 12 deletions
@@ -28,7 +28,7 @@
$act = optional_param('act', 'none' );
$rssid = optional_param('rssid', 'none' );
$courseid = optional_param('courseid', 0, PARAM_INT);
$courseid = optional_param('courseid', SITEID, PARAM_INT);
$url = optional_param('url');
$preferredtitle = optional_param('preferredtitle', '');
$item = optional_param('item');
@@ -67,12 +67,12 @@
//if the user is an admin or course teacher then allow the user to
//assign categories to other uses than personal
if (!( isadmin() || $submitters == SUBMITTERS_ALL_ACCOUNT_HOLDERS || ($submitters == SUBMITTERS_ADMIN_AND_TEACHER && $isteacher) ) ) {
error(get_string('noguestpost', 'forum'), $referrer);
error(get_string('noguestpost', 'forum').' You are not allowed to make modifications to this RSS feed at this time.', $referrer);
}
if ($act == 'none') {
rss_display_feeds();
rss_get_form($act, $url, $rssid, $preferredtitle);
rss_get_form($act, $url, $rssid, $preferredtitle, $courseid);
} else if ($act == 'updfeed') {
if (empty($url)) {
@@ -155,7 +155,7 @@
redirect($referrer, $message);
/*
rss_display_feeds();
rss_get_form($act, $dataobject->url, $dataobject->id, $dataobject->preferredtitle);
rss_get_form($act, $dataobject->url, $dataobject->id, $dataobject->preferredtitle, $courseid);
*/
} else if ( $act == 'rss_edit') {
@@ -166,7 +166,7 @@
}
$url = stripslashes_safe($rss_record->url);
rss_display_feeds('', $rssid);
rss_get_form($act, $url, $rssid, $preferredtitle);
rss_get_form($act, $url, $rssid, $preferredtitle, $courseid);
} else if ($act == 'delfeed') {
@@ -234,7 +234,7 @@
}
} else {
rss_display_feeds();
rss_get_form($act, $url, $rssid, $preferredtitle);
rss_get_form($act, $url, $rssid, $preferredtitle, $courseid);
}
print_footer();
+4 -2
View File
@@ -1,6 +1,8 @@
<?php
require_once($CFG->libdir .'/rsslib.php');
$courseid = optional_param('courseid', SITEID, PARAM_INT);
//create a page object for url_get_full()
$page = page_create_object($this->instance->pagetype, $this->instance->pageid);
@@ -87,7 +89,7 @@ if ($currentaction == 'configblock') {
} else {
print_string('nofeeds', 'block_rss_client');
if ( isadmin() ) {
print '&nbsp;<a href="'. $CFG->wwwroot .'/blocks/rss_client/block_rss_client_action.php"> '. get_string('editnewsfeeds', 'block_rss_client') .'</a><br />';
print '&nbsp;<a href="'. $CFG->wwwroot .'/blocks/rss_client/block_rss_client_action.php?courseid='. $courseid .'"> '. get_string('editnewsfeeds', 'block_rss_client') .'</a><br />';
}
}
?>
@@ -149,6 +151,6 @@ if ($currentaction == 'configblock') {
print '<tr valign="top"><td>';
rss_display_feeds();
print '</form>'; //not sure that this is needed
rss_get_form($act, $url, $rssid, $preferredtitle);
rss_get_form($act, $url, $rssid, $preferredtitle, $courseid);
print '</td></tr></table>';
} ?>
+7 -4
View File
@@ -427,12 +427,14 @@ function rss_unhtmlentities($string) {
/**
* Prints or returns a form for managing rss feed entries.
* @param string $act .
* @param string $url .
* @param int $rssid .
* @param string $act The current action. If "rss_edit" then and "update" button is used, otherwise "add" is used.
* @param string $url The url of the feed that is being updated or NULL
* @param int $rssid The dataabse id of the feed that is being updated or NULL
* @param bool $printnow True if the generated form should be printed out, false if the string should be returned from this function quietly
* @param int $courseid The course that is currently being viewed if applicable
* @return string Either the form is printed directly and nothing is returned or the form is returned as a string
*/
function rss_get_form($act='none', $url='', $rssid='', $preferredtitle='', $printnow=true) {
function rss_get_form($act='none', $url='', $rssid='', $preferredtitle='', $printnow=true, $courseid=SITEID) {
global $USER, $CFG, $_SERVER, $blockid, $blockaction;
global $blogid; //hackish, but if there is a blogid it would be good to preserve it
$stredit = get_string('edit');
@@ -470,6 +472,7 @@ function rss_get_form($act='none', $url='', $rssid='', $preferredtitle='', $prin
if ($act == 'rss_edit') {
$returnstring .= '<input type="hidden" name="rssid" value="'. $rssid .'" />'. "\n";
}
$returnstring .= '<input type="hidden" name="courseid" value="'. $courseid .'" />'."\n";
$returnstring .= '<input type="hidden" name="blogid" value="'. $blogid .'" />'."\n";
$returnstring .= '<input type="hidden" name="user" value="'. $USER->id .'" />'."\n";
$returnstring .= '<br /><input type="submit" value="';