Subversion Repository Public Repository

litesoft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
var LOGIN = "Login";
var LOGOUT = "Logout";
var NOPOPUP = "!Popup";

var mServletRelativeReference;

var mShowing = "";

function showError( pErrorText, pException )
{
    var verNode = document.getElementById("Version");
    var version = "Version Unknown";
    if ( verNode )
    {
        try
        {
            version = verNode.firstChild.nodeValue;
        }
        catch ( e )
        {
            version = e;
        }
    }
    alert(pErrorText + "\n\n" + version + "\n\n" + pException);
}

function log( pText )
{
    var zDebugPanel = document.getElementById("dbg");
    if ( zDebugPanel )
    {
        zDebugPanel.innerHTML = zDebugPanel.innerHTML + "<br>" + pText;
    }
}

function showing( pWhat )
{
    log("showing:" + pWhat);
    mShowing = pWhat;
}

function getLLframe()
{
    return document.getElementById("LLframe");
}

function shouldShow( pWhat )
{
    log("shouldShow:" + pWhat + " | was:" + mShowing);
    if ( mShowing != pWhat )
    {
        forceShow(pWhat);
    }
}

function forceShow( pWhat )
{
    mShowing = pWhat;
    var zLLframe = getLLframe();
    if ( zLLframe )
    {
        var zRequesting = mServletRelativeReference + "?" + pWhat + "PageRequest-" + Math.random();
        log("requesting:" + zRequesting);
        zLLframe.src = zRequesting;
    }
    else
    {
        log("No LLframe");
    }
}

function showingLogin()
{
    showing(LOGIN);
}

function showingLogout()
{
    showing(LOGOUT);
}

function shouldShowLogin()
{
    shouldShow(LOGIN);
    updateAcked();
}

function shouldShowLogout()
{
    shouldShow(LOGOUT);
    updateAcked();
}

var mPendingPoll = false;
var mWaitingRequests = false;
var mAwaitingResponse = false;

function pollUpdate()
{
    var now = new Date();
    log("pollUpdate - " + now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds());
    clientUpdate("");
}

function updateAcked()
{
    mAwaitingResponse = false;
    if ( mWaitingRequests )
    {
        clientUpdate("");
    }
    else
    {
        mPendingPoll = window.setTimeout(pollUpdate, 15000);
    }
}

function clientUpdate( pRequest )
{
    if ( !mWaitingRequests )
    {
        mWaitingRequests = pRequest;
    }
    else if ( pRequest != "" )
    {
        mWaitingRequests = mWaitingRequests + "," + pRequest;
    }
    if ( !mAwaitingResponse )
    {
        if ( mPendingPoll )
        {
            window.clearTimeout(mPendingPoll);
            mPendingPoll = false;
        }

        var zRequesting = mServletRelativeReference + "?Status(" + mWaitingRequests + ")" + Math.random();

        mAwaitingResponse = true;
        mWaitingRequests = false;

        log("requesting:" + zRequesting);

        var script = document.createElement("script");
        script.setAttribute("src", zRequesting);
        script.setAttribute("type", "text/javascript");
        document.body.appendChild(script);
    }
}

function clientOpen( pEncodedClientID )
{
    log("clientOpen:" + pEncodedClientID);
    clientUpdate("+" + pEncodedClientID);
}

function clientClose( pEncodedClientID )
{
    log("clientClose:" + pEncodedClientID);
    clientUpdate("-" + pEncodedClientID);
}

function requestClientStatus()
{
    log("requestClientStatus");
    clientUpdate("");
}

function popupBlocked()
{
    log("popupBlocked");
    clientUpdate(NOPOPUP);
}

function launchApp( pURL, pWinName, pLaunchAppParams )
{
    showing("launchApp");
    try
    {
        var winHandle = window.open(pURL, pWinName, pLaunchAppParams);
        if ( !winHandle )
        {
            popupBlocked();
            return;
        }
    }
    catch ( e )
    {
        showError("Window.open( '" + pURL + "', '" + pWinName + "', '" + pLaunchAppParams + "' )", e);
    }
    shouldShow(LOGOUT);
}

function startPolling()
{
    var zLLframe = getLLframe();
    if ( zLLframe )
    {
        requestClientStatus();
    }
    else
    {
        showError("LLframe Frame Not Found", "");
    }
}

function initPage( pServletRelativeReference )
{
    log("initPage");
    mServletRelativeReference = pServletRelativeReference;
    window.setTimeout(startPolling, 100);
}

Commits for litesoft/trunk/Java/GWT/OldClient/src/org/litesoft/GWT/eventbus/public/portalsupport/PortalFrameScript.js

Diff revisions: vs.
Revision Author Commited Message
2 GeorgeS picture GeorgeS Sun 07 Feb, 2010 12:50:58 +0000