-
+
|
branchBox' style='overflow:visible'> |
|
@@ -315,8 +315,8 @@ foreach(explode(',', $config->bug->create->requiredFields) as $field)
foreach($extendFields as $extendField) echo "control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->flow->getFieldControl($extendField, '', $extendField->field . "[$i]") . " | ";
?>
-
-
+
+
|
diff --git a/module/common/view/pastetext.html.php b/module/common/view/pastetext.html.php
index f2d4f56275..59a248b6da 100644
--- a/module/common/view/pastetext.html.php
+++ b/module/common/view/pastetext.html.php
@@ -30,8 +30,8 @@ $(function()
var moduleArr = ['task', 'story', 'bug', 'testcase'];
if($.inArray(config.currentModule, moduleArr) >= 0 && config.currentMethod == 'batchcreate')
{
- lastIndex = itemIndex;
- itemIndex ++;
+ lastIndex = rowIndex;
+ rowIndex ++;
}
var $newRow = $(rowTpl.replace(/%s/g, lastIndex + 1));
diff --git a/module/story/js/batchcreate.js b/module/story/js/batchcreate.js
index 585b1b2799..c4de3579a9 100644
--- a/module/story/js/batchcreate.js
+++ b/module/story/js/batchcreate.js
@@ -1,6 +1,7 @@
$(function()
{
- if($('#batchCreateForm table thead tr th.col-name').width() < 200) $('#batchCreateForm table thead tr th.col-name').width(200);
+ $name = $('#batchCreateForm table thead tr th.col-name');
+ if($name.width() < 200) $name.width(200);
$('#customField').click(function()
{
@@ -10,39 +11,11 @@ $(function()
/* Implement a custom form without feeling refresh. */
$('#formSettingForm .btn-primary').click(function()
{
- var fields = '';
- $('#formSettingForm > .checkboxes > .checkbox-primary > input:checked').each(function()
- {
- fields += ',' + $(this).val();
- });
-
- var link = createLink('custom', 'ajaxSaveCustomFields', 'module=story§ion=custom&key=batchCreateFields');
- $.post(link, {'fields' : fields}, function()
- {
- showFields = fields;
- showCheckedFields(fields);
- $('#formSetting').parent().removeClass('open');
-
- var fieldCount = $('#batchCreateForm .table thead>tr>th:visible').length;
- $('.form-actions').attr('colspan', fieldCount);
-
- if(fieldCount > 8)
- {
- $('#batchCreateForm > .table-responsive').removeClass('scroll-none');
- $('#batchCreateForm > .table-responsive').css('overflow', 'auto');
- }
- else
- {
- $('#batchCreateForm > .table-responsive').addClass('scroll-none');
- $('#batchCreateForm > .table-responsive').css('overflow', 'visible');
- }
-
- if($('#batchCreateForm table thead tr th.col-name').width() < 200) $('#batchCreateForm table thead tr th.col-name').width(200);
- });
-
+ saveCustomFields('batchCreateFields', 8, $name, 200);
return false;
});
});
+
$(document).on('click', '.chosen-with-drop', function()
{
var select = $(this).prev('select');
diff --git a/module/story/js/common.js b/module/story/js/common.js
index 69553dc63e..191033a664 100644
--- a/module/story/js/common.js
+++ b/module/story/js/common.js
@@ -28,48 +28,3 @@ function getStatus(method, params)
$('form #status').val(status).change();
});
}
-
-/**
- * Show checked fields.
- *
- * @param string fields
- * @access public
- * @return void
- */
-function showCheckedFields(fields)
-{
- var fieldList = ',' + fields + ',';
- $('#formSettingForm > .checkboxes > .checkbox-primary > input').each(function()
- {
- var field = ',' + $(this).val() + ',';
- var $field = config.currentMethod == 'create' ? $('#' + $(this).val()) : $('[name^=' + $(this).val() + ']');
- var required = ',' + requiredFields + ',';
- var $fieldBox = $('.' + $(this).val() + 'Box' );
- if(fieldList.indexOf(field) >= 0 || required.indexOf(field) >= 0)
- {
- $fieldBox.removeClass('hidden');
- $field.removeAttr('disabled');
- }
- else if(!$fieldBox.hasClass('hidden'))
- {
- $fieldBox.addClass('hidden');
- $field.attr('disabled', true);
- }
- });
-}
-
-/**
- * Hidden require field.
- *
- * @access public
- * @return void
- */
-function hiddenRequireFields()
-{
- $('#formSettingForm > .checkboxes > .checkbox-primary > input').each(function()
- {
- var field = ',' + $(this).val() + ',';
- var required = ',' + requiredFields + ',';
- if(required.indexOf(field) >= 0) $(this).closest('div').addClass('hidden');
- });
-}
diff --git a/module/story/js/create.js b/module/story/js/create.js
index b9096a1397..f6abfc3c58 100644
--- a/module/story/js/create.js
+++ b/module/story/js/create.js
@@ -55,20 +55,7 @@ $(function()
/* Implement a custom form without feeling refresh. */
$('#formSettingForm .btn-primary').click(function()
{
- var fields = '';
- $('#formSettingForm > .checkboxes > .checkbox-primary > input:checked').each(function()
- {
- fields += ',' + $(this).val();
- });
-
- var link = createLink('custom', 'ajaxSaveCustomFields', 'module=story§ion=custom&key=createFields');
- $.post(link, {'fields' : fields}, function()
- {
- showFields = fields;
- showCheckedFields(fields);
- $('#formSetting').parent().removeClass('open');
- });
-
+ saveCustomFields('createFields');
return false;
});
});
diff --git a/module/story/view/batchcreate.html.php b/module/story/view/batchcreate.html.php
index f7e395c4ef..f161b56f0d 100755
--- a/module/story/view/batchcreate.html.php
+++ b/module/story/view/batchcreate.html.php
@@ -122,8 +122,8 @@
foreach($extendFields as $extendField) echo "
control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->flow->getFieldControl($extendField, '', $extendField->field . '[$id]') . " | ";
?>
-
-
+
+
|
@@ -142,7 +142,7 @@
-
+
| branchBox'> |
|
planBox' style='overflow:visible'> |
@@ -186,8 +186,8 @@
foreach($extendFields as $extendField) echo "control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->flow->getFieldControl($extendField, '', $extendField->field . "[$i]") . " | ";
?>
-
-
+
+
|
@@ -204,7 +204,7 @@ $(function()
idEnd: ,
rowCreator: function($row, index)
{
- itemIndex = index; // Set the index for the add element operation
+ rowIndex = index; // Set the index for the add element operation
$row.find('select.chosen,select.picker-select').each(function()
{
var $select = $(this);
@@ -217,34 +217,35 @@ $(function()
{
$select.next('.chosen-container').find('.chosen-drop').width($select.closest('td').width() + 50);
}, 200);
- });
- var storyTitle = storyTitles && storyTitles[index - 1];
- if (storyTitle !== undefined && storyTitle !== null)
- {
- $row.find('.input-story-title').val(storyTitle).after('
');
- }
+ });
- if(index == 1) $row.find('td.c-actions > a:last').remove();
+ var storyTitle = storyTitles && storyTitles[index - 1];
+ if (storyTitle !== undefined && storyTitle !== null)
+ {
+ $row.find('.input-story-title').val(storyTitle).after('
');
+ }
- /* Implement a custom form without feeling refresh. */
- var fieldList = ',' + showFields + ',';
- $('#formSettingForm > .checkboxes > .checkbox-primary > input').each(function()
- {
- var field = ',' + $(this).val() + ',';
- var $field = $row.find('[name^=' + $(this).val() + ']');
- var required = ',' + requiredFields + ',';
- var $fieldBox = $row.find('.' + $(this).val() + 'Box' );
- if(fieldList.indexOf(field) >= 0 || required.indexOf(field) >= 0)
- {
- $fieldBox.removeClass('hidden');
- $field.removeAttr('disabled');
- }
- else if(!$fieldBox.hasClass('hidden'))
- {
- $fieldBox.addClass('hidden');
- $field.attr('disabled', true);
- }
- })
+ if(index == 1) $row.find('td.c-actions > a:last').remove();
+
+ /* Implement a custom form without feeling refresh. */
+ var fieldList = ',' + showFields + ',';
+ $('#formSettingForm > .checkboxes > .checkbox-primary > input').each(function()
+ {
+ var field = ',' + $(this).val() + ',';
+ var $field = $row.find('[name^=' + $(this).val() + ']');
+ var required = ',' + requiredFields + ',';
+ var $fieldBox = $row.find('.' + $(this).val() + 'Box' );
+ if(fieldList.indexOf(field) >= 0 || required.indexOf(field) >= 0)
+ {
+ $fieldBox.removeClass('hidden');
+ $field.removeAttr('disabled');
+ }
+ else if(!$fieldBox.hasClass('hidden'))
+ {
+ $fieldBox.addClass('hidden');
+ $field.attr('disabled', true);
+ }
+ })
}
});
diff --git a/module/task/js/batchcreate.js b/module/task/js/batchcreate.js
index 06a4d3fd86..334ec01eeb 100755
--- a/module/task/js/batchcreate.js
+++ b/module/task/js/batchcreate.js
@@ -2,7 +2,8 @@
$(function()
{
removeDitto();
- if($('th.c-name').width() < 165) $('th.c-name').width(165);
+ $name = $('th.c-name');
+ if($name.width() < 165) $name.width(165);
if(taskConsumed > 0) bootbox.alert(addChildTask);
$('#customField').on('click', function(){$('#tableBody .chosen-with-drop').removeClass('chosen-with-drop chosen-container-active')});
@@ -14,36 +15,7 @@ $(function()
/* Implement a custom form without feeling refresh. */
$('#formSettingForm .btn-primary').click(function()
{
- var fields = '';
- $('#formSettingForm > .checkboxes > .checkbox-primary > input:checked').each(function()
- {
- fields += ',' + $(this).val();
- });
-
- var link = createLink('custom', 'ajaxSaveCustomFields', 'module=task§ion=custom&key=batchCreateFields');
- $.post(link, {'fields' : fields}, function()
- {
- showFields = fields;
- showCheckedFields(fields);
- $('#formSetting').parent().removeClass('open');
-
- var fieldCount = $('#batchCreateForm .table thead>tr>th:visible').length;
- $('.form-actions').attr('colspan', fieldCount);
-
- if(fieldCount > 9)
- {
- $('#batchCreateForm > .table-responsive').removeClass('scroll-none');
- $('#batchCreateForm > .table-responsive').css('overflow', 'auto');
- }
- else
- {
- $('#batchCreateForm > .table-responsive').addClass('scroll-none');
- $('#batchCreateForm > .table-responsive').css('overflow', 'visible');
- }
-
- if($('th.c-name').width() < 165) $('th.c-name').width(165);
- });
-
+ saveCustomFields('batchCreateFields', 9, $name, 165);
return false;
});
});
diff --git a/module/task/js/common.js b/module/task/js/common.js
index fe129b6afe..cdd030d6d3 100644
--- a/module/task/js/common.js
+++ b/module/task/js/common.js
@@ -19,65 +19,3 @@ function setStoryModule()
});
}
}
-
-/**
- * Show checked fields.
- *
- * @param string fields
- * @access public
- * @return void
- */
-function showCheckedFields(fields)
-{
- var fieldList = ',' + fields + ',';
- $('#formSettingForm > .checkboxes > .checkbox-primary > input').each(function()
- {
- var field = ',' + $(this).val() + ',';
- var $field = config.currentMethod == 'create' ? $('#' + $(this).val()) : $('[name^=' + $(this).val() + ']');
- var $fieldBox = $('.' + $(this).val() + 'Box' );
- if(fieldList.indexOf(field) >= 0)
- {
- $fieldBox.removeClass('hidden');
- $field.removeAttr('disabled');
- }
- else if(!$fieldBox.hasClass('hidden'))
- {
- $fieldBox.addClass('hidden');
- $field.attr('disabled', true);
- }
- });
-
- if(config.currentMethod == 'create');
- {
- if(fieldList.indexOf(',estStarted,') >= 0 && fieldList.indexOf(',deadline,') >= 0)
- {
- $('.borderBox').removeClass('hidden');
- }
- else if(fieldList.indexOf(',estStarted,') >= 0 || fieldList.indexOf(',deadline,') >= 0)
- {
- $('.datePlanBox').removeClass('hidden');
- if(!$('.borderBox').hasClass('hidden')) $('.borderBox').addClass('hidden');
- }
- else
- {
- if(!$('.borderBox').hasClass('hidden')) $('.borderBox').addClass('hidden');
- if(!$('.datePlanBox').hasClass('hidden')) $('.datePlanBox').addClass('hidden');
- }
- }
-}
-
-/**
- * Hidden require field.
- *
- * @access public
- * @return void
- */
-function hiddenRequireFields()
-{
- $('#formSettingForm > .checkboxes > .checkbox-primary > input').each(function()
- {
- var field = ',' + $(this).val() + ',';
- var required = ',' + requiredFields + ',';
- if(required.indexOf(field) >= 0) $(this).closest('div').addClass('hidden');
- });
-}
diff --git a/module/task/js/create.js b/module/task/js/create.js
index c6b28b6a97..d5a95fd922 100644
--- a/module/task/js/create.js
+++ b/module/task/js/create.js
@@ -8,19 +8,7 @@ $(function()
/* Implement a custom form without feeling refresh. */
$('#formSettingForm .btn-primary').click(function()
{
- var fields = '';
- $('#formSettingForm > .checkboxes > .checkbox-primary > input:checked').each(function()
- {
- fields += ',' + $(this).val();
- });
-
- var link = createLink('custom', 'ajaxSaveCustomFields', 'module=task§ion=custom&key=createFields');
- $.post(link, {'fields' : fields}, function()
- {
- showCheckedFields(fields);
- $('#formSetting').parent().removeClass('open');
- });
-
+ saveCustomFields('createFields');
return false;
});
})
diff --git a/module/task/view/batchcreate.html.php b/module/task/view/batchcreate.html.php
index 6626b15de9..e5b7f5460f 100755
--- a/module/task/view/batchcreate.html.php
+++ b/module/task/view/batchcreate.html.php
@@ -175,9 +175,9 @@ $colspan = count($visibleFields) + 3;
foreach($extendFields as $extendField) echo "
control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->flow->getFieldControl($extendField, '', $extendField->field . "[$i]") . " | ";
?>
-
+
-
+
|
@@ -195,7 +195,7 @@ $colspan = count($visibleFields) + 3;
-
+
@@ -251,8 +251,8 @@ $colspan = count($visibleFields) + 3;
foreach($extendFields as $extendField) echo "| control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->flow->getFieldControl($extendField, '', $extendField->field . "[%s]") . " | ";
?>
-
-
+
+
|
@@ -260,7 +260,7 @@ $colspan = count($visibleFields) + 3;
-
+
|
@@ -320,8 +320,8 @@ $colspan = count($visibleFields) + 3;
foreach($extendFields as $extendField) echo " | control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->flow->getFieldControl($extendField, '', $extendField->field . "[$i]") . " | ";
?>
-
-
+
+
|
diff --git a/module/testcase/js/batchcreate.js b/module/testcase/js/batchcreate.js
index 334a133631..7480f4f066 100644
--- a/module/testcase/js/batchcreate.js
+++ b/module/testcase/js/batchcreate.js
@@ -1,7 +1,8 @@
$(document).ready(function()
{
removeDitto();//Remove 'ditto' in first row.
- if($('#batchCreateForm table thead tr th.c-title').width() < 170) $('#batchCreateForm table thead tr th.c-title').width('170');
+ var $title = $('#batchCreateForm table thead tr th.c-title');
+ if($title.width() < 170) $title.width('170');
$(document).keydown(function(event)
{
@@ -35,35 +36,7 @@ $(document).ready(function()
/* Implement a custom form without feeling refresh. */
$('#formSettingForm .btn-primary').click(function()
{
- var fields = '';
- $('#formSettingForm > .checkboxes > .checkbox-primary > input:checked').each(function()
- {
- fields += ',' + $(this).val();
- });
-
- var link = createLink('custom', 'ajaxSaveCustomFields', 'module=testcase§ion=custom&key=batchCreateFields');
- $.post(link, {'fields' : fields}, function()
- {
- showCheckedFields(fields);
- $('#formSetting').parent().removeClass('open');
-
- var fieldCount = $('#batchCreateForm .table thead>tr>th:visible').length;
- $('.form-actions').attr('colspan', fieldCount);
-
- if(fieldCount > 8)
- {
- $('#batchCreateForm > .table-responsive').removeClass('scroll-none');
- $('#batchCreateForm > .table-responsive').css('overflow', 'auto');
- }
- else
- {
- $('#batchCreateForm > .table-responsive').addClass('scroll-none');
- $('#batchCreateForm > .table-responsive').css('overflow', 'visible');
- }
-
- if($('#batchCreateForm table thead tr th.c-title').width() < 170) $('#batchCreateForm table thead tr th.c-title').width('170');
- });
-
+ saveCustomFields('batchCreateFields', 8, $title, 170);
return false;
});
});
diff --git a/module/testcase/js/common.js b/module/testcase/js/common.js
index cd380b77b7..b9f686ff18 100644
--- a/module/testcase/js/common.js
+++ b/module/testcase/js/common.js
@@ -370,7 +370,7 @@ function loadStories(productID, moduleID, num)
if(!stories) stories = '
';
if(config.currentMethod == 'batchcreate')
{
- for(var i = num; i <= itemIndex ; i ++)
+ for(var i = num; i <= rowIndex ; i ++)
{
if(i != num && $('#module' + i).val() != 'ditto') break;
var nowStories = stories.replaceAll('story' + num, 'story' + i);
@@ -426,50 +426,3 @@ function setModules(branchID, productID, num)
$('#plan' + (num + 1)).trigger("chosen:updated");
}
}
-
-/**
- * Show checked fields.
- *
- * @param string fields
- * @access public
- * @return void
- */
-function showCheckedFields(fields)
-{
- showFields = fields;
-
- var fieldList = ',' + fields + ',';
- $('#formSettingForm > .checkboxes > .checkbox-primary > input').each(function()
- {
- var field = ',' + $(this).val() + ',';
- var $field = config.currentMethod == 'create' ? $('#' + $(this).val()) : $('[name^=' + $(this).val() + ']');
- var required = ',' + requiredFields + ',';
- var $fieldBox = $('.' + $(this).val() + 'Box' );
- if(fieldList.indexOf(field) >= 0 || required.indexOf(field) >= 0)
- {
- $fieldBox.removeClass('hidden');
- $field.removeAttr('disabled');
- }
- else if(!$fieldBox.hasClass('hidden'))
- {
- $fieldBox.addClass('hidden');
- $field.attr('disabled', true);
- }
- });
-}
-
-/**
- * Hidden require field.
- *
- * @access public
- * @return void
- */
-function hiddenRequireFields()
-{
- $('#formSettingForm > .checkboxes > .checkbox-primary > input').each(function()
- {
- var field = ',' + $(this).val() + ',';
- var required = ',' + requiredFields + ',';
- if(required.indexOf(field) >= 0) $(this).closest('div').addClass('hidden');
- });
-}
diff --git a/module/testcase/js/create.js b/module/testcase/js/create.js
index 9acacae0da..d10755f5a4 100644
--- a/module/testcase/js/create.js
+++ b/module/testcase/js/create.js
@@ -165,19 +165,7 @@ $(function()
/* Implement a custom form without feeling refresh. */
$('#formSettingForm .btn-primary').click(function()
{
- var fields = '';
- $('#formSettingForm > .checkboxes > .checkbox-primary > input:checked').each(function()
- {
- fields += ',' + $(this).val();
- });
-
- var link = createLink('custom', 'ajaxSaveCustomFields', 'module=testcase§ion=custom&key=createFields');
- $.post(link, {'fields' : fields}, function()
- {
- showCheckedFields(fields);
- $('#formSetting').parent().removeClass('open');
- });
-
+ saveCustomFields('createFields');
return false;
});
});
diff --git a/module/testcase/view/batchcreate.html.php b/module/testcase/view/batchcreate.html.php
index afdaef41f7..86afac21b6 100644
--- a/module/testcase/view/batchcreate.html.php
+++ b/module/testcase/view/batchcreate.html.php
@@ -114,9 +114,9 @@
foreach($extendFields as $extendField) echo "
control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->flow->getFieldControl($extendField, '', $extendField->field . "[$i]") . " | ";
?>
-
+
-
+
|
@@ -134,7 +134,7 @@
-
+
@@ -165,9 +165,9 @@
foreach($extendFields as $extendField) echo "| control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->flow->getFieldControl($extendField, '', $extendField->field . "[%s]") . " | ";
?>
-
+
-
+
|
@@ -176,7 +176,7 @@
-
+
|
branchBox'> |
moduleBox' style='overflow:visible'> |
@@ -204,8 +204,8 @@
foreach($extendFields as $extendField) echo "control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->flow->getFieldControl($extendField, '', $extendField->field . "[$i]") . " | ";
?>
-
-
+
+
|
diff --git a/www/js/my.full.js b/www/js/my.full.js
index b3ca7a4eac..24f8cc04a3 100644
--- a/www/js/my.full.js
+++ b/www/js/my.full.js
@@ -1034,35 +1034,169 @@ $(document).ready(function()
});
/**
- * Add item box.
+ * Add row.
*
* @param object $obj
* @access public
* @return void
*/
-function addItemBox(obj)
+function addRow(obj)
{
- var item = $('#addItemBox').html().replace(/%i%/g, itemIndex + 1);
- $('
' + item + '
').insertAfter($(obj).closest('tr'));
+ var row = $('#addRow').html().replace(/%i%/g, rowIndex + 1);
+ $('
' + row + '
').insertAfter($(obj).closest('tr'));
- $(obj).closest('tr').next().find(".form-date").datepicker();
- $(obj).closest('tr').next().find("input[name^=color]").colorPicker();
- $(obj).closest('tr').next().find('div[id$=_chosen]').remove();
- $(obj).closest('tr').next().find('.picker').remove();
- $(obj).closest('tr').next().find('.chosen').chosen();
- $(obj).closest('tr').next().find('.picker-select').picker();
+ var $row = $(obj).closest('tr').next();
- itemIndex ++;
+ $row.find(".form-date").datepicker();
+ $row.find("input[name^=color]").colorPicker();
+ $row.find('div[id$=_chosen]').remove();
+ $row.find('.picker').remove();
+ $row.find('.chosen').chosen();
+ $row.find('.picker-select').picker();
+
+ rowIndex ++;
}
/**
- * Delete item box.
+ * Delete row.
*
* @param object $obj
* @access public
* @return void
*/
-function deleteItemBox(obj)
+function deleteRow(obj)
{
$(obj).closest('tr').remove();
}
+
+/**
+ * Show checked fields.
+ *
+ * @param string fields
+ * @access public
+ * @return void
+ */
+function showCheckedFields(fields)
+{
+ var fieldList = ',' + fields + ',';
+ $('#formSettingForm > .checkboxes > .checkbox-primary > input').each(function()
+ {
+ var field = ',' + $(this).val() + ',';
+ var $field = config.currentMethod == 'create' ? $('#' + $(this).val()) : $('[name^=' + $(this).val() + ']');
+ var $fieldBox = $('.' + $(this).val() + 'Box' );
+
+ var required = '';
+ if(typeof requiredFields != 'undefined') var required = ',' + requiredFields + ',';
+ if(fieldList.indexOf(field) >= 0 || (required && required.indexOf(field) >= 0))
+ {
+ $fieldBox.removeClass('hidden');
+ $field.removeAttr('disabled');
+ }
+ else if(!$fieldBox.hasClass('hidden'))
+ {
+ $fieldBox.addClass('hidden');
+ $field.attr('disabled', true);
+ }
+
+ if(config.currentModule == 'story' && $(this).val() == 'source')
+ {
+ var $sourceNote = config.currentMethod == 'create' ? $('#sourceNote') : $('[name^=sourceNote]');
+ $sourceNote.attr('disabled', $fieldBox.hasClass('hidden'));
+ }
+ });
+
+
+ if(config.currentModule == 'task' && config.currentMethod == 'create');
+ {
+ if(fieldList.indexOf(',estStarted,') >= 0 && fieldList.indexOf(',deadline,') >= 0)
+ {
+ $('.borderBox').removeClass('hidden');
+ }
+ else if(fieldList.indexOf(',estStarted,') >= 0 || fieldList.indexOf(',deadline,') >= 0)
+ {
+ $('.datePlanBox').removeClass('hidden');
+ if(!$('.borderBox').hasClass('hidden')) $('.borderBox').addClass('hidden');
+ }
+ else
+ {
+ if(!$('.borderBox').hasClass('hidden')) $('.borderBox').addClass('hidden');
+ if(!$('.datePlanBox').hasClass('hidden')) $('.datePlanBox').addClass('hidden');
+ }
+ }
+}
+
+/**
+ * Hidden require field.
+ *
+ * @access public
+ * @return void
+ */
+function hiddenRequireFields()
+{
+ $('#formSettingForm > .checkboxes > .checkbox-primary > input').each(function()
+ {
+ var field = ',' + $(this).val() + ',';
+ var required = ',' + requiredFields + ',';
+ if(required.indexOf(field) >= 0) $(this).closest('div').addClass('hidden');
+ });
+}
+
+/**
+ * Save custom fields.
+ *
+ * @param stirng $key
+ * @param int $maxFieldCount
+ * @param object $name
+ * @param int $nameMinWidth
+ * @access public
+ * @return void
+ */
+function saveCustomFields(key, maxFieldCount, $name, nameMinWidth)
+{
+ var fields = '';
+ $('#formSettingForm > .checkboxes > .checkbox-primary > input:checked').each(function()
+ {
+ fields += ',' + $(this).val();
+ });
+
+ var module = config.currentModule;
+ var link = createLink('custom', 'ajaxSaveCustomFields', 'module=' + module + '§ion=custom&key=' + key);
+ $.post(link, {'fields' : fields}, function()
+ {
+ showFields = fields;
+
+ showCheckedFields(fields);
+ $('#formSetting').parent().removeClass('open');
+
+ if(key == 'batchCreateFields') setCustomFieldsStyle(maxFieldCount, $name, nameMinWidth);
+ });
+}
+
+/**
+ * Set custom fields style.
+ *
+ * @param int $maxFieldCount
+ * @param object $name
+ * @param int $nameMinWidth
+ * @access public
+ * @return void
+ */
+function setCustomFieldsStyle(maxFieldCount, $name, nameMinWidth)
+{
+ var fieldCount = $('#batchCreateForm .table thead>tr>th:visible').length;
+ $('.form-actions').attr('colspan', fieldCount);
+
+ var $table = $('#batchCreateForm > .table-responsive');
+ if(fieldCount > maxFieldCount)
+ {
+ $table.removeClass('scroll-none');
+ $table.css('overflow', 'auto');
+ }
+ else
+ {
+ $table.addClass('scroll-none');
+ $table.css('overflow', 'visible');
+ }
+
+ if($name.width() < nameMinWidth) $name.width(200);
+}