Page tree
Skip to end of metadata
Go to start of metadata

Playground and DEMO space

This is a playground and demo space for ConfiForms and ConfiDoc addons developed and supported by Vertuna LLC

Most pages provide a storage format for the demo, so you can use the free add-on from Atlassian Confluence Source Editor to import this configuration into your Confluence and see it in action

Please note, all the examples here are provided without any obligation and may or may not be incomplete or may have bugs, and we provide NO SUPPORT for these examples and demos.


This is a storage format for the demo from Building custom report to show data per week with ConfiForms REST API and JavaScript


<p>form with following fields:</p>
<ac:structured-macro ac:macro-id="1a0c1488-5985-421d-95c1-12d4b36e8bc0" ac:name="code" ac:schema-version="1">
  <ac:plain-text-body><![CDATA[Location:
Date:
Set1
Set2
Set3]]></ac:plain-text-body>
</ac:structured-macro>
<p>
  <br/>
</p>
<p>Form</p>
<ac:structured-macro ac:macro-id="539b673a-658d-4876-95d1-1f00a3bb3bd5" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">f</ac:parameter>
  <ac:parameter ac:name="allowReads">true</ac:parameter>
  <ac:parameter ac:name="export">true</ac:parameter>
  <ac:rich-text-body>
    <p>
      <ac:structured-macro ac:macro-id="2c6511d4-77be-4387-9124-9f356222cd33" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">location</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Location</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="840ccaf2-0bc6-40e4-83b9-f84b2a7a7167" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">mydate</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Date</ac:parameter>
        <ac:parameter ac:name="type">date</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="ca57daa9-22e5-4d42-b7a2-540785492d22" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">set1</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Set 1</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="a6089570-7ac1-45a2-8e72-eff72383d9e1" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">set2</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Set 2</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="e0a5828f-7406-4f09-a77b-e14c37158183" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">set3</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Set 3</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
    <ac:structured-macro ac:macro-id="f544e640-738c-4b4b-9fa9-b1d0590ee4c7" ac:name="confiform-entry-register" ac:schema-version="1">
      <ac:parameter ac:name="embedded">true</ac:parameter>
      <ac:rich-text-body>
        <p>
          <br/>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
  </ac:rich-text-body>
</ac:structured-macro>
<p>All records</p>
<ac:structured-macro ac:macro-id="2f774bf5-0707-4325-baa1-07410d0c2cea" ac:name="confiform-table" ac:schema-version="1">
  <ac:parameter ac:name="formName">f</ac:parameter>
  <ac:rich-text-body>
    <p>
      <ac:structured-macro ac:macro-id="50d9fb3a-5c49-4477-b7d6-8a6498ba8ede" ac:name="confiform-field" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">location</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="b5baf6b7-1570-4d98-8ca8-7a7e33f22cb8" ac:name="confiform-field" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">mydate</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="b99e6986-1fc9-4de9-9c91-f1f07e76411a" ac:name="confiform-field" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">set1</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="ee47e2ba-990f-425b-9c4a-9d3665a203be" ac:name="confiform-field" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">set2</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="c07be8f7-ac00-472a-a8ef-e90423871709" ac:name="confiform-field" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">set3</ac:parameter>
      </ac:structured-macro>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>
<p>
  <br/>
</p>
<p>Order by date asc</p>
<ac:structured-macro ac:macro-id="276e819c-89ca-4712-8b66-312b4fe38e54" ac:name="confiform-table" ac:schema-version="1">
  <ac:parameter ac:name="formName">f</ac:parameter>
  <ac:parameter ac:name="sort">mydate ASC</ac:parameter>
  <ac:rich-text-body>
    <p>
      <ac:structured-macro ac:macro-id="174d1c5f-3cca-42f3-afd2-a5a186751a87" ac:name="confiform-field" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">location</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="6727ed11-a002-47db-8234-0b7bdb732392" ac:name="confiform-field" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">mydate</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="599d4152-7fbd-473c-ac0c-86a4a5b3b4c7" ac:name="confiform-field" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">set1</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="91abe4ee-1cbb-489d-8ef3-c1018d5eedcf" ac:name="confiform-field" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">set2</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="0e2e216e-4987-4cac-9939-ecdcb5d39b70" ac:name="confiform-field" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">set3</ac:parameter>
      </ac:structured-macro>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>
<p>
  <br/>
</p>
<p>Using REST API to show data PER WEEK</p>
<ac:structured-macro ac:macro-id="3f39f5ca-1938-47f2-a419-99136ea346e4" ac:name="code" ac:schema-version="1">
  <ac:plain-text-body><![CDATA[https://wiki.vertuna.com/ajax/confiforms/rest/filter.action?pageId=23265387&f=f&q=&sort=mydate%20ASC
]]></ac:plain-text-body>
</ac:structured-macro>
<p>Report is loaded with JavaScript and ConfiForms REST API</p>
<ac:structured-macro ac:macro-id="0fb8923e-370d-46db-bfab-2f50d025f487" ac:name="html" ac:schema-version="1">
  <ac:plain-text-body><![CDATA[<div id="confiReport"></div>


<script>
  AJS.toInit(function() {
	var isPageEdit = AJS.$('#content').hasClass('page edit');	


    if (!isPageEdit) {
      var url = 'https://wiki.vertuna.com/ajax/confiforms/rest/filter.action?pageId=23265387&f=f&q=&sort=mydate%20ASC';
	  var xhr = AJS.$.ajax({
  		url: url,
  		timeout: 10000, // 10 sec
  		success: function (data) {
            var currentWeek = confimoment().format('W');
            var runningWeek = null;
            var rows = data.list.entry;
			for (i=0;i<rows.length;i++) {
               var recordWeek = confimoment(new Date(rows[i].fields.mydate)).format('W');
			   console.log(confimoment(new Date(rows[i].fields.mydate)).format('W'));	
			   if (runningWeek == null || runningWeek != recordWeek) {
                 AJS.$('#confiReport').append('<h2>' + ((recordWeek == currentWeek ) ? 'Current week' : ( recordWeek + ' week')) + '</h2>');
               }


               AJS.$('#confiReport').append('<p> Set1: ' + rows[i].fields.set1 + '</p>');
			   AJS.$('#confiReport').append('<p> Set2: ' + rows[i].fields.set2 + '</p>');
			   AJS.$('#confiReport').append('<p> Set2: ' + rows[i].fields.set2 + '</p><br/>');
			   runningWeek = recordWeek; 
            }
    		console.log(data);
  		},
  		error: function (jqXHR, textStatus, errorThrown) {
    		console.log('request to get data from ConfiForms has failed... ' + textStatus);
  		}
	});
   }

  });
</script>

]]></ac:plain-text-body>
</ac:structured-macro>
<p>
  <br/>
</p>
<p>
  <br/>
</p>


  • No labels