diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php index a5fa4c6479f6f8c33ccb50abce33aca947f34dd6..c237e747fbc32878da7fe44aafe2c402d0835f7a 100644 --- a/include/class.dynamic_forms.php +++ b/include/class.dynamic_forms.php @@ -522,7 +522,7 @@ class DynamicFormField extends VerySimpleModel { } function hasFlag($flag) { - return ($this->flags & $flag) != 0; + return (isset($this->flags) && ($this->flags & $flag) != 0); } function getVisibilityDescription() { diff --git a/include/class.forms.php b/include/class.forms.php index c3d61ea25454a428252841834fbaa5c14ba1d822..0edab5b9da21784c71889b843dc1a722a77a7715 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -1486,10 +1486,6 @@ class PriorityField extends ChoiceField { function hasIdValue() { return true; } - function isChangeable() { - return $this->getForm()->get('type') != 'T' || - $this->get('name') != 'priority'; - } function getChoices() { global $cfg; diff --git a/include/class.organization.php b/include/class.organization.php index 214f7fb2e35c7cd89cb63a6ba4fe9e375ec9bcd2..0c6bb5212d2cd734091ad26c9c473d5deeda4b9f 100644 --- a/include/class.organization.php +++ b/include/class.organization.php @@ -136,7 +136,7 @@ class Organization extends OrganizationModel { function getDynamicData($create=true) { if (!isset($this->_entries)) { - $this->_entries = DynamicFormEntry::forOrganization($this->id)->all(); + $this->_entries = DynamicFormEntry::forObject($this->id, 'O')->all(); if (!$this->_entries && $create) { $g = OrganizationForm::getInstance($this->id, true); $g->save(); diff --git a/include/i18n/en_US/form.yaml b/include/i18n/en_US/form.yaml index 85c8fc00ab553dbe1b842e174a166e44314e92f0..363b9abef8642f8587fa85bf4d19854a1c68a746 100644 --- a/include/i18n/en_US/form.yaml +++ b/include/i18n/en_US/form.yaml @@ -97,8 +97,8 @@ type: priority # notrans name: priority # notrans label: Priority Level - sort: 0x430A3 - flags: 1 + flags: 0x430A3 + sort: 3 - type: C # notrans title: Company Information instructions: Details available in email templates diff --git a/include/staff/templates/dynamic-field-config.tmpl.php b/include/staff/templates/dynamic-field-config.tmpl.php index 6eaad7dc0a8677eed5332cf2e96811c37091188a..ab77ecf322896406be8efda9039d7c0c3b3a8a34 100644 --- a/include/staff/templates/dynamic-field-config.tmpl.php +++ b/include/staff/templates/dynamic-field-config.tmpl.php @@ -3,7 +3,7 @@ <hr/> <form method="post" action="#form/field-config/<?php echo $field->get('id'); ?>"> -<ul class="tabs"> +<ul class="tabs" id="fieldtabs"> <li class="active"><a href="#config"><i class="icon-cogs"></i> <?php echo __('Field Setup'); ?></a></li> <li><a href="#visibility"><i class="icon-beaker"></i> <?php echo __('Settings'); ?></a></li> </ul> diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php index f3ab38354b3c3b186fa0f04260df8e3342046fb3..4a2f57efafaa622b948833c7bc78886d0ae74765 100644 --- a/include/staff/ticket-view.inc.php +++ b/include/staff/ticket-view.inc.php @@ -379,7 +379,8 @@ $tcount+= $ticket->getNumNotes(); <ul id="threads"> <li><a class="active" id="toggle_ticket_thread" href="#"><?php echo sprintf(__('Ticket Thread (%d)'), $tcount); ?></a></li> </ul> -<div id="ticket_thread"> +<div id="ticket_tabs_container"> + <div id="ticket_thread" class="tab_content"> <?php $threadTypes=array('M'=>'message','R'=>'response', 'N'=>'note'); /* -------- Messages & Responses & Notes (if inline)-------------*/ @@ -448,24 +449,26 @@ $tcount+= $ticket->getNumNotes(); <ul class="tabs"> <?php if ($role->canPostReply()) { ?> - <li><a id="reply_tab" href="#reply"><?php echo __('Post Reply');?></a></li> + <li class="active"><a href="#reply"><?php echo __('Post Reply');?></a></li> <?php } ?> <li><a id="note_tab" href="#note"><?php echo __('Post Internal Note');?></a></li> <?php if ($role->canTransferTickets()) { ?> - <li><a id="transfer_tab" href="#transfer"><?php echo __('Department Transfer');?></a></li> + <li><a href="#transfer"><?php echo __('Department Transfer');?></a></li> <?php } if ($role->canAssignTickets()) { ?> - <li><a id="assign_tab" href="#assign"><?php echo $ticket->isAssigned()?__('Reassign Ticket'):__('Assign Ticket'); ?></a></li> + <li><a href="#assign"><?php + echo $ticket->isAssigned()?__('Reassign Ticket'):__('Assign Ticket'); ?></a></li> <?php } ?> </ul> <?php if ($role->canPostReply()) { ?> - <form id="reply" class="tab_content" action="tickets.php?id=<?php echo $ticket->getId(); ?>#reply" name="reply" method="post" enctype="multipart/form-data"> + <form id="reply" class="tab_content" action="tickets.php?id=<?php + echo $ticket->getId(); ?>" name="reply" method="post" enctype="multipart/form-data"> <?php csrf_token(); ?> <input type="hidden" name="id" value="<?php echo $ticket->getId(); ?>"> <input type="hidden" name="msgId" value="<?php echo $msgId; ?>"> @@ -732,7 +735,8 @@ print $note_form->getField('attachments')->render(); </form> <?php if ($role->canTransferTickets()) { ?> - <form id="transfer" class="tab_content" action="tickets.php?id=<?php echo $ticket->getId(); ?>#transfer" name="transfer" method="post" enctype="multipart/form-data"> + <form id="transfer" class="hidden tab_content" action="tickets.php?id=<?php + echo $ticket->getId(); ?>#transfer" name="transfer" method="post" enctype="multipart/form-data"> <?php csrf_token(); ?> <input type="hidden" name="ticket_id" value="<?php echo $ticket->getId(); ?>"> <input type="hidden" name="a" value="transfer"> @@ -792,7 +796,8 @@ print $note_form->getField('attachments')->render(); } ?> <?php if ($role->canAssignTickets()) { ?> - <form id="assign" class="tab_content" action="tickets.php?id=<?php echo $ticket->getId(); ?>#assign" name="assign" method="post" enctype="multipart/form-data"> + <form id="assign" class="hidden tab_content" action="tickets.php?id=<?php + echo $ticket->getId(); ?>#assign" name="assign" method="post" enctype="multipart/form-data"> <?php csrf_token(); ?> <input type="hidden" name="id" value="<?php echo $ticket->getId(); ?>"> <input type="hidden" name="a" value="assign"> diff --git a/scp/js/scp.js b/scp/js/scp.js index 46d4d318a59409082c609a26e8d8c9f3544b81b7..5c3101c667d134e0dfb1957ace6105d1f2bef1a6 100644 --- a/scp/js/scp.js +++ b/scp/js/scp.js @@ -628,14 +628,37 @@ $.uid = 1; //Tabs $(document).on('click.tab', 'ul.tabs li a', function(e) { - var target = $('.tab_content'+$(this).attr('href')); - if (target.length) { - var ul = $(this).closest('ul'); - ul.children('li.active').removeClass('active'); - $(this).closest('li').addClass('active'); - ul.parent().children('.tab_content').hide(); - target.fadeIn('fast'); + e.preventDefault(); + var $this = $(this), + $ul = $(this).closest('ul'), + $container = $('#'+$ul.attr('id')+'_container'); + if (!$container.length) + $container = $ul.parent(); + + var $tab = $($this.attr('href'), $container); + if (!$tab.length && $(this).data('url').length > 1) { + var url = $this.data('url'); + if (url.charAt(0) == '#') + url = 'ajax.php/' + url.substr(1); + $tab = $('<div>') + .addClass('tab_content') + .attr('id', $this.attr('href').substr(1)).hide(); + $container.append( + $tab.load(url, function () { + // TODO: Add / hide loading spinner + }) + ); + } + else { + $tab.addClass('tab_content'); $.changeHash($(this).attr('href'), true); + } + + if ($tab.length) { + $ul.children('li.active').removeClass('active'); + $(this).closest('li').addClass('active'); + $container.children('.tab_content').hide(); + $tab.fadeIn('fast'); return false; } });