Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#579 [Session] add: move content middle of page #581

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion class/session.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class Session extends SaturneObject
'label' => ['type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 70, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2, 'validate' => 1, 'autofocusoncreate' => 1],
'date_start' => ['type' => 'datetime', 'label' => 'DateStart', 'enabled' => 1, 'position' => 110, 'notnull' => 1, 'visible' => 1],
'date_end' => ['type' => 'datetime', 'label' => 'DateEnd', 'enabled' => 1, 'position' => 120, 'notnull' => 1, 'visible' => 1],
'content' => ['type' => 'html', 'label' => 'Content', 'enabled' => 1, 'position' => 140, 'notnull' => 1, 'visible' => 3, 'validate' => 1],
'content' => ['type' => 'html', 'label' => 'Content', 'enabled' => 1, 'position' => 140, 'notnull' => 1, 'visible' => 0, 'validate' => 1],
'type' => ['type' => 'varchar(128)', 'label' => 'Type', 'enabled' => 1, 'position' => 120, 'notnull' => 1, 'visible' => 0],
'duration' => ['type' => 'duration', 'label' => 'Duration', 'enabled' => 1, 'position' => 130, 'notnull' => 0, 'visible' => 1],
'note_public' => ['type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 150, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => 1],
Expand Down
54 changes: 53 additions & 1 deletion view/session/session_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,17 @@
print '</form>';
}

if ($action == 'set_content' && $user->hasRight("dolimeet", "trainingsession", "write")) {
if (!GETPOST('cancel')) {
$object->content = GETPOST('content', 'restricthtml');
$result = $object->setValueFrom('content', $object->content);

if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
}

// Part to show record.
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
$res = $object->fetch_optionals();
Expand Down Expand Up @@ -458,10 +469,51 @@
unset($object->fields['fk_project']); // Hide field already shown in banner.
unset($object->fields['fk_soc']); // Hide field already shown in banner.
unset($object->fields['fk_contrat']); // Hide field already shown in banner.

// Common attributes.
require_once DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';

if ($user->hasRight("dolimeet", "trainingsession", "write") && $action == 'edit_content') {
print '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
print '<input type="hidden" name="token" value="' . newToken() . '">';
print '<input type="hidden" name="id" value="' . $object->id . '">';
print '<input type="hidden" name="object_type" value="' . $objectType . '">';
print '<input type="hidden" name="action" value="set_content">';
}

print '<tr class="liste_titre trforfield"><td class="nowrap titlefield">';
print $langs->trans("Content");
print '</td><td>';
if ($user->hasRight("dolimeet", "trainingsession", "write")) {
print '<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=edit_content&token=' . newToken() . '&id=' . $object->id . '&object_type=' . $objectType . '">' . img_edit($langs->trans('Modify')) . '</a>';
}
print '</td></tr>';

print '<tr>';
print '<td colspan="2">';
if ($user->hasRight("dolimeet", "trainingsession", "write") && $action == 'edit_content') {
$content = GETPOSTISSET('content') ? GETPOST('content', 'restricthtml') : $object->content;
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('content', $content, '', 250, 'dolibarr_notes', 'In', false, true, isModEnabled('fckeditor'), ROWS_5, '90%');
$doleditor->Create();
} else {
print '<div class="longmessagecut">';
print dolPrintHTML($object->content);
print '</div>';
}
if ($user->hasRight("dolimeet", "trainingsession", "write") && $action == 'edit_content') {
print '<div class="center">';
print '<input type="submit" class="button button-edit" value="' . $langs->trans('Modify') . '">';
print '<input type="submit" class="button button-cancel" name="cancel" value="' . $langs->trans("Cancel") . '">';
print '</div>';
}
print '</td>';
print '</tr>';

if ($user->hasRight("dolimeet", "trainingsession", "write") && $action == 'edit_content') {
print '</form>';
}

// Categories
if ($conf->categorie->enabled) {
print '<tr><td class="valignmiddle">' . $langs->trans('Categories') . '</td><td>';
Expand Down