SID-00355: Workflow: Show / search only approved revision of topics
| Status: |
Answered |
TWiki version: |
4.3.1 |
Perl version: |
5.1 |
| Category: |
WorkflowPlugin |
Server OS: |
Windows XP |
Last update: |
16 years ago |
I have been testing the workflow plugin and I have a question that I have been not able to solve with the documentation. When someone edits a controlled document the approval workflow starts, but we would need that the rest of the colleagues see the previous approved version by default, without the new changes, until it is approved.
We have to avoid that someone uses a document with some modifications that could be wrong. In some cases, with processes descriptions, it is very important.
It would be ok if we could define a search that returns only the approved versions of the topics. I can display below a note with a link to the last approved revision, but it would be not enougth.
Any hint would be very helpful, thanks.
--
VictorFerrer - 2009-06-05
Discussion and Answer
You can probably replace the standard search topic with one that uses
QuerySearch, and use a hidden field to restrict the search to topics with the approved status.
Otherwise, you might hack the view of a topic to detect whether the user navigated to it by clicking on a
WebSearch result...
<script language='JavaScript' type='text/javascript'>
// If arrived here by clicking on a search result, for a redirect to the last approved version
myRegExp = /.*\/WebSearch.*/;
if (document.referrer.match(myRegExp)) {
location.href="/bin/view/%WEB%/%TOPIC%"
}
</script>
That
if should also check if the currently viewed topic is approved, so that only unapproved topics are reloaded.
--
SeanCMorgan - 2009-06-08
Ok, thanks for the hints. I see the idea, very interesting.
Anyway this would solve only part of the problem. I don't see how to actually redirect to the last approved revision of the topic: location.href="/bin/view/%WEB%/%TOPIC%"
If I understand right, this or the
QuerySearch approach would avoid that someone accesses a topic that is not in the status 'approved'. But we would need that the document is displayed in the search always, but pointing to the last approved revision of it. And would need some kind of recursion, because maybe the approved revision is not the previous one. Something like: If( rev > 1 && status = 'approved' ) view( topic.revision( rev - 1 ) )
Thank you again for the help! Victor
--
VictorFerrer - 2009-06-09
Sorry, I mean: If( rev > 1 && status !!= 'approved' ) view( topic.revision( rev - 1 ) )
--
VictorFerrer - 2009-06-09
I haven't used
WorkflowPlugin, but from its documentation, it looks like
%WORKFLOWLASTVERSION_State% would do the trick: "Expands to topic version when the document was last in the state
State ".
In your case, something like:
"/bin/view/%WEB%/%TOPIC%?rev=%WORKFLOWLASTVERSION_APPROVED%"
--
SeanCMorgan - 2009-06-09
Execellent, I'll try it!
Thank you!
--
VictorFerrer - 2009-06-12
One caveat: if the most recent version
is an approved version, you want to check that it it doesn't force a reload back to the previous approved version. That's what I was getting with my comment about the javascript
if.
Either way, please let us know how it goes, at this would seem to be a FAQ (or, Frequently Requested Feature, as the case may be).
--
SeanCMorgan - 2009-06-16
Anyone with an update on this issue? this is exactly what I'm looking for - may as well put it in the official plugin in the future.
--
TongMWang222 - 2009-06-28
Closing this question after more than 30 days of inactivity. Feel free to reopen if needed. Consider engaging one of the
TWiki consultants if you need timely help. We invite you to
get involved with the community, it is more likely you get community support if you support the open source project!
--
PeterThoeny - 2009-08-12
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.