Skip to main content
1-Visitor
October 29, 2012
Question

Tracking information removal - atict:info and atict:user - ACL scripting

  • October 29, 2012
  • 12 replies
  • 2400 views

Hi all


I am trying to remove the tracking information from the XML using the ACL scripting, I tried to use the 'xpath_nodeset' function to find the atict:elements with the correct XPath however it looks like the 'atict:' elements are somehow hidden. I also tried to use 'set changetrackingmarkers=full' to show the tracking elements however I was still not able to get the oid of the atict:elements with the 'xpath_nodeset' to be able to remove it.


Basically, I want to remove 'atict:info' and 'atict:user' after checking the attribute '@tracking' from 'info' element, if it is set to 'off' and there is no other atict:element (except for the 'info' and 'user') then both info and user elements should be removed from the XML. I hope it makes sense...


As always any help with this would be much appreciated! 😉


Thanks


Marcin


    12 replies

    1-Visitor
    November 13, 2012

    Hi


    Sharing as maybe someone will need to do similar thing. The only bit missing is to somehow remove the temp file on close however I was unsuccessful with that as it is still 'in use' when you use destroy callback.


    If anyone has experience with temp files please do let me know what's the best approach.


    Thanks


    Marcin



    # only continue if there is NO change tracking within the document.


    if ( !doc_has_change_tracking( $doc ) ) {

    # only continue if Change Tracking is not turned on.

    if ( doc_get( $doc, "changetracking" ) == '0' ) {

    #global $currentPath = doc_path(current_doc());
    #global $tempPath = $currentPath.'.temp';


    #save current as temp
    save_as -xml '$tempPath'
    #remove currentPath file (the original name)
    remove_file -f '$currentPath'
    #write to original name without atict:info atict:users
    write -ct changesapplied -xml '$currentPath'
    #close temp, open current, remove temp?
    }
    }

    1-Visitor
    November 14, 2012

    Hi again Marcin,


    I don't know the particulars, but the "save_as" creates a lock or destroy callback conflict that can't be avoided even with the "-ok" switch (overwrite without prompting) in the "write" command. The fastest way would be to use "move_file [oldname newname]" to rename files.


    local myfile = doc_path(current_doc());
    local file_tmp = myfile . "_temp.xml";

    write -ok -ct changesapplied -pi "$file_tmp";
    set modified=off; #avoid save prompt
    file_close();

    move_file $file_tmp $myfile;
    edit -newwindow -xml "$myfile";


    - Lou Argyres
    Continuing Education of the Bar (CEB)
    Oakland CA