Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_notes/
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# CHANGE LOG
**4 August 2016**

* Fix: #7 district level approver list can now be left blank if needed. Final will be handled by last group level approver.
* Fix: #10 Special characters in goup name can now include / char.
* Fix: #11 If forms fields have identical label text they will now render correctly in email and when viewing/editing.

**16 July 2016**

* Fix: Fixed the query section of the update user page. Now you can update user information
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Workorders v2.0.0
# Workorders v2.0.1

A simple way for large groups to organize work using custom forms!

Expand Down
4 changes: 0 additions & 4 deletions src/classes/_notes/dwsync.xml

This file was deleted.

4 changes: 0 additions & 4 deletions src/dbquery/_notes/dwsync.xml

This file was deleted.

4 changes: 0 additions & 4 deletions src/dbquery/qryGROUP/_notes/dwsync.xml

This file was deleted.

4 changes: 0 additions & 4 deletions src/dbquery/qryUSER/_notes/dwsync.xml

This file was deleted.

12 changes: 7 additions & 5 deletions src/includes/pageformsbuild.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
$userAdapter = new UserDataAdapter($dsn, $user_name, $pass_word);
$userGroups = $userAdapter->SelectUniqueGroupNames();
$groupWorkflowSuffix = 'Workflow'; // appended to groupWorkflow id's
$illegalGroupChars = array(" ", "/"); // Include illegal characters for group name.
$replaceIllegalGroupChars = "-"; // Group name is used for HTML element id's so replace illegal chars with this char.
?>

<script type="text/javascript">
Expand Down Expand Up @@ -83,7 +85,7 @@ function handleNotificationsSelectOnChange(value)
<input id="formdesc" name="formdesc" type="hidden" value="<?php echo htmlspecialchars($result['Description']); ?>">
<input id="xmldata" name="xmldata" type="hidden" value="">
<input id="updateform" name="updateform" type="hidden" value="">
<input id="emailTags" name="workflow" type="text" hidden required value="<?php echo htmlspecialchars($result['Workflow']); ?>">
<input id="emailTags" name="workflow" type="text" hidden value="<?php echo htmlspecialchars($result['Workflow']); ?>">
<input id="finalEmailTags" name="notifyOnFinalApproval" type="text" value="<?php echo htmlspecialchars($result['notifyOnFinalApproval']); ?>" hidden>
<input id="groupWorkflows" name="groupWorkflows" type="text" hidden value="<?php echo htmlspecialchars($result['GroupWorkflows']); ?>">
<label class="checkbox-inline"><input name="formAvailable" type="checkbox" <?php if($result['Available'] == 1) {echo "checked";} ?>> Form Available For Submissions</label>
Expand Down Expand Up @@ -134,15 +136,15 @@ function handleNotificationsSelectOnChange(value)
<?php
// Build the group tabs
foreach ($userGroups as $key => $group) {
$hrefTabsGroupName = str_replace(" ", "-", $group->name);
$hrefTabsGroupName = str_replace($illegalGroupChars, $replaceIllegalGroupChars, $group->name);
echo '<li><a href="#tabs-' . $hrefTabsGroupName . '">' . $group->name . '</a></li>';
}
?>
</ul>
<?php
// build tab content for each group tab. Using Tagit for UI
foreach ($userGroups as $key => $group) {
$tabContentGroupName = str_replace(" ", "-", $group->name);
$tabContentGroupName = str_replace($illegalGroupChars, $replaceIllegalGroupChars, $group->name);
?>

<input id="<?php echo $tabContentGroupName . $groupWorkflowSuffix ?>" type="text" value="" hidden />
Expand Down Expand Up @@ -239,15 +241,14 @@ function handleNotificationsSelectOnChange(value)
</div>

</div>
hello
<!-- /#page-wrapper -->

<script>
// Read data from tag-it elements for each workflow group and compile for server.
var compileGroupWorkflowsData = function(){
var data = {};
userGroups.map(function(group){
var groupDashedName = group.name.replace(/ /g, '-');
var groupDashedName = group.name.replace(/ |\//g, '-');
var groupTags = jQuery("#" + groupDashedName + groupWorkflowSuffix).val().split(",");
data[groupDashedName] = groupTags;
});
Expand All @@ -274,6 +275,7 @@ function handleNotificationsSelectOnChange(value)
$(template).formRender(formRenderOpts);
jQuery('#formPreviewModal').modal();
});
// Use the required attribute on required form fields, then set the message below for the form field.
jQuery("#formsaveform").validate({
submitHandler: function(form){
var xmlString = formBuilder.data('formBuilder').formData;
Expand Down
5 changes: 0 additions & 5 deletions src/page_content/ADMIN/_notes/dwsync.xml

This file was deleted.

10 changes: 10 additions & 0 deletions src/resources/library/approver.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,16 @@ public static function MergeApproverArrays($groupApprovers, $approvers)
return $approvers;
}
}
/** Parse raw workflow data from form element. Expects a CSV of email addresses. returns array of email addresses. */
public static function ParseRawWorkflowData($workflowCsvData)
{
if ($workflowCsvData == "") {
$approverArray = array();
} else {
$approverArray = explode(',', $workflowCsvData);
}
return $approverArray;
}
}

/** Approve State for Workorders */
Expand Down
3 changes: 1 addition & 2 deletions src/resources/library/forms_db_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public function verifyAddFormFields($name, $desc, $xml, $workflow, $notifyOnFina
if ($desc == ""){$valid = False;}
if ($xml !== ""){
// TODO: Check for valid XML
if ($workflow == ""){$valid = false;}
}
return $valid;
}
Expand Down Expand Up @@ -199,7 +198,7 @@ public function renderFormsList()
$delformid = "delform" . $formid;

echo "<td><form id='$delformid' method='post'><input name='id' type='hidden' value='$formid'>
<input name='deleteform' type='hidden'><a href='' title='Delete Form' onclick=\"document.getElementById('$delformid').submit();return false;\" class='btn btn-danger'>X".$pg_encrypt_key."</a></form></td>";
<input name='deleteform' type='hidden'><a href='' title='Delete Form' onclick=\"document.getElementById('$delformid').submit();return false;\" class='btn btn-danger'>X</a></form></td>";
echo "</tr>";
}
echo "</tbody>";
Expand Down
8 changes: 5 additions & 3 deletions src/resources/library/workorder.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ private function CompileViewData()
$label = $this->GetFormXmlFieldLabelValue($key);
if ($label != null)
{
$this->fieldData[(string)$label] = $value;
$data["Label"] = (string)$label;
$data["Data"] = $value;
$this->fieldData[(string)$label . $this->fieldCount] = $data;
}
}
}
Expand Down Expand Up @@ -294,8 +296,8 @@ private function RenderWorkorderDetailsStringAsHtml($wo, $woViewModel = null)
$woBody .= "<div class='" . $woViewModel->stateColorClass . "'>" . $woViewModel->approveState . " (" . $wo->currentApprover . ")" . "</div>";
$woBody .= "</div>";
foreach ($woViewModel->fieldData as $fieldkey => $value) {
$woBody .= "<h4>" . $fieldkey . "</h4>";
$woBody .= "<P>" . $value . "</p>";
$woBody .= "<h4>" . $value["Label"] . "</h4>";
$woBody .= "<P>" . $value["Data"] . "</p>";
}
$woBody .= "<h3>Comments</h3>";
if (count($woViewModel->comments) == 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/views/createworkorder.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
$formName = $formPostHandler->formName; //$_POST['form-name'];
$formDescription = $formPostHandler->formDescription; //$_POST['form-description'];
// Form Workflow field holds array of approver email addresses. We need to transform this to work with the data.
$approverArray = explode(',', $form['Workflow']);
$approverArray = ApproverHelper::ParseRawWorkflowData($form['Workflow']);
$approvers = ApproverHelper::NewApproverArrayFromEmailArray($approverArray);
// Get the groupWorkflow for the users group
$groupWorkflows = $form['GroupWorkflows'];
Expand Down
4 changes: 2 additions & 2 deletions src/views/workorder.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@
echo "<h3>Submitted By</h3><span>" . $wo->createdBy . "</span>";
echo "</div>";
foreach ($woViewModel->fieldData as $fieldkey => $value) {
echo "<h4>" . $fieldkey . "</h4>";
echo "<P>" . $value . "</p>";
echo "<h4>" . $value["Label"] . "</h4>";
echo "<P>" . $value["Data"] . "</p>";
}
echo "<h4>Approver Comments</h4>";
if (count($woViewModel->comments) == 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/views/workorderupdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@
echo "<h3>Submitted By</h3><span>" . $wo->createdBy . "</span>";
echo "</div>";
foreach ($woViewModel->fieldData as $fieldkey => $value) {
echo "<h4>" . $fieldkey . "</h4>";
echo "<P>" . $value . "</p>";
echo "<h4>" . $value["Label"] . "</h4>";
echo "<P>" . $value["Data"] . "</p>";
}
echo "<h3>Comments</h3>";
if (count($woViewModel->comments) == 0) {
Expand Down