Merge branch 'dev/gfl_fix_bug' of https://gitlab.zcorp.cc/easycorp/zentaopms into dev/gfl_fix_bug

This commit is contained in:
tianshujie
2023-03-13 10:38:03 +08:00
4 changed files with 39 additions and 32 deletions
+11 -6
View File
@@ -330,7 +330,8 @@ class baseHTML
*/
static public function hidden($name, $value = "", $attrib = "")
{
return "<input type='hidden' name='$name' id='$name' value='$value' $attrib />\n";
$id = str_replace(array('[', ']'), "", $name);
return "<input type='hidden' name='$name' id='$id' value='$value' $attrib />\n";
}
/**
@@ -347,7 +348,8 @@ class baseHTML
static public function password($name, $value = "", $attrib = "")
{
if(stripos($attrib, 'autocomplete') === false) $attrib .= " autocomplete='off'";
return "<input type='password' name='$name' id='$name' value='$value' $attrib />\n";
$id = str_replace(array('[', ']'), "", $name);
return "<input type='password' name='$name' id='$id' value='$value' $attrib />\n";
}
/**
@@ -364,6 +366,7 @@ class baseHTML
static public function textarea($name, $value = "", $attrib = "")
{
$id = "id='$name'";
$id = str_replace(array('[', ']'), "", $id);
if(strpos($attrib, 'id=') !== false) $id = '';
return "<textarea name='$name' $id $attrib>$value</textarea>\n";
}
@@ -397,8 +400,9 @@ class baseHTML
*/
static public function date($name, $value = "", $options = '', $attrib = '')
{
$html = "<div class='input-append date date-picker' {$options}>";
$html .= "<input type='text' name='{$name}' id='$name' value='$value' {$attrib} />\n";
$id = str_replace(array('[', ']'), "", $name);
$html = "<div class='input-append date date-picker' {$options}>";
$html .= "<input type='text' name='{$name}' id='$id' value='$value' {$attrib} />\n";
$html .= "<span class='add-on'><button class='btn' type='button'><i class='icon-calendar'></i></button></span></div>";
return $html;
}
@@ -417,8 +421,9 @@ class baseHTML
*/
static public function dateTime($name, $value = "", $options = '', $attrib = '')
{
$html = "<div class='input-append date time-picker' {$options}>";
$html .= "<input type='text' name='{$name}' id='$name' value='$value' {$attrib} />\n";
$id = str_replace(array('[', ']'), "", $name);
$html = "<div class='input-append date time-picker' {$options}>";
$html .= "<input type='text' name='{$name}' id='$id' value='$value' {$attrib} />\n";
$html .= "<span class='add-on'><button class='btn' type='button'><i class='icon-calendar'></i></button></span></div>";
return $html;
}
+1
View File
@@ -208,6 +208,7 @@ class html extends baseHTML
static public function number($name, $value = '', $attrib = '')
{
$id = "id='$name'";
$id = str_replace(array('[', ']'), "", $id);
if(strpos($attrib, 'id=') !== false) $id = '';
$value = str_replace("'", '&#039;', $value);
return "<input type='number' name='$name' {$id} value='$value' $attrib />\n";
+25 -24
View File
@@ -1,5 +1,19 @@
(function($)
{
/**
* Save form Arr to $.zui.store.
*
* @access public
* @param {string} formID
* @param {array} formData
* @return void
*/
function storeFormData(formID, formData)
{
$.zui.store.set(formID, formData);
// $.zui.store.set(formID, $(form).serializeArray());
}
/**
* Handle the logic save form draft.
*
@@ -8,10 +22,6 @@
*/
function handleSaveFormDraft()
{
/* Ignore onlybody page. */
var onlybody = window.location.search.substr(1).match(new RegExp("(^|&)onlybody=([^&]*)(&|$)", "i"));
if(onlybody && onlybody[2] == 'yes') return;
if(config.currentMethod === 'login' || config.currentModule === 'repo' || config.currentMethod.indexOf('edit') != -1 || config.currentMethod.indexOf('import') != -1) return;
setTimeout(function()
{
@@ -19,14 +29,12 @@
if(form.length)
{
if($(form).hasClass('no-stash')) return;
if($(form).attr('target') == 'hiddenwin' && (config.currentModule.indexOf('program') != -1 || config.currentModule.indexOf('project') != -1 || config.currentModule.indexOf('testcase') != -1)) return;
function storeFormArr()
{
$.zui.store.set(formDataID, $(form).serializeArray());
var arr = $(form).serializeArray();
}
var formDataID = config.currentMethod + '-' + config.currentModule + '-' + $(form).attr("id");
var formDataStored = $.zui.store.get(formDataID);
if($(form).attr('target') == 'hiddenwin' && config.currentModule.indexOf('program') != -1 && config.currentModule.indexOf('project') != -1 && config.currentModule.indexOf('testcase') != -1) return;
var formID = config.currentMethod + '-' + config.currentModule + '-' + $(form).attr("id");
var formDataStored = $.zui.store.get(formID);
setTimeout(function () {
$.zui.store.remove(formID);
}, 0)
if(formDataStored && formDataStored.length)
{
var message = lang.confirmDraft.replace('%name%', lang[config.currentModule] ? lang[config.currentModule] : '');
@@ -111,31 +119,24 @@
formItem.val(item.value);
$(formItem).kindeditor({
/* Conetnt change event. */
afterChange: storeFormArr()
afterChange: storeFormData(formID, $(form).serializeArray())
});
}
}
}
}
],
onAction: function(name, action, messager)
{
setTimeout(function () {
$.zui.store.remove(formDataID);
}, 0)
}
]
}).show();
}
form.on('input', function()
{
storeFormArr()
storeFormData(formID, $(form).serializeArray())
}).on('change', function()
{
storeFormArr()
storeFormData(formID, $(form).serializeArray())
}).on('success.form.zui', function(event, res)
{
if(res.result === 'success' || res.status === 'success') $.zui.store.remove(formDataID);
if(res.result === 'success' || res.status === 'success') $.zui.store.remove(formID);
})
}
}, 500);
File diff suppressed because one or more lines are too long