This app is in development. The description is NOT STABLE.

The Constraints Soda application enables users with appropriate permissions to create and edit view constraints. 

Data Formats

HTML

When a page containing an Unknowns block is loaded, the HTML has the start and end of a full-width block that contains an Unknowns view that displays the unknowns. The start and end might for example be:

<div class="sodablock blockL" id="3_-9223372036854774266">
<div class="block-content">
<div class="sodarows" pluginname="Unknowns">

  .  .

</div>
</div>
</div>
<div class="sodablock blockL" id="3_-9223372036854774266">
<div class="block-content" pluginname="Unknowns">
<table class="sodarows">

  .  .

</table>
</div>
</div>

If the user has sufficient access permission to re-order the unknowns, the start and end would be:

<div class="sodablock blockL" id="3_-9223372036854774266">
<div class="block-content">
<div class="sodarows sodamovables ui-sortable" pluginname="Unknowns" id="Unknowns" key_unknown="Unknown" rank_unknown="Rank">

  .  .

</div>
</div>
</div>
<div class="sodablock blockL" id="3_-9223372036854774266">
<div class="block-content" pluginname="Unknowns">
<table class="sodarows">
<tbody class="sodamovables ui-sortable" key_unknown="Unknown" rank_unknown="Rank">

  .  .

<tbody>
</table>
</div>
</div>

There is an HTML div  in the content for each unknown. For example:

<div class="sodaviewsegment" id="3_-9223372036854774255">

  .  .

</div>

There is an HTML tr  in the content for each unknown. For example:

<tr class="sodaviewsegment" id="3_-9223372036854774255">

  .  .

</tr>

If the user has sufficient access permissions the div has the sodamovable class, and includes an Edit and Delete buttons and a Drag handle. This might for example be:

<div class="sodaviewsegment sodamovable" id="3_-9223372036854774255">
<div class="sodablockedittools">
<button alt="" command="view_start_edit" class="sodarowbutton sodarowevent" type="button"><img src="/soda/style/images/edit.png" draggable="false"></button>
<button alt="" command="delete" class="sodarowbutton sodarowevent" type="button"><img src="/soda/style/images/remove.png" draggable="false"></button>
<div class="sodamovehandle ui-sortable-handle" draggable="true"><img src="/soda/style/images/move.png" draggable="false"></div>
</div>

  .  .

</div>

If the user has sufficient access permissions the tr has the sodamovable class, and includes an Edit and Delete buttons and a Drag handle. This might for example be:

<tr class="sodaviewsegment sodamovable" id="I88_-9223372036853005805KAction Name">
<td> . . . </td>
   . . .
<td class="sodarowaction">
   <button alt="" action="view_prepare_edit" class="sodarowbutton sodarowevent" type="button">
      <img src="/soda/style/images/edit.png" draggable="false">
   </button>
   <button alt="" action="view_delete" parm2="unknown" class="sodarowbutton sodarowevent" type="button">
      <img src="/soda/style/images/remove.png" draggable="false">
   </button>
   <div class="sodamovehandle" draggable="true">
      <img src="/soda/style/images/move.png" draggable="false">
   </div>
</td>
</tr>

If the user has sufficient access permissions, there is also a div containing an Add button. This might for example be:

<div class="sodaviewsegment">
<button alt="" command="view_start_add" sodaplugin="Unknowns" class="sodarowbutton sodarowevent" type="button"><img src="/soda/style/images/add.png" draggable="false"></button>
</div>


Form Fields

The forms to add and edit unknowns have the following fields.

Name - text input

Type - select

Description - textarea

Priority - number input

Key - checkbox

Required - checkbox

Editable - checkbox

Reverse Sort Order - checkbox

Rank - number input



User Actions

When the user clicks an Add or Edit button, an API view_prepare_add or view_prepare_edit method is invoked to retrieve a form from the server. The form is displayed in place of the content of the Add div or the Unknown div that contained the Edit button. The form has Proceed and Cancel buttons. When the user clicks the Proceed button, the view_add or view_edit method is invoked to submit the form. If the request succeeds then it returns HTML text which is displayed in an additional div (for an Add) or in place of the original div (for an edit). If the request fails, then the form is re-displayed, with the returned error message. When the user clicks the Cancel button, the original div is re-displayed.

When the user clicks a Delete button, a confirmation dialog is displayed. If the user confirms the action, the API view_delete method is invoked. If it succeeds, the Unknown div containing the delete button is removed. 

The user can use the drag handles to re-order the unknowns. The API move-row method is invoked when an unknown is dropped.