From fbf9e9d682e580dc2d020d23ecc173315327ec1e Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Thu, 9 Mar 2017 16:15:10 +0100 Subject: [PATCH 01/26] integrate QC plugin (ajax branch) This refactors the page-attribute area a bit and intergrates the new ajax branch of the QC plugin. I'm not really happy about the included file - it should probably be moved to our Template class instead. --- css/area_nav-breadcrumb.less | 139 ------------------------------ css/area_nav-page-attributes.less | 30 +++++++ css/plugins/qc.less | 28 +++++- js/plugins/do_tasks.js | 94 ++++++++++---------- js/plugins/qc.js | 37 ++++++++ main.php | 3 +- script.js | 1 + style.ini | 1 + tpl/nav-page-attributes.php | 57 ++++++++++++ tpl/nav-page-quality-tasks.php | 54 ------------ 10 files changed, 200 insertions(+), 244 deletions(-) create mode 100644 css/area_nav-page-attributes.less create mode 100644 js/plugins/qc.js create mode 100755 tpl/nav-page-attributes.php delete mode 100755 tpl/nav-page-quality-tasks.php diff --git a/css/area_nav-breadcrumb.less b/css/area_nav-breadcrumb.less index cd3f5b6..4376701 100755 --- a/css/area_nav-breadcrumb.less +++ b/css/area_nav-breadcrumb.less @@ -67,145 +67,6 @@ padding: .1em .1em 0; } } - - -/* + + + + + icon list + + + + + */ - .page-attributes { - list-style: none; - float: right; - display: inline-block; - max-width: 30%; - margin: -.45em 0 0; - padding: 0; - @media @screen_max-xs{ - max-width: 90%; - } - - > li { - .btn-usertools-wrapper(); // uniform li - .btn-usertools-num(); - - float: left; - - > strong, - > a { - display: block; - width: auto; - min-height: 2em; - border: 1px solid @color-border; - border-radius: @border-radius; - color: @color-nav; - text-align: center; - margin: 0; - } - - .prefix { - .btn-prefix (); - .icon-clipboard(); - } - -/* check !!! */ - &.do_none { - position: relative; - - strong { - background-color: @color-site-bg; - } - - .num { - background-color: @color-border; - color: @color-nav; - } - } -/* end check !!! */ - - &.plugin__qc { - display: inline-block; - overflow: visible; - position: static; - } - } // li - - a { - transition: @transition color, @transition background-color, @transition border-color; - - &[aria-expanded="false"] + #plugin__qc__wrapper { - display: none; - } - - &:hover, - &:active, - &:focus { - background-color: @button_color; - border-color: @button_background; - color: @button_background; - - .prefix { - color: @button_background; - } - } - } - - #plugin__qc__wrapper { - position: absolute; - right: 0; - width: auto; - border: 0 none; - background: @background_page-header; - background: -webkit-linear-gradient(top, @background_page-header, @color-content-bg); - background: linear-gradient(top, @background_page-header, @color-content-bg); - box-shadow: @box-shadow-bottom; - z-index: 2000; - - #plugin__qc__out{ - h1 { - font-size: @font-size-head3; - } - - h2 { - margin-top: 1.6em; - font-size: @font-size-head5; - } - > h1, - > h2, - > p, - > dl, - > div { - padding-left: 1rem; - margin-left: 0; - } - - > div p { - padding-left: 0; - margin-left: 0; - } - } - - &[aria-hidden="false"] { - margin-top: .5rem; - } - } - - #plugin__qc__icon { - display: none; - } - - #plugin__qc__link { - position: relative; - - .prefix { - .icon-emo-happy(); - - width: 100%; - font-size: @font-size-default; - - &::before { - width: 100%; - margin: .1em 0 0; - } - } - } - } } diff --git a/css/area_nav-page-attributes.less b/css/area_nav-page-attributes.less new file mode 100644 index 0000000..228f667 --- /dev/null +++ b/css/area_nav-page-attributes.less @@ -0,0 +1,30 @@ +/** + * Page Attribute Icons in the breadcrumb bar + */ +.page-attributes { + list-style: none; + float: right; + display: inline-block; + max-width: 30%; + margin: -.45em 0 0; + padding: 0; + @media @screen_max-xs { + max-width: 90%; + } + + > li { + .btn-usertools-wrapper(); // uniform li + .btn-usertools-num(); + + position: relative; + float: left; + display: block; + width: auto; + min-height: 2em; + border: 1px solid @color-border; + border-radius: @border-radius; + color: @color-nav; + text-align: center; + margin: 0; + } +} diff --git a/css/plugins/qc.less b/css/plugins/qc.less index dff5a32..42c57a5 100644 --- a/css/plugins/qc.less +++ b/css/plugins/qc.less @@ -1,6 +1,26 @@ -#plugin__qc__wrapper{ - font-size: @font-size-default; - p{ - font-size: @font-size-default; +/** + * Styles for the QC plugin + */ + +// icon in page attributes +.page-attributes .plugin_qc { + .qc_icon { + margin: 0; + width: 2em; + height: 2em; + + svg { + margin-top: 0.1em; + margin-left: 0.1em; + width: 1.6em; + height: 1.6em; + } } } + +// output +.qc-output { + font-size: 90%; + border-bottom: 1px solid @ini_border; +} + diff --git a/js/plugins/do_tasks.js b/js/plugins/do_tasks.js index 78a8f34..1ff8717 100755 --- a/js/plugins/do_tasks.js +++ b/js/plugins/do_tasks.js @@ -1,47 +1,49 @@ -( function( $, spc ) { - - var togglePageAnalysis = function(){ - var $this = $('.page-attributes').find('.plugin__qc'); - try{ - var $link = $this.find('#plugin__qc__link'), - $container = $this.find('#plugin__qc__wrapper'); - - if($container.length < 1){ - $this.remove(); - }else{ - $container.attr('aria-hidden','true'); - var $icon = $container.find('#plugin__qc__icon'); - $container.find('#plugin__qc__out').removeAttr('style'); - $link.on( 'click', function(e){ - e.preventDefault(); - $icon.trigger('click'); - var oldState = ($link.attr('aria-expanded')=== "true" ); - $container.attr('aria-hidden',oldState); - $(this).attr('aria-expanded',!oldState); - - }); - - if($container.length > 0){ - var num = $container.attr('data-errors'); - if(num){ - $link.find('.num').empty().append(num); - $link.closest('li').removeClass('do_none'); - } - } - - } - - }catch(err){ - $this.remove(); - } - }; - - $(function(){ - togglePageAnalysis(); - }); - -} )( jQuery, spc ); - - - +// FIXME figure out what this did and why +// ( function( $, spc ) { +// +// var togglePageAnalysis = function(){ +// var $this = $('.page-attributes').find('.plugin__qc'); +// try{ +// var $link = $this.find('#plugin__qc__link'), +// $container = $this.find('#plugin__qc__wrapper'); +// +// if($container.length < 1){ +// $this.remove(); +// }else{ +// $container.attr('aria-hidden','true'); +// var $icon = $container.find('#plugin__qc__icon'); +// $container.find('#plugin__qc__out').removeAttr('style'); +// $link.on( 'click', function(e){ +// e.preventDefault(); +// $icon.trigger('click'); +// var oldState = ($link.attr('aria-expanded')=== "true" ); +// $container.attr('aria-hidden',oldState); +// $(this).attr('aria-expanded',!oldState); +// +// }); +// +// if($container.length > 0){ +// var num = $container.attr('data-errors'); +// if(num){ +// $link.find('.num').empty().append(num); +// $link.closest('li').removeClass('do_none'); +// } +// } +// +// } +// +// }catch(err){ +// $this.remove(); +// } +// }; +// +// $(function(){ +// togglePageAnalysis(); +// }); +// +// } )( jQuery, spc ); +// +// +// +// diff --git a/js/plugins/qc.js b/js/plugins/qc.js new file mode 100644 index 0000000..65d795b --- /dev/null +++ b/js/plugins/qc.js @@ -0,0 +1,37 @@ +/** + * Add custom QC functionality instead of using the plugin's mechanism + */ +jQuery(function () { + var $panel = jQuery('div.qc-output').hide(); + + // load summary + jQuery('.page-attributes .plugin_qc a').load( + DOKU_BASE + '/lib/exe/ajax.php', + { + call: 'plugin_qc_short', + id: JSINFO['id'] + }, + function () { + jQuery(this).find('span span').addClass('num'); + } + ).click(function (e) { + e.preventDefault(); + + if ($panel.html() == '') { + // load output + $panel.load( + DOKU_BASE + '/lib/exe/ajax.php', + { + call: 'plugin_qc_long', + id: JSINFO['id'] + }, + function () { + $panel.dw_show(); + } + ); + } else { + $panel.dw_toggle(); + } + }); + +}); diff --git a/main.php b/main.php index 2934e3f..22fa813 100755 --- a/main.php +++ b/main.php @@ -230,7 +230,7 @@ $classWideContent = ($ACT === "show") ? "": "wide-content "; /* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */ /* page quality / page tasks */ /* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */ - include('tpl/nav-page-quality-tasks.php'); + include('tpl/nav-page-attributes.php'); ?> +
'; +} + + +if($qcPlugin && $qcPlugin->shouldShow()) { + echo '
  • '; // filled by javascript +} + + +if($doPlugin !== null) { + $count = $doPlugin->getPageTaskCount(); + $num = $count['count']; + $title = ""; + + if($num == 0) { // no tasks - does not exist do in plug-in + $class = "do_none"; + $title = tpl_getLang('tasks_page_none'); + } elseif($count['undone'] == 0) { // all tasks done + $class = 'do_done'; + $title = $this->getLang('title_alldone'); + } elseif($count['late'] == 0) { // open tasks but none late + $class = 'do_undone'; + $title = sprintf($this->getLang('title_intime'), $count['undone']); + } else { // late tasks + $class = 'do_late'; + $title = sprintf($this->getLang('title_late'), $count['undone'], $count['late']); + } + $markup = "
  • " . tpl_getLang('prefix_tasks_page') . " " . $num . "
  • "; + + echo $markup; +} + +if($doPlugin !== null || $qcPlugin !== null) { + echo ""; +} + + + +/* + + +$out = '
    '; +$out .= $count['undone']; +$out .= '
    '; + +if($return) return $out; +echo $out;*/ diff --git a/tpl/nav-page-quality-tasks.php b/tpl/nav-page-quality-tasks.php deleted file mode 100755 index 2a1977c..0000000 --- a/tpl/nav-page-quality-tasks.php +++ /dev/null @@ -1,54 +0,0 @@ - - -"; - } - if ($qc) { - echo "
  • ".tpl_getLang('quality_trigger')."0"; - $qc->tplErrorCount(); - echo "
  • "; - } - if ($doPlugin !== null ) { - $count = $doPlugin->getPageTaskCount(); - $num = $count['count']; - $title = ""; - - if($num == 0){ // no tasks - does not exist do in plug-in - $class = "do_none"; - $title = tpl_getLang('tasks_page_none'); - } elseif($count['undone'] == 0){ // all tasks done - $class = 'do_done'; - $title = $this->getLang('title_alldone'); - }elseif($count['late'] == 0) { // open tasks but none late - $class = 'do_undone'; - $title = sprintf($this->getLang('title_intime'), $count['undone']); - } else { // late tasks - $class = 'do_late'; - $title = sprintf($this->getLang('title_late'), $count['undone'], $count['late']); - } - $markup = "
  • ".tpl_getLang('prefix_tasks_page')." ".$num."
  • "; - - echo $markup; - } - - if ($doPlugin !== null ||$qc ) { - echo ""; - } - -/* - - -$out = '
    '; -$out .= $count['undone']; -$out .= '
    '; - -if($return) return $out; -echo $out;*/ From a94fc7a514a474778ffdc5e7e998f441ce1d2576 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Thu, 9 Mar 2017 16:16:19 +0100 Subject: [PATCH 02/26] give tabs a class for special styling I nearly needed that but then didn't. but it might come in handy --- tpl/nav-meta-box.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tpl/nav-meta-box.php b/tpl/nav-meta-box.php index 77328c5..abf95a3 100755 --- a/tpl/nav-meta-box.php +++ b/tpl/nav-meta-box.php @@ -9,7 +9,7 @@ $tabs = \dokuwiki\template\sprintdoc\Template::getInstance()->getMetaBoxTabs();
  •  
  • '; + echo '
  • '; echo '
    View Larger Map'; + echo '
    '; + echo '
    '; + } + } + ?>
    Date: Mon, 10 Apr 2017 13:43:43 +0200 Subject: [PATCH 06/26] Adjust to changed main html --- detail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detail.php b/detail.php index 70ddd7c..5cce646 100755 --- a/detail.php +++ b/detail.php @@ -117,7 +117,7 @@ header('X-UA-Compatible: IE=edge,chrome=1');
    @@ -227,11 +226,6 @@ header('X-UA-Compatible: IE=edge,chrome=1');
    -

    -
    - ← -

    -
    From 6f352bafb27d6b8a6819ca65a04198c78d30d566 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9Fe?= Date: Mon, 10 Apr 2017 13:49:08 +0200 Subject: [PATCH 08/26] function tpl_img_meta reliably exists --- detail.php | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/detail.php b/detail.php index 9aa119e..fdd2cbc 100755 --- a/detail.php +++ b/detail.php @@ -167,7 +167,6 @@ header('X-UA-Compatible: IE=edge,chrome=1');

    - - -
    - $tag){ - $t = array(); - if (!empty($tag[0])) { - $t = array($tag[0]); - } - if(is_array($tag[3])) { - $t = array_merge($t,$tag[3]); - } - $value = tpl_img_getTag($t); - if ($value) { - echo '
    '.$lang[$tag[1]].':
    '; - if ($tag[2] == 'date') { - echo dformat($value); - } else { - echo hsc($value); - } - echo '
    '; - } - } - ?> -
    -
    From ecb77cc51cadc644f63b3cf5e3c2a7d1fb3c45a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9Fe?= Date: Mon, 10 Apr 2017 13:49:54 +0200 Subject: [PATCH 09/26] Fix indent and more style-issues in details.php --- detail.php | 103 ++++++++++++++++++++++++++++------------------------- 1 file changed, 55 insertions(+), 48 deletions(-) diff --git a/detail.php b/detail.php index fdd2cbc..8c87871 100755 --- a/detail.php +++ b/detail.php @@ -9,21 +9,25 @@ */ // must be run from within DokuWiki -if (!defined('DOKU_INC')) die(); +if (!defined('DOKU_INC')) { + die(); +} header('X-UA-Compatible: IE=edge,chrome=1'); ?> - + - + - <?php echo hsc(tpl_img_getTag('IPTC.Headline',$IMG))?> - [<?php echo strip_tags($conf['title'])?>] + <?php echo hsc(tpl_img_getTag('IPTC.Headline', $IMG)) ?> + [<?php echo strip_tags($conf['title']) ?>] - - - + + + @@ -43,7 +47,7 @@ header('X-UA-Compatible: IE=edge,chrome=1');
    - - +
    - @@ -201,11 +209,10 @@ header('X-UA-Compatible: IE=edge,chrome=1'); -
    +
    -
  • '.$doInner.'
  • '; - }else{ - echo '
  • '.$doInner.'
  • '; - } - } - else{ + + $userpage = $doplugin->getConf('userpage'); + if ($userpage && $_SERVER['REMOTE_USER'] && $num > 0) { + $linktarget = sprintf($userpage, $_SERVER['REMOTE_USER']) . ':' . 'dashboard'; + echo '
  • '.$doInner.'
  • '; + } else { echo '
  • '.$doInner.'
  • '; } } ?> From 58aee1016a9f6ed968fb0c9eb5e1d267a2317b16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jana=20Deutschla=CC=88nder?= Date: Wed, 19 Apr 2017 15:21:55 +0200 Subject: [PATCH 21/26] SPR-814: detail template --- css/template_detail.less | 58 ++++++++++- detail.php | 176 ++++++++++++++++++++++++++------- lang/de/lang.php | 3 + lang/de/settings.php | 5 +- lang/en/lang.php | 3 + lang/en/settings.php | 5 +- tpl/nav-page-quality-tasks.php | 2 +- 7 files changed, 204 insertions(+), 48 deletions(-) diff --git a/css/template_detail.less b/css/template_detail.less index b11c551..f11cfcf 100644 --- a/css/template_detail.less +++ b/css/template_detail.less @@ -50,15 +50,71 @@ } // meta data - .img_detail { + div.img_detail { /* vertical minus margin of .img-detail corresponds to the padding of .page */ margin: @margin-default -(@margin-default); + + border: solid @ini_border_light; + border-width: 1px 0; + background-color: @ini_background_page_header; + h1, h2, h3, h4, h5, h6, p{ + padding-left: @margin-default; + padding-right: @margin-default; + } + + dl { + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + flex-direction: row; + -ms-flex-direction: row; + flex-wrap: wrap; + -ms-flex-wrap: wrap; + width: 100%; + + dt, dd { + box-sizing: border-box; + margin: .2em 0; + padding: (@small-spacing * 2) @small-spacing; + } + + dt { + width: 33.3%; + background-color: @ini_highlight; + color: @ini_highlight_text; + + } + dd { + width: 66.6%; + padding-left: (@small-spacing * 2); + } + + } + .os-map { + p { + text-align: right; + } + iframe { + padding: 0; + margin: 0; + border: solid @ini_button_background; + border-width: 1px 0; + } + } + @media @screen_max-md { margin-right: -(@margin-default * 1.6); + h1, h2, h3, h4, h5, h6, p { + padding-right: (@margin-default * 1.6); + } } @media @screen_max-xs { margin-left: -(@margin-small); + h1, h2, h3, h4, h5, h6, p { + padding-left: @margin-small; + } } + } } diff --git a/detail.php b/detail.php index d964f3d..0250f6f 100755 --- a/detail.php +++ b/detail.php @@ -61,12 +61,24 @@ include('tpl/favicon_tiles.php');
    +
    @@ -76,19 +88,57 @@ include('tpl/favicon_tiles.php');
    - -

    - +
    + +

    + +
    +
    +
    + +

    + + +

    + +
    +
    +
    + @@ -98,20 +148,37 @@ include('tpl/favicon_tiles.php');
    -
    - -
    +
    + +
    + +
    @@ -127,8 +194,18 @@ include('tpl/favicon_tiles.php');
    @@ -139,7 +216,8 @@ include('tpl/favicon_tiles.php');
    - + +
    @@ -148,30 +226,28 @@ include('tpl/favicon_tiles.php');