From c83fcf55ba836ebd2afc253150dd587ca54453d0 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 27 Jun 2013 03:33:25 +0000 Subject: [PATCH] * change loadColorbox to setModal4List for the function name. --- module/bug/js/common.js | 2 +- module/bug/js/view.js | 2 +- module/product/js/browse.js | 2 +- module/project/js/bug.js | 7 ++++-- module/project/js/common.js | 2 +- module/testcase/js/browse.js | 2 +- www/js/my.full.js | 43 +++++++++++++++++++++--------------- 7 files changed, 35 insertions(+), 25 deletions(-) diff --git a/module/bug/js/common.js b/module/bug/js/common.js index 508db347d1..c60f521af7 100644 --- a/module/bug/js/common.js +++ b/module/bug/js/common.js @@ -1,6 +1,6 @@ $(function() { - loadColorbox('iframe', 'bugList'); + setModal4List('iframe', 'bugList'); if(typeof page == 'undefined') page = ''; if(page == 'create') diff --git a/module/bug/js/view.js b/module/bug/js/view.js index 65e1774fd1..7d4ef4a971 100644 --- a/module/bug/js/view.js +++ b/module/bug/js/view.js @@ -1,4 +1,4 @@ -function loadColorbox(colorboxClass, replaceID) +function setModal4List(colorboxClass, replaceID) { $('.iframe').colorbox({width:900, height:500, iframe:true, transition:'none', onCleanup:function(){parent.location.href=parent.location.href;}}) } diff --git a/module/product/js/browse.js b/module/product/js/browse.js index 7d9cc6bbe5..90d847e8bf 100644 --- a/module/product/js/browse.js +++ b/module/product/js/browse.js @@ -25,5 +25,5 @@ function changeAction(formName, actionName, actionLink) $(function() { if(browseType == 'bysearch') ajaxGetSearchForm(); - loadColorbox('iframe', 'storyList'); + setModal4List('iframe', 'storyList'); }) diff --git a/module/project/js/bug.js b/module/project/js/bug.js index b8d89359e3..a177d6d1fc 100644 --- a/module/project/js/bug.js +++ b/module/project/js/bug.js @@ -1,4 +1,4 @@ -function loadColorbox(colorboxClass, replaceID) +function setModal4List(colorboxClass, replaceID) { replaceID = 'bugList'; $('.' + colorboxClass).colorbox( @@ -7,14 +7,17 @@ function loadColorbox(colorboxClass, replaceID) height:500, iframe:true, transition:'none', + onCleanup:function() { saveWindowSize(); + var link = self.location.href; $.get(link, {onlybody: "yes"}, function(data) { $('#' + replaceID).replaceWith(data) - loadColorbox(colorboxClass, replaceID) + setModal4List(colorboxClass, replaceID) + $('.colored').colorize(); $('tfoot td').css('background', 'white').unbind('click').unbind('hover'); }); diff --git a/module/project/js/common.js b/module/project/js/common.js index 070a024ef7..e0843d55a4 100644 --- a/module/project/js/common.js +++ b/module/project/js/common.js @@ -95,7 +95,7 @@ function computeEndDate(delta) /* Auto compute the work days. */ $(function() { - loadColorbox('iframe', 'taskList'); + setModal4List('iframe', 'taskList'); $(".date").bind('dateSelected', function() { computeWorkDays(); diff --git a/module/testcase/js/browse.js b/module/testcase/js/browse.js index 33ee02091f..8ea24e95be 100644 --- a/module/testcase/js/browse.js +++ b/module/testcase/js/browse.js @@ -27,7 +27,7 @@ function changeAction(url) $(document).ready(function() { - loadColorbox('runCase', 'caseList'); + setModal4List('runCase', 'caseList'); $('#' + browseType + 'Tab').addClass('active'); $('#module' + moduleID).addClass('active'); if(browseType == 'bysearch') ajaxGetSearchForm(); diff --git a/www/js/my.full.js b/www/js/my.full.js index e1472074f1..42c31e6ce7 100644 --- a/www/js/my.full.js +++ b/www/js/my.full.js @@ -829,32 +829,39 @@ function selectItem(SelectID) } /** - * Load Colorbox for List. + * 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 loadColorbox(colorboxClass, replaceID) +function setModal4List(colorboxClass, replaceID) { $('.' + colorboxClass).colorbox( + { + width: 900, + height: 500, + iframe: true, + transition: 'none', + + onCleanup:function() { - width:900, - height:500, - iframe:true, - transition:'none', - onCleanup:function() + saveWindowSize(); + + var link = self.location.href; + $.get(link, {onlybody:"yes"}, function(data) { - saveWindowSize(); - var link = self.location.href; - $.get(link, {onlybody:"yes"}, function(data) - { - $('#' + replaceID).replaceWith(data) - loadColorbox(colorboxClass, replaceID) - $('.colored').colorize(); - $('tfoot td').css('background', 'white').unbind('click').unbind('hover'); - }); - } - }); + $('#' + replaceID).replaceWith(data); + setModal4List(colorboxClass, replaceID); + + $('.colored').colorize(); + $('tfoot td').css('background', 'white').unbind('click').unbind('hover'); + }); + } + }); } /* Ping the server every some minutes to keep the session. */