From ea6a83453362a59543fd38e1ef3b291afe971c1e Mon Sep 17 00:00:00 2001 From: toyomoyo Date: Wed, 24 May 2006 07:03:14 +0000 Subject: [PATCH] added rsstitle, merged --- mod/data/rsslib.php | 12 ++++++++---- mod/data/templates.php | 15 ++++++++++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/mod/data/rsslib.php b/mod/data/rsslib.php index cb82a1b42f..9a94dac74e 100644 --- a/mod/data/rsslib.php +++ b/mod/data/rsslib.php @@ -73,16 +73,20 @@ array_push($recordarray, $record); $item = null; - $item->title = strip_tags(get_field('data_content', 'content', + + // guess title or not + if ($data->rsstitletemplate) { + $item->title = data_print_template('rsstitletemplate', $recordarray, $data, '', 0, true); + } else { // else we guess + $item->title = strip_tags(get_field('data_content', 'content', 'fieldid', $firstfield->id, 'recordid', $record->id)); - $item->description = data_print_template($recordarray, $data, '', 'rsstemplate', false, - 0, 0, 'timecreated DESC', '', true); + } + $item->description = data_print_template('rsstemplate', $recordarray, $data, '', 0, true); $item->pubdate = $record->timecreated; $item->link = $CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&rid='.$record->id; array_push($items, $item); } - $course = get_record('course', 'id', $data->course); // First all rss feeds common headers. diff --git a/mod/data/templates.php b/mod/data/templates.php index 4f2d153255..bc8ffe51a0 100755 --- a/mod/data/templates.php +++ b/mod/data/templates.php @@ -113,7 +113,10 @@ if (isset($mytemplate->listtemplatefooter)){ $newtemplate->listtemplatefooter = $mytemplate->listtemplatefooter; } - + if (isset($mytemplate->rsstitletemplate)){ + $newtemplate->rsstitletemplate = $mytemplate->rsstitletemplate; + } + // Check for multiple tags, only need to check for add template. if ($mode != 'addtemplate' or data_tags_check($data->id, $newtemplate->{$mode})) { if (update_record('data', $newtemplate)) { @@ -213,6 +216,14 @@ print_textarea($usehtmleditor, 10, 72, 0, 0, 'listtemplatefooter', $data->listtemplatefooter); echo ''; echo ''; + } else if ($mode == 'rsstemplate') { + echo ''; + echo ' '; + echo ''; + echo '
'.get_string('rsstitletemplate','data').'
'; + print_textarea($usehtmleditor, 10, 72, 0, 0, 'rsstitletemplate', $data->rsstitletemplate); + echo ''; + echo ''; } echo ''; @@ -228,6 +239,8 @@ if ($mode == 'listtemplate'){ use_html_editor('listtemplateheader'); use_html_editor('listtemplatefooter'); + } else if ($mode == 'rsstemplate'){ + use_html_editor('rsstitletemplate'); } } -- 2.39.5