1
/*___INFO__MARK_BEGIN__*/
2
/*************************************************************************
4
* The Contents of this file are made available subject to the terms of
5
* the Sun Industry Standards Source License Version 1.2
7
* Sun Microsystems Inc., March, 2001
10
* Sun Industry Standards Source License Version 1.2
11
* =================================================
12
* The contents of this file are subject to the Sun Industry Standards
13
* Source License Version 1.2 (the "License"); You may not use this file
14
* except in compliance with the License. You may obtain a copy of the
15
* License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
17
* Software provided under this License is provided on an "AS IS" basis,
18
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
19
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
20
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
21
* See the License for the specific provisions governing your rights and
22
* obligations concerning the Software.
24
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
26
* Copyright: 2001 by Sun Microsystems, Inc.
28
* All Rights Reserved.
30
************************************************************************/
31
/*___INFO__MARK_END__*/
39
#include <Xmt/MsgLine.h>
40
#include <Xmt/Dialogs.h>
41
#include <Xmt/Create.h>
43
#include "qmon_rmon.h"
44
#include "qmon_cull.h"
45
#include "qmon_message.h"
46
#include "qmon_browser.h"
47
#include "qmon_appres.h"
48
#include "sge_answer.h"
50
static Widget qmon_msg_box = 0;
51
static Widget msg_text_w = 0;
53
static Boolean message_blocked = False;
56
static Widget qmonMessageCreateMsgBox(Widget parent);
57
static void qmonMessageOk(Widget w, XtPointer cld, XtPointer cad);
59
/*-------------------------------------------------------------------------*/
60
void qmonMessageShow(Widget w, Boolean msg_box, StringConst fmt, ...)
66
DENTER(GUI_LAYER, "qmonMessageShow");
68
Va_start(arg_list, fmt);
74
(void) vsprintf(buf, fmt, arg_list);
75
XmtMsgLineSet(w, buf);
76
XmtMsgLineClear(w, DISPLAY_MESSAGE_DURATION);
81
l10nfmt = XmtLocalize(w, fmt, fmt);
82
(void)vsprintf(buf, l10nfmt, arg_list);
83
if (qmonBrowserObjectEnabled(BROWSE_MSG)) {
85
qmonBrowserShow("\n");
89
XmtDisplayWarningMsg(w, "XmtMessageBox", buf, "Warning", NULL);
90
XSync(XtDisplay(w), 0);
97
DPRINTF(("No valid Message Type\n"));
106
/*-------------------------------------------------------------------------*/
112
lListElem *aep = NULL;
114
Boolean error = False;
118
Boolean show = False;
120
DENTER(GUI_LAYER, "qmonMessageBox");
122
DPRINTF(("show_always = %d\n", show_always));
124
if (!alp || !parent) {
130
** create the Message Box if necessary
133
qmon_msg_box = qmonMessageCreateMsgBox(parent);
137
** fill the message texts into the text field
139
XmTextDisableRedisplay(msg_text_w);
141
XmTextSetString(msg_text_w, "");
146
as = lGetUlong(aep, AN_status);
147
aq = lGetUlong(aep, AN_quality);
148
msg = lGetString(aep, AN_text);
150
if (qmonBrowserObjectEnabled(BROWSE_MSG)) {
151
qmonBrowserShow(msg);
152
qmonBrowserShow("\n");
157
if (aq == ANSWER_QUALITY_ERROR)
159
if ((as != STATUS_OK) || show_always) {
162
XmTextInsert(msg_text_w, pos, (String)msg);
164
XmTextInsert(msg_text_w, pos, "\n");
168
XmTextShowPosition(msg_text_w, 0);
169
XmTextEnableRedisplay(msg_text_w);
172
** manage the msg_box
175
XtManageChild(qmon_msg_box);
176
XSync(XtDisplay(parent), 0);
177
XmUpdateDisplay(parent);
178
message_blocked = True;
179
XmtBlock(qmon_msg_box, &message_blocked);
192
/*-------------------------------------------------------------------------*/
193
static Widget qmonMessageCreateMsgBox(
196
Widget msg_layout, msg_ok;
198
DENTER(GUI_LAYER, "qmonMessageCreateMsgBox");
200
msg_layout = XmtBuildQueryDialog( parent, "qmon_msg_box",
202
"msg_text", &msg_text_w,
205
XtAddCallback(msg_ok, XmNactivateCallback,
206
qmonMessageOk, NULL);
213
/*-------------------------------------------------------------------------*/
214
static void qmonMessageOk(Widget w, XtPointer cld, XtPointer cad)
216
DENTER(GUI_LAYER, "qmonMessageOk");
218
message_blocked = False;
231
answer_status = lGetUlong(aep, AN_status);
232
quality = lGetUlong(aep, AN_quality);
233
if (quality == ANSWER_QUALITY_ERROR) {
234
sprintf(msg, "%s\nPlease correct above errors first !\n",
235
lGetString(aep, AN_text));
236
qmonMessageShow(w, True, msg);
240
else if (quality == ANSWER_QUALITY_WARNING) {
241
sprintf(msg, "WARNING!\n%s\n",
242
lGetString(aep, AN_text));
243
qmonMessageShow(w, True, msg);
245
else if (quality == ANSWER_QUALITY_INFO) {
246
qmonMessageShow(w, True, lGetString(aep, AN_text));