Skip to content
Snippets Groups Projects
Commit fd49ac1d authored by David Siegfried's avatar David Siegfried
Browse files

remove obsolete code, refs #1121

Merge request studip/studip!879
parent 2e319c4d
No related branches found
No related tags found
No related merge requests found
...@@ -44,7 +44,7 @@ class RoomManagement_PlanningController extends AuthenticatedController ...@@ -44,7 +44,7 @@ class RoomManagement_PlanningController extends AuthenticatedController
$sidebar = Sidebar::get(); $sidebar = Sidebar::get();
$views = new ViewsWidget(); $views = new ViewsWidget();
if ($GLOBALS['user']->id && ($GLOBALS['user']->id != 'nobody')) { if ($GLOBALS['user']->id && ($GLOBALS['user']->id !== 'nobody')) {
$views->addLink( $views->addLink(
_('Standard Zeitfenster'), _('Standard Zeitfenster'),
URLHelper::getURL( URLHelper::getURL(
...@@ -82,7 +82,6 @@ class RoomManagement_PlanningController extends AuthenticatedController ...@@ -82,7 +82,6 @@ class RoomManagement_PlanningController extends AuthenticatedController
//Add clipboard widget: //Add clipboard widget:
$clipboard_widget = new RoomClipboardWidget(); $clipboard_widget = new RoomClipboardWidget();
$clipboard_widget->setReadonly(true);
$clipboard_widget->setApplyButtonTitle( $clipboard_widget->setApplyButtonTitle(
_('Anzeigen') _('Anzeigen')
); );
...@@ -382,7 +381,6 @@ class RoomManagement_PlanningController extends AuthenticatedController ...@@ -382,7 +381,6 @@ class RoomManagement_PlanningController extends AuthenticatedController
//Add clipboard widget: //Add clipboard widget:
$clipboard_widget = new RoomClipboardWidget(); $clipboard_widget = new RoomClipboardWidget();
$clipboard_widget->setReadonly(true);
$clipboard_widget->setApplyButtonTitle( $clipboard_widget->setApplyButtonTitle(
_('Anzeigen') _('Anzeigen')
); );
...@@ -1102,7 +1100,6 @@ class RoomManagement_PlanningController extends AuthenticatedController ...@@ -1102,7 +1100,6 @@ class RoomManagement_PlanningController extends AuthenticatedController
//Add clipboard widget: //Add clipboard widget:
$clipboard_widget = new RoomClipboardWidget(); $clipboard_widget = new RoomClipboardWidget();
$clipboard_widget->setReadonly(true);
$clipboard_widget->setApplyButtonTitle( $clipboard_widget->setApplyButtonTitle(
_('Anzeigen') _('Anzeigen')
); );
......
...@@ -10,9 +10,8 @@ ...@@ -10,9 +10,8 @@
*/ */
class ClipboardWidget extends SidebarWidget class ClipboardWidget extends SidebarWidget
{ {
protected $allowed_item_class;
protected $draggable_items; protected $draggable_items;
protected $current_selected_items = [];
/** /**
* clipboard_widget_id is required in the case that multiple * clipboard_widget_id is required in the case that multiple
...@@ -49,7 +48,7 @@ class ClipboardWidget extends SidebarWidget ...@@ -49,7 +48,7 @@ class ClipboardWidget extends SidebarWidget
//Check if all allowed item classes are SimpleORMap objects //Check if all allowed item classes are SimpleORMap objects
//and if the classes implement the StudipItem interface: //and if the classes implement the StudipItem interface:
foreach ($allowed_item_classes as $class) { foreach ($allowed_item_classes as $class) {
if (!is_subclass_of($class, 'StudipItem', true)) { if (!is_subclass_of($class, 'StudipItem')) {
throw new InvalidArgumentException( throw new InvalidArgumentException(
sprintf( sprintf(
'The class %s does not implement the StudipItem interface which is required for clipboard items!', 'The class %s does not implement the StudipItem interface which is required for clipboard items!',
...@@ -66,17 +65,14 @@ class ClipboardWidget extends SidebarWidget ...@@ -66,17 +65,14 @@ class ClipboardWidget extends SidebarWidget
$this->allowed_item_classes = $allowed_item_classes; $this->allowed_item_classes = $allowed_item_classes;
$this->template = 'sidebar/clipboard-widget'; $this->template = 'sidebar/clipboard-widget';
$this->title = _('Eigene Merkzettel'); $this->title = _('Eigene Merkzettel');
$this->readonly = false;
$this->apply_button_title = _('Hauptbereich aktualisieren'); $this->apply_button_title = _('Hauptbereich aktualisieren');
$this->clipboard_widget_id = md5(uniqid('clipboard_widget_id')); $this->clipboard_widget_id = md5(uniqid('clipboard_widget_id'));
$this->draggable_items = false;
$this->updateSessionVariables(); $this->updateSessionVariables();
$this->current_clipboard_id = $_SESSION['selected_clipboard_id']; $this->current_clipboard_id = $_SESSION['selected_clipboard_id'];
$this->current_selected_items = $_SESSION['selected_clipboard_items']; if (is_array($_SESSION['selected_clipboard_items'])) {
if (!is_array($this->current_selected_items)) { $this->current_selected_items = $_SESSION['selected_clipboard_items'];
$this->current_selected_items = [];
} }
$this->setId("ClipboardWidget_{$this->clipboard_widget_id}"); $this->setId("ClipboardWidget_{$this->clipboard_widget_id}");
...@@ -84,14 +80,6 @@ class ClipboardWidget extends SidebarWidget ...@@ -84,14 +80,6 @@ class ClipboardWidget extends SidebarWidget
$this->addLayoutCSSClass('clipboard-widget'); $this->addLayoutCSSClass('clipboard-widget');
} }
public function clearSessionVariables()
{
$_SESSION['selected_clipboard_id'] = null;
$_SESSION['selected_clipboard_items'] = [];
}
/** /**
* Updates session variables if a special POST request is made. * Updates session variables if a special POST request is made.
*/ */
...@@ -109,37 +97,6 @@ class ClipboardWidget extends SidebarWidget ...@@ -109,37 +97,6 @@ class ClipboardWidget extends SidebarWidget
} }
} }
/**
* Enables clipboard items to be dragged to the main area of the page.
*/
public function enableDraggableItems()
{
$this->draggable_items = true;
}
/**
* Disables the dragging of clipboard items.
*/
public function disableDraggableItems()
{
$this->draggable_items = false;
}
public function setReadonly($readonly = false)
{
$this->readonly = (bool)$readonly;
}
public function isReadonly()
{
return $this->readonly;
}
public function setApplyButtonTitle($title = '') public function setApplyButtonTitle($title = '')
{ {
if ($title) { if ($title) {
...@@ -147,19 +104,11 @@ class ClipboardWidget extends SidebarWidget ...@@ -147,19 +104,11 @@ class ClipboardWidget extends SidebarWidget
} }
} }
public function getApplyButtonTitle()
{
return $this->apply_button_title;
}
public function getClipboardWidgetId() public function getClipboardWidgetId()
{ {
return $this->clipboard_widget_id; return $this->clipboard_widget_id;
} }
public function render($variables = []) public function render($variables = [])
{ {
$clipboards = Clipboard::getClipboardsForUser( $clipboards = Clipboard::getClipboardsForUser(
...@@ -177,7 +126,6 @@ class ClipboardWidget extends SidebarWidget ...@@ -177,7 +126,6 @@ class ClipboardWidget extends SidebarWidget
'allowed_item_classes' => $this->allowed_item_classes, 'allowed_item_classes' => $this->allowed_item_classes,
'clipboard_widget_id' => $this->clipboard_widget_id, 'clipboard_widget_id' => $this->clipboard_widget_id,
'draggable_items' => $this->draggable_items, 'draggable_items' => $this->draggable_items,
'readonly' => $this->readonly,
'apply_button_title' => $this->apply_button_title, 'apply_button_title' => $this->apply_button_title,
'elements' => $this->elements, 'elements' => $this->elements,
'selected_clipboard_id' => $this->current_clipboard_id, 'selected_clipboard_id' => $this->current_clipboard_id,
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
<? endforeach ?> <? endforeach ?>
<? endif ?> <? endif ?>
</select> </select>
<? if (!$readonly): ?>
<input class="clipboard-name invisible" type="text" name="clipboard_name" value=""> <input class="clipboard-name invisible" type="text" name="clipboard_name" value="">
<?= Icon::create('edit')->asInput( <?= Icon::create('edit')->asInput(
[ [
...@@ -44,7 +42,6 @@ ...@@ -44,7 +42,6 @@
'data-confirm-message' => _('Sind Sie sicher?') 'data-confirm-message' => _('Sind Sie sicher?')
] ]
) ?> ) ?>
<? endif ?>
</div> </div>
<div class="clipboard-area-container"> <div class="clipboard-area-container">
<? if ($clipboards): ?> <? if ($clipboards): ?>
...@@ -74,7 +71,6 @@ ...@@ -74,7 +71,6 @@
[ [
'item' => $item, 'item' => $item,
'draggable_items' => $draggable_items, 'draggable_items' => $draggable_items,
'readonly' => $readonly,
'checkbox_id' => $checkbox_id 'checkbox_id' => $checkbox_id
] ]
) ?> ) ?>
...@@ -98,17 +94,15 @@ ...@@ -98,17 +94,15 @@
<?= htmlReady($item['name']) ?> <?= htmlReady($item['name']) ?>
</label> </label>
</td> </td>
<? if (!$readonly): ?> <td class="actions">
<td class="actions"> <?= Icon::create('trash')->asInput(
<?= Icon::create('trash')->asInput( [
[ 'title' => sprintf(_('%s löschen.'), htmlReady($item['name'])),
'title' => sprintf(_('%s löschen.'), htmlReady($item['name'])), 'data-confirm-message' => _('Sind Sie sicher?'),
'data-confirm-message' => _('Sind Sie sicher?'), 'class' => 'text-bottom clipboard-item-remove-button'
'class' => 'text-bottom clipboard-item-remove-button' ]
] ) ?>
) ?> </td>
</td>
<? endif ?>
</tr> </tr>
<? endif ?> <? endif ?>
<? endforeach ?> <? endforeach ?>
...@@ -138,15 +132,13 @@ ...@@ -138,15 +132,13 @@
value="" value=""
class="item-id"> class="item-id">
</td> </td>
<? if (!$readonly): ?> <td class="item-actions">
<td class="item-actions"> <?= Icon::create('trash')->asInput(
<?= Icon::create('trash')->asInput( [
[ 'class' => 'text-bottom clipboard-item-remove-button'
'class' => 'text-bottom clipboard-item-remove-button' ]
] ) ?>
) ?> </td>
</td>
<? endif ?>
</tr> </tr>
<? endif ?> <? endif ?>
</table> </table>
...@@ -195,13 +187,4 @@ ...@@ -195,13 +187,4 @@
<? endif ?> <? endif ?>
</table> </table>
</div> </div>
<? if ($readonly): ?>
<?= \Studip\Button::create(
$apply_button_title,
'clipboard_update_session_special_action',
[
'class' => 'apply-button'
]
) ?>
<? endif ?>
</form> </form>
...@@ -19,31 +19,29 @@ ...@@ -19,31 +19,29 @@
<? endforeach; ?> <? endforeach; ?>
</ul> </ul>
<? if (!$readonly): ?> <form class="default new-clipboard-form"
<form class="default new-clipboard-form" action="<?= URLHelper::getLink(
action="<?= URLHelper::getLink( 'dispatch.php/clipboard/add'
'dispatch.php/clipboard/add' )?>"
)?>" method="post">
method="post"> <?= CSRFProtection::tokenTag() ?>
<?= CSRFProtection::tokenTag() ?> <input type="hidden" name="allowed_item_class"
<input type="hidden" name="allowed_item_class" value="<?= htmlReady($allowed_item_class) ?>">
value="<?= htmlReady($allowed_item_class) ?>"> <input type="hidden" name="widget_id"
<input type="hidden" name="widget_id" value="<?= htmlReady($clipboard_widget_id) ?>">
value="<?= htmlReady($clipboard_widget_id) ?>"> <label>
<label> <?= _('Merkzettel hinzufügen') ?>
<?= _('Merkzettel hinzufügen') ?> <?= tooltipIcon(_('Geben Sie bitte einen Namen ein und klicken Sie auf das Plus-Symbol um einen neuen Merkzettel zu erstellen.')) ?>
<?= tooltipIcon(_('Geben Sie bitte einen Namen ein und klicken Sie auf das Plus-Symbol um einen neuen Merkzettel zu erstellen.')) ?> <input type="text" name="name" placeholder="<?= _('Name des neuen Merkzettels') ?>">
<input type="text" name="name" placeholder="<?= _('Name des neuen Merkzettels') ?>" </label>
</label>
<?= Icon::create( <?= Icon::create(
'add', 'add',
Icon::ROLE_CLICKABLE, Icon::ROLE_CLICKABLE,
[ 'title' => _('Hinzufügen')])->asInput([ [ 'title' => _('Hinzufügen')])->asInput([
'name' => 'save', 'name' => 'save',
'id' => 'add-clipboard-button', 'id' => 'add-clipboard-button',
'class' => 'middle', 'class' => 'middle',
'disabled' => 'disabled' 'disabled' => 'disabled'
]) ?> ]) ?>
</form> </form>
<? endif ?>
...@@ -66,13 +66,11 @@ if (!$item) { ...@@ -66,13 +66,11 @@ if (!$item) {
] ]
)?> )?>
</a> </a>
<? if (!$readonly): ?> <?= Icon::create('trash')->asInput(
<?= Icon::create('trash')->asInput( [
[ 'data-confirm-message' => _('Sind Sie sicher?'),
'data-confirm-message' => _('Sind Sie sicher?'), 'class' => 'text-bottom clipboard-item-remove-button'
'class' => 'text-bottom clipboard-item-remove-button' ]
] ) ?>
) ?>
<? endif ?>
</td> </td>
</tr> </tr>
...@@ -20,30 +20,28 @@ ...@@ -20,30 +20,28 @@
<? endforeach; ?> <? endforeach; ?>
</ul> </ul>
</div> </div>
<? if (!$readonly): ?> <form class="default new-clipboard-form"
<form class="default new-clipboard-form" action="<?= URLHelper::getLink(
action="<?= URLHelper::getLink( 'dispatch.php/clipboard/add'
'dispatch.php/clipboard/add' )?>"
)?>" method="post">
method="post"> <?= CSRFProtection::tokenTag() ?>
<?= CSRFProtection::tokenTag() ?> <input type="hidden" name="allowed_item_class"
<input type="hidden" name="allowed_item_class" value="<?= htmlReady($allowed_item_class) ?>">
value="<?= htmlReady($allowed_item_class) ?>"> <input type="hidden" name="widget_id"
<input type="hidden" name="widget_id" value="<?= htmlReady($clipboard_widget_id) ?>">
value="<?= htmlReady($clipboard_widget_id) ?>"> <label>
<label> <?= _('Raumgruppe hinzufügen') ?>
<?= _('Raumgruppe hinzufügen') ?> <?= tooltipIcon(_('Geben Sie bitte einen Namen ein und klicken Sie auf das Plus-Symbol um eine neue Raumgruppe zu erstellen.')) ?>
<?= tooltipIcon(_('Geben Sie bitte einen Namen ein und klicken Sie auf das Plus-Symbol um eine neue Raumgruppe zu erstellen.')) ?> <input type="text" name="name" placeholder="<?= _('Name der neuen Raumgruppe') ?>">
<input type="text" name="name" placeholder="<?= _('Name der neuen Raumgruppe') ?>">
<?= Icon::create('add', Icon::ROLE_CLICKABLE, <?= Icon::create('add', Icon::ROLE_CLICKABLE,
[ 'title' => _('Hinzufügen')])->asInput([ [ 'title' => _('Hinzufügen')])->asInput([
'name' => 'save', 'name' => 'save',
'id' => 'add-clipboard-button', 'id' => 'add-clipboard-button',
'class' => 'middle', 'class' => 'middle',
'disabled' => 'disabled' 'disabled' => 'disabled'
]) ?> ]) ?>
</label> </label>
</form> </form>
<? endif ?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment