How to prevent script running when a page loads

Steve Brown May 1, 2013

Hi,

I am a consultant working at WorldPay in the UK. WorldPay are using Confluence 5.0 with the sql-script, run, and script plugins. WorldPay has paid for the sql-script pugin, and is evaluating the other two.

This is the markup:

<ac:macro ac:name="panel">
  <ac:rich-text-body>
    <p>Moved to own space: <ac:link>
        <ri:page ri:content-title="Reference Data Home" ri:space-key="RDS"/>
      </ac:link>
    </p>
  </ac:rich-text-body>
</ac:macro>
<p> </p>
<h2>BobSwift SQL Macro</h2>
<h4>The following table selects all records from the tmpControl table in the RelMgr MySQL database on UKDC1-TC-JIR02</h4>
<ac:macro ac:name="sql">
  <ac:parameter ac:name="dataSource">relmgr</ac:parameter>
  <ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter>
  <ac:plain-text-body><![CDATA[select * from tmpControl]]></ac:plain-text-body>
</ac:macro>
<p> </p>
<h3>Add or update values</h3> <ac:macro ac:name="run"> <ac:parameter ac:name="replace">A:default:Name,B:default:Value</ac:parameter> <ac:parameter ac:name="id">SQLTest1</ac:parameter> <ac:parameter ac:name="autoRun">false</ac:parameter> <ac:parameter ac:name="titleReset">Clear</ac:parameter> <ac:parameter ac:name="exportVersion">replace</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter> <ac:parameter ac:name="titleRun">Update</ac:parameter> <ac:rich-text-body> <ac:macro ac:name="sql"> <ac:parameter ac:name="dataSource">relmgr</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">BLOCK</ac:parameter> <ac:plain-text-body><![CDATA[insert into tmpControl set name='$A', value='$B']]></ac:plain-text-body> </ac:macro> </ac:rich-text-body>

The bold section is run whenever the page is loaded or refreshed (e.g. whenthe Preview button is pressed). How do we make it so that the macros in the highlighted section are run only when the button is pressed, i.e on demand?

Many thanks,

Steve Brown

1 answer

0 votes
Steve Brown May 1, 2013

To be clear the macro is the one after the "Add or update values" heading.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events