From fd06c3a53dc7dd8b5bcc11622380bbe77667c277 Mon Sep 17 00:00:00 2001 From: sam marshall Date: Thu, 18 Apr 2024 11:12:43 +0100 Subject: [PATCH] Technical debt: Remove ousearch - remove ousearch code from mod_oublog #757348 --- allposts.php | 14 --- deletepost.php | 4 - import.php | 10 -- lang/de/oublog.php | 1 - lang/en/oublog.php | 8 -- lang/ja/oublog.php | 1 - lang/pt_br/oublog.php | 1 - lib.php | 136 --------------------- locallib.php | 126 +------------------- search.php | 210 --------------------------------- tests/behat/sharedblog.feature | 34 ------ view.php | 18 --- viewpost.php | 4 - 13 files changed, 1 insertion(+), 566 deletions(-) delete mode 100644 search.php diff --git a/allposts.php b/allposts.php index 2e43af1..f49fbf9 100644 --- a/allposts.php +++ b/allposts.php @@ -88,8 +88,6 @@ $strolderposts = get_string('olderposts', 'oublog'); $strfeeds = get_string('feeds', 'oublog'); -$strblogsearch = get_string('searchblogs', 'oublog'); - // Get Posts. list($posts, $recordcount) = oublog_get_posts($oublog, $context, $offset, $cm, null, -1, null, $tag, $canaudit, true); @@ -109,20 +107,8 @@ $PAGE->navbar->add(get_string('extranavtag', 'oublog', $tag)); } -if (oublog_search_installed()) { - $buttontext=<<
- - - -
-EOF; -} else { - $buttontext=''; -} $url = new moodle_url("$CFG->wwwroot/course/mod.php", array('update' => $cm->id, 'return' => true, 'sesskey' => sesskey())); -$PAGE->set_button($buttontext); // The right column, BEFORE the middle-column. if (isloggedin() and !isguestuser()) { diff --git a/deletepost.php b/deletepost.php index 4d642b9..a227f45 100644 --- a/deletepost.php +++ b/deletepost.php @@ -243,10 +243,6 @@ function oublog_do_delete($course, $cm, $oublog, $post) { array(), $post->visibility)) { throw new moodle_exception('tagupdatefailed', 'oublog'); } - if (oublog_search_installed() && !local_ousearch_indexingdisabled()) { - $doc = oublog_get_search_document($updatepost, $cm); - $doc->delete(); - } // Inform completion system, if available. $completion = new completion_info($course); if ($completion->is_enabled($cm) && ($oublog->completionposts)) { diff --git a/import.php b/import.php index ec0ef30..162022b 100644 --- a/import.php +++ b/import.php @@ -529,16 +529,6 @@ function mod_oublog_import_get_identifier($user): array { $completion->update_state($cm, COMPLETION_COMPLETE); } } - // Update search (add required properties to newpost). - $newpost->id = $newid; - $newpost->userid = $USER->id; - $newpost->tags = array(); - if (isset($post->tags)) { - foreach ($post->tags as $tag) { - $newpost->tags[$tag->id] = $tag->tag; - } - } - oublog_search_update($newpost, $cm); $trans->allow_commit(); $bar->update($cur, count($posts), get_string('import_step2_prog', 'oublog')); } diff --git a/lang/de/oublog.php b/lang/de/oublog.php index bed9a7d..650f194 100644 --- a/lang/de/oublog.php +++ b/lang/de/oublog.php @@ -110,7 +110,6 @@ $string['newcomment'] = 'Neuer Blogkommentar'; $string['searchthisblog'] = 'Dieses Blog suchen'; -$string['searchblogs'] = 'Blogs suchen'; $string['url']='Volle Webadresse'; diff --git a/lang/en/oublog.php b/lang/en/oublog.php index 15f907e..80def67 100644 --- a/lang/en/oublog.php +++ b/lang/en/oublog.php @@ -204,14 +204,6 @@ $string['postmessage'] = 'Post'; $string['searchthisblog'] = 'Search this {$a}'; -$string['searchblogs'] = 'Search'; -$string['searchblogs_help'] = 'Type your search term and press Enter or click the button. - -To search for exact phrases use quote marks. - -To exclude a word insert a hyphen immediately before the word. - -Example: the search term picasso -sculpture "early works" will return results for ‘picasso’ or the phrase ‘early works’ but will exclude items containing ‘sculpture’.'; $string['url'] = 'Full Web address'; diff --git a/lang/ja/oublog.php b/lang/ja/oublog.php index f4c53f8..4bb419f 100644 --- a/lang/ja/oublog.php +++ b/lang/ja/oublog.php @@ -74,7 +74,6 @@ $string['posts'] = '記事'; $string['rss'] = 'RSS'; $string['rssfeed'] = 'RSSフィード'; -$string['searchblogs'] = 'ブログを検索する'; $string['searchthisblog'] = 'このブログを検索する'; $string['siteentries'] = 'サイトエントリを表示する'; $string['subscribefeed'] = 'このブログが更新された場合、通知を受け取るには、フィードを購読登録してください (適切なソフトウェアが必要です)。'; diff --git a/lang/pt_br/oublog.php b/lang/pt_br/oublog.php index 3b12db1..72c34fd 100644 --- a/lang/pt_br/oublog.php +++ b/lang/pt_br/oublog.php @@ -156,7 +156,6 @@ $string['re'] = 'Re: {$a}'; $string['rss'] = 'RSS'; $string['rssfeed'] = 'RSS feed'; -$string['searchblogs'] = 'Pesquisar nos Blogs'; $string['searchthisblog'] = 'Pesquisar este blog'; $string['separateindividual'] = 'Individual separado'; $string['separateindividualblogs'] = 'Blogs individuais separados'; diff --git a/lib.php b/lib.php index d146064..b4c18d6 100644 --- a/lib.php +++ b/lib.php @@ -168,11 +168,7 @@ function oublog_delete_instance($oublogid) { throw new moodle_exception('invalidcoursemodule'); } - // Fulltext search data require_once(dirname(__FILE__).'/locallib.php'); - if (oublog_search_installed()) { - local_ousearch_document::delete_module_instance_data($cm); - } oublog_grade_item_delete($oublog); @@ -464,138 +460,6 @@ function oublog_print_recent_mod_activity($activity, $courseid, $detail, $modnam return; } - -/** - * Obtains a search document given the ousearch parameters. - * @param object $document Object containing fields from the ousearch documents table - * @return mixed False if object can't be found, otherwise object containing the following - * fields: ->content, ->title, ->url, ->activityname, ->activityurl - */ -function oublog_ousearch_get_document($document) { - global $CFG, $DB; - require_once('locallib.php'); - - // Get data - if (!($cm=$DB->get_record('course_modules', array('id' => $document->coursemoduleid)))) { - return false; - } - if (!($oublog=$DB->get_record('oublog', array('id' => $cm->instance)))) { - return false; - } - if (!($post=$DB->get_record_sql(" -SELECT - p.*,bi.userid -FROM -{oublog_posts} p - INNER JOIN {oublog_instances} bi ON p.oubloginstancesid=bi.id -WHERE - p.id= ? ", array($document->intref1)))) { - return false; - } - - $result=new StdClass; - - // Set up activity name and URL - $result->activityname=$oublog->name; - if ($oublog->global) { - $result->activityurl=$CFG->wwwroot.'/mod/oublog/view.php?user='. - $document->userid; - } else { - $result->activityurl=$CFG->wwwroot.'/mod/oublog/view.php?id='. - $document->coursemoduleid; - } - - // Now do the post details - $result->title=$post->title; - $result->content=$post->message; - $result->url=$CFG->wwwroot.'/mod/oublog/viewpost.php?post='.$document->intref1; - - // Sort out tags for use as extrastrings - $taglist=oublog_get_post_tags($post, true); - if (count($taglist)!=0) { - $result->extrastrings=$taglist; - } - - // Post object is used in filter - $result->data=$post; - - return $result; -} - -/** - * Update all documents for ousearch. - * @param bool $feedback If true, prints feedback as HTML list items - * @param int $courseid If specified, restricts to particular courseid - */ -function oublog_ousearch_update_all($feedback=false, $courseid=0) { - global $CFG, $DB; - if (get_config('local_ousearch', 'ousearchindexingdisabled')) { - // Do nothing if the OU Search system is turned off. - return; - } - require_once($CFG->dirroot . '/mod/oublog/locallib.php'); - - // Get all existing blogs as $cm objects (which we are going to need to - // do the updates). get_records is ok here because we're only taking a - // few fields and there's unlikely to be more than a few thousand blog - // instances [user blogs all use a single course-module] - $coursemodules=$DB->get_records_sql(" -SELECT - cm.id,cm.course,cm.instance -FROM -{modules} m - INNER JOIN {course_modules} cm ON m.id=cm.module -WHERE - m.name='oublog'".($courseid ? " AND cm.course= ? " : ""), array($courseid)); - if (!$coursemodules) { - $coursemodules = array(); - } - - // Display info and loop around each coursemodule - if ($feedback) { - print '
  • '.count($coursemodules).' instances to process.
  • '; - $dotcount=0; - } - $posts=0; $instances=0; - foreach ($coursemodules as $coursemodule) { - - // Get all the posts that aren't deleted - $rs=$DB->get_recordset_sql(" -SELECT - p.id,p.title,p.message,p.groupid,i.userid -FROM -{oublog_instances} i - INNER JOIN {oublog_posts} p ON p.oubloginstancesid=i.id -WHERE - p.deletedby IS NULL AND i.oublogid= ? ", array($coursemodule->instance)); - - foreach ($rs as $post) { - oublog_search_update($post, $coursemodule); - - // Add to count and do user feedback every 100 posts - $posts++; - if ($feedback && ($posts%100)==0) { - if ($dotcount==0) { - print '
  • '; - } - print '.'; - $dotcount++; - if ($dotcount == 20 || $instances == count($coursemodules)) { - print "done $posts posts ($instances instances)
  • "; - $dotcount=0; - } - flush(); - } - } - $rs->close(); - - $instances++; - } - if ($feedback && ($dotcount!=0 || $posts<100)) { - print ($dotcount==0?'
  • ':'')."done $posts posts ($instances instances)
  • "; - } -} - /** * Indicates API features that the module supports. * diff --git a/locallib.php b/locallib.php index 6c49ba4..f2b26f1 100644 --- a/locallib.php +++ b/locallib.php @@ -531,10 +531,7 @@ function oublog_add_post($post, $cm, $oublog, $course) { oublog_update_item_tags($post->oubloginstancesid, $postid, $post->tags, $post->visibility); } - $post->id=$postid; // Needed by the below - if (!oublog_search_update($post, $cm)) { - return(false); - } + $post->id = $postid; // Needed by later code in callers (sometimes). // Inform completion system, if available $completion = new completion_info($course); @@ -617,10 +614,6 @@ function oublog_edit_post($post, $cm) { return(false); } - if (!oublog_search_update($post, $cm)) { - return(false); - } - $tw->allow_commit(); return(true); @@ -1970,47 +1963,6 @@ function oublog_replace_url_param($url, $replacekey, $newvalue=null) { return($url); } -/** @return True if OU search extension is installed */ -function oublog_search_installed() { - return @include_once(dirname(__FILE__).'/../../local/ousearch/searchlib.php'); -} - -/** - * Obtains a search document relating to a particular blog post. - * - * @param object $post Post object. Required fields: id (optionally also - * groupid, userid save a db query) - * @param object $cm Course-module object. Required fields: id, course - * @return ousearch_doument - */ -function oublog_get_search_document($post, $cm) { - global $DB; - // Set up 'search document' to refer to this post - $doc=new local_ousearch_document(); - $doc->init_module_instance('oublog', $cm); - if (!isset($post->userid) || !isset($post->groupid)) { - $results=$DB->get_record_sql(" -SELECT - p.groupid,i.userid -FROM -{oublog_posts} p - INNER JOIN {oublog_instances} i ON p.oubloginstancesid=i.id -WHERE - p.id= ?", array($post->id)); - if (!$results) { - throw new moodle_exception('invalidblogdetails', 'oublog'); - } - $post->userid=$results->userid; - $post->groupid=$results->groupid; - } - if ($post->groupid) { - $doc->set_group_id($post->groupid); - } - $doc->set_user_id($post->userid); - $doc->set_int_refs($post->id); - return $doc; -} - /** * Obtains tags for a $post object whether or not it currently has them * defined in some way. (If they're not defined, uses a database query.) @@ -2051,34 +2003,6 @@ function oublog_get_post_tags($post, $includespaces = false) { return $taglist; } -/** - * Updates the fulltext search information for a post which is being added or - * updated. - * @param object $post Post data, including slashes for database. Must have - * fields id,userid,groupid (if applicable), title, message - * @param object $cm Course-module - * @return True if search update was successful - */ -function oublog_search_update($post, $cm) { - // Do nothing if OU search is not installed - if (!oublog_search_installed()) { - return true; - } - - // Get search document - $doc=oublog_get_search_document($post, $cm); - - // Sort out tags for use as extrastrings - $taglist=oublog_get_post_tags($post, true); - if (count($taglist)==0) { - $taglist=null; - } - - // Update information about this post (works ok for add or edit) - $doc->update($post->title, $post->message, null, null, $taglist); - return true; -} - function oublog_date($time, $insentence = false) { if (function_exists('specially_shrunken_date')) { return specially_shrunken_date($time, $insentence); @@ -3295,54 +3219,6 @@ public static function base_supported_formats() { } } -/** - * Returns html for a search form for the nav bar - * @param string $name blog identifier field e.g. id - * @param string $value blog identifier value e.g. 266 - * @param string $strblogsearch search this blog text - * @param string $querytext optional search term - * @param bool $newsearchimage optional param to display a different image.. - * @param int $cmid cmid of shared blog. - * @returns string html - */ -function oublog_get_search_form($name, $value, $strblogsearch, $querytext='', $newsearchimage = false, $cmid = null) { - if (!oublog_search_installed()) { - return ''; - } - global $OUTPUT, $DB; - - // Check if search in shared blog. - if ($name == 'id') { - $cm = get_coursemodule_from_id('oublog', $value); - $oublog = $DB->get_record('oublog', ['id' => $cm->instance]); - if ($oublog->individual && $oublog->idsharedblog) { - // Get master blog. - $masterblog = oublog_get_master($oublog->idsharedblog); - // Get cmid of master blog. - $cmmaster = get_coursemodule_from_instance('oublog', $masterblog->id); - $value = $cmmaster->id; - $cmid = $cm->id; - } - } - $out = html_writer::start_tag('form', array('action' => 'search.php', 'method' => 'get')); - $out .= html_writer::start_tag('div'); - $out .= html_writer::tag('label', $strblogsearch . ' ', array('for' => 'oublog_searchquery')); - $out .= $OUTPUT->help_icon('searchblogs', 'oublog'); - $out .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => $name, - 'value' => $value)); - $out .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'cmid', - 'value' => $cmid)); - $out .= html_writer::empty_tag('input', array('type' => 'text', 'name' => 'query', - 'id' => 'oublog_searchquery', 'value' => $querytext)); - $src = ($newsearchimage) ? $OUTPUT->image_url('search_rgb_32px', 'theme_osep') : $OUTPUT->image_url('i/search'); - $out .= html_writer::empty_tag('input', array('type' => 'image', - 'id' => 'ousearch_searchbutton', 'alt' => get_string('search'), - 'title' => get_string('search'), 'src' => $src)); - $out .= html_writer::end_tag('div'); - $out .= html_writer::end_tag('form'); - return $out; -} - /** * Checks what level of participation the currently * logged in user can view diff --git a/search.php b/search.php deleted file mode 100644 index 01854ac..0000000 --- a/search.php +++ /dev/null @@ -1,210 +0,0 @@ -. - -/** - * Search results page. - * - * @copyright © 2007 The Open University - * @author s.marshall@open.ac.uk - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License - * @package oublog - *//** */ -require_once('../../config.php'); -require_once('locallib.php'); -require_once($CFG->dirroot.'/local/ousearch/searchlib.php'); - -$id = optional_param('id', 0, PARAM_INT); // Course Module ID -$user = optional_param('user', 0, PARAM_INT); // User ID -$querytext = required_param('query', PARAM_RAW); -$querytexthtml = htmlspecialchars($querytext); -$cmid = optional_param('cmid', null, PARAM_INT); - -if ($id) { - if (!$cm = get_coursemodule_from_id('oublog', $id)) { - throw new moodle_exception('invalidcoursemodule'); - } - - if (!$course = $DB->get_record("course", array("id"=>$cm->course))) { - throw new moodle_exception('coursemisconf'); - } - - if (!$oublog = $DB->get_record("oublog", array("id"=>$cm->instance))) { - throw new moodle_exception('invalidcoursemodule'); - } - $oubloguser = (object) array('id' => null); - $oubloginstance = null; - $oubloginstanceid = null; - -} else if ($user) { - if (!$oubloguser = $DB->get_record('user', array('id'=>$user))) { - throw new moodle_exception('invaliduserid'); - } - if (!list($oublog, $oubloginstance) = oublog_get_personal_blog($oubloguser->id)) { - throw new moodle_exception('invalidcoursemodule'); - } - if (!$cm = get_coursemodule_from_instance('oublog', $oublog->id)) { - throw new moodle_exception('invalidcoursemodule'); - } - if (!$course = $DB->get_record("course", array("id"=>$oublog->course))) { - throw new moodle_exception('coursemisconf'); - } - $oubloginstanceid = $oubloginstance->id; -} else { - throw new moodle_exception('missingrequiredfield'); -} - -$context = context_module::instance($cm->id); -$childdata = oublog_get_blog_data_base_on_cmid_of_childblog($cmid, $oublog); -$childcm = null; -$childoublog = null; -$childcourse = null; -if (!empty($childdata)) { - $context = $childdata['context']; - $childcm = $childdata['cm']; - $childoublog = $childdata['ousharedblog']; - $childcourse = $childdata['course']; - oublog_check_view_permissions($childdata['ousharedblog'], $childdata['context'], $childdata['cm']); - -} else { - oublog_check_view_permissions($oublog, $context, $cm); -} -$correctindividual = isset($childoublog->individual) ? $childoublog->individual : $oublog->individual; -$correctglobal = isset($childoublog->global) ? $childoublog->global : $oublog->global; -$PAGE->set_context($context); - -$url = new moodle_url('/mod/oublog/search.php', array('id'=>$id, 'user'=>$user, 'query'=>$querytext)); -$PAGE->set_url($url); -$PAGE->set_cm($childcm ? $childcm : $cm); -$PAGE->set_title(format_string($childoublog ? $childoublog->name : $oublog->name)); - -if ($correctglobal) { - // Check this user is allowed to view the user's blog - $maxvisibility = isset($childoublog->maxvisibility) ? $childoublog->maxvisibility : $oublog->maxvisibility; - if ($maxvisibility != OUBLOG_VISIBILITY_PUBLIC && isset($oubloguser)) { - $usercontext = context_user::instance($oubloguser->id); - require_capability('mod/oublog:view', $usercontext); - } - $returnurl = $CFG->wwwroot . "/mod/oublog/search.php?user=$user&query=$querytext"; - $mreturnurl = new moodle_url('/mod/oublog/view.php', array('user'=>$user)); -} else { - $cmparam = $cmid ? '&cmid=' . $cmid : null; - $returnurl = $CFG->wwwroot . "/mod/oublog/search.php?id=$id&query=$querytext$cmparam"; - $mreturnurl = new moodle_url('/mod/oublog/view.php', array('id'=>$id)); -} - -// Set up groups -$currentgroup = oublog_get_activity_group($childcm ? $childcm : $cm, true); -$groupmode = oublog_get_activity_groupmode($childcm ? $childcm : $cm, $childcourse ? $childcourse : $course); -// Note I am not sure this check is necessary, maybe it is handled by -// oublog_get_activity_group? Or maybe more checks are needed? Not sure. -if ($currentgroup===0 && $groupmode==SEPARATEGROUPS) { - require_capability('moodle/site:accessallgroups', $context); -} - -if ($correctindividual) { - // Individual selector. - $individualdetails = oublog_individual_get_activity_details($cm, $returnurl, $childoublog ? $childoublog : $oublog, - $currentgroup, $context); -} - -// Print the header -$stroublog = get_string('modulename', 'oublog'); -$strblogsearch = get_string('searchthisblog', 'oublog', oublog_get_displayname($childoublog ? $childoublog :$oublog)); -$strblogssearch = get_string('searchblogs', 'oublog'); - - -if ($correctglobal) { - if (!is_null($oubloginstance)) { - $name = $oubloginstance->name; - $buttontext = oublog_get_search_form('user', $oubloguser->id, $strblogsearch, - $querytexthtml, false, $cmid); - } else { - $buttontext = oublog_get_search_form('id', $cm->id, $strblogssearch, - $querytexthtml, false, $cmid); - } - - if (isset($name)) { - $PAGE->navbar->add(fullname($oubloguser), new moodle_url('/user/view.php', array('id'=>$oubloguser->id))); - $PAGE->navbar->add(format_string($oubloginstance->name), $mreturnurl); - } else { - $PAGE->navbar->add(format_string($oublog->name), new moodle_url('/mod/oublog/allposts.php')); - } - -} else { - $name = !empty($childoublog->name) ? $childoublog->name : $oublog->name; - $buttontext = oublog_get_search_form('id', $cm->id, $strblogsearch, $querytexthtml, false, $cmid); -} - -$PAGE->navbar->add(get_string('searchfor', 'local_ousearch', $querytext)); -$PAGE->set_button($buttontext); - -echo $OUTPUT->header(); - -// Print Groups and individual drop-down menu. -echo html_writer::start_div('oublog-groups-individual-selectors'); - -// Print Groups -groups_print_activity_menu($childcm ? $childcm : $cm, $returnurl); - -if ($correctindividual && $individualdetails) { - echo $individualdetails->display; -} - -echo html_writer::end_div(); - -$modulecontext = $context; - -// FINALLY do the actual query -$query=new local_ousearch_search($querytext); -$query->set_coursemodule($cm); -if ($correctglobal && isset($oubloguser)) { - $query->set_user_id($oubloguser->id); -} else if ($correctindividual != OUBLOG_NO_INDIVIDUAL_BLOGS) { - if (!empty($individualdetails->activeindividual)) { - // Only get results for currently selected user. - $query->set_user_id($individualdetails->activeindividual, false); - } else if ($groupmode && $currentgroup) { - // All individual, get results for all users in current group. - $sepcontext = $correctindividual == OUBLOG_SEPARATE_INDIVIDUAL_BLOGS ? $context : 0; - $usersingroup = oublog_individual_get_all_users($course->id, $oublog->id, - $currentgroup, $sepcontext); - if ($usersingroup) { - $query->set_user_ids(array_keys($usersingroup), false); - } else { - // Stop groups with no members returning all results. - $query->set_user_ids(local_ousearch_search::NONE, false); - } - } -} - -if ($groupmode && $currentgroup && $correctindividual == OUBLOG_NO_INDIVIDUAL_BLOGS) { - $query->set_group_id($currentgroup); -} -$query->set_filter(function($result) use($modulecontext, $oublog, $childoublog, $cm, $childcm) { - global $USER; - return oublog_can_view_post($result->data, $USER, $modulecontext, $cm, $oublog, $childcm, $childoublog); -}); -$searchurl = 'search.php?' . (empty($id) ? 'user=' . $oubloguser->id : 'id='. $cm->id) . ($cmid) ? '&cmid=' . $cmid : ''; - -$foundsomething=$query->display_results($searchurl); -if ($cmid) { - // We should add cmid for search result if this is shared blog. - $foundsomething = oublog_add_cmid_to_tag_atrribute($cmid, $foundsomething, 'a', 'href', '&'); -} -echo $foundsomething; - -// Footer -echo $OUTPUT->footer(); diff --git a/tests/behat/sharedblog.feature b/tests/behat/sharedblog.feature index 4c34a70..2750944 100644 --- a/tests/behat/sharedblog.feature +++ b/tests/behat/sharedblog.feature @@ -420,37 +420,3 @@ Feature: Test shared data from Master blog on OUBlog And I follow "Master Blog" And I should see "Post 0 title 2" And I should see "Post 0 title" - - @javascript @_file_upload - Scenario: Searching in shared blog. - Given the following "activities" exist: - | activity | name | intro | course | individual | idsharedblog | idnumber | - | oublog | Child Blog | A blog get content from master | C2 | 2 | masterblog | childblog | - And I am on "Course 1" course homepage - And I follow "Child Blog" - Then I should see "Content Master Blog 1" - When I press "New blog post" - And I set the following fields to these values: - | Title | P1 | - | Message | P1 of student | - | Tags | blog,child | - And I press "Add post" - And I log out - # Shared blog in different course. - Given I log in as "student2" - And I am on "Course 2" course homepage - And I follow "Child Blog" - When I set the field "oublog_searchquery" to "P1 of student" - And I click on "#ousearch_searchbutton" "css_element" - And I should see "P1 of student" - And I should see "Child Blog" - And I should see "C2" - # I search again to make sure it still in share blog - When I set the field "oublog_searchquery" to "Content Master Blog 1" - And I click on "#ousearch_searchbutton" "css_element" - And I should see "C2" - And I should see "Content Master Blog 1" - And I should see "Child Blog" - And I click on "Content Master Blog 1" "link" - And I should see "C2" - And I should see "Content Master Blog 1" diff --git a/view.php b/view.php index a37f664..1b82c19 100644 --- a/view.php +++ b/view.php @@ -147,7 +147,6 @@ $strviews = get_string('views', 'oublog', oublog_get_displayname($oublog)); $strlinks = get_string('links', 'oublog'); $strfeeds = get_string('feeds', 'oublog'); -$strblogsearch = get_string('searchthisblog', 'oublog', oublog_get_displayname($oublog)); // Set-up groups. $groupmode = oublog_get_activity_groupmode($cm, $course); @@ -173,15 +172,11 @@ $returnurl = $CFG->wwwroot . '/mod/oublog/view.php?user='.$user; $name = $oubloginstance->name; - - $buttontext = oublog_get_search_form('user', $oubloguser->id, $strblogsearch); } else { $blogtype = 'course'; $returnurl = $CFG->wwwroot . '/mod/oublog/view.php?id='.$id; $name = $oublog->name; - - $buttontext = oublog_get_search_form('id', $cm->id, $strblogsearch); } if ($tag) { @@ -258,7 +253,6 @@ if (!$hideunusedblog) { // Generate extra navigation. $CFG->additionalhtmlhead .= oublog_get_meta_tags($oublog, $oubloginstance, $currentgroup, $cm); - $PAGE->set_button($buttontext); if ($offset > 0) { $a = new stdClass(); $a->from = ($offset + 1); @@ -282,18 +276,6 @@ if (!$hideunusedblog) { global $USER, $CFG; $links = ''; - // Search block. - if ($oublog->global && strtolower($CFG->theme) == 'osep') { - $buttontext = oublog_get_search_form('user', $oubloguser->id, $strblogsearch, '', true); - $bc = new block_contents(); - $bc->attributes['class'] = 'oublog-sideblock block'; - $bc->attributes['id'] = 'oublog_info_block_search'; - $bc->title = format_string(get_string('searchblogs', 'mod_oublog')); - $bc->content = $buttontext; - if (!empty($bc->content)) { - $PAGE->blocks->add_fake_block($bc, BLOCK_POS_RIGHT); - } - } if ($oublog->global) { $title = $oubloginstance->name; diff --git a/viewpost.php b/viewpost.php index 705b02c..dfb9181 100644 --- a/viewpost.php +++ b/viewpost.php @@ -136,7 +136,6 @@ } // Print the header. -$strblogsearch = get_string('searchthisblog', 'oublog', oublog_get_displayname($childoublog ? $childoublog : $oublog)); if ($oublog->global) { $blogtype = 'personal'; $returnurl = 'view.php?user=' . $oubloginstance->userid; @@ -152,13 +151,11 @@ array('user' => $oubloginstance->userid))); $url = new moodle_url("$CFG->wwwroot/course/mod.php", array('update' => $cm->id, 'return' => true, 'sesskey' => sesskey())); - $buttontext = oublog_get_search_form('user', $oubloguser->id, $strblogsearch); } else { $blogtype = 'course'; $returnurl = $cmid ? 'view.php?id='.$cmid : 'view.php?id='.$cm->id; $blogname = $childoublog ? $childoublog->name : $oublog->name; $url = new moodle_url("$CFG->wwwroot/course/mod.php", array('update' => $cm->id, 'return' => true, 'sesskey' => sesskey())); - $buttontext = oublog_get_search_form('id', $cm->id, $strblogsearch); } // Log view post event. @@ -179,7 +176,6 @@ } $PAGE->set_title(format_string($post->title)); $PAGE->set_heading(format_string($childcourse ? $childcourse->fullname : $course->fullname)); -$PAGE->set_button($buttontext); oublog_get_post_extranav($post, false); if ($childdata) { $oublogoutput->pre_display($childcm, $childoublog, 'viewpost');