Compare commits
248 Commits
release-0.
...
release-0.
| Author | SHA1 | Date | |
|---|---|---|---|
| 57a12465c1 | |||
| 859a13ae51 | |||
| bce084b9db | |||
| 23ed157a75 | |||
| 3723469d52 | |||
| 218e73945d | |||
| 4ab44a0c47 | |||
| 47dbe7fdbb | |||
| 2252971c3e | |||
| 28a6bb158a | |||
| f653507fc8 | |||
| 225cda0af7 | |||
| f3f5384d9b | |||
| 110a95b786 | |||
| cc4ef1a575 | |||
|
|
a982286dd4 | ||
|
|
c27f57adf1 | ||
|
|
6fbe66ff7b | ||
| fa8b3fdccc | |||
| fbbd1f1eee | |||
| 95f14c501c | |||
| f41e83c30c | |||
|
|
32cf1a5720 | ||
|
|
b4ec6fdff8 | ||
| 5b6c257fae | |||
| 401bbc657a | |||
| f706e049bc | |||
| eab8df7e10 | |||
|
|
28d158571c | ||
|
|
35729b4ab6 | ||
|
|
af65519067 | ||
|
|
c9b44414b1 | ||
|
|
b96a02d55d | ||
|
|
d8987f8718 | ||
| 430b34df4f | |||
| 1a518e4d27 | |||
| b09060315c | |||
| 899a32c86c | |||
| 7d5d55462f | |||
| b083f1d596 | |||
| c61afe77a0 | |||
| 654561bcbc | |||
| a065cfb2b5 | |||
| 5c51937b7e | |||
| 330d1462bf | |||
|
|
a75ab85356 | ||
| e8d96b3521 | |||
| 06088866e0 | |||
| ad34ec1156 | |||
|
|
f52aa2ecff | ||
| a547cbaeb1 | |||
|
|
77e2a7107f | ||
|
|
3997efcd2d | ||
|
|
024e5e4b04 | ||
|
|
92ce80cd63 | ||
|
|
137afab3d3 | ||
|
|
31ba0a8828 | ||
| 47e028de2a | |||
| a65f8cbc9c | |||
| f85dc7f550 | |||
|
|
47d98a1a11 | ||
|
|
1b94f58e7a | ||
| 5fc34d947a | |||
|
|
aee512a316 | ||
|
|
57a695555a | ||
|
|
a7e1be115a | ||
|
|
5b4c498ba6 | ||
|
|
decb9d0f9b | ||
|
|
e3e6fd7f62 | ||
|
|
0ef31cead3 | ||
|
|
a8a3f3cb8b | ||
|
|
8647ae1cd3 | ||
|
|
ec2792b645 | ||
|
|
1470389600 | ||
|
|
1fcc69b268 | ||
|
|
3bc3e3b874 | ||
|
|
f5b23c2571 | ||
|
|
9b0ec8a55b | ||
|
|
a0c000b50f | ||
|
|
91624258eb | ||
|
|
ba314cb3f5 | ||
|
|
44cb0ad98c | ||
|
|
01cab452d8 | ||
|
|
20d7009383 | ||
|
|
5249275b23 | ||
|
|
4875ca9ff1 | ||
|
|
a74fcd0575 | ||
|
|
ab9c304597 | ||
|
|
178a48cd7e | ||
|
|
9f132a7b72 | ||
|
|
403b9f7bde | ||
|
|
a05e08c207 | ||
|
|
8c5400915d | ||
|
|
8ebaf2a917 | ||
|
|
0507a1d347 | ||
|
|
7c6980860c | ||
|
|
b321bee60e | ||
|
|
14088f126b | ||
|
|
c9d11b3adb | ||
|
|
c3c8c66f59 | ||
|
|
a23871ff5b | ||
|
|
2eb9abeb37 | ||
|
|
955272f505 | ||
|
|
1ee6ffa725 | ||
|
|
ad5ccd6585 | ||
|
|
da28baf872 | ||
|
|
3b87481c93 | ||
|
|
53f848758a | ||
|
|
1f7f569d82 | ||
|
|
52cc356f8e | ||
|
|
de57e814c0 | ||
|
|
273b4d13f5 | ||
|
|
c44cf5e983 | ||
|
|
d96a76bffa | ||
|
|
665772bda2 | ||
|
|
aa479af8fd | ||
|
|
9e2410c284 | ||
|
|
eca868f10f | ||
|
|
a4095b4e16 | ||
|
|
5eb1f89273 | ||
|
|
f11dbd9080 | ||
|
|
07ac6a6742 | ||
|
|
813caa15e0 | ||
|
|
de8d36d0db | ||
|
|
62d880a7c1 | ||
|
|
1f76fd5360 | ||
|
|
19df76c332 | ||
|
|
78c83a4b69 | ||
|
|
7c7bf9a3f8 | ||
|
|
ade9a30c03 | ||
|
|
91a3b8176f | ||
|
|
982efe6d14 | ||
|
|
3f237c737d | ||
|
|
115b622724 | ||
|
|
f502e6a6f7 | ||
|
|
73f675db60 | ||
|
|
b629bba5cc | ||
|
|
d34c940c91 | ||
|
|
3faa2ab815 | ||
|
|
a4ea402fb5 | ||
|
|
ffd3e30086 | ||
|
|
b614613ff4 | ||
|
|
4d7660a9e3 | ||
|
|
b8490eff28 | ||
|
|
fc954c9521 | ||
|
|
7435b4f454 | ||
|
|
10ffa2066d | ||
|
|
d56f4e6c7d | ||
|
|
dd63042ec4 | ||
|
|
4c946f5829 | ||
|
|
767328287a | ||
|
|
cda8e75f4c | ||
|
|
d01f47f1ee | ||
|
|
a6fbed22fe | ||
|
|
032f96378d | ||
|
|
1c19ff4544 | ||
|
|
2d439a2414 | ||
|
|
34629662ff | ||
|
|
acc0f4ae94 | ||
|
|
a303783204 | ||
|
|
1198d6cef4 | ||
|
|
3e3869e391 | ||
|
|
8db9e85843 | ||
|
|
2ff2dbb7c3 | ||
|
|
c8845e7354 | ||
|
|
dde70512d8 | ||
|
|
69495e69a9 | ||
|
|
45f0971594 | ||
|
|
496b831956 | ||
|
|
bb56166f95 | ||
|
|
c6d022bf18 | ||
|
|
a2b63cb9ba | ||
|
|
049f769638 | ||
|
|
aef30966de | ||
|
|
e14772fcc1 | ||
|
|
3206bcc4fd | ||
|
|
1627fd6d94 | ||
|
|
a96a143fe0 | ||
|
|
4ec2832375 | ||
|
|
ca5619c6fc | ||
|
|
86777d75ea | ||
|
|
82784529fe | ||
|
|
f6e15b6ce1 | ||
|
|
334f7a362b | ||
|
|
b278dba565 | ||
|
|
58adb7ff88 | ||
|
|
617c48adcb | ||
|
|
231b263a82 | ||
|
|
37016a7796 | ||
|
|
504baaf859 | ||
|
|
0d9e1a84f3 | ||
|
|
f280f9b0de | ||
|
|
2501bd3495 | ||
|
|
f029c746bc | ||
|
|
42bd4fa58f | ||
|
|
98f3739c7c | ||
|
|
441cf86eda | ||
|
|
c1d913e67d | ||
|
|
65d8665a64 | ||
|
|
4a92612441 | ||
|
|
7cf395a9bc | ||
|
|
7efcdb065e | ||
|
|
218b2e44a7 | ||
|
|
544401c210 | ||
|
|
f3d37024fb | ||
|
|
ce7be6ea34 | ||
|
|
5dd6079fad | ||
|
|
e7b8f398f7 | ||
|
|
9d8e8eb25a | ||
|
|
ff9be2cf8e | ||
|
|
db4f665de1 | ||
|
|
06c9364362 | ||
|
|
69a77dc2c5 | ||
|
|
d4091a57c9 | ||
|
|
2302a91b5b | ||
|
|
22a725b8be | ||
|
|
92d3f642ac | ||
|
|
598f6df366 | ||
|
|
9c0a2bd6a1 | ||
|
|
0902eef91c | ||
|
|
12404a2d5c | ||
|
|
b543a6b6f2 | ||
|
|
a417cc1e16 | ||
|
|
5d05f31d03 | ||
|
|
c9674b9e8e | ||
|
|
fd0d771d43 | ||
|
|
0d51189324 | ||
|
|
a97235c7b7 | ||
|
|
c62ad33ddc | ||
|
|
5eb8baa096 | ||
|
|
61c8388eba | ||
|
|
9be87e8e15 | ||
|
|
84df92de10 | ||
|
|
df9eb65144 | ||
|
|
bf952a9719 | ||
|
|
1560752f97 | ||
|
|
589abc71a7 | ||
|
|
61e17a9134 | ||
|
|
09c3e56f86 | ||
|
|
3dbccc024f | ||
|
|
993f1ad6b9 | ||
|
|
7028ce07f4 | ||
|
|
461cb4a4db | ||
|
|
cffc02daee | ||
|
|
451aa7773d | ||
|
|
7db054a36d | ||
|
|
dc6255d410 | ||
|
|
ff57d0ecd4 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -2,3 +2,5 @@ EIFGENs
|
||||
tests/temp/
|
||||
.svn/
|
||||
*.swp
|
||||
*~
|
||||
*#
|
||||
|
||||
24
README.md
24
README.md
@@ -1,7 +1,5 @@
|
||||
# Eiffel Web Framework
|
||||
|
||||
* version: v0.2
|
||||
|
||||
|
||||
## Overview
|
||||
|
||||
@@ -18,18 +16,24 @@ For download, check
|
||||
|
||||
## Requirements
|
||||
* Compiling from EiffelStudio 7.0
|
||||
* Developped using EiffelStudio 7.1 and 7.2 (on Windows, Linux)
|
||||
* Tested using EiffelStudio 7.1 with "jenkins" CI server (not compatible with 6.8 due to use of `TABLE_ITERABLE')
|
||||
* Developped using EiffelStudio 7.1 (on Windows, Linux)
|
||||
* Tested using EiffelStudio 7.1 with "jenkins" CI server (not anymore compatible with 6.8 due to use of `TABLE_ITERABLE')
|
||||
* The code have to allow __void-safe__ compilation and non void-safe system (see [more about void-safety](http://docs.eiffel.com/book/method/void-safe-programming-eiffel) )
|
||||
|
||||
## How to get the source code?
|
||||
|
||||
* git clone https://github.com/EiffelWebFramework/EWF.git
|
||||
* svn checkout https://github.com/EiffelWebFramework/EWF/trunk
|
||||
Using git version >= 1.6.5
|
||||
* git clone --recursive https://github.com/EiffelWebFramework/EWF.git
|
||||
|
||||
* Notes:
|
||||
** It does not use submodule anymore due to recurrent trouble for users.
|
||||
** EWF is also provided by delivery of EiffelStudio (starting from version 7.1 shipping v0.1, and 7.2 that ships v0.2)
|
||||
Otherwise, try
|
||||
* git clone https://github.com/EiffelWebFramework/EWF.git
|
||||
* cd Eiffel-Web-Framework
|
||||
* git submodule update --init
|
||||
* git submodule foreach --recursive git checkout master
|
||||
|
||||
An alternative to the last 2 instructions is to use the script from tools folder:
|
||||
* cd tools
|
||||
* update_git_working_copy
|
||||
|
||||
* And to build the required and related Clibs
|
||||
* cd contrib/ise_library/cURL
|
||||
@@ -47,7 +51,7 @@ For download, check
|
||||
### protocol
|
||||
* __http__: HTTP related classes, constants for status code, content types, ... [read more](library/protocol/http)
|
||||
* __uri_template__: URI Template library (parsing and expander) [read more](library/protocol/uri_template)
|
||||
*not yet released: __CONNEG__: CONNEG library (Content-type Negociation) [read more](library/protocol/CONNEG)
|
||||
* __CONNEG__: CONNEG library (Content-type Negociation) [read more](library/protocol/CONNEG)
|
||||
|
||||
### client
|
||||
* __http_client__: simple HTTP client based on cURL [read more](library/client/http_client)
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-5-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-5-0 http://www.eiffel.com/developers/xml/configuration-1-5-0.xsd" name="curl" uuid="D51EF190-6157-4B47-8E73-FA93DCBB7A71" library_target="curl">
|
||||
<target name="curl">
|
||||
<description>cURL: libcURL wrapper library for Eiffel.
|
||||
Copyright (c) 1984-2006, Eiffel Software and others.
|
||||
Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt).</description>
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/\.svn$</exclude>
|
||||
<exclude>/EIFGEN.{0,1}$</exclude>
|
||||
<exclude>/temp$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" cat_call_detection="false" is_attached_by_default="true" void_safety="all" namespace="EiffelSoftware.Library">
|
||||
</option>
|
||||
<setting name="dotnet_naming_convention" value="true"/>
|
||||
<external_include location="$(ECF_CONFIG_PATH)\cURL\spec\include">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_include location="$(ECF_CONFIG_PATH)/cURL/spec/include">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_object location="$(ECF_CONFIG_PATH)/cURL/spec/$(ISE_PLATFORM)/lib/eiffel_curl.o">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<multithreaded value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH)/cURL/spec/$(ISE_PLATFORM)/lib/MTeiffel_curl.o">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<multithreaded value="true"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH)\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\eiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<multithreaded value="false"/>
|
||||
<dotnet value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH)\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\mteiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<multithreaded value="true"/>
|
||||
<dotnet value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH)\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\ileiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<dotnet value="true"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<library name="api_wrapper" location="$ISE_LIBRARY\library\api_wrapper\api_wrapper-safe.ecf"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<cluster name="curl" location=".\cURL" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/spec$</exclude>
|
||||
<exclude>/Clib$</exclude>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/gtk$</exclude>
|
||||
<exclude>/mac$</exclude>
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/mswin$</exclude>
|
||||
<exclude>/gtk$</exclude>
|
||||
<condition>
|
||||
<platform value="macintosh"/>
|
||||
<custom name="vision_implementation" value="cocoa"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/mswin$</exclude>
|
||||
<exclude>/mac$</exclude>
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<custom name="vision_implementation" excluded_value="cocoa"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
</target>
|
||||
<target name="curl_dotnet" extends="curl">
|
||||
<setting name="msil_generation" value="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -1,93 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-5-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-5-0 http://www.eiffel.com/developers/xml/configuration-1-5-0.xsd" name="curl" uuid="D51EF190-6157-4B47-8E73-FA93DCBB7A71" library_target="curl">
|
||||
<target name="curl">
|
||||
<description>cURL: libcURL wrapper library for Eiffel.
|
||||
Copyright (c) 1984-2006, Eiffel Software and others.
|
||||
Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt).</description>
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/\.svn$</exclude>
|
||||
<exclude>/EIFGEN.{0,1}$</exclude>
|
||||
<exclude>/temp$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" namespace="EiffelSoftware.Library">
|
||||
</option>
|
||||
<setting name="dotnet_naming_convention" value="true"/>
|
||||
<external_include location="$(ECF_CONFIG_PATH)\cURL\spec\include">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_include location="$(ECF_CONFIG_PATH)/cURL/spec/include">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_object location="$(ECF_CONFIG_PATH)/cURL/spec/$(ISE_PLATFORM)/lib/eiffel_curl.o">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<multithreaded value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH)/cURL/spec/$(ISE_PLATFORM)/lib/MTeiffel_curl.o">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<multithreaded value="true"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH)\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\eiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<multithreaded value="false"/>
|
||||
<dotnet value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH)\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\mteiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<multithreaded value="true"/>
|
||||
<dotnet value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH)\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\ileiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<dotnet value="true"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<library name="api_wrapper" location="$ISE_LIBRARY\library\api_wrapper\api_wrapper.ecf"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<cluster name="curl" location=".\cURL" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/spec$</exclude>
|
||||
<exclude>/Clib$</exclude>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/gtk$</exclude>
|
||||
<exclude>/mac$</exclude>
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/mswin$</exclude>
|
||||
<exclude>/gtk$</exclude>
|
||||
<condition>
|
||||
<platform value="macintosh"/>
|
||||
<custom name="vision_implementation" value="cocoa"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/mswin$</exclude>
|
||||
<exclude>/mac$</exclude>
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<custom name="vision_implementation" excluded_value="cocoa"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
</target>
|
||||
<target name="curl_dotnet" extends="curl">
|
||||
<setting name="msil_generation" value="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -1,58 +0,0 @@
|
||||
TOP = ..
|
||||
DIR = $dir_sep
|
||||
OUTDIR= .
|
||||
INDIR= .
|
||||
CC = $cc
|
||||
OUTPUT_CMD = $output_cmd
|
||||
CFLAGS = -I"$rt_include" -I..$(DIR)spec$(DIR)include -I. \
|
||||
-I..$(DIR)..$(DIR)..$(DIR)C_library$(DIR)libpng -I..$(DIR)..$(DIR)..$(DIR)C_library$(DIR)zlib
|
||||
JCFLAGS = $(CFLAGS) $ccflags $optimize
|
||||
JMTCFLAGS = $(CFLAGS) $mtccflags $optimize
|
||||
JILCFLAGS = $(CFLAGS) $mtccflags $optimize -DEIF_IL_DLL
|
||||
LN = copy
|
||||
MV = $mv
|
||||
RM = $del
|
||||
MAKE = $make
|
||||
MKDIR = $mkdir
|
||||
LINK = $link32
|
||||
DLL_FLAGS = $dll_flags
|
||||
DLL_LIBS = $dll_libs
|
||||
OBJECTS = eiffel_curl.$obj
|
||||
MT_OBJECTS = MTeiffel_curl.$obj
|
||||
IL_OBJECTS = ILeiffel_curl.$obj
|
||||
|
||||
.c.$obj:
|
||||
$(CC) -c $(JCFLAGS) $<
|
||||
|
||||
all:: $output_libraries
|
||||
$(MAKE) clean
|
||||
|
||||
standard:: eiffel_curl.lib ileiffel_curl.lib
|
||||
mtstandard:: mteiffel_curl.lib
|
||||
|
||||
clean:
|
||||
$(RM) *.$obj
|
||||
$(RM) *.lib
|
||||
|
||||
eiffel_curl.lib: $(OBJECTS)
|
||||
$alib_line
|
||||
$(MKDIR) ..$(DIR)spec$(DIR)$(ISE_C_COMPILER)$(DIR)$(ISE_PLATFORM)$(DIR)lib
|
||||
$(MV) $@ ..$(DIR)spec$(DIR)$(ISE_C_COMPILER)$(DIR)$(ISE_PLATFORM)$(DIR)lib$(DIR)$@
|
||||
|
||||
mteiffel_curl.lib: $(MT_OBJECTS)
|
||||
$alib_line
|
||||
$(MKDIR) ..$(DIR)spec$(DIR)$(ISE_C_COMPILER)$(DIR)$(ISE_PLATFORM)$(DIR)lib
|
||||
$(MV) $@ ..$(DIR)spec$(DIR)$(ISE_C_COMPILER)$(DIR)$(ISE_PLATFORM)$(DIR)lib$(DIR)$@
|
||||
|
||||
ileiffel_curl.lib: $(IL_OBJECTS)
|
||||
$alib_line
|
||||
$(MKDIR) ..$(DIR)spec$(DIR)$(ISE_C_COMPILER)$(DIR)$(ISE_PLATFORM)$(DIR)lib
|
||||
$(MV) $@ ..$(DIR)spec$(DIR)$(ISE_C_COMPILER)$(DIR)$(ISE_PLATFORM)$(DIR)lib$(DIR)$@
|
||||
|
||||
#Multithreaded targets.
|
||||
MTeiffel_curl.$obj: eiffel_curl.c
|
||||
$(CC) $(JMTCFLAGS) $(OUTPUT_CMD)$@ -c $?
|
||||
|
||||
#.NET targets.
|
||||
ILeiffel_curl.$obj: eiffel_curl.c
|
||||
$(CC) $(JILCFLAGS) $(OUTPUT_CMD)$@ -c $?
|
||||
@@ -1,92 +0,0 @@
|
||||
case $CONFIG in
|
||||
'')
|
||||
if test ! -f config.sh; then
|
||||
(echo "Can't find config.sh."; exit 1)
|
||||
fi 2>/dev/null
|
||||
. ./config.sh
|
||||
;;
|
||||
esac
|
||||
case "$0" in
|
||||
*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
|
||||
esac
|
||||
echo "Extracting "."/Makefile (with variable substitutions)"
|
||||
$spitshell >Makefile <<!GROK!THIS!
|
||||
########################################################################
|
||||
# Makefile generated from Makefile.SH on $DATE
|
||||
|
||||
SHELL = /bin/sh
|
||||
AR = ar rc
|
||||
CC = $cc
|
||||
CTAGS = ctags
|
||||
INCLUDE = -I$rt_include -I../spec/include -I../../../C_library/libpng -I../../../C_library/zlib
|
||||
CFLAGS = $optimize $ccflags $large -g \$(INCLUDE)
|
||||
MTCFLAGS = $optimize $mtccflags $large -g \$(INCLUDE)
|
||||
SHAREDLINK = $sharedlink
|
||||
LDSHAREDFLAGS = $ldsharedflags
|
||||
LN = $ln
|
||||
MAKE = $make
|
||||
MKDEP = $mkdep \$(DPFLAGS) --
|
||||
RANLIB = $ranlib
|
||||
RM = $rm -f
|
||||
MV = $mv
|
||||
MKDIR = $mkdir -p
|
||||
PLATFORM = $ISE_PLATFORM
|
||||
|
||||
########################################################################
|
||||
# New suffixes and associated building rules -- edit with care
|
||||
|
||||
|
||||
!GROK!THIS!
|
||||
$spitshell >>Makefile <<'!NO!SUBS!'
|
||||
|
||||
MT_OBJECTS = MTeiffel_curl.o
|
||||
OBJECTS = eiffel_curl.o
|
||||
|
||||
ALL_OBJECTS = $(OBJECTS) $(MT_OBJECTS)
|
||||
|
||||
all: $(ALL_OBJECTS)
|
||||
$(MKDIR) ../spec/$(PLATFORM)/lib
|
||||
$(MV) $? ../spec/$(PLATFORM)/lib
|
||||
$(MAKE) clobber
|
||||
|
||||
MTeiffel_curl.o: eiffel_curl.c
|
||||
$(CC) -c $(MTCFLAGS) $? -o $@
|
||||
|
||||
########################################################################
|
||||
# Common rules for all Makefiles -- do not edit
|
||||
|
||||
emptyrule::
|
||||
|
||||
clean: local_clean
|
||||
realclean: local_realclean
|
||||
clobber: local_clobber
|
||||
|
||||
local_clean::
|
||||
$(RM) core *~ *.o *.so *.a
|
||||
|
||||
local_realclean:: local_clean
|
||||
|
||||
local_clobber:: local_realclean
|
||||
$(RM) Makefile config.sh
|
||||
|
||||
Makefile: Makefile.SH
|
||||
/bin/sh Makefile.SH
|
||||
|
||||
tags::
|
||||
$(CTAGS) -w *.[ch]
|
||||
$(CTAGS) -xw *.[ch] > tags
|
||||
|
||||
local_clobber::
|
||||
$(RM) tags
|
||||
|
||||
########################################################################
|
||||
# Dependencies generated by make depend
|
||||
# DO NOT DELETE THIS LINE -- make depend relies on it
|
||||
|
||||
# Put nothing here or make depend will gobble it up
|
||||
.FORCE_DEPEND::
|
||||
@echo "You must run 'make depend' in $(TOP) first."; exit 1
|
||||
!NO!SUBS!
|
||||
chmod 644 Makefile
|
||||
$eunicefix Makefile
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="build_curl_clib" default="help">
|
||||
|
||||
<description>
|
||||
description: "cURL Clib library compilation"
|
||||
</description>
|
||||
|
||||
<target name="help">
|
||||
<echo message="usage:"/>
|
||||
<echo message=" geant compile"/>
|
||||
<echo message=" geant clean"/>
|
||||
<echo message=" geant clobber"/>
|
||||
</target>
|
||||
|
||||
<target name="compile" >
|
||||
<exec executable="finish_freezing -library" />
|
||||
</target>
|
||||
|
||||
<target name="clean" >
|
||||
</target>
|
||||
|
||||
<target name="clobber" depend="clean" />
|
||||
|
||||
</project>
|
||||
@@ -1,188 +0,0 @@
|
||||
/*
|
||||
indexing
|
||||
description: "Functions used by the class CURL_FUNCTION."
|
||||
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
356 Storke Road, Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
*/
|
||||
|
||||
#include "eiffel_curl.h"
|
||||
|
||||
typedef EIF_INTEGER (* EIF_CURL_PROGRESS_PROC) (
|
||||
#ifndef EIF_IL_DLL
|
||||
EIF_REFERENCE, /* CURL_FUNCTION Eiffel object */
|
||||
#endif
|
||||
EIF_POINTER, /* a_user_pointer */
|
||||
EIF_REAL_64, /* a_dltotal */
|
||||
EIF_REAL_64, /* a_dlnow */
|
||||
EIF_REAL_64, /* a_ultotal */
|
||||
EIF_REAL_64 /* a_ulnow */
|
||||
);
|
||||
|
||||
typedef EIF_INTEGER (* EIF_CURL_WRITE_PROC) (
|
||||
#ifndef EIF_IL_DLL
|
||||
EIF_REFERENCE, /* CURL_FUNCTION Eiffel object */
|
||||
#endif
|
||||
EIF_POINTER, /* a_data_pointer */
|
||||
EIF_INTEGER, /* a_size */
|
||||
EIF_INTEGER, /* a_nmemb */
|
||||
EIF_POINTER /* a_write_pointer */
|
||||
);
|
||||
|
||||
typedef EIF_INTEGER (* EIF_CURL_READ_PROC) (
|
||||
#ifndef EIF_IL_DLL
|
||||
EIF_REFERENCE, /* CURL_FUNCTION Eiffel object */
|
||||
#endif
|
||||
EIF_POINTER, /* a_data_pointer */
|
||||
EIF_INTEGER, /* a_size */
|
||||
EIF_INTEGER, /* a_nmemb */
|
||||
EIF_POINTER /* a_write_pointer */
|
||||
);
|
||||
|
||||
|
||||
typedef EIF_INTEGER (* EIF_CURL_DEBUG_PROC) (
|
||||
#ifndef EIF_IL_DLL
|
||||
EIF_REFERENCE, /* CURL_FUNCTION Eiffel object */
|
||||
#endif
|
||||
EIF_POINTER, /* a_curl_handle */
|
||||
EIF_INTEGER, /* a_curl_infotype */
|
||||
EIF_POINTER, /* a_char_pointer */
|
||||
EIF_INTEGER, /* a_size */
|
||||
EIF_POINTER /* a_user_pointer */
|
||||
);
|
||||
|
||||
static EIF_OBJECT eiffel_function_object = NULL;
|
||||
/* Address of Eiffel object CURL_FUNCTION */
|
||||
|
||||
static EIF_CURL_PROGRESS_PROC eiffel_progress_function = NULL;
|
||||
/* Address of Eiffel CURL_FUNCTION.progress_function */
|
||||
|
||||
static EIF_CURL_WRITE_PROC eiffel_write_function = NULL;
|
||||
/* Address of Eiffel CURL_FUNCTION.write_function */
|
||||
|
||||
static EIF_CURL_READ_PROC eiffel_read_function = NULL;
|
||||
/* Address of Eiffel CURL_FUNCTION.read_function */
|
||||
|
||||
static EIF_CURL_DEBUG_PROC eiffel_debug_function = NULL;
|
||||
/* Address of Eiffel CURL_FUNCTION.debug_function */
|
||||
|
||||
/* Set Eiffel CURL_FUNCTION object address */
|
||||
void c_set_object(EIF_REFERENCE a_address)
|
||||
{
|
||||
if (a_address) {
|
||||
eiffel_function_object = eif_protect (a_address);
|
||||
} else {
|
||||
eiffel_function_object = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Release Eiffel CURL_FUNCTION object address */
|
||||
void c_release_object()
|
||||
{
|
||||
eif_wean (eiffel_function_object);
|
||||
}
|
||||
|
||||
/* Set CURL_FUNCTOIN.progress_function address */
|
||||
void c_set_progress_function_address( EIF_POINTER a_address)
|
||||
{
|
||||
eiffel_progress_function = (EIF_CURL_PROGRESS_PROC) a_address;
|
||||
}
|
||||
|
||||
/* Set CURL_FUNCTOIN.write_function address */
|
||||
void c_set_write_function_address( EIF_POINTER a_address)
|
||||
{
|
||||
eiffel_write_function = (EIF_CURL_WRITE_PROC) a_address;
|
||||
}
|
||||
|
||||
/* Set CURL_FUNCTOIN.read_function address */
|
||||
void c_set_read_function_address( EIF_POINTER a_address)
|
||||
{
|
||||
eiffel_read_function = (EIF_CURL_READ_PROC) a_address;
|
||||
}
|
||||
|
||||
/* Set CURL_FUNCTOIN.debug_function address */
|
||||
void c_set_debug_function_address (EIF_POINTER a_address)
|
||||
{
|
||||
eiffel_debug_function = (EIF_CURL_DEBUG_PROC) a_address;
|
||||
}
|
||||
|
||||
/* Eiffel adapter function for CURLOPT_WRITEFUNCTION
|
||||
We need this function since Eiffel function call need first parameter is EIF_REFERENCE. */
|
||||
size_t curl_write_function (void *ptr, size_t size, size_t nmemb, void *data)
|
||||
{
|
||||
if (eiffel_function_object) {
|
||||
return (size_t) ((eiffel_write_function) (
|
||||
#ifndef EIF_IL_DLL
|
||||
(EIF_REFERENCE) eif_access (eiffel_function_object),
|
||||
#endif
|
||||
(EIF_POINTER) ptr,
|
||||
(EIF_INTEGER) size,
|
||||
(EIF_INTEGER) nmemb,
|
||||
(EIF_POINTER) data));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Eiffel adapter function for CURLOPT_READFUNCTION
|
||||
We need this function since Eiffel function call need first parameter is EIF_REFERENCE. */
|
||||
size_t curl_read_function (void *ptr, size_t size, size_t nmemb, void *data)
|
||||
{
|
||||
if (eiffel_function_object) {
|
||||
return (size_t) ((eiffel_read_function) (
|
||||
#ifndef EIF_IL_DLL
|
||||
(EIF_REFERENCE) eif_access (eiffel_function_object),
|
||||
#endif
|
||||
(EIF_POINTER) ptr,
|
||||
(EIF_INTEGER) size,
|
||||
(EIF_INTEGER) nmemb,
|
||||
(EIF_POINTER) data));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Eiffel adapter function for CURLOPT_PROGRESSFUNCTION
|
||||
We need this function since Eiffel function call need first parameter is EIF_REFERENCE. */
|
||||
size_t curl_progress_function (void * a_object_id, double a_dltotal, double a_dlnow, double a_ultotal, double a_ulnow)
|
||||
{
|
||||
if (eiffel_function_object) {
|
||||
return (size_t) ((eiffel_progress_function) (
|
||||
#ifndef EIF_IL_DLL
|
||||
(EIF_REFERENCE) eif_access (eiffel_function_object),
|
||||
#endif
|
||||
(EIF_POINTER) a_object_id,
|
||||
(EIF_REAL_64) a_dltotal,
|
||||
(EIF_REAL_64) a_dlnow,
|
||||
(EIF_REAL_64) a_ultotal,
|
||||
(EIF_REAL_64) a_ulnow));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Eiffel adapter function for CURLOPT_DEBUGFUNCTION
|
||||
We need this function since Eiffel function call need first parameter is EIF_REFERENCE. */
|
||||
size_t curl_debug_function (CURL * a_curl_handle, curl_infotype a_curl_infotype, unsigned char * a_char_pointer, size_t a_size, void * a_object_id)
|
||||
{
|
||||
if (eiffel_function_object) {
|
||||
return (size_t) ((eiffel_debug_function) (
|
||||
#ifndef EIF_IL_DLL
|
||||
(EIF_REFERENCE) eif_access (eiffel_function_object),
|
||||
#endif
|
||||
(EIF_POINTER) a_curl_handle,
|
||||
(EIF_INTEGER) a_curl_infotype,
|
||||
(EIF_POINTER) a_char_pointer,
|
||||
(EIF_INTEGER) a_size,
|
||||
(EIF_POINTER) a_object_id));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="build_curl" default="help">
|
||||
|
||||
<description>
|
||||
description: "cURL library compilation"
|
||||
</description>
|
||||
|
||||
<target name="help">
|
||||
<echo message="usage:"/>
|
||||
<echo message=" geant compile"/>
|
||||
<echo message=" geant clean"/>
|
||||
<echo message=" geant clobber"/>
|
||||
</target>
|
||||
|
||||
<target name="compile">
|
||||
<echo message="- Compile [cURL]" />
|
||||
<geant target="compile" file="build.eant" dir="Clib"
|
||||
reuse_variables="true" />
|
||||
</target>
|
||||
|
||||
<target name="clean">
|
||||
<echo message="- Clean [cURL]" />
|
||||
<delete directory="spec\${ISE_C_COMPILER}\${ISE_PLATFORM}" />
|
||||
</target>
|
||||
|
||||
<target name="clobber" depend="clean" />
|
||||
|
||||
</project>
|
||||
@@ -1,93 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-5-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-5-0 http://www.eiffel.com/developers/xml/configuration-1-5-0.xsd" name="curl" uuid="D51EF190-6157-4B47-8E73-FA93DCBB7A71" library_target="curl">
|
||||
<target name="curl">
|
||||
<description>cURL: libcURL wrapper library for Eiffel.
|
||||
Copyright (c) 1984-2006, Eiffel Software and others.
|
||||
Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt).</description>
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/\.svn$</exclude>
|
||||
<exclude>/EIFGEN.{0,1}$</exclude>
|
||||
<exclude>/temp$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" cat_call_detection="false" is_attached_by_default="true" void_safety="all" namespace="EiffelSoftware.Library">
|
||||
</option>
|
||||
<setting name="dotnet_naming_convention" value="true"/>
|
||||
<external_include location="$(ISE_LIBRARY)\library\cURL\spec\include">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_include location="$(ISE_LIBRARY)/library/cURL/spec/include">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_object location="$(ISE_LIBRARY)/library/cURL/spec/$(ISE_PLATFORM)/lib/eiffel_curl.o">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<multithreaded value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ISE_LIBRARY)/library/cURL/spec/$(ISE_PLATFORM)/lib/MTeiffel_curl.o">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<multithreaded value="true"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ISE_LIBRARY)\library\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\eiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<multithreaded value="false"/>
|
||||
<dotnet value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ISE_LIBRARY)\library\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\mteiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<multithreaded value="true"/>
|
||||
<dotnet value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ISE_LIBRARY)\library\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\ileiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<dotnet value="true"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<library name="api_wrapper" location="$ISE_LIBRARY\library\api_wrapper\api_wrapper-safe.ecf"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<cluster name="curl" location=".\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/spec$</exclude>
|
||||
<exclude>/Clib$</exclude>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/gtk$</exclude>
|
||||
<exclude>/mac$</exclude>
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/mswin$</exclude>
|
||||
<exclude>/gtk$</exclude>
|
||||
<condition>
|
||||
<platform value="macintosh"/>
|
||||
<custom name="vision_implementation" value="cocoa"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/mswin$</exclude>
|
||||
<exclude>/mac$</exclude>
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<custom name="vision_implementation" excluded_value="cocoa"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
</target>
|
||||
<target name="curl_dotnet" extends="curl">
|
||||
<setting name="msil_generation" value="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -1,93 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-5-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-5-0 http://www.eiffel.com/developers/xml/configuration-1-5-0.xsd" name="curl" uuid="D51EF190-6157-4B47-8E73-FA93DCBB7A71" library_target="curl">
|
||||
<target name="curl">
|
||||
<description>cURL: libcURL wrapper library for Eiffel.
|
||||
Copyright (c) 1984-2006, Eiffel Software and others.
|
||||
Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt).</description>
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/\.svn$</exclude>
|
||||
<exclude>/EIFGEN.{0,1}$</exclude>
|
||||
<exclude>/temp$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" namespace="EiffelSoftware.Library">
|
||||
</option>
|
||||
<setting name="dotnet_naming_convention" value="true"/>
|
||||
<external_include location="$(ISE_LIBRARY)\library\cURL\spec\include">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_include location="$(ISE_LIBRARY)/library/cURL/spec/include">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_object location="$(ISE_LIBRARY)/library/cURL/spec/$(ISE_PLATFORM)/lib/eiffel_curl.o">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<multithreaded value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ISE_LIBRARY)/library/cURL/spec/$(ISE_PLATFORM)/lib/MTeiffel_curl.o">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<multithreaded value="true"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ISE_LIBRARY)\library\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\eiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<multithreaded value="false"/>
|
||||
<dotnet value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ISE_LIBRARY)\library\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\mteiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<multithreaded value="true"/>
|
||||
<dotnet value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ISE_LIBRARY)\library\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\ileiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<dotnet value="true"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<library name="api_wrapper" location="$ISE_LIBRARY\library\api_wrapper\api_wrapper.ecf"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<cluster name="curl" location=".\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/spec$</exclude>
|
||||
<exclude>/Clib$</exclude>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/gtk$</exclude>
|
||||
<exclude>/mac$</exclude>
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/mswin$</exclude>
|
||||
<exclude>/gtk$</exclude>
|
||||
<condition>
|
||||
<platform value="macintosh"/>
|
||||
<custom name="vision_implementation" value="cocoa"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/mswin$</exclude>
|
||||
<exclude>/mac$</exclude>
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<custom name="vision_implementation" excluded_value="cocoa"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
</target>
|
||||
<target name="curl_dotnet" extends="curl">
|
||||
<setting name="msil_generation" value="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -1,336 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
All possible error codes from all sorts of curl functions.
|
||||
Future versions may return other values, stay prepared.
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_CODES
|
||||
|
||||
feature -- Eiffel cURL: Constants
|
||||
|
||||
eiffelcurle_error_occurred: INTEGER = -1
|
||||
-- Error occurred in Eiffel cURL internals
|
||||
|
||||
feature -- Constants
|
||||
|
||||
curle_ok: INTEGER = 0
|
||||
-- Declared as CURLE_OK
|
||||
|
||||
curle_unsupported_protocol: INTEGER = 1
|
||||
-- Declared as CURLE_UNSUPPORTED_PROTOCOL
|
||||
|
||||
curle_failed_init: INTEGER = 2
|
||||
-- Declared as CURLE_FAILED_INIT
|
||||
|
||||
curle_url_malformat: INTEGER = 3
|
||||
-- Declared as CURLE_URL_MALFORMAT
|
||||
|
||||
curle_obsolete4: INTEGER = 4
|
||||
-- Declared as CURLE_OBSOLETE4
|
||||
-- NOT USED
|
||||
|
||||
curle_couldnt_resolve_proxy: INTEGER = 5
|
||||
-- Declared as CURLE_COULDNT_RESOLVE_PROXY
|
||||
|
||||
curle_couldnt_resolve_host: INTEGER = 6
|
||||
-- Declared as CURLE_COULDNT_RESOLVE_HOST
|
||||
|
||||
curle_couldnt_connect: INTEGER = 7
|
||||
-- Declared as CURLE_COULDNT_CONNECT
|
||||
|
||||
curle_ftp_weird_server_reply: INTEGER = 8
|
||||
-- Declared as CURLE_FTP_WEIRD_SERVER_REPLY
|
||||
|
||||
curle_remote_access_denied: INTEGER = 9
|
||||
-- Declared as CURLE_REMOTE_ACCESS_DENIED
|
||||
-- A service was denied by the server due to lack of access
|
||||
-- when login fails this is not returned.
|
||||
|
||||
curle_obsolete10: INTEGER = 10
|
||||
-- Declared as CURLE_OBSOLETE10 NOT USED
|
||||
|
||||
curle_ftp_weird_pass_reply: INTEGER = 11
|
||||
-- Declared as CURLE_FTP_WEIRD_PASS_REPLY
|
||||
|
||||
curle_obsolete12: INTEGER = 12
|
||||
-- Declared as CURLE_OBSOLETE12 NOT USED
|
||||
|
||||
curle_ftp_weird_pasv_reply: INTEGER = 13
|
||||
-- Declared as CURLE_FTP_WEIRD_PASV_REPLY
|
||||
|
||||
curle_ftp_weird_227_format: INTEGER = 14
|
||||
-- Declared as CURLE_FTP_WEIRD_227_FORMAT
|
||||
|
||||
curle_ftp_cant_get_host: INTEGER = 15
|
||||
-- Declared as CURLE_FTP_CANT_GET_HOST
|
||||
|
||||
curle_obsolete16: INTEGER = 16
|
||||
-- Declared as CURLE_OBSOLETE16
|
||||
-- NOT USED
|
||||
|
||||
curle_ftp_couldnt_set_type: INTEGER = 17
|
||||
-- Declared as CURLE_FTP_COULDNT_SET_TYPE
|
||||
|
||||
curle_partial_file: INTEGER = 18
|
||||
-- Declared as CURLE_PARTIAL_FILE
|
||||
|
||||
curle_ftp_couldnt_retr_file: INTEGER = 19
|
||||
-- Declared as CURLE_FTP_COULDNT_RETR_FILE
|
||||
|
||||
curle_obsolete20: INTEGER = 20
|
||||
-- Declared as CURLE_OBSOLETE20
|
||||
-- NOT USED
|
||||
|
||||
curle_quote_error: INTEGER = 21
|
||||
-- Declared as CURLE_QUOTE_ERROR
|
||||
-- quote command failure
|
||||
|
||||
curle_http_returned_error: INTEGER = 22
|
||||
-- Declared as CURLE_HTTP_RETURNED_ERROR
|
||||
|
||||
curle_write_error: INTEGER = 23
|
||||
-- Declared as CURLE_WRITE_ERROR
|
||||
|
||||
curle_obsolete24: INTEGER = 24
|
||||
-- Declared as CURLE_OBSOLETE24 NOT USED
|
||||
|
||||
curle_upload_failed: INTEGER = 25
|
||||
-- Declared as CURLE_UPLOAD_FAILED
|
||||
-- failed upload "command"
|
||||
|
||||
curle_read_error: INTEGER = 26
|
||||
-- Declared as CURLE_READ_ERROR
|
||||
-- couldn't open/read from file
|
||||
|
||||
curle_out_of_memory: INTEGER = 27
|
||||
-- Declared as CURLE_OUT_OF_MEMORY
|
||||
-- Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error
|
||||
-- instead of a memory allocation error if CURL_DOES_CONVERSIONS
|
||||
-- is defined
|
||||
|
||||
curle_operation_timedout: INTEGER = 28
|
||||
-- Declared as CURLE_OPERATION_TIMEDOUT
|
||||
-- the timeout time was reached
|
||||
|
||||
curle_obsolete29: INTEGER = 29
|
||||
-- Declared as CURLE_OBSOLETE29
|
||||
-- NOT USED
|
||||
|
||||
curle_ftp_port_failed: INTEGER = 30
|
||||
-- Declared as CURLE_FTP_PORT_FAILED
|
||||
-- FTP PORT operation failed
|
||||
|
||||
curle_ftp_couldnt_use_rest: INTEGER = 31
|
||||
-- Declared as CURLE_FTP_COULDNT_USE_REST
|
||||
-- the REST command failed
|
||||
|
||||
curle_obsolete32: INTEGER = 32
|
||||
-- Declared as CURLE_OBSOLETE32
|
||||
-- NOT USED
|
||||
|
||||
curle_range_error: INTEGER = 33
|
||||
-- Declared as CURLE_RANGE_ERROR
|
||||
-- RANGE "command" didn't work
|
||||
|
||||
curle_http_post_error: INTEGER = 34
|
||||
-- Declared as CURLE_HTTP_POST_ERROR
|
||||
|
||||
curle_ssl_connect_error: INTEGER = 35
|
||||
-- Declared CURLE_SSL_CONNECT_ERROR
|
||||
-- wrong when connecting with SSL
|
||||
|
||||
curle_bad_download_resume: INTEGER = 36
|
||||
-- Declared as CURLE_BAD_DOWNLOAD_RESUME
|
||||
-- couldn't resume download
|
||||
|
||||
curle_file_couldnt_read_file: INTEGER = 37
|
||||
-- Declared as CURLE_FILE_COULDNT_READ_FILE
|
||||
|
||||
curle_ldap_cannot_bind: INTEGER = 38
|
||||
-- Declared as CURLE_LDAP_CANNOT_BIND
|
||||
|
||||
curle_ldap_search_failed: INTEGER = 39
|
||||
-- Declared as CURLE_LDAP_SEARCH_FAILED
|
||||
|
||||
curle_obsolete40: INTEGER = 40
|
||||
-- Declared as CURLE_OBSOLETE40
|
||||
-- NOT USED
|
||||
|
||||
curle_function_not_found: INTEGER = 41
|
||||
-- Declared as CURLE_FUNCTION_NOT_FOUND
|
||||
|
||||
curle_aborted_by_callback: INTEGER = 42
|
||||
-- Declared as CURLE_ABORTED_BY_CALLBACK
|
||||
|
||||
curle_bad_function_argument: INTEGER = 43
|
||||
-- Declared as CURLE_BAD_FUNCTION_ARGUMENT
|
||||
|
||||
curle_obsolete44: INTEGER = 44
|
||||
-- Declared as CURLE_OBSOLETE44
|
||||
-- NOT USED
|
||||
|
||||
curle_interface_failed: INTEGER = 45
|
||||
-- Declared as CURLE_INTERFACE_FAILED
|
||||
-- CURLOPT_INTERFACE failed
|
||||
|
||||
curle_obsolete46: INTEGER = 46
|
||||
-- Declared as CURLE_OBSOLETE46
|
||||
-- NOT USED
|
||||
|
||||
curle_too_many_redirects: INTEGER = 47
|
||||
-- Declared as CURLE_TOO_MANY_REDIRECTS
|
||||
-- catch endless re-direct loops
|
||||
|
||||
curle_unknown_telnet_option: INTEGER = 48
|
||||
-- Declared as CURLE_UNKNOWN_TELNET_OPTION
|
||||
-- User specified an unknown option
|
||||
|
||||
curle_telnet_option_syntax: INTEGER = 49
|
||||
-- Declared as CURLE_TELNET_OPTION_SYNTAX
|
||||
-- Malformed telnet option
|
||||
|
||||
curle_obsolete50: INTEGER = 50
|
||||
-- Declared as CURLE_OBSOLETE50
|
||||
-- NOT USED
|
||||
|
||||
curle_ssl_peer_certificate: INTEGER = 51
|
||||
-- Declared as CURLE_SSL_PEER_CERTIFICATE
|
||||
-- peer's certificate wasn't ok
|
||||
|
||||
curle_got_nothing: INTEGER = 52
|
||||
-- Declared as CURLE_GOT_NOTHING
|
||||
-- when this is a specific error
|
||||
|
||||
curle_ssl_engine_notfound: INTEGER = 53
|
||||
-- Declared as CURLE_SSL_ENGINE_NOTFOUND
|
||||
-- SSL crypto engine not found */
|
||||
|
||||
curle_ssl_engine_setfailed: INTEGER = 54
|
||||
-- Declared as CURLE_SSL_ENGINE_SETFAILED
|
||||
-- can not set SSL crypto engine as default
|
||||
|
||||
curle_send_error: INTEGER = 55
|
||||
-- Declared as CURLE_SEND_ERROR
|
||||
-- failed sending network data
|
||||
|
||||
curle_recv_error: INTEGER = 56
|
||||
-- Declared as CURLE_RECV_ERROR
|
||||
-- failure in receiving network data
|
||||
|
||||
curle_obsolete57: INTEGER = 57
|
||||
-- Declared as CURLE_OBSOLETE57
|
||||
-- NOT IN USE
|
||||
|
||||
curle_ssl_certproblem: INTEGER = 58
|
||||
-- Declared as CURLE_SSL_CERTPROBLEM
|
||||
-- problem with the local certificate
|
||||
|
||||
curle_ssl_cipher: INTEGER = 59
|
||||
-- Declared as CURLE_SSL_CIPHER
|
||||
-- couldn't use specified cipher
|
||||
|
||||
curle_ssl_cacert: INTEGER = 60
|
||||
-- Declared as CURLE_SSL_CACERT
|
||||
-- problem with the CA cert (path?)
|
||||
|
||||
curle_bad_content_encoding: INTEGER = 61
|
||||
-- Declared as CURLE_BAD_CONTENT_ENCODING
|
||||
-- Unrecognized transfer encoding
|
||||
|
||||
curle_ldap_invalid_url: INTEGER = 62
|
||||
-- Declared as CURLE_LDAP_INVALID_URL
|
||||
-- Invalid LDAP URL
|
||||
|
||||
curle_filesize_exceeded: INTEGER = 63
|
||||
-- Declared as CURLE_FILESIZE_EXCEEDED
|
||||
-- Maximum file size exceeded
|
||||
|
||||
curle_use_ssl_failed: INTEGER = 64
|
||||
-- Declared as CURLE_USE_SSL_FAILED
|
||||
-- Requested FTP SSL level failed
|
||||
|
||||
curle_send_fail_rewind: INTEGER = 65
|
||||
-- Declared as CURLE_SEND_FAIL_REWIND
|
||||
-- Sending the data requires a rewind that failed
|
||||
|
||||
curle_ssl_engine_initfailed: INTEGER = 66
|
||||
-- Declared as CURLE_SSL_ENGINE_INITFAILED
|
||||
-- failed to initialise ENGINE
|
||||
|
||||
curle_login_denied: INTEGER = 67
|
||||
-- Declared as CURLE_LOGIN_DENIED
|
||||
-- user, password or similar was not accepted and we failed to login
|
||||
|
||||
curle_tftp_notfound: INTEGER = 68
|
||||
-- Declared as CURLE_TFTP_NOTFOUND
|
||||
-- file not found on server
|
||||
|
||||
curle_tftp_perm: INTEGER = 69
|
||||
-- Declared as CURLE_TFTP_PERM
|
||||
-- permission problem on server
|
||||
|
||||
curle_remote_disk_full: INTEGER = 70
|
||||
-- Declared as CURLE_REMOTE_DISK_FULL
|
||||
-- out of disk space on server
|
||||
|
||||
curle_tftp_illegal: INTEGER = 71
|
||||
-- Declared as CURLE_TFTP_ILLEGAL
|
||||
-- Illegal TFTP operation
|
||||
|
||||
curle_tftp_unknownid: INTEGER = 72
|
||||
-- Declared as CURLE_TFTP_UNKNOWNID
|
||||
-- Unknown transfer ID
|
||||
|
||||
curle_remote_file_exists: INTEGER = 73
|
||||
-- Declared as CURLE_REMOTE_FILE_EXISTS
|
||||
-- File already exists
|
||||
|
||||
curle_tftp_nosuchuser: INTEGER = 74
|
||||
-- Declared as CURLE_TFTP_NOSUCHUSER
|
||||
-- No such user
|
||||
|
||||
curle_conv_failed: INTEGER = 75
|
||||
-- Declared as CURLE_CONV_FAILED
|
||||
-- conversion failed
|
||||
|
||||
curle_conv_reqd: INTEGER = 76
|
||||
-- Declared as CURLE_CONV_REQD
|
||||
-- caller must register conversion callbacks using curl_easy_setopt options
|
||||
-- CURLOPT_CONV_FROM_NETWORK_FUNCTION, CURLOPT_CONV_TO_NETWORK_FUNCTION, and
|
||||
-- CURLOPT_CONV_FROM_UTF8_FUNCTION
|
||||
|
||||
curle_ssl_cacert_badfile: INTEGER = 77
|
||||
-- Declared as CURLE_SSL_CACERT_BADFILE
|
||||
-- could not load CACERT file, missing or wrong format
|
||||
|
||||
curle_remote_file_not_found: INTEGER = 78
|
||||
-- Declared as CURLE_REMOTE_FILE_NOT_FOUND
|
||||
-- remote file not found
|
||||
|
||||
curle_ssh: INTEGER = 79
|
||||
-- Declared as CURLE_SSH
|
||||
-- error from the SSH layer, somewhat generic so the error message will be of
|
||||
-- interest when this has happened
|
||||
|
||||
curle_ssl_shutdown_failed: INTEGER = 80;
|
||||
-- Declared as CURLE_SSL_SHUTDOWN_FAILED
|
||||
-- Failed to shut down the SSL connection
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
356 Storke Road, Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1,104 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
Default implementation of CURL_FUNCTION.
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_DEFAULT_FUNCTION
|
||||
|
||||
inherit
|
||||
CURL_FUNCTION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Creation method
|
||||
do
|
||||
set_object_and_function_address
|
||||
end
|
||||
|
||||
feature -- Command
|
||||
|
||||
progress_function (a_object_id: POINTER; a_download_total, a_download_now, a_upload_total, a_upload_now: REAL_64): INTEGER
|
||||
do
|
||||
end
|
||||
|
||||
write_function (a_data_pointer: POINTER; a_size, a_nmemb: INTEGER; a_object_id: POINTER): INTEGER
|
||||
local
|
||||
l_c_string: C_STRING
|
||||
do
|
||||
-- Returns the number of bytes actually saved into object identified by `a_object_id'
|
||||
Result := a_size * a_nmemb
|
||||
create l_c_string.make_shared_from_pointer_and_count (a_data_pointer, Result)
|
||||
|
||||
check attached {CURL_STRING} (create {IDENTIFIED}).id_object (a_object_id.to_integer_32) as l_string then
|
||||
l_string.append (l_c_string.substring (1, Result))
|
||||
end
|
||||
end
|
||||
|
||||
read_function (a_data_pointer: POINTER; a_size, a_nmemb: INTEGER; a_object_id: POINTER): INTEGER
|
||||
-- A callback readfunction
|
||||
do
|
||||
end
|
||||
|
||||
debug_function (a_curl_handle: POINTER; a_curl_infotype: INTEGER; a_char_pointer: POINTER; a_size: INTEGER; a_object_id: POINTER): INTEGER
|
||||
local
|
||||
l_c_string: C_STRING
|
||||
do
|
||||
inspect
|
||||
a_curl_infotype
|
||||
when {CURL_INFO_TYPE}.curlinfo_data_in then
|
||||
dump ("<= Recv data", a_char_pointer, a_size)
|
||||
when {CURL_INFO_TYPE}.curlinfo_data_out then
|
||||
dump ("=> Send data", a_char_pointer, a_size)
|
||||
when {CURL_INFO_TYPE}.curlinfo_header_in then
|
||||
dump ("<= Recv header", a_char_pointer, a_size)
|
||||
when {CURL_INFO_TYPE}.curlinfo_header_out then
|
||||
dump ("=> Send header", a_char_pointer, a_size)
|
||||
when {CURL_INFO_TYPE}.curlinfo_ssl_data_in then
|
||||
dump ("<= Recv SSL data", a_char_pointer, a_size)
|
||||
when {CURL_INFO_TYPE}.curlinfo_ssl_data_out then
|
||||
dump ("=> Send SSL data", a_char_pointer, a_size)
|
||||
when {CURL_INFO_TYPE}.curlinfo_text then
|
||||
create l_c_string.make_by_pointer_and_count (a_char_pointer, a_size)
|
||||
print ("%N== Info: " + l_c_string.string)
|
||||
else
|
||||
check type_unknow: False end
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
dump (a_text: STRING; a_char_pointer: POINTER; a_size: INTEGER)
|
||||
-- Dump debug information
|
||||
require
|
||||
not_void: a_text /= Void
|
||||
exists: a_char_pointer /= default_pointer
|
||||
non_negative: a_size >= 0
|
||||
local
|
||||
l_c_string: C_STRING
|
||||
do
|
||||
create l_c_string.make_shared_from_pointer_and_count (a_char_pointer, a_size)
|
||||
print ("%N" + a_text + "%N" + l_c_string.string)
|
||||
end
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1,409 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
cURL easy externals.
|
||||
For more informaton see:
|
||||
http://curl.haxx.se/libcurl/c/
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_EASY_EXTERNALS
|
||||
|
||||
feature -- Command
|
||||
|
||||
init: POINTER
|
||||
-- Declared as curl_easy_init().
|
||||
require
|
||||
dynamic_library_exists: is_dynamic_library_exists
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_easy_init")
|
||||
if l_api /= default_pointer then
|
||||
Result := c_init (l_api)
|
||||
end
|
||||
ensure
|
||||
exists: Result /= default_pointer
|
||||
end
|
||||
|
||||
setopt_string (a_curl_handle: POINTER; a_opt: INTEGER; a_string: READABLE_STRING_GENERAL)
|
||||
-- Declared as curl_easy_setopt().
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
|
||||
not_void: a_string /= Void
|
||||
local
|
||||
l_api: POINTER
|
||||
l_c_str: C_STRING
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||
if l_api /= default_pointer then
|
||||
create l_c_str.make (a_string)
|
||||
c_setopt (l_api, a_curl_handle, a_opt, l_c_str.item)
|
||||
end
|
||||
end
|
||||
|
||||
setopt_form (a_curl_handle: POINTER; a_opt: INTEGER; a_form: CURL_FORM)
|
||||
-- Declared as curl_easy_setopt().
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
|
||||
not_void: a_form /= Void and then a_form.is_exists
|
||||
do
|
||||
setopt_void_star (a_curl_handle, a_opt, a_form.item)
|
||||
end
|
||||
|
||||
setopt_slist (a_curl_handle: POINTER; a_opt: INTEGER; a_curl_slist: POINTER)
|
||||
-- Declared as curl_easy_setopt().
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
valid: a_opt = {CURL_OPT_CONSTANTS}.curlopt_httpheader
|
||||
exists: a_curl_slist /= default_pointer
|
||||
do
|
||||
setopt_void_star (a_curl_handle, a_opt, a_curl_slist)
|
||||
end
|
||||
|
||||
setopt_curl_string (a_curl_handle: POINTER; a_opt: INTEGER; a_curl_string: CURL_STRING)
|
||||
-- Declared as curl_easy_setopt().
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
|
||||
not_void: a_curl_string /= Void
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||
if l_api /= default_pointer then
|
||||
c_setopt_int (l_api, a_curl_handle, a_opt, a_curl_string.object_id)
|
||||
end
|
||||
end
|
||||
|
||||
setopt_integer (a_curl_handle: POINTER; a_opt: INTEGER; a_integer: INTEGER)
|
||||
-- Declared as curl_easy_setopt().
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||
if l_api /= default_pointer then
|
||||
c_setopt_int (l_api, a_curl_handle, a_opt, a_integer)
|
||||
end
|
||||
end
|
||||
|
||||
setopt_file (a_curl_handle: POINTER; a_opt: INTEGER; a_file: FILE)
|
||||
-- Declared as curl_easy_setopt().
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
valid: a_opt = {CURL_OPT_CONSTANTS}.curlopt_readdata
|
||||
readable: a_file /= Void and then a_file.file_readable
|
||||
do
|
||||
setopt_void_star (a_curl_handle, a_opt, a_file.file_pointer)
|
||||
end
|
||||
|
||||
perform (a_curl_handle: POINTER): INTEGER
|
||||
-- Declared as curl_easy_perform().
|
||||
-- Result is one value from {CURL_CODES}
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_easy_perform")
|
||||
if l_api /= default_pointer then
|
||||
Result := c_perform (l_api, a_curl_handle)
|
||||
else
|
||||
Result := {CURL_CODES}.eiffelcurle_error_occurred
|
||||
end
|
||||
end
|
||||
|
||||
cleanup (a_curl_handle: POINTER)
|
||||
-- Declared as curl_easy_cleanup().
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_easy_cleanup")
|
||||
if l_api /= default_pointer then
|
||||
c_cleanup (l_api, a_curl_handle)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Query
|
||||
|
||||
getinfo (a_curl_handle: POINTER; a_info: INTEGER; a_data: CELL [detachable ANY]): INTEGER
|
||||
-- `curl_getinfo
|
||||
--|* Request internal information from the curl session with this function. The
|
||||
--|* third argument MUST be a pointer to a long, a pointer to a char * or a
|
||||
--|* pointer to a double (as the documentation describes elsewhere). The data
|
||||
--|* pointed to will be filled in accordingly and can be relied upon only if the
|
||||
--|* function returns CURLE_OK. This function is intended to get used *AFTER* a
|
||||
--|* performed transfer, all results from this function are undefined until the
|
||||
--|* transfer is completed.
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
valid: (create {CURL_INFO_CONSTANTS}).is_valid (a_info)
|
||||
local
|
||||
l_api: POINTER
|
||||
mp: detachable MANAGED_POINTER
|
||||
l: INTEGER
|
||||
cs: C_STRING
|
||||
d: REAL_64
|
||||
do
|
||||
a_data.replace (Void)
|
||||
l_api := api_loader.api_pointer ("curl_easy_getinfo")
|
||||
if l_api /= default_pointer then
|
||||
if a_info & {CURL_INFO_CONSTANTS}.curlinfo_long /= 0 then
|
||||
create mp.make ({PLATFORM}.integer_32_bytes)
|
||||
elseif a_info & {CURL_INFO_CONSTANTS}.curlinfo_string /= 0 then
|
||||
create mp.make ({PLATFORM}.pointer_bytes)
|
||||
elseif a_info & {CURL_INFO_CONSTANTS}.curlinfo_double /= 0 then
|
||||
create mp.make ({PLATFORM}.real_64_bytes)
|
||||
end
|
||||
if mp /= Void then
|
||||
Result := c_getinfo (l_api, a_curl_handle, a_info, mp.item)
|
||||
if Result = {CURL_CODES}.curle_ok then
|
||||
if a_info & {CURL_INFO_CONSTANTS}.curlinfo_long /= 0 then
|
||||
l := mp.read_integer_32 (0)
|
||||
a_data.put (l)
|
||||
elseif a_info & {CURL_INFO_CONSTANTS}.curlinfo_string /= 0 then
|
||||
create cs.make_shared_from_pointer (mp.read_pointer (0))
|
||||
a_data.put (cs.string)
|
||||
elseif a_info & {CURL_INFO_CONSTANTS}.curlinfo_double /= 0 then
|
||||
d := mp.read_real_64 (0)
|
||||
a_data.put (d)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
is_dynamic_library_exists: BOOLEAN
|
||||
-- If dll/so files exist?
|
||||
do
|
||||
Result := api_loader.is_interface_usable
|
||||
end
|
||||
|
||||
feature -- Special setting
|
||||
|
||||
set_curl_function (a_curl_function: CURL_FUNCTION)
|
||||
-- Set `curl_function' with `a_curl_function'
|
||||
do
|
||||
internal_curl_function := a_curl_function
|
||||
ensure
|
||||
set: a_curl_function /= Void implies curl_function = a_curl_function
|
||||
end
|
||||
|
||||
curl_function: CURL_FUNCTION
|
||||
-- cURL functions in curl_easy_setopt.
|
||||
do
|
||||
if attached internal_curl_function as l_curl_function then
|
||||
Result := l_curl_function
|
||||
else
|
||||
create {CURL_DEFAULT_FUNCTION} Result.make
|
||||
internal_curl_function := Result
|
||||
end
|
||||
ensure
|
||||
not_void: Result /= Void
|
||||
end
|
||||
|
||||
set_write_function (a_curl_handle: POINTER)
|
||||
-- Set cURL write function
|
||||
-- Set cURL write function with Eiffel default write function.
|
||||
-- So we can use CURL_STRING as parameter in {CURL_EASY_EXTERNALS}.setopt_curl_string when the option is {CURL_OPT_CONSTANTS}.curlopt_writedata
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||
if l_api /= default_pointer then
|
||||
curl_function.c_set_write_function (l_api, a_curl_handle)
|
||||
end
|
||||
end
|
||||
|
||||
set_read_function (a_curl_handle: POINTER)
|
||||
-- Set cURL read function
|
||||
-- Set cURL read function with Eiffel default read function.
|
||||
-- So we can use a c file pointer as parameter in {CURL_EASY_EXTERNALS}.setopt_file_pointer when the option is {CURL_OPT_CONSTANTS}.curlopt_readdata
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||
if l_api /= default_pointer then
|
||||
curl_function.c_set_read_function (l_api, a_curl_handle)
|
||||
end
|
||||
end
|
||||
|
||||
set_progress_function (a_curl_handle: POINTER)
|
||||
-- Set cURL progress function for upload/download progress.
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||
if l_api /= default_pointer then
|
||||
curl_function.c_set_progress_function (l_api, a_curl_handle)
|
||||
end
|
||||
end
|
||||
|
||||
set_debug_function (a_curl_handle: POINTER)
|
||||
-- Set cURL debug function
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||
if l_api /= default_pointer then
|
||||
curl_function.c_set_debug_function (l_api, a_curl_handle)
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
internal_curl_function: detachable CURL_FUNCTION
|
||||
-- cURL functions.
|
||||
|
||||
api_loader: DYNAMIC_MODULE
|
||||
-- Module name.
|
||||
local
|
||||
l_utility: CURL_UTILITY
|
||||
once
|
||||
create l_utility
|
||||
Result := l_utility.api_loader
|
||||
end
|
||||
|
||||
setopt_void_star (a_curl_handle: POINTER; a_opt: INTEGER; a_data:POINTER)
|
||||
-- Declared as curl_easy_setopt().
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||
if l_api /= default_pointer then
|
||||
c_setopt (l_api, a_curl_handle, a_opt, a_data)
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- C externals
|
||||
|
||||
c_init (a_api: POINTER): POINTER
|
||||
-- Declared curl_easy_init ().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return (FUNCTION_CAST(CURL *, ()) $a_api)();
|
||||
]"
|
||||
end
|
||||
|
||||
c_cleanup (a_api: POINTER; a_curl_handle: POINTER)
|
||||
-- Decalred as curl_easy_cleanup ().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
exists: a_curl_handle /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
(FUNCTION_CAST(void, (CURL *)) $a_api)((CURL *)$a_curl_handle);
|
||||
]"
|
||||
end
|
||||
|
||||
c_perform (a_api: POINTER; a_curl_handle: POINTER): INTEGER
|
||||
-- Declared as curl_easy_perform().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
exists: a_curl_handle /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return (FUNCTION_CAST(CURLcode, (CURL *)) $a_api)
|
||||
((CURL *) $a_curl_handle);
|
||||
]"
|
||||
end
|
||||
|
||||
c_setopt_int (a_api: POINTER; a_curl_handle: POINTER; a_opt: INTEGER; a_data: INTEGER)
|
||||
-- Same as `c_setopt' except we can pass `a_data' as integer.
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
exists: a_curl_handle /= default_pointer
|
||||
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
{
|
||||
(FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_api)
|
||||
((CURL *) $a_curl_handle,
|
||||
(CURLoption)$a_opt,
|
||||
$a_data);
|
||||
}
|
||||
]"
|
||||
end
|
||||
|
||||
c_setopt (a_api: POINTER; a_curl_handle: POINTER; a_opt: INTEGER; a_data: POINTER)
|
||||
-- C implementation of `setopt_void_star'.
|
||||
-- Declared as curl_easy_setopt ().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
exists: a_curl_handle /= default_pointer
|
||||
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
{
|
||||
(FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_api)
|
||||
((CURL *) $a_curl_handle,
|
||||
(CURLoption)$a_opt,
|
||||
$a_data);
|
||||
}
|
||||
]"
|
||||
end
|
||||
|
||||
c_getinfo (a_api: POINTER; a_curl_handle: POINTER; a_opt: INTEGER; a_data: POINTER): INTEGER
|
||||
-- C implementation of `curl_easy_getinfo'.
|
||||
-- Declared as curl_easy_setopt ().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
exists: a_curl_handle /= default_pointer
|
||||
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return (FUNCTION_CAST(CURLcode, (CURL *, CURLINFO info, ...)) $a_api)
|
||||
((CURL *) $a_curl_handle,
|
||||
(CURLINFO)$a_opt,
|
||||
$a_data);
|
||||
]"
|
||||
end
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2010, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1,254 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
cURL externals.
|
||||
For more information, see:
|
||||
http://curl.haxx.se/libcurl/c/
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_EXTERNALS
|
||||
|
||||
feature -- Command
|
||||
|
||||
global_init
|
||||
-- Declared as curl_global_init().
|
||||
require
|
||||
dynamic_library_exists: is_dynamic_library_exists
|
||||
local
|
||||
l_ptr: POINTER
|
||||
do
|
||||
l_ptr := api_loader.api_pointer ("curl_global_init")
|
||||
if l_ptr /= default_pointer then
|
||||
c_curl_global_init (l_ptr, {CURL_GLOBAL_CONSTANTS}.curl_global_all);
|
||||
end
|
||||
end
|
||||
|
||||
global_cleanup
|
||||
-- Declared as curl_global_cleanup().
|
||||
local
|
||||
l_ptr: POINTER
|
||||
do
|
||||
l_ptr := api_loader.api_pointer ("curl_global_cleanup")
|
||||
if l_ptr /= default_pointer then
|
||||
c_curl_global_cleanup (l_ptr);
|
||||
end
|
||||
end
|
||||
|
||||
formadd_string_string (a_form: CURL_FORM; a_last_pointer: CURL_FORM; a_arg_1: INTEGER; a_arg_1_value: READABLE_STRING_GENERAL; a_arg_2: INTEGER; a_arg_2_value: READABLE_STRING_GENERAL; a_arg_3: INTEGER)
|
||||
-- Declared as curl_formadd ().
|
||||
require
|
||||
not_void: a_form /= Void
|
||||
not_void: a_last_pointer /= Void
|
||||
valid: (create {CURL_FORM_CONSTANTS}).is_valid (a_arg_1)
|
||||
not_void: a_arg_1_value /= Void
|
||||
valid: (create {CURL_FORM_CONSTANTS}).is_valid (a_arg_2)
|
||||
not_void: a_arg_2_value /= Void
|
||||
valid: (create {CURL_FORM_CONSTANTS}).is_valid (a_arg_3)
|
||||
local
|
||||
l_form_pointer, l_last_pointer: POINTER
|
||||
do
|
||||
l_form_pointer := a_form.item
|
||||
l_last_pointer := a_last_pointer.item
|
||||
|
||||
internal_formadd_string_string ($l_form_pointer, $l_last_pointer, a_arg_1, a_arg_1_value, a_arg_2, a_arg_2_value, a_arg_3)
|
||||
|
||||
if a_form.item /= l_form_pointer then
|
||||
check not_set: a_form.item = default_pointer end
|
||||
a_form.set_item (l_form_pointer)
|
||||
end
|
||||
if a_last_pointer.item /= l_last_pointer then
|
||||
a_last_pointer.set_item (l_last_pointer)
|
||||
end
|
||||
end
|
||||
|
||||
slist_append (a_list: POINTER; a_string: READABLE_STRING_GENERAL): POINTER
|
||||
-- Declared as curl_slist_append ().
|
||||
-- note: call with a null `a_list' to get initialized pointer as Result
|
||||
require
|
||||
not_void: a_string /= Void
|
||||
local
|
||||
l_c_string: C_STRING
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_slist_append")
|
||||
if l_api /= default_pointer then
|
||||
create l_c_string.make (a_string)
|
||||
Result := c_slist_append (l_api, a_list, l_c_string.item)
|
||||
end
|
||||
end
|
||||
|
||||
slist_free_all (a_curl_slist: POINTER)
|
||||
-- Declared as curl_slist_free_all ().
|
||||
-- See: http://curl.haxx.se/libcurl/c/curl_slist_free_all.html
|
||||
-- curl_slist_free_all - free an entire curl_slist list
|
||||
-- This must be called when the data has been used, which typically means after the curl_easy_perform(3) has been called.
|
||||
require
|
||||
exists: a_curl_slist /= default_pointer
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_slist_free_all")
|
||||
if l_api /= default_pointer then
|
||||
c_slist_free_all (l_api, a_curl_slist)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Query
|
||||
|
||||
is_dynamic_library_exists: BOOLEAN
|
||||
-- If dll/so files exist?
|
||||
do
|
||||
Result := api_loader.is_interface_usable
|
||||
end
|
||||
|
||||
feature {CURL_FORM} -- Internal command
|
||||
|
||||
formfree (a_curl_form: POINTER)
|
||||
-- Declared as curl_formfree ().
|
||||
-- See: http://curl.askapache.com/libcurl/c/curl_formfree.html
|
||||
-- curl_formfree() is used to clean up data previously built/appended with curl_formadd(3).
|
||||
-- This must be called when the data has been used, which typically means after the curl_easy_perform(3) has been called.
|
||||
require
|
||||
exists: a_curl_form /= default_pointer
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_formfree")
|
||||
if l_api /= default_pointer then
|
||||
c_formfree (l_api, a_curl_form)
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
api_loader: DYNAMIC_MODULE
|
||||
-- Module name.
|
||||
local
|
||||
l_utility: CURL_UTILITY
|
||||
once
|
||||
create l_utility
|
||||
Result := l_utility.api_loader
|
||||
end
|
||||
|
||||
internal_formadd_string_string (a_form: TYPED_POINTER [POINTER]; a_last_pointer: TYPED_POINTER [POINTER]; a_arg_1: INTEGER; a_arg_1_value: READABLE_STRING_GENERAL; a_arg_2: INTEGER; a_arg_2_value: READABLE_STRING_GENERAL; a_arg_3: INTEGER)
|
||||
-- Declared as curl_formadd ().
|
||||
local
|
||||
l_c_string_1, l_c_string_2: C_STRING
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_formadd");
|
||||
if l_api /= default_pointer then
|
||||
create l_c_string_1.make (a_arg_1_value)
|
||||
create l_c_string_2.make (a_arg_2_value)
|
||||
c_formadd_string_string (l_api, a_form, a_last_pointer, a_arg_1, l_c_string_1.item, a_arg_2, l_c_string_2.item, a_arg_3)
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- C externals
|
||||
|
||||
c_formadd_string_string (a_api: POINTER; a_form: TYPED_POINTER [POINTER]; a_last_pointer: TYPED_POINTER [POINTER]; a_arg_1: INTEGER; a_arg_1_value: POINTER; a_arg_2: INTEGER; a_arg_2_value: POINTER; a_arg_3: INTEGER)
|
||||
-- C implementation of formadd_string_string ().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
{
|
||||
(FUNCTION_CAST(void, (struct curl_httppost **, struct curl_httppost **, int, char *, int, char *, int)) $a_api)
|
||||
((struct curl_httppost **)$a_form,
|
||||
(struct curl_httppost **)$a_last_pointer,
|
||||
(int)$a_arg_1,
|
||||
(char *)$a_arg_1_value,
|
||||
(int)$a_arg_2,
|
||||
(char *)$a_arg_2_value,
|
||||
(int)$a_arg_3);
|
||||
}
|
||||
]"
|
||||
end
|
||||
|
||||
c_formfree (a_api: POINTER; a_curl_form: POINTER)
|
||||
-- Declared as curl_formfree ().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
exists: a_curl_form /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
(FUNCTION_CAST(void, (struct curl_httppost *)) $a_api)
|
||||
((struct curl_httppost *) $a_curl_form);
|
||||
]"
|
||||
end
|
||||
|
||||
c_curl_global_init (a_api: POINTER; a_opt: NATURAL_64)
|
||||
-- `a_api' point to API curl_global_init ()
|
||||
-- `a_opt' is intialization option.
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
(FUNCTION_CAST(void, (long)) $a_api)((long) $a_opt);
|
||||
]"
|
||||
end
|
||||
|
||||
c_curl_global_cleanup (a_api: POINTER)
|
||||
-- `a_api' point to API curl_global_cleanup()
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
(FUNCTION_CAST(void, ()) $a_api)();
|
||||
]"
|
||||
end
|
||||
|
||||
c_slist_append (a_api: POINTER; a_list_pointer: POINTER; a_string: POINTER): POINTER
|
||||
-- Declared as curl_slist_append ().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
{
|
||||
return (FUNCTION_CAST(void *, (struct curl_slist *, const char *)) $a_api)
|
||||
((struct curl_slist *)$a_list_pointer,
|
||||
(const char *)$a_string);
|
||||
}
|
||||
]"
|
||||
end
|
||||
|
||||
c_slist_free_all (a_api: POINTER; a_list_pointer: POINTER)
|
||||
-- Declared as void curl_slist_free_all(struct curl_slist * list)
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
(FUNCTION_CAST(void *, (struct curl_slist *)) $a_api)
|
||||
((struct curl_slist *)$a_list_pointer);
|
||||
]"
|
||||
end
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2010, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1,94 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
cURL form.
|
||||
For more informaton see:
|
||||
http://curl.haxx.se/libcurl/c/curl_formadd.html
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_FORM
|
||||
|
||||
inherit
|
||||
DISPOSABLE
|
||||
|
||||
create
|
||||
make,
|
||||
share_with_pointer
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Creation method.
|
||||
do
|
||||
end
|
||||
|
||||
share_with_pointer (a_pointer: POINTER)
|
||||
-- Creation method.
|
||||
-- `item' share with `a_pointer'.
|
||||
require
|
||||
exists: a_pointer /= default_pointer
|
||||
do
|
||||
item := a_pointer
|
||||
ensure
|
||||
set: item = a_pointer
|
||||
end
|
||||
|
||||
feature -- Query
|
||||
|
||||
item: POINTER
|
||||
-- C pointer of Current.
|
||||
|
||||
is_exists: BOOLEAN
|
||||
-- If C pointer exists?
|
||||
do
|
||||
Result := item /= default_pointer
|
||||
end
|
||||
|
||||
feature -- Command
|
||||
|
||||
dispose
|
||||
-- Free memory if possible.
|
||||
local
|
||||
l_curl: CURL_EXTERNALS
|
||||
do
|
||||
if item /= default_pointer then
|
||||
create l_curl
|
||||
l_curl.formfree (item)
|
||||
item := default_pointer
|
||||
end
|
||||
end
|
||||
|
||||
release_item
|
||||
-- Release item
|
||||
-- NOT free memory! This is useful if Current generated by {CURL_EXTERNALS}.formadd_string_string.
|
||||
do
|
||||
item := default_pointer
|
||||
end
|
||||
|
||||
feature {CURL_EXTERNALS} -- Internal command
|
||||
|
||||
set_item (a_item: POINTER)
|
||||
-- Set `item' with `a_item'
|
||||
do
|
||||
item := a_item
|
||||
ensure
|
||||
set: item = a_item
|
||||
end
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
356 Storke Road, Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1,78 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
cURL form constants.
|
||||
For more informaton see:
|
||||
http://curl.haxx.se/libcurl/c/curl_formadd.html
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_FORM_CONSTANTS
|
||||
|
||||
feature -- Query
|
||||
|
||||
curlform_copyname: INTEGER
|
||||
-- Declared as CURLFORM_COPYNAME
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
CURLFORM_COPYNAME
|
||||
]"
|
||||
end
|
||||
|
||||
curlform_copycontents: INTEGER
|
||||
-- Declared as CURLFORM_COPYCONTENTS
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
CURLFORM_COPYCONTENTS
|
||||
]"
|
||||
end
|
||||
|
||||
curlform_end: INTEGER
|
||||
-- Declared as CURLFORM_END
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
CURLFORM_END
|
||||
]"
|
||||
end
|
||||
|
||||
curlform_file: INTEGER
|
||||
-- Declared as CURLFORM_FILE
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
CURLFORM_FILE
|
||||
]"
|
||||
end
|
||||
|
||||
is_valid (a_integer: INTEGER): BOOLEAN
|
||||
-- If `a_integer' valid?
|
||||
do
|
||||
Result := a_integer = curlform_copycontents or
|
||||
a_integer = curlform_copyname or
|
||||
a_integer = curlform_end or
|
||||
a_integer = curlform_file
|
||||
end
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
356 Storke Road, Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1,257 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
cURL curl_easy_setopt callback functions' Eiffel wrappers.
|
||||
We need this class since cURL need a c function pointer as value but
|
||||
Eiffel function need frist parameter of any funciton call is object address.
|
||||
Client programmers can inherit this class to fit their needs.
|
||||
|
||||
Note: descendants of this class have to call `set_object_and_function_address',
|
||||
otherwise cURL would not know how to call Eiffel features (such as `write_function').
|
||||
See example: $ISE_LIBRARY\examples\cURL\upload_and_read_function
|
||||
|
||||
See http://curl.haxx.se/libcurl/c/curl_easy_setopt.html for libcurl documentation
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CURL_FUNCTION
|
||||
|
||||
inherit
|
||||
DISPOSABLE
|
||||
|
||||
feature -- Interactive with C
|
||||
|
||||
set_object_and_function_address
|
||||
-- Set object and function addresses.
|
||||
-- Call this feature before call `c_set_progress_function', `c_set_debug_function' and `c_set_write_function, c_set_read_function'.
|
||||
do
|
||||
c_set_object ($Current)
|
||||
c_set_progress_function_address ($progress_function)
|
||||
c_set_write_function_address ($write_function)
|
||||
c_set_read_function_address ($read_function)
|
||||
c_set_debug_function_address ($debug_function)
|
||||
end
|
||||
|
||||
c_set_progress_function (a_setopt_api: POINTER; a_curl_handle: POINTER)
|
||||
-- Setting CURLOPT_PROGRESSFUNCTION option of `a_curl_handle'.
|
||||
-- We need this function since cURL need a c function pointer as value.
|
||||
require
|
||||
exists: a_setopt_api /= default_pointer
|
||||
external
|
||||
"C inline use <eiffel_curl.h>"
|
||||
alias
|
||||
"[
|
||||
{
|
||||
(FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_setopt_api)
|
||||
((CURL *) $a_curl_handle,
|
||||
(CURLoption)CURLOPT_PROGRESSFUNCTION,
|
||||
curl_progress_function);
|
||||
}
|
||||
]"
|
||||
end
|
||||
|
||||
c_set_debug_function (a_setopt_api: POINTER; a_curl_handle: POINTER)
|
||||
-- Setting CURLOPT_DEBUGFUNCTION option of `a_curl_handle'.
|
||||
-- We need this function since cURL need a c function pointer as value.
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
external
|
||||
"C inline use <eiffel_curl.h>"
|
||||
alias
|
||||
"[
|
||||
{
|
||||
(FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_setopt_api)
|
||||
((CURL *) $a_curl_handle,
|
||||
(CURLoption)CURLOPT_DEBUGFUNCTION,
|
||||
curl_debug_function);
|
||||
|
||||
}
|
||||
]"
|
||||
end
|
||||
|
||||
c_set_write_function (a_setopt_api: POINTER; a_curl_handle: POINTER)
|
||||
-- Setting CURLOPT_WRITEFUNCTION option of `a_curl_handle'.
|
||||
-- We need this function since cURL need a c function pointer as value.
|
||||
require
|
||||
exists: a_setopt_api /= default_pointer
|
||||
external
|
||||
"C inline use <eiffel_curl.h>"
|
||||
alias
|
||||
"[
|
||||
{
|
||||
(FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_setopt_api)
|
||||
((CURL *) $a_curl_handle,
|
||||
(CURLoption)CURLOPT_WRITEFUNCTION,
|
||||
curl_write_function);
|
||||
}
|
||||
]"
|
||||
end
|
||||
|
||||
c_set_read_function (a_setopt_api: POINTER; a_curl_handle: POINTER)
|
||||
-- Setting CURLOPT_READFUNCTION option of `a_curl_handle'.
|
||||
-- We need this function since cURL need a c function pointer as value.
|
||||
require
|
||||
exists: a_setopt_api /= default_pointer
|
||||
external
|
||||
"C inline use <eiffel_curl.h>"
|
||||
alias
|
||||
"[
|
||||
{
|
||||
(FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_setopt_api)
|
||||
((CURL *) $a_curl_handle,
|
||||
(CURLoption)CURLOPT_READFUNCTION,
|
||||
curl_read_function);
|
||||
}
|
||||
]"
|
||||
end
|
||||
|
||||
feature -- cURL curl_easy_setopt functions
|
||||
|
||||
progress_function (a_object_id: POINTER; a_download_total, a_download_now, a_upload_total, a_upload_now: REAL_64): INTEGER
|
||||
-- Function correspond to {CURL_OPT_CONSTANTS}.curlopt_progressfunction
|
||||
-- Note, pass a {IDENTIFIED}.object_id as `a_object_id' value is helpful since we can't directly pass an Eiffel Object address which
|
||||
-- may changed during GC.
|
||||
deferred
|
||||
end
|
||||
|
||||
write_function (a_data_pointer: POINTER; a_size, a_nmemb: INTEGER; a_object_id: POINTER): INTEGER
|
||||
-- Function called by libcurl as soon as there is data received that needs to be saved.
|
||||
-- The size of the data pointed to by `a_data_pointer' is `a_size' multiplied with `a_nmemb', it will not be null terminated.
|
||||
-- Returns the number of bytes actually taken care of
|
||||
--
|
||||
-- Function corresponds to {CURL_OPT_CONSTANTS}.curlopt_writefunction
|
||||
-- Note, pass a {IDENTIFIED}.object_id as `a_object_id' value is helpful since we can't directly pass an Eiffel Object address which
|
||||
-- may changed during GC.
|
||||
--| libcurl doc:
|
||||
--| Function pointer that should match the following prototype: size_t function( char *ptr, size_t size, size_t nmemb, void *userdata);
|
||||
--| This function gets called by libcurl as soon as there is data received that needs to be saved.
|
||||
--| The size of the data pointed to by ptr is size multiplied with nmemb, it will not be zero terminated.
|
||||
--| Return the number of bytes actually taken care of.
|
||||
--| If that amount differs from the amount passed to your function, it'll signal an error to the library.
|
||||
--| This will abort the transfer and return CURLE_WRITE_ERROR.
|
||||
--| From 7.18.0, the function can return CURL_WRITEFUNC_PAUSE which then will cause writing to this connection to become paused.
|
||||
--| See curl_easy_pause(3) for further details.
|
||||
--|
|
||||
--| This function may be called with zero bytes data if the transferred file is empty.
|
||||
--|
|
||||
--| Set this option to NULL to get the internal default function.
|
||||
--| The internal default function will write the data to the FILE * given with CURLOPT_WRITEDATA.
|
||||
--|
|
||||
--| Set the userdata argument with the CURLOPT_WRITEDATA option.
|
||||
--|
|
||||
--| The callback function will be passed as much data as possible in all invokes,
|
||||
--| but you cannot possibly make any assumptions. It may be one byte, it may be thousands.
|
||||
--| The maximum amount of body data that can be passed to the write callback is defined
|
||||
--| in the curl.h header file: CURL_MAX_WRITE_SIZE (the usual default is 16K).
|
||||
--| If you however have CURLOPT_HEADER set, which sends header data to the write callback,
|
||||
--| you can get up to CURL_MAX_HTTP_HEADER bytes of header data passed into it. This usually means 100K.
|
||||
deferred
|
||||
end
|
||||
|
||||
read_function (a_data_pointer: POINTER; a_size, a_nmemb: INTEGER; a_object_id: POINTER): INTEGER
|
||||
-- Function called by libcurl as soon as it needs to read data in order to send it to the peer.
|
||||
-- The data area pointed at by the pointer `a_data_pointer' may be filled with at most
|
||||
-- `a_size' multiplied with `a_nmemb' number of bytes.
|
||||
-- Returns the actual number of bytes stored in that memory area.
|
||||
-- Returning 0 will signal end-of-file to the library and cause it to stop the current transfer.
|
||||
--
|
||||
-- Function corresponds to {CURL_OPT_CONSTANTS}.curlopt_readfunction
|
||||
-- Note, pass a {IDENTIFIED}.object_id as `a_object_id' value is helpful since we can't directly pass an Eiffel Object address which
|
||||
-- may changed during GC.
|
||||
--| libcurl doc:
|
||||
--| Function pointer that should match the following prototype: size_t function( void *ptr, size_t size, size_t nmemb, void *userdata);
|
||||
--| This function gets called by libcurl as soon as it needs to read data in order to send it to the peer.
|
||||
--| The data area pointed at by the pointer ptr may be filled with at most size multiplied with nmemb number of bytes.
|
||||
--| Your function must return the actual number of bytes that you stored in that memory area.
|
||||
--| Returning 0 will signal end-of-file to the library and cause it to stop the current transfer.
|
||||
--|
|
||||
--| If you stop the current transfer by returning 0 "pre-maturely" (i.e before the server expected it,
|
||||
--| like when you've said you will upload N bytes and you upload less than N bytes),
|
||||
--| you may experience that the server "hangs" waiting for the rest of the data that won't come.
|
||||
--|
|
||||
--| The read callback may return CURL_READFUNC_ABORT to stop the current operation immediately,
|
||||
--| resulting in a CURLE_ABORTED_BY_CALLBACK error code from the transfer (Added in 7.12.1)
|
||||
--|
|
||||
--| From 7.18.0, the function can return CURL_READFUNC_PAUSE which then will cause reading from this connection to become paused.
|
||||
--| See curl_easy_pause(3) for further details.
|
||||
--|
|
||||
--| Bugs: when doing TFTP uploads, you must return the exact amount of data that the callback wants,
|
||||
--| or it will be considered the final packet by the server end and the transfer will end there.
|
||||
--|
|
||||
--| If you set this callback pointer to NULL, or don't set it at all, the default internal read function will be used.
|
||||
--| It is doing an fread() on the FILE * userdata set with CURLOPT_READDATA.
|
||||
deferred
|
||||
end
|
||||
|
||||
debug_function (a_curl_handle: POINTER; a_curl_infotype: INTEGER; a_char_pointer: POINTER; a_size: INTEGER; a_object_id: POINTER): INTEGER
|
||||
-- Function correspond to {CURL_OPT_CONSTANTS}.curlopt_debugfunction
|
||||
-- Note, pass a {IDENTIFIED}.object_id as `a_object_id' value is helpful since we can't directly pass an Eiffel Object address which
|
||||
-- may changed during GC.
|
||||
require
|
||||
vaild: (create {CURL_INFO_TYPE}).is_valid (a_curl_infotype)
|
||||
deferred
|
||||
end
|
||||
|
||||
feature {NONE} -- Externals
|
||||
|
||||
c_set_object (a_object: POINTER)
|
||||
-- Set Current object address.
|
||||
external
|
||||
"C signature (EIF_REFERENCE) use %"eiffel_curl.h%""
|
||||
end
|
||||
|
||||
c_release_object
|
||||
-- Release Current pointer in C
|
||||
external
|
||||
"C use %"eiffel_curl.h%""
|
||||
end
|
||||
|
||||
c_set_progress_function_address (a_address: POINTER)
|
||||
-- Set progress function address.
|
||||
external
|
||||
"C use %"eiffel_curl.h%""
|
||||
end
|
||||
|
||||
c_set_write_function_address (a_address: POINTER)
|
||||
-- Set write function address.
|
||||
external
|
||||
"C use %"eiffel_curl.h%""
|
||||
end
|
||||
|
||||
c_set_read_function_address (a_address: POINTER)
|
||||
-- Set read function address.
|
||||
external
|
||||
"C use %"eiffel_curl.h%""
|
||||
end
|
||||
|
||||
c_set_debug_function_address (a_address: POINTER)
|
||||
-- Set write function address.
|
||||
external
|
||||
"C use %"eiffel_curl.h%""
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
dispose
|
||||
-- Wean `Current'
|
||||
do
|
||||
c_release_object
|
||||
c_set_object (default_pointer)
|
||||
end
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1,78 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
cURL library constants used by curl_global_init ()
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_GLOBAL_CONSTANTS
|
||||
|
||||
feature -- Query
|
||||
|
||||
curl_global_ssl: NATURAL_64
|
||||
-- Delcared as CURL_GLOBAL_SSL
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return CURL_GLOBAL_SSL;
|
||||
]"
|
||||
end
|
||||
|
||||
curl_global_win32: NATURAL_64
|
||||
-- Delcared as CURL_GLOBAL_WIN32
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return CURL_GLOBAL_WIN32;
|
||||
]"
|
||||
end
|
||||
|
||||
curl_global_all: NATURAL_64
|
||||
-- Delcared as CURL_GLOBAL_ALL
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return CURL_GLOBAL_ALL;
|
||||
]"
|
||||
end
|
||||
|
||||
curl_global_nothing: NATURAL_64
|
||||
-- Delcared as CURL_GLOBAL_NOTHING
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return CURL_GLOBAL_NOTHING;
|
||||
]"
|
||||
end
|
||||
|
||||
curl_global_default: NATURAL_64
|
||||
-- Delcared as CURL_GLOBAL_DEFAULT
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return CURL_GLOBAL_DEFAULT;
|
||||
]"
|
||||
end
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
356 Storke Road, Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
|
||||
@@ -1,122 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
cURL library info constants.
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_INFO_CONSTANTS
|
||||
|
||||
feature -- Constants
|
||||
|
||||
curlinfo_string: INTEGER = 0x100000
|
||||
-- Declared as CURLINFO_STRING
|
||||
|
||||
curlinfo_long: INTEGER = 0x200000
|
||||
-- Declared as CURLINFO_LONG
|
||||
|
||||
curlinfo_double: INTEGER = 0x300000
|
||||
-- Declared as CURLINFO_DOUBLE
|
||||
|
||||
curlinfo_slist: INTEGER = 0x400000
|
||||
-- Declared as CURLINFO_SLIST
|
||||
|
||||
curlinfo_mask: INTEGER = 0x0fffff
|
||||
-- Declared as CURLINFO_MASK
|
||||
|
||||
curlinfo_typemask: INTEGER = 0xf00000
|
||||
-- Declared as CURLINFO_TYPEMASK
|
||||
|
||||
feature -- Info constants
|
||||
|
||||
curlinfo_effective_url: INTEGER = 0x100001 -- CURLINFO_STRING + 1,
|
||||
curlinfo_response_code: INTEGER = 0x200002 -- CURLINFO_LONG + 2,
|
||||
curlinfo_total_time: INTEGER = 0x300003 -- CURLINFO_DOUBLE + 3,
|
||||
curlinfo_namelookup_time: INTEGER = 0x300004 -- CURLINFO_DOUBLE + 4,
|
||||
curlinfo_connect_time: INTEGER = 0x300005 -- CURLINFO_DOUBLE + 5,
|
||||
curlinfo_pretransfer_time: INTEGER = 0x300006 -- CURLINFO_DOUBLE + 6,
|
||||
curlinfo_size_upload: INTEGER = 0x300007 -- CURLINFO_DOUBLE + 7,
|
||||
curlinfo_size_download: INTEGER = 0x300008 -- CURLINFO_DOUBLE + 8,
|
||||
curlinfo_speed_download: INTEGER = 0x300009 -- CURLINFO_DOUBLE + 9,
|
||||
curlinfo_speed_upload: INTEGER = 0x30000a -- CURLINFO_DOUBLE + 10,
|
||||
curlinfo_header_size: INTEGER = 0x20000b -- CURLINFO_LONG + 11,
|
||||
curlinfo_request_size: INTEGER = 0x20000c -- CURLINFO_LONG + 12,
|
||||
curlinfo_ssl_verifyresult: INTEGER = 0x20000d -- CURLINFO_LONG + 13,
|
||||
curlinfo_filetime: INTEGER = 0x20000e -- CURLINFO_LONG + 14,
|
||||
curlinfo_content_length_download: INTEGER = 0x30000f -- CURLINFO_DOUBLE + 15,
|
||||
curlinfo_content_length_upload: INTEGER = 0x300010 -- CURLINFO_DOUBLE + 16,
|
||||
curlinfo_starttransfer_time: INTEGER = 0x300011 -- CURLINFO_DOUBLE + 17,
|
||||
curlinfo_content_type: INTEGER = 0x100012 -- CURLINFO_STRING + 18,
|
||||
curlinfo_redirect_time: INTEGER = 0x300013 -- CURLINFO_DOUBLE + 19,
|
||||
curlinfo_redirect_count: INTEGER = 0x200014 -- CURLINFO_LONG + 20,
|
||||
curlinfo_private: INTEGER = 0x100015 -- CURLINFO_STRING + 21,
|
||||
curlinfo_http_connectcode: INTEGER = 0x200016 -- CURLINFO_LONG + 22,
|
||||
curlinfo_httpauth_avail: INTEGER = 0x200017 -- CURLINFO_LONG + 23,
|
||||
curlinfo_proxyauth_avail: INTEGER = 0x200018 -- CURLINFO_LONG + 24,
|
||||
curlinfo_os_errno: INTEGER = 0x200019 -- CURLINFO_LONG + 25,
|
||||
curlinfo_num_connects: INTEGER = 0x20001a -- CURLINFO_LONG + 26,
|
||||
curlinfo_ssl_engines: INTEGER = 0x40001b -- CURLINFO_SLIST + 27,
|
||||
curlinfo_cookielist: INTEGER = 0x40001c -- CURLINFO_SLIST + 28,
|
||||
curlinfo_lastsocket: INTEGER = 0x20001d -- CURLINFO_LONG + 29,
|
||||
curlinfo_ftp_entry_path: INTEGER = 0x10001e -- CURLINFO_STRING + 30,
|
||||
|
||||
feature -- Contract support
|
||||
|
||||
is_valid (a_code: INTEGER): BOOLEAN
|
||||
-- Is `a_code' valid?
|
||||
do
|
||||
inspect a_code
|
||||
when
|
||||
curlinfo_effective_url,
|
||||
curlinfo_response_code,
|
||||
curlinfo_total_time,
|
||||
curlinfo_namelookup_time,
|
||||
curlinfo_connect_time,
|
||||
curlinfo_pretransfer_time,
|
||||
curlinfo_size_upload,
|
||||
curlinfo_size_download,
|
||||
curlinfo_speed_download,
|
||||
curlinfo_speed_upload,
|
||||
curlinfo_header_size,
|
||||
curlinfo_request_size,
|
||||
curlinfo_ssl_verifyresult,
|
||||
curlinfo_filetime,
|
||||
curlinfo_content_length_download,
|
||||
curlinfo_content_length_upload,
|
||||
curlinfo_starttransfer_time,
|
||||
curlinfo_content_type,
|
||||
curlinfo_redirect_time,
|
||||
curlinfo_redirect_count,
|
||||
curlinfo_private,
|
||||
curlinfo_http_connectcode,
|
||||
curlinfo_httpauth_avail,
|
||||
curlinfo_proxyauth_avail,
|
||||
curlinfo_os_errno,
|
||||
curlinfo_num_connects,
|
||||
curlinfo_ssl_engines,
|
||||
curlinfo_cookielist,
|
||||
curlinfo_lastsocket,
|
||||
curlinfo_ftp_entry_path
|
||||
then
|
||||
Result := True
|
||||
else
|
||||
Result := False
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
356 Storke Road, Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1,69 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
cURL library info type constants.
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_INFO_TYPE
|
||||
|
||||
feature -- Enumeration
|
||||
|
||||
curlinfo_text: INTEGER = 0
|
||||
-- Declared as CURLINFO_TEXT
|
||||
|
||||
curlinfo_header_in: INTEGER = 1
|
||||
-- Declared as CURLINFO_HEADER_IN
|
||||
|
||||
curlinfo_header_out: INTEGER = 2
|
||||
-- Declared as CURLINFO_HEADER_OUT
|
||||
|
||||
curlinfo_data_in: INTEGER = 3
|
||||
-- Declared as CURLINFO_DATA_IN
|
||||
|
||||
curlinfo_data_out: INTEGER = 4
|
||||
-- Declared as CURLINFO_DATA_OUT
|
||||
|
||||
curlinfo_ssl_data_in: INTEGER = 5
|
||||
-- Declared as CURLINFO_SSL_DATA_IN
|
||||
|
||||
curlinfo_ssl_data_out: INTEGER = 6
|
||||
-- Declared as CURLINFO_SSL_DATA_OUT
|
||||
|
||||
feature -- Contract support
|
||||
|
||||
is_valid (a_type: INTEGER): BOOLEAN
|
||||
-- If `a_type' valid?
|
||||
do
|
||||
inspect a_type
|
||||
when
|
||||
curlinfo_data_in,
|
||||
curlinfo_data_out,
|
||||
curlinfo_header_in,
|
||||
curlinfo_header_out,
|
||||
curlinfo_ssl_data_in,
|
||||
curlinfo_ssl_data_out,
|
||||
curlinfo_text
|
||||
then
|
||||
Result := True
|
||||
else
|
||||
Result := False
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
356 Storke Road, Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1,51 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
C CURLMSG enum
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_MSG
|
||||
|
||||
feature -- Query
|
||||
|
||||
curlmsg_done: INTEGER
|
||||
-- Declared as CURLMSG_DONE.
|
||||
-- This easy handle has completed.
|
||||
-- 'result' contains the CURLcode of the transfer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"return CURLMSG_DONE;"
|
||||
end
|
||||
|
||||
curlmsg_none: INTEGER
|
||||
-- Declared as CURLMSG_NONE.
|
||||
-- First, not used
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"return CURLMSG_NONE;"
|
||||
end
|
||||
|
||||
curlmsg_last: INTEGER
|
||||
-- Declared as CURLMSG_LAST.
|
||||
-- Last, not used
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"return CURLMSG_LAST;"
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -1,83 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
|
||||
C Struct CURLMsg wrapper
|
||||
Read multi stack informationals
|
||||
|
||||
This class is used by {CURL_MSG_STRUCT}.info_read
|
||||
|
||||
More info:
|
||||
http://curl.haxx.se/libcurl/c/curl_multi_info_read.html
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_MSG_STRUCT
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_pointer: POINTER)
|
||||
-- Creation method
|
||||
-- Bind message structure to the address `a_pointer'".
|
||||
require
|
||||
not_default: a_pointer /= default_pointer
|
||||
do
|
||||
item := a_pointer
|
||||
ensure
|
||||
set: item = a_pointer
|
||||
end
|
||||
|
||||
feature -- Query
|
||||
|
||||
curl_handle: POINTER
|
||||
-- CURL easy_handle
|
||||
-- The handle it concerns
|
||||
do
|
||||
Result := c_curl_handle (item)
|
||||
end
|
||||
|
||||
msg: INTEGER
|
||||
-- What does this message mean?
|
||||
-- It's one value from {CURLMSG}
|
||||
do
|
||||
Result := c_msg (item)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
item: POINTER
|
||||
-- C struct item
|
||||
|
||||
feature {NONE} -- C externals
|
||||
|
||||
c_curl_handle (a_item: POINTER): POINTER
|
||||
-- cURL easy handle it concerns
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"return (CURL *)((CURLMsg *)$a_item)->easy_handle;"
|
||||
end
|
||||
|
||||
c_msg (a_item: POINTER): INTEGER
|
||||
-- Get msg
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"return (CURLMSG)((CURLMsg *)$a_item)->msg;"
|
||||
end
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -1,48 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
The generic return code used by functions in the libcurl multi interface.
|
||||
Also consider curl_multi_strerror(3).
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_MULTI_CODES
|
||||
|
||||
feature -- Query
|
||||
|
||||
curlm_call_multi_perform: INTEGER = -1
|
||||
-- This is not really an error. It means you should call curl_multi_perform(3) again without doing select() or similar in between.
|
||||
|
||||
curlm_ok: INTEGER = 0
|
||||
-- Things are fine.
|
||||
|
||||
curlm_bad_handle: INTEGER = 1
|
||||
-- The passed-in handle is not a valid CURLM handle.
|
||||
|
||||
curlm_bad_easy_handle: INTEGER = 2
|
||||
-- An easy handle was not good/valid. It could mean that it isn't an easy handle at all, or possibly that the handle already is in used by this or another multi handle.
|
||||
|
||||
curlm_out_of_memory: INTEGER = 3
|
||||
-- You are doomed.
|
||||
|
||||
curlm_internal_error: INTEGER = 4
|
||||
-- This can only be returned if libcurl bugs. Please report it to us!
|
||||
|
||||
curlm_bad_socket: INTEGER = 5
|
||||
-- The passed-in socket is not a valid one that libcurl already knows about. (Added in 7.15.4)
|
||||
|
||||
curlm_unknown_option: INTEGER = 6
|
||||
-- curl_multi_setopt() with unsupported option (Added in 7.15.4)
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -1,251 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
The multi interface offers several abilities that the easy interface doesn't. They are mainly:
|
||||
1. Enable a "pull" interface. The application that uses libcurl decides where and when to ask libcurl to get/send data.
|
||||
2. Enable multiple simultaneous transfers in the same thread without making it complicated for the application.
|
||||
3. Enable the application to wait for action on its own file descriptors and curl's file descriptors simultaneous easily.
|
||||
|
||||
More info: http://curl.haxx.se/libcurl/c/libcurl-multi.html
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_MULTI_EXTERNALS
|
||||
|
||||
feature -- Command
|
||||
|
||||
init
|
||||
-- Create a multi handle.
|
||||
-- If success, Result is a cURL multi hanlde just created.
|
||||
-- This feature maybe failed in some cases: cannot find required DLL, etc.
|
||||
-- Then the post condition would be violated.
|
||||
require
|
||||
dynamic_library_exists: is_dynamic_library_exists
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_multi_init")
|
||||
if l_api /= default_pointer then
|
||||
item := c_init (l_api)
|
||||
end
|
||||
end
|
||||
|
||||
add_handle (a_easy_handle: POINTER)
|
||||
-- Add an easy handle to a multi session.
|
||||
require
|
||||
dynamic_library_exists: is_dynamic_library_exists
|
||||
is_multi_handle_exists: is_exists
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_multi_add_handle")
|
||||
if l_api /= default_pointer then
|
||||
c_add_handle (l_api, item, a_easy_handle)
|
||||
end
|
||||
end
|
||||
|
||||
remove_handle (a_easy_handle: POINTER)
|
||||
-- Remove an easy handle from a multi session.
|
||||
require
|
||||
dynamic_library_exists: is_dynamic_library_exists
|
||||
is_multi_handle_exists: is_exists
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_multi_remove_handle")
|
||||
if l_api /= default_pointer then
|
||||
c_remove_handle (l_api, item, a_easy_handle)
|
||||
end
|
||||
end
|
||||
|
||||
cleanup: INTEGER
|
||||
-- Close down a multi session.
|
||||
-- Result is one value from {CURL_MULTI_CODES}.
|
||||
require
|
||||
dynamic_library_exists: is_dynamic_library_exists
|
||||
is_multi_handle_exists: is_exists
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_multi_cleanup")
|
||||
if l_api /= default_pointer then
|
||||
Result := c_cleanup (l_api, item)
|
||||
end
|
||||
end
|
||||
|
||||
perform (a_running_handle: CELL [INTEGER]): INTEGER
|
||||
-- Reads/writes available data from each easy handle.
|
||||
-- Result is one value from {CURL_MULTI_CODES}.
|
||||
require
|
||||
dynamic_library_exists: is_dynamic_library_exists
|
||||
is_multi_handle_exists: is_exists
|
||||
local
|
||||
l_api: POINTER
|
||||
l_running_handle: INTEGER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_multi_perform")
|
||||
if l_api /= default_pointer then
|
||||
Result := c_perform (l_api, item, $l_running_handle)
|
||||
a_running_handle.put (l_running_handle)
|
||||
end
|
||||
end
|
||||
|
||||
info_read (a_msgs_in_queue: CELL [INTEGER]): POINTER
|
||||
-- Read multi stack informationals.
|
||||
-- The result is C struct CURLMsg {CURL_MSG_STRUCT}.
|
||||
-- Repeated calls to this function will return a new struct each time, until a NULL
|
||||
-- is returned as a signal that there is no more to get at this point. The integer
|
||||
-- pointed to with msgs_in_queue will contain the number of remaining messages after
|
||||
-- this function was called.
|
||||
-- When you fetch a message using this function, it is removed from the internal queue
|
||||
-- so calling this function again will not return the same message again. It will instead
|
||||
-- return new messages at each new invoke until the queue is emptied.
|
||||
require
|
||||
dynamic_library_exists: is_dynamic_library_exists
|
||||
is_multi_handle_exists: is_exists
|
||||
local
|
||||
l_api: POINTER
|
||||
l_msgs_in_queue: INTEGER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_multi_info_read")
|
||||
if l_api /= default_pointer then
|
||||
Result := c_info_read (l_api, item, $l_msgs_in_queue)
|
||||
a_msgs_in_queue.put (l_msgs_in_queue)
|
||||
end
|
||||
end
|
||||
|
||||
is_dynamic_library_exists: BOOLEAN
|
||||
-- Are required .dll/.so files available?
|
||||
do
|
||||
Result := api_loader.is_interface_usable
|
||||
end
|
||||
|
||||
-- Feature not yet wrapped/tested
|
||||
-- curl_multi_assign
|
||||
-- curl_multi_fdset
|
||||
-- curl_multi_setopt
|
||||
-- curl_multi_socket
|
||||
-- curl_multi_socket_action
|
||||
-- curl_multi_strerror
|
||||
-- curl_multi_timeout
|
||||
|
||||
feature -- Query
|
||||
|
||||
is_exists: BOOLEAN
|
||||
-- If C pointer exists?
|
||||
do
|
||||
Result := item /= default_pointer
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
item: POINTER
|
||||
-- C pointer item for cURL multi
|
||||
|
||||
feature {NONE} -- C externals
|
||||
|
||||
c_init (a_api: POINTER): POINTER
|
||||
-- Declared as curl_multi_init ().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return (FUNCTION_CAST(CURLM *, ()) $a_api)();
|
||||
]"
|
||||
end
|
||||
|
||||
c_cleanup (a_api: POINTER; a_multi_handle: POINTER): INTEGER
|
||||
-- Declared as curl_multi_cleanup ().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return (FUNCTION_CAST(CURLMcode, (CURLM *)) $a_api)
|
||||
((CURLM *)$a_multi_handle);
|
||||
]"
|
||||
end
|
||||
|
||||
c_add_handle (a_api: POINTER; a_multi_handle: POINTER; a_easy_handle: POINTER)
|
||||
-- Declared as curl_multi_add_handle ().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
(FUNCTION_CAST(void, (CURLM *, CURL *)) $a_api)
|
||||
((CURLM *) $a_multi_handle,
|
||||
(CURL *) $a_easy_handle);
|
||||
]"
|
||||
end
|
||||
|
||||
c_remove_handle (a_api: POINTER; a_multi_handle: POINTER; a_easy_handle: POINTER)
|
||||
-- Declared as curl_multi_remove_handle ().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
(FUNCTION_CAST(void, (CURLM *, CURL *)) $a_api)
|
||||
((CURLM *) $a_multi_handle,
|
||||
(CURL *) $a_easy_handle);
|
||||
]"
|
||||
end
|
||||
|
||||
c_perform (a_api: POINTER; a_multi_handle: POINTER; a_running_handles: TYPED_POINTER [INTEGER]): INTEGER
|
||||
-- Declared as curl_multi_perform.
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return (FUNCTION_CAST(CURLMcode, (CURLM *, int *)) $a_api)
|
||||
((CURLM *) $a_multi_handle,
|
||||
(int *) $a_running_handles);
|
||||
]"
|
||||
end
|
||||
|
||||
c_info_read (a_api: POINTER; a_multi_handle: POINTER; a_msgs_in_queue: TYPED_POINTER [INTEGER]): POINTER
|
||||
-- Declared as curl_multi_info_read.
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return (FUNCTION_CAST(CURLMsg *, (CURLM *, int *)) $a_api)
|
||||
((CURLM *) $a_multi_handle,
|
||||
(int *) $a_msgs_in_queue);
|
||||
]"
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
api_loader: DYNAMIC_MODULE
|
||||
-- Module name.
|
||||
local
|
||||
l_utility: CURL_UTILITY
|
||||
once
|
||||
create l_utility
|
||||
Result := l_utility.api_loader
|
||||
end
|
||||
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,50 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
String used by cURL wrapper library.
|
||||
Only added features from IDENTIFIED.
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_STRING
|
||||
|
||||
inherit
|
||||
STRING
|
||||
select
|
||||
is_equal,
|
||||
copy,
|
||||
out
|
||||
end
|
||||
|
||||
IDENTIFIED
|
||||
rename
|
||||
is_equal as identified_is_equal,
|
||||
copy as identified_copy,
|
||||
out as identified_out
|
||||
end
|
||||
|
||||
create
|
||||
make,
|
||||
make_empty,
|
||||
make_filled,
|
||||
make_from_string,
|
||||
make_from_c,
|
||||
make_from_cil
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
356 Storke Road, Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
Utilities for Eiffel cURL wrapper library.
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_UTILITY
|
||||
|
||||
feature -- Query
|
||||
|
||||
api_loader: DYNAMIC_MODULE
|
||||
-- API dynamic loader
|
||||
local
|
||||
l_platform: PLATFORM
|
||||
once
|
||||
create l_platform
|
||||
if l_platform.is_unix or l_platform.is_mac then
|
||||
create Result.make_with_version (module_name, "3")
|
||||
else
|
||||
check is_window: l_platform.is_windows end
|
||||
create Result.make (module_name)
|
||||
end
|
||||
ensure
|
||||
not_void: Result /= Void
|
||||
end
|
||||
|
||||
module_name: STRING
|
||||
-- Module name.
|
||||
once
|
||||
Result := "libcurl"
|
||||
ensure
|
||||
not_void: Result /= Void
|
||||
end
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
356 Storke Road, Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1,65 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
Interactive with native system APIs for dynamic loading.
|
||||
Cocoa verson.
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
API_LOADER_IMP
|
||||
|
||||
feature -- Command
|
||||
|
||||
load_module (a_name: STRING): POINTER
|
||||
-- Load module with `a_name'.
|
||||
require
|
||||
exists: a_name /= Void
|
||||
do
|
||||
-- fixme: implement
|
||||
end
|
||||
|
||||
loal_api (a_module: POINTER; a_name: STRING): POINTER
|
||||
-- Load api which name is `a_name' in `a_module'
|
||||
require
|
||||
exists: a_module /= default_pointer
|
||||
exists: a_name /= Void
|
||||
do
|
||||
-- fixme: implement
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2007, Eiffel Software"
|
||||
license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
|
||||
licensing_options: "http://www.eiffel.com/licensing"
|
||||
copying: "[
|
||||
This file is part of Eiffel Software's Eiffel Development Environment.
|
||||
|
||||
Eiffel Software's Eiffel Development Environment is free
|
||||
software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published
|
||||
by the Free Software Foundation, version 2 of the License
|
||||
(available at the URL listed under "license" above).
|
||||
|
||||
Eiffel Software's Eiffel Development Environment is
|
||||
distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with Eiffel Software's Eiffel Development
|
||||
Environment; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
]"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
356 Storke Road, Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1 +0,0 @@
|
||||
reference:forum2
|
||||
@@ -1,5 +0,0 @@
|
||||
When your Eiffel executable running, Eiffel cURL library needs 3 DLLs, they are:
|
||||
|
||||
libcurl.dll, libeay32.dll and ssleay32.dll
|
||||
|
||||
Please make sure the 3 DLLs files can be found in your environment PATH or in same folder of your executable.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,67 +0,0 @@
|
||||
#ifndef __CURL_CURLVER_H
|
||||
#define __CURL_CURLVER_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
|
||||
/* This header file contains nothing but libcurl version info, generated by
|
||||
a script at release-time. This was made its own header file in 7.11.2 */
|
||||
|
||||
/* This is the version number of the libcurl package from which this header
|
||||
file origins: */
|
||||
#define LIBCURL_VERSION "7.17.0"
|
||||
|
||||
/* The numeric version number is also available "in parts" by using these
|
||||
defines: */
|
||||
#define LIBCURL_VERSION_MAJOR 7
|
||||
#define LIBCURL_VERSION_MINOR 17
|
||||
#define LIBCURL_VERSION_PATCH 0
|
||||
|
||||
/* This is the numeric version of the libcurl version number, meant for easier
|
||||
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
|
||||
always follow this syntax:
|
||||
|
||||
0xXXYYZZ
|
||||
|
||||
Where XX, YY and ZZ are the main version, release and patch numbers in
|
||||
hexadecimal (using 8 bits each). All three numbers are always represented
|
||||
using two digits. 1.2 would appear as "0x010200" while version 9.11.7
|
||||
appears as "0x090b07".
|
||||
|
||||
This 6-digit (24 bits) hexadecimal number does not show pre-release number,
|
||||
and it is always a greater number in a more recent release. It makes
|
||||
comparisons with greater than and less than work.
|
||||
*/
|
||||
#define LIBCURL_VERSION_NUM 0x071100
|
||||
|
||||
/*
|
||||
* This is the date and time when the full source package was created. The
|
||||
* timestamp is not stored in CVS, as the timestamp is properly set in the
|
||||
* tarballs by the maketgz script.
|
||||
*
|
||||
* The format of the date should follow this template:
|
||||
*
|
||||
* "Mon Feb 12 11:35:33 UTC 2007"
|
||||
*/
|
||||
#define LIBCURL_TIMESTAMP "Thu Sep 13 20:22:24 UTC 2007"
|
||||
|
||||
#endif /* __CURL_CURLVER_H */
|
||||
@@ -1,81 +0,0 @@
|
||||
#ifndef __CURL_EASY_H
|
||||
#define __CURL_EASY_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
CURL_EXTERN CURL *curl_easy_init(void);
|
||||
CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
|
||||
CURL_EXTERN CURLcode curl_easy_perform(CURL *curl);
|
||||
CURL_EXTERN void curl_easy_cleanup(CURL *curl);
|
||||
|
||||
/*
|
||||
* NAME curl_easy_getinfo()
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Request internal information from the curl session with this function. The
|
||||
* third argument MUST be a pointer to a long, a pointer to a char * or a
|
||||
* pointer to a double (as the documentation describes elsewhere). The data
|
||||
* pointed to will be filled in accordingly and can be relied upon only if the
|
||||
* function returns CURLE_OK. This function is intended to get used *AFTER* a
|
||||
* performed transfer, all results from this function are undefined until the
|
||||
* transfer is completed.
|
||||
*/
|
||||
CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
|
||||
|
||||
|
||||
/*
|
||||
* NAME curl_easy_duphandle()
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Creates a new curl session handle with the same options set for the handle
|
||||
* passed in. Duplicating a handle could only be a matter of cloning data and
|
||||
* options, internal state info and things like persistant connections cannot
|
||||
* be transfered. It is useful in multithreaded applications when you can run
|
||||
* curl_easy_duphandle() for each new thread to avoid a series of identical
|
||||
* curl_easy_setopt() invokes in every thread.
|
||||
*/
|
||||
CURL_EXTERN CURL* curl_easy_duphandle(CURL *curl);
|
||||
|
||||
/*
|
||||
* NAME curl_easy_reset()
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Re-initializes a CURL handle to the default values. This puts back the
|
||||
* handle to the same state as it was in when it was just created.
|
||||
*
|
||||
* It does keep: live connections, the Session ID cache, the DNS cache and the
|
||||
* cookies.
|
||||
*/
|
||||
CURL_EXTERN void curl_easy_reset(CURL *curl);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,80 +0,0 @@
|
||||
#ifndef __CURL_MPRINTF_H
|
||||
#define __CURL_MPRINTF_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h> /* needed for FILE */
|
||||
|
||||
#include "curl.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
CURL_EXTERN int curl_mprintf(const char *format, ...);
|
||||
CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...);
|
||||
CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...);
|
||||
CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength, const char *format, ...);
|
||||
CURL_EXTERN int curl_mvprintf(const char *format, va_list args);
|
||||
CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args);
|
||||
CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args);
|
||||
CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength, const char *format, va_list args);
|
||||
CURL_EXTERN char *curl_maprintf(const char *format, ...);
|
||||
CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);
|
||||
|
||||
#ifdef _MPRINTF_REPLACE
|
||||
# undef printf
|
||||
# undef fprintf
|
||||
# undef sprintf
|
||||
# undef vsprintf
|
||||
# undef snprintf
|
||||
# undef vprintf
|
||||
# undef vfprintf
|
||||
# undef vsnprintf
|
||||
# undef aprintf
|
||||
# undef vaprintf
|
||||
# define printf curl_mprintf
|
||||
# define fprintf curl_mfprintf
|
||||
#ifdef CURLDEBUG
|
||||
/* When built with CURLDEBUG we define away the sprintf() functions since we
|
||||
don't want internal code to be using them */
|
||||
# define sprintf sprintf_was_used
|
||||
# define vsprintf vsprintf_was_used
|
||||
#else
|
||||
# define sprintf curl_msprintf
|
||||
# define vsprintf curl_mvsprintf
|
||||
#endif
|
||||
# define snprintf curl_msnprintf
|
||||
# define vprintf curl_mvprintf
|
||||
# define vfprintf curl_mvfprintf
|
||||
# define vsnprintf curl_mvsnprintf
|
||||
# define aprintf curl_maprintf
|
||||
# define vaprintf curl_mvaprintf
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __CURL_MPRINTF_H */
|
||||
@@ -1,346 +0,0 @@
|
||||
#ifndef __CURL_MULTI_H
|
||||
#define __CURL_MULTI_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
/*
|
||||
This is an "external" header file. Don't give away any internals here!
|
||||
|
||||
GOALS
|
||||
|
||||
o Enable a "pull" interface. The application that uses libcurl decides where
|
||||
and when to ask libcurl to get/send data.
|
||||
|
||||
o Enable multiple simultaneous transfers in the same thread without making it
|
||||
complicated for the application.
|
||||
|
||||
o Enable the application to select() on its own file descriptors and curl's
|
||||
file descriptors simultaneous easily.
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* This header file should not really need to include "curl.h" since curl.h
|
||||
* itself includes this file and we expect user applications to do #include
|
||||
* <curl/curl.h> without the need for especially including multi.h.
|
||||
*
|
||||
* For some reason we added this include here at one point, and rather than to
|
||||
* break existing (wrongly written) libcurl applications, we leave it as-is
|
||||
* but with this warning attached.
|
||||
*/
|
||||
#include "curl.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void CURLM;
|
||||
|
||||
typedef enum {
|
||||
CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or
|
||||
curl_multi_socket*() soon */
|
||||
CURLM_OK,
|
||||
CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */
|
||||
CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */
|
||||
CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */
|
||||
CURLM_INTERNAL_ERROR, /* this is a libcurl bug */
|
||||
CURLM_BAD_SOCKET, /* the passed in socket argument did not match */
|
||||
CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */
|
||||
CURLM_LAST
|
||||
} CURLMcode;
|
||||
|
||||
/* just to make code nicer when using curl_multi_socket() you can now check
|
||||
for CURLM_CALL_MULTI_SOCKET too in the same style it works for
|
||||
curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */
|
||||
#define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM
|
||||
|
||||
typedef enum {
|
||||
CURLMSG_NONE, /* first, not used */
|
||||
CURLMSG_DONE, /* This easy handle has completed. 'result' contains
|
||||
the CURLcode of the transfer */
|
||||
CURLMSG_LAST /* last, not used */
|
||||
} CURLMSG;
|
||||
|
||||
struct CURLMsg {
|
||||
CURLMSG msg; /* what this message means */
|
||||
CURL *easy_handle; /* the handle it concerns */
|
||||
union {
|
||||
void *whatever; /* message-specific data */
|
||||
CURLcode result; /* return code for transfer */
|
||||
} data;
|
||||
};
|
||||
typedef struct CURLMsg CURLMsg;
|
||||
|
||||
/*
|
||||
* Name: curl_multi_init()
|
||||
*
|
||||
* Desc: inititalize multi-style curl usage
|
||||
*
|
||||
* Returns: a new CURLM handle to use in all 'curl_multi' functions.
|
||||
*/
|
||||
CURL_EXTERN CURLM *curl_multi_init(void);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_add_handle()
|
||||
*
|
||||
* Desc: add a standard curl handle to the multi stack
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle,
|
||||
CURL *curl_handle);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_remove_handle()
|
||||
*
|
||||
* Desc: removes a curl handle from the multi stack again
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
|
||||
CURL *curl_handle);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_fdset()
|
||||
*
|
||||
* Desc: Ask curl for its fd_set sets. The app can use these to select() or
|
||||
* poll() on. We want curl_multi_perform() called as soon as one of
|
||||
* them are ready.
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,
|
||||
fd_set *read_fd_set,
|
||||
fd_set *write_fd_set,
|
||||
fd_set *exc_fd_set,
|
||||
int *max_fd);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_perform()
|
||||
*
|
||||
* Desc: When the app thinks there's data available for curl it calls this
|
||||
* function to read/write whatever there is right now. This returns
|
||||
* as soon as the reads and writes are done. This function does not
|
||||
* require that there actually is data available for reading or that
|
||||
* data can be written, it can be called just in case. It returns
|
||||
* the number of handles that still transfer data in the second
|
||||
* argument's integer-pointer.
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code. *NOTE* that this only
|
||||
* returns errors etc regarding the whole multi stack. There might
|
||||
* still have occurred problems on invidual transfers even when this
|
||||
* returns OK.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,
|
||||
int *running_handles);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_cleanup()
|
||||
*
|
||||
* Desc: Cleans up and removes a whole multi stack. It does not free or
|
||||
* touch any individual easy handles in any way. We need to define
|
||||
* in what state those handles will be if this function is called
|
||||
* in the middle of a transfer.
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_info_read()
|
||||
*
|
||||
* Desc: Ask the multi handle if there's any messages/informationals from
|
||||
* the individual transfers. Messages include informationals such as
|
||||
* error code from the transfer or just the fact that a transfer is
|
||||
* completed. More details on these should be written down as well.
|
||||
*
|
||||
* Repeated calls to this function will return a new struct each
|
||||
* time, until a special "end of msgs" struct is returned as a signal
|
||||
* that there is no more to get at this point.
|
||||
*
|
||||
* The data the returned pointer points to will not survive calling
|
||||
* curl_multi_cleanup().
|
||||
*
|
||||
* The 'CURLMsg' struct is meant to be very simple and only contain
|
||||
* very basic informations. If more involved information is wanted,
|
||||
* we will provide the particular "transfer handle" in that struct
|
||||
* and that should/could/would be used in subsequent
|
||||
* curl_easy_getinfo() calls (or similar). The point being that we
|
||||
* must never expose complex structs to applications, as then we'll
|
||||
* undoubtably get backwards compatibility problems in the future.
|
||||
*
|
||||
* Returns: A pointer to a filled-in struct, or NULL if it failed or ran out
|
||||
* of structs. It also writes the number of messages left in the
|
||||
* queue (after this read) in the integer the second argument points
|
||||
* to.
|
||||
*/
|
||||
CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,
|
||||
int *msgs_in_queue);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_strerror()
|
||||
*
|
||||
* Desc: The curl_multi_strerror function may be used to turn a CURLMcode
|
||||
* value into the equivalent human readable error string. This is
|
||||
* useful for printing meaningful error messages.
|
||||
*
|
||||
* Returns: A pointer to a zero-terminated error message.
|
||||
*/
|
||||
CURL_EXTERN const char *curl_multi_strerror(CURLMcode);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_socket() and
|
||||
* curl_multi_socket_all()
|
||||
*
|
||||
* Desc: An alternative version of curl_multi_perform() that allows the
|
||||
* application to pass in one of the file descriptors that have been
|
||||
* detected to have "action" on them and let libcurl perform.
|
||||
* See man page for details.
|
||||
*/
|
||||
#define CURL_POLL_NONE 0
|
||||
#define CURL_POLL_IN 1
|
||||
#define CURL_POLL_OUT 2
|
||||
#define CURL_POLL_INOUT 3
|
||||
#define CURL_POLL_REMOVE 4
|
||||
|
||||
#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD
|
||||
|
||||
#define CURL_CSELECT_IN 0x01
|
||||
#define CURL_CSELECT_OUT 0x02
|
||||
#define CURL_CSELECT_ERR 0x04
|
||||
|
||||
typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */
|
||||
curl_socket_t s, /* socket */
|
||||
int what, /* see above */
|
||||
void *userp, /* private callback
|
||||
pointer */
|
||||
void *socketp); /* private socket
|
||||
pointer */
|
||||
/*
|
||||
* Name: curl_multi_timer_callback
|
||||
*
|
||||
* Desc: Called by libcurl whenever the library detects a change in the
|
||||
* maximum number of milliseconds the app is allowed to wait before
|
||||
* curl_multi_socket() or curl_multi_perform() must be called
|
||||
* (to allow libcurl's timed events to take place).
|
||||
*
|
||||
* Returns: The callback should return zero.
|
||||
*/
|
||||
typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */
|
||||
long timeout_ms, /* see above */
|
||||
void *userp); /* private callback
|
||||
pointer */
|
||||
|
||||
CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s,
|
||||
int *running_handles);
|
||||
|
||||
CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle,
|
||||
curl_socket_t s,
|
||||
int ev_bitmask,
|
||||
int *running_handles);
|
||||
|
||||
CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle,
|
||||
int *running_handles);
|
||||
|
||||
#ifndef CURL_ALLOW_OLD_MULTI_SOCKET
|
||||
/* This macro below was added in 7.16.3 to push users who recompile to use
|
||||
the new curl_multi_socket_action() instead of the old curl_multi_socket()
|
||||
*/
|
||||
#define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Name: curl_multi_timeout()
|
||||
*
|
||||
* Desc: Returns the maximum number of milliseconds the app is allowed to
|
||||
* wait before curl_multi_socket() or curl_multi_perform() must be
|
||||
* called (to allow libcurl's timed events to take place).
|
||||
*
|
||||
* Returns: CURLM error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle,
|
||||
long *milliseconds);
|
||||
|
||||
#undef CINIT /* re-using the same name as in curl.h */
|
||||
|
||||
#ifdef CURL_ISOCPP
|
||||
#define CINIT(name,type,number) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + number
|
||||
#else
|
||||
/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
|
||||
#define LONG CURLOPTTYPE_LONG
|
||||
#define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT
|
||||
#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
|
||||
#define OFF_T CURLOPTTYPE_OFF_T
|
||||
#define CINIT(name,type,number) CURLMOPT_/**/name = type + number
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
/* This is the socket callback function pointer */
|
||||
CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1),
|
||||
|
||||
/* This is the argument passed to the socket callback */
|
||||
CINIT(SOCKETDATA, OBJECTPOINT, 2),
|
||||
|
||||
/* set to 1 to enable pipelining for this multi handle */
|
||||
CINIT(PIPELINING, LONG, 3),
|
||||
|
||||
/* This is the timer callback function pointer */
|
||||
CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4),
|
||||
|
||||
/* This is the argument passed to the timer callback */
|
||||
CINIT(TIMERDATA, OBJECTPOINT, 5),
|
||||
|
||||
/* maximum number of entries in the connection cache */
|
||||
CINIT(MAXCONNECTS, LONG, 6),
|
||||
|
||||
CURLMOPT_LASTENTRY /* the last unused */
|
||||
} CURLMoption;
|
||||
|
||||
|
||||
/*
|
||||
* Name: curl_multi_setopt()
|
||||
*
|
||||
* Desc: Sets options for the multi handle.
|
||||
*
|
||||
* Returns: CURLM error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle,
|
||||
CURLMoption option, ...);
|
||||
|
||||
|
||||
/*
|
||||
* Name: curl_multi_assign()
|
||||
*
|
||||
* Desc: This function sets an association in the multi handle between the
|
||||
* given socket and a private pointer of the application. This is
|
||||
* (only) useful for curl_multi_socket uses.
|
||||
*
|
||||
* Returns: CURLM error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,
|
||||
curl_socket_t sockfd, void *sockp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end of extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,34 +0,0 @@
|
||||
#ifndef __STDC_HEADERS_H
|
||||
#define __STDC_HEADERS_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
size_t fread (void *, size_t, size_t, FILE *);
|
||||
size_t fwrite (const void *, size_t, size_t, FILE *);
|
||||
|
||||
int strcasecmp(const char *, const char *);
|
||||
int strncasecmp(const char *, const char *, size_t);
|
||||
|
||||
#endif
|
||||
@@ -1 +0,0 @@
|
||||
/* not used */
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
indexing
|
||||
description: "Functions used by the class CURL_FUNCTION."
|
||||
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
356 Storke Road, Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
*/
|
||||
|
||||
#ifndef _eiffel_curl_h_
|
||||
#define _eiffel_curl_h_
|
||||
|
||||
#include "eif_eiffel.h"
|
||||
|
||||
/* unix-specific */
|
||||
#ifndef EIF_WINDOWS
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void c_set_object(EIF_REFERENCE a_address);
|
||||
extern void c_release_object(void);
|
||||
extern void c_set_progress_function_address( EIF_POINTER a_address);
|
||||
extern void c_set_read_function_address( EIF_POINTER a_address);
|
||||
extern void c_set_write_function_address( EIF_POINTER a_address);
|
||||
extern void c_set_debug_function_address (EIF_POINTER a_address);
|
||||
extern size_t curl_write_function (void *ptr, size_t size, size_t nmemb, void *data);
|
||||
extern size_t curl_read_function (void *ptr, size_t size, size_t nmemb, void *data);
|
||||
extern size_t curl_progress_function (void * a_object_id, double a_dltotal, double a_dlnow, double a_ultotal, double a_ulnow);
|
||||
extern size_t curl_debug_function (CURL * a_curl_handle, curl_infotype a_curl_infotype, unsigned char * a_char_pointer, size_t a_size, void * a_object_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -8,6 +8,9 @@ class
|
||||
|
||||
inherit
|
||||
NETWORK_STREAM_SOCKET
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make_server_by_address_and_port,
|
||||
@@ -18,6 +21,13 @@ create {NETWORK_STREAM_SOCKET}
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Create a network stream socket.
|
||||
do
|
||||
Precursor
|
||||
set_reuse_address
|
||||
end
|
||||
|
||||
make_server_by_address_and_port (an_address: INET_ADDRESS; a_port: INTEGER)
|
||||
-- Create server socket on `an_address' and `a_port'.
|
||||
require
|
||||
|
||||
15
doc/how-to-include-ewf-in-my-git-repository.txt
Normal file
15
doc/how-to-include-ewf-in-my-git-repository.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
GOAL: include EWF into your own git repository
|
||||
For instance, let's put it under lib/EWF
|
||||
|
||||
git remote add -f _ewf https://github.com/EiffelWebFramework/EWF.git
|
||||
git merge --squash -s ours --no-commit _ewf/master
|
||||
git read-tree --prefix=lib/EWF/ -u _ewf/master
|
||||
git commit -m "Imported EWF into subtree lib/EWF/"
|
||||
|
||||
Then to update lib/EWF
|
||||
git pull -X subtree=lib/EWF _ewf master
|
||||
|
||||
From another git clone, reconnect this "import"
|
||||
git remote add -f _ewf https://github.com/EiffelWebFramework/EWF.git
|
||||
git merge -s ours --no-commit --squash _ewf/master
|
||||
and then update lib/EWF as described before
|
||||
@@ -7,21 +7,22 @@
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" is_attached_by_default="true" void_safety="all" syntax="transitional">
|
||||
<option warning="true" full_class_checking="false" is_attached_by_default="true" void_safety="all" syntax="transitional">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<setting name="exception_trace" value="true"/>
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="default_nino" location="..\..\..\library\server\wsf\default\nino-safe.ecf"/>
|
||||
<library name="encoder" location="..\..\..\library\text\encoder\encoder-safe.ecf" readonly="false"/>
|
||||
<library name="http" location="..\..\..\library\network\protocol\http\http-safe.ecf" readonly="false"/>
|
||||
<library name="nino" location="..\..\..\library\server\ewsgi\connectors\nino\nino-safe.ecf"/>
|
||||
<library name="notification_email" location="..\..\..\library\runtime\process\notification_email\notification_email-safe.ecf"/>
|
||||
<library name="openid" location="..\..\..\library\security\openid\consumer\openid-safe.ecf" readonly="false"/>
|
||||
<library name="process" location="$ISE_LIBRARY\library\process\process-safe.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<library name="uri_template" location="..\..\..\library\text\parser\uri_template\uri_template-safe.ecf" readonly="false"/>
|
||||
<library name="uri_template" location="..\..\..\library\text\parser\uri_template\uri_template-safe.ecf"/>
|
||||
<library name="uuid" location="$ISE_LIBRARY\library\uuid\uuid-safe.ecf"/>
|
||||
<library name="wsf" location="..\..\..\library\server\wsf\wsf-safe.ecf" readonly="false"/>
|
||||
<library name="wsf_html" location="..\..\..\library\server\wsf_html\wsf_html-safe.ecf" readonly="false"/>
|
||||
<library name="wsf_session" location="..\..\..\library\server\wsf\wsf_session-safe.ecf" readonly="false"/>
|
||||
<cluster name="src" location=".\src\" recursive="true"/>
|
||||
</target>
|
||||
|
||||
@@ -14,16 +14,17 @@
|
||||
<setting name="exception_trace" value="true"/>
|
||||
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="default_nino" location="..\..\..\library\server\wsf\default\nino.ecf"/>
|
||||
<library name="encoder" location="..\..\..\library\text\encoder\encoder.ecf" readonly="false"/>
|
||||
<library name="wsf_html" location="..\..\..\library\server\wsf_html\wsf_html.ecf" readonly="false"/>
|
||||
<library name="http" location="..\..\..\library\network\protocol\http\http.ecf" readonly="false"/>
|
||||
<library name="nino" location="..\..\..\library\server\ewsgi\connectors\nino\nino.ecf"/>
|
||||
<library name="openid" location="..\..\..\library\security\openid\consumer\openid.ecf" />
|
||||
<library name="process" location="$ISE_LIBRARY\library\process\process.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
|
||||
<library name="uri_template" location="..\..\..\library\text\parser\uri_template\uri_template.ecf" readonly="false"/>
|
||||
<library name="uuid" location="$ISE_LIBRARY\library\uuid\uuid.ecf"/>
|
||||
<library name="uri_template" location="..\..\..\library\text\parser\uri_template\uri_template.ecf"/>
|
||||
<library name="wsf" location="..\..\..\library\server\wsf\wsf.ecf" readonly="false"/>
|
||||
<library name="wsf_session" location="..\..\..\library\server\wsf\wsf_session.ecf" readonly="false"/>
|
||||
<library name="notification_email" location="..\..\..\library\runtime\process\notification_email\notification_email.ecf"/>
|
||||
<cluster name="src" location=".\src\" recursive="true">
|
||||
</cluster>
|
||||
</target>
|
||||
|
||||
@@ -3,6 +3,6 @@ site.name=EWF Web CMS
|
||||
site.email=your@email.com
|
||||
root-dir=../www
|
||||
var-dir=var
|
||||
files-dir=../www/files
|
||||
themes-dir=../www/themes
|
||||
theme=test
|
||||
files-dir=files
|
||||
themes-dir=${root-dir}/themes
|
||||
#theme=test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-10-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-10-0 http://www.eiffel.com/developers/xml/configuration-1-10-0.xsd" name="demo" uuid="402ED70E-9A85-4501-8730-7B211EB32E6B">
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-10-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-10-0 http://www.eiffel.com/developers/xml/configuration-1-10-0.xsd" name="demo" uuid="402ED70E-9A85-4501-8730-7B211EB32E6B" library_target="demo">
|
||||
<target name="demo">
|
||||
<root class="WEB_CMS" feature="make_and_launch"/>
|
||||
<file_rule>
|
||||
@@ -16,6 +16,7 @@
|
||||
<library name="http" location="..\..\..\..\library\network\protocol\http\http-safe.ecf" readonly="false"/>
|
||||
<library name="nino" location="..\..\..\..\library\server\ewsgi\connectors\nino\nino-safe.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<library name="wsf_html" location="..\..\..\..\library\server\wsf_html\wsf_html-safe.ecf" readonly="false"/>
|
||||
<library name="wsf" location="..\..\..\..\library\server\wsf\wsf-safe.ecf" readonly="false"/>
|
||||
<cluster name="src" location=".\src\" recursive="true"/>
|
||||
</target>
|
||||
|
||||
6
draft/application/cms/example/demo.rc
Normal file
6
draft/application/cms/example/demo.rc
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <windows.h>
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
1 "This Program was made using EiffelStudio using Visual Studio C++"
|
||||
END
|
||||
@@ -9,15 +9,21 @@ class
|
||||
|
||||
inherit
|
||||
CMS_MODULE
|
||||
redefine
|
||||
links
|
||||
end
|
||||
|
||||
CMS_HOOK_MENU_ALTER
|
||||
|
||||
CMS_HOOK_AUTO_REGISTER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_service: like service)
|
||||
make
|
||||
do
|
||||
service := a_service
|
||||
name := "demo"
|
||||
version := "1.0"
|
||||
description := "demo"
|
||||
@@ -26,12 +32,23 @@ feature {NONE} -- Initialization
|
||||
|
||||
feature {CMS_SERVICE} -- Registration
|
||||
|
||||
service: CMS_SERVICE
|
||||
service: detachable CMS_SERVICE
|
||||
|
||||
register (a_service: CMS_SERVICE)
|
||||
do
|
||||
a_service.map_uri_template ("/demo/date/{arg}", agent handle_date_time_demo)
|
||||
a_service.map_uri_template ("/demo/format/{arg}", agent handle_format_demo)
|
||||
service := a_service
|
||||
a_service.map_uri_template ("/demo/widget{/args}", agent handle_widget_demo (a_service, ?, ?))
|
||||
a_service.map_uri_template ("/demo/date/{arg}", agent handle_date_time_demo (a_service, ?, ?))
|
||||
a_service.map_uri_template ("/demo/format/{arg}", agent handle_format_demo (a_service, ?, ?))
|
||||
end
|
||||
|
||||
menu_alter (a_menu_system: CMS_MENU_SYSTEM; a_execution: CMS_EXECUTION)
|
||||
local
|
||||
lnk: CMS_LOCAL_LINK
|
||||
-- opts: CMS_API_OPTIONS
|
||||
do
|
||||
create lnk.make ("Demo::widget", "/demo/widget/")
|
||||
a_menu_system.management_menu.extend (lnk)
|
||||
end
|
||||
|
||||
feature -- Hooks
|
||||
@@ -39,22 +56,27 @@ feature -- Hooks
|
||||
links: HASH_TABLE [CMS_MODULE_LINK, STRING]
|
||||
-- Link indexed by path
|
||||
local
|
||||
-- lnk: CMS_MODULE_LINK
|
||||
lnk: CMS_MODULE_LINK
|
||||
do
|
||||
create Result.make (3)
|
||||
-- create lnk.make ("Date/time demo")
|
||||
Result := Precursor
|
||||
create lnk.make ("Date/time demo")
|
||||
-- lnk.set_callback (agent process_date_time_demo, <<"arg">>)
|
||||
-- Result["/demo/date/{arg}"] := lnk
|
||||
end
|
||||
|
||||
handle_date_time_demo (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_date_time_demo (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {ANY_CMS_EXECUTION}.make_with_text (req, res, service, "<h1>Demo::date/time</h1>")).execute
|
||||
(create {ANY_CMS_EXECUTION}.make_with_text (req, res, cms, "<h1>Demo::date/time</h1>")).execute
|
||||
end
|
||||
|
||||
handle_format_demo (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_format_demo (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {ANY_CMS_EXECUTION}.make_with_text (req, res, service, "<h1>Demo::format</h1>")).execute
|
||||
(create {ANY_CMS_EXECUTION}.make_with_text (req, res, cms, "<h1>Demo::format</h1>")).execute
|
||||
end
|
||||
|
||||
handle_widget_demo (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {DEMO_WIDGET_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
note
|
||||
description : "Objects that ..."
|
||||
author : "$Author$"
|
||||
date : "$Date$"
|
||||
revision : "$Revision$"
|
||||
|
||||
class
|
||||
DEMO_WIDGET_CMS_EXECUTION
|
||||
|
||||
inherit
|
||||
CMS_EXECUTION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Execution
|
||||
|
||||
process
|
||||
local
|
||||
args: like arguments
|
||||
l_table: like new_table
|
||||
s: STRING
|
||||
do
|
||||
args := arguments
|
||||
if args.is_empty then
|
||||
set_title ("Widgets")
|
||||
set_main_content ("...")
|
||||
else
|
||||
|
||||
end
|
||||
l_table := new_table
|
||||
|
||||
create s.make_empty
|
||||
l_table.append_to_html (theme, s)
|
||||
set_main_content (s)
|
||||
end
|
||||
|
||||
new_table: WSF_WIDGET_AGENT_TABLE [READABLE_STRING_8]
|
||||
local
|
||||
l_table: WSF_WIDGET_AGENT_TABLE [READABLE_STRING_8]
|
||||
do
|
||||
create l_table.make
|
||||
l_table.add_css_style ("width: 85%%; border: solid 1px #999; padding: 2px;")
|
||||
|
||||
l_table.set_column_count (3)
|
||||
l_table.column (1).set_title ("First")
|
||||
l_table.column (2).set_title ("Second")
|
||||
l_table.column (3).set_title ("Third")
|
||||
|
||||
l_table.column (1).add_css_style ("width: 20%%")
|
||||
l_table.column (2).add_css_style ("width: 40px")
|
||||
l_table.column (3).add_css_style ("width: 40px")
|
||||
|
||||
l_table.set_data (<<"foo", "bar", "foobar">>)
|
||||
l_table.set_foot_data (<<"abc", "def">>)
|
||||
l_table.set_compute_item_function (agent (d: READABLE_STRING_8): WSF_WIDGET_TABLE_ROW
|
||||
local
|
||||
i: INTEGER
|
||||
w: WSF_WIDGET_TABLE_ITEM
|
||||
do
|
||||
create Result.make (d.count)
|
||||
if d.is_case_insensitive_equal ("bar") then
|
||||
Result.add_css_style ("background-color: #ccf;")
|
||||
end
|
||||
across
|
||||
d as c
|
||||
loop
|
||||
i := i + 1
|
||||
create w.make_with_text (c.item.out)
|
||||
if i = 1 then
|
||||
w.add_css_style ("background-color: #333; color: white; font-weight: bold;")
|
||||
elseif i > 3 then
|
||||
w.add_css_style ("color: red; border: solid 1px red; padding: 3px;")
|
||||
end
|
||||
Result.force (w)
|
||||
end
|
||||
end)
|
||||
|
||||
Result := l_table
|
||||
end
|
||||
|
||||
arguments: ARRAY [READABLE_STRING_32]
|
||||
-- Path parameters arguments related to {/vars}
|
||||
do
|
||||
if
|
||||
attached {WSF_TABLE} request.path_parameter ("args") as lst and then
|
||||
attached lst.as_array_of_string as arr
|
||||
then
|
||||
Result := arr
|
||||
else
|
||||
create Result.make_empty
|
||||
end
|
||||
|
||||
Result.rebase (1)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -9,6 +9,9 @@ class
|
||||
|
||||
inherit
|
||||
CMS_MODULE
|
||||
redefine
|
||||
permissions
|
||||
end
|
||||
|
||||
CMS_HOOK_MENU_ALTER
|
||||
|
||||
@@ -39,25 +42,19 @@ feature {CMS_SERVICE} -- Registration
|
||||
|
||||
feature -- Hooks
|
||||
|
||||
permissions (a_service: CMS_SERVICE): LIST [CMS_PERMISSION]
|
||||
do
|
||||
Result := Precursor (a_service)
|
||||
Result.extend ("shutdown")
|
||||
end
|
||||
|
||||
menu_alter (a_menu_system: CMS_MENU_SYSTEM; a_execution: CMS_EXECUTION)
|
||||
local
|
||||
lnk: CMS_LOCAL_LINK
|
||||
do
|
||||
create lnk.make ("Shutdown", "/admin/shutdown/")
|
||||
lnk.set_permission_arguments (<<"admin shutdown">>)
|
||||
lnk.set_permission_arguments (<<"shutdown">>)
|
||||
a_menu_system.management_menu.extend (lnk)
|
||||
|
||||
end
|
||||
|
||||
links: HASH_TABLE [CMS_MODULE_LINK, STRING]
|
||||
-- Link indexed by path
|
||||
local
|
||||
-- lnk: CMS_MODULE_LINK
|
||||
do
|
||||
create Result.make (3)
|
||||
-- create lnk.make ("Date/time demo")
|
||||
-- lnk.set_callback (agent process_date_time_demo, <<"arg">>)
|
||||
-- Result["/demo/date/{arg}"] := lnk
|
||||
end
|
||||
|
||||
handle_shutdown (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
|
||||
@@ -8,11 +8,6 @@ class
|
||||
WEB_CMS
|
||||
|
||||
inherit
|
||||
CMS_SERVICE
|
||||
redefine
|
||||
modules
|
||||
end
|
||||
|
||||
WSF_DEFAULT_SERVICE
|
||||
redefine
|
||||
initialize
|
||||
@@ -21,47 +16,15 @@ inherit
|
||||
create
|
||||
make_and_launch
|
||||
|
||||
feature -- Initialization
|
||||
|
||||
base_url: detachable READABLE_STRING_8
|
||||
|
||||
server_base_url: detachable READABLE_STRING_8
|
||||
-- Base url (related to absolute path).
|
||||
--| Mainly pertinent when run from a standalone server.
|
||||
do
|
||||
Result := base_url
|
||||
end
|
||||
|
||||
modules: ARRAYED_LIST [CMS_MODULE]
|
||||
local
|
||||
m: CMS_MODULE
|
||||
once
|
||||
Result := Precursor
|
||||
|
||||
-- Others
|
||||
create {DEMO_MODULE} m.make (Current)
|
||||
m.enable
|
||||
Result.extend (m)
|
||||
|
||||
create {SHUTDOWN_MODULE} m.make
|
||||
m.enable
|
||||
Result.extend (m)
|
||||
|
||||
-- create {EIFFEL_LOGIN_MODULE} m.make
|
||||
-- m.enable
|
||||
-- Result.extend (m)
|
||||
end
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
local
|
||||
args: ARGUMENTS
|
||||
cfg: detachable STRING
|
||||
args: ARGUMENTS_32
|
||||
cfg: detachable READABLE_STRING_32
|
||||
i,n: INTEGER
|
||||
cms_config: CMS_CONFIGURATION
|
||||
opts: WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI
|
||||
do
|
||||
--| Arguments
|
||||
create args
|
||||
from
|
||||
i := 1
|
||||
@@ -70,7 +33,7 @@ feature {NONE} -- Initialization
|
||||
i > n or cfg /= Void
|
||||
loop
|
||||
if attached args.argument (i) as s then
|
||||
if s.same_string ("--config") or s.same_string ("-c") then
|
||||
if s.same_string_general ("--config") or s.same_string_general ("-c") then
|
||||
if i < n then
|
||||
cfg := args.argument (i + 1)
|
||||
end
|
||||
@@ -80,43 +43,92 @@ feature {NONE} -- Initialization
|
||||
end
|
||||
if cfg = Void then
|
||||
if file_exists ("cms.ini") then
|
||||
cfg := "cms.ini"
|
||||
cfg := {STRING_32} "cms.ini"
|
||||
end
|
||||
end
|
||||
if cfg /= Void then
|
||||
create cms_config.make_from_file (cfg)
|
||||
-- (create {EXECUTION_ENVIRONMENT}).change_working_directory (dir)
|
||||
else
|
||||
create cms_config.make
|
||||
end
|
||||
|
||||
--| EWF settings
|
||||
create opts.make_from_file ("ewf.ini")
|
||||
service_options := opts
|
||||
service_options := create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI}.make_from_file ("ewf.ini")
|
||||
Precursor
|
||||
|
||||
--| CMS settings
|
||||
base_url := cms_config.site_base_url (base_url)
|
||||
initialize_cms (cms_config)
|
||||
site_email := cms_config.site_email (site_email)
|
||||
site_name := cms_config.site_name (site_name)
|
||||
|
||||
on_launched
|
||||
--| CMS initialization
|
||||
launch_cms (cms_setup (cfg))
|
||||
end
|
||||
|
||||
on_launched
|
||||
cms_setup (a_cfg_fn: detachable READABLE_STRING_GENERAL): CMS_CUSTOM_SETUP
|
||||
do
|
||||
if a_cfg_fn /= Void then
|
||||
create Result.make_from_file (a_cfg_fn)
|
||||
else
|
||||
create Result -- Default
|
||||
end
|
||||
setup_modules (Result)
|
||||
setup_storage (Result)
|
||||
end
|
||||
|
||||
launch_cms (a_setup: CMS_SETUP)
|
||||
local
|
||||
cms: CMS_SERVICE
|
||||
do
|
||||
create cms.make (a_setup)
|
||||
on_launched (cms)
|
||||
cms_service := cms
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
cms_service: CMS_SERVICE
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
cms_service.execute (req, res)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
setup_modules (a_setup: CMS_SETUP)
|
||||
local
|
||||
m: CMS_MODULE
|
||||
do
|
||||
create {DEMO_MODULE} m.make
|
||||
m.enable
|
||||
a_setup.add_module (m)
|
||||
|
||||
create {SHUTDOWN_MODULE} m.make
|
||||
m.enable
|
||||
a_setup.add_module (m)
|
||||
|
||||
create {DEBUG_MODULE} m.make
|
||||
m.enable
|
||||
a_setup.add_module (m)
|
||||
|
||||
create {OPENID_MODULE} m.make
|
||||
m.enable
|
||||
a_setup.add_module (m)
|
||||
end
|
||||
|
||||
setup_storage (a_setup: CMS_SETUP)
|
||||
do
|
||||
|
||||
end
|
||||
|
||||
feature -- Event
|
||||
|
||||
on_launched (cms: CMS_SERVICE)
|
||||
local
|
||||
e: CMS_EMAIL
|
||||
do
|
||||
create e.make (site_email, site_email, "[" + site_name + "] launched...", "The site [" + site_name + "] was launched at " + (create {DATE_TIME}.make_now_utc).out + " UTC.")
|
||||
mailer.safe_process_email (e)
|
||||
create e.make (cms.site_email, cms.site_email, "[" + cms.site_name + "] launched...", "The site [" + cms.site_name + "] was launched at " + (create {DATE_TIME}.make_now_utc).out + " UTC.")
|
||||
cms.mailer.safe_process_email (e)
|
||||
end
|
||||
|
||||
file_exists (fn: STRING): BOOLEAN
|
||||
feature -- Helper
|
||||
|
||||
file_exists (fn: READABLE_STRING_GENERAL): BOOLEAN
|
||||
local
|
||||
f: RAW_FILE
|
||||
do
|
||||
create f.make (fn)
|
||||
create f.make_with_name (fn)
|
||||
Result := f.exists and then f.is_readable
|
||||
end
|
||||
|
||||
|
||||
@@ -7,8 +7,13 @@ note
|
||||
class
|
||||
CMS_CONFIGURATION
|
||||
|
||||
--inherit
|
||||
-- SHARED_EXECUTION_ENVIRONMENT
|
||||
inherit
|
||||
ANY
|
||||
|
||||
SHARED_EXECUTION_ENVIRONMENT
|
||||
export
|
||||
{NONE} all
|
||||
end
|
||||
|
||||
create
|
||||
make,
|
||||
@@ -18,15 +23,19 @@ feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
create options.make (10)
|
||||
create options.make_equal (10)
|
||||
analyze
|
||||
end
|
||||
|
||||
make_from_file (a_filename: READABLE_STRING_32)
|
||||
make_from_file (a_filename: READABLE_STRING_GENERAL)
|
||||
-- Initialize `Current'.
|
||||
local
|
||||
p: PATH
|
||||
do
|
||||
make
|
||||
import (a_filename)
|
||||
create p.make_from_string (a_filename)
|
||||
configuration_location := p
|
||||
import_from_path (p)
|
||||
analyze
|
||||
end
|
||||
|
||||
@@ -40,81 +49,54 @@ feature {NONE} -- Initialization
|
||||
|
||||
feature -- Access
|
||||
|
||||
configuration_location: detachable PATH
|
||||
|
||||
option (a_name: READABLE_STRING_GENERAL): detachable ANY
|
||||
do
|
||||
Result := options.item (a_name.as_string_8)
|
||||
Result := options.item (a_name)
|
||||
end
|
||||
|
||||
options: HASH_TABLE [STRING, STRING]
|
||||
options: STRING_TABLE [STRING_32]
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
append_to_string (s: STRING)
|
||||
local
|
||||
utf: UTF_CONVERTER
|
||||
do
|
||||
s.append ("Options:%N")
|
||||
across
|
||||
options as c
|
||||
loop
|
||||
s.append (c.key.to_string_8)
|
||||
s.append_character ('=')
|
||||
utf.string_32_into_utf_8_string_8 (c.item, s)
|
||||
s.append_character ('%N')
|
||||
end
|
||||
|
||||
s.append ("Specific:%N")
|
||||
s.append ("root_location=" + root_location.utf_8_name + "%N")
|
||||
s.append ("var_location=" + var_location.utf_8_name + "%N")
|
||||
s.append ("files_location=" + files_location.utf_8_name + "%N")
|
||||
s.append ("themes_location=" + themes_location.utf_8_name + "%N")
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_option (a_name: READABLE_STRING_GENERAL; a_value: STRING)
|
||||
set_option (a_name: READABLE_STRING_GENERAL; a_value: STRING_32)
|
||||
do
|
||||
options.force (a_value, a_name.as_string_8)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
var_location: READABLE_STRING_8
|
||||
var_location: PATH
|
||||
|
||||
get_var_location
|
||||
local
|
||||
res: STRING_32
|
||||
do
|
||||
if attached options.item ("var-dir") as s then
|
||||
res := s
|
||||
else
|
||||
res := execution_environment.current_working_directory
|
||||
end
|
||||
if res.ends_with ("/") then
|
||||
res.remove_tail (1)
|
||||
end
|
||||
var_location := res
|
||||
end
|
||||
root_location: PATH
|
||||
|
||||
root_location: READABLE_STRING_8
|
||||
files_location: PATH
|
||||
|
||||
get_root_location
|
||||
local
|
||||
res: STRING_32
|
||||
do
|
||||
if attached options.item ("root-dir") as s then
|
||||
res := s
|
||||
else
|
||||
res := execution_environment.current_working_directory
|
||||
end
|
||||
if res.ends_with ("/") then
|
||||
res.remove_tail (1)
|
||||
end
|
||||
root_location := res
|
||||
end
|
||||
|
||||
files_location: STRING
|
||||
|
||||
get_files_location
|
||||
do
|
||||
if attached options.item ("files-dir") as s then
|
||||
files_location := s
|
||||
else
|
||||
files_location := "files"
|
||||
end
|
||||
end
|
||||
|
||||
themes_location: STRING
|
||||
|
||||
get_themes_location
|
||||
local
|
||||
dn: DIRECTORY_NAME
|
||||
do
|
||||
if attached options.item ("themes-dir") as s then
|
||||
themes_location := s
|
||||
else
|
||||
create dn.make_from_string (root_location)
|
||||
dn.extend ("theme")
|
||||
themes_location := dn.string
|
||||
end
|
||||
end
|
||||
themes_location: PATH
|
||||
|
||||
theme_name (dft: detachable like theme_name): READABLE_STRING_8
|
||||
do
|
||||
@@ -127,6 +109,15 @@ feature -- Access
|
||||
end
|
||||
end
|
||||
|
||||
site_id: READABLE_STRING_8
|
||||
do
|
||||
if attached options.item ("site.id") as s then
|
||||
Result := s
|
||||
else
|
||||
Result := "_EWF_CMS_NO_ID_"
|
||||
end
|
||||
end
|
||||
|
||||
site_name (dft: like site_name): READABLE_STRING_8
|
||||
do
|
||||
if attached options.item ("site.name") as s then
|
||||
@@ -136,21 +127,33 @@ feature -- Access
|
||||
end
|
||||
end
|
||||
|
||||
site_base_url (dft: like site_base_url): detachable READABLE_STRING_8
|
||||
site_url (dft: like site_url): READABLE_STRING_8
|
||||
do
|
||||
if attached options.item ("site.base_url") as s then
|
||||
if attached options.item ("site.url") as s then
|
||||
Result := s
|
||||
else
|
||||
Result := dft
|
||||
end
|
||||
if Result /= Void then
|
||||
if Result.is_empty then
|
||||
Result := Void
|
||||
elseif not Result.starts_with ("/") then
|
||||
Result := "/" + Result
|
||||
if Result.ends_with ("/") then
|
||||
Result := Result.substring (1, Result.count - 1)
|
||||
end
|
||||
-- ok
|
||||
elseif not Result.ends_with ("/") then
|
||||
Result := Result + "/"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
site_script_url (dft: like site_script_url): detachable READABLE_STRING_8
|
||||
do
|
||||
if attached options.item ("site.script_url") as s then
|
||||
Result := s
|
||||
else
|
||||
Result := dft
|
||||
end
|
||||
if Result /= Void then
|
||||
if Result.is_empty then
|
||||
elseif not Result.ends_with ("/") then
|
||||
Result := Result + "/"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -164,17 +167,67 @@ feature -- Access
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
get_var_location
|
||||
local
|
||||
utf: UTF_CONVERTER
|
||||
do
|
||||
if attached options.item ("var-dir") as s then
|
||||
create var_location.make_from_string (utf.utf_8_string_8_to_escaped_string_32 (s))
|
||||
else
|
||||
var_location := execution_environment.current_working_path
|
||||
end
|
||||
end
|
||||
|
||||
get_root_location
|
||||
local
|
||||
utf: UTF_CONVERTER
|
||||
do
|
||||
if attached options.item ("root-dir") as s then
|
||||
create root_location.make_from_string (utf.utf_8_string_8_to_escaped_string_32 (s))
|
||||
else
|
||||
root_location := execution_environment.current_working_path
|
||||
end
|
||||
end
|
||||
|
||||
get_files_location
|
||||
local
|
||||
utf: UTF_CONVERTER
|
||||
do
|
||||
if attached options.item ("files-dir") as s then
|
||||
create files_location.make_from_string (utf.utf_8_string_8_to_escaped_string_32 (s))
|
||||
else
|
||||
create files_location.make_from_string ("files")
|
||||
end
|
||||
end
|
||||
|
||||
get_themes_location
|
||||
local
|
||||
utf: UTF_CONVERTER
|
||||
do
|
||||
if attached options.item ("themes-dir") as s then
|
||||
create themes_location.make_from_string (utf.utf_8_string_8_to_escaped_string_32 (s))
|
||||
else
|
||||
themes_location := root_location.extended ("themes")
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
import (a_filename: READABLE_STRING_32)
|
||||
import_from_file (fn: READABLE_STRING_GENERAL)
|
||||
do
|
||||
import_from_path (create {PATH}.make_from_string (fn))
|
||||
end
|
||||
|
||||
import_from_path (a_filename: PATH)
|
||||
-- Import ini file content
|
||||
local
|
||||
f: PLAIN_TEXT_FILE
|
||||
l,v: STRING_8
|
||||
p: INTEGER
|
||||
do
|
||||
--FIXME: handle unicode filename here.
|
||||
create f.make (a_filename)
|
||||
create f.make_with_path (a_filename)
|
||||
if f.exists and f.is_readable then
|
||||
f.open_read
|
||||
from
|
||||
@@ -184,15 +237,24 @@ feature {NONE} -- Implementation
|
||||
loop
|
||||
l := f.last_string
|
||||
l.left_adjust
|
||||
if not l.is_empty and then l[1] /= '#' then
|
||||
p := l.index_of ('=', 1)
|
||||
if p > 1 then
|
||||
v := l.substring (p + 1, l.count)
|
||||
l.keep_head (p - 1)
|
||||
v.left_adjust
|
||||
v.right_adjust
|
||||
l.right_adjust
|
||||
set_option (l.as_lower, v)
|
||||
if not l.is_empty then
|
||||
if l[1] = '#' then
|
||||
-- commented line
|
||||
else
|
||||
p := l.index_of ('=', 1)
|
||||
if p > 1 then
|
||||
v := l.substring (p + 1, l.count)
|
||||
l.keep_head (p - 1)
|
||||
v.left_adjust
|
||||
v.right_adjust
|
||||
l.right_adjust
|
||||
|
||||
if l.is_case_insensitive_equal ("@include") then
|
||||
import_from_file (resolved_string (v))
|
||||
else
|
||||
set_option (l.as_lower, resolved_string (v))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
f.read_line
|
||||
@@ -203,9 +265,47 @@ feature {NONE} -- Implementation
|
||||
|
||||
feature {NONE} -- Environment
|
||||
|
||||
Execution_environment: EXECUTION_ENVIRONMENT
|
||||
once
|
||||
create Result
|
||||
resolved_string (s: READABLE_STRING_8): STRING_32
|
||||
-- Resolved `s' using `options' or else environment variables.
|
||||
local
|
||||
i,n,b,e: INTEGER
|
||||
k: detachable READABLE_STRING_8
|
||||
do
|
||||
from
|
||||
i := 1
|
||||
n := s.count
|
||||
create Result.make (s.count)
|
||||
until
|
||||
i > n
|
||||
loop
|
||||
if i + 1 < n and then s[i] = '$' and then s[i+1] = '{' then
|
||||
b := i + 2
|
||||
e := s.index_of ('}', b) - 1
|
||||
if e > 0 then
|
||||
k := s.substring (b, e)
|
||||
if attached option (k) as v then
|
||||
if attached {READABLE_STRING_32} v as s32 then
|
||||
Result.append (s32)
|
||||
else
|
||||
Result.append (v.out)
|
||||
end
|
||||
i := e + 1
|
||||
elseif attached execution_environment.item (k) as v then
|
||||
Result.append (v)
|
||||
i := e + 1
|
||||
else
|
||||
Result.extend (s[i])
|
||||
end
|
||||
else
|
||||
Result.extend (s[i])
|
||||
end
|
||||
else
|
||||
Result.extend (s[i])
|
||||
end
|
||||
i := i + 1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
18
draft/application/cms/src/cms_custom_setup.e
Normal file
18
draft/application/cms/src/cms_custom_setup.e
Normal file
@@ -0,0 +1,18 @@
|
||||
note
|
||||
description: "Summary description for {CMS_CUSTOM_SETUP}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_CUSTOM_SETUP
|
||||
|
||||
inherit
|
||||
CMS_DEFAULT_SETUP
|
||||
|
||||
create
|
||||
default_create,
|
||||
make,
|
||||
make_from_file
|
||||
|
||||
end
|
||||
132
draft/application/cms/src/cms_default_setup.e
Normal file
132
draft/application/cms/src/cms_default_setup.e
Normal file
@@ -0,0 +1,132 @@
|
||||
note
|
||||
description: "Summary description for {CMS_DEFAULT_SETUP}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_DEFAULT_SETUP
|
||||
|
||||
inherit
|
||||
CMS_SETUP
|
||||
redefine
|
||||
default_create
|
||||
end
|
||||
|
||||
create
|
||||
default_create,
|
||||
make,
|
||||
make_from_file
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_cfg: CMS_CONFIGURATION)
|
||||
do
|
||||
configuration := a_cfg
|
||||
default_create
|
||||
end
|
||||
|
||||
make_from_file (fn: READABLE_STRING_GENERAL)
|
||||
local
|
||||
cfg: CMS_CONFIGURATION
|
||||
do
|
||||
create cfg.make_from_file (fn)
|
||||
make (cfg)
|
||||
end
|
||||
|
||||
default_create
|
||||
do
|
||||
Precursor
|
||||
build_modules
|
||||
build_storage
|
||||
build_session_manager
|
||||
build_auth_engine
|
||||
build_mailer
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
modules: ARRAYED_LIST [CMS_MODULE]
|
||||
|
||||
storage: CMS_STORAGE
|
||||
-- CMS persistent layer
|
||||
|
||||
session_manager: WSF_SESSION_MANAGER
|
||||
-- CMS Session manager
|
||||
|
||||
auth_engine: CMS_AUTH_ENGINE
|
||||
-- CMS Authentication engine
|
||||
|
||||
mailer: NOTIFICATION_MAILER
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
build_modules
|
||||
local
|
||||
m: CMS_MODULE
|
||||
do
|
||||
create modules.make (3)
|
||||
|
||||
-- Core
|
||||
create {USER_MODULE} m.make
|
||||
m.enable
|
||||
modules.extend (m)
|
||||
|
||||
create {ADMIN_MODULE} m.make
|
||||
m.enable
|
||||
modules.extend (m)
|
||||
|
||||
create {NODE_MODULE} m.make
|
||||
m.enable
|
||||
modules.extend (m)
|
||||
end
|
||||
|
||||
build_storage
|
||||
local
|
||||
dn: PATH
|
||||
do
|
||||
if attached configuration as cfg and then attached cfg.var_location as l_site_var_dir then
|
||||
dn := l_site_var_dir
|
||||
else
|
||||
create dn.make_current
|
||||
end
|
||||
create {CMS_SED_STORAGE} storage.make (dn.extended ("_storage_").name)
|
||||
end
|
||||
|
||||
build_session_manager
|
||||
local
|
||||
dn: PATH
|
||||
do
|
||||
if attached configuration as cfg and then attached cfg.var_location as l_site_var_dir then
|
||||
dn := l_site_var_dir
|
||||
else
|
||||
create dn.make_empty
|
||||
end
|
||||
dn := dn.extended ("_storage_").extended ("_sessions_")
|
||||
create {WSF_FS_SESSION_MANAGER} session_manager.make_with_folder (dn.name)
|
||||
end
|
||||
|
||||
build_auth_engine
|
||||
do
|
||||
create {CMS_STORAGE_AUTH_ENGINE} auth_engine.make (storage)
|
||||
end
|
||||
|
||||
build_mailer
|
||||
local
|
||||
ch_mailer: NOTIFICATION_CHAIN_MAILER
|
||||
st_mailer: CMS_STORAGE_MAILER
|
||||
do
|
||||
create st_mailer.make (storage)
|
||||
create ch_mailer.make (st_mailer)
|
||||
ch_mailer.set_next (create {NOTIFICATION_SENDMAIL_MAILER})
|
||||
mailer := ch_mailer
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
add_module (m: CMS_MODULE)
|
||||
do
|
||||
modules.force (m)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -51,11 +51,6 @@ feature {CMS_SESSION_CONTROLER} -- Access: restricted
|
||||
|
||||
controller: CMS_SESSION_CONTROLER
|
||||
|
||||
base_url: detachable READABLE_STRING_8
|
||||
do
|
||||
Result := service.server_base_url
|
||||
end
|
||||
|
||||
pending_messages_session_item_name: STRING = "cms.pending_messages"
|
||||
-- Session item name to get the pending messages.
|
||||
|
||||
@@ -73,7 +68,7 @@ feature -- Access: CMS
|
||||
|
||||
feature -- Permission
|
||||
|
||||
has_permissions (lst: detachable ITERABLE [READABLE_STRING_8]): BOOLEAN
|
||||
frozen has_permissions (lst: detachable ITERABLE [READABLE_STRING_8]): BOOLEAN
|
||||
do
|
||||
if lst = Void then
|
||||
Result := True
|
||||
@@ -82,9 +77,11 @@ feature -- Permission
|
||||
end
|
||||
end
|
||||
|
||||
has_permission (s: detachable READABLE_STRING_8): BOOLEAN
|
||||
frozen has_permission (s: detachable READABLE_STRING_8): BOOLEAN
|
||||
-- Anonymous or Current `user' has permission for `s'
|
||||
--| `s' could be "create page",
|
||||
local
|
||||
u: detachable CMS_USER
|
||||
do
|
||||
if s = Void then
|
||||
Result := True
|
||||
@@ -92,10 +89,11 @@ feature -- Permission
|
||||
if s.same_string ("authenticated") then
|
||||
Result := authenticated
|
||||
else
|
||||
if s.has_substring ("admin") or s.has_substring ("users") then
|
||||
Result := attached user as u and then u.is_admin
|
||||
else
|
||||
u := user
|
||||
if u /= Void and then u.is_admin then
|
||||
Result := True
|
||||
else
|
||||
Result := service.user_has_permission (u, s)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -266,7 +264,7 @@ feature -- Message
|
||||
add_message (a_msg, "success")
|
||||
end
|
||||
|
||||
report_form_errors (fd: CMS_FORM_DATA)
|
||||
report_form_errors (fd: WSF_FORM_DATA)
|
||||
require
|
||||
has_error: not fd.is_valid
|
||||
do
|
||||
@@ -388,11 +386,11 @@ feature -- Generation
|
||||
across
|
||||
a_menu_system as c
|
||||
loop
|
||||
prepare_menu (c.item)
|
||||
prepare_links (c.item)
|
||||
end
|
||||
end
|
||||
|
||||
prepare_menu (a_menu: CMS_MENU)
|
||||
prepare_links (a_menu: CMS_LINK_COMPOSITE)
|
||||
local
|
||||
to_remove: ARRAYED_LIST [CMS_LINK]
|
||||
do
|
||||
@@ -401,11 +399,17 @@ feature -- Generation
|
||||
a_menu as c
|
||||
loop
|
||||
if attached {CMS_LOCAL_LINK} c.item as lm then
|
||||
if not has_permissions (lm.permission_arguments) then
|
||||
if attached lm.permission_arguments as perms and then not has_permissions (perms) then
|
||||
to_remove.force (lm)
|
||||
else
|
||||
-- if lm.permission_arguments is Void , this is permitted
|
||||
lm.get_is_active (request)
|
||||
if attached {CMS_LINK_COMPOSITE} lm as comp then
|
||||
prepare_links (comp)
|
||||
end
|
||||
end
|
||||
elseif attached {CMS_LINK_COMPOSITE} c.item as comp then
|
||||
prepare_links (comp)
|
||||
end
|
||||
end
|
||||
across
|
||||
@@ -633,6 +637,8 @@ feature {NONE} -- Implementation
|
||||
set_session_item ("last_access", (create {DATE_TIME}.make_now_utc))
|
||||
end
|
||||
|
||||
feature -- Access: Session
|
||||
|
||||
session_item (k: READABLE_STRING_GENERAL): detachable ANY
|
||||
do
|
||||
Result := controller.session.item (k)
|
||||
|
||||
@@ -6,21 +6,31 @@ note
|
||||
even for a specific handler.
|
||||
]"
|
||||
|
||||
deferred class
|
||||
class
|
||||
CMS_SERVICE
|
||||
|
||||
feature -- Initialization
|
||||
inherit
|
||||
WSF_SERVICE
|
||||
|
||||
initialize_cms (a_cfg: detachable CMS_CONFIGURATION)
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_setup: CMS_SETUP)
|
||||
local
|
||||
cfg: detachable CMS_CONFIGURATION
|
||||
do
|
||||
cfg := a_cfg
|
||||
cfg := a_setup.configuration
|
||||
if cfg = Void then
|
||||
create cfg.make
|
||||
end
|
||||
|
||||
site_url := "" -- Fixme
|
||||
configuration := cfg
|
||||
base_url := a_setup.base_url
|
||||
|
||||
site_id := cfg.site_id
|
||||
site_url := cfg.site_url ("")
|
||||
site_name := cfg.site_name ("EWF::CMS")
|
||||
site_email := cfg.site_email ("webmaster")
|
||||
site_dir := cfg.root_location
|
||||
@@ -29,10 +39,18 @@ feature -- Initialization
|
||||
themes_location := cfg.themes_location
|
||||
theme_name := cfg.theme_name ("default")
|
||||
|
||||
set_script_url (cfg.site_script_url (Void)) -- Temporary value
|
||||
|
||||
compute_theme_resource_location
|
||||
|
||||
|
||||
create content_types.make (3)
|
||||
|
||||
modules := a_setup.modules
|
||||
storage := a_setup.storage
|
||||
session_manager := a_setup.session_manager
|
||||
auth_engine := a_setup.auth_engine
|
||||
mailer := a_setup.mailer
|
||||
|
||||
initialize_storage
|
||||
initialize_auth_engine
|
||||
initialize_session_manager
|
||||
@@ -42,23 +60,17 @@ feature -- Initialization
|
||||
end
|
||||
|
||||
initialize_session_manager
|
||||
local
|
||||
dn: DIRECTORY_NAME
|
||||
-- local
|
||||
-- dn: DIRECTORY_NAME
|
||||
do
|
||||
create dn.make_from_string (site_var_dir)
|
||||
dn.extend ("_storage_")
|
||||
dn.extend ("_sessions_")
|
||||
create {WSF_FS_SESSION_MANAGER} session_manager.make_with_folder (dn.string)
|
||||
-- create dn.make_from_string (site_var_dir)
|
||||
-- dn.extend ("_storage_")
|
||||
-- dn.extend ("_sessions_")
|
||||
-- create {WSF_FS_SESSION_MANAGER} session_manager.make_with_folder (dn.string)
|
||||
end
|
||||
|
||||
initialize_storage
|
||||
local
|
||||
dn: DIRECTORY_NAME
|
||||
-- u: CMS_USER
|
||||
do
|
||||
create dn.make_from_string (site_var_dir)
|
||||
dn.extend ("_storage_")
|
||||
create {CMS_SED_STORAGE} storage.make (dn.string)
|
||||
if not storage.has_user then
|
||||
initialize_users
|
||||
end
|
||||
@@ -69,28 +81,35 @@ feature -- Initialization
|
||||
has_no_user: not storage.has_user
|
||||
local
|
||||
u: CMS_USER
|
||||
ur: CMS_USER_ROLE
|
||||
do
|
||||
create u.make_new ("admin")
|
||||
u.set_password ("istrator")
|
||||
storage.save_user (u)
|
||||
|
||||
create ur.make_with_id (1, "anonymous")
|
||||
storage.save_user_role (ur)
|
||||
create ur.make_with_id (2, "authenticated")
|
||||
ur.add_permission ("create page")
|
||||
ur.add_permission ("edit page")
|
||||
storage.save_user_role (ur)
|
||||
end
|
||||
|
||||
initialize_mailer
|
||||
local
|
||||
ch_mailer: CMS_CHAIN_MAILER
|
||||
st_mailer: CMS_STORAGE_MAILER
|
||||
-- ch_mailer: CMS_CHAIN_MAILER
|
||||
-- st_mailer: CMS_STORAGE_MAILER
|
||||
do
|
||||
create st_mailer.make (storage)
|
||||
create ch_mailer.make (st_mailer)
|
||||
ch_mailer.set_next (create {CMS_SENDMAIL_MAILER})
|
||||
mailer := ch_mailer
|
||||
-- create st_mailer.make (storage)
|
||||
-- create ch_mailer.make (st_mailer)
|
||||
-- ch_mailer.set_next (create {CMS_SENDMAIL_MAILER})
|
||||
-- mailer := ch_mailer
|
||||
end
|
||||
|
||||
initialize_router
|
||||
local
|
||||
-- h: CMS_HANDLER
|
||||
file_hdl: CMS_FILE_SYSTEM_HANDLER
|
||||
dn: DIRECTORY_NAME
|
||||
do
|
||||
create router.make (10)
|
||||
router.set_base_url (base_url)
|
||||
@@ -98,13 +117,12 @@ feature -- Initialization
|
||||
router.map (create {WSF_URI_MAPPING}.make ("/", create {CMS_HANDLER}.make (agent handle_home)))
|
||||
router.map (create {WSF_URI_MAPPING}.make ("/favicon.ico", create {CMS_HANDLER}.make (agent handle_favicon)))
|
||||
|
||||
create file_hdl.make (files_location)
|
||||
create file_hdl.make_with_path (files_location)
|
||||
file_hdl.disable_index
|
||||
file_hdl.set_max_age (8*60*60)
|
||||
router.map (create {WSF_STARTS_WITH_MAPPING}.make ("/files/", file_hdl))
|
||||
|
||||
create dn.make_from_string (theme_resource_location)
|
||||
create file_hdl.make (theme_resource_location)
|
||||
create file_hdl.make_with_path (theme_resource_location)
|
||||
file_hdl.set_max_age (8*60*60)
|
||||
router.map (create {WSF_STARTS_WITH_MAPPING}.make ("/theme/", file_hdl))
|
||||
end
|
||||
@@ -125,31 +143,16 @@ feature -- Initialization
|
||||
|
||||
initialize_auth_engine
|
||||
do
|
||||
create {CMS_STORAGE_AUTH_ENGINE} auth_engine.make (storage)
|
||||
-- create {CMS_STORAGE_AUTH_ENGINE} auth_engine.make (storage)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
configuration: CMS_CONFIGURATION
|
||||
|
||||
auth_engine: CMS_AUTH_ENGINE
|
||||
|
||||
modules: ARRAYED_LIST [CMS_MODULE]
|
||||
local
|
||||
m: CMS_MODULE
|
||||
once
|
||||
create Result.make (10)
|
||||
-- Core
|
||||
create {USER_MODULE} m.make (Current)
|
||||
m.enable
|
||||
Result.extend (m)
|
||||
|
||||
create {ADMIN_MODULE} m.make (Current)
|
||||
m.enable
|
||||
Result.extend (m)
|
||||
|
||||
create {NODE_MODULE} m.make (Current)
|
||||
m.enable
|
||||
Result.extend (m)
|
||||
end
|
||||
modules: LIST [CMS_MODULE]
|
||||
|
||||
feature -- Hook: menu_alter
|
||||
|
||||
@@ -162,7 +165,9 @@ feature -- Hook: menu_alter
|
||||
create lst.make (1)
|
||||
menu_alter_hooks := lst
|
||||
end
|
||||
lst.force (h)
|
||||
if not lst.has (h) then
|
||||
lst.force (h)
|
||||
end
|
||||
end
|
||||
|
||||
menu_alter_hooks: detachable ARRAYED_LIST [CMS_HOOK_MENU_ALTER]
|
||||
@@ -189,18 +194,20 @@ feature -- Hook: form_alter
|
||||
create lst.make (1)
|
||||
form_alter_hooks := lst
|
||||
end
|
||||
lst.force (h)
|
||||
if not lst.has (h) then
|
||||
lst.force (h)
|
||||
end
|
||||
end
|
||||
|
||||
form_alter_hooks: detachable ARRAYED_LIST [CMS_HOOK_FORM_ALTER]
|
||||
|
||||
call_form_alter_hooks (f: CMS_FORM; a_execution: CMS_EXECUTION)
|
||||
call_form_alter_hooks (f: CMS_FORM; a_form_data: detachable WSF_FORM_DATA; a_execution: CMS_EXECUTION)
|
||||
do
|
||||
if attached form_alter_hooks as lst then
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
c.item.form_alter (f, a_execution)
|
||||
c.item.form_alter (f, a_form_data, a_execution)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -216,7 +223,9 @@ feature -- Hook: block
|
||||
create lst.make (1)
|
||||
block_hooks := lst
|
||||
end
|
||||
lst.force (h)
|
||||
if not lst.has (h) then
|
||||
lst.force (h)
|
||||
end
|
||||
end
|
||||
|
||||
block_hooks: detachable ARRAYED_LIST [CMS_HOOK_BLOCK]
|
||||
@@ -238,59 +247,33 @@ feature -- Hook: block
|
||||
|
||||
feature -- Router
|
||||
|
||||
site_id: READABLE_STRING_8
|
||||
|
||||
site_name: READABLE_STRING_32
|
||||
|
||||
site_email: READABLE_STRING_8
|
||||
|
||||
site_url: READABLE_STRING_8
|
||||
|
||||
site_dir: READABLE_STRING_8
|
||||
site_dir: PATH
|
||||
|
||||
site_var_dir: READABLE_STRING_8
|
||||
site_var_dir: PATH
|
||||
|
||||
files_location: READABLE_STRING_8
|
||||
files_location: PATH
|
||||
|
||||
themes_location: READABLE_STRING_8
|
||||
themes_location: PATH
|
||||
|
||||
compute_theme_resource_location
|
||||
local
|
||||
dn: DIRECTORY_NAME
|
||||
do
|
||||
create dn.make_from_string (themes_location)
|
||||
dn.extend (theme_name)
|
||||
dn.extend ("res")
|
||||
theme_resource_location := dn.string
|
||||
theme_resource_location := themes_location.extended (theme_name).extended ("res")
|
||||
end
|
||||
|
||||
theme_resource_location: READABLE_STRING_8
|
||||
theme_resource_location: PATH
|
||||
|
||||
theme_name: READABLE_STRING_32
|
||||
|
||||
front_path: STRING
|
||||
do
|
||||
if attached base_url as l_base_url then
|
||||
Result := l_base_url + "/"
|
||||
else
|
||||
Result := "/"
|
||||
end
|
||||
end
|
||||
|
||||
router: WSF_ROUTER
|
||||
|
||||
base_url: detachable READABLE_STRING_8
|
||||
-- Base url (related to the script path).
|
||||
deferred
|
||||
ensure
|
||||
valid_base_url: (Result /= Void and then Result.is_empty) implies (Result.starts_with ("/") and not Result.ends_with ("/"))
|
||||
end
|
||||
|
||||
server_base_url: detachable READABLE_STRING_8
|
||||
-- Base url (related to absolute path).
|
||||
deferred
|
||||
ensure
|
||||
valid_base_url: (Result /= Void and then Result.is_empty) implies (Result.starts_with ("/") and not Result.ends_with ("/"))
|
||||
end
|
||||
|
||||
map_uri_template (tpl: STRING; proc: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]])
|
||||
do
|
||||
router.map (create {WSF_URI_TEMPLATE_MAPPING}.make_from_template (tpl, create {CMS_HANDLER}.make (proc)))
|
||||
@@ -301,6 +284,61 @@ feature -- Router
|
||||
router.map (create {WSF_URI_MAPPING}.make (a_uri, create {CMS_HANDLER}.make (proc)))
|
||||
end
|
||||
|
||||
feature -- URL related
|
||||
|
||||
front_path: STRING
|
||||
do
|
||||
if attached base_url as l_base_url then
|
||||
Result := l_base_url + "/"
|
||||
else
|
||||
Result := "/"
|
||||
end
|
||||
end
|
||||
|
||||
urls_set: BOOLEAN
|
||||
|
||||
initialize_urls (req: WSF_REQUEST)
|
||||
local
|
||||
u: like base_url
|
||||
do
|
||||
if not urls_set then
|
||||
u := base_url
|
||||
if u = Void then
|
||||
u := ""
|
||||
end
|
||||
urls_set := True
|
||||
if site_url.is_empty then
|
||||
site_url := req.absolute_script_url (u)
|
||||
end
|
||||
set_script_url (req.script_url (u))
|
||||
end
|
||||
end
|
||||
|
||||
base_url: detachable READABLE_STRING_8
|
||||
-- Base url (related to the script path).
|
||||
|
||||
script_url: detachable READABLE_STRING_8
|
||||
|
||||
set_script_url (a_url: like script_url)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
if a_url = Void then
|
||||
script_url := Void
|
||||
elseif not a_url.is_empty then
|
||||
if a_url.ends_with ("/") then
|
||||
create s.make_from_string (a_url)
|
||||
else
|
||||
create s.make (a_url.count + 1)
|
||||
s.append (a_url)
|
||||
s.append_character ('/')
|
||||
end
|
||||
script_url := s
|
||||
end
|
||||
ensure
|
||||
attached script_url as l_url implies l_url.ends_with ("/")
|
||||
end
|
||||
|
||||
feature -- Report
|
||||
|
||||
is_front_page (req: WSF_REQUEST): BOOLEAN
|
||||
@@ -308,12 +346,21 @@ feature -- Report
|
||||
Result := req.path_info.same_string (front_path)
|
||||
end
|
||||
|
||||
feature {CMS_EXECUTION, CMS_MODULE} -- Security report
|
||||
|
||||
user_has_permission (u: detachable CMS_USER; s: detachable READABLE_STRING_8): BOOLEAN
|
||||
-- Anonymous or user `u' has permission for `s' ?
|
||||
--| `s' could be "create page",
|
||||
do
|
||||
Result := storage.user_has_permission (u, s)
|
||||
end
|
||||
|
||||
feature -- Storage
|
||||
|
||||
session_controller (req: WSF_REQUEST): CMS_SESSION_CONTROLER
|
||||
-- New session controller for request `req'
|
||||
do
|
||||
create Result.make (req, session_manager)
|
||||
create Result.make (req, session_manager, site_id)
|
||||
end
|
||||
|
||||
session_manager: WSF_SESSION_MANAGER
|
||||
@@ -359,18 +406,15 @@ feature -- Content type
|
||||
|
||||
feature -- Notification
|
||||
|
||||
mailer: CMS_MAILER
|
||||
mailer: NOTIFICATION_MAILER
|
||||
|
||||
feature -- Core Execution
|
||||
|
||||
handle_favicon (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
local
|
||||
fres: WSF_FILE_RESPONSE
|
||||
fn: FILE_NAME
|
||||
do
|
||||
create fn.make_from_string (theme_resource_location)
|
||||
fn.set_file_name ("favicon.ico")
|
||||
create fres.make (fn.string)
|
||||
create fres.make_with_path (theme_resource_location.extended ("favicon.ico"))
|
||||
fres.set_expires_in_seconds (7 * 24 * 60 * 60) -- 7 jours
|
||||
res.send (fres)
|
||||
end
|
||||
@@ -380,27 +424,18 @@ feature -- Core Execution
|
||||
(create {HOME_CMS_EXECUTION}.make (req, res, Current)).execute
|
||||
end
|
||||
|
||||
-- handle_theme (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- do
|
||||
-- (create {THEME_CMS_EXECUTION}.make (req, res, Current)).execute
|
||||
-- end
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Default request handler if no other are relevant
|
||||
local
|
||||
e: CMS_EXECUTION
|
||||
-- not_found: WSF_NOT_FOUND_RESPONSE
|
||||
sess: WSF_ROUTER_SESSION
|
||||
do
|
||||
if site_url.is_empty then
|
||||
site_url := req.absolute_script_url ("")
|
||||
end
|
||||
if attached router.dispatch_and_return_handler (req, res) as p then
|
||||
-- ok
|
||||
else
|
||||
initialize_urls (req)
|
||||
create sess
|
||||
router.dispatch (req, res, sess)
|
||||
if not sess.dispatched then
|
||||
create {NOT_FOUND_CMS_EXECUTION} e.make (req, res, Current)
|
||||
e.execute
|
||||
-- create not_found.make
|
||||
-- res.send (not_found)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
55
draft/application/cms/src/cms_setup.e
Normal file
55
draft/application/cms/src/cms_setup.e
Normal file
@@ -0,0 +1,55 @@
|
||||
note
|
||||
description: "Summary description for {CMS_SETUP}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_SETUP
|
||||
|
||||
feature -- Access
|
||||
|
||||
configuration: detachable CMS_CONFIGURATION
|
||||
|
||||
base_url: detachable READABLE_STRING_8
|
||||
|
||||
modules: LIST [CMS_MODULE]
|
||||
deferred
|
||||
end
|
||||
|
||||
storage: CMS_STORAGE
|
||||
-- CMS persistent layer
|
||||
deferred
|
||||
end
|
||||
|
||||
session_manager: WSF_SESSION_MANAGER
|
||||
-- CMS Session manager
|
||||
deferred
|
||||
end
|
||||
|
||||
auth_engine: CMS_AUTH_ENGINE
|
||||
-- CMS Authentication engine
|
||||
deferred
|
||||
end
|
||||
|
||||
mailer: NOTIFICATION_MAILER
|
||||
-- CMS email engine
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
set_base_url (a_base_url: like base_url)
|
||||
do
|
||||
if a_base_url /= Void and then not a_base_url.is_empty then
|
||||
base_url := a_base_url
|
||||
else
|
||||
base_url := Void
|
||||
end
|
||||
end
|
||||
|
||||
add_module (m: CMS_MODULE)
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
@@ -27,7 +27,7 @@ feature -- Access
|
||||
|
||||
theme: DEFAULT_CMS_THEME
|
||||
|
||||
prepare (page: CMS_HTML_PAGE)
|
||||
prepare (page: CMS_HTML_PAGE)
|
||||
do
|
||||
variables.make (10)
|
||||
|
||||
@@ -69,9 +69,9 @@ feature {NONE} -- Implementation
|
||||
</div>
|
||||
<div id="main-wrapper">
|
||||
<div id="main">
|
||||
<div id="first_sidebar" class="sidebar">$first_sidebar</div>
|
||||
<div id="content">$content</div>
|
||||
<div id="second_sidebar" class="sidebar">$second_sidebar</div>
|
||||
<div id="first_sidebar" class="sidebar $first_sidebar_css_class">$first_sidebar</div>
|
||||
<div id="content" class="$content_css_class">$content</div>
|
||||
<div id="second_sidebar" class="sidebar $second_sidebar_css_class">$second_sidebar</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="footer">$footer</div>
|
||||
|
||||
@@ -55,52 +55,6 @@ feature -- Access
|
||||
Result := tpl
|
||||
end
|
||||
|
||||
-- css: STRING
|
||||
-- do
|
||||
-- Result := "[
|
||||
-- body { margin: 0; }
|
||||
-- div#header { background-color: #00a; color: #fff; border: solid 1px #00a; padding: 10px;}
|
||||
-- div#header img#logo { float: left; margin: 3px; }
|
||||
-- div#header div#title {font-size: 180%; font-weight: bold; }
|
||||
-- ul.horizontal {
|
||||
-- list-style-type: none;
|
||||
-- }
|
||||
-- ul.horizontal li {
|
||||
-- display: inline;
|
||||
-- padding: 5px;
|
||||
-- }
|
||||
-- div#first-menu { padding: 5px; color: #ccf; background-color: #006; }
|
||||
-- div#first-menu a { color: #ccf; }
|
||||
-- div#second-menu { color: #99f; background-color: #333; }
|
||||
-- div#second-menu a { color: #99f; }
|
||||
--
|
||||
-- div#left_sidebar {
|
||||
-- width: 150px;
|
||||
-- border: solid 1px #009;
|
||||
-- margin: 5px;
|
||||
-- padding: 5px;
|
||||
-- width: 150px;
|
||||
-- display: inline;
|
||||
-- float: left;
|
||||
-- position: relative;
|
||||
-- }
|
||||
-- div#main-wrapper {
|
||||
-- clear: both;
|
||||
-- display: block;
|
||||
-- height: 0;
|
||||
-- }
|
||||
-- div#main { margin: 0; padding: 10px; clear: both; height:0; display: block; }
|
||||
-- div#content { padding: 10px; border: solid 1px #00f;
|
||||
-- width: 700px;
|
||||
-- display: inline;
|
||||
-- float: left;
|
||||
-- position: relative;
|
||||
-- }
|
||||
-- div#footer { margin: 10px 0 10px 0; clear: both; display: block; text-align: center; padding: 10px; border-top: solid 1px #00f; color: #fff; background-color: #333;}
|
||||
-- div#footer a { color: #ff0; }
|
||||
-- ]"
|
||||
-- end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
prepare (page: CMS_HTML_PAGE)
|
||||
|
||||
43
draft/application/cms/src/form/cms_form.e
Normal file
43
draft/application/cms/src/form/cms_form.e
Normal file
@@ -0,0 +1,43 @@
|
||||
note
|
||||
description: "Summary description for {CMS_FORM}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_FORM
|
||||
|
||||
inherit
|
||||
WSF_FORM
|
||||
rename
|
||||
process as process_form
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Basic operation
|
||||
|
||||
prepare (a_execution: CMS_EXECUTION)
|
||||
do
|
||||
a_execution.service.call_form_alter_hooks (Current, Void, a_execution)
|
||||
end
|
||||
|
||||
process (a_execution: CMS_EXECUTION)
|
||||
do
|
||||
process_form (a_execution.request, agent on_prepared (a_execution, ?), agent on_processed (a_execution, ?))
|
||||
end
|
||||
|
||||
on_prepared (a_execution: CMS_EXECUTION; fd: WSF_FORM_DATA)
|
||||
do
|
||||
a_execution.service.call_form_alter_hooks (Current, fd, a_execution)
|
||||
end
|
||||
|
||||
on_processed (a_execution: CMS_EXECUTION; fd: WSF_FORM_DATA)
|
||||
do
|
||||
if not fd.is_valid or fd.has_error then
|
||||
a_execution.report_form_errors (fd)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -36,12 +36,14 @@ feature -- Execution
|
||||
b: STRING_8
|
||||
s: STRING
|
||||
do
|
||||
create b.make_empty
|
||||
if attached text as t then
|
||||
if attached main_content as m then
|
||||
-- ok
|
||||
elseif attached text as t then
|
||||
create b.make_empty
|
||||
s := request.path_info
|
||||
if attached service.base_url as l_base_url then
|
||||
if s.starts_with (l_base_url) then
|
||||
s.remove_head (l_base_url.count)
|
||||
if attached service.script_url as l_script_url then
|
||||
if s.starts_with (l_script_url) then
|
||||
s.remove_head (l_script_url.count)
|
||||
if s.starts_with ("/") then
|
||||
s.remove_head (1)
|
||||
end
|
||||
@@ -49,10 +51,11 @@ feature -- Execution
|
||||
end
|
||||
set_title (s)
|
||||
b.append (t)
|
||||
set_main_content (b)
|
||||
else
|
||||
set_title ("Page Not Found")
|
||||
set_title ("...")
|
||||
set_main_content ("")
|
||||
end
|
||||
set_main_content (b)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -11,6 +11,7 @@ inherit
|
||||
WSF_FILE_SYSTEM_HANDLER
|
||||
|
||||
create
|
||||
make
|
||||
make,
|
||||
make_with_path
|
||||
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ note
|
||||
Summary description for {CMS_HOOK_AUTO_REGISTER}.
|
||||
When inheriting from this class, the declared hooks are automatically
|
||||
registered, otherwise, each descendant has to add it to the cms service
|
||||
itself.
|
||||
itself.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
@@ -24,6 +24,10 @@ feature -- Hook
|
||||
if attached {CMS_HOOK_BLOCK} Current as h_block then
|
||||
a_service.add_block_hook (h_block)
|
||||
end
|
||||
if attached {CMS_HOOK_FORM_ALTER} Current as h_block then
|
||||
a_service.add_form_alter_hook (h_block)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -12,7 +12,7 @@ inherit
|
||||
|
||||
feature -- Hook
|
||||
|
||||
form_alter (a_form: CMS_FORM; a_execution: CMS_EXECUTION)
|
||||
form_alter (a_form: CMS_FORM; a_form_data: detachable WSF_FORM_DATA; a_execution: CMS_EXECUTION)
|
||||
deferred
|
||||
end
|
||||
|
||||
|
||||
@@ -7,69 +7,20 @@ note
|
||||
class
|
||||
CMS_API_OPTIONS
|
||||
|
||||
inherit
|
||||
WSF_API_OPTIONS
|
||||
|
||||
create
|
||||
make,
|
||||
make_from_manifest
|
||||
|
||||
convert
|
||||
make_from_manifest ({ ARRAY [TUPLE [key: STRING; value: detachable ANY]],
|
||||
ARRAY [TUPLE [STRING_8, ARRAY [TUPLE [STRING_8, READABLE_STRING_32]]]]
|
||||
ARRAY [TUPLE [STRING_8, ARRAY [TUPLE [STRING_8, STRING_32]]]],
|
||||
ARRAY [TUPLE [STRING_8, ARRAY [TUPLE [STRING_8, STRING_8]]]]
|
||||
})
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (n: INTEGER)
|
||||
do
|
||||
create table.make (n)
|
||||
end
|
||||
|
||||
make_from_manifest (lst: ARRAY [TUPLE [key: STRING; value: detachable ANY]])
|
||||
do
|
||||
make (lst.count)
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
force (c.item.value, c.item.key)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
item (k: STRING): detachable ANY
|
||||
do
|
||||
Result := table.item (k)
|
||||
end
|
||||
|
||||
force (v: detachable ANY; k: STRING)
|
||||
do
|
||||
table.force (v, k)
|
||||
end
|
||||
|
||||
boolean_item (k: STRING; dft: BOOLEAN): BOOLEAN
|
||||
do
|
||||
if attached {BOOLEAN} item (k) as b then
|
||||
Result := b
|
||||
else
|
||||
Result := dft
|
||||
end
|
||||
end
|
||||
|
||||
string_general_item (k: STRING): detachable READABLE_STRING_GENERAL
|
||||
do
|
||||
if attached {READABLE_STRING_GENERAL} item (k) as s then
|
||||
Result := s
|
||||
end
|
||||
end
|
||||
|
||||
string_item, string_8_item (k: STRING): detachable READABLE_STRING_8
|
||||
do
|
||||
if attached {READABLE_STRING_8} item (k) as s then
|
||||
Result := s
|
||||
end
|
||||
end
|
||||
|
||||
table: HASH_TABLE [detachable ANY, STRING]
|
||||
|
||||
invariant
|
||||
|
||||
end
|
||||
|
||||
@@ -7,96 +7,28 @@ note
|
||||
deferred class
|
||||
CMS_COMMON_API
|
||||
|
||||
inherit
|
||||
WSF_API_UTILITIES
|
||||
|
||||
feature {NONE} -- Access
|
||||
|
||||
service: CMS_SERVICE
|
||||
deferred
|
||||
end
|
||||
|
||||
base_url: detachable READABLE_STRING_8
|
||||
-- Base url if any.
|
||||
deferred
|
||||
site_url: READABLE_STRING_8
|
||||
do
|
||||
Result := service.site_url
|
||||
end
|
||||
|
||||
based_path (p: STRING): STRING
|
||||
-- Path `p' in the context of the `base_url'
|
||||
base_url: detachable READABLE_STRING_8
|
||||
-- Base url if any.
|
||||
do
|
||||
if attached base_url as l_base_url then
|
||||
create Result.make_from_string (l_base_url)
|
||||
Result.append (p)
|
||||
else
|
||||
Result := p
|
||||
end
|
||||
Result := service.script_url
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
url_encoded (s: detachable READABLE_STRING_GENERAL): STRING_8
|
||||
local
|
||||
enc: URL_ENCODER
|
||||
do
|
||||
create enc
|
||||
if s /= Void then
|
||||
Result := enc.general_encoded_string (s)
|
||||
else
|
||||
create Result.make_empty
|
||||
end
|
||||
end
|
||||
|
||||
html_encoded (s: detachable READABLE_STRING_GENERAL): STRING_8
|
||||
local
|
||||
enc: HTML_ENCODER
|
||||
do
|
||||
create enc
|
||||
if s /= Void then
|
||||
Result := enc.general_encoded_string (s)
|
||||
else
|
||||
create Result.make_empty
|
||||
end
|
||||
end
|
||||
|
||||
link (a_text: detachable READABLE_STRING_GENERAL; a_path: STRING; opts: detachable CMS_API_OPTIONS): STRING
|
||||
local
|
||||
l_html: BOOLEAN
|
||||
t: READABLE_STRING_GENERAL
|
||||
do
|
||||
l_html := True
|
||||
if opts /= Void then
|
||||
l_html := opts.boolean_item ("html", l_html)
|
||||
end
|
||||
Result := "<a href=%"" + checked_url (url (a_path, opts)) + "%">"
|
||||
if a_text = Void then
|
||||
t := a_path
|
||||
else
|
||||
t := a_text
|
||||
end
|
||||
if l_html then
|
||||
Result.append (html_encoded (t))
|
||||
else
|
||||
Result.append (checked_plain (t))
|
||||
end
|
||||
Result.append ("</a>")
|
||||
end
|
||||
|
||||
link_with_raw_text (a_text: detachable READABLE_STRING_8; a_path: STRING; opts: detachable CMS_API_OPTIONS): STRING
|
||||
local
|
||||
l_html: BOOLEAN
|
||||
t: READABLE_STRING_8
|
||||
do
|
||||
l_html := True
|
||||
if opts /= Void then
|
||||
l_html := opts.boolean_item ("html", l_html)
|
||||
end
|
||||
Result := "<a href=%"" + checked_url (url (a_path, opts)) + "%">"
|
||||
if a_text = Void then
|
||||
t := a_path
|
||||
else
|
||||
t := a_text
|
||||
end
|
||||
Result.append (t)
|
||||
Result.append ("</a>")
|
||||
end
|
||||
|
||||
user_link (u: CMS_USER): like link
|
||||
do
|
||||
Result := link (u.name, "/user/" + u.id.out, Void)
|
||||
@@ -117,61 +49,6 @@ feature -- Access
|
||||
Result := url ("/node/" + n.id.out, Void)
|
||||
end
|
||||
|
||||
url (a_path: STRING; opts: detachable CMS_API_OPTIONS): STRING
|
||||
local
|
||||
q,f: detachable STRING_8
|
||||
l_abs: BOOLEAN
|
||||
do
|
||||
l_abs := False
|
||||
|
||||
Result := based_path (a_path)
|
||||
if opts /= Void then
|
||||
l_abs := opts.boolean_item ("absolute", l_abs)
|
||||
if attached opts.item ("query") as l_query then
|
||||
if attached {READABLE_STRING_8} l_query as s_value then
|
||||
q := s_value
|
||||
elseif attached {ITERABLE [TUPLE [key, value: READABLE_STRING_GENERAL]]} l_query as lst then
|
||||
create q.make_empty
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
if q.is_empty then
|
||||
else
|
||||
q.append_character ('&')
|
||||
end
|
||||
q.append (url_encoded (c.item.key))
|
||||
q.append_character ('=')
|
||||
q.append (url_encoded (c.item.value))
|
||||
end
|
||||
end
|
||||
end
|
||||
if attached opts.string_item ("fragment") as s_frag then
|
||||
f := s_frag
|
||||
end
|
||||
end
|
||||
if q /= Void then
|
||||
Result.append ("?" + q)
|
||||
end
|
||||
if f /= Void then
|
||||
Result.append ("#" + f)
|
||||
end
|
||||
if l_abs then
|
||||
if Result.substring_index ("://", 1) = 0 then
|
||||
Result.prepend (service.site_url)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
checked_url (a_url: STRING): STRING
|
||||
do
|
||||
Result := a_url
|
||||
end
|
||||
|
||||
checked_plain (a_text: READABLE_STRING_GENERAL): STRING_8
|
||||
do
|
||||
Result := html_encoder.general_encoded_string (a_text)
|
||||
end
|
||||
|
||||
feature -- Helper
|
||||
|
||||
is_empty (s: detachable READABLE_STRING_GENERAL): BOOLEAN
|
||||
@@ -217,9 +94,9 @@ feature {NONE} -- Implementation
|
||||
end
|
||||
end
|
||||
|
||||
html_encoder: HTML_ENCODER
|
||||
once ("thread")
|
||||
create Result
|
||||
end
|
||||
-- html_encoder: HTML_ENCODER
|
||||
-- once ("thread")
|
||||
-- create Result
|
||||
-- end
|
||||
|
||||
end
|
||||
|
||||
@@ -18,8 +18,9 @@ create
|
||||
|
||||
feature -- Initialization
|
||||
|
||||
make (req: WSF_REQUEST; a_mngr: like session_manager)
|
||||
make (req: WSF_REQUEST; a_mngr: like session_manager; a_site_id: READABLE_STRING_8)
|
||||
do
|
||||
site_id := a_site_id
|
||||
session_manager := a_mngr
|
||||
initialize
|
||||
create discarded_sessions.make
|
||||
@@ -28,9 +29,13 @@ feature -- Initialization
|
||||
|
||||
initialize
|
||||
do
|
||||
session_id_name := "_EWF_CMS_SESSID__" + site_id
|
||||
end
|
||||
|
||||
feature -- Session access
|
||||
feature -- Session access
|
||||
|
||||
site_id: READABLE_STRING_8
|
||||
-- Associated CMS site id.
|
||||
|
||||
session: WSF_SESSION
|
||||
|
||||
@@ -129,6 +134,6 @@ feature -- Session internal
|
||||
|
||||
session_request_variable_name: STRING = "_EWF_CMS_SESSION_"
|
||||
|
||||
session_id_name: STRING = "_EWF_CMS_SESSID"
|
||||
session_id_name: READABLE_STRING_8
|
||||
|
||||
end
|
||||
|
||||
@@ -63,6 +63,41 @@ feature -- Access
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Permission
|
||||
|
||||
roles: detachable LIST [INTEGER]
|
||||
-- Associated roles
|
||||
-- Note: does not include "authenticated" and "anonymous".
|
||||
|
||||
has_role (r: CMS_USER_ROLE): BOOLEAN
|
||||
do
|
||||
Result := attached roles as lst and then lst.has (r.id)
|
||||
end
|
||||
|
||||
clear_roles
|
||||
do
|
||||
roles := Void
|
||||
end
|
||||
|
||||
add_role_by_id (r_id: INTEGER)
|
||||
local
|
||||
lst: like roles
|
||||
do
|
||||
lst := roles
|
||||
if r_id <= 2 then -- Anonymous=1 and Authenticated=2
|
||||
lst := roles
|
||||
if lst /= Void and then lst.is_empty then
|
||||
clear_roles
|
||||
end
|
||||
else
|
||||
if lst = Void then
|
||||
create {ARRAYED_SET [INTEGER]} lst.make (1)
|
||||
roles := lst
|
||||
end
|
||||
lst.force (r_id)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
has_id: BOOLEAN
|
||||
|
||||
85
draft/application/cms/src/kernel/cms_user_role.e
Normal file
85
draft/application/cms/src/kernel/cms_user_role.e
Normal file
@@ -0,0 +1,85 @@
|
||||
note
|
||||
description: "Summary description for {CMS_USER_ROLE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_USER_ROLE
|
||||
|
||||
inherit
|
||||
ANY
|
||||
redefine
|
||||
is_equal
|
||||
end
|
||||
|
||||
create
|
||||
make,
|
||||
make_with_id
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_with_id (a_id: like id; a_name: like name)
|
||||
do
|
||||
id := a_id
|
||||
make (a_name)
|
||||
end
|
||||
|
||||
make (a_name: like name)
|
||||
do
|
||||
name := a_name
|
||||
create {ARRAYED_LIST [READABLE_STRING_8]} permissions.make (0)
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
has_id: BOOLEAN
|
||||
do
|
||||
Result := id > 0
|
||||
end
|
||||
|
||||
has_permission (p: READABLE_STRING_8): BOOLEAN
|
||||
do
|
||||
Result := across permissions as c some c.item.is_case_insensitive_equal (p) end
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
id: INTEGER
|
||||
|
||||
name: READABLE_STRING_8
|
||||
|
||||
permissions: LIST [READABLE_STRING_8]
|
||||
|
||||
feature -- Comparison
|
||||
|
||||
same_user_role (r: CMS_USER_ROLE): BOOLEAN
|
||||
do
|
||||
Result := r.id = id
|
||||
end
|
||||
|
||||
is_equal (other: like Current): BOOLEAN
|
||||
-- Is `other' attached to an object considered
|
||||
-- equal to current object?
|
||||
do
|
||||
Result := id = other.id
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
set_id (a_id: like id)
|
||||
do
|
||||
id := a_id
|
||||
end
|
||||
|
||||
set_name (a_name: like name)
|
||||
do
|
||||
name := a_name
|
||||
end
|
||||
|
||||
add_permission (n: READABLE_STRING_8)
|
||||
do
|
||||
permissions.force (n)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -34,14 +34,14 @@ feature -- Factory
|
||||
deferred
|
||||
end
|
||||
|
||||
change_node (a_execution: CMS_EXECUTION; a_form_data: CMS_FORM_DATA; a_node: like new_node)
|
||||
change_node (a_execution: CMS_EXECUTION; a_form_data: WSF_FORM_DATA; a_node: like new_node)
|
||||
-- Apply data from `a_form_data' to a_node
|
||||
require
|
||||
a_node.has_id
|
||||
deferred
|
||||
end
|
||||
|
||||
new_node (a_execution: CMS_EXECUTION; a_form_data: CMS_FORM_DATA; a_node: detachable like new_node): CMS_NODE
|
||||
new_node (a_execution: CMS_EXECUTION; a_form_data: WSF_FORM_DATA; a_node: detachable like new_node): CMS_NODE
|
||||
-- New content created with `a_form_data'
|
||||
deferred
|
||||
ensure
|
||||
|
||||
@@ -75,7 +75,9 @@ feature -- Conversion
|
||||
else
|
||||
i := a_text.index_of ('<', p2 + 1)
|
||||
end
|
||||
if i > 0 then
|
||||
if i = 0 then
|
||||
p1 := p2 + 1
|
||||
else
|
||||
l_new.append (a_text.substring (p2 + 1, i - 1))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,181 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_FORM}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_FORM
|
||||
|
||||
inherit
|
||||
ITERABLE [CMS_FORM_ITEM]
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_action: READABLE_STRING_8; a_id: READABLE_STRING_8)
|
||||
do
|
||||
action := a_action
|
||||
id := a_id
|
||||
|
||||
create html_classes.make (2)
|
||||
create items.make (10)
|
||||
set_method_post
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
action: READABLE_STRING_8
|
||||
-- URL for the web form
|
||||
|
||||
id: READABLE_STRING_8
|
||||
-- Id of the form
|
||||
|
||||
count: INTEGER
|
||||
do
|
||||
Result := items.count
|
||||
end
|
||||
|
||||
method: READABLE_STRING_8
|
||||
-- Form's method
|
||||
--| GET or POST
|
||||
|
||||
feature -- Validation
|
||||
|
||||
validation_action: detachable PROCEDURE [ANY, TUPLE [CMS_FORM_DATA]]
|
||||
-- Procedure to validate the data
|
||||
-- report error if not valid
|
||||
|
||||
-- submit_callbacks_actions: HASH_TABLE [PROCEDURE [ANY, TUPLE [CMS_FORM_DATA]], STRING]
|
||||
-- -- Submit callbacks indexed by submit names
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_method_get
|
||||
do
|
||||
method := "GET"
|
||||
end
|
||||
|
||||
set_method_post
|
||||
do
|
||||
method := "POST"
|
||||
end
|
||||
|
||||
set_validation_action (act: like validation_action)
|
||||
do
|
||||
validation_action := act
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
new_cursor: ITERATION_CURSOR [CMS_FORM_ITEM]
|
||||
-- Fresh cursor associated with current structure
|
||||
do
|
||||
Result := items.new_cursor
|
||||
end
|
||||
|
||||
feature -- Optional
|
||||
|
||||
html_classes: ARRAYED_LIST [STRING_8]
|
||||
|
||||
feature -- Items
|
||||
|
||||
has_field (a_name: READABLE_STRING_GENERAL): BOOLEAN
|
||||
do
|
||||
Result := across items as i some attached {CMS_FORM_FIELD} i.item as l_field and then l_field.name.same_string_general (a_name) end
|
||||
end
|
||||
|
||||
-- items_by_name (a_name: READABLE_STRING_GENERAL): detachable LIST [CMS_FORM_ITEM]
|
||||
-- local
|
||||
-- res: detachable ARRAYED_LIST [CMS_FORM_ITEM]
|
||||
-- do
|
||||
-- across
|
||||
-- items as c
|
||||
-- loop
|
||||
-- if c.item.name.same_string_general (a_name) then
|
||||
-- if res = Void then
|
||||
-- create res.make (1)
|
||||
-- end
|
||||
-- res.force (c.item)
|
||||
-- end
|
||||
-- end
|
||||
-- Result := res
|
||||
-- end
|
||||
|
||||
fields_by_name (a_name: READABLE_STRING_GENERAL): detachable LIST [CMS_FORM_FIELD]
|
||||
local
|
||||
res: detachable ARRAYED_LIST [CMS_FORM_FIELD]
|
||||
do
|
||||
across
|
||||
items as c
|
||||
loop
|
||||
if
|
||||
attached {CMS_FORM_FIELD} c.item as l_field and then
|
||||
l_field.name.same_string_general (a_name)
|
||||
then
|
||||
if res = Void then
|
||||
create res.make (1)
|
||||
end
|
||||
res.force (l_field)
|
||||
end
|
||||
end
|
||||
Result := res
|
||||
end
|
||||
|
||||
extend (i: CMS_FORM_ITEM)
|
||||
local
|
||||
n: READABLE_STRING_8
|
||||
do
|
||||
if attached {CMS_FORM_FIELD} i as l_field then
|
||||
n := l_field.name
|
||||
if n.is_empty then
|
||||
n := (items.count + 1).out
|
||||
l_field.update_name (n)
|
||||
end
|
||||
end
|
||||
items.force (i)
|
||||
end
|
||||
|
||||
extend_text (t: READABLE_STRING_8)
|
||||
do
|
||||
extend (create {CMS_FORM_RAW_TEXT}.make (t))
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
to_html (a_theme: CMS_THEME): STRING_8
|
||||
local
|
||||
s: STRING
|
||||
do
|
||||
Result := "<form action=%""+ action +"%" id=%""+ id +"%" method=%""+ method +"%" "
|
||||
if not html_classes.is_empty then
|
||||
create s.make_empty
|
||||
across
|
||||
html_classes as cl
|
||||
loop
|
||||
if not s.is_empty then
|
||||
s.extend (' ')
|
||||
end
|
||||
s.append (cl.item)
|
||||
end
|
||||
Result.append (" class=%"" + s + "%" ")
|
||||
end
|
||||
Result.append (">%N")
|
||||
across
|
||||
items as c
|
||||
loop
|
||||
Result.append (c.item.to_html (a_theme))
|
||||
end
|
||||
Result.append ("</form>%N")
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
items: ARRAYED_LIST [CMS_FORM_ITEM]
|
||||
-- name => item
|
||||
|
||||
invariant
|
||||
|
||||
end
|
||||
@@ -1,81 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_FORM_CHECKBOX_INPUT}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_FORM_CHECKBOX_INPUT
|
||||
|
||||
inherit
|
||||
CMS_FORM_INPUT
|
||||
rename
|
||||
default_value as value
|
||||
redefine
|
||||
specific_input_attributes_string,
|
||||
child_to_html
|
||||
end
|
||||
|
||||
CMS_FORM_SELECTABLE_ITEM
|
||||
rename
|
||||
is_selected as checked,
|
||||
set_is_selected as set_checked
|
||||
end
|
||||
|
||||
create
|
||||
make,
|
||||
make_with_text
|
||||
|
||||
feature -- Access
|
||||
|
||||
checked: BOOLEAN
|
||||
-- Current <input> element should be preselected when the page loads
|
||||
|
||||
input_type: STRING = "checkbox"
|
||||
|
||||
text: detachable READABLE_STRING_32
|
||||
|
||||
feature -- Status report
|
||||
|
||||
is_same_value (v: READABLE_STRING_32): BOOLEAN
|
||||
do
|
||||
Result := attached value as l_value and then v.same_string (l_value)
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
set_text (t: detachable READABLE_STRING_32)
|
||||
do
|
||||
text := t
|
||||
end
|
||||
|
||||
set_checked (b: like checked)
|
||||
do
|
||||
checked := b
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
child_to_html (a_theme: CMS_THEME): detachable READABLE_STRING_8
|
||||
-- Specific child element if any.
|
||||
--| To redefine if needed
|
||||
do
|
||||
if attached text as t then
|
||||
Result := a_theme.html_encoded (t)
|
||||
elseif attached value as v then
|
||||
Result := a_theme.html_encoded (v)
|
||||
end
|
||||
end
|
||||
|
||||
specific_input_attributes_string: detachable STRING_8
|
||||
-- Specific input attributes if any.
|
||||
-- To redefine if needed
|
||||
do
|
||||
if checked then
|
||||
Result := "checked=%"checked%""
|
||||
end
|
||||
end
|
||||
|
||||
invariant
|
||||
|
||||
end
|
||||
@@ -1,195 +0,0 @@
|
||||
note
|
||||
description : "Objects that ..."
|
||||
author : "$Author$"
|
||||
date : "$Date$"
|
||||
revision : "$Revision$"
|
||||
|
||||
class
|
||||
CMS_FORM_DATA
|
||||
|
||||
inherit
|
||||
TABLE_ITERABLE [detachable WSF_VALUE, READABLE_STRING_8]
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (req: WSF_REQUEST; a_form: CMS_FORM)
|
||||
-- Initialize `Current'.
|
||||
do
|
||||
form := a_form
|
||||
create items.make (a_form.count)
|
||||
get_items (req)
|
||||
validate
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
form: CMS_FORM
|
||||
|
||||
feature -- Status
|
||||
|
||||
is_valid: BOOLEAN
|
||||
do
|
||||
Result := errors = Void
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
item (a_name: READABLE_STRING_GENERAL): detachable WSF_VALUE
|
||||
do
|
||||
Result := items.item (a_name.as_string_8)
|
||||
end
|
||||
|
||||
string_item (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
|
||||
do
|
||||
if attached {WSF_STRING} item (a_name) as s then
|
||||
Result := s.value
|
||||
end
|
||||
end
|
||||
|
||||
integer_item (a_name: READABLE_STRING_GENERAL): INTEGER
|
||||
do
|
||||
if attached {WSF_STRING} item (a_name) as s and then s.is_integer then
|
||||
Result := s.integer_value
|
||||
end
|
||||
end
|
||||
|
||||
new_cursor: TABLE_ITERATION_CURSOR [detachable WSF_VALUE, READABLE_STRING_8]
|
||||
-- Fresh cursor associated with current structure
|
||||
do
|
||||
Result := items.new_cursor
|
||||
end
|
||||
|
||||
feature -- Basic operation
|
||||
|
||||
validate
|
||||
do
|
||||
across
|
||||
form as f
|
||||
loop
|
||||
if attached {CMS_FORM_FIELD} f.item as l_field then
|
||||
l_field.validate (Current)
|
||||
end
|
||||
end
|
||||
if attached form.validation_action as act then
|
||||
act.call ([Current])
|
||||
end
|
||||
end
|
||||
|
||||
set_fields_invalid (b: BOOLEAN; a_name: READABLE_STRING_GENERAL)
|
||||
do
|
||||
if attached form.fields_by_name (a_name) as lst then
|
||||
across
|
||||
lst as i
|
||||
loop
|
||||
i.item.set_is_invalid (b)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
apply_to_associated_form
|
||||
do
|
||||
if attached errors as errs then
|
||||
across
|
||||
errs as e
|
||||
loop
|
||||
if attached e.item as err then
|
||||
if attached err.field as e_field then
|
||||
set_fields_invalid (True, e_field.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
across
|
||||
items as c
|
||||
loop
|
||||
across
|
||||
form as i
|
||||
loop
|
||||
if attached {CMS_FORM_FIELD} i.item as l_field then
|
||||
if not attached {CMS_FORM_SUBMIT_INPUT} l_field then
|
||||
if l_field.name.same_string (c.key) then
|
||||
l_field.set_value (c.item)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
report_error (a_msg: READABLE_STRING_8)
|
||||
do
|
||||
add_error (Void, a_msg)
|
||||
ensure
|
||||
is_invalid: not is_valid
|
||||
end
|
||||
|
||||
report_invalid_field (a_field_name: READABLE_STRING_8; a_msg: READABLE_STRING_8)
|
||||
require
|
||||
has_field: form.has_field (a_field_name)
|
||||
do
|
||||
if attached form.fields_by_name (a_field_name) as lst then
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
add_error (c.item, a_msg)
|
||||
end
|
||||
end
|
||||
ensure
|
||||
is_invalid: not is_valid
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
get_items (req: WSF_REQUEST)
|
||||
do
|
||||
get_form_items (req, form)
|
||||
end
|
||||
|
||||
get_form_items (req: WSF_REQUEST; lst: ITERABLE [CMS_FORM_ITEM])
|
||||
local
|
||||
n: READABLE_STRING_8
|
||||
v: detachable WSF_VALUE
|
||||
do
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
if attached {CMS_FORM_FIELD} c.item as l_field then
|
||||
n := l_field.name
|
||||
v := req.form_parameter (n)
|
||||
if l_field.is_required and (v = Void or else v.is_empty) then
|
||||
add_error (l_field, "Field %"<em>" + l_field.name + "</em>%" is required")
|
||||
else
|
||||
items.force (v, n)
|
||||
end
|
||||
elseif attached {CMS_FORM_FIELD_SET} c.item as l_fieldset then
|
||||
get_form_items (req, l_fieldset)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
add_error (a_field: detachable CMS_FORM_FIELD; a_msg: detachable READABLE_STRING_8)
|
||||
local
|
||||
err: like errors
|
||||
do
|
||||
err := errors
|
||||
if err = Void then
|
||||
create err.make (1)
|
||||
errors := err
|
||||
end
|
||||
err.force ([a_field, a_msg])
|
||||
end
|
||||
|
||||
items: HASH_TABLE [detachable WSF_VALUE, READABLE_STRING_8]
|
||||
|
||||
feature -- Reports
|
||||
|
||||
errors: detachable ARRAYED_LIST [TUPLE [field: detachable CMS_FORM_FIELD; message: detachable READABLE_STRING_8]]
|
||||
|
||||
invariant
|
||||
|
||||
end
|
||||
@@ -1,65 +0,0 @@
|
||||
note
|
||||
description : "Objects that ..."
|
||||
author : "$Author$"
|
||||
date : "$Date$"
|
||||
revision : "$Revision$"
|
||||
|
||||
class
|
||||
CMS_FORM_DIV
|
||||
|
||||
inherit
|
||||
CMS_FORM_ITEM
|
||||
|
||||
ITERABLE [CMS_FORM_ITEM]
|
||||
|
||||
WITH_CSS_ID
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Initialize `Current'.
|
||||
do
|
||||
create items.make (0)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
new_cursor: ITERATION_CURSOR [CMS_FORM_ITEM]
|
||||
-- Fresh cursor associated with current structure
|
||||
do
|
||||
Result := items.new_cursor
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
extend (i: CMS_FORM_ITEM)
|
||||
do
|
||||
items.force (i)
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
to_html (a_theme: CMS_THEME): STRING_8
|
||||
do
|
||||
Result := "<div"
|
||||
append_css_class_to (Result, Void)
|
||||
append_css_id_to (Result)
|
||||
append_css_style_to (Result)
|
||||
|
||||
Result.append (">%N")
|
||||
across
|
||||
items as c
|
||||
loop
|
||||
Result.append (c.item.to_html (a_theme))
|
||||
end
|
||||
Result.append ("%N</div>%N")
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
items: ARRAYED_LIST [CMS_FORM_ITEM]
|
||||
|
||||
end
|
||||
@@ -1,77 +0,0 @@
|
||||
note
|
||||
description : "Objects that ..."
|
||||
author : "$Author$"
|
||||
date : "$Date$"
|
||||
revision : "$Revision$"
|
||||
|
||||
class
|
||||
CMS_FORM_FIELD_SET
|
||||
|
||||
inherit
|
||||
CMS_FORM_ITEM
|
||||
|
||||
ITERABLE [CMS_FORM_ITEM]
|
||||
|
||||
WITH_CSS_ID
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Initialize `Current'.
|
||||
do
|
||||
create items.make (0)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
legend: detachable READABLE_STRING_8
|
||||
|
||||
feature -- Access
|
||||
|
||||
new_cursor: ITERATION_CURSOR [CMS_FORM_ITEM]
|
||||
-- Fresh cursor associated with current structure
|
||||
do
|
||||
Result := items.new_cursor
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
set_legend (v: like legend)
|
||||
do
|
||||
legend := v
|
||||
end
|
||||
|
||||
extend (i: CMS_FORM_ITEM)
|
||||
do
|
||||
items.force (i)
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
to_html (a_theme: CMS_THEME): STRING_8
|
||||
do
|
||||
Result := "<fieldset"
|
||||
append_css_class_to (Result, Void)
|
||||
append_css_id_to (Result)
|
||||
append_css_style_to (Result)
|
||||
|
||||
Result.append (">%N")
|
||||
if attached legend as leg then
|
||||
Result.append ("<legend>" + leg + "</legend>%N")
|
||||
end
|
||||
across
|
||||
items as c
|
||||
loop
|
||||
Result.append (c.item.to_html (a_theme))
|
||||
end
|
||||
Result.append ("%N</fieldset>%N")
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
items: ARRAYED_LIST [CMS_FORM_ITEM]
|
||||
|
||||
end
|
||||
@@ -1,37 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_FORM_INPUT}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_FORM_HIDDEN_INPUT
|
||||
|
||||
inherit
|
||||
CMS_FORM_INPUT
|
||||
redefine
|
||||
input_type,
|
||||
item_to_html
|
||||
end
|
||||
|
||||
create
|
||||
make,
|
||||
make_with_text
|
||||
|
||||
feature -- Access
|
||||
|
||||
input_type: STRING
|
||||
once
|
||||
Result := "hidden"
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
item_to_html (a_theme: CMS_THEME): STRING_8
|
||||
do
|
||||
Result := "<div style=%"display:none%">"
|
||||
Result.append (Precursor (a_theme))
|
||||
Result.append ("</div>")
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,21 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_FORM_ITEM}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_FORM_ITEM
|
||||
|
||||
inherit
|
||||
WITH_CSS_CLASS
|
||||
|
||||
WITH_CSS_STYLE
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
to_html (a_theme: CMS_THEME): STRING_8
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,61 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_FORM_RADIO_INPUT}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_FORM_RADIO_INPUT
|
||||
|
||||
inherit
|
||||
CMS_FORM_INPUT
|
||||
rename
|
||||
default_value as value
|
||||
redefine
|
||||
specific_input_attributes_string
|
||||
end
|
||||
|
||||
CMS_FORM_SELECTABLE_ITEM
|
||||
rename
|
||||
is_selected as checked,
|
||||
set_is_selected as set_checked
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Access
|
||||
|
||||
checked: BOOLEAN
|
||||
-- Current <input> element should be preselected when the page loads
|
||||
|
||||
input_type: STRING = "radio"
|
||||
|
||||
feature -- Status report
|
||||
|
||||
is_same_value (v: READABLE_STRING_32): BOOLEAN
|
||||
do
|
||||
Result := attached value as l_value and then v.same_string (l_value)
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
set_checked (b: like checked)
|
||||
do
|
||||
checked := b
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
specific_input_attributes_string: detachable STRING_8
|
||||
-- Specific input attributes if any.
|
||||
-- To redefine if needed
|
||||
do
|
||||
if checked then
|
||||
Result := "checked=%"checked%""
|
||||
end
|
||||
end
|
||||
|
||||
invariant
|
||||
|
||||
end
|
||||
@@ -1,49 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_FORM_RAW_TEXT}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_FORM_RAW_TEXT
|
||||
|
||||
inherit
|
||||
CMS_FORM_ITEM
|
||||
redefine
|
||||
to_html
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_text: like text)
|
||||
do
|
||||
text := a_text
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
text: READABLE_STRING_8
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_value (v: detachable WSF_VALUE)
|
||||
do
|
||||
-- Not applicable
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
to_html (a_theme: CMS_THEME): STRING_8
|
||||
do
|
||||
Result := item_to_html (a_theme)
|
||||
end
|
||||
|
||||
item_to_html (a_theme: CMS_THEME): STRING_8
|
||||
do
|
||||
Result := text
|
||||
end
|
||||
|
||||
end
|
||||
@@ -29,6 +29,8 @@ feature -- Status report
|
||||
|
||||
is_expandable: BOOLEAN = False
|
||||
|
||||
has_children: BOOLEAN = False
|
||||
|
||||
children: detachable LIST [CMS_LINK]
|
||||
do
|
||||
end
|
||||
|
||||
@@ -10,6 +10,10 @@ deferred class
|
||||
inherit
|
||||
REFACTORING_HELPER
|
||||
|
||||
DEBUG_OUTPUT
|
||||
|
||||
ITERABLE [CMS_LINK]
|
||||
|
||||
feature -- Access
|
||||
|
||||
title: READABLE_STRING_32
|
||||
@@ -32,6 +36,10 @@ feature -- status report
|
||||
deferred
|
||||
end
|
||||
|
||||
has_children: BOOLEAN
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Query
|
||||
|
||||
parent: detachable CMS_LINK
|
||||
@@ -40,4 +48,24 @@ feature -- Query
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
new_cursor: ITERATION_CURSOR [CMS_LINK]
|
||||
-- Fresh cursor associated with current structure
|
||||
do
|
||||
if attached children as lst then
|
||||
Result := lst.new_cursor
|
||||
else
|
||||
Result := (create {ARRAYED_LIST [CMS_LINK]}.make (0)).new_cursor
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
debug_output: STRING
|
||||
-- String that should be displayed in debugger to represent `Current'.
|
||||
do
|
||||
Result := title.as_string_8 + " -> " + location
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
27
draft/application/cms/src/kernel/link/cms_link_composite.e
Normal file
27
draft/application/cms/src/kernel/link/cms_link_composite.e
Normal file
@@ -0,0 +1,27 @@
|
||||
note
|
||||
description: "Summary description for {CMS_LINK_COMPOSITE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_LINK_COMPOSITE
|
||||
|
||||
inherit
|
||||
ITERABLE [CMS_LINK]
|
||||
|
||||
feature -- Access
|
||||
|
||||
items: detachable LIST [CMS_LINK]
|
||||
deferred
|
||||
end
|
||||
|
||||
extend (lnk: CMS_LINK)
|
||||
deferred
|
||||
end
|
||||
|
||||
remove (lnk: CMS_LINK)
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
@@ -10,6 +10,13 @@ class
|
||||
inherit
|
||||
CMS_LINK
|
||||
|
||||
CMS_LINK_COMPOSITE
|
||||
rename
|
||||
items as children,
|
||||
extend as add_link,
|
||||
remove as remove_link
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
@@ -30,15 +37,55 @@ feature -- Status report
|
||||
is_active: BOOLEAN
|
||||
|
||||
is_expanded: BOOLEAN
|
||||
do
|
||||
Result := is_expandable and then internal_is_expanded
|
||||
end
|
||||
|
||||
is_expandable: BOOLEAN
|
||||
do
|
||||
Result := internal_is_expandable or internal_is_expanded or has_children
|
||||
end
|
||||
|
||||
permission_arguments: detachable ITERABLE [STRING]
|
||||
has_children: BOOLEAN
|
||||
do
|
||||
Result := attached children as l_children and then not l_children.is_empty
|
||||
end
|
||||
|
||||
permission_arguments: detachable ITERABLE [READABLE_STRING_8]
|
||||
|
||||
children: detachable LIST [CMS_LINK]
|
||||
|
||||
internal_is_expandable: BOOLEAN
|
||||
|
||||
internal_is_expanded: BOOLEAN
|
||||
|
||||
feature -- Element change
|
||||
|
||||
add_link (lnk: CMS_LINK)
|
||||
local
|
||||
lst: like children
|
||||
do
|
||||
lst := children
|
||||
if lst = Void then
|
||||
create {ARRAYED_LIST [CMS_LINK]} lst.make (1)
|
||||
children := lst
|
||||
end
|
||||
lst.force (lnk)
|
||||
end
|
||||
|
||||
remove_link (lnk: CMS_LINK)
|
||||
local
|
||||
lst: like children
|
||||
do
|
||||
lst := children
|
||||
if lst /= Void then
|
||||
lst.prune_all (lnk)
|
||||
if lst.is_empty then
|
||||
children := Void
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
set_children (lst: like children)
|
||||
do
|
||||
children := lst
|
||||
@@ -46,20 +93,30 @@ feature -- Element change
|
||||
|
||||
set_expanded (b: like is_expanded)
|
||||
do
|
||||
is_expanded := b
|
||||
internal_is_expanded := b
|
||||
end
|
||||
|
||||
set_expandable (b: like is_expandable)
|
||||
do
|
||||
is_expandable := b
|
||||
internal_is_expandable := b
|
||||
end
|
||||
|
||||
get_is_active (req: WSF_REQUEST)
|
||||
local
|
||||
qs: STRING
|
||||
do
|
||||
is_active := req.path_info.same_string (location)
|
||||
create qs.make_from_string (req.path_info)
|
||||
is_active := qs.same_string (location)
|
||||
if not is_active then
|
||||
if attached req.query_string as l_query_string and then not l_query_string.is_empty then
|
||||
qs.append_character ('?')
|
||||
qs.append (l_query_string)
|
||||
end
|
||||
is_active := qs.same_string (location)
|
||||
end
|
||||
end
|
||||
|
||||
set_permission_arguments (args: ITERABLE [STRING])
|
||||
set_permission_arguments (args: like permission_arguments)
|
||||
do
|
||||
permission_arguments := args
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ class
|
||||
CMS_MENU
|
||||
|
||||
inherit
|
||||
ITERABLE [CMS_LINK]
|
||||
CMS_LINK_COMPOSITE
|
||||
|
||||
create
|
||||
make,
|
||||
|
||||
@@ -7,138 +7,11 @@ note
|
||||
class
|
||||
CMS_PAGER
|
||||
|
||||
inherit
|
||||
WSF_WIDGET_PAGER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (tpl: READABLE_STRING_8; a_lower, a_upper: NATURAL_64; a_step: NATURAL_64)
|
||||
do
|
||||
create template.make (tpl)
|
||||
lower := a_lower
|
||||
upper := a_upper
|
||||
step := a_step
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
set_active_range (a_lower, a_upper: NATURAL_64)
|
||||
do
|
||||
if a_upper = 0 then
|
||||
active_range := [{NATURAL_64} 1, {NATURAL_64} 0]
|
||||
elseif a_lower > 0 and a_lower <= a_upper then
|
||||
active_range := [a_lower, a_upper]
|
||||
else
|
||||
active_range := Void
|
||||
end
|
||||
ensure
|
||||
valid_range: attached active_range as rg implies (rg.upper = 0 or else rg.lower <= rg.upper)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
template: URI_TEMPLATE
|
||||
|
||||
lower: NATURAL_64
|
||||
|
||||
upper: NATURAL_64
|
||||
|
||||
step: NATURAL_64
|
||||
|
||||
active_range: detachable TUPLE [lower_index, upper_index: NATURAL_64]
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
to_html (a_theme: CMS_THEME): STRING_8
|
||||
local
|
||||
l_step: INTEGER
|
||||
nb: INTEGER
|
||||
curr: INTEGER
|
||||
n, i: INTEGER
|
||||
tb: HASH_TABLE [detachable ANY, STRING_8]
|
||||
do
|
||||
create Result.make (32)
|
||||
Result.append ("<div")
|
||||
Result.append_character ('>')
|
||||
nb := ((upper - lower) // step).to_integer_32 + 1
|
||||
if attached active_range as rg then
|
||||
if rg.upper_index = 0 then
|
||||
-- all
|
||||
else
|
||||
curr := ((rg.lower_index - lower) // step).to_integer_32
|
||||
if step * curr.to_natural_64 < rg.lower_index then
|
||||
curr := curr + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
l_step := step.to_integer_32
|
||||
create tb.make (2)
|
||||
tb.force (1, "lower")
|
||||
tb.force (step, "upper")
|
||||
if curr > 1 then
|
||||
if curr > 2 then
|
||||
tb.force (1, "lower")
|
||||
tb.force (l_step, "upper")
|
||||
|
||||
Result.append_character (' ')
|
||||
Result.append (a_theme.link ("<<", template.expanded_string (tb), Void))
|
||||
Result.append_character (' ')
|
||||
end
|
||||
|
||||
tb.force ((curr - 1) * l_step + 1, "lower")
|
||||
tb.force ((curr ) * l_step , "upper")
|
||||
|
||||
Result.append_character (' ')
|
||||
Result.append (a_theme.link ("<", template.expanded_string (tb), Void))
|
||||
Result.append_character (' ')
|
||||
end
|
||||
|
||||
from
|
||||
i := (curr - 1).max (1)
|
||||
n := 5
|
||||
until
|
||||
n = 0 or i > nb
|
||||
loop
|
||||
Result.append_character (' ')
|
||||
|
||||
tb.force ((i - 1) * l_step + 1, "lower")
|
||||
tb.force ((i ) * l_step , "upper")
|
||||
|
||||
if i = curr then
|
||||
Result.append ("<strong>")
|
||||
end
|
||||
Result.append (a_theme.link (i.out, template.expanded_string (tb), Void))
|
||||
if i = curr then
|
||||
Result.append ("</strong>")
|
||||
end
|
||||
|
||||
Result.append_character (' ')
|
||||
|
||||
i := i + 1
|
||||
n := n - 1
|
||||
end
|
||||
|
||||
if curr < nb then
|
||||
Result.append_character (' ')
|
||||
tb.force ((curr ) * l_step + 1, "lower")
|
||||
tb.force ((curr + 1) * l_step , "upper")
|
||||
|
||||
Result.append (a_theme.link (">", template.expanded_string (tb), Void))
|
||||
Result.append_character (' ')
|
||||
|
||||
if curr + 1 < nb then
|
||||
tb.force ((nb - 1) * l_step + 1, "lower")
|
||||
tb.force ( upper , "upper")
|
||||
|
||||
Result.append_character (' ')
|
||||
Result.append (a_theme.link (">>", template.expanded_string (tb), Void))
|
||||
Result.append_character (' ')
|
||||
end
|
||||
end
|
||||
|
||||
Result.append ("</div>")
|
||||
Result.append ("curr=" + curr.out +" step=" + step.out + " nb=" + nb.out)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -91,7 +91,7 @@ feature -- Change
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
to_html (a_theme: CMS_THEME): STRING_8
|
||||
to_html (a_theme: WSF_THEME): STRING_8
|
||||
do
|
||||
Result := "<div class=%"log " + category + " " + level_name + "%" id=%"log-" + id.out + "%">"
|
||||
Result.append ("<div class=%"inner%">")
|
||||
|
||||
@@ -29,6 +29,9 @@ feature -- Execution
|
||||
if has_permission ("administrate blocks") then
|
||||
b.append ("<li>" + link ("Blocks", "/admin/blocks/", Void) + "</li>")
|
||||
end
|
||||
if has_permission ("administrate user-roles") then
|
||||
b.append ("<li>" + link ("User roles", "/admin/roles/", Void) + "</li>")
|
||||
end
|
||||
if has_permission ("administrate users") then
|
||||
b.append ("<li>" + link ("Users", "/admin/users/", Void) + "</li>")
|
||||
end
|
||||
|
||||
@@ -9,6 +9,9 @@ class
|
||||
|
||||
inherit
|
||||
CMS_MODULE
|
||||
redefine
|
||||
permissions
|
||||
end
|
||||
|
||||
CMS_HOOK_MENU_ALTER
|
||||
|
||||
@@ -17,9 +20,8 @@ create
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_service: like service)
|
||||
make
|
||||
do
|
||||
service := a_service
|
||||
name := "admin"
|
||||
version := "1.0"
|
||||
description := "Set of service to administrate the site"
|
||||
@@ -30,16 +32,18 @@ feature {NONE} -- Initialization
|
||||
|
||||
feature {CMS_SERVICE} -- Registration
|
||||
|
||||
service: CMS_SERVICE
|
||||
service: detachable CMS_SERVICE
|
||||
|
||||
register (a_service: CMS_SERVICE)
|
||||
do
|
||||
a_service.map_uri ("/admin/", agent handle_admin)
|
||||
a_service.map_uri ("/admin/users/", agent handle_admin_users)
|
||||
a_service.map_uri ("/admin/blocks/", agent handle_admin_blocks)
|
||||
a_service.map_uri ("/admin/modules/", agent handle_admin_modules)
|
||||
a_service.map_uri ("/admin/logs/", agent handle_admin_logs)
|
||||
a_service.map_uri_template ("/admin/log/{log-id}", agent handle_admin_log_view)
|
||||
service := a_service
|
||||
a_service.map_uri ("/admin/", agent handle_admin (a_service, ?, ?))
|
||||
a_service.map_uri ("/admin/users/", agent handle_admin_users (a_service, ?, ?))
|
||||
a_service.map_uri ("/admin/roles/", agent handle_admin_user_roles (a_service, ?, ?))
|
||||
a_service.map_uri ("/admin/blocks/", agent handle_admin_blocks (a_service, ?, ?))
|
||||
a_service.map_uri ("/admin/modules/", agent handle_admin_modules (a_service, ?, ?))
|
||||
a_service.map_uri ("/admin/logs/", agent handle_admin_logs (a_service, ?, ?))
|
||||
a_service.map_uri_template ("/admin/log/{log-id}", agent handle_admin_log_view (a_service, ?, ?))
|
||||
|
||||
a_service.add_menu_alter_hook (Current)
|
||||
end
|
||||
@@ -55,45 +59,53 @@ feature -- Hooks
|
||||
a_menu_system.management_menu.extend (lnk)
|
||||
end
|
||||
|
||||
links: HASH_TABLE [CMS_MODULE_LINK, STRING]
|
||||
-- Link indexed by path
|
||||
local
|
||||
-- lnk: CMS_MODULE_LINK
|
||||
permissions (a_service: CMS_SERVICE): LIST [CMS_PERMISSION]
|
||||
do
|
||||
create Result.make (3)
|
||||
-- create lnk.make ("Date/time demo")
|
||||
-- lnk.set_callback (agent process_date_time_demo, <<"arg">>)
|
||||
-- Result["/demo/date/{arg}"] := lnk
|
||||
Result := Precursor (a_service)
|
||||
Result.extend ("administer")
|
||||
Result.extend ("administer users")
|
||||
Result.extend ("administer user roles")
|
||||
Result.extend ("administer content")
|
||||
Result.extend ("administer logs")
|
||||
Result.extend ("administer blocks")
|
||||
Result.extend ("administer modules")
|
||||
end
|
||||
|
||||
handle_admin (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
feature -- Handler
|
||||
|
||||
handle_admin (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {ADMIN_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {ADMIN_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
handle_admin_users (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_admin_users (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {ADMIN_USERS_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {ADMIN_USERS_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
handle_admin_blocks (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_admin_user_roles (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {ADMIN_BLOCKS_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {ADMIN_USER_ROLES_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
handle_admin_modules (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_admin_blocks (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {ADMIN_MODULES_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {ADMIN_BLOCKS_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
handle_admin_logs (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_admin_modules (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {ADMIN_LOGS_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {ADMIN_MODULES_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
handle_admin_log_view (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_admin_logs (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {LOG_VIEW_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {ADMIN_LOGS_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
handle_admin_log_view (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {LOG_VIEW_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
note
|
||||
description: "Summary description for {ADMIN_USER_ROLES_CMS_EXECUTION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
ADMIN_USER_ROLES_CMS_EXECUTION
|
||||
|
||||
inherit
|
||||
CMS_EXECUTION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Execution
|
||||
|
||||
process
|
||||
do
|
||||
if request.is_post_request_method then
|
||||
process_post
|
||||
else
|
||||
process_get
|
||||
end
|
||||
end
|
||||
|
||||
process_get
|
||||
-- Computed response message.
|
||||
local
|
||||
b: STRING_8
|
||||
f: CMS_FORM
|
||||
l_roles: LIST [CMS_USER_ROLE]
|
||||
do
|
||||
set_title ("User roles")
|
||||
-- check Permission !!!
|
||||
create b.make_empty
|
||||
if has_permission ("administrate user roles") then
|
||||
l_roles := service.storage.user_roles
|
||||
f := new_edit_form (url (request.path_info, Void), l_roles, True)
|
||||
f.append_to_html (theme, b)
|
||||
else
|
||||
b.append ("<div class=%"denied%">Access denied</div>")
|
||||
end
|
||||
set_main_content (b)
|
||||
end
|
||||
|
||||
process_post
|
||||
-- Computed response message.
|
||||
local
|
||||
b: STRING_8
|
||||
f: CMS_FORM
|
||||
l_roles: LIST [CMS_USER_ROLE]
|
||||
do
|
||||
set_title ("User roles")
|
||||
create b.make_empty
|
||||
|
||||
debug ("cms")
|
||||
across
|
||||
request.form_parameters as c
|
||||
loop
|
||||
b.append ("<li>")
|
||||
b.append (html_encoded (c.item.name))
|
||||
b.append ("=")
|
||||
b.append (html_encoded (c.item.string_representation))
|
||||
b.append ("</li>")
|
||||
end
|
||||
end
|
||||
|
||||
if has_permission ("administer user roles") then
|
||||
l_roles := service.storage.user_roles
|
||||
f := new_edit_form (url (request.path_info, Void), l_roles, False)
|
||||
f.submit_actions.extend (agent edit_form_submit (?, l_roles))
|
||||
f.process (Current)
|
||||
f.append_to_html (theme, b)
|
||||
else
|
||||
b.append ("<div class=%"denied%">Access denied</div>")
|
||||
end
|
||||
|
||||
set_main_content (b)
|
||||
end
|
||||
|
||||
feature -- Forms
|
||||
|
||||
edit_form_submit (fd: WSF_FORM_DATA; a_roles: LIST [CMS_USER_ROLE])
|
||||
local
|
||||
l_role: CMS_USER_ROLE
|
||||
do
|
||||
if fd.item_same_string ("op", "Apply") then
|
||||
across
|
||||
a_roles as r
|
||||
loop
|
||||
if attached fd.table_item (r.item.name) as perms then
|
||||
r.item.permissions.wipe_out
|
||||
across
|
||||
perms as c
|
||||
loop
|
||||
if attached {WSF_STRING} c.item as s then
|
||||
r.item.add_permission (s.value)
|
||||
end
|
||||
end
|
||||
service.storage.save_user_role (r.item)
|
||||
end
|
||||
end
|
||||
elseif fd.item_same_string ("op", "Add role") then
|
||||
if attached fd.string_item ("new-role") as l_new_role then
|
||||
create l_role.make (l_new_role)
|
||||
service.storage.save_user_role (l_role)
|
||||
set_redirection (url (request.path_info, Void))
|
||||
end
|
||||
elseif fd.item_same_string ("op", "Add permission") then
|
||||
if attached fd.string_item ("new-permission") as l_new_permission then
|
||||
l_role := service.storage.authenticated_user_role
|
||||
l_role.add_permission (l_new_permission)
|
||||
service.storage.save_user_role (l_role)
|
||||
set_redirection (url (request.path_info, Void))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
new_edit_form (a_action: READABLE_STRING_8; a_roles: LIST [CMS_USER_ROLE]; a_use_data: BOOLEAN): CMS_FORM
|
||||
local
|
||||
perms: ARRAYED_SET [READABLE_STRING_8]
|
||||
tb: WSF_WIDGET_AGENT_TABLE [READABLE_STRING_8]
|
||||
i: INTEGER
|
||||
tf: WSF_FORM_TEXT_INPUT
|
||||
do
|
||||
create perms.make (10)
|
||||
perms.compare_objects
|
||||
across
|
||||
service.modules as m
|
||||
loop
|
||||
across
|
||||
m.item.permissions (service) as p
|
||||
loop
|
||||
perms.extend (p.item.name)
|
||||
end
|
||||
end
|
||||
across
|
||||
a_roles as c
|
||||
loop
|
||||
across
|
||||
c.item.permissions as p
|
||||
loop
|
||||
perms.extend (p.item)
|
||||
end
|
||||
end
|
||||
|
||||
create tb.make
|
||||
tb.set_column_count (1 + a_roles.count)
|
||||
i := 1
|
||||
tb.column (i).set_title ("Permissions")
|
||||
across
|
||||
a_roles as r
|
||||
loop
|
||||
i := i + 1
|
||||
tb.column (i).set_title (r.item.name)
|
||||
end
|
||||
|
||||
tb.add_css_style ("border: solid 1px #999;")
|
||||
tb.set_data (perms)
|
||||
tb.set_compute_item_function (agent (p: READABLE_STRING_8; ia_roles: LIST [CMS_USER_ROLE]; ia_use_data: BOOLEAN): WSF_WIDGET_TABLE_ROW
|
||||
local
|
||||
it: WSF_WIDGET_TABLE_ITEM
|
||||
cb: WSF_FORM_CHECKBOX_INPUT
|
||||
do
|
||||
create Result.make (1 + ia_roles.count)
|
||||
create it.make_with_text (p)
|
||||
Result.set_item (it, 1)
|
||||
across
|
||||
ia_roles as r
|
||||
loop
|
||||
create cb.make (r.item.name + "[" + p + "]")
|
||||
cb.set_text_value (p)
|
||||
|
||||
if ia_use_data then
|
||||
if r.item.has_permission (p) then
|
||||
cb.set_checked (True)
|
||||
else
|
||||
cb.set_checked (False)
|
||||
end
|
||||
end
|
||||
create it.make_with_content (cb)
|
||||
Result.add_item (it)
|
||||
end
|
||||
end(?, a_roles, a_use_data)
|
||||
)
|
||||
|
||||
create Result.make (a_action, "edit-user-roles")
|
||||
Result.set_method_post
|
||||
Result.extend (tb.to_computed_table)
|
||||
Result.extend (create {WSF_FORM_SUBMIT_INPUT}.make_with_text ("op", "Apply"))
|
||||
|
||||
create tf.make ("new-role")
|
||||
tf.add_css_class ("horizontal")
|
||||
tf.set_size (24)
|
||||
tf.set_label ("New user role")
|
||||
Result.extend (tf)
|
||||
Result.extend (create {WSF_FORM_SUBMIT_INPUT}.make_with_text ("op", "Add role"))
|
||||
|
||||
create tf.make ("new-permission")
|
||||
tf.add_css_class ("horizontal")
|
||||
tf.set_size (24)
|
||||
tf.set_label ("New permission")
|
||||
Result.extend (tf)
|
||||
Result.extend (create {WSF_FORM_SUBMIT_INPUT}.make_with_text ("op", "Add permission"))
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -41,17 +41,18 @@ feature -- Hooks
|
||||
|
||||
help_text (a_path: STRING): STRING
|
||||
do
|
||||
Result := ""
|
||||
create Result.make_empty
|
||||
end
|
||||
|
||||
permissions: LIST [TUPLE [title: detachable STRING; description: detachable STRING]]
|
||||
permissions (a_service: CMS_SERVICE): LIST [CMS_PERMISSION]
|
||||
do
|
||||
create {ARRAYED_LIST [like permissions.item]} Result.make (0)
|
||||
create {ARRAYED_SET [CMS_PERMISSION]} Result.make (0)
|
||||
end
|
||||
|
||||
links: HASH_TABLE [CMS_MODULE_LINK, STRING]
|
||||
-- Link indexed by path
|
||||
deferred
|
||||
do
|
||||
create Result.make (0)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
36
draft/application/cms/src/modules/cms_permission.e
Normal file
36
draft/application/cms/src/modules/cms_permission.e
Normal file
@@ -0,0 +1,36 @@
|
||||
note
|
||||
description: "Summary description for {CMS_PERMISSION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_PERMISSION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
convert
|
||||
make ({READABLE_STRING_8, STRING_8, IMMUTABLE_STRING_8})
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (n: like name)
|
||||
do
|
||||
name := n
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: READABLE_STRING_8
|
||||
|
||||
description: detachable READABLE_STRING_8
|
||||
|
||||
feature -- Change
|
||||
|
||||
set_description (s: like description)
|
||||
do
|
||||
description := s
|
||||
end
|
||||
|
||||
end
|
||||
128
draft/application/cms/src/modules/debug/debug_module.e
Normal file
128
draft/application/cms/src/modules/debug/debug_module.e
Normal file
@@ -0,0 +1,128 @@
|
||||
note
|
||||
description: "Summary description for {DEBUG_MODULE}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
DEBUG_MODULE
|
||||
|
||||
inherit
|
||||
CMS_MODULE
|
||||
|
||||
-- CMS_HOOK_BLOCK
|
||||
|
||||
CMS_HOOK_AUTO_REGISTER
|
||||
|
||||
SHARED_EXECUTION_ENVIRONMENT
|
||||
export
|
||||
{NONE} all
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
name := "debug"
|
||||
version := "1.0"
|
||||
description := "Debug"
|
||||
package := "cms"
|
||||
end
|
||||
|
||||
feature {CMS_SERVICE} -- Registration
|
||||
|
||||
service: detachable CMS_SERVICE
|
||||
|
||||
register (a_service: CMS_SERVICE)
|
||||
do
|
||||
service := a_service
|
||||
a_service.map_uri_template ("/debug/", agent handle_debug (a_service, ?, ?))
|
||||
end
|
||||
|
||||
feature -- Hooks
|
||||
|
||||
-- block_list: ITERABLE [like {CMS_BLOCK}.name]
|
||||
-- do
|
||||
-- Result := <<"debug-info">>
|
||||
-- end
|
||||
|
||||
-- get_block_view (a_block_id: detachable READABLE_STRING_8; a_execution: CMS_EXECUTION)
|
||||
-- local
|
||||
-- b: CMS_CONTENT_BLOCK
|
||||
-- do
|
||||
-- create b.make ("debug-info", "Debug", "... ", a_execution.formats.plain_text)
|
||||
-- a_execution.add_block (b, Void)
|
||||
-- end
|
||||
|
||||
feature -- Handler
|
||||
|
||||
handle_debug (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
local
|
||||
e: CMS_EXECUTION
|
||||
s: STRING
|
||||
do
|
||||
if req.is_get_request_method then
|
||||
create {ANY_CMS_EXECUTION} e.make (req, res, cms)
|
||||
e.set_title ("DEBUG")
|
||||
|
||||
create s.make_empty
|
||||
append_info_to ("Name", cms.site_name, e, s)
|
||||
append_info_to ("Url", cms.site_url, e, s)
|
||||
|
||||
if attached cms.configuration as cfg and then attached cfg.configuration_location as l_loc then
|
||||
s.append ("<hr/>")
|
||||
append_info_to ("Configuration file", l_loc.name, e, s)
|
||||
end
|
||||
|
||||
s.append ("<hr/>")
|
||||
|
||||
append_info_to ("Current dir", execution_environment.current_working_path.utf_8_name, e, s)
|
||||
append_info_to ("Base url", cms.base_url, e, s)
|
||||
append_info_to ("Script url", cms.script_url, e, s)
|
||||
s.append ("<hr/>")
|
||||
append_info_to ("Dir", cms.site_dir.utf_8_name, e, s)
|
||||
append_info_to ("Var dir", cms.site_var_dir.utf_8_name, e, s)
|
||||
s.append ("<hr/>")
|
||||
append_info_to ("Theme", cms.theme_name, e, s)
|
||||
append_info_to ("Theme location", cms.theme_resource_location.utf_8_name, e, s)
|
||||
s.append ("<hr/>")
|
||||
append_info_to ("Files location", cms.files_location.utf_8_name, e, s)
|
||||
s.append ("<hr/>")
|
||||
|
||||
append_info_to ("Url", e.url ("/", Void), e, s)
|
||||
if attached e.user as u then
|
||||
append_info_to ("User", u.name, e, s)
|
||||
append_info_to ("User url", e.user_url (u), e, s)
|
||||
|
||||
end
|
||||
|
||||
e.set_main_content (s)
|
||||
else
|
||||
create {NOT_FOUND_CMS_EXECUTION} e.make (req, res, cms)
|
||||
end
|
||||
e.execute
|
||||
end
|
||||
|
||||
append_info_to (n: READABLE_STRING_8; v: detachable READABLE_STRING_GENERAL; e: CMS_EXECUTION; t: STRING)
|
||||
do
|
||||
t.append ("<li>")
|
||||
t.append ("<strong>" + n + "</strong>: ")
|
||||
if v /= Void then
|
||||
t.append (e.html_encoded (v))
|
||||
end
|
||||
t.append ("</li>")
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2013, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -41,11 +41,11 @@ feature -- Factory
|
||||
|
||||
fill_edit_form (f: CMS_FORM; a_node: detachable CMS_NODE)
|
||||
local
|
||||
ti: CMS_FORM_TEXT_INPUT
|
||||
fset: CMS_FORM_FIELD_SET
|
||||
ta: CMS_FORM_TEXTAREA
|
||||
tselect: CMS_FORM_SELECT
|
||||
opt: CMS_FORM_SELECT_OPTION
|
||||
ti: WSF_FORM_TEXT_INPUT
|
||||
fset: WSF_FORM_FIELD_SET
|
||||
ta: WSF_FORM_TEXTAREA
|
||||
tselect: WSF_FORM_SELECT
|
||||
opt: WSF_FORM_SELECT_OPTION
|
||||
do
|
||||
create ti.make ("title")
|
||||
ti.set_label ("Title")
|
||||
@@ -56,7 +56,7 @@ feature -- Factory
|
||||
ti.set_is_required (True)
|
||||
f.extend (ti)
|
||||
|
||||
f.extend (create {CMS_FORM_RAW_TEXT}.make ("<br/>"))
|
||||
f.extend_text ("<br/>")
|
||||
|
||||
create ta.make ("body")
|
||||
ta.set_rows (10)
|
||||
@@ -72,8 +72,7 @@ feature -- Factory
|
||||
fset.set_legend ("Body")
|
||||
fset.extend (ta)
|
||||
|
||||
|
||||
fset.extend (create {CMS_FORM_RAW_TEXT}.make ("<br/>"))
|
||||
fset.extend_text ("<br/>")
|
||||
|
||||
create tselect.make ("format")
|
||||
tselect.set_label ("Body's format")
|
||||
@@ -97,7 +96,7 @@ feature -- Factory
|
||||
|
||||
end
|
||||
|
||||
change_node (a_execution: CMS_EXECUTION; fd: CMS_FORM_DATA; a_node: like new_node)
|
||||
change_node (a_execution: CMS_EXECUTION; fd: WSF_FORM_DATA; a_node: like new_node)
|
||||
local
|
||||
b: detachable READABLE_STRING_8
|
||||
f: detachable CMS_FORMAT
|
||||
@@ -124,7 +123,7 @@ feature -- Factory
|
||||
end
|
||||
end
|
||||
|
||||
new_node (a_execution: CMS_EXECUTION; fd: CMS_FORM_DATA; a_node: detachable like new_node): CMS_PAGE
|
||||
new_node (a_execution: CMS_EXECUTION; fd: WSF_FORM_DATA; a_node: detachable like new_node): CMS_PAGE
|
||||
-- <Precursor>
|
||||
local
|
||||
b: detachable READABLE_STRING_8
|
||||
|
||||
@@ -6,7 +6,7 @@ class
|
||||
NODE_ADD_CMS_EXECUTION
|
||||
|
||||
inherit
|
||||
CMS_EXECUTION
|
||||
NODE_CMS_EXECUTION
|
||||
|
||||
create
|
||||
make
|
||||
@@ -18,72 +18,21 @@ feature -- Execution
|
||||
local
|
||||
b: STRING_8
|
||||
f: like edit_form
|
||||
fd: detachable CMS_FORM_DATA
|
||||
l_preview: BOOLEAN
|
||||
l_format: detachable CMS_FORMAT
|
||||
fd: detachable WSF_FORM_DATA
|
||||
do
|
||||
create b.make_empty
|
||||
if attached non_empty_string_path_parameter ("type") as s_type then
|
||||
if attached service.content_type (s_type) as l_type then
|
||||
f := edit_form (Void, request.path_info, "add-" + l_type.name, l_type)
|
||||
if request.is_post_request_method then
|
||||
create fd.make (request, f)
|
||||
l_preview := attached {WSF_STRING} fd.item ("op") as l_op and then l_op.same_string ("Preview")
|
||||
end
|
||||
|
||||
f := edit_form (Void, url (request.path_info, Void), "add-" + l_type.name, l_type)
|
||||
set_title ("Create " + l_type.title)
|
||||
if has_permission ("create " + l_type.name) then
|
||||
|
||||
if fd /= Void and l_preview then
|
||||
b.append ("<strong>Preview</strong><div class=%"preview%">")
|
||||
if attached fd.string_item ("format") as s_format and then attached formats.format (s_format) as f_format then
|
||||
l_format := f_format
|
||||
end
|
||||
if attached fd.string_item ("title") as l_title then
|
||||
b.append ("<strong>Title:</strong><div class=%"title%">" + html_encoded (l_title) + "</div>")
|
||||
end
|
||||
if attached fd.string_item ("body") as l_body then
|
||||
b.append ("<strong>Body:</strong><div class=%"body%">")
|
||||
if l_format /= Void then
|
||||
b.append (l_format.to_html (l_body))
|
||||
else
|
||||
b.append (html_encoded (l_body))
|
||||
end
|
||||
b.append ("</div>")
|
||||
end
|
||||
b.append ("</div>")
|
||||
end
|
||||
|
||||
if fd /= Void and then fd.is_valid and not l_preview then
|
||||
across
|
||||
fd as c
|
||||
loop
|
||||
b.append ("<li>" + html_encoded (c.key) + "=")
|
||||
if attached c.item as v then
|
||||
b.append (html_encoded (v.string_representation))
|
||||
end
|
||||
b.append ("</li>")
|
||||
end
|
||||
if attached l_type.new_node (Current, fd, Void) as l_node then
|
||||
service.storage.save_node (l_node)
|
||||
if attached user as u then
|
||||
service.log ("node", "User %"" + user_link (u) + "%" created node " + link (l_type.name +" #" + l_node.id.out, "/node/" + l_node.id.out , Void), 0, node_local_link (l_node))
|
||||
else
|
||||
service.log ("node", "Anonymous created node "+ l_type.name +" #" + l_node.id.out, 0, node_local_link (l_node))
|
||||
end
|
||||
add_success_message ("Node #" + l_node.id.out + " saved.")
|
||||
set_redirection (node_url (l_node))
|
||||
end
|
||||
-- Creation ...
|
||||
else
|
||||
if fd /= Void then
|
||||
if not fd.is_valid then
|
||||
report_form_errors (fd)
|
||||
end
|
||||
fd.apply_to_associated_form
|
||||
end
|
||||
b.append (f.to_html (theme))
|
||||
if request.is_post_request_method then
|
||||
f.validation_actions.extend (agent edit_form_validate (?, b))
|
||||
f.submit_actions.extend (agent edit_form_submit (?, Void, l_type, b))
|
||||
f.process (Current)
|
||||
fd := f.last_data
|
||||
end
|
||||
f.append_to_html (theme, b)
|
||||
else
|
||||
set_title ("Access denied")
|
||||
end
|
||||
@@ -109,35 +58,4 @@ feature -- Execution
|
||||
set_main_content (b)
|
||||
end
|
||||
|
||||
edit_form (a_node: detachable CMS_NODE; a_url: READABLE_STRING_8; a_name: STRING; a_type: CMS_CONTENT_TYPE): CMS_FORM
|
||||
local
|
||||
f: CMS_FORM
|
||||
ts: CMS_FORM_SUBMIT_INPUT
|
||||
th: CMS_FORM_HIDDEN_INPUT
|
||||
do
|
||||
create f.make (a_url, a_name)
|
||||
|
||||
create th.make ("node-id")
|
||||
if a_node /= Void then
|
||||
th.set_text_value (a_node.id.out)
|
||||
else
|
||||
th.set_text_value ("0")
|
||||
end
|
||||
f.extend (th)
|
||||
|
||||
a_type.fill_edit_form (f, a_node)
|
||||
|
||||
f.extend (create {CMS_FORM_RAW_TEXT}.make ("<br/>"))
|
||||
|
||||
create ts.make ("op")
|
||||
ts.set_default_value ("Save")
|
||||
f.extend (ts)
|
||||
|
||||
create ts.make ("op")
|
||||
ts.set_default_value ("Preview")
|
||||
f.extend (ts)
|
||||
|
||||
Result := f
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
141
draft/application/cms/src/modules/node/node_cms_execution.e
Normal file
141
draft/application/cms/src/modules/node/node_cms_execution.e
Normal file
@@ -0,0 +1,141 @@
|
||||
note
|
||||
description: "Summary description for {NODE_CMS_EXECUTION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
NODE_CMS_EXECUTION
|
||||
|
||||
inherit
|
||||
CMS_EXECUTION
|
||||
|
||||
feature -- Form
|
||||
|
||||
edit_form_validate (fd: WSF_FORM_DATA; b: STRING)
|
||||
local
|
||||
l_preview: BOOLEAN
|
||||
l_format: detachable CMS_FORMAT
|
||||
do
|
||||
l_preview := attached {WSF_STRING} fd.item ("op") as l_op and then l_op.same_string ("Preview")
|
||||
if l_preview then
|
||||
b.append ("<strong>Preview</strong><div class=%"preview%">")
|
||||
if attached fd.string_item ("format") as s_format and then attached formats.format (s_format) as f_format then
|
||||
l_format := f_format
|
||||
end
|
||||
if attached fd.string_item ("title") as l_title then
|
||||
b.append ("<strong>Title:</strong><div class=%"title%">" + html_encoded (l_title) + "</div>")
|
||||
end
|
||||
if attached fd.string_item ("body") as l_body then
|
||||
b.append ("<strong>Body:</strong><div class=%"body%">")
|
||||
if l_format /= Void then
|
||||
b.append (l_format.to_html (l_body))
|
||||
else
|
||||
b.append (html_encoded (l_body))
|
||||
end
|
||||
b.append ("</div>")
|
||||
end
|
||||
b.append ("</div>")
|
||||
end
|
||||
end
|
||||
|
||||
edit_form_submit (fd: WSF_FORM_DATA; a_node: detachable CMS_NODE; a_type: CMS_CONTENT_TYPE; b: STRING)
|
||||
local
|
||||
l_preview: BOOLEAN
|
||||
l_node: detachable CMS_NODE
|
||||
s: STRING
|
||||
do
|
||||
l_preview := attached {WSF_STRING} fd.item ("op") as l_op and then l_op.same_string ("Preview")
|
||||
if not l_preview then
|
||||
debug ("cms")
|
||||
across
|
||||
fd as c
|
||||
loop
|
||||
b.append ("<li>" + html_encoded (c.key) + "=")
|
||||
if attached c.item as v then
|
||||
b.append (html_encoded (v.string_representation))
|
||||
end
|
||||
b.append ("</li>")
|
||||
end
|
||||
end
|
||||
if a_node /= Void then
|
||||
l_node := a_node
|
||||
a_type.change_node (Current, fd, a_node)
|
||||
s := "modified"
|
||||
else
|
||||
l_node := a_type.new_node (Current, fd, Void)
|
||||
s := "created"
|
||||
end
|
||||
service.storage.save_node (l_node)
|
||||
if attached user as u then
|
||||
service.log ("node", "User %"" + user_link (u) + "%" " + s + " node " + link (a_type.name +" #" + l_node.id.out, "/node/" + l_node.id.out , Void), 0, node_local_link (l_node))
|
||||
else
|
||||
service.log ("node", "Anonymous " + s + " node " + a_type.name +" #" + l_node.id.out, 0, node_local_link (l_node))
|
||||
end
|
||||
add_success_message ("Node #" + l_node.id.out + " saved.")
|
||||
set_redirection (node_url (l_node))
|
||||
end
|
||||
end
|
||||
|
||||
-- edit_form_submit (fd: WSF_FORM_DATA; a_type: CMS_CONTENT_TYPE; b: STRING)
|
||||
-- local
|
||||
-- l_preview: BOOLEAN
|
||||
-- do
|
||||
-- l_preview := attached {WSF_STRING} fd.item ("op") as l_op and then l_op.same_string ("Preview")
|
||||
-- if not l_preview then
|
||||
-- debug ("cms")
|
||||
-- across
|
||||
-- fd as c
|
||||
-- loop
|
||||
-- b.append ("<li>" + html_encoded (c.key) + "=")
|
||||
-- if attached c.item as v then
|
||||
-- b.append (html_encoded (v.string_representation))
|
||||
-- end
|
||||
-- b.append ("</li>")
|
||||
-- end
|
||||
-- end
|
||||
-- if attached a_type.new_node (Current, fd, Void) as l_node then
|
||||
-- service.storage.save_node (l_node)
|
||||
-- if attached user as u then
|
||||
-- service.log ("node", "User %"" + user_link (u) + "%" created node " + link (a_type.name +" #" + l_node.id.out, "/node/" + l_node.id.out , Void), 0, node_local_link (l_node))
|
||||
-- else
|
||||
-- service.log ("node", "Anonymous created node "+ a_type.name +" #" + l_node.id.out, 0, node_local_link (l_node))
|
||||
-- end
|
||||
-- add_success_message ("Node #" + l_node.id.out + " saved.")
|
||||
-- set_redirection (node_url (l_node))
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
|
||||
edit_form (a_node: detachable CMS_NODE; a_url: READABLE_STRING_8; a_name: STRING; a_type: CMS_CONTENT_TYPE): CMS_FORM
|
||||
local
|
||||
f: CMS_FORM
|
||||
ts: WSF_FORM_SUBMIT_INPUT
|
||||
th: WSF_FORM_HIDDEN_INPUT
|
||||
do
|
||||
create f.make (a_url, a_name)
|
||||
|
||||
create th.make ("node-id")
|
||||
if a_node /= Void then
|
||||
th.set_text_value (a_node.id.out)
|
||||
else
|
||||
th.set_text_value ("0")
|
||||
end
|
||||
f.extend (th)
|
||||
|
||||
a_type.fill_edit_form (f, a_node)
|
||||
|
||||
f.extend_text ("<br/>")
|
||||
|
||||
create ts.make ("op")
|
||||
ts.set_default_value ("Save")
|
||||
f.extend (ts)
|
||||
|
||||
create ts.make ("op")
|
||||
ts.set_default_value ("Preview")
|
||||
f.extend (ts)
|
||||
|
||||
Result := f
|
||||
end
|
||||
|
||||
end
|
||||
@@ -6,7 +6,7 @@ class
|
||||
NODE_EDIT_CMS_EXECUTION
|
||||
|
||||
inherit
|
||||
CMS_EXECUTION
|
||||
NODE_CMS_EXECUTION
|
||||
|
||||
create
|
||||
make
|
||||
@@ -18,9 +18,7 @@ feature -- Execution
|
||||
local
|
||||
b: STRING_8
|
||||
f: like edit_form
|
||||
fd: detachable CMS_FORM_DATA
|
||||
l_preview: BOOLEAN
|
||||
l_format: detachable CMS_FORMAT
|
||||
fd: detachable WSF_FORM_DATA
|
||||
do
|
||||
create b.make_empty
|
||||
if
|
||||
@@ -30,10 +28,12 @@ feature -- Execution
|
||||
then
|
||||
if attached service.content_type (l_node.content_type_name) as l_type then
|
||||
if has_permission ("edit " + l_type.name) then
|
||||
f := edit_form (l_node, request.path_info, "edit-" + l_type.name, l_type)
|
||||
f := edit_form (l_node, url (request.path_info, Void), "edit-" + l_type.name, l_type)
|
||||
if request.is_post_request_method then
|
||||
create fd.make (request, f)
|
||||
l_preview := attached {WSF_STRING} fd.item ("op") as l_op and then l_op.same_string ("Preview")
|
||||
f.validation_actions.extend (agent edit_form_validate (?, b))
|
||||
f.submit_actions.extend (agent edit_form_submit (?, l_node, l_type, b))
|
||||
f.process (Current)
|
||||
fd := f.last_data
|
||||
end
|
||||
|
||||
set_title ("Edit #" + l_node.id.out)
|
||||
@@ -41,54 +41,7 @@ feature -- Execution
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make ("View", node_url (l_node)), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make ("Edit", "/node/" + l_node.id.out + "/edit"), primary_tabs)
|
||||
|
||||
if fd /= Void and l_preview then
|
||||
b.append ("<strong>Preview</strong><div class=%"preview%">")
|
||||
if attached fd.string_item ("format") as s_format and then attached formats.format (s_format) as f_format then
|
||||
l_format := f_format
|
||||
end
|
||||
if attached fd.string_item ("title") as l_title then
|
||||
b.append ("<strong>Title:</strong><div class=%"title%">" + html_encoded (l_title) + "</div>")
|
||||
end
|
||||
if attached fd.string_item ("body") as l_body then
|
||||
b.append ("<strong>Body:</strong><div class=%"body%">")
|
||||
if l_format /= Void then
|
||||
b.append (l_format.to_html (l_body))
|
||||
else
|
||||
b.append (html_encoded (l_body))
|
||||
end
|
||||
b.append ("</div>")
|
||||
end
|
||||
b.append ("</div>")
|
||||
end
|
||||
|
||||
if fd /= Void and then fd.is_valid and not l_preview then
|
||||
across
|
||||
fd as c
|
||||
loop
|
||||
b.append ("<li>" + html_encoded (c.key) + "=")
|
||||
if attached c.item as v then
|
||||
b.append (html_encoded (v.string_representation))
|
||||
end
|
||||
b.append ("</li>")
|
||||
end
|
||||
l_type.change_node (Current, fd, l_node)
|
||||
service.storage.save_node (l_node)
|
||||
if attached user as u then
|
||||
service.log ("node", "User %"" + user_link (u) + "%" modified node " + link (l_type.name +" #" + l_node.id.out, "/node/" + l_node.id.out , Void), 0, node_local_link (l_node))
|
||||
else
|
||||
service.log ("node", "Anonymous modified node "+ l_type.name +" #" + l_node.id.out, 0, node_local_link (l_node))
|
||||
end
|
||||
add_success_message ("Node #" + l_node.id.out + " saved.")
|
||||
set_redirection (node_url (l_node))
|
||||
else
|
||||
if fd /= Void then
|
||||
if not fd.is_valid then
|
||||
report_form_errors (fd)
|
||||
end
|
||||
fd.apply_to_associated_form
|
||||
end
|
||||
b.append (f.to_html (theme))
|
||||
end
|
||||
f.append_to_html (theme, b)
|
||||
else
|
||||
b.append ("<h1>Access denied</h1>")
|
||||
end
|
||||
@@ -114,35 +67,100 @@ feature -- Execution
|
||||
set_main_content (b)
|
||||
end
|
||||
|
||||
edit_form (a_node: detachable CMS_NODE; a_url: READABLE_STRING_8; a_name: STRING; a_type: CMS_CONTENT_TYPE): CMS_FORM
|
||||
local
|
||||
f: CMS_FORM
|
||||
ts: CMS_FORM_SUBMIT_INPUT
|
||||
th: CMS_FORM_HIDDEN_INPUT
|
||||
do
|
||||
create f.make (a_url, a_name)
|
||||
-- edit_form_validate (fd: CMS_FORM_DATA; b: STRING)
|
||||
-- local
|
||||
-- l_preview: BOOLEAN
|
||||
-- l_format: detachable CMS_FORMAT
|
||||
-- do
|
||||
-- l_preview := attached {WSF_STRING} fd.item ("op") as l_op and then l_op.same_string ("Preview")
|
||||
-- if l_preview then
|
||||
-- b.append ("<strong>Preview</strong><div class=%"preview%">")
|
||||
-- if attached fd.string_item ("format") as s_format and then attached formats.format (s_format) as f_format then
|
||||
-- l_format := f_format
|
||||
-- end
|
||||
-- if attached fd.string_item ("title") as l_title then
|
||||
-- b.append ("<strong>Title:</strong><div class=%"title%">" + html_encoded (l_title) + "</div>")
|
||||
-- end
|
||||
-- if attached fd.string_item ("body") as l_body then
|
||||
-- b.append ("<strong>Body:</strong><div class=%"body%">")
|
||||
-- if l_format /= Void then
|
||||
-- b.append (l_format.to_html (l_body))
|
||||
-- else
|
||||
-- b.append (html_encoded (l_body))
|
||||
-- end
|
||||
-- b.append ("</div>")
|
||||
-- end
|
||||
-- b.append ("</div>")
|
||||
-- end
|
||||
-- end
|
||||
|
||||
create th.make ("node-id")
|
||||
if a_node /= Void then
|
||||
th.set_text_value (a_node.id.out)
|
||||
else
|
||||
th.set_text_value ("0")
|
||||
end
|
||||
f.extend (th)
|
||||
-- edit_form_submit (fd: CMS_FORM_DATA; a_node: detachable CMS_NODE; a_type: CMS_CONTENT_TYPE; b: STRING)
|
||||
-- local
|
||||
-- l_preview: BOOLEAN
|
||||
-- l_node: detachable CMS_NODE
|
||||
-- s: STRING
|
||||
-- do
|
||||
-- l_preview := attached {WSF_STRING} fd.item ("op") as l_op and then l_op.same_string ("Preview")
|
||||
-- if not l_preview then
|
||||
-- debug ("cms")
|
||||
-- across
|
||||
-- fd as c
|
||||
-- loop
|
||||
-- b.append ("<li>" + html_encoded (c.key) + "=")
|
||||
-- if attached c.item as v then
|
||||
-- b.append (html_encoded (v.string_representation))
|
||||
-- end
|
||||
-- b.append ("</li>")
|
||||
-- end
|
||||
-- end
|
||||
-- if a_node /= Void then
|
||||
-- l_node := a_node
|
||||
-- a_type.change_node (Current, fd, a_node)
|
||||
-- s := "modified"
|
||||
-- else
|
||||
-- l_node := a_type.new_node (Current, fd, Void)
|
||||
-- s := "created"
|
||||
-- end
|
||||
-- service.storage.save_node (l_node)
|
||||
-- if attached user as u then
|
||||
-- service.log ("node", "User %"" + user_link (u) + "%" " + s + " node " + link (a_type.name +" #" + l_node.id.out, "/node/" + l_node.id.out , Void), 0, node_local_link (l_node))
|
||||
-- else
|
||||
-- service.log ("node", "Anonymous " + s + " node " + a_type.name +" #" + l_node.id.out, 0, node_local_link (l_node))
|
||||
-- end
|
||||
-- add_success_message ("Node #" + l_node.id.out + " saved.")
|
||||
-- set_redirection (node_url (l_node))
|
||||
-- end
|
||||
-- end
|
||||
|
||||
a_type.fill_edit_form (f, a_node)
|
||||
-- edit_form (a_node: detachable CMS_NODE; a_url: READABLE_STRING_8; a_name: STRING; a_type: CMS_CONTENT_TYPE): CMS_FORM
|
||||
-- local
|
||||
-- f: CMS_FORM
|
||||
-- ts: CMS_FORM_SUBMIT_INPUT
|
||||
-- th: CMS_FORM_HIDDEN_INPUT
|
||||
-- do
|
||||
-- create f.make (a_url, a_name)
|
||||
|
||||
f.extend (create {CMS_FORM_RAW_TEXT}.make ("<br/>"))
|
||||
-- create th.make ("node-id")
|
||||
-- if a_node /= Void then
|
||||
-- th.set_text_value (a_node.id.out)
|
||||
-- else
|
||||
-- th.set_text_value ("0")
|
||||
-- end
|
||||
-- f.extend (th)
|
||||
|
||||
create ts.make ("op")
|
||||
ts.set_default_value ("Save")
|
||||
f.extend (ts)
|
||||
-- a_type.fill_edit_form (f, a_node)
|
||||
|
||||
create ts.make ("op")
|
||||
ts.set_default_value ("Preview")
|
||||
f.extend (ts)
|
||||
-- f.extend_text ("<br/>")
|
||||
|
||||
Result := f
|
||||
end
|
||||
-- create ts.make ("op")
|
||||
-- ts.set_default_value ("Save")
|
||||
-- f.extend (ts)
|
||||
|
||||
-- create ts.make ("op")
|
||||
-- ts.set_default_value ("Preview")
|
||||
-- f.extend (ts)
|
||||
|
||||
-- Result := f
|
||||
-- end
|
||||
|
||||
end
|
||||
|
||||
@@ -9,6 +9,9 @@ class
|
||||
|
||||
inherit
|
||||
CMS_MODULE
|
||||
redefine
|
||||
permissions
|
||||
end
|
||||
|
||||
CMS_HOOK_MENU_ALTER
|
||||
|
||||
@@ -19,9 +22,8 @@ create
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_service: like service)
|
||||
make
|
||||
do
|
||||
service := a_service
|
||||
name := "node"
|
||||
version := "1.0"
|
||||
description := "Service to manage content based on 'node'"
|
||||
@@ -30,27 +32,43 @@ feature {NONE} -- Initialization
|
||||
enable
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
permissions (a_service: CMS_SERVICE): LIST [CMS_PERMISSION]
|
||||
do
|
||||
Result := Precursor (a_service)
|
||||
across
|
||||
a_service.content_types as c
|
||||
loop
|
||||
Result.extend ("create " + c.item.name)
|
||||
Result.extend ("edit " + c.item.name)
|
||||
Result.extend ("delete " + c.item.name)
|
||||
end
|
||||
end
|
||||
|
||||
feature {CMS_SERVICE} -- Registration
|
||||
|
||||
service: CMS_SERVICE
|
||||
service: detachable CMS_SERVICE
|
||||
|
||||
register (a_service: CMS_SERVICE)
|
||||
local
|
||||
h: CMS_HANDLER
|
||||
do
|
||||
a_service.map_uri ("/node/add", agent handle_node_add)
|
||||
a_service.map_uri_template ("/node/add/{type}", agent handle_node_add)
|
||||
service := a_service
|
||||
a_service.map_uri ("/node/add", agent handle_node_add (a_service, ?, ?))
|
||||
a_service.map_uri_template ("/node/add/{type}", agent handle_node_add (a_service, ?, ?))
|
||||
|
||||
create {CMS_HANDLER} h.make (agent handle_node_view)
|
||||
create {CMS_HANDLER} h.make (agent handle_node_view (a_service, ?, ?))
|
||||
a_service.router.map (create {WSF_URI_TEMPLATE_MAPPING}.make ("/node/{nid}", h))
|
||||
a_service.router.map (create {WSF_URI_TEMPLATE_MAPPING}.make ("/node/{nid}/view", h))
|
||||
|
||||
a_service.map_uri_template ("/node/{nid}/edit", agent handle_node_edit)
|
||||
a_service.map_uri_template ("/node/{nid}/edit", agent handle_node_edit (a_service, ?, ?))
|
||||
|
||||
a_service.add_content_type (create {CMS_PAGE_CONTENT_TYPE}.make)
|
||||
|
||||
a_service.add_menu_alter_hook (Current)
|
||||
a_service.add_block_hook (Current)
|
||||
|
||||
end
|
||||
|
||||
feature -- Hooks
|
||||
@@ -76,38 +94,34 @@ feature -- Hooks
|
||||
menu_alter (a_menu_system: CMS_MENU_SYSTEM; a_execution: CMS_EXECUTION)
|
||||
local
|
||||
lnk: CMS_LOCAL_LINK
|
||||
perms: detachable ARRAYED_LIST [READABLE_STRING_8]
|
||||
do
|
||||
if a_execution.authenticated then
|
||||
create lnk.make ("Add content", "/node/add/")
|
||||
lnk.set_permission_arguments (<<"authenticated">>)
|
||||
a_menu_system.navigation_menu.extend (lnk)
|
||||
if attached a_execution.service.content_types as lst then
|
||||
create perms.make (lst.count)
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
perms.force ("create " + c.item.name)
|
||||
end
|
||||
end
|
||||
create lnk.make ("Add content", "/node/add/")
|
||||
lnk.set_permission_arguments (perms)
|
||||
a_menu_system.navigation_menu.extend (lnk)
|
||||
end
|
||||
|
||||
links: HASH_TABLE [CMS_MODULE_LINK, STRING]
|
||||
-- Link indexed by path
|
||||
local
|
||||
-- lnk: CMS_MODULE_LINK
|
||||
handle_node_view (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
create Result.make (3)
|
||||
-- create lnk.make ("Date/time demo")
|
||||
-- lnk.set_callback (agent process_date_time_demo, <<"arg">>)
|
||||
-- Result["/demo/date/{arg}"] := lnk
|
||||
(create {NODE_VIEW_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
handle_node_view (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_node_edit (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {NODE_VIEW_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {NODE_EDIT_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
handle_node_edit (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
handle_node_add (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {NODE_EDIT_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
end
|
||||
|
||||
handle_node_add (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {NODE_ADD_CMS_EXECUTION}.make (req, res, service)).execute
|
||||
(create {NODE_ADD_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ class
|
||||
NODE_VIEW_CMS_EXECUTION
|
||||
|
||||
inherit
|
||||
CMS_EXECUTION
|
||||
NODE_CMS_EXECUTION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
149
draft/application/cms/src/modules/openid/openid_cms_execution.e
Normal file
149
draft/application/cms/src/modules/openid/openid_cms_execution.e
Normal file
@@ -0,0 +1,149 @@
|
||||
note
|
||||
description: "Summary description for {OPENID_CMS_EXECUTION}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
OPENID_CMS_EXECUTION
|
||||
|
||||
inherit
|
||||
CMS_EXECUTION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Execution
|
||||
|
||||
process
|
||||
local
|
||||
b: STRING
|
||||
f: CMS_FORM
|
||||
tf: WSF_FORM_TEXT_INPUT
|
||||
ts: WSF_FORM_SUBMIT_INPUT
|
||||
o: OPENID_CONSUMER
|
||||
v: OPENID_CONSUMER_VALIDATION
|
||||
tb: HASH_TABLE [READABLE_STRING_8, STRING_8]
|
||||
l_uid: INTEGER
|
||||
do
|
||||
create b.make_empty
|
||||
set_title ("OpenID identities")
|
||||
if attached request.string_item ("openid.mode") as l_openid_mode then
|
||||
-- Callback
|
||||
create o.make (request.absolute_script_url ("/openid/login"))
|
||||
o.ask_email (True)
|
||||
o.ask_nickname (False)
|
||||
-- o.ask_all_info (False)
|
||||
|
||||
create v.make_from_items (o, request.items_as_string_items)
|
||||
v.validate
|
||||
if v.is_valid then
|
||||
if attached v.identity as l_identity then
|
||||
if attached user as u then
|
||||
if attached service.storage.custom_value (l_identity, "openid") as obj then
|
||||
l_uid := user_id_from_custom_value (obj)
|
||||
if l_uid > 0 and then l_uid = u.id then
|
||||
-- Authenticated
|
||||
b.append ("OpenID already associated to user %""+ user_link (u) +"%"")
|
||||
else
|
||||
-- Wrong USER !!!
|
||||
b.append ("OpenID already associated to another user !!!")
|
||||
end
|
||||
else
|
||||
-- New OpenID association
|
||||
create tb.make (1)
|
||||
tb.force (l_identity, "openid_identity")
|
||||
tb.force (u.id.out, "uid")
|
||||
service.storage.set_custom_value (l_identity, tb, "openid")
|
||||
|
||||
b.append ("OpenID %""+ l_identity +"%" is now associated with user %""+ user_link (u) +"%"")
|
||||
end
|
||||
else
|
||||
if
|
||||
attached service.storage.custom_value (l_identity, "openid") as obj and then
|
||||
attached user_id_from_custom_value (obj) as obj_uid and then
|
||||
obj_uid > 0 and then
|
||||
attached service.storage.user_by_id (obj_uid.to_integer) as u
|
||||
then
|
||||
-- Authenticated
|
||||
set_user (u)
|
||||
b.append ("Authenticated as %""+ user_link (u) +"%"")
|
||||
set_redirection (user_url (u))
|
||||
else
|
||||
-- Register new account
|
||||
b.append ("Register new account associated with Openid %"" + l_identity + "%"?")
|
||||
across
|
||||
v.attributes as c
|
||||
loop
|
||||
b.append ("<li>" + c.key + "=" + c.item + "</li>")
|
||||
end
|
||||
set_session_item ("openid.identity", l_identity)
|
||||
if attached v.email_attribute as att_email then
|
||||
set_session_item ("openid.email", att_email)
|
||||
end
|
||||
if attached v.nickname_attribute as att_nickname then
|
||||
set_session_item ("openid.nickname", att_nickname)
|
||||
end
|
||||
b.append ("Create new account from your OpenID ")
|
||||
b.append (link ("Register new account", "/user/register", Void))
|
||||
set_redirection (url ("/user/register", Void))
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
b.append ("User authentication failed!!")
|
||||
end
|
||||
elseif attached request.string_item ("openid") as p_openid then
|
||||
b.append ("Check openID: " + p_openid)
|
||||
create o.make (request.absolute_script_url ("/openid/login"))
|
||||
o.ask_email (True)
|
||||
o.ask_all_info (False)
|
||||
if attached o.auth_url (p_openid) as l_url then
|
||||
set_redirection (l_url)
|
||||
else
|
||||
b.append ("Failure")
|
||||
end
|
||||
else
|
||||
if attached user as u then
|
||||
if attached service.storage.custom_value_names_where ("uid", u.id.out, "openid") as lst then
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
b.append ("<li>OpenID: " + c.item + "</li>")
|
||||
end
|
||||
else
|
||||
b.append ("No OpenID associated with current account")
|
||||
end
|
||||
end
|
||||
create f.make (url ("/openid/login", Void), "openid-login")
|
||||
create tf.make ("openid")
|
||||
tf.set_size (50)
|
||||
tf.set_text_value ("")
|
||||
tf.set_label ("OpenID identifier")
|
||||
f.extend (tf)
|
||||
create ts.make_with_text ("op", "Validate")
|
||||
f.extend (ts)
|
||||
f.prepare (Current)
|
||||
f.append_to_html (theme, b)
|
||||
end
|
||||
set_main_content (b)
|
||||
end
|
||||
|
||||
user_id_from_custom_value (lst: TABLE_ITERABLE [READABLE_STRING_8, STRING_8]): INTEGER
|
||||
local
|
||||
l_uid: detachable READABLE_STRING_8
|
||||
do
|
||||
across
|
||||
lst as c
|
||||
until
|
||||
l_uid /= Void
|
||||
loop
|
||||
if c.key.same_string ("uid") then
|
||||
l_uid := c.item
|
||||
end
|
||||
end
|
||||
if l_uid /= Void and then l_uid.is_integer then
|
||||
Result := l_uid.to_integer
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
141
draft/application/cms/src/modules/openid/openid_module.e
Normal file
141
draft/application/cms/src/modules/openid/openid_module.e
Normal file
@@ -0,0 +1,141 @@
|
||||
note
|
||||
description: "Summary description for {OPENID_MODULE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
OPENID_MODULE
|
||||
|
||||
inherit
|
||||
CMS_MODULE
|
||||
|
||||
CMS_HOOK_MENU_ALTER
|
||||
|
||||
CMS_HOOK_FORM_ALTER
|
||||
|
||||
CMS_HOOK_AUTO_REGISTER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
name := "openid"
|
||||
version := "1.0"
|
||||
description := "OpenID login support"
|
||||
package := "server"
|
||||
end
|
||||
|
||||
feature {CMS_SERVICE} -- Registration
|
||||
|
||||
service: detachable CMS_SERVICE
|
||||
|
||||
register (a_service: CMS_SERVICE)
|
||||
do
|
||||
a_service.map_uri ("/openid/login", agent handle_login)
|
||||
|
||||
a_service.add_menu_alter_hook (Current)
|
||||
service := a_service
|
||||
end
|
||||
|
||||
feature -- Hooks
|
||||
|
||||
menu_alter (a_menu_system: CMS_MENU_SYSTEM; a_execution: CMS_EXECUTION)
|
||||
local
|
||||
lnk: CMS_LOCAL_LINK
|
||||
req: WSF_REQUEST
|
||||
do
|
||||
req := a_execution.request
|
||||
if req.path_info.starts_with ("/user") then
|
||||
if a_execution.authenticated then
|
||||
create lnk.make ("Openid identities", "/openid/login")
|
||||
else
|
||||
create lnk.make ("Login with Openid", "/openid/login")
|
||||
end
|
||||
-- a_menu_system.management_menu.extend (lnk)
|
||||
a_menu_system.primary_tabs.extend (lnk)
|
||||
end
|
||||
end
|
||||
|
||||
form_alter (a_form: CMS_FORM; a_form_data: detachable WSF_FORM_DATA; a_execution: CMS_EXECUTION)
|
||||
local
|
||||
i: WSF_FORM_DIV
|
||||
fh: WSF_FORM_HIDDEN_INPUT
|
||||
do
|
||||
if a_form.id.same_string ("openid-login") then
|
||||
create i.make_with_text_and_css_id (
|
||||
"Login with " + a_execution.link ("OpenID", "/openid/login", Void)
|
||||
+ " , " + a_execution.link ("Google", "/openid/login?openid=https://www.google.com/accounts/o8/id", Void)
|
||||
+ " , " + a_execution.link ("Yahoo", "/openid/login?openid=https://me.yahoo.com/", Void)
|
||||
,
|
||||
"openid"
|
||||
)
|
||||
a_form.extend (i)
|
||||
elseif a_form.id.same_string ("user-login") then
|
||||
create i.make_with_text_and_css_id (
|
||||
"Login with " + a_execution.link ("OpenID", "/openid/login", Void)
|
||||
+ " , " + a_execution.link ("Google", "/openid/login?openid=https://www.google.com/accounts/o8/id", Void)
|
||||
+ " , " + a_execution.link ("Yahoo", "/openid/login?openid=https://me.yahoo.com/", Void)
|
||||
,
|
||||
"openid"
|
||||
)
|
||||
if attached a_form.items_by_type ({WSF_WIDGET_TEXT}) as lst and then not lst.is_empty then
|
||||
a_form.insert_before (i, lst.last)
|
||||
else
|
||||
a_form.extend (i)
|
||||
end
|
||||
elseif a_form.id.same_string ("user-register") then
|
||||
if attached {READABLE_STRING_GENERAL} a_execution.session_item ("openid.identity") as l_openid_identity then
|
||||
create fh.make_with_text ("openid-identity", l_openid_identity.to_string_32)
|
||||
a_execution.remove_session_item ("openid.identity")
|
||||
a_form.extend (fh)
|
||||
a_form.extend_text ("The new account will be associated with OpenID %""+ a_execution.html_encoded (l_openid_identity) +"%"")
|
||||
if attached {READABLE_STRING_GENERAL} a_execution.session_item ("openid.nickname") as l_openid_nickname then
|
||||
if attached a_form.fields_by_name ("username") as f_lst then
|
||||
across
|
||||
f_lst as c
|
||||
loop
|
||||
if attached {WSF_FORM_TEXT_INPUT} c.item as txt then
|
||||
txt.set_text_value (l_openid_nickname.to_string_32)
|
||||
end
|
||||
end
|
||||
end
|
||||
a_execution.remove_session_item ("openid.nickname")
|
||||
end
|
||||
if attached {READABLE_STRING_GENERAL} a_execution.session_item ("openid.email") as l_openid_email then
|
||||
if attached a_form.fields_by_name ("email") as f_lst then
|
||||
across
|
||||
f_lst as c
|
||||
loop
|
||||
if attached {WSF_FORM_TEXT_INPUT} c.item as txt then
|
||||
txt.set_text_value (l_openid_email.to_string_32)
|
||||
end
|
||||
end
|
||||
end
|
||||
a_execution.remove_session_item ("openid.email")
|
||||
end
|
||||
a_form.submit_actions.extend (agent openid_user_register_submitted)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
openid_user_register_submitted (a_form_data: WSF_FORM_DATA)
|
||||
do
|
||||
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
handle_login (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
if attached service as l_service then
|
||||
(create {OPENID_CMS_EXECUTION}.make (req, res, l_service)).execute
|
||||
else
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.expectation_failed)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user