Skip to content

Commit e029037

Browse files
author
Koen Deforche
committed
see Changelog
1 parent 63027ec commit e029037

File tree

12 files changed

+430
-303
lines changed

12 files changed

+430
-303
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ IF(COMMAND CMAKE_POLICY)
55
ENDIF(COMMAND CMAKE_POLICY)
66

77
PROJECT(WT)
8-
SET(CMAKE_MODULE_PATH ${WT_SOURCE_DIR})
8+
SET(CMAKE_MODULE_PATH ${WT_SOURCE_DIR} ${WT_SOURCE_DIR}/cmake)
99

1010
SET(VERSION_SERIES 3)
1111
SET(VERSION_MAJOR 1)

Changelog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
04-12-2010:
2+
* Wt.js, CommAjax.js, CommScript.js: support communication problems
3+
by retrying with exponential back-off
4+
15
31-12-2009:
26
* Dbo: quote all identifiers
37

WConfig.h.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
#define WT_CONFIG_XML "${CONFIGURATION}"
1919
#define WTHTTP_CONFIGURATION "${WTHTTP_CONFIGURATION}"
2020

21-
#cmakedefine WTHTTP_WITH_ZLIB
22-
2321
#cmakedefine WT_STATIC
2422
#cmakedefine WTHTTP_STATIC
2523
#cmakedefine WT_EXT_STATIC

cmake/FindSqlite3.cmake

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# - find Sqlite 3
2+
# SQLITE3_INCLUDE_DIR - Where to find Sqlite 3 header files (directory)
3+
# SQLITE3_LIBRARIES - Sqlite 3 libraries
4+
# SQLITE3_LIBRARY_RELEASE - Where the release library is
5+
# SQLITE3_LIBRARY_DEBUG - Where the debug library is
6+
# SQLITE3_FOUND - Set to TRUE if we found everything (library, includes and executable)
7+
8+
# Copyright (c) 2010 Pau Garcia i Quiles, <pgquiles@elpauer.org>
9+
#
10+
# Redistribution and use is allowed according to the terms of the BSD license.
11+
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
12+
#
13+
# Generated by CModuler, a CMake Module Generator - http://gitorious.org/cmoduler
14+
15+
IF( SQLITE3_INCLUDE_DIR AND SQLITE3_LIBRARY_RELEASE AND SQLITE3_LIBRARY_DEBUG )
16+
SET(SQLITE3_FIND_QUIETLY TRUE)
17+
ENDIF( SQLITE3_INCLUDE_DIR AND SQLITE3_LIBRARY_RELEASE AND SQLITE3_LIBRARY_DEBUG )
18+
19+
FIND_PATH( SQLITE3_INCLUDE_DIR sqlite3.h )
20+
21+
FIND_LIBRARY(SQLITE3_LIBRARY_RELEASE NAMES sqlite3 )
22+
23+
FIND_LIBRARY(SQLITE3_LIBRARY_DEBUG NAMES sqlite3 HINTS /usr/lib/debug/usr/lib/ )
24+
25+
IF( SQLITE3_LIBRARY_RELEASE OR SQLITE3_LIBRARY_DEBUG AND SQLITE3_INCLUDE_DIR )
26+
SET( SQLITE3_FOUND TRUE )
27+
ENDIF( SQLITE3_LIBRARY_RELEASE OR SQLITE3_LIBRARY_DEBUG AND SQLITE3_INCLUDE_DIR )
28+
29+
IF( SQLITE3_LIBRARY_DEBUG AND SQLITE3_LIBRARY_RELEASE )
30+
# if the generator supports configuration types then set
31+
# optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
32+
IF( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
33+
SET( SQLITE3_LIBRARIES optimized ${SQLITE3_LIBRARY_RELEASE} debug ${SQLITE3_LIBRARY_DEBUG} )
34+
ELSE( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
35+
# if there are no configuration types and CMAKE_BUILD_TYPE has no value
36+
# then just use the release libraries
37+
SET( SQLITE3_LIBRARIES ${SQLITE3_LIBRARY_RELEASE} )
38+
ENDIF( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
39+
ELSEIF( SQLITE3_LIBRARY_RELEASE )
40+
SET( SQLITE3_LIBRARIES ${SQLITE3_LIBRARY_RELEASE} )
41+
ELSE( SQLITE3_LIBRARY_DEBUG AND SQLITE3_LIBRARY_RELEASE )
42+
SET( SQLITE3_LIBRARIES ${SQLITE3_LIBRARY_DEBUG} )
43+
ENDIF( SQLITE3_LIBRARY_DEBUG AND SQLITE3_LIBRARY_RELEASE )
44+
45+
IF( SQLITE3_FOUND )
46+
IF( NOT SQLITE3_FIND_QUIETLY )
47+
MESSAGE( STATUS "Found Sqlite3 header file in ${SQLITE3_INCLUDE_DIR}")
48+
MESSAGE( STATUS "Found Sqlite3 libraries: ${SQLITE3_LIBRARIES}")
49+
ENDIF( NOT SQLITE3_FIND_QUIETLY )
50+
ELSE(SQLITE3_FOUND)
51+
IF( SQLITE3_FIND_REQUIRED)
52+
MESSAGE( FATAL_ERROR "Could not find Sqlite3" )
53+
ELSE( SQLITE3_FIND_REQUIRED)
54+
MESSAGE( STATUS "Optional package Sqlite3 was not found" )
55+
ENDIF( SQLITE3_FIND_REQUIRED)
56+
ENDIF(SQLITE3_FOUND)

examples/hello-widgetset/hello.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ HelloApplication::HelloApplication(const WEnvironment& env, bool embedded)
3939
* only work if your application is hosted on the same domain as the
4040
* web page in which it is embedded.
4141
*/
42-
setAjaxMethod(XMLHttpRequest);
42+
//setAjaxMethod(XMLHttpRequest);
4343

4444
WContainerWidget *top;
4545

src/Wt/Dbo/backend/CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
OPTION( USE_SYSTEM_SQLITE3 "Use system-wide Sqlite3 instead of Wt's version" OFF)
2+
3+
IF(USE_SYSTEM_SQLITE3)
4+
FIND_PACKAGE( Sqlite3 REQUIRED)
5+
ELSE(USE_SYSTEM_SQLITE3)
6+
SET(Sqlite3_SRCS amalgamation/sqlite3.c)
7+
ENDIF(USE_SYSTEM_SQLITE3)
8+
19
ADD_LIBRARY(wtdbosqlite3
210
Sqlite3.C
3-
amalgamation/sqlite3.c
11+
${Sqlite3_SRCS}
412
)
513

6-
TARGET_LINK_LIBRARIES(wtdbosqlite3 wtdbo)
14+
TARGET_LINK_LIBRARIES(wtdbosqlite3 wtdbo ${SQLITE3_LIBRARIES})
715

816
IF(NOT WIN32)
917
TARGET_LINK_LIBRARIES(wtdbosqlite3 dl)

src/Wt/WContainerWidget.C

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,19 @@ void WContainerWidget::setLayout(WLayout *layout)
7575
void WContainerWidget::setLayout(WLayout *layout,
7676
WFlags<AlignmentFlag> alignment)
7777
{
78-
if (layout_)
78+
if (layout_ && layout != layout_)
7979
delete layout_;
8080

8181
contentAlignment_ = alignment;
8282

83-
if (layout) {
83+
if (layout != layout_) {
8484
layout_ = layout;
8585
flags_.set(BIT_LAYOUT_CHANGED);
8686

87-
WWidget::setLayout(layout);
88-
89-
layoutImpl()->setContainer(this);
87+
if (layout) {
88+
WWidget::setLayout(layout);
89+
layoutImpl()->setContainer(this);
90+
}
9091
}
9192
}
9293

src/web/WebRenderer.C

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ void WebRenderer::streamCommJs(WApplication *app, std::ostream& out)
424424
: skeletons::CommScript_js);
425425

426426
js.setVar("APP_CLASS", app->javaScriptClass());
427+
js.setVar("WT_CLASS", WT_CLASS);
427428

428429
/*
429430
* Mozilla Bugzilla #246651

src/web/WebSession.C

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,8 @@ void WebSession::notify(const WEvent& event)
11901190
}
11911191
} else if (*signalE == "poll" && !updatesPending_) {
11921192
pollResponse_ = handler.response();
1193+
//pollResponse_->setContentType("text/plain; charset=UTF-8");
1194+
//pollResponse_->flush(WebResponse::ResponseWaitMore);
11931195
handler.setRequest(0, 0);
11941196
}
11951197
} else {

src/web/skeleton/CommAjax.js

Lines changed: 70 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,72 @@
1-
_$_APP_CLASS_$_._p_.recvCallback = function(request, userData) {
2-
if (request.readyState == 4) {
3-
if (request.status) {
4-
_$_APP_CLASS_$_._p_.handleResponse
5-
(request.status == 200 ? request.responseText : "", userData);
6-
}
7-
request.onreadystatechange = new Function;
8-
}
9-
};
10-
11-
_$_APP_CLASS_$_._p_.commResponseReceived = function(updateId) {
12-
}
13-
14-
_$_APP_CLASS_$_._p_.sendUpdate = function(url, data, userData, id) {
15-
var xmlHttpReq = false;
16-
if (window.XMLHttpRequest) {
17-
xmlHttpReq = new XMLHttpRequest();
18-
} else if (window.ActiveXObject) {
19-
try {
20-
xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
21-
} catch (err) {
22-
try {
23-
xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
24-
} catch (err2) {
1+
_$_APP_CLASS_$_._p_.comm = new (function(handleResponse) {
2+
var handler = handleResponse;
3+
4+
function Request(url, data, userData, id, timeout) {
5+
var request = false;
6+
var timer = null;
7+
var handled = false;
8+
9+
function recvCallback() {
10+
if (request.readyState == 4) {
11+
if (handled)
12+
return;
13+
14+
// console.log("recvCallback " + request.status);
15+
clearTimeout(timer);
16+
17+
if (request.status == 200)
18+
handler(0, request.responseText, userData);
19+
else
20+
handler(1, null, userData);
21+
22+
request.onreadystatechange = new Function;
23+
24+
handled = true;
25+
}
26+
}
27+
28+
function handleTimeout() {
29+
request.onreadystatechange = new Function;
30+
handled = true;
31+
handler(2, null, userData);
32+
};
33+
34+
this.abort = function() {
35+
request.onreadystatechange = new Function;
36+
handled = true;
37+
request.abort();
2538
}
39+
40+
if (window.XMLHttpRequest)
41+
request = new XMLHttpRequest();
42+
else if (window.ActiveXObject)
43+
try {
44+
request = new ActiveXObject("Msxml2.XMLHTTP");
45+
} catch (err) {
46+
try {
47+
request = new ActiveXObject("Microsoft.XMLHTTP");
48+
} catch (err2) {
49+
}
50+
}
51+
52+
if (!request)
53+
return;
54+
55+
request.open('POST', url, true);
56+
request.setRequestHeader("Content-type",
57+
"application/x-www-form-urlencoded;");
58+
if (_$_CLOSE_CONNECTION_$_)
59+
request.setRequestHeader("Connection","close");
60+
61+
if (timeout > 0)
62+
timer = setTimeout(handleTimeout, timeout);
63+
request.onreadystatechange = recvCallback;
64+
request.send(data);
2665
}
27-
}
28-
29-
xmlHttpReq.open('POST', url, true);
30-
xmlHttpReq.setRequestHeader("Content-type",
31-
"application/x-www-form-urlencoded;");
32-
if (_$_CLOSE_CONNECTION_$_)
33-
xmlHttpReq.setRequestHeader("Connection","close");
34-
xmlHttpReq.onreadystatechange
35-
= function() { _$_APP_CLASS_$_._p_.recvCallback(xmlHttpReq, userData); };
36-
xmlHttpReq.send(data);
37-
38-
return xmlHttpReq;
39-
};
66+
67+
this.responseReceived = function(updateId) { };
68+
69+
this.sendUpdate = function(url, data, userData, id, timeout) {
70+
return new Request(url, data, userData, id, timeout);
71+
};
72+
})(_$_APP_CLASS_$_._p_.handleResponse);

0 commit comments

Comments
 (0)