Skip to content

Commit

Permalink
OUBlog: Copy posts between individual and personal blog instances #88…
Browse files Browse the repository at this point in the history
…71 #9031
  • Loading branch information
jason-platts authored and sammarshallou committed Jan 31, 2014
1 parent 73feff4 commit e6bc768
Show file tree
Hide file tree
Showing 16 changed files with 1,704 additions and 6 deletions.
2 changes: 1 addition & 1 deletion backup/moodle2/backup_oublog_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected function define_structure() {
'accesstoken', 'intro', 'introformat', 'allowcomments', 'individual',
'maxbytes', 'maxattachments', 'maxvisibility', 'global', 'views',
'completionposts', 'completioncomments', 'reportingemail', 'displayname',
'statblockon'));
'statblockon', 'allowimport'));

$instances = new backup_nested_element('instances');

Expand Down
3 changes: 2 additions & 1 deletion db/install.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/oublog/db" VERSION="20131211" COMMENT="XMLDB file for Moodle mod/oublog"
<XMLDB PATH="mod/oublog/db" VERSION="20140127" COMMENT="XMLDB file for Moodle mod/oublog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
Expand All @@ -25,6 +25,7 @@
<FIELD NAME="reportingemail" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Email addresses for reporting posts or comments"/>
<FIELD NAME="displayname" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Alternative name used in some areas of the interface"/>
<FIELD NAME="statblockon" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Show the stat block"/>
<FIELD NAME="allowimport" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="0 or 1 to enable importing of posts"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
Expand Down
69 changes: 69 additions & 0 deletions db/services.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Web service definition.
*
* @package mod_oublog
* @copyright 2013 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

$functions = array(
'mod_oublog_get_user_blogs' => array(
'classname' => 'mod_oublog_external',
'methodname' => 'get_user_blogs',
'classpath' => 'mod/oublog/externallib.php',
'description' => 'Get all user\'s blogs on system',
'type' => 'read',
),
'mod_oublog_get_blog_info' => array(
'classname' => 'mod_oublog_external',
'methodname' => 'get_blog_info',
'classpath' => 'mod/oublog/externallib.php',
'description' => 'Get info on blog, inc access check',
'type' => 'read',
),
'mod_oublog_get_blog_allposts' => array(
'classname' => 'mod_oublog_external',
'methodname' => 'get_blog_allposts',
'classpath' => 'mod/oublog/externallib.php',
'description' => 'Get importable user posts from blog',
'type' => 'read',
),
'mod_oublog_get_blog_posts' => array(
'classname' => 'mod_oublog_external',
'methodname' => 'get_blog_posts',
'classpath' => 'mod/oublog/externallib.php',
'description' => 'Get selected user posts from blog',
'type' => 'read',
),

);

$services = array(
'OUBlog import' => array(
'shortname' => 'oublogimport',
'functions' => array ('mod_oublog_get_user_blogs', 'mod_oublog_get_blog_info',
'mod_oublog_get_blog_allposts', 'mod_oublog_get_blog_posts'),
'requiredcapability' => '',
'restrictedusers' => 1,
'enabled' => 1,
'downloadfiles' => 1
)
);
15 changes: 15 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,5 +223,20 @@ function xmldb_oublog_upgrade($oldversion=0) {
upgrade_mod_savepoint(true, 2013121100, 'oublog');
}

if ($oldversion < 2014012702) {

// Define field allowimport to be added to oublog.
$table = new xmldb_table('oublog');
$field = new xmldb_field('allowimport', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'statblockon');

// Conditionally launch add field allowimport.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}

// Oublog savepoint reached.
upgrade_mod_savepoint(true, 2014012702, 'oublog');
}

return true;
}
Loading

0 comments on commit e6bc768

Please sign in to comment.