How to prevent script running when a page loads


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">
    <p>Moved to own space: <ac:link>
        <ri:page ri:content-title="Reference Data Home" ri:space-key="RDS"/>
<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>
<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

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
Community showcase
Published Feb 07, 2019 in Marketplace Apps

A Timeless Love Story

It started as any story starts, on a normal, rainy day.   Admin meets App, and her name was Klok2, and like any first relationship we were both trying to make it work but neither one knew what...

441 views 8 26
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you