Commit 4bebfa0f authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge "Bug 1810990: blocktype: openbadgedisplayer displays an empty block for...

Merge "Bug 1810990: blocktype: openbadgedisplayer displays an empty block for testing purposes, otherwise real accounts would be needed to use this block     additonal: tidy up code, tags(static text in group pages) Change-Id: Id8de7afc590a79ba5755d3ecb30f861b2701755d"
parents f2230f20 8c8ac45f
......@@ -251,8 +251,8 @@ EOD;
$artefactid = get_field('artefact', 'id', 'title', $filename, 'parent', $parentid);
}
if (!$artefactid) {
$artefactid = TestingDataGenerator::create_artefact($filename, $ownertype, $ownerid, $mediatype, $parentid);
TestingDataGenerator::file_creation($artefactid, $filename, $ownertype, $ownerid);
$artefactid = self::create_artefact($filename, $ownertype, $ownerid, $mediatype, $parentid);
self::file_creation($artefactid, $filename, $ownertype, $ownerid);
}
return $artefactid;
}
......@@ -760,11 +760,20 @@ EOD;
else {
throw new SystemException("The blocktype {$record['type']} is not supported yet.");
}
// make new block
self::create_new_block_instance($blocktype, $view, $viewid, $title, self::$viewcolcounts, $configdata, $maxcols);
}
/**
* creates a new block instance
*
* @param string $blocktype
* @param View $view object of the current view
* @param int $viewid of the View
* @param string $title of the block instance to be created
* @param int $viewcolcounts the current count of 1,2,3 column to create next block instance
* @param array $configdata holding data for new block instance
* @param int $maxcols ~ 3
* @param View $otherview for situations such as navigation where a block is related to another view
*/
public static function create_new_block_instance($blocktype, $view, $viewid, $title, $viewcolcounts, $configdata, $maxcols, $otherview = null) {
safe_require('blocktype', $blocktype);
$bi = new BlockInstance(0,
......@@ -970,7 +979,7 @@ EOD;
* @param array $sortedfields holding each chunk of data between the ; in the behat data column
* @return array $configdata of key and values for db table
*/
public static function generate_configdata_externalfeed($sortedfields) {
public static function generate_configdata_externalfeed($sortedfields, $ownertype, $ownerid) {
$configdata = array();
$configdata['full'] = 1;
......@@ -986,6 +995,13 @@ EOD;
if ($key == 'count') {
$configdata[$key] = $value;
}
if ($key == 'tags') {
$tags = explode(',', $value);
foreach ($tags as $tag) {
$tag = trim(strtolower($tag));
$configdata['tags'][] = $tag;
}
}
}
return $configdata;
}
......@@ -996,12 +1012,20 @@ EOD;
* @return array $configdata of key and values for db table
*/
public static function generate_configdata_externalvideo($sortedfields) {
$configdata = array();
foreach ($sortedfields as $key => $value) {
if ($key == 'tags') {
$tags = explode(',', $value);
foreach ($tags as $tag) {
$tag = trim(strtolower($tag));
$configdata['tags'][] = $tag;
}
}
if ($key == 'source') {
$sourceinfo = PluginBlocktypeExternalvideo::process_url($value);
return $sourceinfo;
$configdata = PluginBlocktypeExternalvideo::process_url($value);
}
}
return $configdata;
}
/**
......@@ -1125,6 +1149,13 @@ EOD;
$configdata['height'] = $value;
}
}
if ($key == 'tags') {
$tags = explode(',', $value);
foreach ($tags as $tag) {
$tag = trim(strtolower($tag));
$configdata['tags'][] = $tag;
}
}
}
return $configdata;
}
......@@ -1187,12 +1218,12 @@ EOD;
if (!$artefactid = get_field('artefact', 'id', 'title', $filename, 'owner', $ownerid)) {
if ($ext == 'wmv' || $ext == 'webm' || $ext == 'mov'|| $ext == 'ogv' || $ext == 'mpeg' || $ext == 'mp4' || $ext == 'flv' || $ext == 'avi' || $ext == '3gp') {
$artefactid = TestingDataGenerator::create_artefact($filename, $ownertype, $ownerid, 'video');
TestingDataGenerator::file_creation($artefactid, $filename, $ownertype, $ownerid);
$artefactid = self::create_artefact($filename, $ownertype, $ownerid, 'video');
self::file_creation($artefactid, $filename, $ownertype, $ownerid);
}
if ($ext == 'mp3' || $ext == 'oga' || $ext == 'ogg') {
$artefactid = TestingDataGenerator::create_artefact($filename, $ownertype, $ownerid, 'audio');
TestingDataGenerator::file_creation($artefactid, $filename, $ownertype, $ownerid);
$artefactid = self::create_artefact($filename, $ownertype, $ownerid, 'audio');
self::file_creation($artefactid, $filename, $ownertype, $ownerid);
}
}
$configdata['artefactid'] = $artefactid;
......@@ -1255,6 +1286,15 @@ EOD;
return $configdata;
}
/**
* generate configdata for the bloctype: open badges
* @param array $fields holding each chunk of data between the ; in the behat data column
* @return array
*/
public static function generate_configdata_openbadgedisplayer($fields) {
return array('badgegroup' => 'null' );
}
/**
* generate configdata for the bloctype: peerassessment
* @param array $fields holding each chunk of data between the ; in the behat data column
......@@ -1507,6 +1547,13 @@ EOD;
if ($key == 'textinput') {
$configdata['text'] = $value;
}
if ($key == 'tags') {
$tags = explode(',', $value);
foreach ($tags as $tag) {
$tag = trim(strtolower($tag));
$configdata['tags'][] = $tag;
}
}
}
return $configdata;
}
......@@ -1666,7 +1713,7 @@ EOD;
if (!check_dir_exists($directory, true, true)) {
throw new SystemException("Unable to create folder $directory");
}
$result2 = copy($path, $directory . $artefactid);
copy($path, $directory . $artefactid);
}
}
if (!$artefactid) {
......
......@@ -109,16 +109,17 @@ Background:
And the following "pages" exist:
# Available fields: title*, description, ownertype*, ownername*, layout, tags
| title | description | ownertype | ownername |
| Page UserA | Page 01 | user | UserA |
| Page UserB | Page 01 | user | UserB |
| Page Grp1 | Page 01 | group | Group1 |
| Page One | test 01 | user | UserA |
| Page Two | test 01 | user | UserA |
| Page One A | UserA Page 1 | user | UserA |
| Page Two A | UserA Page 2 | user | UserA |
| Page Three A | UserA Page 3 | user | UserA |
| Page Four A | UserA Page 4 | user | UserA |
| Page One B | UserB Page 1 | user | UserB |
| Page One Grp | Group Page 1 | group | Group1 |
And the following "collections" exist:
# Available fields: title*, description, ownertype*, ownername*, pages
| title | ownertype | ownername | description | pages |
| collection one | user | UserA | desc of col |Page One,Page Two |
| collection one | user | UserA | desc of col |Page One A, Page Two A |
And the following "journals" exist:
......@@ -159,69 +160,95 @@ Background:
And the following "blocks" exist:
# Available fields: title*, type*, data*, page*, retractable*
# Page One A
| title | type | page |retractable | data |
| Text | text | Page UserA | yes | textinput=This is some text |
| Image JPG | image | Page UserA | no | attachment=Image1.jpg; width=100 |
| Image PNG | image | Page UserA | no | attachment=Image2.png |
| Files to download | filedownload | Page UserA | auto | attachments=mahara_about.pdf |
| Files to download | filedownload | Page UserA | no | attachments=mahara_about.pdf,Image2.png |
| External Feed - News | externalfeed | Page UserA | No | source=http://rss.nzherald.co.nz/rss/xml/nzhtsrsscid_000000698.xml;count=5 |
| External Feed - Food | externalfeed | Page UserA | no | source=http://www.thekitchenmaid.com/feed;count=3 |
| Social Media | socialprofile | Page UserA | no | sns=instagram,twitter,facebook,tumblr,pinterest,mysocialmedia |
| Image | image | Page Grp1 | no | attachment=Image3.png |
| Files to download | filedownload | Page Grp1 | no | attachments=mahara_about.pdf,Image2.png,testvid3.mp4,mahara.mp3 |
| External Video | externalvideo | Page Grp1 | no | source=https://youtu.be/yRxFm70nOrY |
| Navigation | navigation | Page Grp1 | no | collection=collection one;copytoall=yes |
| Social Media | socialprofile | Page UserB | no | sns=instagram,twitter,facebook,tumblr,pinterest,mysocialmedia |
| Gallery - style 1 | gallery | Page UserB | no | attachments=Image1.jpg,Image3.png,Image3.png,Image2.png,Image1.jpg;imagesel=2;showdesc=yes;width=75;imagestyle=1;photoframe=1 |
| Gallery - style 2 | gallery | Page UserB | yes | attachments=Image3.png,Image2.png,Image1.jpg,Image1.jpg;imagesel=2;showdesc=yes;width=75;imagestyle=2 |
| Gallery - style 3 | gallery | Page UserB | yes | attachments=Image3.png,Image2.png,Image3.png,Image1.jpg,Image1.jpg;imagesel=2;showdesc=no;imagestyle=3;photoframe=0|
| Folder | folder | Page UserB | no | dirname=myfolder;attachments=mahara_about.pdf,Image2.png,Image1.jpg,Image3.png,mahara.mp3 |
| Some HTML | html | Page UserB | yes | attachment=test_html.html |
| Profile Information | profileinfo | Page UserB | no | introtext =Mahara unicorn here! Nice to meet you :);profileicon=Image3.png |
| Résumé | entireresume | Page UserB | no | tags=mahara |
| Blog/Journal | blog | Page One | no | copytype=nocopy;count=5;journaltitle=journal1 |
| Blogpost/JournalEntry| blogpost | Page One | no | copytype=nocopy;journaltitle=journal1;entrytitle=Entry Two |
| Comments | comment | Page One | no | |
| Peer Assessment | peerassessment | Page One | auto | |
| Creative Commons | creativecommons| Page One | no | commercialuse=yes;license=3.0;allowmods=no |
| Navigation | navigation | Page One | no | collection=collection one;copytoall=yes |
| Plans | plans | Page One | no | plans=Plan One,Plan Two;tasksdisplaycount=10 |
| Internal Media: Video| internalmedia | Page One | no | attachment=testvid3.mp4 |
| Internal Media: Audio| internalmedia | Page One | no | attachment=mahara.mp3 |
| Recent journal entries| recentposts | Page One | no | journaltitle=journal1;maxposts=10 |
| Tagged journal entries| taggedposts | Page One | no | tags=cats; maxposts=5;showfullentries=yes;copytype=nocopy |
| Text | text | Page One A | yes | textinput=This is some text;tags=texttag |
| Image JPG | image | Page One A | no | attachment=Image1.jpg; width=100;tags=imagetag |
| Image PNG | image | Page One A | no | attachment=Image2.png |
| Files to download | filedownload | Page One A | auto | attachments=mahara_about.pdf |
| Files to download | filedownload | Page One A | no | attachments=mahara_about.pdf,Image2.png |
| External Feed - News | externalfeed | Page One A | No | source=http://stuff.co.nz/rss;count=5 |
| External Feed - Food | externalfeed | Page One A | no | source=http://www.thekitchenmaid.com/feed;count=3;tags=cat,a,lyst |
| External Feed - Tech | externalfeed | Page One A | no | source=feeds.feedburner.com/geekzone;count=3;tags=cat,a,lyst |
| Social Media | socialprofile | Page One A | no | sns=instagram,twitter,facebook,tumblr,pinterest,mysocialmedia |
And the following "blocks" exist:
# Page Two A
| title | type | page |retractable | data |
| Pdf | pdf | Page Two | no | attachment=mahara_about.pdf |
| Recent Forum Posts |recentforumposts| Page Two | no | groupname=Group1;maxposts=3 |
| External Video | externalvideo | Page Two | no | source=https://youtu.be/k5t5PD5F8Wo |
| Note/Textbox 1 | textbox | Page Two | no | notetitle=secretnote;text=ma ha ha ha ra!;tags=mahara,araham;attachments=Image3.png,Image2.png,Image1.jpg;allowcomments=yes |
| Note/textbox ref:1 | textbox | Page Two | no | existingnote=secretnote |
| Note/Textbox copy:1 | textbox | Page Two | no | existingnote=secretnote;allowcomments=yes;copynote=true;notetitle=newsecretnote |
| Profile Information | profileinfo | Page Two | no | introtext =Mahara unicorn here! Nice to meet you :);profileicon=Image1.jpg |
| Profile Information | profileinfo | Page Two | no | introtext =Mahara unicorn here! Nice to meet you :);profileicon=Image2.png |
| Résumé | entireresume | Page Two | no | tags=mahara |
| Résumé: Personal Goal | resumefield | Page Two | no | artefacttype=personalgoal |
| Résumé: Work Skill | resumefield | Page Two | no | artefacttype=workskill |
| Résumé: Interest | resumefield | Page Two | no | artefacttype=interest |
| Résumé: Achievements | resumefield | Page Two | no | artefacttype=certification |
| Résumé: Employment Hist.| resumefield | Page Two | no | artefacttype=employmenthistory |
| Résumé: Books | resumefield | Page Two | no | artefacttype=book |
| Résumé: Memberships | resumefield | Page Two | no | artefacttype=membership |
| Résumé: Education Hist. | resumefield | Page Two | no | artefacttype=educationhistory |
| GoogleApps: Google Maps | googleapps | Page Two | no | googleapp=<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2997.861064367898!2d174.77176941597108!3d-41.29012814856559!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x6d38afd6326bfda5%3A0x5c0d858838e52d7a!2sCatalyst!5e0!3m2!1sen!2snz!4v1550707486290" width="800" height="600" frameborder="0" style="border:0" allowfullscreen></iframe>;height=200;tags=cat,dog,monkeys |
| GoogleApps: Google Cal. | googleapps | Page Two | no | googleapp=https://calendar.google.com/calendar/embed?src=en.new_zealand%23holiday%40group.v.calendar.google.com&ctz=Pacific%2FAuckland |
Scenario: Login as admin to change upload settings
| Image | image | Page Two A | no | attachment=Image3.png |
| Files to download | filedownload | Page Two A | no | attachments=mahara_about.pdf,Image2.png,testvid3.mp4,mahara.mp3 |
| External Video | externalvideo | Page Two A | no | source=https://youtu.be/yRxFm70nOrY;tags=jen,from,the,house |
| Navigation | navigation | Page Two A | no | collection=collection one;copytoall=yes |
| Social Media | socialprofile | Page Two A | no | sns=instagram,twitter,facebook,tumblr,pinterest,mysocialmedia |
| Pdf | pdf | Page Two A | no | attachment=mahara_about.pdf |
| Recent Forum Posts |recentforumposts| Page Two A | no | groupname=Group1;maxposts=3 |
| External Video | externalvideo | Page Two A | no | source=https://youtu.be/k5t5PD5F8Wo |
| Note/Textbox 1 | textbox | Page Two A | no | notetitle=secretnote;text=ma ha ha ha ra!;tags=mahara,araham;attachments=Image3.png,Image2.png,Image1.jpg;allowcomments=yes |
| Note/textbox ref:1 | textbox | Page Two A | no | existingnote=secretnote |
| Note/Textbox copy:1 | textbox | Page Two A | no | existingnote=secretnote;allowcomments=yes;copynote=true;notetitle=newsecretnote |
| Profile Information | profileinfo | Page Two A | no | introtext =Mahara unicorn here! Nice to meet you :);profileicon=Image1.jpg |
| Profile Information | profileinfo | Page Two A | no | introtext =Mahara unicorn here! Nice to meet you :);profileicon=Image2.png |
| Résumé | entireresume | Page Two A | no | tags=mahara |
| Résumé: Personal Goal | resumefield | Page Two A | no | artefacttype=personalgoal |
| Résumé: Work Skill | resumefield | Page Two A | no | artefacttype=workskill |
| Résumé: Interest | resumefield | Page Two A | no | artefacttype=interest |
| Résumé: Achievements | resumefield | Page Two A | no | artefacttype=certification |
| Résumé: Employment Hist.| resumefield | Page Two A | no | artefacttype=employmenthistory |
| Résumé: Books | resumefield | Page Two A | no | artefacttype=book |
| Résumé: Memberships | resumefield | Page Two A | no | artefacttype=membership |
| Résumé: Education Hist. | resumefield | Page Two A | no | artefacttype=educationhistory |
And the following "blocks" exist:
# Page Three A
| title | type | page |retractable | data |
| Blog/Journal | blog | Page Three A | no | copytype=nocopy;count=5;journaltitle=journal1 |
| Blogpost/JournalEntry| blogpost | Page Three A | no | copytype=nocopy;journaltitle=journal1;entrytitle=Entry Two |
| Comments | comment | Page Three A | no | |
| Peer Assessment | peerassessment | Page Three A | auto | |
| Creative Commons | creativecommons| Page Three A | no | commercialuse=yes;license=3.0;allowmods=no |
| Navigation | navigation | Page Three A | no | collection=collection one;copytoall=yes |
| Plans | plans | Page Three A | no | plans=Plan One,Plan Two;tasksdisplaycount=10 |
| Internal Media: Video| internalmedia | Page Three A | no | attachment=testvid3.mp4 |
| Internal Media: Audio| internalmedia | Page Three A | no | attachment=mahara.mp3 |
And the following "blocks" exist:
# Page Four A
| title | type | page |retractable | data |
| Recent journal entries| recentposts | Page Four A | no | journaltitle=journal1;maxposts=10 |
| Tagged journal entries| taggedposts | Page Four A | no | tags=cats; maxposts=5;showfullentries=yes;copytype=nocopy |
| Recent journal entries| recentposts | Page Four A | no | journaltitle=journal1;maxposts=10 |
| Tagged journal entries| taggedposts | Page Four A | no | tags=cats; maxposts=5;showfullentries=yes;copytype=nocopy |
| Open Badges |openbadgedisplayer| Page Four A | no | |
And the following "blocks" exist:
# Page One B
| title | type | page |retractable | data |
| Gallery - style 1 | gallery | Page One B | no | attachments=Image1.jpg,Image3.png,Image3.png,Image2.png,Image1.jpg;imagesel=2;showdesc=yes;width=75;imagestyle=1;photoframe=1 |
| Gallery - style 2 | gallery | Page One B | yes | attachments=Image3.png,Image2.png,Image1.jpg,Image1.jpg;imagesel=2;showdesc=yes;width=75;imagestyle=2 |
| Gallery - style 3 | gallery | Page One B | yes | attachments=Image3.png,Image2.png,Image3.png,Image1.jpg,Image1.jpg;imagesel=2;showdesc=no;imagestyle=3;photoframe=0|
| Folder | folder | Page One B | no | dirname=myfolder;attachments=mahara_about.pdf,Image2.png,Image1.jpg,Image3.png,mahara.mp3 |
| Some HTML | html | Page One B | yes | attachment=test_html.html |
| Profile Information | profileinfo | Page One B | no | introtext =Mahara unicorn here! Nice to meet you :);profileicon=Image3.png |
| Résumé | entireresume | Page One B | no | tags=mahara |
And the following "blocks" exist:
| title | type | page |retractable | data |
| GoogleApps: Google Maps | googleapps | Page One Grp | no | googleapp=<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2997.861064367898!2d174.77176941597108!3d-41.29012814856559!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x6d38afd6326bfda5%3A0x5c0d858838e52d7a!2sCatalyst!5e0!3m2!1sen!2snz!4v1550707486290" width="800" height="600" frameborder="0" style="border:0" allowfullscreen></iframe>;height=200;tags=cat,dog,monkeys |
| GoogleApps: Google Cal. | googleapps | Page One Grp | no | https://calendar.google.com/calendar/embed?src=en.new_zealand%23holiday%40group.v.calendar.google.com&ctz=Pacific%2FAuckland |
Scenario: login as different users to see blocktypes and interaction
Given I log in as "UserA" with password "Kupuh1pa!"
And I go to portfolio page "Page UserA"
And I go to portfolio page "Page Grp1"
And I go to portfolio page "Page One"
And I go to portfolio page "Page Two"
And I go to portfolio page "Page One A"
And I go to portfolio page "Page Two A"
And I go to portfolio page "Page Three A"
And I go to portfolio page "Page Four A"
And I go to portfolio page "Page One Grp"
And I log out
Then I log in as "UserB" with password "Kupuh1pa!"
And I go to portfolio page "Page UserB"
And I go to portfolio page "Page One B"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment