var newRowID = 0; /** * Load modules and stories of a product. * * @param int $productID * @access public * @return void */ function loadAll(productID) { loadProductModules(productID); setStories(); } /** * Load stories of module. * * @access public * @return void */ function loadModuleRelated() { setStories(); } /** * Load module. * * @param int $productID * @access public * @return void */ function loadProductModules(productID) { link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=case&rootModuleID=0&returnType=html&needManage=true'); $('#moduleIdBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)}); setStories(); } /** * Set story field. * * @access public * @return void */ function setStories() { moduleID = $('#module').val(); productID = $('#product').val(); link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&moduleID=' + moduleID + '&storyID=0&onlyOption=false&status=noclosed'); $.get(link, function(stories) { var value = $('#story').val(); if(!stories) stories = ''; $('#story').replaceWith(stories); $('#story').val(value); $('#story_chosen').remove(); $("#story").chosen(defaultChosenOptions); }); } /** * Delete a step row. * * @param int $rowID * @access public * @return void */ function deleteRow(rowID) { if($('.stepID').size() == 1) return; $('#row' + rowID).remove(); updateStepID(); } /** * Insert before the step. * * @param int $rowID * @access public * @return void */ function preInsert(rowID) { $('#row' + rowID).before(createRow()); updateStepID(); } /** * Insert after the step. * * @param int $rowID * @access public * @return void */ function postInsert(rowID) { $('#row' + rowID).after(createRow()); updateStepID(); } /** * Create a step row. * * @access public * @return void */ function createRow() { if(newRowID == 0) newRowID = $('.stepID').size(); newRowID ++; var newRow = "