function ws_delete($window_name, $form = '') { global $include, $conf, $self, $onadb; // Check permissions if (!auth('host_del')) { $response = new xajaxResponse(); $response->addScript("alert('Permission denied!');"); return $response->getXML(); } // If an array in a string was provided, build the array and store it in $form $form = parse_options_string($form); // Instantiate the xajaxResponse object $response = new xajaxResponse(); $js = ''; // Run the module list($status, $output) = run_module('host_del', array('host' => $form['host_id'], 'commit' => $form['commit'])); // If commit was N, display the confirmation dialog box if (!$form['commit']) { $build_commit_html = 1; $commit_function = 'delete'; include window_find_include('module_results'); return window_open("{$window_name}_results", $window); } // If the module returned an error code display a popup warning if ($status) { $js .= "alert('Delete failed. " . preg_replace('/[\\s\']+/', ' ', $output) . "');"; } else { if ($form['js']) { $js .= $form['js']; } } // usually js will refresh the window we got called from // Return an XML response $response->addScript($js); return $response->getXML(); }
function ws_window_progressbar($window_name, $form = '') { global $images; // If an array in a string was provided, build the array and store it in $form $form = parse_options_string($form); $window_name = $form['name']; $output = "<center>Working on the results, please wait<br><img src={$images}/loading.gif></center>"; $window['title'] = 'Processing...'; $window['js'] = "el('{$window_name}_extras').innerHTML='<br>';"; $build_commit_html = 0; $commit_function = ''; include window_find_include('module_results'); return window_open("{$window_name}_results", $window); }
function window_submit($window_name, $form = '', $function = '') { // Instantiate the xajaxResponse object $response = new xajaxResponse(); if (!$window_name or !$form) { return $response->getXML(); } $js = ""; printmsg("DEBUG => webwin_submit() Window: {$window_name} Function: {$function} Form: {$form}", 1); // If a function name wasn't provided, we look for a function called: // $window_name . '_submit' if (!$function) { $function = "{$window_name}_submit"; } $function = 'ws_' . $function; // If the function exists, run it and return it's output (an xml response) if (function_exists($function)) { return $function($window_name, $form); } // Try looking for the same function in an include file $file = window_find_include($window_name); if ($file) { require_once $file; } else { $response->addAssign("work_space_content", "innerHTML", "<br><center><font color=\"red\"><b>Invalid window requested: {$window_name}</b></font></center>"); } // Now see if our function is available... if (function_exists($function)) { return $function($window_name, $form); } // Ok, I couldn't find anything to do.. just return an empty XML response printmsg("NOTICE => webwin_submit() invalid function called! Window: {$window_name} Function: {$function}", 0); return $response->getXML(); }