diff --git a/include/ajax.orgs.php b/include/ajax.orgs.php index 9b29f714834deffbf9ae08848442b7cc695bb705..def54cf3c549d98188a801a78199e52fd6b9e1ab 100644 --- a/include/ajax.orgs.php +++ b/include/ajax.orgs.php @@ -88,11 +88,10 @@ class OrgsAjaxAPI extends AjaxController { if (!$thisstaff) Http::response(403, 'Login Required'); elseif (!($org = Organization::lookup($id))) - Http::response(404, 'Unknown user'); + Http::response(404, 'Unknown organization'); $info = array(); if ($_SERVER['REQUEST_METHOD'] == 'DELETE') { - if ($org->delete()) Http::response(204, 'Organization deleted successfully'); else diff --git a/include/class.organization.php b/include/class.organization.php index a37665291ae9981258ca32ce5510412513172b2d..18b9f537d92735ad613b1fbc57af0f0e73f38284 100644 --- a/include/class.organization.php +++ b/include/class.organization.php @@ -124,10 +124,10 @@ class Organization extends OrganizationModel { } function delete() { + //TODO: delete or reset intrumented list. return parent::delete(); } - function update($vars, &$errors) { $valid = true; diff --git a/include/staff/templates/org-delete.tmpl.php b/include/staff/templates/org-delete.tmpl.php new file mode 100644 index 0000000000000000000000000000000000000000..17ab2bc6a94577e0967059c64050124ff2d910fa --- /dev/null +++ b/include/staff/templates/org-delete.tmpl.php @@ -0,0 +1,56 @@ +<?php + +if (!$info['title']) + $info['title'] = 'Delete '.Format::htmlchars($org->getName()); + +$info['warn'] = 'Deleted organization CANNOT be recovered'; + +?> +<h3><?php echo $info['title']; ?></h3> +<b><a class="close" href="#"><i class="icon-remove-circle"></i></a></b> +<hr/> +<?php + +if ($info['error']) { + echo sprintf('<p id="msg_error">%s</p>', $info['error']); +} elseif ($info['warn']) { + echo sprintf('<p id="msg_warning">%s</p>', $info['warn']); +} elseif ($info['msg']) { + echo sprintf('<p id="msg_notice">%s</p>', $info['msg']); +} ?> + +<div id="org-profile" style="margin:5px;"> + <i class="icon-group icon-4x pull-left icon-border"></i> + <div><b> <?php echo Format::htmlchars($org->getName()); ?></b></div> + <table style="margin-top: 1em;"> +<?php foreach ($org->getDynamicData() as $entry) { +?> + <tr><td colspan="2" style="border-bottom: 1px dotted black"><strong><?php + echo $entry->getForm()->get('title'); ?></strong></td></tr> +<?php foreach ($entry->getAnswers() as $a) { ?> + <tr style="vertical-align:top"><td style="width:30%;border-bottom: 1px dotted #ccc"><?php echo Format::htmlchars($a->getField()->get('label')); + ?>:</td> + <td style="border-bottom: 1px dotted #ccc"><?php echo $a->display(); ?></td> + </tr> +<?php } +} +?> + </table> + <div class="clear"></div> + <hr> + <form method="delete" class="org" + action="#orgs/<?php echo $org->getId(); ?>/delete"> + <input type="hidden" name="id" value="<?php echo $org->getId(); ?>" /> + <p class="full-width"> + <span class="buttons" style="float:left"> + <input type="reset" value="Reset"> + <input type="button" name="cancel" class="close" + value="No, Cancel"> + </span> + <span class="buttons" style="float:right"> + <input type="submit" value="Yes, Delete"> + </span> + </p> + </form> +</div> +<div class="clear"></div>