Commit c1db85ac authored by Penny Leach's avatar Penny Leach

manual fix up of merge. two broken places still:

- can_view_view needs http://paste.dollyfish.net.nz/0e6800 (see comment
  in function)
- blocktype/mygroups/lib.php is BROKEN (was using get_associated_groups
  which I guess has been removed. needs updating! I commented out a line
  to stop it fataling in the meantime.
parent b91da79f
......@@ -53,7 +53,8 @@ class PluginBlocktypeMyGroups extends SystemBlocktype {
$smarty = smarty_core();
require_once('group.php');
// Group stuff
if (!$userassocgroups = get_associated_groups($userid, false)) {
// if (!$userassocgroups = get_associated_groups($userid, false)) {
if (true) { // TODO RICHARDM!
$userassocgroups = array();
}
......
......@@ -1301,7 +1301,7 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
if ($oldversion < 2008091600) {
if ($oldversion < 2008091601) {
$table = new XMLDBTable('event_subscription');
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED,
XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
......@@ -1317,7 +1317,7 @@ function xmldb_core_upgrade($oldversion=0) {
insert_record('event_subscription', (object)array('event' => 'createuser', 'callfunction' => 'activity_set_defaults'));
}
if ($oldversion < 2008032400) {
if ($oldversion < 2008091601) {
$table = new XMLDBTable('view_type');
$table->addFieldInfo('type', XMLDB_TYPE_CHAR, 50, XMLDB_UNSIGNED, XMLDB_NOTNULL);
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('type'));
......
......@@ -27,7 +27,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2008091600;
$config->version = 2008091601;
$config->release = '1.1.0alpha2dev';
$config->minupgradefrom = 2007080700;
$config->minupgraderelease = '0.8.0 (release tag 0.8.0_RELEASE)';
......
......@@ -1835,7 +1835,7 @@ class View {
}
}
public static function set_nav($group, $institution) {
public static function set_nav($group, $institution, $profile=false) {
if ($group) {
define('MENUITEM', 'groups/views');
define('GROUP', $group);
......@@ -1844,6 +1844,9 @@ class View {
define('INSTITUTIONALADMIN', 1);
define('MENUITEM', $institution == 'mahara' ? 'configsite/siteviews' : 'manageinstitutions/institutionviews');
}
else if ($profile) {
define('MENUITEM', 'profile/editprofilepage');
}
else {
define('MENUITEM', 'myportfolio/views');
}
......
......@@ -48,6 +48,13 @@ if (!$user = get_record('usr', 'id', $userid, 'deleted', 0)) {
}
$is_friend = is_friend($userid, $loggedinid);
$view = View::profile_view($userid);
# access will either be logged in (always) or public as well
if (!can_view_view($view->get('id'))) {
log_debug('throwing access denied exception');
throw new AccessDeniedException();
}
$name = display_name($user);
define('TITLE', $name);
$smarty = smarty(
......
......@@ -52,20 +52,6 @@ if (!empty($id) && empty($view)) {
$view = new View($id);
}
if ($view->get('type') == 'profile') {
$profile = true;
define('TITLE', get_string('editprofileview', 'view'));
define('MENUITEM', 'profile/editprofilepage');
}
else if ($new) {
define('TITLE', get_string('createviewsteptwo', 'view'));
define('MENUITEM', 'myportfolio/views');
}
else {
define('TITLE', get_string('editblocksforview', 'view', $view->get('title')));
define('MENUITEM', 'myportfolio/views');
}
if (!$USER->can_edit_view($view)) {
throw new AccessDeniedException();
}
......@@ -91,9 +77,13 @@ if ($new && isset($_POST['cancel'])) {
redirect(get_config('wwwroot') . '/view/');
}
View::set_nav($group, $institution);
View::set_nav($group, $institution, ($view->get('type') == 'profile'));
if ($new) {
if ($view->get('type') == 'profile') {
$profile = true;
define('TITLE', get_string('editprofileview', 'view'));
}
else if ($new) {
define('TITLE', get_string('createviewstepone', 'view'));
}
else {
......
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