Permalink
Browse files

interface fix - instead of a combo box show feeds as checkboxes to ma…

…ke it more obvious when an instance has no associated feed. bug fix - if a custom title is set always use it over the feed's incoming title
  • Loading branch information...
1 parent 67f74fe commit e4897989b22842e2e405cb065961e1c029737dfe dhawes committed May 18, 2005
Showing with 12 additions and 21 deletions.
  1. +7 −2 blocks/rss_client/block_rss_client.php
  2. +5 −19 blocks/rss_client/config_instance.html
@@ -235,8 +235,13 @@ function get_rss_by_id($rssid, $display_description, $shownumentries, $showtitle
}
}
- if (!empty($feedtitle) and ($feedtitle != '<a href="'. $rss->channel['link'] .'"></a>')) {
- $this->title = $feedtitle;
+ // if block has no custom title
+ if (empty($this->config) || (!empty($this->config) && empty($this->config->title))) {
+ // if the feed has a title
+ if (!empty($feedtitle) and ($feedtitle != '<a href="'. $rss->channel['link'] .'"></a>')) {
+ // set the block's title to the feed's title
+ $this->title = $feedtitle;
+ }
}
// store config setting for this rssid so we do not need to read from file each time
@@ -77,27 +77,13 @@
} else {
$feedtitle = stripslashes_safe($rssfeed->title);
}
- $feedoptions[$rssfeed->id] = $feedtitle;
- }
- $dropdownmenustring = choose_from_menu($feedoptions, 'rssid[]', '', '', '', '0', true);
-
- //Daryl Hawes note:
- // moodle's choose_from_menu() function does not support
- // the "multiple" or "size" options, so before printing out the
- // calculated drop down menu we insert the keyword "multiple"
- $dropdownmenustring = preg_replace("|\"rssid\[\]\" >*|","\"rssid[]\" multiple>", $dropdownmenustring);
-
- // since there may be multiple rssids to select
- // we need to check for each
- if (!empty($selectedarray)) {
- foreach ($selectedarray as $selected) {
- $selected = intval($selected);
- $dropdownmenustring = preg_replace("|\"$selected\">*|","\"$selected\" selected>", $dropdownmenustring);
+ $checked = '';
+ if (in_array($rssfeed->id, $selectedarray)) {
+ $checked = 'checked';
}
+ $checkbox = '<input type="checkbox" name="rssid[]" id="rssid[]" value="'. $rssfeed->id .'" '. $checked .' />';
+ print $checkbox . $feedtitle .'<br />'."\n";
}
-
- print $dropdownmenustring;
-
} else {
print_string('nofeeds', 'block_rss_client');
if ( isadmin() ) {

0 comments on commit e489798

Please sign in to comment.