* refactor codes.
This commit is contained in:
@@ -416,12 +416,12 @@ class commonModel extends model
|
||||
foreach ($lang->searchObjects as $key => $value)
|
||||
{
|
||||
$class = $key == $searchObject ? "class='selected'" : '';
|
||||
echo "<li $class><a href='javascript:;' data-value='{$key}'>{$value}</a></li>";
|
||||
echo "<li $class><a href='javascript:$.setSearchType(\"$key\");' data-value='{$key}'>{$value}</a></li>";
|
||||
}
|
||||
echo '</ul></div>';
|
||||
echo "<input id='searchInput' class='form-control search-input' type='search' onclick='this.value=\"\"' onkeydown='if(event.keyCode==13) shortcut()' placeholder='" . $lang->searchTips . "'/>";
|
||||
echo "<input id='searchInput' class='form-control search-input' type='search' onclick='this.value=\"\"' onkeydown='if(event.keyCode==13) $.gotoObject();' placeholder='" . $lang->searchTips . "'/>";
|
||||
echo '</div>';
|
||||
echo "<a href='javascript:shortcut();' class='btn btn-link' id='searchGo'>GO!</a>";
|
||||
echo "<a href='javascript:$.gotoObject();' class='btn btn-link' id='searchGo'>GO!</a>";
|
||||
echo "</div>\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -8,4 +8,4 @@
|
||||
#todoBatchAddForm .control-time-begin + .chosen-container-single .chosen-single {border-radius: 2px 0 0 2px; border-right-width: 0; padding-right: 1px;}
|
||||
#todoBatchAddForm .control-time-begin + .chosen-container-active .chosen-single {border-right-width: 1px; padding-right: 0;}
|
||||
#todoBatchAddHeader [name="date"]:disabled {color: #ccc; text-decoration: line-through;}
|
||||
.main-header > .input-group {width: 220px;}
|
||||
.main-header > .input-group {width: 240px;}
|
||||
Vendored
-150
File diff suppressed because one or more lines are too long
+191
-244
@@ -1,88 +1,35 @@
|
||||
/**
|
||||
* Create link.
|
||||
*
|
||||
* @param string $moduleName
|
||||
* @param string $methodName
|
||||
* @param string $vars
|
||||
* @param string $viewType
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
function createLink(moduleName, methodName, vars, viewType, isOnlyBody)
|
||||
{
|
||||
if(!viewType) viewType = config.defaultView;
|
||||
if(!isOnlyBody) isOnlyBody = false;
|
||||
if(vars)
|
||||
{
|
||||
vars = vars.split('&');
|
||||
for(i = 0; i < vars.length; i ++)
|
||||
{
|
||||
splited = vars[i].split('=');
|
||||
// /**
|
||||
// * Bind Event for searchbox
|
||||
// *
|
||||
// */
|
||||
// function setSearchBox()
|
||||
// {
|
||||
// $('#searchTypeMenu a').click(function()
|
||||
// {
|
||||
// $('#searchTypeMenu li.selected').removeClass('selected');
|
||||
// var $this = $(this);
|
||||
// $this.closest('li').addClass('selected');
|
||||
// $("#searchType").val($this.data('value'));
|
||||
// $("#searchTypeName").text($this.text());
|
||||
// });
|
||||
// }
|
||||
|
||||
var newvars = new Array()
|
||||
newvars[0] = splited.shift();
|
||||
newvars[1] = splited.join('=');
|
||||
|
||||
vars[i] = newvars;
|
||||
}
|
||||
}
|
||||
if(config.requestType != 'GET')
|
||||
{
|
||||
if(config.requestType == 'PATH_INFO') link = config.webRoot + moduleName + config.requestFix + methodName;
|
||||
if(config.requestType == 'PATH_INFO2') link = config.webRoot + 'index.php/' + moduleName + config.requestFix + methodName;
|
||||
if(vars)
|
||||
{
|
||||
for(i = 0; i < vars.length; i ++) link += config.requestFix + vars[i][1];
|
||||
}
|
||||
link += '.' + viewType;
|
||||
}
|
||||
else
|
||||
{
|
||||
link = config.router + '?' + config.moduleVar + '=' + moduleName + '&' + config.methodVar + '=' + methodName + '&' + config.viewVar + '=' + viewType;
|
||||
if(vars) for(i = 0; i < vars.length; i ++) link += '&' + vars[i][0] + '=' + vars[i][1];
|
||||
}
|
||||
|
||||
/* if page has onlybody param then add this param in all link. the param hide header and footer. */
|
||||
if((typeof(config.onlybody) != 'undefined' && config.onlybody == 'yes') || isOnlyBody)
|
||||
{
|
||||
var onlybody = config.requestType != 'GET' ? "?onlybody=yes" : '&onlybody=yes';
|
||||
link = link + onlybody;
|
||||
}
|
||||
return link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind Event for searchbox
|
||||
*
|
||||
*/
|
||||
function setSearchBox()
|
||||
{
|
||||
$('#searchTypeMenu a').click(function()
|
||||
{
|
||||
$('#searchTypeMenu li.selected').removeClass('selected');
|
||||
var $this = $(this);
|
||||
$this.closest('li').addClass('selected');
|
||||
$("#searchType").val($this.data('value'));
|
||||
$("#searchTypeName").text($this.text());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Go to the view page of one object.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function shortcut()
|
||||
{
|
||||
objectType = $('#searchType').attr('value');
|
||||
objectValue = $("input#searchInput").attr('value');
|
||||
if(objectType && objectValue)
|
||||
{
|
||||
method = objectType == 'testsuite' ? 'library' : 'view';
|
||||
location.href=createLink(objectType, method, "id=" + objectValue);
|
||||
}
|
||||
}
|
||||
// /**
|
||||
// * Go to the view page of one object.
|
||||
// *
|
||||
// * @access public
|
||||
// * @return void
|
||||
// */
|
||||
// function shortcut()
|
||||
// {
|
||||
// objectType = $('#searchType').attr('value');
|
||||
// objectValue = $("input#searchInput").attr('value');
|
||||
// if(objectType && objectValue)
|
||||
// {
|
||||
// method = objectType == 'testsuite' ? 'library' : 'view';
|
||||
// location.href=createLink(objectType, method, "id=" + objectValue);
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Show search drop menu.
|
||||
@@ -203,30 +150,30 @@ function setRequiredFields()
|
||||
$('.required').closest('td,th').next().css('padding-left', '15px');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the help links of forum's items.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setHelpLink()
|
||||
{
|
||||
if(!$.cookie('help')) $.cookie('help', 'off', {expires:config.cookieLife, path:config.webRoot});
|
||||
className = $.cookie('help') == 'off' ? 'hidden' : '';
|
||||
// /**
|
||||
// * Set the help links of forum's items.
|
||||
// *
|
||||
// * @access public
|
||||
// * @return void
|
||||
// */
|
||||
// function setHelpLink()
|
||||
// {
|
||||
// if(!$.cookie('help')) $.cookie('help', 'off', {expires:config.cookieLife, path:config.webRoot});
|
||||
// className = $.cookie('help') == 'off' ? 'hidden' : '';
|
||||
|
||||
$('form input[id], form select[id], form textarea[id]').each(function()
|
||||
{
|
||||
if($(this).attr('type') == 'hidden' || $(this).attr('type') == 'file') return;
|
||||
currentFieldName = $(this).attr('name') ? $(this).attr('name') : $(this).attr('id');
|
||||
if(currentFieldName == 'submit' || currentFieldName == 'reset') return;
|
||||
if(currentFieldName.indexOf('[') > 0) currentFieldName = currentFieldName.substr(0, currentFieldName.indexOf('['));
|
||||
currentFieldName = currentFieldName.toLowerCase();
|
||||
helpLink = createLink('help', 'field', 'module=' + config.currentModule + '&method=' + config.currentMethod + '&field=' + currentFieldName);
|
||||
$(this).after(' <a class="helplink ' + className + '" href=' + helpLink + ' target="_blank">?</a> ');
|
||||
});
|
||||
// $('form input[id], form select[id], form textarea[id]').each(function()
|
||||
// {
|
||||
// if($(this).attr('type') == 'hidden' || $(this).attr('type') == 'file') return;
|
||||
// currentFieldName = $(this).attr('name') ? $(this).attr('name') : $(this).attr('id');
|
||||
// if(currentFieldName == 'submit' || currentFieldName == 'reset') return;
|
||||
// if(currentFieldName.indexOf('[') > 0) currentFieldName = currentFieldName.substr(0, currentFieldName.indexOf('['));
|
||||
// currentFieldName = currentFieldName.toLowerCase();
|
||||
// helpLink = createLink('help', 'field', 'module=' + config.currentModule + '&method=' + config.currentMethod + '&field=' + currentFieldName);
|
||||
// $(this).after(' <a class="helplink ' + className + '" href=' + helpLink + ' target="_blank">?</a> ');
|
||||
// });
|
||||
|
||||
$("a.helplink").modalTrigger({width:600, type:'iframe'});
|
||||
}
|
||||
// $("a.helplink").modalTrigger({width:600, type:'iframe'});
|
||||
// }
|
||||
|
||||
/**
|
||||
* Set paceholder.
|
||||
@@ -367,19 +314,19 @@ function removeAnchor(url)
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the window size and save to cookie.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function saveWindowSize()
|
||||
{
|
||||
width = $(window).width();
|
||||
height = $(window).height();
|
||||
$.cookie('windowWidth', width)
|
||||
$.cookie('windowHeight', height)
|
||||
}
|
||||
// /**
|
||||
// * Get the window size and save to cookie.
|
||||
// *
|
||||
// * @access public
|
||||
// * @return void
|
||||
// */
|
||||
// function saveWindowSize()
|
||||
// {
|
||||
// width = $(window).width();
|
||||
// height = $(window).height();
|
||||
// $.cookie('windowWidth', width)
|
||||
// $.cookie('windowHeight', height)
|
||||
// }
|
||||
|
||||
/**
|
||||
* Adjust Outer box's width and height.
|
||||
@@ -678,39 +625,39 @@ function checkTable($table)
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function toggleSearch()
|
||||
{
|
||||
$("#bysearchTab").toggle
|
||||
(
|
||||
function()
|
||||
{
|
||||
if(typeof(browseType) == 'undefined' || browseType == 'bymodule')
|
||||
{
|
||||
$('#bymoduleTab').removeClass('btn-active-text');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#' + browseType + 'Tab').removeClass('btn-active-text');
|
||||
}
|
||||
$('#bysearchTab').addClass('btn-active-text');
|
||||
ajaxGetSearchForm();
|
||||
$('#queryBox').addClass('show');
|
||||
},
|
||||
function()
|
||||
{
|
||||
if(typeof(browseType) == 'undefined' || browseType == 'bymodule')
|
||||
{
|
||||
$('#bymoduleTab').addClass('btn-active-text');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#' + browseType +'Tab').addClass('btn-active-text');
|
||||
}
|
||||
$('#bysearchTab').removeClass('btn-active-text');
|
||||
$('#queryBox').removeClass('show');
|
||||
}
|
||||
);
|
||||
}
|
||||
// function toggleSearch()
|
||||
// {
|
||||
// $("#bysearchTab").toggle
|
||||
// (
|
||||
// function()
|
||||
// {
|
||||
// if(typeof(browseType) == 'undefined' || browseType == 'bymodule')
|
||||
// {
|
||||
// $('#bymoduleTab').removeClass('btn-active-text');
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $('#' + browseType + 'Tab').removeClass('btn-active-text');
|
||||
// }
|
||||
// $('#bysearchTab').addClass('btn-active-text');
|
||||
// ajaxGetSearchForm();
|
||||
// $('#queryBox').addClass('show');
|
||||
// },
|
||||
// function()
|
||||
// {
|
||||
// if(typeof(browseType) == 'undefined' || browseType == 'bymodule')
|
||||
// {
|
||||
// $('#bymoduleTab').addClass('btn-active-text');
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $('#' + browseType +'Tab').addClass('btn-active-text');
|
||||
// }
|
||||
// $('#bysearchTab').removeClass('btn-active-text');
|
||||
// $('#queryBox').removeClass('show');
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
|
||||
/**
|
||||
* Ajax get search form
|
||||
@@ -1400,47 +1347,47 @@ function removeCookieByKey(cookieKey)
|
||||
location.href = location.href;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind hotkey event
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function initHotKey()
|
||||
{
|
||||
$(document).bind('keydown', 'Ctrl+g', function(e)
|
||||
{
|
||||
/* CTRL+g, auto focus on the search box. */
|
||||
$('#searchQuery').val('').focus();
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}).bind('keydown', 'Alt+up', function()
|
||||
{
|
||||
/* Alt+up, go back to the previous page. */
|
||||
var backLink = $('#back').attr('href');
|
||||
if(backLink) location.href = backLink;
|
||||
}).bind('keydown', 'left', function()
|
||||
{
|
||||
/* left, go to pre object. */
|
||||
var preLink = $('#pre').attr('href');
|
||||
if(!$.cookie('ajax_lastNext'))
|
||||
{
|
||||
$.cookie('ajax_lastNext', 'on', {expires: config.cookieLife, path: config.webRoot});
|
||||
$.get(createLink('score', 'ajax', "method=lastNext"));
|
||||
}
|
||||
if(preLink) location.href = preLink;
|
||||
}).bind('keydown', 'right', function()
|
||||
{
|
||||
/* right, go to next object. */
|
||||
var nextLink = $('#next').attr('href');
|
||||
if(!$.cookie('ajax_lastNext'))
|
||||
{
|
||||
$.cookie('ajax_lastNext', 'on', {expires: config.cookieLife, path: config.webRoot});
|
||||
$.get(createLink('score', 'ajax', "method=lastNext"));
|
||||
}
|
||||
if(nextLink) location.href = nextLink;
|
||||
});
|
||||
}
|
||||
// /**
|
||||
// * Bind hotkey event
|
||||
// * @access public
|
||||
// * @return void
|
||||
// */
|
||||
// function initHotKey()
|
||||
// {
|
||||
// $(document).bind('keydown.ctrl_g', function(e)
|
||||
// {
|
||||
// /* CTRL+g, auto focus on the search box. */
|
||||
// $('#searchQuery').val('').focus();
|
||||
// e.stopPropagation();
|
||||
// e.preventDefault();
|
||||
// return false;
|
||||
// }).bind('keydown.Alt+up', function()
|
||||
// {
|
||||
// /* Alt+up, go back to the previous page. */
|
||||
// var backLink = $('#back').attr('href');
|
||||
// if(backLink) location.href = backLink;
|
||||
// }).bind('keydown.left', function()
|
||||
// {
|
||||
// /* left, go to pre object. */
|
||||
// var preLink = $('#pre').attr('href');
|
||||
// if(!$.cookie('ajax_lastNext'))
|
||||
// {
|
||||
// $.cookie('ajax_lastNext', 'on', {expires: config.cookieLife, path: config.webRoot});
|
||||
// $.get(createLink('score', 'ajax', "method=lastNext"));
|
||||
// }
|
||||
// if(preLink) location.href = preLink;
|
||||
// }).bind('keydown.right', function()
|
||||
// {
|
||||
// /* right, go to next object. */
|
||||
// var nextLink = $('#next').attr('href');
|
||||
// if(!$.cookie('ajax_lastNext'))
|
||||
// {
|
||||
// $.cookie('ajax_lastNext', 'on', {expires: config.cookieLife, path: config.webRoot});
|
||||
// $.get(createLink('score', 'ajax', "method=lastNext"));
|
||||
// }
|
||||
// if(nextLink) location.href = nextLink;
|
||||
// });
|
||||
// }
|
||||
|
||||
/**
|
||||
* Init help link for user to open zentao help website in iframe
|
||||
@@ -1592,50 +1539,50 @@ function revertModuleCookie()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Focus move up or down for input.
|
||||
*
|
||||
* @param type up|down
|
||||
*/
|
||||
function inputFocusJump(type){
|
||||
var hasFocus = $('input').is(':focus');
|
||||
if(hasFocus)
|
||||
{
|
||||
var title = $("input:focus").attr('name').replace(/\[\d]/g, '');
|
||||
var $input = $(":input[name^=" + title + "]:text:not(:disabled):not([name*='%'])");
|
||||
var num = $input.length;
|
||||
var index = parseInt($("input:focus").attr('name').replace(/[^0-9]/g, ''));
|
||||
var nextIndex = type == 'down' ? index + 1 : index - 1;
|
||||
// /**
|
||||
// * Focus move up or down for input.
|
||||
// *
|
||||
// * @param type up|down
|
||||
// */
|
||||
// function inputFocusJump(type){
|
||||
// var hasFocus = $('input').is(':focus');
|
||||
// if(hasFocus)
|
||||
// {
|
||||
// var title = $("input:focus").attr('name').replace(/\[\d]/g, '');
|
||||
// var $input = $(":input[name^=" + title + "]:text:not(:disabled):not([name*='%'])");
|
||||
// var num = $input.length;
|
||||
// var index = parseInt($("input:focus").attr('name').replace(/[^0-9]/g, ''));
|
||||
// var nextIndex = type == 'down' ? index + 1 : index - 1;
|
||||
|
||||
if(nextIndex < num && nextIndex >= 0)
|
||||
{
|
||||
$input[nextIndex].focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
// if(nextIndex < num && nextIndex >= 0)
|
||||
// {
|
||||
// $input[nextIndex].focus();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Focus move up or down for select.
|
||||
*
|
||||
* @param type
|
||||
*/
|
||||
function selectFocusJump(type)
|
||||
{
|
||||
var hasFocus = $('select').is(':focus');
|
||||
if(hasFocus)
|
||||
{
|
||||
var title = $("select:focus").attr('name').replace(/\[\d]/g, '');
|
||||
var $select = $("select[name^=" + title + "]:not([name*='%'])");
|
||||
var num = $select.length;
|
||||
var index = parseInt($("select:focus").attr('name').replace(/[^0-9]/g, ''));
|
||||
var nextIndex = type == 'down' ? index + 1 : index - 1;
|
||||
// /**
|
||||
// * Focus move up or down for select.
|
||||
// *
|
||||
// * @param type
|
||||
// */
|
||||
// function selectFocusJump(type)
|
||||
// {
|
||||
// var hasFocus = $('select').is(':focus');
|
||||
// if(hasFocus)
|
||||
// {
|
||||
// var title = $("select:focus").attr('name').replace(/\[\d]/g, '');
|
||||
// var $select = $("select[name^=" + title + "]:not([name*='%'])");
|
||||
// var num = $select.length;
|
||||
// var index = parseInt($("select:focus").attr('name').replace(/[^0-9]/g, ''));
|
||||
// var nextIndex = type == 'down' ? index + 1 : index - 1;
|
||||
|
||||
if(nextIndex < num && nextIndex >= 0)
|
||||
{
|
||||
$select[nextIndex].focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
// if(nextIndex < num && nextIndex >= 0)
|
||||
// {
|
||||
// $select[nextIndex].focus();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
function adjustNoticePosition()
|
||||
{
|
||||
@@ -1671,31 +1618,31 @@ needPing = true;
|
||||
/* When body's ready, execute these. */
|
||||
$(document).ready(function()
|
||||
{
|
||||
setTableBehavior();
|
||||
setForm();
|
||||
saveWindowSize();
|
||||
setSearchBox();
|
||||
setOuterBox();
|
||||
// setTableBehavior();
|
||||
// setForm();
|
||||
// saveWindowSize();
|
||||
// setSearchBox();
|
||||
// setOuterBox();
|
||||
|
||||
//setRequiredFields();
|
||||
setPlaceholder();
|
||||
|
||||
setModalTriggerLink();
|
||||
|
||||
checkTable();
|
||||
toggleSearch();
|
||||
// checkTable();
|
||||
// toggleSearch();
|
||||
|
||||
fixStyle();
|
||||
// fixStyle();
|
||||
|
||||
// Init tree menu
|
||||
$('.tree').tree({initialState: 'preserve'});
|
||||
|
||||
$(window).resize(saveWindowSize); // When window resized, call it again.
|
||||
// $(window).resize(saveWindowSize); // When window resized, call it again.
|
||||
|
||||
if(needPing) setTimeout('setPing()', 1000 * 60 * 10); // After 10 minutes, begin ping.
|
||||
|
||||
initPrioritySelector();
|
||||
initHotKey();
|
||||
// initHotKey();
|
||||
initHelpLink();
|
||||
checkTutorial();
|
||||
revertModuleCookie();
|
||||
|
||||
+13
-2
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user