From 8f21f260c552940f6dfe7e7a8df86cb3c2a63e8b Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 25 Jun 2014 02:17:06 +0000 Subject: [PATCH 1/5] * add my.min.js. --- www/js/my.min.js | 1200 +--------------------------------------------- 1 file changed, 1 insertion(+), 1199 deletions(-) diff --git a/www/js/my.min.js b/www/js/my.min.js index 0d4e328994..7298533e4a 120000 --- a/www/js/my.min.js +++ b/www/js/my.min.js @@ -1,1199 +1 @@ -/** - * 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 ++) vars[i] = vars[i].split('='); - } - if(config.requestType == 'PATH_INFO') - { - link = config.webRoot + moduleName + config.requestFix + methodName; - if(vars) - { - if(config.pathType == "full") - { - for(i = 0; i < vars.length; i ++) link += config.requestFix + vars[i][0] + config.requestFix + vars[i][1]; - } - else - { - 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(onlybody == 'yes' || isOnlyBody) - { - var onlybody = config.requestType == 'PATH_INFO' ? "?onlybody=yes" : '&onlybody=yes'; - link = link + onlybody; - } - return link; -} - -/** - * Bind Event for searchbox - * - */ -function setSearchBox() -{ - $('#typeSelector a').click(function() - { - $('#typeSelector li.active').removeClass('active'); - var $this = $(this); - $this.closest('li').addClass('active'); - $("#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 = $('#searchQuery').attr('value'); - if(objectType && objectValue) - { - location.href=createLink(objectType, 'view', "id=" + objectValue); - } -} - -/** - * Show drop menu. - * - * @param string $objectType product|project - * @param int $objectID - * @param string $module - * @param string $method - * @param string $extra - * @access public - * @return void - */ -function showDropMenu(objectType, objectID, module, method, extra) -{ - var li = $('#currentItem').closest('li'); - if(li.hasClass('show')) {li.removeClass('show'); return;} - - if(!li.data('showagain')) - { - li.data('showagain', true); - $(document).click(function() {li.removeClass('show');}); - $('#dropMenu, #currentItem').click(function(e){e.stopPropagation();}); - } - $.get(createLink(objectType, 'ajaxGetDropMenu', "objectID=" + objectID + "&module=" + module + "&method=" + method + "&extra=" + extra), function(data){ $('#dropMenu').html(data).find('#search').focus();}); - - li.addClass('show'); -} - -/** - * Show drop result. - * - * @param objectType $objectType - * @param objectID $objectID - * @param module $module - * @param method $method - * @param extra $extra - * @access public - * @return void - */ -function showDropResult(objectType, objectID, module, method, extra) -{ - $.get(createLink(objectType, 'ajaxGetDropMenu', "objectID=" + objectID + "&module=" + module + "&method=" + method + "&extra=" + extra), function(data){ $('#dropMenu').html(data).find('#search').focus();}); -} - -/** - * Search items. - * - * @param string $keywords - * @param string $objectType - * @param int $objectID - * @param string $module - * @param string $method - * @param string $extra - * @access public - * @return void - */ -function searchItems(keywords, objectType, objectID, module, method, extra) -{ - if(keywords == '') - { - showMenu = 0; - showDropResult(objectType, objectID, module, method, extra); - } - else - { - keywords = encodeURI(keywords); - if(keywords != '-') $.get(createLink(objectType, 'ajaxGetMatchedItems', "keywords=" + keywords + "&module=" + module + "&method=" + method + "&extra=" + extra), function(data){$('#searchResult').html(data);}); - } -} - -/** - * Show or hide more items. - * - * @access public - * @return void - */ -function switchMore() -{ - $('#search').width($('#search').width()).focus(); - $('#moreMenu').width($('#defaultMenu').outerWidth()); - $('#searchResult').toggleClass('show-more'); -} - -/** - * Switch doc library. - * - * @param int $libID - * @param string $module - * @param string $method - * @param string $extra - * @access public - * @return void - */ -function switchDocLib(libID, module, method, extra) -{ - if(module == 'doc') - { - if(method != 'view' && method != 'edit') - { - link = createLink(module, method, "rootID=" + libID); - } - else - { - link = createLink('doc', 'browse'); - } - } - else if(module == 'tree') - { - link = createLink(module, method, "rootID=" + libID + '&type=' + extra); - } - location.href=link; -} - -/** - * Set the ping url. - * - * @access public - * @return void - */ -function setPing() -{ - $('#hiddenwin').attr('src', createLink('misc', 'ping')); -} - -/** - * Set required fields, add star class to them. - * - * @access public - * @return void - */ -function setRequiredFields() -{ - if(!config.requiredFields) return false; - requiredFields = config.requiredFields.split(','); - for(i = 0; i < requiredFields.length; i++) - { - $('#' + requiredFields[i]).closest('td,th').prepend("
"); - var colEle = $('#' + requiredFields[i]).closest('[class*="col-"]'); - if(colEle.parent().hasClass('form-group')) colEle.addClass('required'); - } -} - -/** - * 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.helplink").modalTrigger({width:600, type:'iframe'}); -} - -/** - * Set paceholder. - * - * @access public - * @return void - */ -function setPlaceholder() -{ - if(typeof(holders) != "undefined") - { - for(var key in holders) - { - if($('#' + key).prop('tagName') == 'INPUT') - { - $("#" + key).attr('placeholder', holders[key]); - } - else - { - $("#" + key).parent().append("" + holders[key] + ''); - } - } - } -} - -/** - * Toggle the help links. - * - * @access public - * @return void - */ -function toggleHelpLink() -{ - $('.helplink').toggle(); - if($.cookie('help') == 'off') return $.cookie('help', 'on', {expires:config.cookieLife, path:config.webRoot}); - if($.cookie('help') == 'on') return $.cookie('help', 'off', {expires:config.cookieLife, path:config.webRoot}); -} - -/** - * Hide tree box - * - * @param string $treeType - * @access public - * @return void - */ -function hideTreeBox(treeType) -{ - $.cookie(treeType, 'hide', {expires:config.cookieLife, path:config.webRoot}); - $('.outer').addClass('hide-side'); - $('.side-handle .icon-caret-left').removeClass('icon-caret-left').addClass('icon-caret-right'); -} - -/** - * Show tree box - * - * @param string $treeType - * @access public - * @return void - */ -function showTreeBox(treeType) -{ - $.cookie(treeType, 'show', {expires:config.cookieLife, path:config.webRoot}); - $('.outer').removeClass('hide-side'); - $('.side-handle .icon-caret-right').removeClass('icon-caret-right').addClass('icon-caret-left'); -} - -/** - * Toggle tree menu. - - * @access public - * @return void - */ -function toggleTreeBox() -{ - var treeType = $('.side-handle').data('id'); - if(typeof treeType == 'undefined' || treeType == null) return; - if($.cookie(treeType) == 'hide') hideTreeBox(treeType); - - $('.side-handle').toggle - ( - function() - { - if($.cookie(treeType) == 'hide') return showTreeBox(treeType); - hideTreeBox(treeType); - }, - function() - { - if($.cookie(treeType) == 'show') return hideTreeBox(treeType); - showTreeBox(treeType); - } - ); - - setTimeout(function(){$('.outer.with-side').addClass('with-transition')}, 1000); -} - -/** - * Set language. - * - * @access public - * @return void - */ -function selectLang(lang) -{ - $.cookie('lang', lang, {expires:config.cookieLife, path:config.webRoot}); - location.href = removeAnchor(location.href); -} - -/** - * Set theme. - * - * @access public - * @return void - */ -function selectTheme(theme) -{ - $.cookie('theme', theme, {expires:config.cookieLife, path:config.webRoot}); - location.href = removeAnchor(location.href); -} - -/** - * Remove anchor from the url. - * - * @param string $url - * @access public - * @return string - */ -function removeAnchor(url) -{ - pos = url.indexOf('#'); - if(pos > 0) return url.substring(0, pos); - 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) -} - -/** - * Set Outer box's width and height. - * - * @access public - * @return void - */ -function setOuterBox() -{ - if($('.outer > .side').length) $('.outer').addClass('with-side'); - if($('.sub-featurebar').length) $('#featurebar').addClass('with-sub'); - - var side = $('#wrap .outer > .side'); - var resetOuterHeight = function() - { - var sideH = side.length ? (side.outerHeight() + $('#featurebar').outerHeight() + 20) : 0; - var height = Math.max(sideH, $(window).height() - $('#header').height() - $('#footer').height() - 33); - if(navigator.userAgent.indexOf("MSIE 8.0") >= 0) height -= 40; - $('#wrap .outer').css('min-height', height); - } - - side.resize(resetOuterHeight); - $(window).resize(resetOuterHeight); - resetOuterHeight(); -} - -/** - * Disable the submit button when submit form. - * - * @access public - * @return void - */ -function setForm() -{ - var formClicked = false; - $('form').submit(function() - { - submitObj = $(this).find(':submit'); - if($(submitObj).size() == 1) - { - var isBtn = submitObj.prop('tagName') == "BUTTON"; - submitLabel = isBtn ? $(submitObj).text() : $(submitObj).attr('value'); - $(submitObj).attr('disabled', 'disabled'); - var submitting = submitObj.attr('data-submitting') || config.submitting; - if(isBtn) submitObj.text(submitting); - else $(submitObj).attr('value', submitting); - formClicked = true; - } - }); - - $("body").click(function() - { - if(formClicked) - { - $(submitObj).removeAttr('disabled'); - if(submitObj.prop('tagName') == "BUTTON") submitObj.text(submitLabel); - else $(submitObj).attr('value', submitLabel); - $(submitObj).removeClass('button-d'); - } - formClicked = false; - }); -} - -/** - * Set form action and submit. - * - * @param url $actionLink - * @param string $hiddenwin 'hiddenwin' - * @access public - * @return void - */ -function setFormAction(actionLink, hiddenwin) -{ - if(hiddenwin) $('form').attr('target', hiddenwin); - else $('form').removeAttr('target'); - - $('form').attr('action', actionLink).submit(); -} - -/** - * Set the max with of image. - * - * @access public - * @return void - */ -function setImageSize(image, maxWidth) -{ - /* If not set maxWidth, set it auto. */ - if(!maxWidth) - { - bodyWidth = $('body').width(); - maxWidth = bodyWidth - 470; // The side bar's width is 336, and add some margins. - } - - if($(image).width() > maxWidth) $(image).attr('width', maxWidth); - $(image).wrap(''); -} - -/** - * Set the repo link. - * - * @access public - * @return void - */ -function setRepoLink() -{ - $('.repolink').modalTrigger({width:960, type:'iframe'}); -} - -/* Set the modal dialog of export. */ -function setExport() -{ - $(".export").modalTrigger({width:650, type:'iframe'}); -} - -/** - * Set mailto list from a contact list.. - * - * @param string $mailto - * @param int $contactListID - * @access public - * @return void - */ -function setMailto(mailto, contactListID) -{ - link = createLink('user', 'ajaxGetContactUsers', 'listID=' + contactListID); - $.get(link, function(users) - { - $('#' + mailto).replaceWith(users); - $('#' + mailto + '_chosen').remove(); - $('#' + mailto).chosen(defaultChosenOptions); - }); -} - -/** - * Set comment. - * - * @access public - * @return void - */ -function setComment() -{ - $('#commentBox').toggle(); - $('.ke-container').css('width', '100%'); - setTimeout(function() { $('#commentBox textarea').focus(); }, 50); -} - -/** - * Auto checked the checkbox of a row. - * - * @access public - * @return void - */ -function autoCheck() -{ - $('.tablesorter tr :checkbox').click(function(){clickInCheckbox = 1;}); - - $('.tablesorter tr').click(function() - { - if(document.activeElement.type != 'select-one' && document.activeElement.type != 'text') - { - if(typeof(clickInCheckbox) != 'undefined' && clickInCheckbox == 1) - { - clickInCheckbox = 0; - } - else - { - if($(this).find(':checkbox').attr('checked')) - { - $(this).find(':checkbox').attr('checked', false); - } - else - { - $(this).find(':checkbox').attr('checked', true); - } - } - } - }); -} - -/** - * Toogle the search form. - * - * @access public - * @return void - */ -function toggleSearch() -{ - $("#bysearchTab").toggle - ( - function() - { - if(browseType == 'bymodule') - { - $('#bymoduleTab').removeClass('active'); - } - else - { - $('#' + browseType + 'Tab').removeClass('active'); - } - $('#bysearchTab').addClass('active'); - ajaxGetSearchForm(); - $('#querybox').addClass('show'); - }, - function() - { - if(browseType == 'bymodule') - { - $('#bymoduleTab').addClass('active'); - } - else - { - $('#' + browseType +'Tab').addClass('active'); - } - $('#bysearchTab').removeClass('active'); - $('#querybox').removeClass('show'); - } - ); -} - -/** - * Ajax get search form - * - * @access public - * @return void - */ -function ajaxGetSearchForm() -{ - if($('#querybox').html() == '') - { - $.get(createLink('search', 'buildForm'), function(data) - { - $('#querybox').html(data); - }); - } -} - -/** - * Hide the link of clearData. - * - * @access public - * @return void - */ -function hideClearDataLink() -{ - if(typeof showDemoUsers == 'undefined' || !showDemoUsers) $('#submenuclearData').addClass('hidden'); -} - -/** - * add one option of a select to another select. - * - * @param string $SelectID - * @param string $TargetID - * @access public - * @return void - */ -function addItem(SelectID,TargetID) -{ - ItemList = document.getElementById(SelectID); - Target = document.getElementById(TargetID); - for(var x = 0; x < ItemList.length; x++) - { - var opt = ItemList.options[x]; - if (opt.selected) - { - flag = true; - for (var y=0;y=0;x--) - { - var opt = ItemList.options[x]; - if (opt.selected) - { - ItemList.options[x] = null; - } - } -} - -/** - * move one selected option up from a select. - * - * @param string $SelectID - * @access public - * @return void - */ -function upItem(SelectID) -{ - ItemList = document.getElementById(SelectID); - for(var x=1;x=0;x--) - { - var opt = ItemList.options[x]; - opt.selected = true; - } -} - -/** - * Delete item use ajax. - * - * @param string url - * @param string replaceID - * @param string notice - * @access public - * @return void - */ -function ajaxDelete(url, replaceID, notice) -{ - if(confirm(notice)) - { - $.ajax( - { - type: 'GET', - url: url, - dataType: 'json', - success: function(data) - { - if(data.result == 'success') - { - $('#' + replaceID).wrap("
"); - $('#tmpDiv').load(document.location.href + ' #' + replaceID, function() - { - $('#tmpDiv').replaceWith($('#tmpDiv').html()); - if(typeof sortTable == 'function') - { - sortTable(); - } - $('#' + replaceID).find('[data-toggle=modal], a.iframe').modalTrigger(); - }); - } - } - }); - } -} - -/** - * Judge the string is a integer number - * - * @access public - * @return bool - */ -function isNum(s) -{ - if(s!=null) - { - var r, re; - re = /\d*/i; - r = s.match(re); - return (r == s) ? true : false; - } - return false; -} - -/** - * Set modal load content with ajax or iframe - * - * @access public - * @return void - */ -function setModal() -{ - jQuery.fn.modalTrigger = function(setting) - { - $(this).click(function(event) - { - var $e = $(this); - if($e.closest('.body-modal').length) return; - - if($e.hasClass('disabled')) return false; - - var url = (setting ? setting.url : false) || $e.attr('href') || $e.data('url'); - var type = (setting ? setting.type : false) || $e.hasClass('iframe') ? 'iframe' : ($e.data('type') || 'ajax'); - if(type == 'iframe') - { - var options = - { - url: url, - width: $e.data('width') || 800, - height: $e.data('height') || 'auto', - icon: $e.data('icon') || '?', - title: $e.data('title') || $e.attr('title') || $e.text(), - name: $e.data('name') || 'modalIframe', - cssClass: $e.data('class'), - headerless: $e.data('headerless') || false, - center: $e.data('center') || true - }; - - if(options.icon == '?') - { - var i = $e.find("[class^='icon-']"); - options.icon = i.length ? i.attr('class').substring(5) : 'file-text'; - } - - showIframeModal($.extend(options, setting)); - } - else - { - $('#ajaxModal').load(url, function() - { - /* Set the width of modal dialog. */ - if($e.data('width')) - { - var modalWidth = parseInt($e.data('width')); - $(this).data('width', modalWidth).find('.modal-dialog').css('width', modalWidth); - } - - /* show the modal dialog. */ - $('#ajaxModal').modal('show'); - }); - } - - /* Save the href to rel attribute thus we can save it. */ - $('#ajaxModal').attr('rel', url); - - return false; - }); - } - - function showIframeModal(settings) - { - var options = - { - width: 800, - height: 'auto', - icon: '?', - title: '', - name: 'modalIframe', - cssClass: '', - headerless: false, - waittime: 0, - center: true - } - - if(typeof(settings) == 'string') - { - options.url = settings; - } - else - { - options = $.extend(options, settings); - } - - initModalFrame(options); - - if(isNum(options.height.toString())) options.height += 'px'; - if(isNum(options.width.toString())) options.width += 'px'; - if(options.size == 'fullscreen') - { - var $w = $(window); - options.width = $w.width(); - options.height = $w.height(); - options.cssClass += ' fullscreen'; - } - if(options.headerless) - { - options.cssClass += ' hide-header'; - } - - var modal = $('#ajaxModal').addClass('modal-loading').data('first', true); - - modal.html("
".format(options)); - - var modalBody = modal.find('.modal-body'), dialog = modal.find('.modal-dialog'); - if(options.cssClass) - { - dialog.addClass(options.cssClass); - } - - if(options.waittime > 0) - { - options.waitingFuc = setTimeout(function(){showModal(options, modal, modalBody, dialog);}, options.waittime ); - } - - var frame = document.getElementById(options.name); - frame.onload = frame.onreadystatechange = function() - { - - if(this.readyState && this.readyState != 'complete') return; - if(modal.data('first') && (!modal.hasClass('modal-loading'))) return; - if(!modal.data('first')) modal.addClass('modal-loading'); - - if(options.waittime > 0) - { - clearTimeout(options.waitingFuc); - } - showModal(options, modal, modalBody, dialog); - } - modal.modal('show'); - } - - function showModal(options, modal, modalBody, dialog) - { - modalBody.css('height', options.height - modal.find('.modal-header').outerHeight()); - try - { - var $frame = $(window.frames[options.name].document); - if($frame.find('#titlebar').length) - { - modal.addClass('with-titlebar'); - if(options.size == 'fullscreen') - { - modalBody.css('height', options.height); - } - } - if(options.height == 'auto') - { - var $framebody = $frame.find('body'); - setTimeout(function() - { - var fbH = $framebody.addClass('body-modal').outerHeight(); - if(typeof fbH == 'object') fbH = $framebody.height(); - modalBody.css('height', fbH); - if(options.center) dialog.css('margin-top', Math.max(0, (modal.height() - dialog.height())/3)); - modal.removeClass('modal-loading'); - if(modal.data('first')) modal.data('first', false); - }, 100); - - if(navigator.userAgent.indexOf("MSIE 8.0") < 0) - { - $framebody.resize(function() - { - var fbH = $framebody.addClass('body-modal').outerHeight(); - if(typeof fbH == 'object') fbH = $framebody.height(); - modalBody.css('height', fbH); - }); - } - } - else - { - modal.removeClass('modal-loading'); - } - - var iframe$ = window.frames[options.name].$; - if(iframe$) - { - iframe$.extend({'closeModal': $.closeModal}); - } - } - catch(e) - { - modal.removeClass('modal-loading'); - } - } - - function initModalFrame(setting) - { - if($('#ajaxModal').length) - { - /* unbind all events */ - $('#ajaxModal').off('show.bs.modal shown.bs.modal hide.bs.modal hidden.bs.modal'); - } - else - { - /* Addpend modal div. */ - $('').appendTo('body'); - } - - $ajaxModal = $('#ajaxModal'); - $ajaxModal.data('cancel-reload', false); - - $.extend({'closeModal':function(callback, location) - { - $ajaxModal.modal('hide'); - $ajaxModal.on('hidden.bs.modal', function() - { - if(location && (!$ajaxModal.data('cancel-reload'))) - { - if(location == 'this') window.location.reload(); - else window.location = location; - } - if(callback && $.isFunction(callback)) callback(); - }); - }, 'cancelReloadCloseModal': function(){$ajaxModal.data('cancel-reload', true);}}); - - /* rebind events */ - if(!setting) return; - if(setting.afterShow && $.isFunction(setting.afterShow)) $ajaxModal.on('show.bs.modal', setting.afterShow); - if(setting.afterShown && $.isFunction(setting.afterShown)) $ajaxModal.on('shown.bs.modal', setting.afterShown); - if(setting.afterHide && $.isFunction(setting.afterHide)) $ajaxModal.on('hide.bs.modal', setting.afterHide); - if(setting.afterHidden && $.isFunction(setting.afterHidden)) $ajaxModal.on('hidden.bs.modal', setting.afterHidden); - } - - $.extend({modalTrigger: showIframeModal}); - - $('[data-toggle=modal], a.iframe').modalTrigger(); - - jQuery.fn.colorbox = function(setting) - { - if((typeof setting == 'object') && setting.iframe) - { - $(this).modalTrigger({type: 'iframe', width: setting['width'], afterHide: setting['onCleanup'], url: setting['href']}); - } - } -} - -/** - * Set modal for list page. - * - * Open operation pages in modal for list pages, after the modal window close, reload the list content and repace the replaceID. - * - * @param string colorboxClass the class for colorbox binding. - * @param string replaceID the html object to be replaced. - * @access public - * @return void - */ -function setModal4List(colorboxClass, replaceID, callback, width) -{ - if(typeof(width) == 'undefined') width = 900 - $('.' + colorboxClass).modalTrigger( - { - width: width, - type: 'iframe', - - afterHide:function() - { - var selfClose = $.cookie('selfClose'); - if(selfClose != 1) return; - saveWindowSize(); - - if(typeof(replaceID) == 'string' && replaceID.length > 0) - { - $.cancelReloadCloseModal(); - - - var link = self.location.href; - $('#' + replaceID).wrap("
"); - $('#tmpDiv').load(link + ' #' + replaceID, function() - { - $('#tmpDiv').replaceWith($('#tmpDiv').html()); - setModal4List(colorboxClass, replaceID, callback, width); - - $('#' + replaceID + ' tbody tr:not(.active-disabled) td').click(function(){$(this).closest('tr').toggleClass('active');}); - $('#' + replaceID).find('[data-toggle=modal], a.iframe').modalTrigger(); - try - { - $(".date").datetimepicker(datepickerOptions); - } - catch(err){} - if(typeof(callback) == 'function') callback(); - $.cookie('selfClose', 0); - }); - } - } - }); -} - -/** - * Set table behavior - * - * @access public - * @return void - */ -function setTableBehavior() -{ - $('#wrap .table:not(.table-data, .table-form, .active-disabled) tbody tr:not(.active-disabled) td').click(function(){$(this).closest('tr').toggleClass('active');}); - $('#wrap .outer > .table, #wrap .outer > form > .table, #wrap .outer > .mian > .table, #wrap .outer > .mian > form > .table, #wrap .outer > .container > .table').not('.table-data, .table-form, .table-custom').addClass('table table-condensed table-hover table-striped tablesorter'); -} - -/* Ping the server every some minutes to keep the session. */ -needPing = true; - -/* When body's ready, execute these. */ -$(document).ready(function() -{ - $('body').addClass('m-{currentModule}-{currentMethod}'.format(config)); - - setModal(); - setTableBehavior(); - setForm(); - saveWindowSize(); - setSearchBox(); - setOuterBox(); - - setRequiredFields(); - setPlaceholder(); - - setExport(); - setRepoLink(); - - autoCheck(); - toggleSearch(); - toggleTreeBox(); - - hideClearDataLink(); - - $(window).resize(saveWindowSize); // When window resized, call it again. - - if(needPing) setTimeout('setPing()', 1000 * 60); // After 5 minutes, begin ping. - - $('.export').bind('click', function() - { - var checkeds = ''; - $(':checkbox').each(function() - { - if($(this).attr('checked')) - { - var checkedVal = parseInt($(this).val()); - if(checkedVal != 0) checkeds = checkeds + checkedVal + ','; - } - }) - if(checkeds != '') checkeds = checkeds.substring(0, checkeds.length - 1); - $.cookie('checkedItem', checkeds, {expires:config.cookieLife, path:config.webRoot}); - }); -}); - -/* CTRL+g, auto focus on the search box. */ -$(document).bind('keydown', 'Ctrl+g', function(evt) -{ - $('#searchQuery').attr('value', ''); - $('#searchQuery').focus(); - evt.stopPropagation( ); - evt.preventDefault( ); - return false; -}); - -/* left, go to pre object. */ -$(document).bind('keydown', 'left', function(evt) -{ - preLink = ($('#pre').attr("href")); - if(typeof(preLink) != 'undefined') location.href = preLink; -}); - -/* right, go to next object. */ -$(document).bind('keydown', 'right', function(evt) -{ - nextLink = ($('#next').attr("href")); - if(typeof(nextLink) != 'undefined') location.href = nextLink; -}); +my.full.js \ No newline at end of file From c15d972be440797ee5a752b71c8c5b873c839dee Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 25 Jun 2014 02:18:40 +0000 Subject: [PATCH 2/5] * adjust lang. --- module/action/lang/zh-cn.php | 2 +- module/action/lang/zh-tw.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php index 806d163339..3387e6b15d 100755 --- a/module/action/lang/zh-cn.php +++ b/module/action/lang/zh-cn.php @@ -128,7 +128,7 @@ $lang->action->label->linked2project = '关联项目'; $lang->action->label->unlinkedfromproject = '移除项目'; $lang->action->label->started = '开始了'; $lang->action->label->recordestimate = '记录了工时'; -$lang->action->label->editestimate = '编辑工时'; +$lang->action->label->editestimate = '编辑了工时'; $lang->action->label->canceled = '取消了'; $lang->action->label->finished = '完成了'; $lang->action->label->login = '登录系统'; diff --git a/module/action/lang/zh-tw.php b/module/action/lang/zh-tw.php index c53fa43961..e7f3bfaa6f 100755 --- a/module/action/lang/zh-tw.php +++ b/module/action/lang/zh-tw.php @@ -128,7 +128,7 @@ $lang->action->label->linked2project = '關聯項目'; $lang->action->label->unlinkedfromproject = '移除項目'; $lang->action->label->started = '開始了'; $lang->action->label->recordestimate = '記錄了工時'; -$lang->action->label->editestimate = '編輯工時'; +$lang->action->label->editestimate = '編輯了工時'; $lang->action->label->canceled = '取消了'; $lang->action->label->finished = '完成了'; $lang->action->label->login = '登錄系統'; From 28e409542e08b4466d5e0badd5f170b5f221adf2 Mon Sep 17 00:00:00 2001 From: Catouse Date: Wed, 25 Jun 2014 10:44:02 +0800 Subject: [PATCH 3/5] * added space arround arrow. --- module/common/lang/en.php | 2 +- module/common/lang/zh-cn.php | 2 +- module/common/lang/zh-tw.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/module/common/lang/en.php b/module/common/lang/en.php index cdd3b5bdb2..464d5ada7c 100644 --- a/module/common/lang/en.php +++ b/module/common/lang/en.php @@ -9,7 +9,7 @@ * @version $Id: en.php 5116 2013-07-12 06:37:48Z chencongzhi520@gmail.com $ * @link http://www.zentao.net */ -$lang->arrow = ' '; +$lang->arrow = '  '; $lang->colon = '::'; $lang->comma = ','; $lang->dot = '.'; diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index b0e10ab254..7d619061b4 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -9,7 +9,7 @@ * @version $Id: zh-cn.php 5116 2013-07-12 06:37:48Z chencongzhi520@gmail.com $ * @link http://www.zentao.net */ -$lang->arrow = ' '; +$lang->arrow = '  '; $lang->colon = '::'; $lang->comma = ','; $lang->dot = '。'; diff --git a/module/common/lang/zh-tw.php b/module/common/lang/zh-tw.php index 503ae43880..052afb9ee0 100644 --- a/module/common/lang/zh-tw.php +++ b/module/common/lang/zh-tw.php @@ -9,7 +9,7 @@ * @version $Id: zh-tw.php 5116 2013-07-12 06:37:48Z chencongzhi520@gmail.com $ * @link http://www.zentao.net */ -$lang->arrow = ' '; +$lang->arrow = '  '; $lang->colon = '::'; $lang->comma = ','; $lang->dot = '。'; From 3c04fb1ef6b647c699b6964c14ec066865e3e04d Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 25 Jun 2014 02:56:48 +0000 Subject: [PATCH 4/5] * fix a bug for managecontact. --- module/user/control.php | 1 + module/user/view/managecontacts.html.php | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/module/user/control.php b/module/user/control.php index 82651ebf5b..cf49f0af7a 100644 --- a/module/user/control.php +++ b/module/user/control.php @@ -857,6 +857,7 @@ class user extends control $this->view->position[] = $this->lang->user->manageContacts; $this->view->lists = $this->user->getContactLists($this->app->user->account); $this->view->users = $users; + $this->view->listID = $listID; $this->view->mode = $mode; $this->display(); } diff --git a/module/user/view/managecontacts.html.php b/module/user/view/managecontacts.html.php index 6757720522..3538570632 100644 --- a/module/user/view/managecontacts.html.php +++ b/module/user/view/managecontacts.html.php @@ -16,9 +16,6 @@ icons['company']);?> user->contacts->manage;?> -
- delete, 'hiddenwin', "class='btn btn-danger'");?> -
@@ -38,6 +35,9 @@
user->contacts->manage;?> +
+ delete, 'hiddenwin', "class='btn btn-danger'");?> +
From edfafc1047e478d3f294568cb628d63c7426d901 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 25 Jun 2014 03:25:59 +0000 Subject: [PATCH 5/5] * fix bugs for side cookie. --- VERSION | 2 +- module/bug/view/browse.html.php | 2 +- module/project/view/task.html.php | 2 +- module/testcase/view/browse.html.php | 2 +- module/testtask/control.php | 4 ++-- module/testtask/js/cases.js | 22 ---------------------- module/testtask/view/cases.html.php | 5 ++--- www/theme/default/style.css | 1 + 8 files changed, 9 insertions(+), 31 deletions(-) diff --git a/VERSION b/VERSION index be6d30b351..5576d55de8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.0.beta1 +6.0.stable diff --git a/module/bug/view/browse.html.php b/module/bug/view/browse.html.php index 45415c0f59..64cef9810f 100644 --- a/module/bug/view/browse.html.php +++ b/module/bug/view/browse.html.php @@ -61,7 +61,7 @@ js::set('moduleID', $moduleID);
'>
- +
diff --git a/module/project/view/task.html.php b/module/project/view/task.html.php index 4b0d6ea0f9..e615a63f62 100644 --- a/module/project/view/task.html.php +++ b/module/project/view/task.html.php @@ -19,7 +19,7 @@
- +
diff --git a/module/testcase/view/browse.html.php b/module/testcase/view/browse.html.php index d72a99feca..1a62fc3f92 100644 --- a/module/testcase/view/browse.html.php +++ b/module/testcase/view/browse.html.php @@ -55,7 +55,7 @@ js::set('confirmDelete', $lang->testcase->confirmDelete);
'>
- +
icons['product']);?>
diff --git a/module/testtask/control.php b/module/testtask/control.php index 34a6c65b64..ba5e83d9c9 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -205,7 +205,7 @@ class testtask extends control * @access public * @return void */ - public function cases($taskID, $browseType = 'byModule', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function cases($taskID, $browseType = 'all', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { /* Save the session. */ $this->app->loadLang('testcase'); @@ -268,7 +268,7 @@ class testtask extends control $caseQuery = $this->loadModel('search')->replaceDynamic($caseQuery); $caseQuery = preg_replace('/`(\w+)`/', 't2.`$1`', $caseQuery); - $this->view->runs = $this->dao->select('t2.*,t1.*')->from(TABLE_TESTRUN)->alias('t1') + $this->view->runs = $this->dao->select('t2.*,t1.*, t2.version as caseVersion')->from(TABLE_TESTRUN)->alias('t1') ->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id') ->where($caseQuery) ->andWhere('t1.task')->eq($taskID) diff --git a/module/testtask/js/cases.js b/module/testtask/js/cases.js index d68454aa97..dcf9cc4af1 100644 --- a/module/testtask/js/cases.js +++ b/module/testtask/js/cases.js @@ -1,19 +1,3 @@ -function browseByModule(active) -{ - $('#bymoduleTab').addClass('active'); - $('#' + active + 'Tab').removeClass('active'); - $('#querybox').addClass('hidden'); -} - -/* Swtich to search module. */ -function browseBySearch(active) -{ - $('#querybox').removeClass('hidden'); - $('#' + active + 'Tab').removeClass('active'); - $('#bysearchTab').addClass('active'); - $('#bymoduleTab').removeClass('active'); -} - $(document).ready(function() { setModal4List('runCase', 'caseList', function(){$(".iframe").modalTrigger({width:1024, type:'iframe'});}, 1024); @@ -21,9 +5,3 @@ $(document).ready(function() $('#module' + moduleID).addClass('active'); if(browseType == 'bysearch') ajaxGetSearchForm(); }); - -$(document).ready(function() -{ - $('#' + browseType + 'Tab').addClass('active'); - $('#module' + moduleID).addClass('active'); -}); diff --git a/module/testtask/view/cases.html.php b/module/testtask/view/cases.html.php index f9ebd9f488..3770a97c5a 100644 --- a/module/testtask/view/cases.html.php +++ b/module/testtask/view/cases.html.php @@ -22,10 +22,9 @@ var moduleID = '';
icons['usecase']);?>
@@ -42,7 +41,7 @@ var moduleID = '';
'>
- +
icons['product']);?>
diff --git a/www/theme/default/style.css b/www/theme/default/style.css index a9ff529000..e4a9a2806b 100644 --- a/www/theme/default/style.css +++ b/www/theme/default/style.css @@ -432,6 +432,7 @@ body {font-size: 13px; color:#141414;padding-bottom: 40px;} .sub-featurebar > .nav > li.active > a {color: #333; font-weight: bold;} #featurebar.with-sub > .nav > li.active > a {border: 1px solid #ddd; position: relative; border-bottom: none; background: #fff; padding: 2px 15px 5px} +.treeview > li > a.active { font-weight:bold;} /* Title bar. */ #titlebar {margin: -20px -20px 20px; background: #F8FAFE; border-bottom: 1px solid #e5e5e5; min-height: 46px; min-height: 20px\0; padding: 13px 20px; vertical-align: bottom; position: relative;}