Пример #1
0
         $gui->move_enabled = 0;
     }
     $gui->top_checked = 'checked=checked';
     $gui->bottom_checked = '';
     $gui->old_container = $the_tc_node['parent_id'];
     // original container
     $gui->array_container = $the_xx;
     $gui->testcase_id = $args->tcase_id;
     $gui->name = $tc_info[0]['name'];
     $gui->tproject_id = $args->tproject_id;
     $smarty->assign('gui', $gui);
     $templateCfg = templateConfiguration('tcMove');
     $smarty->display($templateCfg->template_dir . $templateCfg->default_template);
 } else {
     if ($args->do_move) {
         $result = $tree_mgr->change_parent($args->tcase_id, $args->new_container_id);
         $tree_mgr->change_child_order($args->new_container_id, $args->tcase_id, $args->target_position, $cfg->exclude_node_types);
         $gui->refreshTree = $args->refreshTree;
         $gui->modify_tc_rights = $_SESSION['currentUser']->hasRight($db, "mgt_modify_tc", $args->tproject_id);
         // $tsuite_mgr->show($smarty,$args->tproject_id,$gui,$templateCfg->template_dir,$args->old_container_id);
         $identity = new stdClass();
         $identity->tproject_id = $args->tproject_id;
         $identity->id = $args->old_container_id;
         $tsuite_mgr->show($smarty, $gui, $identity);
     } else {
         if ($args->do_copy) {
             $user_feedback = '';
             $msg = '';
             $options = array('check_duplicate_name' => config_get('check_names_for_duplicates'), 'action_on_duplicate_name' => config_get('action_on_duplicate_name'), 'copy_also' => $args->copy);
             $result = $tcase_mgr->copy_to($args->tcase_id, $args->new_container_id, $args->user_id, $options);
             $msg = $result['msg'];
function update_tc_specs_parents(&$source_db, &$target_db, &$tmp_table_name, &$old_new, &$migrator)
{
    $tree_mgr = new tree($target_db);
    $items_processed = 0;
    // how many records are we going to tackle at a time
    $step_amt = 500;
    print_msg("<b><center>Migrating Test Cases - Part I - " . date("H:i:s") . " -</center></b><br>");
    $tc_count = $migrator->get_tmp_table_count();
    // Make sure we have enough memory to do what we are about to do
    check_memory($tc_count);
    while ($items_processed < $tc_count) {
        $item_limit = $items_processed + $step_amt;
        $query = "SELECT * FROM {$tmp_table_name} ORDER BY id LIMIT {$items_processed},{$step_amt}";
        $tc_specs = $source_db->fetchRowsIntoMap($query, 'id');
        echo "<pre>   Number of items to update: " . $tc_count . "</pre>";
        foreach ($tc_specs as $item_id => $idata) {
            // change_parent($node_id, $parent_id)
            $parent_id = $old_new['mgtcat'][$idata['catid']];
            if (intval($parent_id) == 0) {
                echo '<pre> <font style="color:white;background-color:red;">' . "Error TCID:{$item_id} {$idata['title']} has no parent</font></pre>";
            } else {
                $tree_mgr->change_parent($item_id, $parent_id);
            }
            $items_processed++;
        }
        echo "<br>have now processed {$items_processed} items";
    }
}
Пример #3
0
*   This code is called by javascript function writeNodePositionToDB() present
*   in javascript file with all function used to manage EXTJS tree.
*
*   rev: 20080605 - franciscom
*        
*/
require_once '../../config.inc.php';
require_once 'common.php';
testlinkInitPage($db);
// check if this is really needed
$exclude_node_types = array('testplan' => 1, 'requirement' => 1, 'requirement_spec' => 1);
$args = init_args();
$treeMgr = new tree($db);
switch ($args->doAction) {
    case 'changeParent':
        $treeMgr->change_parent($args->nodeid, $args->newparentid);
        break;
    case 'doReorder':
        $dummy = explode(',', $args->nodelist);
        $treeMgr->change_order_bulk($dummy);
        break;
}
function init_args()
{
    $args = new stdClass();
    $key2loop = array('nodeid', 'newparentid', 'doAction', 'top_or_bottom', 'nodeorder', 'nodelist');
    foreach ($key2loop as $key) {
        $args->{$key} = isset($_REQUEST[$key]) ? $_REQUEST[$key] : null;
    }
    return $args;
}