Commit 49b6c74e authored by Antonella De Chiara's avatar Antonella De Chiara Committed by Cecilia Vela Gurovic
Browse files

Bug 1668888: Keep buttons across all editing screens



Initial commit of info plus some moving about of files to 'raw' theme
from 'raw2' theme

behatnotneeded - will be in child patch

Change-Id: I0e8a2683d658df0f25a1586f6ecd9e74cf43062d
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 2b054fdb
......@@ -6766,7 +6766,7 @@ function createview_submit(Pieform $form, $values) {
}
}
redirect(get_config('wwwroot') . 'view/edit.php?new=1&id=' . $view->get('id'));
redirect(get_config('wwwroot') . 'view/editlayout.php?new=1&id=' . $view->get('id'));
}
/**
......@@ -6826,7 +6826,7 @@ function copyview($id, $istemplate = false, $groupid = null, $collectionid = nul
$copystatus['artefacts'],
$template->get('title'))
);
redirect(get_config('wwwroot') . 'view/edit.php?new=1&id=' . $view->get('id'));
redirect(get_config('wwwroot') . 'view/editlayout.php?new=1&id=' . $view->get('id'));
}
}
......
......@@ -22,7 +22,20 @@ if (!isset($templatedata['layoutoptions']) || !is_array($templatedata['layoutopt
}
echo $form_tag;
$output = '<div id="viewlayout_basic_container" class="basiclayoutfieldset form-group collapsible-group">';
// set our renderer
$this->include_plugin('renderer', $this->data['renderer']);
// page description form
$output = '<div class="row"><div class="col-md-9">';
$output .= pieform_render_element($this, $elements['title']);
$output .= ($elements['urlid']) ? pieform_render_element($this, $elements['urlid']) : '';
$output .= pieform_render_element($this, $elements['description']);
$output .= pieform_render_element($this, $elements['tags']);
$output .= ($elements['ownerformat']) ? pieform_render_element($this, $elements['ownerformat']) : '';
$output .= ($elements['locked']) ? pieform_render_element($this, $elements['locked']) : '';
$output .= ($elements['anonymise']) ?pieform_render_element($this, $elements['anonymise']) : '';
$output .= '</div></div>';
// Page layout form
$output .= '<div id="viewlayout_basic_container" class="basiclayoutfieldset form-group collapsible-group">';
$output .= '<fieldset class="pieform-fieldset basiclayoutfieldset collapsible">'
. '<legend><h3><a href="#viewlayout_layoutselect_container" data-toggle="collapse" aria-expanded="true" aria-controls="#viewlayout_layoutselect_container" class="">'
. get_string('basicoptions', 'view')
......
......@@ -491,4 +491,88 @@
.forassessment label {
display: inline-block !important;
margin-top: -25px;
}
\ No newline at end of file
}
/*
* NEW CSS
* Antonella De Chiara - Eticeo Santé
*/
/***********************************
SIDEBLOCKS
***********************************/
#sb-switchtheme form{
padding:20px;
}
#sb-switchtheme .submit.btn.btn-primary{
display:block;
margin:0 auto;
margin-top:15px;
}
#viewtheme-select {
display:block;
margin:0 auto;
}
/* Boutons institutions*/
.list-group-item.bouton-instit-theme {
border: 0px !important;
width: 100%;
text-align: left;
}
#sb-switchtheme form {
padding: 0 !important;
width: 100% !important;
}
/* Pages */
.col-md-12.lesboutons {
z-index: 999;
}
.theorder1866 > img {
width: 10%;
}
.btn-group.btn-toolbar {
.editviews {
img {
width: 16px;
}
}
}
.col-md-12.lesboutons {
margin-bottom: 10px;
margin-top: 10px;
padding: 0;
}
.col-md-12.lesboutons .col-collapse-offset.col-with-collapse, .col-md-12.lesboutons #enregistrer {
margin-left: 0;
padding-left: 0;
}
.col-md-12.lesboutons #afficher {
margin-right: 0;
padding-right: 0;
}
.accessurl-title {
padding-top: 30px !important;
}
.pageshare.editthepage .btn-group.btn-toolbar.btn-group-top.col-md-12 {
margin-top: -30px;
}
.modifiertoutensemble {
padding-bottom: 20px;
}
.modifiertoutensemble > label {
display: block;
padding-top: 20px;
}
.modifiertoutensemble .mce-tinymce {
width: 100% !important;
}
.modifiertoutensemble .select2.select2-container.select2-container--default {
margin-top: 20px;
}
#dialoginst {
padding: 5px;
z-index: 9999;
}
{include file="header.tpl"}
{include file="view/editviewtabs.tpl" selected='share' new=$new issiteview=$issiteview}
<div id="accessurl-container">
<br/>
<h2 class="accessurl-title">{str tag=secreturls section=view}</h2>
<!-- Url -->
<div class="btn-top-right btn-group">
{$newform|safe}
</div>
<div class="view-container">
{if !$allownew}
<div class="message info">
{if $onprobation}
{str tag=publicaccessnotallowedforprobation section=view}
{else}
{str tag=publicaccessnotallowed section=view}
{/if}
</div>
{/if}
{if $editurls}
<div class="panel panel-default">
<h2 class="panel-heading">
{str tag=secreturls section=view}
</h2>
<div class="secreturls list-group">
{foreach from=$editurls item=item name=urls}
<div class="{cycle values='r0,r1' advance=false} list-group-item">
<div class="row">
<div class="col-xs-12 col-sm-9">
<strong class="secret-url">{$item.url}</strong>
</div>
<div class="col-xs-12 col-sm-3">
<div class="btn-action-list">
<div class="btn-top-right btn-group btn-group-top">
<a id="copytoclipboard-{$item.id}" data-clipboard-text="{$item.url}" class="url-copytoclipboardbutton btn btn-default btn-xs" title="{str tag=copytoclipboard}" href="#">
<span class="icon icon-files-o icon-lg" role="presentation" aria-hidden="true"></span>
<span class="sr-only">{str tag=copytoclipboard}</span>
</a>
<a id="edit-{$item.id}" class="url-open-editform nojs-hidden-inline btn btn-default closed" title="{str tag=edit}" href="">
<span class="icon icon-pencil icon-lg" role="presentation" aria-hidden="true"></span>
<span class="icon icon-chevron-down right" role="presentation" aria-hidden="true"></span>
<span class="sr-only">{str tag=edit}</span>
</a>
{$item.deleteform|safe}
</div>
</div>
</div>
</div>
</div>
<div class="editrow {cycle} url-editform js-hidden list-group-item" id="edit-{$item.id}-form">
{$item.editform|safe}
</div>
{/foreach}
</div>
</div>
{/if}
</div>
<div class="pageshare">
<h2 class="access-title">{str tag=otherusersandgroups section=view}</h2>
<!-- Access -->
{$form|safe}
</div>
</div>
{include file="footer.tpl"}
{include file="header.tpl"}
{include file="view/editviewtabs.tpl" selected='layout' new=$new issiteview=$issiteview}
<!-- Layout -->
{$form|safe}
{include file="footer.tpl"}
<div class="btn-group btn-toolbar btn-group-top">
<a class="btn btn-default {if $selected == 'content'}active{/if}" href="{$WWWROOT}view/blocks.php?id={$viewid}{if $new}&new=1{/if}" title="{str tag=editcontent section=view}">
<span class="icon icon-lg icon-pencil" role="presentation" aria-hidden="true"></span>
<span class="btn-title">{str tag=editcontent section=view}</span>
</a>
<a class="btn btn-default {if $selected == 'layout'}active{/if}" href="{$WWWROOT}view/layout.php?id={$viewid}{if $new}&new=1{/if}" title="{str tag=editlayout section=view}">
<span class="icon icon-lg icon-columns" role="presentation" aria-hidden="true"></span>
<span class="btn-title">{str tag=editlayout section=view}</span>
</a>
{if !$issitetemplate && can_use_skins(null, false, $issiteview)}
<a class="btn btn-default {if $selected == 'skin'}active{/if}" href="{$WWWROOT}view/skin.php?id={$viewid}{if $new}&new=1{/if}" title="{str tag=chooseskin section=skin}">
<span class="icon icon-lg icon-paint-brush" role="presentation" aria-hidden="true"></span>
<span class="btn-title">{str tag=chooseskin section=skin}</span>
</a>
{/if}
{if $edittitle}
<a class="btn btn-default {if $selected == 'title'}active{/if}" href="{$WWWROOT}view/edit.php?id={$viewid}{if $new}&new=1{/if}" title="{str tag=edittitleanddescription section=view}">
<span class="icon icon-lg icon-cogs" role="presentation" aria-hidden="true"></span>
<a class="btn btn-default editviews editlayout {if $selected == 'layout'}active{/if}" href="{$WWWROOT}view/editlayout.php?id={$viewid}{if $new}&new=1{/if}" title="{str tag=edittitleanddescription section=view}">
<span class="theorder1866"><img src="{$WWWROOT}theme/raw/images/number-one-in-a-circle-grey.png"></span>
<span class="btn-title">{str tag=edittitleanddescription section=view}</span>
{if !$issitetemplate && can_use_skins(null, false, $issiteview)}
+ {str tag=chooseskin section=skin}
{/if}
</a>
{else}
<a class="btn btn-default editviews editlayout {if $selected == 'layout'}active{/if}" href="{$WWWROOT}view/layout.php?id={$viewid}{if $new}&new=1{/if}" title="{str tag=editlayout section=view}">
<span class="theorder1866"><img src="{$WWWROOT}theme/raw/images/number-one-in-a-circle-grey.png"></span>
<span class="btn-title">{str tag=editlayout section=view}</span>
</a>
{/if}
</div>
<div class="with-heading">
{if !$issitetemplate}
<a href="{$displaylink}">
{str tag=displayview section=view}
<a class="btn btn-default editviews editcontent {if $selected == 'content'}active{/if}" href="{$WWWROOT}view/blocks.php?id={$viewid}{if $new}&new=1{/if}" title="{str tag=editcontent section=view}">
<span class="theorder1866"><img src="{$WWWROOT}theme/raw/images/number-two-in-a-circle-grey.png"></span>
<span class="btn-title">{str tag=editcontent section=view}</span>
</a>
{if $edittitle || $viewtype == 'profile'}
<a href="{$WWWROOT}view/access.php?id={$viewid}{if $collectionid}&collection={$collectionid}{/if}{if $new}&new=1{/if}">
<span class="icon icon-unlock-alt" role="presentation" aria-hidden="true"></span>
{str tag=shareview section=view}
{if $edittitle || $viewtype == 'share'}
<a class="btn btn-default editviews editshare {if $selected == 'share'}active{/if}" href="{$WWWROOT}view/accessurl.php?id={$viewid}{if $collectionid}&collection={$collectionid}{/if}{if $new}&new=1{/if}">
<span class="theorder1866"><img src="{$WWWROOT}theme/raw/images/number-three-in-a-circle-grey.png"></span>
<span class="btn-title">{str tag=shareview section=view}</span>
</a>
{/if}
{else}
&nbsp;
{/if}
</div>
{if !$issitetemplate}
<div id="view-wizard-controls" class="with-heading">
<a href="{$displaylink}" id="display_page" class="">
{str tag=displayview section=view}
<span class="icon icon-arrow-circle-right right" role="presentation" aria-hidden="true"></span>
</a>
</div>
{else}
&nbsp;
{/if}
This diff is collapsed.
<?php
/*
* Created by De Chiara Antonella
* Eticeo Santé (http://eticeo.fr)
*/
define('INTERNAL', 1);
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'view');
define('SECTION_PAGE', 'editlayout');
require_once(dirname(dirname(__FILE__)) . '/init.php');
require_once('view.php');
require_once(get_config('libroot') . 'group.php');
require_once(get_config('libroot') . 'layoutpreviewimage.php');
require_once(get_config('docroot') . 'blocktype/lib.php');
require_once(get_config('libroot') . 'view.php');
$id = param_integer('id');
$new = param_boolean('new');
$view = new View($id);
$state = get_string('changemyviewlayout', 'view');
if ($new) {
define('TITLE', get_string('notitle', 'view'));
}
else {
define('TITLE', $view->get('title'));
}
define('SUBSECTIONHEADING', TITLE);
if (!$USER->can_edit_view($view)) {
throw new AccessDeniedException();
}
// Make sure we can edit view title for this type.
// If not, then we probably meant to edit blocks
if (!$view->can_edit_title()) {
redirect('/view/layout.php?id=' . $view->get('id'));
}
// If the view has been submitted, disallow editing
if ($view->is_submitted()) {
$submittedto = $view->submitted_to();
throw new AccessDeniedException(get_string('canteditsubmitted', 'view', $submittedto['name']));
}
$group = $view->get('group');
$institution = $view->get('institution');
$view->set_edit_nav();
$view->set_user_theme();
// Edit
if ($group && !group_within_edit_window($group)) {
throw new AccessDeniedException();
}
$new = param_boolean('new', 0);
$state = get_string('edittitleanddescription', 'view');
$formatstring = '%s (%s)';
$ownerformatoptions = array(
FORMAT_NAME_FIRSTNAME => sprintf($formatstring, get_string('firstname'), $USER->get('firstname')),
FORMAT_NAME_LASTNAME => sprintf($formatstring, get_string('lastname'), $USER->get('lastname')),
FORMAT_NAME_FIRSTNAMELASTNAME => sprintf($formatstring, get_string('fullname'), full_name())
);
$displayname = display_name($USER);
if ($displayname !== '') {
$ownerformatoptions[FORMAT_NAME_DISPLAYNAME] = sprintf($formatstring, get_string('preferredname'), $displayname);
}
$studentid = (string)get_field('artefact', 'title', 'owner', $USER->get('id'), 'artefacttype', 'studentid');
if ($studentid !== '') {
$ownerformatoptions[FORMAT_NAME_STUDENTID] = sprintf($formatstring, get_string('studentid'), $studentid);
}
// Clean urls are only available for portfolio views owned by groups or users who already
// have their own clean profiles or group homepages.
if ($urlallowed = get_config('cleanurls') && $view->get('type') == 'portfolio' && !$institution) {
if ($group) {
$groupdata = get_record('group', 'id', $group);
if ($urlallowed = !is_null($groupdata->urlid) && strlen($groupdata->urlid)) {
$cleanurlbase = group_homepage_url($groupdata) . '/';
}
}
else {
$userurlid = $USER->get('urlid');
if ($urlallowed = !is_null($userurlid) && strlen($userurlid)) {
$cleanurlbase = profile_url($USER) . '/';
}
}
}
// Layout
$numrows = $view->get('numrows');
$layoutcolumns = View::$layoutcolumns; // static, all possible column width combinations
$layoutrows = $view->get_layoutrows();
$maxlayoutrows = View::$maxlayoutrows; // static, max possible rows for custom layouts
$basicoptionids = array_keys(
get_records_select_assoc(
'view_layout',
'layoutmenuorder > 0 AND iscustom = 0',
array(),
'layoutmenuorder',
'id, id'
)
);
$currentlayout = $view->get('layout');
// if not set, use equal width layout for that number of columns
if (!$currentlayout) {
// if columns have been dynamically added or removed from a multi-row layout,
// there may be no valid layout id, in which case none of the layout options will be selected
$currentlayout = $view->get_layout()->id;
}
if (!in_array($currentlayout, $basicoptionids)) {
$basicoptionids[] = $currentlayout;
}
$layoutoptions = array();
$basiclayoutoptions = array();
$maxrows = 3;
foreach ($layoutrows as $key => $layout) {
$maxrows = (count($layout) > $maxrows)? count($layout) : $maxrows;
$layoutoptions[$key]['rows'] = count($layout);
$structure = array();
$rowtext = array();
for ($r = 1; $r <= count($layout); $r++) {
$widths = $layoutcolumns[$layout[$r]]->widths;
$structure['layout']['row' . $r] = $widths;
$rowtext[] = str_replace(',', '-', $widths);
}
$structure['text'] = implode(' / ', $rowtext);
$l = new LayoutPreviewImage($structure);
$layoutoptions[$key]['layout'] = $l->create_preview();
$layoutoptions[$key]['columns'] = $structure['text'];
}
foreach ($basicoptionids as $id) {
if (array_key_exists($id, $layoutoptions)) {
$basiclayoutoptions[$id] = $layoutoptions[$id];
}
}
$clnumcolumnsoptions = array();
for ($i=1; $i<6; $i++) {
$clnumcolumnsoptions[$i] = $i;
}
$columnlayoutoptions = array();
$columnlayouts = get_records_assoc('view_layout_columns');
foreach ($columnlayouts as $layout => $percents) {
$percentswidths = str_replace(',', ' - ', $percents->widths);
$columnlayoutoptions[$layout] = $percentswidths;
}
// provide a simple default to build custom layouts with
$defaultcustomlayout = View::default_columnsperrow();
$defaultlayout = get_record('view_layout_columns', 'columns', $defaultcustomlayout[1]->columns, 'widths', $defaultcustomlayout[1]->widths);
$clnumcolumnsdefault = $defaultlayout->columns;
$clwidths = $defaultlayout->widths;
// Ready custom layout preview.
$defaultlayoutpreviewdata['layout']['row1'] = $defaultcustomlayout[1]->widths;
$defaultlayoutpreviewdata['text'] = get_string($defaultcustomlayout[1]->widths, 'view');
$defaultlayoutpreview = new LayoutPreviewImage($defaultlayoutpreviewdata);
$inlinejavascript = <<<JAVASCRIPT
function get_max_custom_rows() {
return {$maxlayoutrows};
}
addLoadEvent(function () {
formchangemanager.add("viewlayout");
});
JAVASCRIPT;
$elements = array(
'viewid' => array(
'type' => 'hidden',
'value' => $view->get('id'),
),
);
$elements['customlayoutnumrows'] = array(
'type' => 'hidden',
'value' => 1,
);
$elements['layoutselect'] = array(
'type' => 'hidden',
'value' => $currentlayout,
'sesskey' => $USER->get('sesskey'),
);
$elements['layoutfallback'] = array(
'type' => 'hidden',
'value' => $defaultlayout->id,
);
// Edit
$elements['id'] = array(
'type' => 'hidden',
'value' => $view->get('id'),
);
$elements['new'] = array(
'type' => 'hidden',
'value' => $new,
);
$elements['title'] = array(
'type' => 'text',
'title' => get_string('title','view'),
'defaultvalue' => $view->get('title'),
'rules' => array( 'required' => true ),
);
$elements['urlid'] = array(
'type' => 'text',
'title' => get_string('viewurl', 'view'),
'prehtml' => '<span class="description">' . (isset($cleanurlbase) ? $cleanurlbase : '') . '</span> ',
'description' => get_string('viewurldescription', 'view') . ' ' . get_string('cleanurlallowedcharacters'),
'defaultvalue' => $new ? null : $view->get('urlid'),
'rules' => array('maxlength' => 100, 'regex' => get_config('cleanurlvalidate')),
'ignore' => !$urlallowed || $new,
);
$elements['description'] = array(
'type' => 'wysiwyg',
'title' => get_string('description','view'),
'rows' => 10,
'cols' => 70,
'defaultvalue' => $view->get('description'),
'rules' => array('maxlength' => 65536),
);
$elements['tags'] = array(
'type' => 'tags',
'title' => get_string('tags'),
'description' => get_string('tagsdescprofile'),
'defaultvalue' => $view->get('tags'),
'help' => true,
);
if ($group) {
$grouproles = $USER->get('grouproles');
if ($grouproles[$group] == 'admin') {
$elements['locked'] = array(
'type' => 'switchbox',
'title' => get_string('Locked', 'view'),
'description' => get_string('lockedgroupviewdesc', 'view'),
'defaultvalue' => $view->get('locked'),
'disabled' => $view->get('type') == 'grouphomepage', // This page unreachable for grouphomepage anyway
);
}
}
if (!($group || $institution)) {
$default = $view->get('ownerformat');
if (!$default) {
$default = FORMAT_NAME_DISPLAYNAME;
}
$elements['ownerformat'] = array(
'type' => 'select',
'title' => get_string('ownerformat','view'),
'description' => get_string('ownerformatdescription','view'),
'options' => $ownerformatoptions,
'defaultvalue' => $default,
'rules' => array('required' => true),
);
}
if (get_config('allowanonymouspages')) {
$elements['anonymise'] = array(
'type' => 'switchbox',
'title' => get_string('anonymise','view'),
'description' => get_string('anonymisedescription','view'),
'defaultvalue' => $view->get('anonymise'),
);
}
$elements['submit'] = array(
'type' => 'submit',
'class' => 'btn-primary',
'value' => get_string('save'),
);
$templatedata = array(
'id' => $id,
'basiclayoutoptions' => $basiclayoutoptions,
'layoutoptions' => $layoutoptions,
'currentlayout' => $currentlayout,
'clnumcolumnsoptions' => $clnumcolumnsoptions,
'clnumcolumnsdefault' => $clnumcolumnsdefault,
'columnlayoutoptions' => $columnlayoutoptions,
'customlayoutid' => $defaultlayout->id,
'customlayout' => $defaultlayoutpreview->create_preview(),
'clwidths' => $clwidths,
'maxrows' => $maxrows
);
$layoutform = array(