Commit fae347da authored by Dan Marsden's avatar Dan Marsden
Browse files

WR#71154 UI for feedback enhancements

parent 669a3274
......@@ -99,6 +99,8 @@ $string['publiclower'] = 'public';
$string['everyoneingroup'] = 'Everyone in Group';
$string['token'] = 'Secret URL';
$string['peoplewiththesecreturl'] = 'People with the Secret URL';
$string['allowfeedback'] = 'Allow feedback';
$string['approvefeedback'] = 'Approve feedback';
// view user
$string['inviteusertojoingroup'] = 'Invite this user to join a group';
......
......@@ -669,6 +669,8 @@
<FIELD NAME="accesstype" TYPE="char" LENGTH="16" NOTNULL="true" ENUM="true" ENUMVALUES="'public', 'loggedin', 'friends'" DEFAULT="public" />
<FIELD NAME="startdate" TYPE="datetime" NOTNULL="false" />
<FIELD NAME="stopdate" TYPE="datetime" NOTNULL="false" />
<FIELD NAME="allowfeedback" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="approvefeedback" TYPE="int" LENGTH="10" NOTNULL="true" />
</FIELDS>
<KEYS>
<KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
......@@ -681,6 +683,8 @@
<FIELD NAME="role" TYPE="char" LENGTH="255" NOTNULL="false" />
<FIELD NAME="startdate" TYPE="datetime" NOTNULL="false" />
<FIELD NAME="stopdate" TYPE="datetime" NOTNULL="false" />
<FIELD NAME="allowfeedback" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="approvefeedback" TYPE="int" LENGTH="10" NOTNULL="true" />
</FIELDS>
<KEYS>
<KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
......@@ -693,6 +697,8 @@
<FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="startdate" TYPE="datetime" NOTNULL="false" />
<FIELD NAME="stopdate" TYPE="datetime" NOTNULL="false" />
<FIELD NAME="allowfeedback" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="approvefeedback" TYPE="int" LENGTH="10" NOTNULL="true" />
</FIELDS>
<KEYS>
<KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
......@@ -706,6 +712,8 @@
<FIELD NAME="startdate" TYPE="datetime" NOTNULL="false" />
<FIELD NAME="stopdate" TYPE="datetime" NOTNULL="false" />
<FIELD NAME="visible" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" />
<FIELD NAME="allowfeedback" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="approvefeedback" TYPE="int" LENGTH="10" NOTNULL="true" />
</FIELDS>
<KEYS>
<KEY NAME="viewfk" TYPE="foreign" FIELDS="view" REFTABLE="view" REFFIELDS="id" />
......
......@@ -1859,6 +1859,25 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
}
if ($oldversion < 2010062502) {
//new feature feedback control on views
$field = new XMLDBField('allowfeedback');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10');
$field2 = new XMLDBField('approvefeedback');
$field2->setAttributes(XMLDB_TYPE_INTEGER, '10');
$table = new XMLDBTable('view_access');
add_field($table, $field);
add_field($table, $field2);
$table = new XMLDBTable('view_access_group');
add_field($table, $field);
add_field($table, $field2);
$table = new XMLDBTable('view_access_usr');
add_field($table, $field);
add_field($table, $field2);
$table = new XMLDBTable('view_access_token');
add_field($table, $field);
add_field($table, $field2);
}
return $status;
}
......@@ -28,7 +28,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2010062501;
$config->version = 2010062502;
$config->release = '1.3.0beta2dev';
$config->minupgradefrom = 2008040200;
$config->minupgraderelease = '1.0.0 (release tag 1.0.0_RELEASE)';
......
......@@ -549,19 +549,19 @@ class View {
}
$data = get_records_sql_array("
SELECT accesstype AS type, NULL AS id, NULL AS role, NULL AS grouptype, startdate, stopdate
SELECT accesstype AS type, NULL AS id, NULL AS role, NULL AS grouptype, startdate, stopdate, allowfeedback, approvefeedback
FROM {view_access}
WHERE \"view\" = ?
UNION
SELECT 'user' AS type, $uid AS id, NULL AS role, NULL AS grouptype, startdate, stopdate
SELECT 'user' AS type, $uid AS id, NULL AS role, NULL AS grouptype, startdate, stopdate, allowfeedback, approvefeedback
FROM {view_access_usr}
WHERE \"view\" = ?
UNION
SELECT 'group', $gid, \"role\", grouptype, startdate, stopdate FROM {view_access_group}
SELECT 'group', $gid, \"role\", grouptype, startdate, stopdate, allowfeedback, approvefeedback FROM {view_access_group}
INNER JOIN {group} g ON (\"group\" = g.id AND g.deleted = ?)
WHERE \"view\" = ?
UNION
SELECT 'token', token, NULL AS role, NULL AS grouptype, startdate, stopdate
SELECT 'token', token, NULL AS role, NULL AS grouptype, startdate, stopdate, allowfeedback, approvefeedback
FROM {view_access_token}
WHERE \"view\" = ? AND visible = 1
", array($this->id, $this->id, 0, $this->id, $this->id));
......@@ -676,6 +676,16 @@ class View {
foreach ($accessdata as $item) {
$accessrecord = new StdClass;
$accessrecord->view = $this->get('id');
if (!empty($item['allowfeedback'])) {
$accessrecord->allowfeedback = 1;
} else {
$accessrecord->allowfeedback = 0;
}
if (!empty($item['approvefeedback'])) {
$accessrecord->approvefeedback = 1;
} else {
$accessrecord->approvefeedback = 0;
}
if (isset($item['startdate'])) {
$accessrecord->startdate = db_format_timestamp($item['startdate']);
}
......
......@@ -59,6 +59,16 @@ function renderPotentialPresetItem(item) {
// Given a row, render it on the right hand side
function renderAccessListItem(item) {
var removeButton = BUTTON({'type': 'button'}, '{{str tag=remove}}');
var allowfdbk = INPUT({
'type': 'checkbox',
'name': 'accesslist[' + count + '][allowfeedback]',
'id' : 'allowfeedback' + count,
'value': 1});
var approvefdbk = INPUT({
'type': 'checkbox',
'name': 'accesslist[' + count + '][approvefeedback]',
'id' : 'approvefeedback' + count,
'value': 1});
var dateInfo = TABLE(null,
TBODY(null,
TR(null,
......@@ -72,9 +82,24 @@ function renderAccessListItem(item) {
TR(null,
TH(null, null),
TD(null, get_string('datetimeformatguide'))
),
TR(null,
TH(null, get_string('allowfeedback') + ':'),
TD(null, allowfdbk)
),
TR(null,
TH(null, get_string('approvefeedback') + ':'),
TD(null, approvefdbk)
)
)
);
if (item['approvefeedback']==1) {
setNodeAttribute(allowfdbk,'checked',true);
}
if (item['allowfeedback']==1) {
setNodeAttribute(approvefdbk,'checked',true);
}
var cssClass = 'ai-container';
if (item.preset) {
cssClass += ' preset';
......@@ -128,7 +153,7 @@ function renderAccessListItem(item) {
removeElement(row);
});
appendChildNodes('accesslistitems', row);
setupCalendar(item, 'start');
setupCalendar(item, 'stop');
count++;
......
......@@ -392,7 +392,7 @@ function editaccess_submit(Pieform $form, $values) {
$form = pieform($form);
$smarty = smarty(array('tablerenderer'), array(), array('mahara' => array('From', 'To', 'datetimeformatguide')), array('sidebars' => false));
$smarty = smarty(array('tablerenderer'), array(), array('mahara' => array('From', 'To', 'datetimeformatguide'),'view' => array('allowfeedback', 'approvefeedback')), array('sidebars' => false));
$smarty->assign('INLINEJAVASCRIPT', $js);
$smarty->assign('PAGEHEADING', hsc(TITLE));
$smarty->assign('form', $form);
......
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