#foswiki 2015-11-21,Sat

↑back Search ←Prev date Next date→ Show only urls(Click on time to select a line by its url)

WhoWhatWhen
GithubBot[distro] FoswikiBot pushed 2 new commits to master: http://git.io/v4xvG
distro/master 82f986f GeorgeClark: Item13505: Translations updated using Weblate (Czech)...
distro/master a345fcc Vadim Belman: Item13505: Translations updated using Weblate (Ukrainian)...
[00:09]
***GithubBot has left [00:09]
GithubBot[NatSkin] FoswikiBot pushed 1 new commit to master: http://git.io/v4xvW
NatSkin/master 28150f3 GeorgeClark: Item13856: Translated using Weblate (German)...
[00:10]
***GithubBot has left [00:10]
FoswikiBothttp://foswiki.org/Tasks/Item13856 [ Item13856: Translations for NatSkin ] [00:10]
.......................... (idle for 2h9mn)
***KryoStof1er has quit IRC (Write error: Broken pipe) [02:19]
............. (idle for 1h1mn)
rouiljI am trying to create a banner on a page if the page has not been
updated in the last 6 months. Here is the code I am using. For
testing it uses a 10 second change time rather then 6 months:
====
%CALC{"$IF($TIMEDIFF($TIME(%REVINFO{format="$date"}%), $TIME(), second) > 10, $NOP($perINCLUDE{"WarnUnreviewedTopic"}$per))"}%
====
In the WarnUnreviewedTopic topic I have:
====
%STARTINCLUDE%
<div style="background-color: red">
%X% Warning topic has not been reviewed in the last %CALC{"$TIMEDIFF($TIME(%REVINFO{format="$date"}%), $TIME(), second)"}% year(s) and may be out of date.<br />
Please have a SME review and update the topic.
In production, the calc that does the include from WarnUnreviewedTopic will be an include itself, so I'll need one additional level of evaluation.
the pages that I want to enable the banner for already have a macro defined at the top of the page, so I plan on just adding the include statement to that macro rather than editing all the pages to add a new macro.
hmm, I am getting a warning that my message may have been throttled, but it looks ok here.
[03:20]
gac410I don't know the answer to your question, but have a couple of comments.
to avoid "editing all pages" you could consider a custom view template that provides the banner logic.
Unless you were abbreviating for posting, The abbreviation is $percnt not $per.
I'd probably use %IF{} instead of $IF. it might avoid some of the complexity
[03:23]
rouiljthis is a 1.1.9 foswiki. hmm, $per seems to work inside the %CAL%. I think I tried using %IF{}, but I couldn't get the calculation to work. IIRC the %IF always took the true path. [03:34]
gac410Oh. $per ... that's a CALC token, not TML... sorry. my mistake
I'm tinkering, may take a bit.
[03:34]
rouiljno prob on $per [03:36]
gac410Okay, well one thing, the revinfo of date returns just the date, so time(date) gives a time of midnight, You'll never get 10 second resolution. [03:39]
rouiljI am combing through the older code in history. It looks like I tried: %IF{ "%CALC{"$TIMEDIFF($TIME(%REVINFO{format="$date"}%), $TIME(), second)}% > 10" then="%INCLUDE{WarnUnreviewedTopic}"}%
yeah, this was just a test. I wanted it to be > 10.
in reality the timediff will be in days
or months
I consider a page too old if not reviewed in the prior 6 months. I was planning on including some other code that added a special comment plugin template (wrong word, but hopefully you get the idea) that allows the reviewer to add their signature to the end of the document along with the date as a stamp of approval for the content.
[03:39]
***geetar has left [03:42]
rouiljThe current sharepoint at work has a ton of unreviewed procedures and there is no indication that it maybe out of date. [03:42]
gac410Okay... Try this
%IF{"%CALCULATE{"$TIMEDIFF($TIME(%REVINFO{format="$date"}%), $TIME(), second)"}% > 100" then="$percntINCLUDE{$quotSomeWarning$quot}$percnt" else="bar"}%
er.... but use %CALC ... CALCULATE is 2.0
[03:43]
rouiljack. [03:46]
gac410I deferred the %INCLUDE with $percnt so it would not expand if not needed. [03:47]
rouiljack. Yup that worked as well as my full %CALC% statement did. It still produces:
Warning topic has not been reviewed in the last %CALC{"$TIMEDIFF($TIME(03 Aug 2015), $TIME(), second)"}% year(s) and may be out of date.
Please have a SME review and update the topic.
so the calc in the INCLUDE'd file isn;t evaluated.
is there a %EVAL{%INCLUDE{...}}% that will evaluate the result of the include in the context of the including topic?
[03:48]
gac410Ah... okay. hm I missed that aspect.
thinking ...
[03:49]
rouiljyour solution is cleaner, so I will adopt it.
I guess I could do an: %INCLUDE{foo, months="%CALC{"$TIMEDIFF($TIME(03 Aug 2015), $TIME(), second)"}%"}% and then replace the calc in the inluded file by %month%. But I still have one level of redirection. Hmm, I wonder if I can pass custom params from the top level macro all the way through the stack of included files.
[03:51]
gac410I was thinking about that. I wasn't sure if 1.1 had parameterized macros. Sounds like it does. [03:54]
rouiljThat may be preferable now that I think of it since I am calculating %CALC{"$TIMEDIFF($TIME(03 Aug 2015), $TIME(), second)"}% a couple of times. (where 03 Aug 2015 is the %REVINFO% expansion).
I think it does have parameterizes includes.
[03:54]
gac410Another way would be to use %CALC($SET(timediff, ....) And then reference timediff with $GET
That works across includes etc.
So calc the timediff once in the main topic. Then conditionally include the warning, which references the timediff
[03:54]
rouiljyeah I think that will work.
I'll have to make sure that I can set the top level macro correctly in the WebPreferences topic, but I think that will work.
[03:56]
gac410probably a lot cleaner. the set/get code of ssp is very useful [03:57]
rouiljssp? [03:57]
gac410SpreadSheetPlugin.
:) Too much typing.
[03:57]
rouiljah by set I meant
* Set MACRO = values here
not the SSP set command.
[03:57]
gac410Oh.. sorry, I was not answering your comment about top level macros.
Yes you should be able to SET in the WebPreferences
You just cannot * SET variables in included topics. That only works in SpreadSheetPlugin
(There is no relationship at all between SSP's $SET/$GET and * Set statements
[03:58]
GithubBot[distro] gac410 created Item13859 (+1 new commit): http://git.io/v4xrn
distro/Item13859 7133c12 George Clark: Item13859: Initial checkin of URLPARAM validation...
[04:02]
***GithubBot has left [04:02]
FoswikiBothttp://foswiki.org/Tasks/Item13859 [ Item13859: Implement AddValidationsToURLPARAMMacro ] [04:02]
..... (idle for 20mn)
GithubBot[distro] FoswikiBot pushed 2 new commits to master: http://git.io/v4xKV
distro/master d792941 Vadim Belman: Item13505: Translations updated using Weblate (Ukrainian)...
distro/master 5bccd9a Vadim Belman: Item13505: Translations updated using Weblate (Ukrainian)...
[04:22]
***GithubBot has left [04:22]
FoswikiBothttp://foswiki.org/Tasks/Item13505 [ Item13505: Translations for Foswiki 2.0.x / 2.1.0 ] [04:22]
rouiljgac410 ack understood on * SET and ssp
and I think I have something that works from the top level SET macro.
will test in production n monday. Thanks again.
[04:27]
gac410btw I'm hoping to build and release Foswiki 1.1.10 this weekend. It's a wrap-up release for the 1.1.x stream. Backport a few critical compatibility features, and fix some major issues that come about if you upgrade perl or cpan libraries.
But upgrade to 2.0.3 is still recommended.
[04:28]
............... (idle for 1h12mn)
***gac410 has left [05:41]
...... (idle for 29mn)
rouiljYeah, I have been looking at upgrading. I have about 40 pages with attachments (pasted images) that I need to move. I have to spin a new centos 7 box to support it.
BTW do you know what the status is of ContributorsPlugin on 1.1.9? None of the examples packed with it work on my test wiki. The formating of the data is way off.
The ContributorsPlugin is to be used during 1 on 1's with the manager to show how people are contributing to the knowledge base.
Hmm, maybe I need to set an explicit eval order for that macro??
[06:10]
............. (idle for 1h3mn)
***ChanServ sets mode: +o CDot [07:23]
......... (idle for 40mn)
GuilainC_away is now known as GuilainC [08:03]
.............................................................. (idle for 5h6mn)
ChanServ sets mode: +o Lynnwood [13:09]
.................. (idle for 1h25mn)
ChanServ sets mode: +o gac410 [14:34]
gac410Hey CDot. If you get a chance, The https://github.com/foswiki/distro/commits/Item13859 branch. I started experimenting with URL param validations. But I think it needs some review or ideas on better implementation
Currently it throws 1 error at a time. A "reporter" concept and a single oops for all errors might be better.
Anyway, ... a feature branch in need of constructive (hopefully :) ) review
[14:37]
.................................... (idle for 2h57mn)
***ChanServ sets mode: +o Lynnwood [17:35]
GuilainC has quit IRC (Ping timeout: 240 seconds)
ChanServ sets mode: +o SvenDowideit
[17:45]
......... (idle for 43mn)
GithubBot[distro] Jlevens pushed 1 new commit to master: http://git.io/v4jJj
distro/master b4ea64a www-data: Item13594: Merge feature: concatenate attributes
[18:30]
***GithubBot has left [18:30]
FoswikiBothttp://foswiki.org/Tasks/Item13594 [ Item13594: Implement Feature AddConcatOptionToAttrs ] [18:30]
JulianLevensgac410: Just committed albeit not with my f.o name/email, sorry -- out of practice :( [18:41]
........ (idle for 38mn)
gac410no issues JulianLevens ... system figured it out anyway. Task has you as the committer. [19:19]
***gac410 sets mode: +o JulianLevens [19:23]
............... (idle for 1h13mn)
ging has left [20:36]
.... (idle for 15mn)
ChanServ sets mode: +o Lynnwood [20:51]
.................................... (idle for 2h59mn)
geetar has left
ChanServ sets mode: +o Lynnwood
[23:50]

↑back Search ←Prev date Next date→ Show only urls(Click on time to select a line by its url)