$list_idname = cw_query_first_cell("SELECT name FROM {$tables['newslists']} WHERE list_id='{$list_id}'");
 $smarty->assign('list_idname', $list_idname);
 $smarty->assign('list_id', $list_id);
 $smarty->assign('list', $list);
 # subscribers tabs
 $total_items = count($subscribers = cw_call('cw\\news\\get_subscribers', array($list_id)));
 if (!empty($total_items)) {
     $navigation = cw_core_get_navigation($target, $total_items, $page);
     $navigation['script'] = "index.php?target={$target}&js_tab=subscriptions&list_id=" . $list_id;
     $smarty->assign('navigation', $navigation);
     $subscribers = array_slice($subscribers, $navigation['first_page'], $navigation['objects_per_page']);
 }
 $smarty->assign('subscribers', $subscribers);
 # messages tab
 cw_load('map');
 $countries = cw_map_get_countries();
 $smarty->assign('countries', $countries);
 if (isset($messageid)) {
     $message = cw_query_first("SELECT * FROM {$tables['newsletter']} WHERE news_id='{$messageid}'");
     $countries = cw_query("select * from {$tables['newsletter_countries']} where news_id='{$messageid}'");
     if (is_array($countries)) {
         foreach ($countries as $val) {
             $message['countries'][$val['code']] = true;
         }
     }
     $smarty->assign('message', $message);
     $smarty->assign('messageid', $messageid);
 }
 $messages = cw_query("SELECT * FROM {$tables['newsletter']} WHERE list_id='{$list_id}'");
 $smarty->assign('messages', $messages);
 $smarty->assign('main', 'management');
    }
    $location[] = array(cw_get_langvar_by_name("lbl_messages"), "");
}
if (cw_session_is_registered("nwslt_object")) {
    $nwslt_object =& cw_session_register("nwslt_object");
    if (is_array($nwslt_object)) {
        foreach ($nwslt_object as $k => $v) {
            $smarty->assign($k, $v);
        }
    }
    cw_session_unregister("nwslt_object");
}
if (!empty($targetlist)) {
    $targetlistname = cw_query_first_cell("SELECT name FROM {$tables['newslists']} WHERE list_id='{$targetlist}'");
    $smarty->assign('targetlistname', $targetlistname);
    $smarty->assign('targetlist', $targetlist);
}
$lists = cw_query("SELECT * FROM {$tables['newslists']} WHERE lngcode='{$current_language}' {$salesman_condition}");
$smarty->assign('lists', $lists);
$smarty->assign('action', $action);
$smarty->assign('mode', $mode);
cw_load('user');
$memberships = cw_user_get_memberships(array('C', 'R'));
//cw_query("select * from $tables[memberships] where area='C' order by orderby");
$memberships[] = array('membership' => cw_get_langvar_by_name("lbl_retail_level"), 'membership_id' => 0);
$smarty->assign('memberships', $memberships);
$smarty->assign('flag_show_as_news', $flag_show_as_news);
$smarty->assign('current_script', $current_script);
cw_load('map');
$smarty->assign('countries', cw_map_get_countries());