Ejemplo n.º 1
0
 function notify()
 {
     global $display_buffer;
     $enable = freemed::config_value('worklist_enabled');
     $providers = freemed::config_value('worklist_providers');
     // Skip if this is not enabled
     if (!$enable) {
         return false;
     }
     include_once freemed::template_file('ajax.php');
     $display_buffer .= "\n\t\t<script language=\"javascript\">\n\t\tvar workListElementActive = 0;\n\t\tvar workListElementCurrent;\n\n\t\tfunction workListClick ( id ) {\n\t\t\tif (workListElementActive) { return false; }\n\t\t\tworkListElementCurrent = id;\n\t\t\tdocument.getElementById(id).innerHTML = '<select id=\"worklist_select\" onChange=\"workListProcess(\\'worklist_select\\', \\'' + id + '\\'); return true;\">' +\n\t\t\t'<option value=\"\">-</option>'+\n\t\t";
     $q = $GLOBALS['sql']->query("SELECT * FROM schedulerstatustype ORDER BY id");
     foreach ($q as $r) {
         $display_buffer .= "'<option value=\"{$r['id']}\">{$r['sname']}</option>'+\n";
     }
     $display_buffer .= "\n\t\t\t'<option value=\"\">-</option>'+\n\t\t\t'</select>';\n\t\t\tworkListElementActive = 1;\n\t\t}\n\n\t\tfunction workListProcess ( id, parent ) {\n\t\t\tif (! document.getElementById(id).value ) {\n\t\t\t\tdocument.getElementById(parent).innerHTML = '&nbsp;';\n\t\t\t\tworkListElementCurrent = '';\n\t\t\t\tworkListElementActive = 0;\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tx_module_html('" . get_class($this) . "', 'ajax_process', document.getElementById(id).value + workListElementCurrent, workListPopulate);\n\t\t}\n\n\t\tfunction workListPopulate ( value ) {\n\t\t\tvar tokenizer = new StringTokenizer ( value, ':' );\n\t\t\tvar _color = tokenizer.nextToken();\n\t\t\tvar _text  = tokenizer.nextToken();\n\t\t\tvar _desc  = tokenizer.nextToken();\n\t\t\tdocument.getElementById('r' + workListElementCurrent).style.backgroundColor = _color;\n\t\t\tdocument.getElementById(workListElementCurrent).innerHTML = '<acronym title=\"' + _desc + '\">' + _text + '</acronym>';\n\t\t\tworkListElementCurrent = '';\n\t\t\tworkListElementActive = 0;\n\t\t}\n\n\t\t</script>\n\t\t";
     // Get list of providers
     $p = explode(',', $providers);
     $buffer .= "<table border=\"0\" cellspacing=\"5\"><tr>\n";
     foreach ($p as $v) {
         $buffer .= "<td valign=\"top\">" . $this->generate_worklist($v) . "</td>\n";
     }
     $buffer .= "</tr></table>\n";
     return array(__("Work Lists"), $buffer);
 }