diff options
author | René Gieling <github@dartcafe.de> | 2017-10-21 15:41:34 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-21 15:41:34 +0300 |
commit | 540e09bcade129f22e2682041dcf4e704385ee79 (patch) | |
tree | 0dc96520deae6a36083dc33f4cceaec40d61a7dc /templates/create.tmpl.php | |
parent | 4788739b6470cebd2ca32b6f74600952738dcfca (diff) |
Code cleaning (#185)
* Update no.acc.tmpl.php
* update for scutinizer
* Update PageController.php
* Update PageController.php
* coding style
* dito
* more fixes
* update
* Added scrutinizer config
* Coding style
Adopting style guide from docs.nextcloud.com
* More changes
* disabled external code coverage
* changes
* Changes
* changes
* changes
* More changes
* Update to version 2.5.11
* Update .scrutinizer.yml
* Update .scrutinizer.yml
* created vendor
[ci skip]
* config
[skip scrutinizer] [skip ci]
* fix
[skip ci]
* Minor
* continuing
[skip ci]
* just a test
* removed unused function declarations
Commenting out some functions, which seem not to be used.
* css tests?
* again
* formatting
* removed comment
and converted spaces in tabs
Diffstat (limited to 'templates/create.tmpl.php')
-rw-r--r-- | templates/create.tmpl.php | 366 |
1 files changed, 184 insertions, 182 deletions
diff --git a/templates/create.tmpl.php b/templates/create.tmpl.php index 6d84ff52..1b7c178e 100644 --- a/templates/create.tmpl.php +++ b/templates/create.tmpl.php @@ -1,191 +1,193 @@ <?php - /** - * @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com> - * - * @author Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - - \OCP\Util::addStyle('polls', 'main'); - \OCP\Util::addStyle('polls', 'createpoll'); - \OCP\Util::addStyle('polls', 'jquery.datetimepicker'); - \OCP\Util::addScript('polls', 'create_edit'); - \OCP\Util::addScript('polls', 'jquery.datetimepicker.full.min'); - - $userId = $_['userId']; - $userMgr = $_['userMgr']; - $urlGenerator = $_['urlGenerator']; - $isUpdate = isset($_['poll']) && $_['poll'] !== null; - $isAnonymous = false; - $hideNames = false; - - if ($isUpdate) { - $poll = $_['poll']; - $isAnonymous = $poll->getIsAnonymous(); - $hideNames = $isAnonymous && $poll->getFullAnonymous(); - $dates = $_['dates']; - $chosen = '['; - foreach ($dates as $d) { - if ($poll->getType() == '0') { - $chosen .= strtotime($d->getDt()); - } else { - $chosen .= '"' . $d->getText() . '"'; - } - $chosen .= ','; - } - $chosen = trim($chosen, ','); - $chosen .= ']'; - $title = $poll->getTitle(); - $desc = $poll->getDescription(); - if ($poll->getExpire() !== null) { - $expireTs = strtotime($poll->getExpire()) - 60*60*24; //remove one day, which has been added to expire at the end of a day - $expireStr = date('d.m.Y', $expireTs); - } - $access = $poll->getAccess(); - $accessTypes = $access; - if ($access !== 'registered' && $access !== 'hidden' && $access !== 'public') { - $access = 'select'; - } - } + /** + * @copyright Copyright (c) 2017 Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com> + * + * @author Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + + \OCP\Util::addStyle('polls', 'main'); + \OCP\Util::addStyle('polls', 'createpoll'); + \OCP\Util::addStyle('polls', 'jquery.datetimepicker'); + \OCP\Util::addScript('polls', 'create_edit'); + \OCP\Util::addScript('polls', 'vendor/jquery.datetimepicker.full.min'); + + $userId = $_['userId']; + $userMgr = $_['userMgr']; + $urlGenerator = $_['urlGenerator']; + $isUpdate = isset($_['poll']) && $_['poll'] != null; + $isAnonymous = false; + $hideNames = false; + + if ($isUpdate) { + $poll = $_['poll']; + $isAnonymous = $poll->getIsAnonymous(); + $hideNames = $isAnonymous && $poll->getFullAnonymous(); + $dates = $_['dates']; + $chosen = '['; + foreach ($dates as $d) { + if ($poll->getType() == '0') { + $chosen .= strtotime($d->getDt()); + } else { + $chosen .= '"' . $d->getText() . '"'; + } + $chosen .= ','; + } + $chosen = trim($chosen, ','); + $chosen .= ']'; + $title = $poll->getTitle(); + $desc = $poll->getDescription(); + if ($poll->getExpire() != null) { + $expireTs = strtotime($poll->getExpire()) - 60*60*24; //remove one day, which has been added to expire at the end of a day + $expireStr = date('d.m.Y', $expireTs); + } + $access = $poll->getAccess(); + $accessTypes = $access; + if ( $access != 'registered' + && $access != 'hidden' && $access != 'public' + ) { + $access = 'select'; + } + } ?> <div id="app"> <div id="app-content"> - <div id="app-content-wrapper"> + <div id="app-content-wrapper"> <div id="controls"> - <div id="breadcrump"> - <div class="crumb svg" data-dir="/"> - <a href="<?php p($urlGenerator->linkToRoute('polls.page.index')); ?>"> - <img class="svg" src="<?php print_unescaped(OCP\image_path("core", "places/home.svg")); ?>" alt="Home"> - </a> - </div> - <div class="crumb svg last"> - <span> - <?php if ($isUpdate): ?> - <?php p($l->t('Edit poll') . ' ' . $poll->getTitle()); ?> - <?php else: ?> - <?php p($l->t('Create new poll')); ?> - <?php endif; ?> - </span> - </div> - </div> + <div id="breadcrump"> + <div class="crumb svg" data-dir="/"> + <a href="<?php p($urlGenerator->linkToRoute('polls.page.index')); ?>"> + <img class="svg" src="<?php print_unescaped(OCP\image_path("core", "places/home.svg")); ?>" alt="Home"> + </a> + </div> + <div class="crumb svg last"> + <span> + <?php if ($isUpdate): ?> + <?php p($l->t('Edit poll') . ' ' . $poll->getTitle()); ?> + <?php else: ?> + <?php p($l->t('Create new poll')); ?> + <?php endif; ?> + </span> + </div> + </div> </div> -<?php if ($isUpdate): ?> -<form name="finish_poll" action="<?php p($urlGenerator->linkToRoute('polls.page.update_poll')); ?>" method="POST"> - <input type="hidden" name="pollId" value="<?php p($poll->getId()); ?>" /> -<?php else: ?> -<form name="finish_poll" action="<?php p($urlGenerator->linkToRoute('polls.page.insert_poll')); ?>" method="POST"> -<?php endif; ?> - <input type="hidden" name="chosenDates" id="chosenDates" value="<?php if (isset($chosen)) p($chosen); ?>" /> - <input type="hidden" name="expireTs" id="expireTs" value="<?php if (isset($expireTs)) p($expireTs); ?>" /> - <input type="hidden" name="userId" id="userId" value="<?php p($userId); ?>" /> - - <header class="row"> - </header> - - <div class="new_poll row"> - <div class="col-50"> - <label for="pollTitle" class="input_title"><?php p($l->t('Title')); ?></label> - <input type="text" class="input_field" id="pollTitle" name="pollTitle" value="<?php if (isset($title)) p($title); ?>" /> - <label for="pollDesc" class="input_title"><?php p($l->t('Description')); ?></label> - <textarea class="input_field" id="pollDesc" name="pollDesc"><?php if (isset($desc)) p($desc); ?></textarea> - - <label class="input_title"><?php p($l->t('Access')); ?></label> - - <input type="radio" name="accessType" id="private" value="registered" class="radio" <?php if (!$isUpdate || $access === 'registered') print_unescaped('checked'); ?> /> - <label for="private"><?php p($l->t('Registered users only')); ?></label> - - <input type="radio" name="accessType" id="hidden" value="hidden" class="radio" <?php if ($isUpdate && $access === 'hidden') print_unescaped('checked'); ?> /> - <label for="hidden"><?php p($l->t('hidden')); ?></label> - - <input type="radio" name="accessType" id="public" value="public" class="radio" <?php if ($isUpdate && $access === 'public') print_unescaped('checked'); ?> /> - <label for="public"><?php p($l->t('Public access')); ?></label> - - <input type="radio" name="accessType" id="select" value="select" class="radio" <?php if ($isUpdate && $access === 'select') print_unescaped('checked'); ?>> - <label for="select"><?php p($l->t('Select')); ?></label> - <span id="id_label_select">...</span> - - <div id="selected_access" class="row user-group-list"> - <ul id="selected-search-list-id"> - </ul> - </div> - <div id="access_rights" class="row user-group-list"> - <div class="col-50"> - <input type="text" class="live-search-box" id="user-group-search-box" placeholder="<?php p($l->t('User/Group search')); ?>" /> - <ul class="live-search-list" id="live-search-list-id"> - </ul> - </div> - </div> - - <input type="hidden" name="accessValues" id="accessValues" value="<?php if ($isUpdate && $access === 'select') p($accessTypes) ?>" /> - - <input id="isAnonymous" name="isAnonymous" type="checkbox" class="checkbox" <?php $isAnonymous ? print_unescaped('value="true" checked') : print_unescaped('value="false"'); ?> /> - <label for="isAnonymous" class="input_title"><?php p($l->t('Anonymous')) ?></label> - - <div id="anonOptions" style="display:none;"> - <input id="hideNames" name="hideNames" type="checkbox" class="checkbox" <?php $hideNames ? print_unescaped('value="true" checked') : print_unescaped('value="false"'); ?> /> - <label for="hideNames" class="input_title"><?php p($l->t('Hide user names for admin')) ?></label> - </div> - - <input id="id_expire_set" name="check_expire" type="checkbox" class="checkbox" <?php ($isUpdate && $poll->getExpire() !== null) ? print_unescaped('value="true" checked') : print_unescaped('value="false"'); ?> /> - <label for="id_expire_set" class="input_title"><?php p($l->t('Expires')); ?></label> - <div class="input-group" id="expiration"> - <input id="id_expire_date" type="text" required="" <?php (!$isUpdate || $poll->getExpire() === null) ? print_unescaped('disabled="true"') : print_unescaped('value="' . $expireStr . '"'); ?> name="expire_date_input" /> - </div> - </div> - <div class="col-50"> - - <input type="radio" name="pollType" id="event" value="event" class="radio" <?php if (!$isUpdate || $poll->getType() == '0') print_unescaped('checked'); ?> /> - <label for="event"><?php p($l->t('Event schedule')); ?></label> - - <!-- TODO texts to db --> - <input type="radio" name="pollType" id="text" value="text" class="radio" <?php if ($isUpdate && $poll->getType() == '1') print_unescaped('checked'); ?>> - <label for="text"><?php p($l->t('Text based')); ?></label> - - <div id="date-select-container" <?php if ($isUpdate && $poll->getType() == '1') print_unescaped('style="display:none;"'); ?> > - <label for="datetimepicker" class="input_title"><?php p($l->t('Dates')); ?></label> - <input id="datetimepicker" type="text" /> - <table id="selected-dates-table" class="choices"> - </table> - </div> - <div id="text-select-container" <?php if(!$isUpdate || $poll->getType() == '0') print_unescaped('style="display:none;"'); ?> > - <label for="text-title" class="input_title"><?php p($l->t('Text item')); ?></label> - <div class="input-group"> - <input type="text" id="text-title" placeholder="<?php print_unescaped('Insert text...'); ?>" /> - <div class="input-group-btn"> - <input type="button" id="text-submit" class="button btn" value="<?php p($l->t('Add')); ?>" class="btn"/> - </div> - </div> - <table id="selected-texts-table" class="choices"> - </table> - </div> - </div> - </div> - <div class="form-actions"> - <?php if ($isUpdate): ?> - <input type="submit" id="submit_finish_poll" class="button btn primary" value="<?php p($l->t('Update poll')); ?>" /> - <?php else: ?> - <input type="submit" id="submit_finish_poll" class="button btn primary" value="<?php p($l->t('Create poll')); ?>" /> - <?php endif; ?> - <a href="<?php p($urlGenerator->linkToRoute('polls.page.index')); ?>" id="submit_cancel_poll" class="button"><?php p($l->t('Cancel')); ?></a> - </div> -</form> -</div> -</div> + <?php if ($isUpdate): ?> + <form name="finish_poll" action="<?php p($urlGenerator->linkToRoute('polls.page.update_poll')); ?>" method="POST"> + <input type="hidden" name="pollId" value="<?php p($poll->getId()); ?>" /> + <?php else: ?> + <form name="finish_poll" action="<?php p($urlGenerator->linkToRoute('polls.page.insert_poll')); ?>" method="POST"> + <?php endif; ?> + <input type="hidden" name="chosenDates" id="chosenDates" value="<?php if (isset($chosen)) p($chosen); ?>" /> + <input type="hidden" name="expireTs" id="expireTs" value="<?php if (isset($expireTs)) p($expireTs); ?>" /> + <input type="hidden" name="userId" id="userId" value="<?php p($userId); ?>" /> + + <header class="row"> + </header> + + <div class="new_poll row"> + <div class="col-50"> + <label for="pollTitle" class="input_title"><?php p($l->t('Title')); ?></label> + <input type="text" class="input_field" id="pollTitle" name="pollTitle" value="<?php if (isset($title)) p($title); ?>" /> + <label for="pollDesc" class="input_title"><?php p($l->t('Description')); ?></label> + <textarea class="input_field" id="pollDesc" name="pollDesc"><?php if (isset($desc)) p($desc); ?></textarea> + + <label class="input_title"><?php p($l->t('Access')); ?></label> + + <input type="radio" name="accessType" id="private" value="registered" class="radio" <?php if (!$isUpdate || $access == 'registered') print_unescaped('checked'); ?> /> + <label for="private"><?php p($l->t('Registered users only')); ?></label> + + <input type="radio" name="accessType" id="hidden" value="hidden" class="radio" <?php if ($isUpdate && $access == 'hidden') print_unescaped('checked'); ?> /> + <label for="hidden"><?php p($l->t('hidden')); ?></label> + + <input type="radio" name="accessType" id="public" value="public" class="radio" <?php if ($isUpdate && $access == 'public') print_unescaped('checked'); ?> /> + <label for="public"><?php p($l->t('Public access')); ?></label> + + <input type="radio" name="accessType" id="select" value="select" class="radio" <?php if ($isUpdate && $access == 'select') print_unescaped('checked'); ?>> + <label for="select"><?php p($l->t('Select')); ?></label> + <span id="id_label_select">...</span> + + <div id="selected_access" class="row user-group-list"> + <ul id="selected-search-list-id"> + </ul> + </div> + <div id="access_rights" class="row user-group-list"> + <div class="col-50"> + <input type="text" class="live-search-box" id="user-group-search-box" placeholder="<?php p($l->t('User/Group search')); ?>" /> + <ul class="live-search-list" id="live-search-list-id"> + </ul> + </div> + </div> + + <input type="hidden" name="accessValues" id="accessValues" value="<?php if ($isUpdate && $access == 'select') p($accessTypes) ?>" /> + + <input id="isAnonymous" name="isAnonymous" type="checkbox" class="checkbox" <?php $isAnonymous ? print_unescaped('value="true" checked') : print_unescaped('value="false"'); ?> /> + <label for="isAnonymous" class="input_title"><?php p($l->t('Anonymous')) ?></label> + + <div id="anonOptions" style="display:none;"> + <input id="hideNames" name="hideNames" type="checkbox" class="checkbox" <?php $hideNames ? print_unescaped('value="true" checked') : print_unescaped('value="false"'); ?> /> + <label for="hideNames" class="input_title"><?php p($l->t('Hide user names for admin')) ?></label> + </div> + + <input id="id_expire_set" name="check_expire" type="checkbox" class="checkbox" <?php ($isUpdate && $poll->getExpire() != null) ? print_unescaped('value="true" checked') : print_unescaped('value="false"'); ?> /> + <label for="id_expire_set" class="input_title"><?php p($l->t('Expires')); ?></label> + <div class="input-group" id="expiration"> + <input id="id_expire_date" type="text" required="" <?php (!$isUpdate || $poll->getExpire() == null) ? print_unescaped('disabled="true"') : print_unescaped('value="' . $expireStr . '"'); ?> name="expire_date_input" /> + </div> + </div> + <div class="col-50"> + + <input type="radio" name="pollType" id="event" value="event" class="radio" <?php if (!$isUpdate || $poll->getType() == '0') print_unescaped('checked'); ?> /> + <label for="event"><?php p($l->t('Event schedule')); ?></label> + + <!-- TODO texts to db --> + <input type="radio" name="pollType" id="text" value="text" class="radio" <?php if ($isUpdate && $poll->getType() == '1') print_unescaped('checked'); ?>> + <label for="text"><?php p($l->t('Text based')); ?></label> + + <div id="date-select-container" <?php if ($isUpdate && $poll->getType() == '1') print_unescaped('style="display:none;"'); ?> > + <label for="datetimepicker" class="input_title"><?php p($l->t('Dates')); ?></label> + <input id="datetimepicker" type="text" /> + <table id="selected-dates-table" class="choices"> + </table> + </div> + <div id="text-select-container" <?php if(!$isUpdate || $poll->getType() == '0') print_unescaped('style="display:none;"'); ?> > + <label for="text-title" class="input_title"><?php p($l->t('Text item')); ?></label> + <div class="input-group"> + <input type="text" id="text-title" placeholder="<?php print_unescaped('Insert text...'); ?>" /> + <div class="input-group-btn"> + <input type="button" id="text-submit" class="button btn" value="<?php p($l->t('Add')); ?>" class="btn"/> + </div> + </div> + <table id="selected-texts-table" class="choices"> + </table> + </div> + </div> + </div> + <div class="form-actions"> + <?php if ($isUpdate): ?> + <input type="submit" id="submit_finish_poll" class="button btn primary" value="<?php p($l->t('Update poll')); ?>" /> + <?php else: ?> + <input type="submit" id="submit_finish_poll" class="button btn primary" value="<?php p($l->t('Create poll')); ?>" /> + <?php endif; ?> + <a href="<?php p($urlGenerator->linkToRoute('polls.page.index')); ?>" id="submit_cancel_poll" class="button"><?php p($l->t('Cancel')); ?></a> + </div> + </form> + </div> + </div> </div> |