From 0ef662e5ac02df5a0a8a62bb3942c6893f75090f Mon Sep 17 00:00:00 2001 From: Nikos Papagiannopoulos Date: Thu, 18 Feb 2021 06:39:31 +0100 Subject: [PATCH 1/5] Remove unnecessary files --- style.css~ | 44 ---------------------------- syntax.php~ | 83 ----------------------------------------------------- 2 files changed, 127 deletions(-) delete mode 100644 style.css~ delete mode 100644 syntax.php~ diff --git a/style.css~ b/style.css~ deleted file mode 100644 index dc9164c..0000000 --- a/style.css~ +++ /dev/null @@ -1,44 +0,0 @@ -/*.ample { - display: block; - width: 200px; - height: 100px; - font-size: 24px; - font-weight: bold; - padding: 5px; -} - -.available { - background-color: green; - color: white; -} - -.not-available { - background-color: red; - color: white; -}*/ - -div.hackerspace-room-state { - border: 1px solid #cccccc; - background-color: #ffffff; - padding: 0.5rem; -} - -div.hackerspace-room-state h3 { - -} - -div.hackerspace-room-state .icon { - display: inline; - width: 24px; - height: 24px; -} - -div.hackerspace-room-state .text { - display: inline; - margin-left: 0.3rem; -} - -div.hackerspace-room-state hr { - margin-top: 0.3rem; - margin-bottom: 0.3rem; -} \ No newline at end of file diff --git a/syntax.php~ b/syntax.php~ deleted file mode 100644 index 4d6eaf1..0000000 --- a/syntax.php~ +++ /dev/null @@ -1,83 +0,0 @@ - - */ - -// must be run within Dokuwiki -if (!defined('DOKU_INC')) die(); - -if (!defined('DOKU_LF')) define('DOKU_LF', "\n"); -if (!defined('DOKU_TAB')) define('DOKU_TAB', "\t"); -if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); - -require_once DOKU_PLUGIN.'syntax.php'; - -class syntax_plugin_whoisinyourhackspace extends DokuWiki_Syntax_Plugin { - /** - * Check if a given option has been given, and remove it from the initial string - * @param string $match The string match by the plugin - * @param string $pattern The pattern which activate the option - * @param $varAffected The variable which will memorise the option - * @param $valIfFound the value affected to the previous variable if the option is found - */ - private function _checkOption(&$match, $pattern, &$varAffected, $valIfFound){ - if ( preg_match($pattern, $match, $found) ){ - $varAffected = $valIfFound; - $match = str_replace($found[0], '', $match); - } - } // _checkOption - - public function getType() { - return 'substition'; - } - - public function getPType() { - return 'block'; - } - - public function getSort() { - return 0; - } - - - public function connectTo($mode) { - $this->Lexer->addSpecialPattern('\[wiyh\]',$mode,'plugin_whoisinyourhackspace'); - } - - public function render($mode, &$renderer, $data) { - global $conf; - - if($mode != 'xhtml') return false; - - $api_path = $this->getConf('api_path'); - - $file = file_get_contents($api_path); - - $api = json_decode($file); - - $content = ''; - $content .= '
'; - $content .= "

" . $this->getLang('wiyh_heading') . "

"; - - if ($api->state->open) { - $content .= "state->icon->open}\" alt=\"{$api->space} ist besetzt.\" title=\"{$api->space} ist besetzt.\" />"; - $content .= "

{$api->space} " . $this->getLang('wiyh_open') . "

"; - } else { - $content .= "state->icon->closed}\" alt=\"{$api->space} ist geschlossen.\" title=\"{$api->space} ist geschlossen.\" />"; - $content .= "

{$api->space} " . $this->getLang('wiyh_closed') . "

"; - } - - $content .= '
'; - - $content .= sprintf('

'.$this->getLang('wiyh_stats').'

',strtolower($api->space)); - $content .= '
'; - - $renderer->doc .= $content; - return true; - } -} - -// vim:ts=4:sw=4:et: From 16556e77222f6318342910b67bfa2c60eb807907 Mon Sep 17 00:00:00 2001 From: Nikos Papagiannopoulos Date: Thu, 18 Feb 2021 06:41:03 +0100 Subject: [PATCH 2/5] Fix indentation --- syntax.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax.php b/syntax.php index 277060b..1b2a096 100644 --- a/syntax.php +++ b/syntax.php @@ -76,11 +76,11 @@ class syntax_plugin_whoisinyourhackspace extends DokuWiki_Syntax_Plugin { $content .= "

" . $this->getLang('wiyh_heading') . "

"; if ($api->state->open) { - $message = "{$api->space} {$this->getLang('wiyh_open')}"; + $message = "{$api->space} {$this->getLang('wiyh_open')}"; $content .= $api->state->icon->open ? "state->icon->open}\" alt=\"{$message}\" title=\"{$message}\" />" : ''; $content .= "

{$message}

"; } else { - $message = "{$api->space} {$this->getLang('wiyh_closed')}"; + $message = "{$api->space} {$this->getLang('wiyh_closed')}"; $content .= $api->state->icon->closed ? "state->icon->closed}\" alt=\"{$message}\" title=\"{$message}\" />" : ''; $content .= "

{$message}

"; } From d411aa2d0fc03ba1e46dd2a799d50f0e368805fe Mon Sep 17 00:00:00 2001 From: Nikos Papagiannopoulos Date: Thu, 18 Feb 2021 06:44:26 +0100 Subject: [PATCH 3/5] Add and use 'since' translation key --- lang/de/lang.php | 1 + lang/en/lang.php | 1 + syntax.php | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lang/de/lang.php b/lang/de/lang.php index fa5cc20..bdc63b4 100644 --- a/lang/de/lang.php +++ b/lang/de/lang.php @@ -12,6 +12,7 @@ $lang['wiyh_closed'] = 'ist geschlossen'; $lang['wiyh_stats'] = 'Raumöffnungsstatistiken'; $lang['wiyh_no_api_path'] = 'Es wurde kein API-Pfad angegeben.'; $lang['wiyh_fetch_error'] = 'Der API-Pfad konnte nicht abgerufen werden.'; +$lang['wiyh_since'] = 'seit'; diff --git a/lang/en/lang.php b/lang/en/lang.php index 7e72678..563486b 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -12,6 +12,7 @@ $lang['wiyh_closed'] = 'is closed.'; $lang['wiyh_stats'] = 'Stats'; $lang['wiyh_no_api_path'] = 'No API path was given.'; $lang['wiyh_fetch_error'] = 'Could not fetch API path.'; +$lang['wiyh_since'] = 'since'; //Setup VIM: ex: et ts=4 : diff --git a/syntax.php b/syntax.php index 1b2a096..f553c45 100644 --- a/syntax.php +++ b/syntax.php @@ -87,7 +87,7 @@ class syntax_plugin_whoisinyourhackspace extends DokuWiki_Syntax_Plugin { $date = new DateTime(); $date->setTimeStamp($api->state->lastchange); - $content .= "

seit " . $date->format('d.m.Y H:i') . " Uhr

"; + $content .= "

{$this->getLang('wiyh_since')} " . $date->format('d.m.Y H:i') . " Uhr

"; $content .= '
'; $content .= ''; From 449657474b3c0d997877d229979dacf496f6a74c Mon Sep 17 00:00:00 2001 From: Nikos Papagiannopoulos Date: Thu, 18 Feb 2021 06:45:33 +0100 Subject: [PATCH 4/5] Remove unnecessary stops from english translation keys --- lang/en/lang.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lang/en/lang.php b/lang/en/lang.php index 563486b..4f387aa 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -7,8 +7,8 @@ // menu entry for admin plugins $lang['wiyh_heading'] = 'State'; -$lang['wiyh_open'] = 'is open.'; -$lang['wiyh_closed'] = 'is closed.'; +$lang['wiyh_open'] = 'is open'; +$lang['wiyh_closed'] = 'is closed'; $lang['wiyh_stats'] = 'Stats'; $lang['wiyh_no_api_path'] = 'No API path was given.'; $lang['wiyh_fetch_error'] = 'Could not fetch API path.'; From 1b47aebf646c17bd3af6cc8bb88e1cf9b196fc1e Mon Sep 17 00:00:00 2001 From: Nikos Papagiannopoulos Date: Thu, 18 Feb 2021 06:46:54 +0100 Subject: [PATCH 5/5] Remove LeineLab specific css from style.css --- style.css | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/style.css b/style.css index cd6b256..398abd5 100644 --- a/style.css +++ b/style.css @@ -1,22 +1,3 @@ -/*.ample { - display: block; - width: 200px; - height: 100px; - font-size: 24px; - font-weight: bold; - padding: 5px; -} - -.available { - background-color: green; - color: white; -} - -.not-available { - background-color: red; - color: white; -}*/ - div.hackerspace-room-state { border: 1px solid #cccccc; background-color: #ffffff; @@ -27,11 +8,6 @@ div.hackerspace-room-state h3 { } -div.leinelab-state img.icon { - display: inline; - width: 180px; -} - div.hackerspace-room-state .text { display: inline; margin-left: 0.3rem; @@ -40,4 +16,4 @@ div.hackerspace-room-state .text { div.hackerspace-room-state hr { margin-top: 0.3rem; margin-bottom: 0.3rem; -} \ No newline at end of file +}