diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php index c6dbac5f979e4c40393ad435b45ef297bf9a2362..fa04624b29de1b0083d7bc92f8b65b62d32d58ae 100644 --- a/include/class.dynamic_forms.php +++ b/include/class.dynamic_forms.php @@ -616,8 +616,8 @@ class DynamicFormField extends VerySimpleModel { const FLAG_MASK_VIEW = 0x20000; const FLAG_MASK_NAME = 0x40000; - const MASK_MASK_INTERNAL = 0x400B0; # !change, !delete, !disable, !edit-name - const MASK_MASK_ALL = 0x700F0; + const MASK_MASK_INTERNAL = 0x400B2; # !change, !delete, !disable, !edit-name + const MASK_MASK_ALL = 0x700F2; const FLAG_CLIENT_VIEW = 0x00100; const FLAG_CLIENT_EDIT = 0x00200; @@ -1056,8 +1056,6 @@ class DynamicFormEntry extends VerySimpleModel { // even when stored elsewhere -- important during validation foreach ($this->getDynamicFields() as $f) { $f = $f->getImpl($f); - if ($f instanceof ThreadEntryField) - continue; $this->_fields[$f->get('id')] = $f; $f->isnew = true; } diff --git a/include/class.forms.php b/include/class.forms.php index 47d6ae86db45c1426e097387dce13d180bd2d088..2b85a204f9871e5610aa00a837f8f153dfa3cdbe 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -179,8 +179,8 @@ class Form { return new $rc($title, $options); } - function asTable($options=array()) { - return $this->getLayout(false, $options)->asTable($this); + function asTable($title=false, $options=array()) { + return $this->getLayout($title, $options)->asTable($this); // XXX: Media can't go in a table echo $this->getMedia(); } @@ -347,6 +347,14 @@ interface FormRenderer { abstract class FormLayout { static $default_cell_layout = 'Cell'; + var $title; + var $options; + + function __construct($title=false, $options=array()) { + $this->title = $title; + $this->options = $options; + } + function getLayout($field) { $layout = $field->get('layout') ?: static::$default_cell_layout; if (is_string($layout)) @@ -362,7 +370,8 @@ implements FormRenderer { ob_start(); ?> <table class="<?php echo 'grid form' ?>"> - <caption><?php echo Format::htmlchars($form->getTitle()); ?> + <colgroup width="8.333333%"><col span="12"/></colgroup> + <caption><?php echo Format::htmlchars($this->title ?: $form->getTitle()); ?> <div><small><?php echo Format::viewableImages($form->getInstructions()); ?></small></div> </caption> <tbody><tr><?php for ($i=0; $i<12; $i++) echo '<td style="width:8.3333%"/>'; ?></tr></tbody> @@ -1969,6 +1978,14 @@ class ThreadEntryField extends FormField { $config = $this->getConfiguration(); return $config['attachments']; } + + function getWidget($widgetClass=false) { + if ($hint = $this->get('hint')) + $this->set('placeholder', $hint); + $this->set('hint', null); + $widget = parent::getWidget($widgetClass); + return $widget; + } } class PriorityField extends ChoiceField { @@ -3347,7 +3364,7 @@ class DatetimePickerWidget extends Widget { } ?> <input type="text" name="<?php echo $this->name; ?>" - id="<?php echo $this->id; ?>" + id="<?php echo $this->id; ?>" style="display:inline-block;width:auto" value="<?php echo Format::htmlchars($this->value); ?>" size="12" autocomplete="off" class="dp" /> <script type="text/javascript"> @@ -3374,6 +3391,8 @@ class DatetimePickerWidget extends Widget { // TODO: Add time picker -- requires time picker or selection with // Misc::timeDropdown echo ' ' . Misc::timeDropdown($hr, $min, $this->name . ':time'); + + echo '</div>'; } /** @@ -3429,11 +3448,8 @@ class ThreadEntryWidget extends Widget { list($draft, $attrs) = Draft::getDraftAndDataAttrs($namespace, $object_id, $this->value); ?> - <span class="required"><?php - echo Format::htmlchars($this->field->getLocal('label')); - ?>: <span class="error">*</span></span><br/> <textarea style="width:100%;" name="<?php echo $this->field->get('name'); ?>" - placeholder="<?php echo Format::htmlchars($this->field->get('hint')); ?>" + placeholder="<?php echo Format::htmlchars($this->field->get('placeholder')); ?>" class="<?php if ($cfg->isRichTextEnabled()) echo 'richtext'; ?> draft draft-delete" <?php echo $attrs; ?> cols="21" rows="8" style="width:80%;"><?php echo diff --git a/include/class.misc.php b/include/class.misc.php index 4a7301782600c3cfe69b8b493d3ee02794bda8a8..69063c44229556fa6e1467224bfb4e01dc9d0604 100644 --- a/include/class.misc.php +++ b/include/class.misc.php @@ -160,7 +160,7 @@ class Misc { $min=0; ob_start(); - echo sprintf('<select name="%s" id="%s">',$name,$name); + echo sprintf('<select name="%s" id="%s" style="display:inline-block;width:auto">',$name,$name); echo '<option value="" selected>'.__('Time').'</option>'; for($i=23; $i>=0; $i--) { for($minute=45; $minute>=0; $minute-=15) { diff --git a/include/class.nav.php b/include/class.nav.php index e2dde777539cf2aa5157a68aa6fe4f559f01ae89..aafb4dc2562c92c4cc8cf09e2308cabf6343040a 100644 --- a/include/class.nav.php +++ b/include/class.nav.php @@ -177,7 +177,7 @@ class StaffNav { if($staff) { if ($staff->hasPerm(FAQ::PERM_MANAGE)) $subnav[]=array('desc'=>__('Categories'),'href'=>'categories.php','iconclass'=>'faq-categories'); - if ($cfg->isCannedResponseEnabled() && $staff->getRole()->hasPerm(Canned::PERM_MANAGE, false)) + if ($cfg->isCannedResponseEnabled() && $staff->hasPerm(Canned::PERM_MANAGE, false)) $subnav[]=array('desc'=>__('Canned Responses'),'href'=>'canned.php','iconclass'=>'canned'); } break; diff --git a/include/class.task.php b/include/class.task.php index f8c2ae765add39e30b48f182a8b1d617ad7b233b..7cede6194704e7b7a86b2761e4666115aebaedff 100644 --- a/include/class.task.php +++ b/include/class.task.php @@ -1287,12 +1287,14 @@ class TaskForm extends DynamicForm { 'label' => __('Department'), 'flags' => hexdec(0X450F3), 'required' => true, + 'layout' => new GridFluidCell(6), )), 'staff_id' => new AssigneeField(array( 'id'=>2, 'label' => __('Assignee'), 'flags' => hexdec(0X450F3), 'required' => false, + 'layout' => new GridFluidCell(6), )), 'duedate' => new DatetimeField(array( 'id' => 3, diff --git a/include/staff/tasks.inc.php b/include/staff/tasks.inc.php index ab826da6aeb550dd0fdcb42c2a4c62a0d86f410b..09e9bd3b27f2a1da59171dbd5760a8f87ab720d2 100644 --- a/include/staff/tasks.inc.php +++ b/include/staff/tasks.inc.php @@ -150,7 +150,7 @@ $_SESSION[':Q:tasks'] = $tasks; // Mass actions $actions = array(); -if ($thisstaff->hasPerm(Task::PERM_ASSIGN)) { +if ($thisstaff->hasPerm(Task::PERM_ASSIGN, false)) { $actions += array( 'assign' => array( 'icon' => 'icon-user', @@ -158,7 +158,7 @@ if ($thisstaff->hasPerm(Task::PERM_ASSIGN)) { )); } -if ($thisstaff->hasPerm(Task::PERM_TRANSFER)) { +if ($thisstaff->hasPerm(Task::PERM_TRANSFER, false)) { $actions += array( 'transfer' => array( 'icon' => 'icon-share', @@ -166,7 +166,7 @@ if ($thisstaff->hasPerm(Task::PERM_TRANSFER)) { )); } -if ($thisstaff->hasPerm(Task::PERM_DELETE)) { +if ($thisstaff->hasPerm(Task::PERM_DELETE, false)) { $actions += array( 'delete' => array( 'icon' => 'icon-trash', @@ -396,7 +396,7 @@ $(function() { var url = 'ajax.php/' +$(this).attr('href').substr(1) +'?_uid='+new Date().getTime(); - var $options = $(this).data('dialog'); + var $options = $(this).data('dialogConfig'); var $redirect = $(this).data('redirect'); $.dialog(url, [201], function (xhr) { if ($redirect) diff --git a/include/staff/templates/task-view.tmpl.php b/include/staff/templates/task-view.tmpl.php index 18ea9cd7a22f8eee3adf92a7ee667290c9a6b17b..1903035656819835db48cc297feffa400664a807 100644 --- a/include/staff/templates/task-view.tmpl.php +++ b/include/staff/templates/task-view.tmpl.php @@ -129,7 +129,7 @@ if ($task->isOverdue()) echo $action['class'] ?: 'task-action'; ?>" <?php if ($action['dialog']) - echo sprintf("data-dialog='%s'", $action['dialog']); + echo sprintf("data-dialog-config='%s'", $action['dialog']); if ($action['redirect']) echo sprintf("data-redirect='%s'", $action['redirect']); ?> @@ -149,7 +149,7 @@ if ($task->isOverdue()) echo $action['class'] ?: 'task-action'; ?>" <?php if ($action['dialog']) - echo sprintf("data-dialog='%s'", $action['dialog']); + echo sprintf("data-dialog-config='%s'", $action['dialog']); ?> href="<?php echo $action['href']; ?>"><i class="<?php @@ -486,7 +486,7 @@ $(function() { var url = 'ajax.php/' +$(this).attr('href').substr(1) +'?_uid='+new Date().getTime(); - var $options = $(this).data('dialog'); + var $options = $(this).data('dialogConfig'); var $redirect = $(this).data('redirect'); $.dialog(url, [201], function (xhr) { if ($redirect) diff --git a/include/staff/templates/task.tmpl.php b/include/staff/templates/task.tmpl.php index 1271318ba3a5e48b7715ec5577987882e5fa1056..e7743a79a9dd81d90760b8490861a6ec9e0a8d89 100644 --- a/include/staff/templates/task.tmpl.php +++ b/include/staff/templates/task.tmpl.php @@ -23,41 +23,15 @@ if ($info['error']) { } ?> <div id="new-task-form" style="display:block;"> <form method="post" class="org" action="<?php echo $info['action'] ?: '#tasks/add'; ?>"> - <table width="100%" class="fixed"> <?php $form = $form ?: TaskForm::getInstance(); - $form->render(true, - __('Create New Task'), + echo $form->getForm()->asTable(__('Create New Task'), array('draft-namespace' => $namespace) ); - ?> - <tr><th colspan=2><em><?php - echo __('Task Visibility & Assignment'); ?></em></th></tr> - <?php + $iform = $iform ?: TaskForm::getInternalForm(); - foreach ($iform->getFields() as $name=>$field) { ?> - <tr> - <td class="multi-line <?php if ($field->get('required')) echo 'required'; - ?>" style="min-width:120px;" > - <?php echo Format::htmlchars($field->get('label')); ?>:</td> - <td> - <fieldset id="field<?php echo $field->getWidget()->id; - ?>" <?php if (!$field->isVisible()) echo 'style="display:none;"'; ?>> - <?php echo $field->render(); ?> - <?php if ($field->get('required')) { ?> - <span class="error">*</span> - <?php - } - foreach ($field->errors() as $E) { - ?><div class="error"><?php echo $E; ?></div><?php - } ?> - </fieldset> - </td> - </tr> - <?php - } - ?> - </table> + echo $iform->asTable(__("Task Visibility & Assignment")); +?> <hr> <p class="full-width"> <span class="buttons pull-left"> diff --git a/include/staff/templates/tasks-actions.tmpl.php b/include/staff/templates/tasks-actions.tmpl.php index 378b0eb39ef290255142f615e825a11c976f7ea7..94fc18a19054665d849522c5e305b1a7b0103783 100644 --- a/include/staff/templates/tasks-actions.tmpl.php +++ b/include/staff/templates/tasks-actions.tmpl.php @@ -102,7 +102,7 @@ if ($actions) { <a class="no-pjax tasks-action" <?php if ($action['dialog']) - echo sprintf("data-dialog='%s'", $action['dialog']); + echo sprintf("data-dialog-config='%s'", $action['dialog']); if ($action['redirect']) echo sprintf("data-redirect='%s'", $action['redirect']); ?> diff --git a/include/staff/ticket-tasks.inc.php b/include/staff/ticket-tasks.inc.php index 6bab893e5abf68446f016f2df92a2d8621f36528..824ebb1542b65ab9c49c47d9b445bbff3b2dd0db 100644 --- a/include/staff/ticket-tasks.inc.php +++ b/include/staff/ticket-tasks.inc.php @@ -31,9 +31,9 @@ $showing = $pageNav->showing().' '._N('task', 'tasks', $count); <?php if ($role && $role->hasPerm(Task::PERM_CREATE)) { ?> <a - class="action-button ticket-task-action" + class="green button action-button ticket-task-action" data-url="tickets.php?id=<?php echo $ticket->getId(); ?>#tasks" - data-dialog='{"size":"large"}' + data-dialog-config='{"size":"large"}' href="#tickets/<?php echo $ticket->getId(); ?>/add-task"> <i class="icon-plus-sign"></i> <?php @@ -158,7 +158,7 @@ $(function() { +$(this).attr('href').substr(1) +'?_uid='+new Date().getTime(); var $redirect = $(this).data('href'); - var $options = $(this).data('dialog'); + var $options = $(this).data('dialogConfig'); $.dialog(url, [201], function (xhr) { var tid = parseInt(xhr.responseText); if (tid) { diff --git a/include/upgrader/streams/core/0d6099a6-98ad7d55.patch.sql b/include/upgrader/streams/core/0d6099a6-98ad7d55.patch.sql index ab6a3f7576c1cd4b8a633c503e4051334b04057e..35c654582659f8bb30eaddcc9fd1eef35eb68422 100644 --- a/include/upgrader/streams/core/0d6099a6-98ad7d55.patch.sql +++ b/include/upgrader/streams/core/0d6099a6-98ad7d55.patch.sql @@ -43,6 +43,13 @@ UPDATE `%TABLE_PREFIX%thread` A1 SET A1.`lastresponse` = A2.`lastresponse`, A1.`lastmessage` = A2.`lastmessage`; +-- Mark `message` field as externally stored +-- DynamicFormField::FLAG_EXT_STORED = 0x00002; +UPDATE `%TABLE_PREFIX%form_field` A1 + JOIN `%TABLE_PREFIX%form` A2 ON (A2.`id` = A1.`form_id`) + SET A1.`flags` = A1.`flags` | 0x00002 + WHERE A2.`type` = 'T' AND A1.`name` = 'message'; + -- Finished with patch UPDATE `%TABLE_PREFIX%config` SET `value` = '98ad7d550c26ac44340350912296e673' diff --git a/include/upgrader/streams/core/b26f29a6-1ee831c8.patch.sql b/include/upgrader/streams/core/b26f29a6-1ee831c8.patch.sql index 4eb98233d7ff69fad3fbafdcdb573b0304715a87..84df9fc92396ad1169464db4aa637c135d98cf20 100644 --- a/include/upgrader/streams/core/b26f29a6-1ee831c8.patch.sql +++ b/include/upgrader/streams/core/b26f29a6-1ee831c8.patch.sql @@ -250,13 +250,6 @@ UPDATE `%TABLE_PREFIX%ticket_attachment` A1 DROP TABLE `%TABLE_PREFIX%_unknown_inlines`; --- Mark `message` field as externally stored --- DynamicFormField::FLAG_EXT_STORED = 0x00002; -UPDATE `%TABLE_PREFIX%form_field` A1 - JOIN `%TABLE_PREFIX%form` A2 ON (A2.`id` = A1.`form_id`) - SET A1.`flags` = A1.`flags` | 0x00002 - WHERE A2.`type` = 'T' AND A1.`name` = 'message'; - -- Finished with patch UPDATE `%TABLE_PREFIX%config` SET `value` = '1ee831c854fe9f35115a3e672916bb91' diff --git a/scp/tasks.php b/scp/tasks.php index 757d507fdafed1caa75bf576a82b7af791800419..756b9fd577ac27f4c9d5a94745d652c0ecc23558 100644 --- a/scp/tasks.php +++ b/scp/tasks.php @@ -172,14 +172,14 @@ if (isset($_SESSION['advsearch:tasks'])) { (!$_REQUEST['status'] || $_REQUEST['status']=='search')); } -if ($thisstaff->hasPerm(TaskModel::PERM_CREATE)) { +if ($thisstaff->hasPerm(TaskModel::PERM_CREATE, false)) { $nav->addSubMenu(array('desc'=>__('New Task'), 'title'=> __('Open a New Task'), 'href'=>'#tasks/add', 'iconclass'=>'newTicket task-action', 'id' => 'new-task', 'attr' => array( - 'data-dialog' => '{"size":"large"}' + 'data-dialog-config' => '{"size":"large"}' ) ), ($_REQUEST['a']=='open')); @@ -206,7 +206,7 @@ if($task) { } else { $inc = 'tasks.inc.php'; if ($_REQUEST['a']=='open' && - $thisstaff->hasPerm(Task::PERM_CREATE)) + $thisstaff->hasPerm(Task::PERM_CREATE, false)) $inc = 'task-open.inc.php'; elseif($_REQUEST['a'] == 'export') { $ts = strftime('%Y%m%d');