Commit 935c90cf authored by Robert Lyon's avatar Robert Lyon Committed by Doris Tam
Browse files

Bug 1810990: blocktypes: journal, journalentry

    - additional: tidy up names

Change-Id: Idc328ccb74c3de7adb6d74c2450c75d56a89a598
parent 9813474c
......@@ -500,6 +500,7 @@ class ArtefactTypeBlog extends ArtefactType {
$newdescription = EmbeddedImage::prepare_embedded_images($artefact->get('description'), 'blog', $blogid);
$artefact->set('description', $newdescription);
db_commit();
return $blogid;
}
/**
......
create_artefact(<?php
<?php
/**
* @package mahara
* @subpackage test/generator
......@@ -719,6 +719,57 @@ EOD;
}
public static function generate_configdata_blog($data, $ownertype, $ownerid) {
if (!$data) return;
$configdata = array();
$fields = explode(';',$data);
foreach($fields as $field) {
list($key, $value) = explode('=', $field);
$key=trim($key);
$value=trim($value);
if ($key == 'journaltitle') {
$blogid = get_field('artefact', 'id', 'title', $value, 'artefacttype', 'blog');
$configdata['artefactid'] = $blogid;
}
if ($key == 'copytype') {
$configdata[$key]=$value;
}
if ($key == 'count') {
$configdata[$key]=$value;
}
}
return $configdata;
}
public static function generate_configdata_blogpost($data) {
if (!$data) return;
$configdata = array();
$blogpostid;
$blogid;
$fields = explode(';',$data);
foreach($fields as $field) {
list($key, $value) = explode('=', $field);
$key = trim($key);
$value = trim($value);
if ($key == 'journaltitle') {
$blogid = get_field('artefact', 'id', 'title', $value, 'artefacttype','blog');
}
if ($key == 'entrytitle') {
$blogpostid = get_field('artefact','id','title',$value, 'parent',$blogid, 'artefacttype','blogpost');
$configdata['artefactid'] = $blogpostid;
}
if ($key == 'copytype') {
$configdata[$key]=$value;
}
}
return $configdata;
}
/**
* generate config data for the blocktype: rss feeds/external feeds
* @param string $data inside data column in behat test
......@@ -851,8 +902,8 @@ EOD;
foreach ($fields as $field) {
list($key, $value) = explode('=', $field);
$key=trim($key);
$value=trim($value);
$key = trim($key);
$value = trim($value);
if ($key == 'attachments') {
$galleryimages = explode(',', $value);
......@@ -881,7 +932,6 @@ EOD;
$value -= 1;
$configdata['style'] = $value;
}
else {
$configdata[$key] = $value;
}
......@@ -890,7 +940,6 @@ EOD;
return $configdata;
}
public static function generate_configdata_html($data, $ownertype, $ownerid) {
if (!$data) return;
......@@ -1082,7 +1131,6 @@ EOD;
}
}
/**
* set up configdata for retractable and retractable on load
*/
......@@ -1418,7 +1466,7 @@ EOD;
* @param unknown $record
* @throws SystemException
*/
public function create_journal($record) {
public function create_blog($record) {
$record['owner'] = trim($record['owner']);
$record['ownertype'] = trim($record['ownertype']);
$owner = null;
......@@ -1475,7 +1523,7 @@ EOD;
* @param unknown $record
* @throws SystemException
*/
public function create_journalpost($record) {
public function create_blogpost($record) {
$record['owner'] = trim($record['owner']);
$record['ownertype'] = trim($record['ownertype']);
$owner = null;
......
......@@ -181,7 +181,7 @@ class BehatDataGenerators extends BehatBase {
'required' => array('emailtype', 'to', 'subject'),
),
'journals' => array(
'datagenerator' => 'journal',
'datagenerator' => 'blog',
'available' => array(
'owner' => 'text',
'ownertype' => 'text',
......@@ -191,8 +191,8 @@ class BehatDataGenerators extends BehatBase {
),
'required' => array('owner', 'ownertype', 'title'),
),
'journalposts' => array(
'datagenerator' => 'journalpost',
'journalentries' => array(
'datagenerator' => 'blogpost',
'available' => array(
'owner' => 'text',
'ownertype' => 'text',
......
......@@ -16,10 +16,25 @@ Background:
| Group1 | UserB | Group1 owned by UserB | standard | ON | OFF | all | ON | OFF | UserA | |
And the following "pages" exist:
| title | description | ownertype | ownername |
| Page UserA_00 | Page 01 | user | UserA |
| Page UserB_00 | Page 01 | user | UserA |
| Page Grp1 | Page 01 | group | Group1 |
| title | description | ownertype | ownername |
| Page UserA_00 | Page 01 | user | UserA |
| Page UserB_00 | Page 01 | user | UserA |
| Page Grp1 | Page 01 | group | Group1 |
| Page One | test 01 | user | UserA |
And the following "journals" exist:
| owner | ownertype | title | description | tags |
| UserA | user | journal1| this is journal1 | amber,brown,cobalt |
| Group1| group |journal2| this is journal1 | amber,brown,cobalt |
And the following "journalentries" exist:
| owner | ownertype | title | entry | blog | tags | draft |
| UserA | user | Entry One | This is my entry One | journal1 | cats,dogs | 0 |
| UserA | user | Entry Two | This is my entry Two | journal1 | cats,dogs | 0 |
| UserA | user | Entry Three | This is my entry Three | journal1 | cats,dogs | 0 |
| UserA | user | Entry Four | This is my entry Four | journal1 | cats,dogs | 0 |
| UserA | user | Entry Five | This is my entry Five | journal1 | cats,dogs | 0 |
| Group1 | group | Group e1 | This is my group entry | journal2 | | 0 |
And the following "blocks" exist:
| title | type | page |retractable | data |
......@@ -45,6 +60,8 @@ Background:
| internalm a | internalmedia| Page UserB_00 | no | attachment=mahara.mp3 |
| my pdf | pdf | Page UserB_00 | no | attachment=mahara_about.pdf |
| my blog | blog | Page One | no |copytype=nocopy;count=5;journaltitle=journal1 |
| my blogpost | blogpost | Page One | no |copytype=nocopy;journaltitle=journal1;entrytitle=Entry Two |
......@@ -72,3 +89,4 @@ Scenario: Create Page UserA_00 with text blocks
And I go to portfolio page "Page UserA_00"
And I go to portfolio page "Page Grp1"
And I go to portfolio page "Page UserB_00"
And I go to portfolio page "Page One"
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