> Is there an easy way to access the username that an author used when
logging into to a 

> remote database via a vdrive plugin? I'd like to autopopulate
draft-comment elements with the date and the author's name.

 

> i.e. <draft-comment user='hookerje' date='09062010'>Comment
here</draft-comment>

 

 

Jeff, here's the macro code I use to insert the OS user and a datetime
into a draft-comment. (Note that the two "run" commands assume the OS is
Windows, but there is a way to create OS-specific varieties of these, if
needed.)

 

  <command name="addDraftComment">

    <macro>

      <sequence>

        <choice>

          <command name="insert" parameter="into draft-comment"/>

          <command name="insert" parameter="after[implicitElement]
draft-comment"/>

          <command name="insert" parameter="before[implicitElement]
draft-comment"/>

        </choice>

        <command name="run" parameter="date /t"/>

        <set variable="theDate" expression="%_" plainString="true"/>

        <command name="run" parameter="time /t"/>

        <set variable="theTime" expression="%_" plainString="true"/>

        <get expression="normalize-space(concat($theDate,$theTime))"/>

        <command name="putAttribute" parameter="[implicitElement] time
'%_'"/>

        <command name="putAttribute" parameter="[implicitElement] author
%U"/> 

      </sequence>

    </macro>

  </command>

 

 

I actually have this code modularized across a few different macros,
pardon any errors in translation. HTH!

 
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to