diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2023-03-22 12:00:29 +0000 |
|---|---|---|
| committer | David Siegfried <david.siegfried@uni-vechta.de> | 2023-03-22 12:00:29 +0000 |
| commit | b8ac06e96379c20d55009144c580089a0a7404aa (patch) | |
| tree | c2463ed506d31a13435bea4abef6c3ba59ad22d3 /app | |
| parent | 3dcee65137d7c25129c93a2f197084e2e9c8ab2f (diff) | |
remove smileys, fixes #2403
Closes #2403
Merge request studip/studip!1599
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/admin/smileys.php | 320 | ||||
| -rw-r--r-- | app/controllers/smileys.php | 131 | ||||
| -rw-r--r-- | app/views/admin/smileys/edit.php | 63 | ||||
| -rw-r--r-- | app/views/admin/smileys/index.php | 92 | ||||
| -rw-r--r-- | app/views/admin/smileys/statistics.php | 21 | ||||
| -rw-r--r-- | app/views/admin/smileys/upload.php | 46 | ||||
| -rw-r--r-- | app/views/course/forum/index/_post.php | 3 | ||||
| -rw-r--r-- | app/views/course/forum/index/_smiley_favorites.php | 27 | ||||
| -rw-r--r-- | app/views/smileys/index.php | 117 | ||||
| -rw-r--r-- | app/views/smileys/picker.php | 77 |
10 files changed, 0 insertions, 897 deletions
diff --git a/app/controllers/admin/smileys.php b/app/controllers/admin/smileys.php deleted file mode 100644 index 7b4a774..0000000 --- a/app/controllers/admin/smileys.php +++ /dev/null @@ -1,320 +0,0 @@ -<?php -/** - * smileys.php - controller class for the smileys administration - * - * 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. - * - * @author Jan-Hendrik Willms <tleilax+studip@gmail.com> - * @author Tobias Thelen <tthelen@uos.de> - * @author Jens Schmelzer <jens.schmelzer@fh-jena.de> - * @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2 - * @category Stud.IP - * @package smiley - * @since 2.3 - */ -class Admin_SmileysController extends AuthenticatedController -{ - /** - * Common tasks for all actions. - */ - public function before_filter(&$action, &$args) - { - parent::before_filter($action, $args); - - // user must have root permission - $GLOBALS['perm']->check('root'); - - // set navigation - Navigation::activateItem('/admin/config/smileys'); - - //pagelayout - PageLayout::setTitle(_('Verwaltung der Smileys')); - } - - /** - * Administrtion view for smileys - */ - public function index_action() - { - $this->view = Request::option('view', Smiley::getFirstUsedCharacter() ?: 'a'); - $this->smileys = Smiley::getGrouped($this->view); - $this->favorites_enabled = SmileyFavorites::isEnabled(); - - $this->setSidebar($this->view); - } - - /** - * Displays edit form and performs according actions upon submit - * - * @param int $id Id of the smiley to edit - * @param String $view View to return to after editing - */ - public function edit_action($id, $view) - { - PageLayout::setTitle(_('Smiley bearbeiten')); - - $smiley = Smiley::getById($id); - - if (Request::submitted('edit')) { - $success = true; - - $name = Request::get('name', $smiley->name); - if ($smiley->name != $name) { // rename smiley - if (Smiley::getByName($name)->id) { - $error = sprintf(_('Es existiert bereits eine Datei mit dem Namen "%s".'), $name . '.gif'); - PageLayout::postError($error); - $success = false; - } elseif (!$smiley->rename($name)) { - $error = sprintf(_('Die Datei "%s" konnte nicht umbenannt werden.'), $smiley->name . '.gif'); - PageLayout::postError($error); - $success = false; - } else { - PageLayout::postSuccess(_('Smiley erfolgreich umbenannt.')); - } - } - - $short = Request::get('short', $smiley->short); - if ($smiley->short != $short) { // rename short - if (Smiley::getByShort($short)->id) { - $error = sprintf(_('Es gibt bereits einen Smileys mit dem Kürzel "%s".'), $short); - PageLayout::postError($error); - $success = false; - } else { - $smiley->short = $short; - $smiley->store(); - PageLayout::postSuccess(_('Kürzel erfolgreich geändert.')); - } - } - - if ($success) { - $this->redirect('admin/smileys?view=' . $smiley->name[0] . '#smiley' . $smiley->id); - } else { - $this->redirect($this->url_for('admin/smileys/edit', $id, $view)); - } - } - - $this->smiley = $smiley; - $this->view = $view; - } - - /** - * Deletes a smiley - * - * @param int $id Id of the smiley to delete - * @param String $view View to return to after deletion - * @todo needs some of confirmation - */ - public function delete_action($id, $view) - { - if ($id == 'bulk') { - $ids = Request::intArray('smiley_id'); - Smiley::remove($ids); - $message = sprintf(_('%d Smiley(s) erfolgreich gelöscht.'), count($ids)); - } else { - $smiley = Smiley::getById($id); - $name = $smiley->name; - $smiley->delete(); - - $message = sprintf(_('Smiley "%s" erfolgreich gelöscht.'), $name); - } - PageLayout::postSuccess($message); - - $this->redirect('admin/smileys?view=' . $view); - } - - /** - * Counts all smiley occurences systemwide and updates the smileys' counters - * - * @param String $view View to return to - */ - public function count_action($view) - { - $updated = Smiley::updateUsage(); - - $message = sprintf(_('%d Zählerstände aktualisiert'), $updated); - $msg = $updated > 0 - ? MessageBox::success($message) - : MessageBox::info($message); - PageLayout::postMessage($msg); - - $this->redirect('admin/smileys?view=' . $view); - } - - /** - * Refreshes the smiley table by aligning it with the file system - * - * @param String $view View to return to - */ - public function refresh_action($view) - { - $result = Smiley::refresh(); - - $message = sprintf(_('%u Operationen wurden durchgeführt.'), array_sum($result)); - $details = [ - sprintf(_('%d Smileys aktualisiert'), $result['update']), - sprintf(_('%d Smileys eingefügt'), $result['insert']), - sprintf(_('%d Smileys gelöscht'), $result['delete']) - ]; - if (isset($result['favorites'])) { - $details[] = sprintf(_('%d Favoriten geändert'), $result['favorites']); - } - $msg = array_sum($result) > 0 - ? MessageBox::success($message, $details, true) - : MessageBox::info($message, $details, true); - PageLayout::postMessage($msg); - - $this->redirect('admin/smileys?view=' . $view); - } - - /** - * Displays upload form and processes the upload command - * - * @param String $view View to return to if canceled - */ - public function upload_action($view) - { - PageLayout::setTitle(_('Neues Smiley hochladen')); - - if (!Request::submitted('upload')) { - $this->view = $view; - return; - } - - // File submitted? - $upload = $_FILES['smiley_file']; - if (empty($upload) || empty($upload['name'])) { - $error = _('Sie haben keine Datei zum Hochladen ausgewählt!'); - PageLayout::postError($error); - return; - } - - // Error upon upload? - if ($upload['error']) { - $error = _('Es gab einen Fehler beim Upload. Bitte versuchen Sie es erneut.'); - PageLayout::postError($error); - return; - } - - // Correct mime-type? - $no_image = !empty($upload['type']) && mb_substr($upload['type'], 0, 5) != 'image'; - if (!$no_image) { - $image_info = getimagesize($upload['tmp_name']); // Used later on! - $no_gif = $image_info[2] != IMAGETYPE_GIF; - } - if ($no_image) { - $error = _('Die Datei ist keine Bilddatei'); - PageLayout::postError($error); - return; - } - - // Extract smiley information - $smiley_file = $upload['name']; - $smiley_name = mb_substr($smiley_file, 0, mb_strrpos($smiley_file, '.')); - - // Replace smiley? - $smiley = Smiley::getByName($smiley_name); - $replace = Request::int('replace'); - if ($smiley->id && !$replace) { - $error = sprintf(_('Es ist bereits eine Bildatei mit dem Namen "%s" vorhanden.'), $smiley_file); - PageLayout::postError($error); - return; - } - - // Copy file into file system - $destination = Smiley::getFilename($smiley_file); - if (!move_uploaded_file($upload['tmp_name'], $destination)) { - $error = _('Es ist ein Fehler beim Kopieren der Datei aufgetreten. Das Bild wurde nicht hochgeladen!'); - PageLayout::postError($error); - return; - } - - // set permissions for uploaded file - chmod($destination, 0666 & ~umask()); - - // Import smiley into database - Smiley::refresh($destination); - - // Output appropriate wurde message - $message = $replace - ? sprintf(_('Die Bilddatei "%s" wurde erfolgreich ersetzt.'), $smiley_file) - : sprintf(_('Die Bilddatei "%s" wurde erfolgreich hochgeladen.'), $smiley_file); - PageLayout::postSuccess($message); - - // Return to index and display the view the uploaded smiley is in - $this->redirect('admin/smileys?view=' . $smiley_file[0]); - } - - /** - * Extends this controller with neccessary infobox - * - * @param String $view Currently viewed group - */ - private function setSidebar($view) - { - $sidebar = Sidebar::Get(); - - // Render items - $factory = new Flexi_TemplateFactory($this->dispatcher->trails_root . '/views/admin/smileys/'); - - $actions = new ActionsWidget(); - $actions->addLink( - _('Neues Smiley hochladen'), - $this->url_for('admin/smileys/upload', $view), - Icon::create('add') - )->asDialog('size=auto'); - $actions->addLink( - _('Smileys zählen'), - $this->url_for('admin/smileys/count', $view), - Icon::create('code') - ); - $actions->addLink( - _('Tabelle aktualisieren'), - $this->url_for('admin/smileys/refresh', $view), - Icon::create('refresh') - ); - $actions->addLink( - _('Smiley-Übersicht öffnen'), - URLHelper::getLink('dispatch.php/smileys'), - Icon::create('smiley') - )->asDialog(); - $sidebar->addWidget($actions); - - $widget = new SelectWidget( - _('Filter'), - $this->url_for('admin/smileys/index'), - 'view' - ); - $group = new SelectGroupElement(_('Nach Buchstaben')); - foreach (Smiley::getUsedCharacters() as $character => $count) { - $option = new SelectElement($character, sprintf("%s (% 2u)", mb_strtoupper($character), $count)); - $option->setActive($view == $character); - $group->addElement($option); - } - $widget->addElement($group); - - $groups = [ - 'all' => _('Alle'), - 'top20' => _('Top 20'), - 'used' => _('Benutzte'), - 'none' => _('Nicht benutzte'), - 'short' => _('Nur mit Kürzel') - ]; - $group = new SelectGroupElement(_('Gruppiert')); - foreach ($groups as $key => $label) { - $option = new SelectElement($key, $label); - $option->setActive($view == $key); - $group->addElement($option); - } - $widget->addElement($group); - $sidebar->addWidget($widget); - - $widget = new SidebarWidget(); - $statistics = $factory->render('statistics', Smiley::getStatistics()); - $widget->setTitle(_('Statistiken')); - $widget->addElement(new WidgetElement($statistics)); - $sidebar->addWidget($widget); - } -} diff --git a/app/controllers/smileys.php b/app/controllers/smileys.php deleted file mode 100644 index 600645d..0000000 --- a/app/controllers/smileys.php +++ /dev/null @@ -1,131 +0,0 @@ -<?php -/** - * smileys.php - controller class for the smileys - * - * 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. - * - * @author Jan-Hendrik Willms <tleilax+studip@gmail.com> - * @author Tobias Thelen <tthelen@uos.de> - * @author Jens Schmelzer <jens.schmelzer@fh-jena.de> - * @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2 - * @category Stud.IP - * @package smiley - * @since 2.3 - */ -class SmileysController extends AuthenticatedController -{ - const GRID_WIDTH = 5; - const GRID_HEIGHT = 2; - - /** - * Common tasks for all actions. - */ - public function before_filter(&$action, &$args) - { - parent::before_filter($action, $args); - - PageLayout::setTitle(_('Smiley-Übersicht')); - - $this->favorites_activated = SmileyFavorites::isEnabled() - && $GLOBALS['user']->id != 'nobody'; - - if ($this->favorites_activated) { - $this->favorites = new SmileyFavorites($GLOBALS['user']->id); - $this->default = count($this->favorites->get()) > 0 - ? 'favorites' - : Smiley::getFirstUsedCharacter(); - } else { - $this->default = Smiley::getFirstUsedCharacter(); - } - } - - /** - * Displays (a subset of) the smileys in the system - * - * @param mixed $view Subset to display, defaults to favorites if enabled - */ - public function index_action($view = null) - { - $this->view = $view ?: $this->default; - - $this->characters = Smiley::getUsedCharacters(); - $this->statistics = Smiley::getStatistics(); - - // Redirect to index if favorites is selected but user is not logged in - if (!$this->favorites_activated and $this->view == 'favorites') { - $this->redirect('smileys'); - } - - $title = _('Smiley-Übersicht') . ' - ' . sprintf(_('%s Smileys vorhanden'), $this->statistics['count_all']); - PageLayout::setTitle($title); - - $this->smileys = $this->view == 'favorites' - ? Smiley::getByIds($this->favorites->get()) - : Smiley::getGrouped($this->view); - } - - /** - * Toggles whether a certain smiley is favored for the current user - * - * @param int $id Id of the smiley to favor/disfavor - * @param String $view View to return to - */ - public function favor_action($id, $view) - { - try { - $state = $this->favorites->toggle($id); - - $message = $state - ? _('Der Smiley wurde zu Ihren Favoriten hinzugefügt.') - : _('Der Smiley gehört nicht mehr zu Ihren Favoriten.'); - $msg_box = MessageBox::success($message); - } catch (OutOfBoundsException $e) { - $state = $this->favorites->contain($id); - $message = _('Maximale Favoritenzahl erreicht. Vielleicht sollten Sie mal ausmisten? :)'); - $msg_box = MessageBox::error($message); - } - - if (Request::isXhr()) { - $this->response->add_header('Content-Type', 'application/json'); - $this->render_text(json_encode([ - 'state' => $state, - 'message' => $msg_box, - ])); - } else { - PageLayout::postMessage($msg_box); - $this->redirect('smileys/index/' . $view . '#smiley' . $id); - } - } - - /** - * Back end for the smiley picker javascript module. - * Renders a list of smileys very similar to the index action but - * unfortunately still to different to be combined. - * - * @param mixed $view Subset to display, defaults to favorites if enabled - * @param int $page Section of subset to display - */ - public function picker_action($view = null, $page = 0) - { - $per_page = self::GRID_WIDTH * self::GRID_HEIGHT; - - $this->view = $view ?: ($this->default === 'favorites' ? 'favorites' : 'all'); - $smileys = $this->view == 'favorites' - ? Smiley::getByIds($this->favorites->get()) - : Smiley::getGrouped($this->view); - - $this->page = $page; - $this->pages = floor(count($smileys) / $per_page); - - array_walk($smileys, function ($smiley) { - $smiley->link = $smiley->getURL(); - $smiley->html = $smiley->getImageTag(); - }); - $this->smileys = array_slice($smileys, $page * $per_page, $per_page); - - $this->characters = Smiley::getUsedCharacters(); - } -} diff --git a/app/views/admin/smileys/edit.php b/app/views/admin/smileys/edit.php deleted file mode 100644 index ebe9883..0000000 --- a/app/views/admin/smileys/edit.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php -/** - * @var Admin_SmileysController $controller - * @var Smiley $smiley - * @var string $view - */ -use Studip\Button, Studip\LinkButton; -?> - -<form action="<?= $controller->url_for('admin/smileys/edit', $smiley->id, $view) ?>" - method="post" enctype="multipart/form-data"> - <?= CSRFProtection::tokenTag() ?> - - <table class="default"> - <thead class="hide-in-dialog"> - <tr> - <th colspan="2"><b><?= _('Smiley bearbeiten') ?></b></th> - </tr> - </thead> - <tbody> - <tr> - <td><?= _('Smiley:')?></td> - <td align="center"><?= $smiley->getImageTag() ?></td> - </tr> - <tr> - <td> - <label for="name"><?= _('Name')?></label> - </td> - <td> - <input type="text" name="name" id="name" required pattern="[A-Za-z0-9-_]+" - value="<?= Request::option('name', $smiley->name) ?>"> - <br> - <small><?= _('Erlaubte Zeichen:') ?> a-z 0-9 – _</small> - </td> - </tr> - <tr> - <td> - <label for="short"><?= _('Kürzel')?></label> - </td> - <td> - <input type="text" name="short" id="short" - value="<?= Request::option('short', $smiley->short) ?>"> - </td> - </tr> - <tr> - <td><?= _('Erstellt') ?></td> - <td><?= date('d.m.Y H:i:s', $smiley->mkdate) ?></td> - </tr> - <tr> - <td><?= _('Geändert') ?></td> - <td><?= date('d.m.Y H:i:s', $smiley->chdate) ?></td> - </tr> - </tbody> - <tfoot data-dialog-button> - <tr> - <td colspan="2"> - <?= Button::createAccept(_('Speichern'), 'edit') ?> - <?= LinkButton::createCancel(_('Abbrechen'), $controller->url_for('admin/smileys?view=' . $view))?> - </td> - </tr> - </tfoot> - </table> -</form> diff --git a/app/views/admin/smileys/index.php b/app/views/admin/smileys/index.php deleted file mode 100644 index 44a51f7..0000000 --- a/app/views/admin/smileys/index.php +++ /dev/null @@ -1,92 +0,0 @@ -<?php -/** - * @var Admin_SmileysController $controller - * @var bool $favorites_enabled - * @var string $view - * @var Smiley[] $smileys - */ -?> -<form action="<?= $controller->action_link('admin/smileys/delete/bulk', $view) ?>" method="post"> - <?= CSRFProtection::tokenTag() ?> - - <table class="default"> - <colgroup> - <col style="width: 20px"> - <col> - <col> - <col style="width: 50px"> - <col> - <col style="width: 50px"> - <? if ($favorites_enabled): ?> - <col style="width: 50px"> - <? endif; ?> - <col style="width: 50px"> - </colgroup> - <thead> - <tr> - <th> </th> - <th><?= _('Smiley') ?></th> - <th><?= _('Smileyname') ?></th> - <th>Σ</th> - <th><?= _('Kürzel') ?></th> - <th>Σ</th> - <? if ($favorites_enabled): ?> - <th><?= _('Favoriten') ?></th> - <? endif; ?> - <th> </th> - </tr> - </thead> - <? if (empty($smileys)): ?> - <tbody> - <tr> - <td class="blank" colspan="<?= $favorites_enabled ? 8 : 7 ?>"> - <?= _('Keine Smileys vorhanden.') ?> - </td> - </tr> - </tbody> - <? else: ?> - <tbody> - <? foreach ($smileys as $smiley): ?> - <tr id="smiley<?= $smiley->id ?>"> - <td><input type="checkbox" name="smiley_id[]" value="<?= $smiley->id ?>"></td> - <td><?= $smiley->getImageTag() ?></td> - <td><?= htmlReady($smiley->name) ?></td> - <td><?= $smiley->count ?></td> - <? if ($smiley->short): ?> - <td class="separator"><?= htmlReady($smiley->short) ?></td> - <td><?= $smiley->short_count ?></td> - <? else: ?> - <td class="separator" colspan="2">-</td> - <? endif; ?> - <? if ($favorites_enabled): ?> - <td class="separator"><?= $smiley->fav_count ?></td> - <? endif; ?> - <td align="right"> - <a href="<?= $controller->url_for('admin/smileys/edit', $smiley->id, $view) ?>" - title="<?= htmlReady(sprintf(_('Smiley "%s" bearbeiten'), $smiley->name)) ?>" - data-dialog="size=auto"> - <?= Icon::create('edit') ?> - </a> - <a href="<?= $controller->url_for('admin/smileys/delete', $smiley->id, $view) ?>" - title="<?= htmlReady(sprintf(_('Smiley "%s" löschen'), $smiley->name)) ?>"> - <?= Icon::create('trash') ?> - </a> - </td> - </tr> - <? endforeach; ?> - </tbody> - <tfoot> - <tr> - <td> - <input class="middle" type="checkbox" data-proxyfor=":checkbox[name^=smiley_id]" - data-activates="button[name=bulk-delete]" - name="check_all" title="<?= _('Alle Benutzer auswählen') ?>"> - </td> - <td colspan="<?= $favorites_enabled ? 7 : 6 ?>"> - <?= Studip\Button::createCancel(_('Markierte löschen'), 'bulk-delete') ?> - </td> - </tr> - </tfoot> - <? endif; ?> - </table> -</form> diff --git a/app/views/admin/smileys/statistics.php b/app/views/admin/smileys/statistics.php deleted file mode 100644 index bdef017..0000000 --- a/app/views/admin/smileys/statistics.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -/** - * @var int $count_all - * @var int $count_used - * @var int $sum - * @var int $last_change - */ -?> -<dl class="smiley-statistics"> - <dt><?= _('Vorhanden') ?></dt> - <dd><?= $count_all ?></dd> - - <dt><?= _('Davon benutzt') ?></dt> - <dd><?= $count_used ?></dd> - - <dt><?= _('Smiley-Vorkommen') ?></dt> - <dd><?= $sum ?></dd> - - <dt><?= _('Letzte Änderung') ?></dt> - <dd><?= (!is_null($last_change) ? date('d.m.Y H:i:s', $last_change) : '')?></dd> -</dl> diff --git a/app/views/admin/smileys/upload.php b/app/views/admin/smileys/upload.php deleted file mode 100644 index c0d6c6b..0000000 --- a/app/views/admin/smileys/upload.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** - * @var Admin_SmileysController $controller - * @var string $view - */ - -use Studip\Button, Studip\LinkButton; -?> -<form action="<?= $controller->url_for('admin/smileys/upload', $view) ?>" - method="post" enctype="multipart/form-data"> - <?= CSRFProtection::tokenTag() ?> - - <table class="default"> - <thead class="hide-in-dialog"> - <tr> - <th colspan="2"><b><?= _('Neues Smiley hochladen') ?></b></th> - </tr> - </thead> - <tbody> - <tr> - <td> - <label for="replace"><?= _('existierende Datei überschreiben') ?></label> - </td> - <td> - <input type="checkbox" id="replace" name="replace" value="1"> - </td> - </tr> - <tr> - <td> - <label for="file"><?= _('Bilddatei auswählen') ?></label> - </td> - <td> - <input type="file" id="file" name="smiley_file" required> - </td> - </tr> - </tbody> - <tfoot data-dialog-button> - <tr> - <td colspan="2" align="center"> - <?= Button::createAccept(_('Hochladen'), 'upload') ?> - <?= LinkButton::createCancel(_('Abbrechen'), $controller->url_for('admin/smileys?view=' . $view))?> - </td> - </tr> - </tfoot> - </table> -</form> diff --git a/app/views/course/forum/index/_post.php b/app/views/course/forum/index/_post.php index 538b98d..d21b4ef 100644 --- a/app/views/course/forum/index/_post.php +++ b/app/views/course/forum/index/_post.php @@ -161,9 +161,6 @@ <span data-edit-topic="<?= $post['topic_id'] ?>" <?= $edit_posting == $post['topic_id'] ? '' : 'style="display: none;"' ?>> <dl class="postprofile"> <dt> - <? if (!Config::get()->WYSIWYG): ?> - <?= $this->render_partial('course/forum/index/_smiley_favorites', ['textarea_id' => $post['topic_id']]) ?> - <? endif; ?> </dt> </dl> </span> diff --git a/app/views/course/forum/index/_smiley_favorites.php b/app/views/course/forum/index/_smiley_favorites.php deleted file mode 100644 index fbe48b4..0000000 --- a/app/views/course/forum/index/_smiley_favorites.php +++ /dev/null @@ -1,27 +0,0 @@ -<? -$sm = new SmileyFavorites($GLOBALS['user']->id); -?> -<div class="smiley_favorites"> - <a href="<?= URLHelper::getLink('dispatch.php/smileys') ?>" data-dialog> - <?= _('Smileys') ?> - </a> | - <a href="<?= format_help_url("Basis.VerschiedenesFormat") ?>" target="new"><?= _("Formatierungshilfen") ?></a> - <br> - <? $smileys = Smiley::getByIds($sm->get()) ?> - <? if (!empty($smileys)) : ?> - <? foreach ($smileys as $smiley) : ?> - <img class="js" src="<?= $smiley->getUrl() ?>" data-smiley=" :<?= $smiley->name ?>: " - style="cursor: pointer;" onClick="STUDIP.Forum.insertSmiley('<?= $textarea_id ?>', this)"> - <? endforeach ?> - <? elseif ($GLOBALS['user']->id != 'nobody') : ?> - <span style="font-size: 1.2em" class="js"> - <br> - <?= _('Sie haben noch keine Smiley-Favoriten.') ?><br> - <br> - <a href="<?= URLHelper::getLink('dispatch.php/smileys') ?>" data-dialog> - <?= _('Fügen Sie welche hinzu!') ?> - </a> - </span> - <? endif ?> - <br> -</div> diff --git a/app/views/smileys/index.php b/app/views/smileys/index.php deleted file mode 100644 index 5860b95..0000000 --- a/app/views/smileys/index.php +++ /dev/null @@ -1,117 +0,0 @@ -<?php -use Studip\Button; - -// divide smiley array in equal chunks, spillover from left to right -$count = count($smileys); -$columns = min(3, ceil($count / 5)); - -$max = $columns ? floor($count / $columns) : 0; -$spillover = $columns ? $count % $columns : 0; - -$data = []; -for ($i = 0; $i < $columns; $i++) { - $num = $max + (int)($spillover > 0); - - $data[] = array_splice($smileys, 0, $num); - - $spillover -= 1; -} -$data = array_filter($data); -?> - -<ul class="smiley-tabs" role="navigation"> -<? if ($favorites_activated): ?> - <li class="favorites <? if ($view === 'favorites') echo 'current'; ?>"> - <a href="<?= $controller->url_for('smileys/index/favorites') ?>" data-dialog> - <?= _('Favoriten') ?> - </a> - </li> -<? endif; ?> -<? if (Smiley::getShort()): ?> - <li <? if ($view === 'short') echo 'class="current"'; ?>> - <a href="<?= $controller->url_for('smileys/index/short') ?>" data-dialog> - <?= _('Kürzel') ?> - </a> - </li> -<? endif; ?> - <li <? if ($view === 'all') echo 'class="current"'; ?>> - <a href="<?= $controller->url_for('smileys/index/all') ?>" data-dialog> - <?= _('Alle') ?> - </a> - </li> -<? foreach (array_keys($characters) as $char): ?> - <li <? if ($view === $char) echo 'class="current"'; ?>> - <a href="<?= $controller->url_for('smileys/index', $char) ?>" data-dialog> - <?= mb_strtoupper($char) ?> - </a> - </li> -<? endforeach; ?> -</ul> - -<div class="clear"></div> - -<? if (!$count): ?> - <?= MessageBox::info($view === 'favorites' - ? _('Keine Favoriten vorhanden.') - : _('Keine Smileys vorhanden.')) ?> -<? else: ?> - <table class="smiley-container"> - <tr> - <? foreach ($data as $smileys): ?> - <td valign="top" align="center"> - - <table class="smiley-column default"> - <colgroup> - <col> - <col width="25%"> - <col width="25%"> - <? if ($favorites_activated): ?> - <col width="32px"> - <? endif; ?> - </colgroup> - <thead> - <tr> - <th><?= _('Bild') ?></th> - <th><?= _('Code') ?></th> - <th><?= _('Kürzel') ?></th> - <? if ($favorites_activated): ?> - <th class="actions"> - <abbr title="<?= _('Favorit') ?>"> - <?= Icon::create('star', 'info')->asImg() ?> - </abbr> - </th> - <? endif; ?> - </tr> - </thead> - <tbody> - <? foreach ($smileys as $smiley): ?> - <tr id="smiley<?= $smiley->id ?>"> - <td class="smiley-icon"> - <a name="smiley<?= $smiley->id ?>"></a> - <?= $smiley->getImageTag() ?> - </td> - <td><?= sprintf(':%s:', $smiley->name) ?></td> - <td><?= htmlReady($smiley->short) ?></td> - <? if ($favorites_activated): ?> - <td class="actions"> - <a href="<?= $controller->url_for('smileys/favor', $smiley->id, $view) ?>" - class="smiley-toggle <?= $favorites->contain($smiley->id) ? 'favorite' : '' ?>"> - <? if ($favorites->contain($smiley->id)): ?> - <?= _('Als Favorit entfernen') ?> - <? else: ?> - <?= _('Als Favorit markieren') ?> - <? endif; ?> - </a> - </td> - <? endif; ?> - </tr> - <? endforeach; ?> - </tbody> - </table> - - </td> - <? endforeach; ?> - </tr> - </table> -<? endif; ?> - diff --git a/app/views/smileys/picker.php b/app/views/smileys/picker.php deleted file mode 100644 index 8093fb5..0000000 --- a/app/views/smileys/picker.php +++ /dev/null @@ -1,77 +0,0 @@ -<div class="smiley-picker"> - <table class="navigation top"> - <tr> - <? if ($favorites_activated && count($favorites->get()) > 0): ?> - <td> - <a href="<?= $controller->url_for('smileys/picker/favorites') ?>"> - <?= Icon::create('star', $view === 'favorites' ? 'attention' : 'clickable', ['title' => _('Favoriten')]) ?> - </a> - </td> - <? endif; ?> - <td style="text-align: right;"> - <a href="<?= $controller->url_for('smileys/picker/all') ?>"> - <?= Icon::create('smiley', $view === 'all' ? 'attention' : 'clickable', ['title' => _('alle')]) ?> - </a> - </td> - <? for ($i = 0; $i < 26; $i++): - $char = chr(ord('a') + $i); - ?> - <td <? if ($view === $char) echo 'class="active"'; ?>> - <? if (isset($characters[$char])): ?> - <a href="<?= $controller->url_for('smileys/picker/'. $char) ?>"> - <?= mb_strtoupper($char) ?> - </a> - <? else: ?> - <?= $char ?> - <? endif; ?> - </td> - <? endfor; ?> - </tr> - </table> - - <div class="smileys"> -<? foreach (array_pad($smileys, $controller::GRID_WIDTH * $controller::GRID_HEIGHT, null) as $smiley): ?> - <? if ($smiley === null): ?> - <span class="empty"></span> - <? else: ?> - <a class="smiley" href="#" data-code="<?= $smiley->short ?: (':' . $smiley->name . ':') ?>"> - <?= $smiley->html ?> - </a> - <? endif; ?> -<? endforeach; ?> - </div> - - <table class="navigation bottom"> - <tr> - <td> - <? if ($page > 0): ?> - <a href="<?= $controller->url_for('smileys/picker/' . $view . '/0') ?>"> - <?= Icon::create('arr_eol-left', 'clickable')->asImg() ?> - </a> - <a href="<?= $controller->url_for('smileys/picker/' . $view . '/' . ($page - 1)) ?>"> - <?= Icon::create('arr_1left', 'clickable')->asImg() ?> - </a> - <? else: ?> - <?= Icon::create('arr_eol-left', 'inactive')->asImg() ?> - <?= Icon::create('arr_1left', 'inactive')->asImg() ?> - <? endif; ?> - </td> - <td style="text-align: center;"> - <?= sprintf('Seite %u von %u', $page + 1, $pages + 1) ?> - </td> - <td style="text-align: right;"> - <? if ($page < $pages): ?> - <a href="<?= $controller->url_for('smileys/picker/' . $view . '/' . ($page + 1)) ?>"> - <?= Icon::create('arr_1right', 'clickable')->asImg() ?> - </a> - <a href="<?= $controller->url_for('smileys/picker/' . $view . '/' . $pages) ?>"> - <?= Icon::create('arr_eol-right', 'clickable')->asImg() ?> - </a> - <? else: ?> - <?= Icon::create('arr_1right', 'inactive')->asImg() ?> - <?= Icon::create('arr_eol-right', 'inactive')->asImg() ?> - <? endif; ?> - </td> - </tr> - </table> -</div>
\ No newline at end of file |
