Commit ffaec8b7 authored by Nigel McNie's avatar Nigel McNie
Browse files

Put the new view pages into the menu structure in the correct place.

parent df4a7c33
{include file="header.tpl"}
{include file="columnfullstart.tpl"}
<h2>{$titlestr}</h2>
{$form}
{include file="columnfullend.tpl"}
{include file="footer.tpl"}
{include file="header.tpl"}
{include file="columnfullstart.tpl"}
<form action="" method="post">
<input type="hidden" id="viewid" name="id" value="{$view}">
<input type="hidden" name="change" value="1">
<div id="page">
<div id="top-pane">
<div id="category-list">
{$category_list}
</div>
<div id="blocktype-list">
{$blocktype_list}
</div>
<div id="blocktype-footer"></div>
</div>
<a id="layout-link" href="layout.php?id=1"{if !$can_change_layout} style="display: none;"{/if}>Change View Layout</a>
<div id="bottom-pane">
<div id="column-container">
{$columns}
<div id="clearer">
</div>
</div>
</div>
<script type="text/javascript">
{literal}
insertSiblingNodesAfter('bottom-pane', DIV({'id': 'views-loading'}, 'Loading...'));
{/literal}
</script>
</div>
</form>
{* TODO theme me *}
{if $new}
<form action="{$WWWROOT}view/edit.php" method="GET">
<input type="hidden" name="id" value="{$view}">
<input type="hidden" name="new" value="1">
<input type="submit" class="submit" value="{str tag='back'}">
</form>
<form action="{$WWWROOT}view/access.php" method="GET">
<input type="hidden" name="id" value="{$view}">
<input type="hidden" name="new" value="1">
<input class="submit" type="submit" value="{str tag='next'}">
</form>
{else}
<form action="{$WWWROOT}view/" method="GET">
<input class="submit" type="submit" value="{str tag='done'}">
</form>
{/if}
{include file="columnfullend.tpl"}
{include file="footer.tpl"}
{include file="header.tpl"}
{include file="columnfullstart.tpl"}
<h2>{str tag="editview" section="view"}</h2>
{$editview}
{include file="columnfullend.tpl"}
{include file="footer.tpl"}
{include file="header.tpl"}
{include file="columnfullstart.tpl"}
<h2>Column Layout</h2>
<p>You can change the widths of the columns in your view.</p>
{$form_start_tag}
{foreach from=$options key=id item=description}
<div class="fl" style="margin: 0 .5em; text-align: center;">
<div><img src="/thumb.php?type=blocktype&bt=test" alt=""></div>
<div><input type="radio" class="radio" name="layout" value="{$id}"></div>
<div>{$description|escape}</div>
</div>
{/foreach}
<div style="clear: both;">
<input type="hidden" name="pieform_viewlayout" value="">
<input type="submit" class="submit" name="submit" value="Change Layout">
</div>
</form>
<a href="blocks.php?id={$view}">Back to your view</a>
{include file="columnfullend.tpl"}
{include file="footer.tpl"}
<?php
/**
* This program is part of Mahara
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @package mahara
* @subpackage core
* @author Nigel McNie <nigel@catalyst.net.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
// NOTE: this JSON script is used by the 'viewacl' element. It could probably
// be moved elsewhere without harm if necessary (e.g. if the 'viewacl' element
// was used in more places
define('INTERNAL', 1);
define('JSON', 1);
require(dirname(dirname(__FILE__)) . '/init.php');
require('searchlib.php');
safe_require('search', 'internal');
json_headers();
$type = param_variable('type');
$query = param_variable('query', '');
$limit = param_integer('limit', 10);
$offset = param_integer('offset', 0);
switch ($type) {
case 'user':
$data = get_user_results($query, $limit, $offset);
break;
case 'group':
$data = get_group_results($query, $limit, $offset);
break;
}
json_headers();
$data['error'] = false;
$data['message'] = '';
echo json_encode($data);
function get_user_results($query, $limit, $offset) {
$data = search_user($query, $limit, $offset);
return $data;
}
function get_group_results($query, $limit, $offset) {
$data = search_group($query, $limit, $offset);
if ($data['data']) {
foreach ($data['data'] as &$result) {
}
}
return $data;
}
?>
<?php
/**
* This program is part of Mahara
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @package mahara
* @subpackage core
* @author Nigel McNie <nigel@catalyst.net.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
define('INTERNAL', 1);
define('MENUITEM', 'myportfolio/views');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'view');
define('SECTION_PAGE', 'editaccess');
require(dirname(dirname(__FILE__)) . '/init.php');
define('TITLE', get_string('editaccess', 'view'));
require_once('pieforms/pieform.php');
require_once('pieforms/pieform/elements/calendar.php');
require_once(get_config('docroot') . 'lib/view.php');
$smarty = smarty(array('tablerenderer'), pieform_element_calendar_get_headdata(pieform_element_calendar_configure(array())));
$view = new View(param_integer('id'));
$new = param_boolean('new');
$artefacts = $view->get_artefact_metadata();
if (empty($artefacts)) {
$confirmmessage = get_string('reallyaddaccesstoemptyview');
$js = <<<EOF
addLoadEvent(function() {
connect('editaccess_submit', 'onclick', function () {
var accesslistrows = getElementsByTagAndClassName('tr', null, 'accesslistitems');
if (accesslistrows.length > 0 && !confirm('{$confirmmessage}')) {
replaceChildNodes('accesslistitems', []);
}
});
});
EOF;
$smarty->assign('INLINEJAVASCRIPT', $js);
}
$form = array(
'name' => 'editaccess',
'elements' => array(
'id' => array(
'type' => 'hidden',
'value' => $view->get('id'),
),
'new' => array(
'type' => 'hidden',
'value' => $new,
),
'accesslist' => array(
'type' => 'viewacl',
'defaultvalue' => isset($view) ? $view->get_access() : null
),
'submit' => array(
'type' => !empty($new) ? 'cancelbackcreate' : 'submitcancel',
'value' => !empty($new)
? array(get_string('cancel'), get_string('back','view'), get_string('save'))
: array(get_string('save'), get_string('cancel')),
),
)
);
function editaccess_cancel_submit() {
redirect('/view/');
}
function editaccess_submit(Pieform $form, $values) {
global $SESSION, $view, $new;
if (param_boolean('back')) {
redirect('/view/blocks.php?id=' . $view->get('id') . '&new=' . $new);
}
$view->set_access($values['accesslist']);
if ($values['new']) {
$str = get_string('viewcreatedsuccessfully', 'view');
}
else {
$str = get_string('viewaccesseditedsuccessfully', 'view');
}
$SESSION->add_ok_msg($str);
redirect('/view/');
}
$smarty->assign('titlestr', get_string('editaccess', 'view'));
$smarty->assign('form', pieform($form));
$smarty->display('view/access.tpl');
?>
<?php
/**
* This program is part of Mahara
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @package mahara
* @subpackage core
* @author Nigel McNie <nigel@catalyst.net.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
define('INTERNAL', 1);
define('JSON', 1);
require(dirname(dirname(__FILE__)) . '/init.php');
require('view.php');
$view = new View(param_integer('id'));
$change = param_boolean('change', false);
$action = param_alphanumext('action', '');
// we actually ned to process stuff
if ($change) {
try {
$returndata = $view->process_changes();
json_reply(false, $returndata);
}
catch (Exception $e) {
json_reply(true, $e->getMessage());
}
}
// else we're just reading data...
switch ($action) {
case 'blocktype_list':
$category = param_alpha('c');
$data = View::build_blocktype_list($category, true);
json_reply(false, array('message' => false, 'data' => $data));
break;
}
json_reply(true, get_string('noviewcontrolaction', 'error', $action));
?>
<?php
/**
* This program is part of Mahara
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @package mahara
* @subpackage core
* @author Nigel McNie <nigel@catalyst.net.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
define('INTERNAL', 1);
define('MENUITEM', 'viewrework');
require(dirname(dirname(__FILE__)) . '/init.php');
require('view.php');
define('TITLE', get_string('editblocks', 'view'));
$view = new View(param_integer('id'));
$new = param_boolean('new');
// FIXME: we can't know the first category is 'aboutme'
$category = param_alpha('c', 'aboutme');
$view->process_changes($category, $new);
$columns = $view->build_columns(true);
$extraconfig = array(
'stylesheets' => array('style/views.css'),
'themepaths' => array('style/views-js.css'), // for config.theme
);
$smarty = smarty(array('views', 'tinytinymce'), false, false, $extraconfig);
// The list of categories for the tabbed interface
$smarty->assign('category_list', View::build_category_list($category, $view, $new));
// The list of blocktypes for the default category
$smarty->assign('blocktype_list', View::build_blocktype_list($category));
// The HTML for the columns in the view
$smarty->assign('columns', $columns);
// Tell smarty we're editing rather than just rendering
$smarty->assign('editing', true);
$smarty->assign('new', $new);
$smarty->assign('view', $view->get('id'));
$smarty->assign('can_change_layout', ($view->get('numcolumns') > 1 && $view->get('numcolumns') < 5));
$smarty->display('view/blocks.tpl');
?>
*************** function createview1_cancel_submit() {
*** 147,153 ****
}
function createview1_validate(Pieform $form, $values) {
- if ($values['startdate'] > $values['stopdate']) {
$form->set_error('startdate', get_string('startdatemustbebeforestopdate', 'view'));
}
}
--- 147,153 ----
}
function createview1_validate(Pieform $form, $values) {
+ if ($values['startdate'] && $values['stopdate'] && $values['startdate'] > $values['stopdate']) {
$form->set_error('startdate', get_string('startdatemustbebeforestopdate', 'view'));
}
}
*************** function createview1_cancel_submit() {
*** 141,147 ****
}
function createview1_validate(Pieform $form, $values) {
- if ($values['startdate'] > $values['stopdate']) {
$form->set_error('startdate', get_string('startdatemustbebeforestopdate', 'view'));
}
}
--- 141,147 ----
}
function createview1_validate(Pieform $form, $values) {
+ if ($values['startdate'] && $values['stopdate'] && $values['startdate'] > $values['stopdate']) {
$form->set_error('startdate', get_string('startdatemustbebeforestopdate', 'view'));
}
}
<?php
/**
* This program is part of Mahara
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @package mahara
* @subpackage core
* @author Nigel McNie <nigel@catalyst.net.nz>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
*
*/
define('INTERNAL', 1);
define('PUBLIC', 1);
define('MENUITEM', 'viewlayout');
require_once(dirname(dirname(__FILE__)) . '/init.php');
require_once('pieforms/pieform.php');
require_once('view.php');
define('TITLE', 'Views Layout [DANGER construction site]');
$id = param_integer('id');
$view = new View($id);
if ($view->get('numcolumns') > 1) {
$layouts = get_records_array('view_layout', 'columns', $view->get('numcolumns'));
$options = array();
foreach ($layouts as $layout) {
$options[$layout->id] = get_string($layout->widths, 'view');
}
}
else {
redirect('/view/blocks.php?id=' . $id);
}
// NOTE: not building the form, that's left to the template
$form = new Pieform(array(
'name' => 'viewlayout',
'elements' => array(
'layout' => array(
'type' => 'radio',
'options' => $options,
'defaultvalue' => $view->get('layout'),
),
'submit' => array(
'type' => 'submit',
'value' => get_string('submit'),
),
),
));
$smarty = smarty();
$smarty->assign('view', $id);
$smarty->assign('form_start_tag', $form->get_form_tag());
$smarty->assign('options', $options);
$smarty->display('view/layout.tpl');
function viewlayout_submit(Pieform $form, $values) {
global $view, $SESSION;
$view->set('layout', $values['layout']);
$view->commit();
$SESSION->add_ok_msg('View layout changed');
redirect('/view/blocks.php?id=' . $view->get('id'));
}
?>
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