Skip to main content
1-Visitor
April 29, 2010
Question

Check status of change tracking

  • April 29, 2010
  • 4 replies
  • 1304 views

Hello,

I have the below ACL code:

alias copyfit1 {
set changetracking=off
insert_pi 'xpp copyfittext1';
set changetracking=on}
map F1 copyfit1

As you can see that a PI is inserted. Our requirement is to turn the change tracking off when this PI is inserted. In the above code I could able to achieve this. But here is my issue - I do not want change tracking to be turned on when the PI is inserted for a docuemnt where we do not need change tracking at all i.e., if the document does not to be tracked whereas this PI should be inserted I do not want change tracking to be turned on after inserting the PI. For this can I check the status of change tracking in a document and have the code act according to the status of change tracking in the document.

Thanks in advance.

Karthik

    4 replies

    18-Opal
    April 29, 2010
    Hi Karthik-



    You can use doc_get(current_doc(),'changetracking') to get the current
    state of change tracking (where 1=on, 0=off). Try something like this:



    function copyfit1 (doc=current_doc()) {

    # save current state of changetracking

    local $ct = doc_get(doc,'changetracking');



    # turn off change tracking for PI insertion

    doc_set(doc,'changetracking',0);

    insert_pi 'xpp copyfittext1';



    # restore previous changetracking state

    doc_set(doc,'changetracking',$ct);

    }

    map F1 copyfit1();



    HTH.



    --Clay


    1-Visitor
    April 29, 2010
    Clay,

    Thanks a million. It works.

    Karthik
    1-Visitor
    May 5, 2010

    It was working till today but one of the user had bought up an issue on this:-(

    When you insert this PI in non-tracked section, the PI is inserted without change tracking. However if we insert the PI on a existing change tracking section it is still tracked. See the screenshots attached.

    I understand that the PI is been tracked because it is inside <atict:...> markup. So the only solution is to read the type of change track (add or deleted) close it before the PI and reopen it after PI.

    How do I handle this? If ACL can't help I have to look for XSLT may be.

    Karthik

    18-Opal
    May 5, 2010
    Hi Karthik-



    That's right, but it may be more complicated than you realize. Your
    strategy will work as long as the tracked change is just text inside an
    element, but consider the following case where the user has inserted an
    entire paragraph:



    <atict:add><para>Here is some text (insert PI here -> <-), blah blah
    blah.</para></atict:add>



    In this case, you can't just close the <atict:add>, insert the PI, and
    then open a new <atict:add> element, because then you'd have crossed
    elements and your document would no longer be well-formed XML.



    Is the case of inserting the PI into an already-existing tracked change
    really a problem? Presumably, if a change is already tracked, then
    either a) the change will be accepted, at which point the PI will be
    preserved along with the change, or b) the change will be rejected, in
    which case you probably want the PI to disappear with the rejected
    change anyway.



    --Clay