cyberweb 0.5.225 → 0.6.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cyberweb might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +438 -238
- data/doc/README.gen +437 -237
- data/doc/todo/todo_for_the_cyberweb_project.md +6 -0
- data/examples/advanced/cursor_example/cursor_example.cgi +29 -0
- data/examples/advanced/draw_circle/draw_circle.cgi +13 -4
- data/examples/css/css_bubbles.html +8 -2
- data/examples/css/examples_with_borders/examples_with_borders.html +33 -0
- data/examples/javascript_and_jquery/copy_to_the_clipboard_example/copy_to_the_clipboard_example.html +80 -0
- data/images/cyberweb_theme.png +0 -0
- data/lib/cyberweb/base/misc.rb +67 -18
- data/lib/cyberweb/base_module/base_module.rb +66 -8
- data/lib/cyberweb/cascading_style_sheets/cursors.css +12 -5
- data/lib/cyberweb/cascading_style_sheets/default.css +20 -18
- data/lib/cyberweb/cascading_style_sheets/glow_effects.css +12 -6
- data/lib/cyberweb/cascading_style_sheets/misc.css +12 -1
- data/lib/cyberweb/generator/cgi.rb +3 -3
- data/lib/cyberweb/html_template/html_template.rb +172 -114
- data/lib/cyberweb/javascript/javascript.rb +34 -31
- data/lib/cyberweb/javascript_code/copy_to_the_clipboard.js +12 -0
- data/lib/cyberweb/jquery_module/jquery_module.rb +51 -0
- data/lib/cyberweb/modules/css_style.rb +27 -0
- data/lib/cyberweb/{favicon → modules}/favicon.rb +162 -33
- data/lib/cyberweb/requires/require_the_cyberweb_project.rb +6 -2
- data/lib/cyberweb/toplevel_methods/download_webpage.rb +16 -2
- data/lib/cyberweb/toplevel_methods/html_tables.rb +42 -30
- data/lib/cyberweb/toplevel_methods/log_directory.rb +11 -8
- data/lib/cyberweb/toplevel_methods/misc.rb +84 -47
- data/lib/cyberweb/toplevel_methods/path.rb +29 -8
- data/lib/cyberweb/toplevel_methods/temp_directory.rb +3 -1
- data/lib/cyberweb/version/version.rb +2 -2
- data/lib/cyberweb/web_images/map_symbol_to_image_location.rb +43 -7
- data/lib/cyberweb/web_object/favicon.rb +4 -106
- data/lib/cyberweb/web_object/html_tags.rb +133 -65
- data/lib/cyberweb/web_object/images.rb +20 -20
- data/lib/cyberweb/web_object/javascript_and_jquery.rb +39 -16
- data/lib/cyberweb/web_object/link.rb +18 -15
- data/lib/cyberweb/web_object/misc.rb +4158 -327
- data/lib/cyberweb/web_object/reset.rb +19 -15
- data/lib/cyberweb/web_object/run.rb +2 -0
- data/lib/cyberweb/web_object/web_object.rb +1 -3584
- data/lib/cyberweb/webmin/simple_forum/index.cgi +30 -0
- data/lib/cyberweb/webmin/simple_forum/simple_forum.rb +134 -0
- data/lib/cyberweb/yaml/http_status_codes.yml +3 -0
- data/lib/cyberweb/yaml/js_files_to_load.yml +6 -1
- data/test/html_template/html_template.rb +22 -3
- data/test/simple_tests/testing_the_javascript_component.cgi +32 -0
- data/test/simple_tests/testing_the_select_tag.cgi +7 -1
- metadata +13 -4
@@ -4,35 +4,30 @@
|
|
4
4
|
# =========================================================================== #
|
5
5
|
# === Cyberweb::Favicon
|
6
6
|
#
|
7
|
-
# This
|
8
|
-
# functionality if you connect to remote https hosts.
|
7
|
+
# This module can download remote favicons. OpenSSL is required for this
|
8
|
+
# functionality if you wish to connect to remote https hosts.
|
9
9
|
#
|
10
|
-
# The three optional dependencies for this
|
10
|
+
# The three optional dependencies for this module are on:
|
11
11
|
#
|
12
12
|
# → nokogiri
|
13
13
|
# → open-uri, and
|
14
14
|
# → addressable
|
15
15
|
#
|
16
|
+
# This is only relevant for the method Cyberweb::Favicon.download, though.
|
17
|
+
#
|
18
|
+
# The second primary use case for this module is via the method called
|
19
|
+
# Cyberweb::Favicon.path_of?(). This functionality will also be used
|
20
|
+
# for the HtmlTemplate class.
|
16
21
|
# =========================================================================== #
|
17
|
-
# require 'cyberweb/
|
22
|
+
# require 'cyberweb/modules/favicon.rb'
|
23
|
+
# include Cyberweb::Favicon
|
18
24
|
# =========================================================================== #
|
19
25
|
module Cyberweb
|
20
26
|
|
21
|
-
|
27
|
+
module Favicon # === Cyberweb::Favicon
|
22
28
|
|
23
29
|
require 'cyberweb/constants/constants.rb'
|
24
|
-
|
25
|
-
begin
|
26
|
-
require 'nokogiri'
|
27
|
-
rescue LoadError; end
|
28
|
-
|
29
|
-
begin
|
30
|
-
require 'open-uri'
|
31
|
-
rescue LoadError; end
|
32
|
-
|
33
|
-
begin
|
34
|
-
require 'addressable/uri'
|
35
|
-
rescue LoadError; end
|
30
|
+
require 'cyberweb/web_images/map_symbol_to_image_location.rb'
|
36
31
|
|
37
32
|
attr_accessor :data
|
38
33
|
|
@@ -43,6 +38,124 @@ class Favicon # === Cyberweb::Favicon
|
|
43
38
|
class InvalidFavicon < Error; end
|
44
39
|
class MissingFavicon < Error; end
|
45
40
|
|
41
|
+
# ========================================================================= #
|
42
|
+
# === Cyberweb::Favicon.path_of?
|
43
|
+
# ========================================================================= #
|
44
|
+
def self.path_of?(i)
|
45
|
+
if i.is_a? Array
|
46
|
+
i = i.first
|
47
|
+
end
|
48
|
+
# ======================================================================= #
|
49
|
+
# === Handle Symbols here
|
50
|
+
# ======================================================================= #
|
51
|
+
if i.is_a? Symbol
|
52
|
+
case i # case tag
|
53
|
+
# ======================================================================= #
|
54
|
+
# === :rpg_favicon
|
55
|
+
# ======================================================================= #
|
56
|
+
when :rpg_favicon,
|
57
|
+
:rpg
|
58
|
+
i = 'RPG/RPG_FAVICON.png'
|
59
|
+
# ======================================================================= #
|
60
|
+
# === :wlan_favicon
|
61
|
+
# ======================================================================= #
|
62
|
+
when :wlan_favicon,
|
63
|
+
:wlan
|
64
|
+
i = 'science/funk/WLAN_FAVICON.png'
|
65
|
+
# ======================================================================= #
|
66
|
+
# === :package
|
67
|
+
# ======================================================================= #
|
68
|
+
when :package
|
69
|
+
i = 'STD/DOWNLOAD_PACKAGE.png'
|
70
|
+
# ======================================================================= #
|
71
|
+
# === :dnd_favicon
|
72
|
+
# ======================================================================= #
|
73
|
+
when :dnd_favicon,
|
74
|
+
:dnd_favicons,
|
75
|
+
:dnd
|
76
|
+
i = 'RPG/DnD/DnD_FAVICON.png'
|
77
|
+
# ======================================================================= #
|
78
|
+
# === :ruby_favicon
|
79
|
+
# ======================================================================= #
|
80
|
+
when :ruby_favicon
|
81
|
+
i = 'programming/ruby/RUBY_FAVICON.png'
|
82
|
+
# ======================================================================= #
|
83
|
+
# === :linux_favicon
|
84
|
+
# ======================================================================= #
|
85
|
+
when :linux_favicon
|
86
|
+
i = 'linux/LINUX_FAVICON.png'
|
87
|
+
# ======================================================================= #
|
88
|
+
# === :sitemap_favicon
|
89
|
+
# ======================================================================= #
|
90
|
+
when :sitemap_favicon
|
91
|
+
i = 'SITEMAP/SITEMAP_FAVICON.png'
|
92
|
+
# ======================================================================= #
|
93
|
+
# === :science_favicon
|
94
|
+
# ======================================================================= #
|
95
|
+
when :science_favicon
|
96
|
+
i = 'science/SCIENCE_FAVICON.png'
|
97
|
+
# ======================================================================= #
|
98
|
+
# === :bioroebe_favicon
|
99
|
+
# ======================================================================= #
|
100
|
+
when :bioroebe_favicon
|
101
|
+
i = 'bioroebe/images/BIOROEBE.png'
|
102
|
+
# ======================================================================= #
|
103
|
+
# === :dsa
|
104
|
+
# ======================================================================= #
|
105
|
+
when :dsa,
|
106
|
+
:dsa_favicon
|
107
|
+
i = 'RPG/DSA/DSA_FAVICON.png'
|
108
|
+
# ======================================================================= #
|
109
|
+
# === :shadowrun_favicon
|
110
|
+
# ======================================================================= #
|
111
|
+
when :shadowrun_favicon,
|
112
|
+
:shadowrun
|
113
|
+
i = 'RPG/SR/SHADOWRUN_FAVICON.png'
|
114
|
+
# ======================================================================= #
|
115
|
+
# === :default
|
116
|
+
# ======================================================================= #
|
117
|
+
when :default
|
118
|
+
i = 'STD/ZITRONE.png'
|
119
|
+
# ======================================================================= #
|
120
|
+
# === :tai_favicon
|
121
|
+
# ======================================================================= #
|
122
|
+
when :tai_favicon
|
123
|
+
i = 'RPG/SARLEM/OSTREICH/TAI/TAI_FAVICON.png'
|
124
|
+
# ======================================================================= #
|
125
|
+
# === :sarlem
|
126
|
+
# ======================================================================= #
|
127
|
+
when :sarlem,
|
128
|
+
:sarlem_favicon
|
129
|
+
i = 'RPG/SARLEM/SARLEM_FAVICON.png'
|
130
|
+
# ======================================================================= #
|
131
|
+
# === :random
|
132
|
+
# ======================================================================= #
|
133
|
+
when :random,
|
134
|
+
:rand
|
135
|
+
i = random_favicon
|
136
|
+
# ======================================================================= #
|
137
|
+
# === :inline
|
138
|
+
#
|
139
|
+
# Add support for "inline" favicons" which are ... no favicons really.
|
140
|
+
#
|
141
|
+
# URLs prefixed with the "data:" scheme allow content creators to
|
142
|
+
# embed small files inline in documents.
|
143
|
+
# ======================================================================= #
|
144
|
+
when :inline,
|
145
|
+
:minimal,
|
146
|
+
:none
|
147
|
+
i = "<link href=data:, rel=icon>#{NL}"
|
148
|
+
else
|
149
|
+
# ===================================================================== #
|
150
|
+
# We assume this symbol to be part of WebImage. This will
|
151
|
+
# handle input such as :big_star, for example.
|
152
|
+
# ===================================================================== #
|
153
|
+
i = ::Cyberweb.get_webimage(i)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
return i
|
157
|
+
end
|
158
|
+
|
46
159
|
# ========================================================================= #
|
47
160
|
# === url?
|
48
161
|
# ========================================================================= #
|
@@ -66,6 +179,15 @@ class Favicon # === Cyberweb::Favicon
|
|
66
179
|
# Nokogiri will search for any favicon in the remote URL.
|
67
180
|
# ========================================================================= #
|
68
181
|
def self.download(url)
|
182
|
+
begin
|
183
|
+
require 'open-uri'
|
184
|
+
rescue LoadError; end
|
185
|
+
begin
|
186
|
+
require 'nokogiri'
|
187
|
+
rescue LoadError; end
|
188
|
+
begin
|
189
|
+
require 'addressable/uri'
|
190
|
+
rescue LoadError; end
|
69
191
|
uri = Addressable::URI.heuristic_parse(url)
|
70
192
|
uri = Addressable::URI.encode(uri) # needed for chars with accents in url
|
71
193
|
doc = Nokogiri::HTML(open(uri))
|
@@ -124,6 +246,24 @@ class Favicon # === Cyberweb::Favicon
|
|
124
246
|
|
125
247
|
end
|
126
248
|
|
249
|
+
# =========================================================================== #
|
250
|
+
# === Cyberweb.create_random_cfdg_favicon
|
251
|
+
#
|
252
|
+
# This is a special method, should be used internally only! (cfdg tag)
|
253
|
+
# =========================================================================== #
|
254
|
+
def self.create_random_cfdg_favicon(
|
255
|
+
img_dir = '/home/x/programming/ruby/src/image_paradise/lib/image_paradise/'
|
256
|
+
)
|
257
|
+
print_html_header
|
258
|
+
directory_with_cfdg_images = img_dir+'cfdg/'
|
259
|
+
favicon_name = 'DEFAULT_FAVICON.png'
|
260
|
+
_ = 'CFDG/'+get_files_from(directory_with_cfdg_images).sample(1)[0]
|
261
|
+
string = 'cfdg '+img_dir+'/'+_+' -b 2 -w 48 -h 48 '+img_dir+'/'+favicon_name
|
262
|
+
# ee string+'<br>'
|
263
|
+
system("#{string} 2>&1")
|
264
|
+
return favicon_name
|
265
|
+
end
|
266
|
+
|
127
267
|
# =========================================================================== #
|
128
268
|
# === Cyberweb.download_favicon
|
129
269
|
#
|
@@ -176,22 +316,11 @@ def self.return_favicon(
|
|
176
316
|
return _ # Return the result finally, as string.
|
177
317
|
end
|
178
318
|
|
179
|
-
# =========================================================================== #
|
180
|
-
# === Cyberweb.create_random_cfdg_favicon
|
181
|
-
#
|
182
|
-
# This is a special method, should be used internally only! (cfdg tag)
|
183
|
-
# =========================================================================== #
|
184
|
-
def self.create_random_cfdg_favicon(
|
185
|
-
img_dir = '/home/x/programming/ruby/src/image_paradise/lib/image_paradise/'
|
186
|
-
)
|
187
|
-
print_html_header
|
188
|
-
directory_with_cfdg_images = img_dir+'cfdg/'
|
189
|
-
favicon_name = 'DEFAULT_FAVICON.png'
|
190
|
-
_ = 'CFDG/'+get_files_from(directory_with_cfdg_images).sample(1)[0]
|
191
|
-
string = 'cfdg '+img_dir+'/'+_+' -b 2 -w 48 -h 48 '+img_dir+'/'+favicon_name
|
192
|
-
# ee string+'<br>'
|
193
|
-
system("#{string} 2>&1")
|
194
|
-
return favicon_name
|
195
319
|
end
|
196
320
|
|
321
|
+
if __FILE__ == $PROGRAM_NAME
|
322
|
+
alias e puts
|
323
|
+
# e Cyberweb::Favicon.path_of?(ARGV)
|
324
|
+
e Cyberweb::Favicon.path_of?(:ruby_favicon)
|
325
|
+
e Cyberweb::Favicon.path_of?(:backup_image)
|
197
326
|
end
|
@@ -47,7 +47,7 @@ require 'cyberweb/colours/colour_chart.rb' # This pulls in 'cyberweb/colours/col
|
|
47
47
|
# =========================================================================== #
|
48
48
|
# Load up favicon-related code next.
|
49
49
|
# =========================================================================== #
|
50
|
-
require 'cyberweb/
|
50
|
+
require 'cyberweb/modules/favicon.rb'
|
51
51
|
|
52
52
|
# =========================================================================== #
|
53
53
|
# Add encoding support:
|
@@ -150,4 +150,8 @@ Cyberweb.include_greek_letters # Include the greek letters here.
|
|
150
150
|
|
151
151
|
require 'cyberweb/css_manager/css_manager.rb'
|
152
152
|
|
153
|
-
require 'cyberweb/utility_scripts/images_to_html/images_to_html.rb'
|
153
|
+
require 'cyberweb/utility_scripts/images_to_html/images_to_html.rb'
|
154
|
+
|
155
|
+
# Include the SimpleForum as well:
|
156
|
+
require 'cyberweb/cybersprawl/simple_forum/simple_forum.rb'
|
157
|
+
|
@@ -14,16 +14,30 @@ module Cyberweb
|
|
14
14
|
# === Cyberweb.download_webpage
|
15
15
|
#
|
16
16
|
# The argument should be a remote website.
|
17
|
+
#
|
18
|
+
# Usage example:
|
19
|
+
#
|
20
|
+
# Cyberweb.download_webpage('https://www.cardmarket.com/en/Magic/Orders/Sales/ShoppingCart')
|
21
|
+
# x = Cyberweb.download_webpage('https://www.cardmarket.com/en/Magic/Orders/Sales/ShoppingCart', { http_basic_authentication: ['shev55y@inbox.ar', 'JJJieie33aeeeggkhlhgejk7878eKIEUIbeue'] })
|
22
|
+
#
|
17
23
|
# ========================================================================= #
|
18
24
|
def self.download_webpage(
|
19
|
-
remote_URL = ARGV
|
25
|
+
remote_URL = ARGV,
|
26
|
+
options = {}
|
20
27
|
)
|
21
28
|
require 'cyberweb/coloured_tags/coloured_tags.rb'
|
22
29
|
require 'open-uri'
|
23
30
|
if remote_URL.is_a? Array
|
24
31
|
remote_URL = remote_URL.first
|
25
32
|
end
|
26
|
-
|
33
|
+
if options and options.is_a?(Hash) and options.has_key?(:http_basic_authentication)
|
34
|
+
pp options
|
35
|
+
pp 1
|
36
|
+
what = URI.open(remote_URL, options[:http_basic_authentication]).read
|
37
|
+
else
|
38
|
+
pp 2
|
39
|
+
what = URI.open(remote_URL).read
|
40
|
+
end
|
27
41
|
into = File.basename(remote_URL)+'.html'
|
28
42
|
if block_given?
|
29
43
|
yielded = yield
|
@@ -18,11 +18,17 @@ module Cyberweb
|
|
18
18
|
require 'cyberweb/toplevel_methods/css.rb'
|
19
19
|
|
20
20
|
# ========================================================================= #
|
21
|
-
# === Cyberweb.
|
21
|
+
# === Cyberweb.string_table2
|
22
22
|
#
|
23
23
|
# This returns the string form of a <table> tag.
|
24
|
+
#
|
25
|
+
# Arguments to this method could look like this:
|
26
|
+
#
|
27
|
+
# Cyberweb.string_table2('mars1em') { an_array_here } # To pass an array as the main dataset.
|
28
|
+
# Cyberweb.string_table2('mars1em') { [1,2,3,4,5,6] } # ^^^ as stated above
|
29
|
+
#
|
24
30
|
# ========================================================================= #
|
25
|
-
def self.
|
31
|
+
def self.string_table2(
|
26
32
|
css_class = '',
|
27
33
|
id = '',
|
28
34
|
css_style = '',
|
@@ -36,6 +42,12 @@ module Cyberweb
|
|
36
42
|
if block_given?
|
37
43
|
yielded = yield
|
38
44
|
if yielded.is_a? Hash
|
45
|
+
# =================================================================== #
|
46
|
+
# === :with_this_data
|
47
|
+
# =================================================================== #
|
48
|
+
if yielded.has_key? :with_this_data
|
49
|
+
content = yielded.delete(:with_this_data)
|
50
|
+
end
|
39
51
|
# =================================================================== #
|
40
52
|
# === :read_in_this_file
|
41
53
|
# =================================================================== #
|
@@ -57,7 +69,16 @@ module Cyberweb
|
|
57
69
|
end
|
58
70
|
end
|
59
71
|
end
|
72
|
+
# ===================================================================== #
|
73
|
+
# If content is empty then we will replace the content with the
|
74
|
+
# value of the passed block next.
|
75
|
+
# ===================================================================== #
|
76
|
+
if content.empty? and !yielded.empty?
|
77
|
+
content = yielded
|
78
|
+
end
|
60
79
|
end
|
80
|
+
css_class = css_class.to_s
|
81
|
+
|
61
82
|
_ = '<table'.dup
|
62
83
|
_ << return_css_class(css_class)
|
63
84
|
_ << return_the_id(id)
|
@@ -65,29 +86,22 @@ module Cyberweb
|
|
65
86
|
_ << '>'
|
66
87
|
_ << "\n"
|
67
88
|
content.each_with_index { |item, index|
|
68
|
-
if index %
|
69
|
-
_ << '<tr>'+N+' <td>'+item+'</td>'+N
|
70
|
-
elsif index % 3 == 2
|
71
|
-
_ << ' <td>'+item+'</td>'+N+'</tr>'+N
|
89
|
+
if index % 2 == 0
|
90
|
+
_ << '<tr>'+N+' <td>'+item.to_s+'</td>'+N
|
72
91
|
else
|
73
|
-
_ <<
|
92
|
+
_ << " <td>#{item}</td>#{N}</tr>#{N}"
|
74
93
|
end
|
75
94
|
}
|
76
95
|
_ << ::Cyberweb.string_ctable.to_s
|
77
|
-
|
96
|
+
return _
|
97
|
+
end; self.instance_eval { alias string_table string_table2 } # === Cyberweb.string_table
|
78
98
|
|
79
99
|
# ========================================================================= #
|
80
|
-
# === Cyberweb.
|
100
|
+
# === Cyberweb.string_table3
|
81
101
|
#
|
82
102
|
# This returns the string form of a <table> tag.
|
83
|
-
#
|
84
|
-
# Arguments to this method could look like this:
|
85
|
-
#
|
86
|
-
# Cyberweb.string_table2('mars1em') { an_array_here } # To pass an array as the main dataset.
|
87
|
-
# Cyberweb.string_table2('mars1em') { [1,2,3,4,5,6] } # ^^^ as stated above
|
88
|
-
#
|
89
103
|
# ========================================================================= #
|
90
|
-
def self.
|
104
|
+
def self.string_table3(
|
91
105
|
css_class = '',
|
92
106
|
id = '',
|
93
107
|
css_style = '',
|
@@ -101,6 +115,12 @@ module Cyberweb
|
|
101
115
|
if block_given?
|
102
116
|
yielded = yield
|
103
117
|
if yielded.is_a? Hash
|
118
|
+
# =================================================================== #
|
119
|
+
# === :with_this_data
|
120
|
+
# =================================================================== #
|
121
|
+
if yielded.has_key? :with_this_data
|
122
|
+
content = yielded.delete(:with_this_data)
|
123
|
+
end
|
104
124
|
# =================================================================== #
|
105
125
|
# === :read_in_this_file
|
106
126
|
# =================================================================== #
|
@@ -122,16 +142,7 @@ module Cyberweb
|
|
122
142
|
end
|
123
143
|
end
|
124
144
|
end
|
125
|
-
# ===================================================================== #
|
126
|
-
# If content is empty then we will replace the content with the
|
127
|
-
# value of the passed block next.
|
128
|
-
# ===================================================================== #
|
129
|
-
if content.empty? and !yielded.empty?
|
130
|
-
content = yielded
|
131
|
-
end
|
132
145
|
end
|
133
|
-
css_class = css_class.to_s
|
134
|
-
|
135
146
|
_ = '<table'.dup
|
136
147
|
_ << return_css_class(css_class)
|
137
148
|
_ << return_the_id(id)
|
@@ -139,15 +150,16 @@ module Cyberweb
|
|
139
150
|
_ << '>'
|
140
151
|
_ << "\n"
|
141
152
|
content.each_with_index { |item, index|
|
142
|
-
if index %
|
143
|
-
_ << '<tr>'+N+' <td>'+item
|
153
|
+
if index % 3 == 0
|
154
|
+
_ << '<tr>'+N+' <td>'+item+'</td>'+N
|
155
|
+
elsif index % 3 == 2
|
156
|
+
_ << ' <td>'+item+'</td>'+N+'</tr>'+N
|
144
157
|
else
|
145
|
-
_ <<
|
158
|
+
_ << ' <td>'+item+'</td>'+N+N
|
146
159
|
end
|
147
160
|
}
|
148
161
|
_ << ::Cyberweb.string_ctable.to_s
|
149
|
-
|
150
|
-
end; self.instance_eval { alias string_table string_table2 } # === Cyberweb.string_table
|
162
|
+
end
|
151
163
|
|
152
164
|
# ========================================================================= #
|
153
165
|
# === Cyberweb.string_table2_with_heading
|
@@ -46,7 +46,7 @@ module Cyberweb
|
|
46
46
|
# ======================================================================= #
|
47
47
|
when :depot_temp_dir_cyberweb,
|
48
48
|
:depot_temp_dir_web_object
|
49
|
-
i = '/
|
49
|
+
i = '/Depot/Temp/cyberweb/'
|
50
50
|
end
|
51
51
|
unless i.end_with? '/'
|
52
52
|
i = i.dup if i.frozen?
|
@@ -55,13 +55,6 @@ module Cyberweb
|
|
55
55
|
@log_directory = i.freeze
|
56
56
|
end; self.instance_eval { alias set_log_dir set_log_directory } # === Cyberweb.set_log_dir
|
57
57
|
|
58
|
-
# ========================================================================= #
|
59
|
-
# === Cyberweb.log_directory?
|
60
|
-
# ========================================================================= #
|
61
|
-
def self.log_directory?
|
62
|
-
@log_directory
|
63
|
-
end
|
64
|
-
|
65
58
|
# ========================================================================= #
|
66
59
|
# === log_directory?
|
67
60
|
# ========================================================================= #
|
@@ -77,6 +70,16 @@ module Cyberweb
|
|
77
70
|
MISSING_IMAGES_ARE_STORED_HERE =
|
78
71
|
"#{@log_directory}web_object_errors.log"
|
79
72
|
|
73
|
+
# ========================================================================= #
|
74
|
+
# === Cyberweb.log_directory?
|
75
|
+
#
|
76
|
+
# On my home system this method will return a String such as
|
77
|
+
# "/home/Temp/cyberweb/".
|
78
|
+
# ========================================================================= #
|
79
|
+
def self.log_directory?
|
80
|
+
@log_directory
|
81
|
+
end; self.instance_eval { alias log_dir? log_directory? } # === Cyberweb.log_dir?
|
82
|
+
|
80
83
|
end
|
81
84
|
|
82
85
|
if __FILE__ == $PROGRAM_NAME
|
@@ -62,6 +62,90 @@ module Cyberweb
|
|
62
62
|
require 'cyberweb/toplevel_methods/write_what_into.rb'
|
63
63
|
require 'cyberweb/html_tags/option.rb'
|
64
64
|
|
65
|
+
# ========================================================================= #
|
66
|
+
# === Cyberweb.draw_triangle
|
67
|
+
#
|
68
|
+
# This method will draw a triangle, via CSS.
|
69
|
+
#
|
70
|
+
# Usage example:
|
71
|
+
#
|
72
|
+
# Cyberweb.draw_triangle(width: 200, height: 500, background_color: :steelblue, border_radius: '30%')
|
73
|
+
#
|
74
|
+
# ========================================================================= #
|
75
|
+
def self.draw_triangle(
|
76
|
+
hash = {
|
77
|
+
width: 0, # in px
|
78
|
+
height: 0, # in px
|
79
|
+
colour_to_use: '#2762e9',
|
80
|
+
border_rules: '
|
81
|
+
border-left: 50px solid transparent;
|
82
|
+
border-right: 50px solid transparent;
|
83
|
+
border-bottom: 100px solid '+colour_to_use+';
|
84
|
+
'
|
85
|
+
},
|
86
|
+
counter = @internal_hash[:counter_for_the_dynamic_circle] # Repurpose it here.
|
87
|
+
)
|
88
|
+
_ = "\n".dup
|
89
|
+
_ << "<style>\n"
|
90
|
+
_ << "div.dynamic_triangle#{counter} {\n"
|
91
|
+
_ << " width: #{hash[:width]};\n"
|
92
|
+
_ << " height: #{hash[:height]};\n"
|
93
|
+
_ << " background: #{hash[:colour_to_use]};\n"
|
94
|
+
_ << " #{hash[:border_rulres]};\n"
|
95
|
+
_ << "}\n"
|
96
|
+
_ << "</style>\n"
|
97
|
+
_ << "<div class=\"dynamic_triangle#{counter}\"></div>"
|
98
|
+
increment_draw_circle_counter
|
99
|
+
return _
|
100
|
+
end
|
101
|
+
|
102
|
+
# ========================================================================= #
|
103
|
+
# === Cyberweb.draw_circle
|
104
|
+
#
|
105
|
+
# This method will draw a circle, via CSS.
|
106
|
+
#
|
107
|
+
# Usage example:
|
108
|
+
#
|
109
|
+
# Cyberweb.draw_circle(width: 200, height: 500, background_color: :steelblue, border_radius: '30%')
|
110
|
+
#
|
111
|
+
# ========================================================================= #
|
112
|
+
def self.draw_circle(
|
113
|
+
hash = {
|
114
|
+
width: 200, # in px
|
115
|
+
height: 200, # in px
|
116
|
+
background_color: :crimson,
|
117
|
+
border_radius: '50%'
|
118
|
+
},
|
119
|
+
counter = @internal_hash[:counter_for_the_dynamic_circle]
|
120
|
+
)
|
121
|
+
_ = "\n".dup
|
122
|
+
_ << "<style>\n"
|
123
|
+
_ << "div.dynamic_circle#{counter} {\n"
|
124
|
+
_ << " width: #{hash[:width]}px;\n"
|
125
|
+
_ << " height: #{hash[:height]}px;\n"
|
126
|
+
_ << " background: #{hash[:background_color]};\n"
|
127
|
+
_ << " border-radius: #{hash[:border_radius]};\n"
|
128
|
+
_ << "}\n"
|
129
|
+
_ << "</style>\n"
|
130
|
+
_ << "<div class=\"dynamic_circle#{counter}\"></div>"
|
131
|
+
increment_draw_circle_counter
|
132
|
+
return _
|
133
|
+
end
|
134
|
+
|
135
|
+
# ========================================================================= #
|
136
|
+
# === Cyberweb.increment_draw_circle_counter
|
137
|
+
# ========================================================================= #
|
138
|
+
def self.increment_draw_circle_counter
|
139
|
+
@internal_hash[:counter_for_the_dynamic_circle] += 1
|
140
|
+
end
|
141
|
+
|
142
|
+
# ========================================================================= #
|
143
|
+
# === Cyberweb.return_pretty_stars
|
144
|
+
# ========================================================================= #
|
145
|
+
def self.return_pretty_stars
|
146
|
+
return '<hr class="hr_stars">'
|
147
|
+
end
|
148
|
+
|
65
149
|
# ========================================================================= #
|
66
150
|
# === send_email
|
67
151
|
#
|
@@ -404,46 +488,6 @@ and <b>newlines</b>.</p>
|
|
404
488
|
end
|
405
489
|
end
|
406
490
|
|
407
|
-
# ========================================================================= #
|
408
|
-
# === Cyberweb.draw_circle
|
409
|
-
#
|
410
|
-
# This method will draw a circle, via CSS.
|
411
|
-
#
|
412
|
-
# Usage example:
|
413
|
-
#
|
414
|
-
# Cyberweb.draw_circle(width: 200, height: 500, background_color: :steelblue, border_radius: '30%')
|
415
|
-
#
|
416
|
-
# ========================================================================= #
|
417
|
-
def self.draw_circle(
|
418
|
-
hash = {
|
419
|
-
width: 200, # in px
|
420
|
-
height: 200, # in px
|
421
|
-
background_color: :crimson,
|
422
|
-
border_radius: '50%'
|
423
|
-
},
|
424
|
-
counter = @internal_hash[:counter_for_the_dynamic_circle]
|
425
|
-
)
|
426
|
-
_ = "\n".dup
|
427
|
-
_ << "<style>\n"
|
428
|
-
_ << "div.dynamic_circle#{counter} {\n"
|
429
|
-
_ << " width: #{hash[:width]}px;\n"
|
430
|
-
_ << " height: #{hash[:height]}px;\n"
|
431
|
-
_ << " background: #{hash[:background_color]};\n"
|
432
|
-
_ << " border-radius: #{hash[:border_radius]};\n"
|
433
|
-
_ << "}\n"
|
434
|
-
_ << "</style>\n"
|
435
|
-
_ << "<div class=\"dynamic_circle#{counter}\"></div>"
|
436
|
-
increment_draw_circle_counter
|
437
|
-
return _
|
438
|
-
end
|
439
|
-
|
440
|
-
# ========================================================================= #
|
441
|
-
# === Cyberweb.increment_draw_circle_counter
|
442
|
-
# ========================================================================= #
|
443
|
-
def self.increment_draw_circle_counter
|
444
|
-
@internal_hash[:counter_for_the_dynamic_circle] += 1
|
445
|
-
end
|
446
|
-
|
447
491
|
# ========================================================================= #
|
448
492
|
# === Cyberweb.is_a_video_file?
|
449
493
|
#
|
@@ -483,13 +527,6 @@ and <b>newlines</b>.</p>
|
|
483
527
|
return _
|
484
528
|
end
|
485
529
|
|
486
|
-
# ========================================================================= #
|
487
|
-
# === Cyberweb.return_pretty_stars
|
488
|
-
# ========================================================================= #
|
489
|
-
def self.return_pretty_stars
|
490
|
-
return '<hr class="hr_stars">'
|
491
|
-
end
|
492
|
-
|
493
530
|
# ========================================================================= #
|
494
531
|
# === show_ruby_file
|
495
532
|
#
|
@@ -9,6 +9,33 @@ module Cyberweb
|
|
9
9
|
require 'cyberweb/toplevel_methods/server_base_directory.rb'
|
10
10
|
require 'cyberweb/toplevel_methods/return_pwd.rb'
|
11
11
|
|
12
|
+
# ========================================================================= #
|
13
|
+
# === Cyberweb.converted_path_to_the_directory_containing_the_copied_javascript_files
|
14
|
+
#
|
15
|
+
# This method may return a String such as
|
16
|
+
# "../../../../Temp/cyberweb/javascript_code/".
|
17
|
+
# ========================================================================= #
|
18
|
+
def self.converted_path_to_the_directory_containing_the_copied_javascript_files
|
19
|
+
"#{converted_path}#{converted_path}Temp/cyberweb/javascript_code/"
|
20
|
+
end
|
21
|
+
|
22
|
+
# ========================================================================= #
|
23
|
+
# === Cyberweb.converted_path_to_project_base_dir
|
24
|
+
#
|
25
|
+
# This method may return a String such as
|
26
|
+
# "../../../../cyberweb/lib/cyberweb/".
|
27
|
+
# ========================================================================= #
|
28
|
+
def self.converted_path_to_project_base_dir
|
29
|
+
"#{converted_path}cyberweb/lib/cyberweb/"
|
30
|
+
end
|
31
|
+
|
32
|
+
# ========================================================================= #
|
33
|
+
# === Cyberweb.converted_path_to_data
|
34
|
+
# ========================================================================= #
|
35
|
+
def self.converted_path_to_data
|
36
|
+
"#{converted_path}data/"
|
37
|
+
end; self.instance_eval { alias path_to_data? converted_path_to_data } # === Cyberweb.path_to_data?
|
38
|
+
|
12
39
|
# ========================================================================= #
|
13
40
|
# === Cyberweb.converted_path
|
14
41
|
#
|
@@ -18,20 +45,14 @@ module Cyberweb
|
|
18
45
|
# It can be overruled on a per-directory setting, using a yaml file.
|
19
46
|
# ========================================================================= #
|
20
47
|
def self.converted_path(
|
21
|
-
result = '../' *
|
48
|
+
result = '../' *
|
49
|
+
::Cyberweb.n_slashes_towards_the_server_base_directory
|
22
50
|
)
|
23
51
|
return result
|
24
52
|
end; self.instance_eval { alias cyberweb_fixed_path? converted_path } # === Cyberweb.cyberweb_fixed_path?
|
25
53
|
self.instance_eval { alias fixed_path? converted_path } # === Cyberweb.fixed_path?
|
26
54
|
self.instance_eval { alias path? converted_path } # === Cyberweb.path?
|
27
55
|
self.instance_eval { alias local_base? converted_path } # === Cyberweb.local_base?
|
28
|
-
|
29
|
-
# ========================================================================= #
|
30
|
-
# === Cyberweb.converted_path_to_data
|
31
|
-
# ========================================================================= #
|
32
|
-
def self.converted_path_to_data
|
33
|
-
"#{converted_path}data/"
|
34
|
-
end; self.instance_eval { alias path_to_data? converted_path_to_data } # === Cyberweb.path_to_data?
|
35
56
|
|
36
57
|
# ========================================================================= #
|
37
58
|
# === Cyberweb.n_slashes_towards_the_server_base_directory
|