Commit 9d73c5e7 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Display changes to copy view page

parent ca5d6cec
......@@ -273,6 +273,6 @@ $string['nocopyableviewsfound'] = 'No Views that you can copy';
$string['noownersfound'] = 'No owners found';
$string['viewsby'] = 'Views by %s';
$string['Preview'] = 'Preview';
$string['closepreview'] = 'Close Preview';
$string['close'] = 'Close';
?>
......@@ -1571,6 +1571,9 @@ button#dosearch {
background-color: #92b328 !important;
}
#copyview .searchlist {
margin-bottom: 20px;
}
#copyview .templateresults {
width: 100%;
margin-top: 5px;
......@@ -1591,8 +1594,17 @@ button#dosearch {
#copyview .selectowner {
font-weight: bold;
}
#copyview #viewownersearch td img {
vertical-align: bottom;
}
#copyview #viewownersearch td.selectowner img {
vertical-align: middle;
}
.preview-group {
margin: 5px 40px 0;
margin: 10px;
}
.preview-group ul#group-info {
padding: 0;
}
#viewpreview {
position: absolute;
......
<div class="preview-group">
<h3>{$group->name|escape}</h3>
{if $group->description}<p id="group-description">{$group->description|escape}</p> {/if}
{include file="group/info.tpl"}
</div>
{include file="group/info.tpl"}
......@@ -2,14 +2,10 @@
<div class="fl">
<img src="{$WWWROOT}thumb.php?type=profileicon&amp;maxwidth=50&amp;maxheight=50&amp;id={$user->id}" alt="">
</div>
<h3>
<a href="{$WWWROOT}user/view.php?id={$user->id}">
{$user->id|display_name|escape}
</a>
</h3>
<h3><a href="{$WWWROOT}user/view.php?id={$user->id}">{$user->id|display_name|escape}</a></h3>
{if $user->introduction}
<p>
{$user->introduction}
</p>
<p>{$user->introduction}</p>
{else}
<br><br>
{/if}
</div>
......@@ -15,7 +15,10 @@
{elseif $row->ownertype == 'group'}
<td><a class="grouplink" href="{$WWWROOT}group/view.php?id={$row->id|escape}" target="_blank">{$row->display|escape}</a></td>
{else}
<td><a class="userlink" href="{$WWWROOT}user/view.php?id={$row->id|escape}" target="_blank">{$row->display|escape}</a></td>
<td>
<img src="{$WWWROOT}thumb.php?type=profileicon&maxwidth=20&maxheight=20&id={$row->id|escape}" />
<a class="userlink" href="{$WWWROOT}user/view.php?id={$row->id|escape}" target="_blank">{$row->display|escape}</a>
</td>
{/if}
<td style="text-align: center;">{$row->count|escape}</td>
<td class="selectowner"><a href="{$viewurl}&amp;owntype={$row->ownertype}&amp;ownid={$row->id}">{str tag=listviews section=view}</a>&nbsp;<img src="{theme_path location='images/icon_fieldset_left.gif'}" alt=""></td>
......
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2008 Catalyst IT Ltd (http://www.catalyst.net.nz)
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage core
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2008 Catalyst IT Ltd http://catalyst.net.nz
*
*/
define('INTERNAL', 1);
define('JSON', 1);
require(dirname(dirname(__FILE__)) . '/init.php');
$id = param_integer('id');
$smarty = smarty_core();
$smarty->assign('user', (object) array('id' => $id, 'introduction' => get_field('artefact', 'title', 'artefacttype', 'introduction', 'owner', $id)));
ob_start();
$smarty->display('user/simpleuser.tpl');
$html = ob_get_contents();
ob_end_clean();
json_reply(false, array(
'message' => null,
'html' => $html,
));
?>
......@@ -80,17 +80,22 @@ else {
View::get_templatesearch_data($views);
$strpreview = json_encode(get_string('Preview','view'));
$strclose = json_encode(get_string('closepreview','view'));
$strclose = json_encode(get_string('close','view'));
$js = <<<EOF
preview = DIV({'id':'viewpreview', 'class':'hidden'}, DIV({'id':'viewpreviewinner'}, DIV({'id':'viewpreviewclose'}, A({'href':'','id':'closepreview'}, {$strclose})), DIV({'id':'viewpreviewcontent'})));
function showPreview(data) {
function showPreview(size, data) {
$('viewpreviewcontent').innerHTML = data.html;
var vdim = getViewportDimensions();
var vpos = getViewportPosition();
var offset = 16; // Left border & padding of preview container elements (@todo: use getStyle()?)
setElementDimensions(preview, {'w':vdim.w - 200});
if (size == 'small') {
var width = 400;
} else {
var width = vdim.w - 200;
}
setElementDimensions(preview, {'w':width});
setElementPosition(preview, {'x':vpos.x+100-offset, 'y':vpos.y+200});
showElement(preview);
}
......@@ -119,7 +124,7 @@ addLoadEvent(function() {
e.stop();
var href = getNodeAttribute(this, 'href');
var params = parseQueryString(href.substring(href.indexOf('?')+1, href.length));
sendjsonrequest(config.wwwroot + 'group/groupinfo.json.php', params, 'POST', showPreview);
sendjsonrequest(config.wwwroot + 'group/groupinfo.json.php', params, 'POST', partial(showPreview, 'small'));
});
});
forEach(getElementsByTagAndClassName('a', 'userlink', 'viewownersearch'), function(i) {
......@@ -127,7 +132,7 @@ addLoadEvent(function() {
e.stop();
var href = getNodeAttribute(this, 'href');
var params = parseQueryString(href.substring(href.indexOf('?')+1, href.length));
sendjsonrequest('viewcontent.json.php', {'user':params.id}, 'POST', showPreview);
sendjsonrequest(config.wwwroot + 'user/userdetail.json.php', params, 'POST', partial(showPreview, 'small'));
});
});
};
......@@ -140,13 +145,14 @@ addLoadEvent(function() {
e.stop();
var href = getNodeAttribute(this, 'href');
var params = parseQueryString(href.substring(href.indexOf('?')+1, href.length));
sendjsonrequest('viewcontent.json.php', params, 'POST', showPreview);
sendjsonrequest('viewcontent.json.php', params, 'POST', partial(showPreview, 'big'));
});
});
};
templatelist.rewriteOther();
appendChildNodes(getFirstElementByTagAndClassName('body'), preview);
connect('closepreview', 'onclick', function (e) {e.stop(); fade(preview, {'duration':0.2});});
connect('viewpreviewcontent', 'onclick', function (e) {e.stop(); return false;});
});
EOF;
......
......@@ -29,25 +29,15 @@ define('JSON', 1);
require(dirname(dirname(__FILE__)) . '/init.php');
require_once(get_config('libroot') . 'view.php');
if ($user = param_integer('user', null)) {
$id = get_field('view', 'id', 'type', 'profile', 'owner', $user);
}
else {
$id = param_integer('id');
}
$id = param_integer('id');
if (!can_view_view($id)) {
json_reply('local', get_string('accessdenied', 'error'));
}
$view = new View($id);
$smarty = smarty_core();
if ($user) {
$smarty->assign('viewtitle', $view->formatted_owner());
}
else {
$smarty->assign('viewtitle', $view->get('title'));
$smarty->assign('ownername', $view->formatted_owner());
}
$smarty->assign('viewtitle', $view->get('title'));
$smarty->assign('ownername', $view->formatted_owner());
$smarty->assign('viewdescription', $view->get('description'));
$smarty->assign('viewcontent', $view->build_columns());
ob_start();
......
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