diff --git a/amd/build/export.min.js b/amd/build/export.min.js index 66e51e5..1982409 100644 --- a/amd/build/export.min.js +++ b/amd/build/export.min.js @@ -1 +1,10 @@ -define(["jquery"],function(a){var b;return b={CSS:{SELECTALLPOST:'button[name="oublog-export-select-all"]',SELECTNONE:'button[name="oublog-export-select-none"]',CHECKBOXS:'.oublog-posts-table input[type="checkbox"]',EXPORTSELECTED:'button[name="oublog-export-selected"]',EXPORTTYPE:"#oublog-export-type"},mconfig:null,contentIds:[],init:function(c){b.mconfig=c,null!==sessionStorage.getItem("contentIds")&&b.mconfig.newsession!==!0&&(b.contentIds=JSON.parse(sessionStorage.getItem("contentIds"))),a(b.CSS.SELECTALLPOST).on("click",b.selectAll.bind(b)),a(b.CSS.SELECTNONE).on("click",b.selectNone.bind(b)),a(b.CSS.CHECKBOXS).on("click",b.selectPost.bind(b)),a(b.CSS.EXPORTSELECTED).on("click",b.exportSelected.bind(b)),b.initSelectedPost(),b.initButtonState()},selectAll:function(){a(b.CSS.CHECKBOXS).prop("checked",!0),a(b.CSS.SELECTALLPOST).prop("disabled",!0),a(b.CSS.SELECTALLPOST).blur(),a(b.CSS.SELECTNONE).prop("disabled",!1),a(b.CSS.EXPORTSELECTED).prop("disabled",!1),a(b.CSS.CHECKBOXS).each(function(){a(this).prop("checked")&&b.addPost(a(this).val())})},selectNone:function(){a(b.CSS.CHECKBOXS).prop("checked",!1),a(b.CSS.SELECTALLPOST).prop("disabled",!1),a(b.CSS.SELECTNONE).prop("disabled",!0),a(b.CSS.SELECTNONE).blur(),a(b.CSS.EXPORTSELECTED).prop("disabled",!0),a(b.CSS.CHECKBOXS).each(function(){a(this).prop("checked")||b.removePost(a(this).val())})},selectPost:function(a){1==a.target.checked?b.addPost(a.target.value):b.removePost(a.target.value),b.initButtonState()},initSelectedPost:function(){a(b.CSS.CHECKBOXS).each(function(){var c=b.contentIds.indexOf(a(this).val());c!==-1&&a(this).prop("checked",!0)})},exportSelected:function(){if(b.contentIds.length>0){var c=a(b.CSS.EXPORTSELECTED).data("url"),d=a(b.CSS.EXPORTTYPE).val();c=this.updateQueryStringParameter(c,"instance",String(d)),c=this.updateQueryStringParameter(c,"ca_postids",b.contentIds.join("|")),sessionStorage.removeItem("contentIds"),b.contentIds=[],window.location.href=c}},removePost:function(a){var c=b.contentIds.indexOf(a);c!==-1&&(b.contentIds.splice(c,1),sessionStorage.setItem("contentIds",JSON.stringify(b.contentIds)))},addPost:function(a){var c=b.contentIds.indexOf(a);c===-1&&(b.contentIds.push(a),sessionStorage.setItem("contentIds",JSON.stringify(b.contentIds)))},initButtonState:function(){var c=0,d=0;a(b.CSS.CHECKBOXS).each(function(){0==a(this).prop("checked")&&c++,d++}),a(b.CSS.SELECTALLPOST).prop("disabled",0==c),a(b.CSS.SELECTNONE).prop("disabled",c==d),a(b.CSS.EXPORTSELECTED).prop("disabled",0==b.contentIds.length)},updateQueryStringParameter:function(a,b,c){var d=new RegExp("([?&])"+b+"=.*?(&|$)","i"),e=a.indexOf("?")!==-1?"&":"?";return a.match(d)?a.replace(d,"$1"+b+"="+c+"$2"):a+e+b+"="+c}}}); +/** + * JavaScript to manage export feature. + * + * @package mod_oublog + * @copyright 2018 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +define("mod_oublog/export",["jquery"],(function($){var t;return t={CSS:{SELECTALLPOST:'button[name="oublog-export-select-all"]',SELECTNONE:'button[name="oublog-export-select-none"]',CHECKBOXS:'.oublog-posts-table input[type="checkbox"]',EXPORTSELECTED:'button[name="oublog-export-selected"]',EXPORTTYPE:"#oublog-export-type"},mconfig:null,contentIds:[],init:function(options){t.mconfig=options,null!==sessionStorage.getItem("contentIds")&&!0!==t.mconfig.newsession&&(t.contentIds=JSON.parse(sessionStorage.getItem("contentIds"))),$(t.CSS.SELECTALLPOST).on("click",t.selectAll.bind(t)),$(t.CSS.SELECTNONE).on("click",t.selectNone.bind(t)),$(t.CSS.CHECKBOXS).on("click",t.selectPost.bind(t)),$(t.CSS.EXPORTSELECTED).on("click",t.exportSelected.bind(t)),t.initSelectedPost(),t.initButtonState()},selectAll:function(){$(t.CSS.CHECKBOXS).prop("checked",!0),$(t.CSS.SELECTALLPOST).prop("disabled",!0),$(t.CSS.SELECTALLPOST).blur(),$(t.CSS.SELECTNONE).prop("disabled",!1),$(t.CSS.EXPORTSELECTED).prop("disabled",!1),$(t.CSS.CHECKBOXS).each((function(){$(this).prop("checked")&&t.addPost($(this).val())}))},selectNone:function(){$(t.CSS.CHECKBOXS).prop("checked",!1),$(t.CSS.SELECTALLPOST).prop("disabled",!1),$(t.CSS.SELECTNONE).prop("disabled",!0),$(t.CSS.SELECTNONE).blur(),$(t.CSS.EXPORTSELECTED).prop("disabled",!0),$(t.CSS.CHECKBOXS).each((function(){$(this).prop("checked")||t.removePost($(this).val())}))},selectPost:function(event){1==event.target.checked?t.addPost(event.target.value):t.removePost(event.target.value),t.initButtonState()},initSelectedPost:function(){$(t.CSS.CHECKBOXS).each((function(){-1!==t.contentIds.indexOf($(this).val())&&$(this).prop("checked",!0)}))},exportSelected:function(){if(t.contentIds.length>0){var exportUrl=$(t.CSS.EXPORTSELECTED).data("url"),exportType=$(t.CSS.EXPORTTYPE).val();exportUrl=this.updateQueryStringParameter(exportUrl,"instance",String(exportType)),exportUrl=this.updateQueryStringParameter(exportUrl,"ca_postids",t.contentIds.join("|")),sessionStorage.removeItem("contentIds"),t.contentIds=[],window.location.href=exportUrl}},removePost:function(postId){var index=t.contentIds.indexOf(postId);-1!==index&&(t.contentIds.splice(index,1),sessionStorage.setItem("contentIds",JSON.stringify(t.contentIds)))},addPost:function(postId){-1===t.contentIds.indexOf(postId)&&(t.contentIds.push(postId),sessionStorage.setItem("contentIds",JSON.stringify(t.contentIds)))},initButtonState:function(){var uncheckBoxes=0,boxquantity=0;$(t.CSS.CHECKBOXS).each((function(){0==$(this).prop("checked")&&uncheckBoxes++,boxquantity++})),$(t.CSS.SELECTALLPOST).prop("disabled",0==uncheckBoxes),$(t.CSS.SELECTNONE).prop("disabled",uncheckBoxes==boxquantity),$(t.CSS.EXPORTSELECTED).prop("disabled",0==t.contentIds.length)},updateQueryStringParameter:function(uri,key,value){var re=new RegExp("([?&])"+key+"=.*?(&|$)","i"),separator=-1!==uri.indexOf("?")?"&":"?";return uri.match(re)?uri.replace(re,"$1"+key+"="+value+"$2"):uri+separator+key+"="+value}}})); + +//# sourceMappingURL=export.min.js.map \ No newline at end of file diff --git a/amd/build/export.min.js.map b/amd/build/export.min.js.map new file mode 100644 index 0000000..e53b270 --- /dev/null +++ b/amd/build/export.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"export.min.js","sources":["../src/export.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * JavaScript to manage export feature.\n *\n * @package mod_oublog\n * @copyright 2018 The Open University\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * @module mod_oublog/export\n */\n\ndefine([\n 'jquery'\n], function($) {\n var t;\n t = {\n /**\n * List out all of css selector used in export module.\n */\n CSS: {\n SELECTALLPOST: 'button[name=\"oublog-export-select-all\"]',\n SELECTNONE: 'button[name=\"oublog-export-select-none\"]',\n CHECKBOXS: '.oublog-posts-table input[type=\"checkbox\"]',\n EXPORTSELECTED: 'button[name=\"oublog-export-selected\"]',\n EXPORTTYPE: '#oublog-export-type'\n },\n\n /**\n * Module config. Passed from server side.\n */\n mconfig: null,\n\n /**\n * Selected post id for export.\n */\n contentIds: [],\n\n /**\n * Initialize module.\n *\n * @param {JSON} options The settings for module\n * @method init\n */\n init: function(options) {\n t.mconfig = options;\n if (sessionStorage.getItem(\"contentIds\") !== null && t.mconfig.newsession !== true) {\n t.contentIds = JSON.parse(sessionStorage.getItem(\"contentIds\"));\n }\n $(t.CSS.SELECTALLPOST).on('click', t.selectAll.bind(t));\n $(t.CSS.SELECTNONE).on('click', t.selectNone.bind(t));\n $(t.CSS.CHECKBOXS).on('click', t.selectPost.bind(t));\n $(t.CSS.EXPORTSELECTED).on('click', t.exportSelected.bind(t));\n t.initSelectedPost();\n t.initButtonState();\n },\n\n /**\n * Select all posts\n * @method selectAll\n */\n selectAll: function() {\n $(t.CSS.CHECKBOXS).prop('checked', true);\n $(t.CSS.SELECTALLPOST).prop(\"disabled\", true);\n $(t.CSS.SELECTALLPOST).blur();\n $(t.CSS.SELECTNONE).prop('disabled', false);\n $(t.CSS.EXPORTSELECTED).prop('disabled', false);\n $(t.CSS.CHECKBOXS).each(function() {\n if ($(this).prop('checked')) {\n t.addPost($(this).val());\n }\n });\n },\n\n /**\n * Remove all selected posts\n * @method selectNone\n */\n selectNone: function() {\n $(t.CSS.CHECKBOXS).prop('checked', false);\n $(t.CSS.SELECTALLPOST).prop(\"disabled\", false);\n $(t.CSS.SELECTNONE).prop(\"disabled\", true);\n $(t.CSS.SELECTNONE).blur();\n $(t.CSS.EXPORTSELECTED).prop('disabled', true);\n $(t.CSS.CHECKBOXS).each(function() {\n if (!$(this).prop('checked')) {\n t.removePost($(this).val());\n }\n });\n },\n\n /**\n * Select a post\n * @method selectPost\n */\n selectPost: function(event) {\n if (event.target.checked == true) {\n t.addPost(event.target.value);\n } else {\n t.removePost(event.target.value);\n }\n t.initButtonState();\n },\n\n /**\n * Set checkbox state to checked if user already selected it.\n * @method selectNone\n */\n initSelectedPost: function() {\n $(t.CSS.CHECKBOXS).each(function() {\n var index = t.contentIds.indexOf($(this).val());\n if (index !== -1) {\n $(this).prop('checked', true);\n }\n });\n },\n\n /**\n * Export selected posts\n * @method exportSelected\n */\n exportSelected: function() {\n if (t.contentIds.length > 0) {\n var exportUrl = $(t.CSS.EXPORTSELECTED).data(\"url\");\n var exportType = $(t.CSS.EXPORTTYPE).val();\n exportUrl = this.updateQueryStringParameter(exportUrl, 'instance', String(exportType));\n exportUrl = this.updateQueryStringParameter(exportUrl, 'ca_postids', t.contentIds.join('|'));\n sessionStorage.removeItem('contentIds');\n t.contentIds = [];\n window.location.href = exportUrl;\n }\n },\n\n /**\n * Remove post from sessionStorage and contentIds\n * @method removePost\n */\n removePost: function(postId) {\n var index = t.contentIds.indexOf(postId);\n if (index !== -1) {\n t.contentIds.splice(index, 1);\n sessionStorage.setItem(\"contentIds\", JSON.stringify(t.contentIds));\n }\n },\n\n /**\n * Add post from sessionStorage and contentIds\n * @method addPost\n */\n addPost: function(postId) {\n var index = t.contentIds.indexOf(postId);\n if (index === -1) {\n t.contentIds.push(postId);\n sessionStorage.setItem(\"contentIds\", JSON.stringify(t.contentIds));\n }\n },\n\n /**\n * Init the state of all buttons.\n * @method initButtonState\n */\n initButtonState: function() {\n var uncheckBoxes = 0;\n var boxquantity = 0;\n $(t.CSS.CHECKBOXS).each(function() {\n if ($(this).prop('checked') == false) {\n uncheckBoxes++;\n }\n boxquantity++;\n });\n $(t.CSS.SELECTALLPOST).prop('disabled', uncheckBoxes == 0);\n $(t.CSS.SELECTNONE).prop('disabled', uncheckBoxes == boxquantity);\n $(t.CSS.EXPORTSELECTED).prop('disabled', t.contentIds.length == 0);\n },\n\n /**\n * Update or add new param to uri.\n *\n * @method updateQueryStringParameter\n * @param {String} uri\n * @param {String} key\n * @param {String} value\n * @returns {string|*}\n */\n updateQueryStringParameter: function(uri, key, value) {\n var re = new RegExp(\"([?&])\" + key + \"=.*?(&|$)\", \"i\"),\n separator = uri.indexOf('?') !== -1 ? \"&\" : \"?\";\n return uri.match(re) ? uri.replace(re, '$1' + key + \"=\" + value + '$2') :\n uri + separator + key + \"=\" + value;\n }\n };\n return t;\n});\n"],"names":["define","$","t","CSS","SELECTALLPOST","SELECTNONE","CHECKBOXS","EXPORTSELECTED","EXPORTTYPE","mconfig","contentIds","init","options","sessionStorage","getItem","newsession","JSON","parse","on","selectAll","bind","selectNone","selectPost","exportSelected","initSelectedPost","initButtonState","prop","blur","each","this","addPost","val","removePost","event","target","checked","value","indexOf","length","exportUrl","data","exportType","updateQueryStringParameter","String","join","removeItem","window","location","href","postId","index","splice","setItem","stringify","push","uncheckBoxes","boxquantity","uri","key","re","RegExp","separator","match","replace"],"mappings":"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"} \ No newline at end of file diff --git a/locallib.php b/locallib.php index 8e07ca8..fb4b1c2 100644 --- a/locallib.php +++ b/locallib.php @@ -953,7 +953,7 @@ function oublog_clarify_tags($tags) { } foreach ($tags as $idx => $tag) { - $tag = core_text::strtolower(trim($tag)); + $tag = trim($tag); if (empty($tag)) { unset($tags[$idx]); continue; @@ -3398,11 +3398,12 @@ function oublog_can_grade($course, $oublog, $cm, $groupid=0) { * @param object $masterblog master oublog object. * @param object $cmmaster course-module object of master blog. * @param object $coursemaster course object of master blog. + * @param bool $showuseridentityfields show user identity fields. * @return array user participation */ function oublog_get_participation($oublog, $context, $groupid = 0, $cm, $course, $start = null, $end = null, $sort = 'u.firstname,u.lastname', $masterblog = null, $cmmaster = null, - $coursemaster = null) { + $coursemaster = null, $showuseridentityfields = false) { global $DB; // get user objects @@ -3417,6 +3418,11 @@ function oublog_get_participation($oublog, $context, $groupid = 0, $cm, if (empty($users)) { return array(); } + + if ($showuseridentityfields) { + oublog_load_user_identity_data($context, $users); + } + if ($oublog->individual > 0) { $groupid = 0; } @@ -3508,6 +3514,59 @@ function oublog_get_participation($oublog, $context, $groupid = 0, $cm, return $users; } +/** + * Loads the identity fields data for each user. + * + * @param object $context current context + * @param array $users + * @throws coding_exception + * @throws dml_exception + */ +function oublog_load_user_identity_data($context, $users) { + global $DB; + + if (empty($users)) { + return; + } + + // Get user identity fields. + $extrafields = \core_user\fields::get_identity_fields($context); + if (empty($extrafields)) { + return; + } + + $api = \core_user\fields::for_identity($context); + [ + 'selects' => $selects, + 'joins' => $joins, + 'params' => $params + ] = (array) $api->get_sql('u', true); + + $userids = array_map(function($user) { + return $user->id; + }, $users); + + list($insql, $inparams) = $DB->get_in_or_equal($userids, SQL_PARAMS_NAMED); + $params = array_merge($params, $inparams); + + // Get fields data for users. + $sql = "SELECT u.id $selects + FROM {user} u $joins + WHERE u.id $insql "; + $rows = $DB->get_records_sql($sql, $params); + + // Set fields data for users. + foreach ($rows as $row) { + foreach ($users as $user) { + if ($user->id == $row->id) { + foreach ($extrafields as $field) { + $user->$field = $row->$field; + } + } + } + } +} + /** * Returns user participation to view in userparticipation.php * diff --git a/mod_form.php b/mod_form.php index 252f4ad..833638e 100644 --- a/mod_form.php +++ b/mod_form.php @@ -277,7 +277,7 @@ public function get_data() { $data->introonpost = 0; } if (!empty($data->tagslist)) { - $data->tagslist = core_text::strtolower(trim($data->tagslist)); + $data->tagslist = trim($data->tagslist); } if (empty($data->restricttags)) { $data->restricttags = 0; diff --git a/participation.php b/participation.php index 6201f95..a387f5d 100644 --- a/participation.php +++ b/participation.php @@ -128,7 +128,7 @@ } $participation = oublog_get_participation($oublog, $context, $groupid, $cm, $course, $start, $end, - 'u.firstname,u.lastname', $masterblog, $cmmaster, $coursemaster); + 'u.firstname,u.lastname', $masterblog, $cmmaster, $coursemaster, true); $PAGE->navbar->add(get_string('userparticipation', 'oublog')); $PAGE->set_title(format_string($oublog->name)); $PAGE->set_heading(format_string($oublog->name)); diff --git a/participation_table.php b/participation_table.php index e62ce86..bd3b598 100644 --- a/participation_table.php +++ b/participation_table.php @@ -63,8 +63,8 @@ public function setup($download = '') { // extra headers for export only if (!empty($download)) { $this->extraheaders = array( - format_string($this->course->shortname, true), - format_string($this->oublog->name, true), + format_string($this->course->shortname, true), + format_string($this->oublog->name, true), ); if (!empty($this->groupname)) { $this->extraheaders[] = $this->groupname; @@ -73,18 +73,26 @@ public function setup($download = '') { // Define table columns $columns = array( - 'picture', - 'fullname', - 'posts', - 'comments' + 'picture', + 'fullname', + 'posts', + 'comments' ); $headers = array( - '', - get_string('user'), - get_string('posts', 'oublog'), - get_string('comments', 'oublog'), + '', + get_string('user'), + get_string('posts', 'oublog'), + get_string('comments', 'oublog'), ); + // Add user identity fields. + $context = context_module::instance($this->cm->id); + $extrafields = \core_user\fields::get_identity_fields($context); + foreach ($extrafields as $field) { + $columns[] = $field; + $headers[] = \core_user\fields::get_display_name($field); + } + // unset picture column + headers if download if (!empty($download)) { unset($columns[0]); @@ -99,11 +107,15 @@ public function setup($download = '') { $this->define_columns($columns); $this->define_headers($headers); $this->define_baseurl($CFG->wwwroot . '/mod/oublog/participation.php?id=' . - $this->cm->id . '&group=' . $this->groupid); + $this->cm->id . '&group=' . $this->groupid); $this->column_class('fullname', 'fullname'); $this->column_class('posts', 'posts'); $this->column_class('comments', 'comments'); + // Add user identity fields. + foreach ($extrafields as $field) { + $this->column_class($field, $field); + } $this->set_attribute('cellspacing', '0'); $this->set_attribute('id', 'participation'); @@ -129,13 +141,17 @@ public function get_download_menu() { * This function is not part of the public api. * You don't normally need to call this. It is called automatically when * needed when you start adding data to the table. - * */ public function start_output() { $this->started_output = true; if ($this->exportclass !== null) { $this->exportclass->start_table($this->sheettitle); - $this->exportclass->output_headers($this->extraheaders); + if (!empty($this->download) && in_array($this->download, ['ods', 'excel'])) { + // Using add_data to avoid a duplicate sheet. + $this->exportclass->add_data($this->extraheaders); + } else { + $this->exportclass->output_headers($this->extraheaders); + } $this->exportclass->output_headers($this->headers); } else { $this->start_html(); diff --git a/renderer.php b/renderer.php index 958efc5..17f6a1b 100644 --- a/renderer.php +++ b/renderer.php @@ -590,6 +590,8 @@ public function render_participation_list($cm, $course, $oublog, $groupid, $endposition = count($participation); $offset = 0; } + + $extrafields = \core_user\fields::get_identity_fields($context); $currentposition = 0; foreach ($participation as $user) { if ($currentposition == $offset && $offset < $endposition) { @@ -662,6 +664,13 @@ public function render_participation_list($cm, $course, $oublog, $groupid, } else { $row = array($fullname, $posts, $comments); } + + // Add identity fields data for user. + $col = count($row); + foreach ($extrafields as $field) { + $row[$col++] = isset($user->$field) ? $user->$field : ''; + } + if (isset($gradeitem)) { $row[] = $gradeitem; } diff --git a/tests/behat/basic.feature b/tests/behat/basic.feature index bb249fd..0eb48b3 100644 --- a/tests/behat/basic.feature +++ b/tests/behat/basic.feature @@ -6,28 +6,28 @@ Feature: Test Post and Comment on OUBlog entry Background: Given the following "users" exist: - | username | firstname | lastname | email | - | teacher1 | Teacher | 1 | teacher1@asd.com | - | student1 | Student | 1 | student1@asd.com | - | student2 | Student | 2 | student2@asd.com | - | student3 | Student | 3 | student3@asd.com | + | username | firstname | lastname | email | + | teacher1 | Teacher | 1 | teacher1@asd.com | + | student1 | Student | 1 | student1@asd.com | + | student2 | Student | 2 | student2@asd.com | + | student3 | Student | 3 | student3@asd.com | And the following "courses" exist: | fullname | shortname | category | - | Course 1 | C1 | 0 | + | Course 1 | C1 | 0 | And the following "course enrolments" exist: - | user | course | role | - | teacher1 | C1 | editingteacher | - | student1 | C1 | student | - | student2 | C1 | student | - | student3 | C1 | student | + | user | course | role | + | teacher1 | C1 | editingteacher | + | student1 | C1 | student | + | student2 | C1 | student | + | student3 | C1 | student | And the following "groups" exist: | name | course | idnumber | - | G1 | C1 | G1 | - | G2 | C1 | G2 | + | G1 | C1 | G1 | + | G2 | C1 | G2 | And the following "group members" exist: - | user | group | - | student1 | G1 | - | student2 | G2 | + | user | group | + | student1 | G1 | + | student2 | G2 | And the following "activities" exist: | activity | name | intro | course | idnumber | restricttags | tagslist | | oublog | Test oublog basics | Test oublog basics intro text | C1 | oublog1 | | | @@ -54,7 +54,7 @@ Feature: Test Post and Comment on OUBlog entry Given I follow "Test oublog basics" When I press "New blog post" And I set the following fields to these values: - | Title | P0 | + | Title | P0 | | Message | P0 | And I press "Add post" And I am on "Course 1" course homepage @@ -63,28 +63,28 @@ Feature: Test Post and Comment on OUBlog entry And I press "Go" When I press "New blog post" And I set the following fields to these values: - | Title | P2 | + | Title | P2 | | Message | P2 | And I press "Add post" Given I set the field "Separate groups" to "G2" And I press "Go" When I press "New blog post" And I set the following fields to these values: - | Title | P3 | + | Title | P3 | | Message | P3 | And I press "Add post" And I am on "Course 1" course homepage Given I follow "B.SI" When I press "New blog post" And I set the following fields to these values: - | Title | P10 | + | Title | P10 | | Message | P10 | And I press "Add post" And I am on "Course 1" course homepage Given I follow "B.VI" When I press "New blog post" And I set the following fields to these values: - | Title | P13 | + | Title | P13 | | Message | P13 | And I press "Add post" Then I log out @@ -95,63 +95,63 @@ Feature: Test Post and Comment on OUBlog entry Given I follow "Test oublog basics" When I press "New blog post" And I set the following fields to these values: - | Title | P1 | + | Title | P1 | | Message | P1 | And I press "Add post" And I am on "Course 1" course homepage Given I follow "B.SG" When I press "New blog post" And I set the following fields to these values: - | Title | P4 | + | Title | P4 | | Message | P4 | And I press "Add post" And I am on "Course 1" course homepage Given I follow "B.VG" When I press "New blog post" And I set the following fields to these values: - | Title | P6 | + | Title | P6 | | Message | P6 | And I press "Add post" And I am on "Course 1" course homepage Given I follow "B.SI" When I press "New blog post" And I set the following fields to these values: - | Title | P8 | + | Title | P8 | | Message | P8 | And I press "Add post" And I am on "Course 1" course homepage Given I follow "B.VI" When I press "New blog post" And I set the following fields to these values: - | Title | P11 | + | Title | P11 | | Message | P11 | And I press "Add post" And I am on "Course 1" course homepage Given I follow "B.SISG" When I press "New blog post" And I set the following fields to these values: - | Title | P15 | + | Title | P15 | | Message | P15 | And I press "Add post" And I am on "Course 1" course homepage Given I follow "B.SIVG" When I press "New blog post" And I set the following fields to these values: - | Title | P16 | + | Title | P16 | | Message | P16 | And I press "Add post" And I am on "Course 1" course homepage Given I follow "B.VISG" When I press "New blog post" And I set the following fields to these values: - | Title | P17 | + | Title | P17 | | Message | P17 | And I press "Add post" And I am on "Course 1" course homepage Given I follow "B.VIVG" When I press "New blog post" And I set the following fields to these values: - | Title | P18 | + | Title | P18 | | Message | P18 | And I press "Add post" And I am on "Course 1" course homepage @@ -163,56 +163,56 @@ Feature: Test Post and Comment on OUBlog entry Given I follow "B.SG" When I press "New blog post" And I set the following fields to these values: - | Title | P5 | + | Title | P5 | | Message | P5 | And I press "Add post" And I am on "Course 1" course homepage Given I follow "B.VG" When I press "New blog post" And I set the following fields to these values: - | Title | P7 | + | Title | P7 | | Message | P7 | And I press "Add post" And I am on "Course 1" course homepage Given I follow "B.SI" When I press "New blog post" And I set the following fields to these values: - | Title | P9 | + | Title | P9 | | Message | P9 | And I press "Add post" And I am on "Course 1" course homepage Given I follow "B.VI" When I press "New blog post" And I set the following fields to these values: - | Title | P12 | + | Title | P12 | | Message | P12 | And I press "Add post" And I am on "Course 1" course homepage Given I follow "B.SISG" When I press "New blog post" And I set the following fields to these values: - | Title | P19 | + | Title | P19 | | Message | P19 | And I press "Add post" And I am on "Course 1" course homepage Given I follow "B.SIVG" When I press "New blog post" And I set the following fields to these values: - | Title | P20 | + | Title | P20 | | Message | P20 | And I press "Add post" And I am on "Course 1" course homepage Given I follow "B.VISG" When I press "New blog post" And I set the following fields to these values: - | Title | P21 | + | Title | P21 | | Message | P21 | And I press "Add post" And I am on "Course 1" course homepage Given I follow "B.VIVG" When I press "New blog post" And I set the following fields to these values: - | Title | P22 | + | Title | P22 | | Message | P22 | And I press "Add post" And I am on "Course 1" course homepage @@ -384,9 +384,9 @@ Feature: Test Post and Comment on OUBlog entry # Before the 'Set' tags restriction And I should not see "You may only enter the 'Set' tags:" And I set the following fields to these values: - | Title | SC02 OUBlog post01 from teacher1 | + | Title | SC02 OUBlog post01 from teacher1 | | Message | SC02 Teacher OUBlog post01 content | - | Tags | ctag3sc02 | + | Tags | ctag3sc02 | And I press "Add post" And I log out @@ -398,15 +398,15 @@ Feature: Test Post and Comment on OUBlog entry # Before the 'Set' tags restriction And I should not see "You may only enter the 'Set' tags:" And I set the following fields to these values: - | Title | SC02 OUBlog post01 from student | + | Title | SC02 OUBlog post01 from student | | Message | SC02 Student OUBlog post01 content | - | Tags | ctag3sc02, btag2sc02 | + | Tags | ctag3sc02, btag2sc02 | And I press "Add post" And I press "New blog post" And I set the following fields to these values: - | Title | SC02 OUBlog post02 from student | - | Message | SC02 Student OUBlog post02 content filtered by tag| - | Tags | atag1sc02, btag2sc02, ctag3sc02 | + | Title | SC02 OUBlog post02 from student | + | Message | SC02 Student OUBlog post02 content filtered by tag | + | Tags | atag1sc02, btag2sc02, ctag3sc02 | And I press "Add post" # Should see tags in default Alphabetical order. @@ -424,9 +424,9 @@ Feature: Test Post and Comment on OUBlog entry # Check post edit with attachment. Given I follow "Edit" And I set the following fields to these values: - | Title | SC02 OUBlog post02 from student edited post subject | + | Title | SC02 OUBlog post02 from student edited post subject | | Message | SC02 Student OUBlog post02 content filtered by tag edited post body | - | Tags | atag1sc02, btag2sc02, ctag3sc02, dtag3sc02 | + | Tags | atag1sc02, btag2sc02, ctag3sc02, dtag3sc02 | And I upload "lib/tests/fixtures/empty.txt" file to "Attachments" filemanager And I press "Save changes" And I wait to be redirected @@ -471,17 +471,17 @@ Feature: Test Post and Comment on OUBlog entry And I navigate to "Edit settings" in current page administration # Add the 'Set' tags restriction When I set the following fields to these values: - | Tags | ctag4sc02, btag5sc02, dogtag | - | Tag options | 1 | + | Tags | ctag4sc02, btag5sc02, dogtag | + | Tag options | 1 | And I press "Save and display" # Test only the predefined tags are allowed. And I press "New blog post" Then I should see "You may only enter the 'Set' tags:" And I set the following fields to these values: - | Title | SC02 OUBlog post02 from teacher1 | + | Title | SC02 OUBlog post02 from teacher1 | | Message | SC02 OUBlog post02 teacher content | - | Tags | ctag4sc02, btag5sc02, catsndogs | + | Tags | ctag4sc02, btag5sc02, catsndogs | And I press "Add post" # Warning tags are now restricted @@ -510,22 +510,22 @@ Feature: Test Post and Comment on OUBlog entry And I press "New blog post" Then "#fitem_id_visibility" "css_element" should not exist And I set the following fields to these values: - | Title | Post01 from teacher | + | Title | Post01 from teacher | | Message | OUBlog post01 content | And I press "Add post" # Check related links 'block'. Given I follow "Add link" And I set the following fields to these values: - | Title | Teachers Personal blog test | + | Title | Teachers Personal blog test | | Full Web address | http://127.0.0.1/mod/oublog/view.php?user=3 | When I press "id_submitbutton" Then "Teachers Personal blog test" "link" should exist And "#oublog-links form" "css_element" should not exist Given I follow "Add link" And I set the following fields to these values: - | Title | Teachers Personal blog link2 | - | Full Web address | http://www.open.ac.uk | + | Title | Teachers Personal blog link2 | + | Full Web address | http://www.open.ac.uk | When I press "id_submitbutton" Then "#oublog-links form" "css_element" should exist And "Personal blog link2" "link" should exist @@ -597,6 +597,66 @@ Feature: Test Post and Comment on OUBlog entry Then I should see "2 comments" And I log out + Scenario: Check user participation + # Post as student + Given I log in as "student1" + And I am on homepage + And I am on "Course 1" course homepage + When I follow "Test oublog basics" + And I press "New blog post" + And I set the following fields to these values: + | Title | Student1 blog1 | + | Message | Student1 message1 | + And I press "Add post" + And I should not see "Participation by user" + And I log out + # Post as teacher + Given I log in as "teacher1" + And I am on homepage + And I am on "Course 1" course homepage + When I follow "Test oublog basics" + And I press "New blog post" + And I set the following fields to these values: + | Title | Teacher1 blog1 | + | Message | Teacher1 message1 | + And I press "Add post" + And I press "New blog post" + And I set the following fields to these values: + | Title | Teacher1 blog2 | + | Message | Teacher1 message2 | + And I press "Add post" + And I should see "Participation by user" + # Go to participation page + Given I press "Participation by user" + Then I should see "Participation - All time" + # Columns + And I should see "User" in the "//th[@class='header c1 fullname']" "xpath_element" + And I should see "Posts" in the "//th[@class='header c2 posts']" "xpath_element" + And I should see "Comments" in the "//th[@class='header c3 comments']" "xpath_element" + And I should see "Email address" in the "//th[@class='header c4 email']" "xpath_element" + # Student 1 + And "//td[@id='mod-oublog-participation_r0_c1']/a[contains(text(), 'Student 1')]" "xpath_element" should exist + And "//td[@id='mod-oublog-participation_r0_c1']/*/a[contains(text(), 'Details')]" "xpath_element" should exist + And I should see "1" in the "#mod-oublog-participation_r0_c2" "css_element" + And I should see "0" in the "#mod-oublog-participation_r0_c3" "css_element" + And I should see "student1@asd.com" in the "#mod-oublog-participation_r0_c4" "css_element" + # Student 2 + And "//td[@id='mod-oublog-participation_r1_c1']/a[contains(text(), 'Student 2')]" "xpath_element" should exist + And I should see "0" in the "#mod-oublog-participation_r1_c2" "css_element" + And I should see "0" in the "#mod-oublog-participation_r1_c3" "css_element" + And I should see "student2@asd.com" in the "#mod-oublog-participation_r1_c4" "css_element" + # Student 3 + And "//td[@id='mod-oublog-participation_r2_c1']/a[contains(text(), 'Student 3')]" "xpath_element" should exist + And I should see "0" in the "#mod-oublog-participation_r2_c2" "css_element" + And I should see "0" in the "#mod-oublog-participation_r2_c3" "css_element" + And I should see "student3@asd.com" in the "#mod-oublog-participation_r2_c4" "css_element" + # Teacher 1 + And "//td[@id='mod-oublog-participation_r3_c1']/a[contains(text(), 'Teacher 1')]" "xpath_element" should exist + And "//td[@id='mod-oublog-participation_r3_c1']/*/a[contains(text(), 'Details')]" "xpath_element" should exist + And I should see "2" in the "#mod-oublog-participation_r3_c2" "css_element" + And I should see "0" in the "#mod-oublog-participation_r3_c3" "css_element" + And I should see "teacher1@asd.com" in the "#mod-oublog-participation_r3_c4" "css_element" + Scenario: Check back to main page link Given I log in as "teacher1" And I am on homepage @@ -604,7 +664,7 @@ Feature: Test Post and Comment on OUBlog entry When I follow "Test oublog basics" And I press "New blog post" And I set the following fields to these values: - | Title | Teacher1 blog | + | Title | Teacher1 blog | | Message | Teacher1 message | And I press "Add post" # Go to viewpost page and back to the main blog page @@ -647,7 +707,7 @@ Feature: Test Post and Comment on OUBlog entry And "#oublog_info_block" "css_element" should exist And I follow "Edit settings" When I set the following fields to these values: - | Intro | | + | Intro | | And I press "Save and display" And "#oublog_info_block" "css_element" should not exist @@ -677,9 +737,9 @@ Feature: Test Post and Comment on OUBlog entry Scenario: Check group level access when no groups Given I log in as "teacher1" And the following "activities" exist: - | activity | name | course | section | groupmode | - | oublog | B.SG | C1 | 1 | 1 | - | oublog | B.VG | C1 | 1 | 2 | + | activity | name | course | section | groupmode | + | oublog | B.SG | C1 | 1 | 1 | + | oublog | B.VG | C1 | 1 | 2 | And I am on homepage And I am on "Course 1" course homepage # Editing teacher adds posts to all the blogs. @@ -689,7 +749,7 @@ Feature: Test Post and Comment on OUBlog entry And I press "Go" When I press "New blog post" And I set the following fields to these values: - | Title | P1 | + | Title | P1 | | Message | P1 | And I press "Add post" Given I am on "Course 1" course homepage @@ -698,7 +758,7 @@ Feature: Test Post and Comment on OUBlog entry And I press "Go" When I press "New blog post" And I set the following fields to these values: - | Title | P2 | + | Title | P2 | | Message | P2 | And I press "Add post" Given I log out @@ -717,9 +777,9 @@ Feature: Test Post and Comment on OUBlog entry And I follow "Test oublog basics" And I press "New blog post" And I set the following fields to these values: - | Title | Teacher1 blog | - | Message | Teacher1 post | - | Tags | tag1 | + | Title | Teacher1 blog | + | Message | Teacher1 post | + | Tags | tag1 | And I press "Add post" And I press "New blog post" And I set the following fields to these values: @@ -782,9 +842,9 @@ Feature: Test Post and Comment on OUBlog entry And I follow "Test oublog completion" And I press "New blog post" And I set the following fields to these values: - | Title | Student1 blog | - | Message | Student1 post | - | Tags | tag1 | + | Title | Student1 blog | + | Message | Student1 post | + | Tags | tag1 | And I press "Add post" When I am on "Course 2" course homepage Then I should see "100%" diff --git a/tests/behat/importblog.feature b/tests/behat/importblog.feature index 2b8bc69..163ef82 100644 --- a/tests/behat/importblog.feature +++ b/tests/behat/importblog.feature @@ -78,8 +78,8 @@ Feature: Test import posts function for blog Then I should see "Post 0 message" Then I should see "Post 1 title" Then I should see "Post 1 message" - Then I should see "js, php, c1" - Then I should see "c#, java, c1" + Then I should see "JS, PHP, c1" + Then I should see "C#, Java, c1" Then I should see "2 comments" Then I should see "upload_users.csv" And I follow "2 comments" @@ -100,8 +100,8 @@ Feature: Test import posts function for blog Then I should see "Post 0 message" Then I should see "Post 1 title" Then I should see "Post 1 message" - Then I should see "js, php, c1" - Then I should see "c#, java, c1" + Then I should see "JS, PHP, c1" + Then I should see "C#, Java, c1" Then I should see "2 comments" Then I should see "upload_users.csv" And I follow "2 comments" diff --git a/tests/behat/personalblog.feature b/tests/behat/personalblog.feature index 3cac308..16fa53c 100644 --- a/tests/behat/personalblog.feature +++ b/tests/behat/personalblog.feature @@ -78,7 +78,7 @@ Feature: Test Post and Comment on Personal OUBlog And I set the following fields to these values: | Title | Personal OUBlog post01 WorldVis | | Message | Admin Persblog post01 content WorldVis | - | Tags | edap01 | + | Tags | edap01, Money, money | | Who can read this | Visible to anyone in the world | | Allow comments | Yes, from everybody (even if not logged in) | And I press "Save changes" @@ -86,6 +86,8 @@ Feature: Test Post and Comment on Personal OUBlog Then I should see "Personal OUBlog post01 WorldVis" And I should see "Admin Persblog post01 content WorldVis" And I should see "edap01" + And I should see "Money" + And I should see "money" And I should see "Total visits to this blog: 3" And I log out (in the OU theme) @@ -100,6 +102,8 @@ Feature: Test Post and Comment on Personal OUBlog Then I should see "Personal OUBlog post01 WorldVis" And I should see "Admin Persblog post01 content WorldVis" And I should see "edap01" + And I should see "Money" + And I should see "money" And I should see "Comments" in the ".oublog-commentstitle" "css_element" And I should see "$My own >nasty< \"string\"!" And I should see "Another $Nasty" @@ -335,7 +339,7 @@ Feature: Test Post and Comment on Personal OUBlog Then I should not see "Personal OUBlog post01 WorldVis" And I should see "Next" in the ".oublog-paging" "css_element" And I should not see "Previous" in the ".oublog-paging" "css_element" - Given I follow "taggy1" + Given I follow "Taggy1" Then I should see "Personal OUBlog post27" And I should not see "Personal OUBlog post26" And I should not see "Next" in the ".oublog-paging" "css_element" @@ -377,7 +381,7 @@ Feature: Test Post and Comment on Personal OUBlog And I press "Add post" Then I should see "SC02 Personal OUBlog post01" And I should see "SC02 Admin Persblog post01 content Private" - And I should see "sc02edap01" + And I should see "SC02edap01" And I should not see "Share this post" And I should not see "Tweet" And I should not see "Share" @@ -393,7 +397,7 @@ Feature: Test Post and Comment on Personal OUBlog And I press "Add post" Then I should see "SC02 Personal OUBlog post02" And I should see "SC02 Admin Persblog post02 content WorldVis" - And I should see "sc02edap02" + And I should see "SC02edap02" # Changed below to make more specific. And I should see "Share post" in the "div.oublog-post-share-title" "css_element" And I should see "Tweet" in the "div.share-button:nth-child(1)" "css_element" @@ -404,7 +408,7 @@ Feature: Test Post and Comment on Personal OUBlog And I wait to be redirected Then I should see "SC02 Personal OUBlog post02" And I should see "SC02 Admin Persblog post02 content WorldVis" - And I should see "sc02edap02" + And I should see "SC02edap02" And I should see "Share post" in the "div.oublog-post-share-title" "css_element" And I should see "Tweet" in the "div.share-button:nth-child(1)" "css_element" And "div.share-button:nth-child(2) div.fb-share-button" "css_element" should exist diff --git a/tests/locallib_test.php b/tests/locallib_test.php index 394b9c9..79eeb8d 100644 --- a/tests/locallib_test.php +++ b/tests/locallib_test.php @@ -1336,13 +1336,13 @@ public function test_oublog_tags() { $cm = get_coursemodule_from_id('oublog', $oublog->cmid); $post = $this->get_post_stub($oublog->id); - $post->tags = array('1', 'new', 'new', 'new2', 'a space'); + $post->tags = array('1', 'new', 'new', 'new2', 'a space', 'Money', 'money'); $postid = oublog_add_post($post, $cm, $oublog, $course); - $this->assertEquals(21, strlen(oublog_get_tags_csv($postid))); + $this->assertEquals(35, strlen(oublog_get_tags_csv($postid))); $tags = oublog_get_tags($oublog, 0, $cm, null, -1); - $this->assertCount(4, $tags); + $this->assertCount(6, $tags); foreach ($tags as $tag) { $this->assertEquals(1, $tag->count); diff --git a/tests/tool_datamasking_test.php b/tests/tool_datamasking_test.php index 9be3a3c..336dbb2 100644 --- a/tests/tool_datamasking_test.php +++ b/tests/tool_datamasking_test.php @@ -24,6 +24,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class tool_datamasking_test extends \advanced_testcase { + use \tool_datamasking\phpunit_clear_statics; /** * Tests actual behaviour of the masking applied in this plugin. diff --git a/yui/build/moodle-mod_oublog-savecheck/moodle-mod_oublog-savecheck-min.js b/yui/build/moodle-mod_oublog-savecheck/moodle-mod_oublog-savecheck-min.js index 0155074..2f514f9 100644 --- a/yui/build/moodle-mod_oublog-savecheck/moodle-mod_oublog-savecheck-min.js +++ b/yui/build/moodle-mod_oublog-savecheck/moodle-mod_oublog-savecheck-min.js @@ -1 +1 @@ -YUI.add("moodle-mod_oublog-savecheck",function(e,t){M.mod_oublog=M.mod_oublog||{},M.mod_oublog.savecheck={init:function(t){var n=e.all("#id_submitbutton");n.on("click",function(r){function i(){n.set("disabled",!0);var t=new M.core.alert({title:M.util.get_string("savefailtitle","oublog"),message:M.util.get_string("savefailnetwork","oublog"),render:!0,plugins:[e.Plugin.Drag],modal:!0});t.show(),r.preventDefault();var i=e.one("#id_cancel");i.on("click",function(t){var n=e.one(".region-content #mform1"),r=n.one("#fitem_id_message"),i=n.one("#fitem_id_attachments");r.remove(),i.remove(),n.set("method","get")})}function s(e,t){t.responseText!=="ok"&&i()}var o={method:"POST",data:"sesskey="+M.cfg.sesskey+"&contextid="+t,on:{success:s,failure:i},sync:!0,timeout:1e4};e.io("confirmloggedin.php",o)})}}},"@VERSION@",{requires:["base","node","io","panel","moodle-core-notification-alert"]}); +YUI.add("moodle-mod_oublog-savecheck",function(s,e){M.mod_oublog=M.mod_oublog||{},M.mod_oublog.savecheck={init:function(n){var i=s.all("#id_submitbutton");i.on("click",function(e){function t(){i.set("disabled",!0),new M.core.alert({title:M.util.get_string("savefailtitle","oublog"),message:M.util.get_string("savefailnetwork","oublog"),render:!0,plugins:[s.Plugin.Drag],modal:!0}).show(),e.preventDefault(),s.one("#id_cancel").on("click",function(e){var o=s.one(".region-content #mform1"),t=o.one("#fitem_id_message"),n=o.one("#fitem_id_attachments");t.remove(),n.remove(),o.set("method","get")})}var o={method:"POST",data:"sesskey="+M.cfg.sesskey+"&contextid="+n,on:{success:function(e,o){"ok"!==o.responseText&&t()},failure:t},sync:!0,timeout:1e4};s.io("confirmloggedin.php",o)})}}},"@VERSION@",{requires:["base","node","io","panel","moodle-core-notification-alert"]}); \ No newline at end of file diff --git a/yui/build/moodle-mod_oublog-tagselector/moodle-mod_oublog-tagselector-min.js b/yui/build/moodle-mod_oublog-tagselector/moodle-mod_oublog-tagselector-min.js index e0f9d0d..069f5ad 100644 --- a/yui/build/moodle-mod_oublog-tagselector/moodle-mod_oublog-tagselector-min.js +++ b/yui/build/moodle-mod_oublog-tagselector/moodle-mod_oublog-tagselector-min.js @@ -1 +1 @@ -YUI.add("moodle-mod_oublog-tagselector",function(e,t){M.mod_oublog=M.mod_oublog||{},M.mod_oublog.tagselector={init:function(t,n){var r=e.one("form #"+t);if(n&&typeof n=="object"){var i=[];for(var s in n)i.push(n[s]);n=i}r&&(r.plug(e.Plugin.AutoComplete,{minQueryLength:0,queryDelay:100,queryDelimiter:",",allowTrailingDelimiter:!0,source:n,width:"auto",scrollIntoView:!0,circular:!1,resultTextLocator:"tag",resultHighlighter:"startsWith",resultFilters:["startsWith",function(t,n){function u(e,t){return e.raw.tagt.raw.tag?1:0}var i="",s=r.get("value").lastIndexOf(",");s>0&&(i=r.get("value").substring(0,s).split(/\s*,\s*/)),i=e.Array.hash(i);var o=e.Array.filter(n,function(e){return!i.hasOwnProperty(e.text)});return o.sort(u)}],resultFormatter:function(t,n){return e.Array.map(n,function(e){var t='
'+e.highlighted+"";return e.raw.label&&(t+=' '+e.raw.label+""),t+=' '+M.util.get_string("numposts","oublog",e.raw.count)+""+"
",t})}}),r.on("focus",function(){r.ac.sendRequest("")}),r.ac.after("select",function(t){e.UA.chrome&&window.scrollBy(0,parseInt(r.getStyle("height"))+200),setTimeout(function(){r.ac.sendRequest(""),r.ac.show()},1)}))}}},"@VERSION@",{requires:["base","node","autocomplete","autocomplete-filters","autocomplete-highlighters"]}); +YUI.add("moodle-mod_oublog-tagselector",function(s,t){M.mod_oublog=M.mod_oublog||{},M.mod_oublog.tagselector={init:function(t,e){var r,o,a=s.one("form #"+t);if(e&&"object"==typeof e){for(o in r=[],e)r.push(e[o]);e=r}a&&(a.plug(s.Plugin.AutoComplete,{minQueryLength:0,queryDelay:100,queryDelimiter:",",allowTrailingDelimiter:!0,source:e,width:"auto",scrollIntoView:!0,circular:!1,resultTextLocator:"tag",resultHighlighter:"startsWith",resultFilters:["startsWith",function(t,e){var r="",o=a.get("value").lastIndexOf(",");return 0e.raw.tag?1:0})}],resultFormatter:function(t,e){return s.Array.map(e,function(t){var e='
'+t.highlighted+"";return t.raw.label&&(e+=' '+t.raw.label+""),e+=' '+M.util.get_string("numposts","oublog",t.raw.count)+"
"})}}),a.on("focus",function(){a.ac.sendRequest("")}),a.ac.after("select",function(t){s.UA.chrome&&window.scrollBy(0,parseInt(a.getStyle("height"))+200),setTimeout(function(){a.ac.sendRequest(""),a.ac.show()},1)}))}}},"@VERSION@",{requires:["base","node","autocomplete","autocomplete-filters","autocomplete-highlighters"]}); \ No newline at end of file