spiderfw 0.6.21 → 0.6.22
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.
- data/CHANGELOG +33 -0
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/apps/core/admin/_init.rb +4 -0
- data/apps/core/admin/admin.rb +20 -4
- data/apps/core/admin/controllers/admin_controller.rb +63 -4
- data/apps/core/admin/controllers/app_admin_controller.rb +15 -0
- data/apps/core/admin/data/locale/it/LC_MESSAGES/admin.mo +0 -0
- data/apps/core/admin/po/admin.pot +33 -0
- data/apps/core/admin/po/it/admin.po +34 -0
- data/apps/core/admin/public/css/admin.css +13 -0
- data/apps/core/admin/public/css/login.css +51 -0
- data/apps/core/admin/public/css/sass/admin.css +198 -0
- data/apps/core/admin/public/css/sass/bootstrap/bootstrap.css +3107 -0
- data/apps/core/admin/public/img/css/header_bg.png +0 -0
- data/apps/core/admin/public/img/css/noise.png +0 -0
- data/apps/core/admin/public/img/css/side_bg.png +0 -0
- data/apps/core/admin/public/img/icons/logout.png +0 -0
- data/apps/core/admin/public/img/icons-s845a69dd9f.png +0 -0
- data/apps/core/admin/public/js/bootstrap-alerts.js +113 -0
- data/apps/core/admin/public/js/bootstrap-buttons.js +62 -0
- data/apps/core/admin/public/js/bootstrap-dropdown.js +55 -0
- data/apps/core/admin/public/js/bootstrap-modal.js +260 -0
- data/apps/core/admin/public/js/bootstrap-popover.js +90 -0
- data/apps/core/admin/public/js/bootstrap-scrollspy.js +107 -0
- data/apps/core/admin/public/js/bootstrap-tabs.js +80 -0
- data/apps/core/admin/public/js/bootstrap-twipsy.js +321 -0
- data/apps/core/admin/public/sass/admin.scss +167 -0
- data/apps/core/admin/public/sass/bootstrap/bootstrap.scss +29 -0
- data/apps/core/admin/public/sass/bootstrap/forms.scss +478 -0
- data/apps/core/admin/public/sass/bootstrap/mixins.scss +220 -0
- data/apps/core/admin/public/sass/bootstrap/patterns.scss +1062 -0
- data/apps/core/admin/public/sass/bootstrap/reset.scss +141 -0
- data/apps/core/admin/public/sass/bootstrap/scaffolding.scss +136 -0
- data/apps/core/admin/public/sass/bootstrap/tables.scss +224 -0
- data/apps/core/admin/public/sass/bootstrap/type.scss +187 -0
- data/apps/core/admin/public/sass/bootstrap/variables.scss +60 -0
- data/apps/core/admin/public/sass/grid.scss +54 -0
- data/apps/core/admin/views/_app_info.shtml +5 -0
- data/apps/core/admin/views/admin.layout.shtml +35 -0
- data/apps/core/admin/views/index.shtml +1 -1
- data/apps/core/admin/views/login.layout.shtml +13 -0
- data/apps/core/auth/controllers/mixins/auth_helper.rb +1 -1
- data/apps/core/auth/models/super_user.rb +6 -0
- data/apps/core/auth/models/user.rb +9 -0
- data/apps/core/components/assets.rb +5 -1
- data/apps/core/components/data/locale/it/LC_MESSAGES/spider_components.mo +0 -0
- data/apps/core/components/po/it/spider_components.po +23 -9
- data/apps/core/components/po/spider_components.pot +16 -8
- data/apps/core/components/public/css/admin.css +0 -12
- data/apps/core/components/public/css/crud.css +16 -19
- data/apps/core/components/public/css/table.css +11 -5
- data/apps/core/components/public/js/less-1.1.3.min.js +16 -0
- data/apps/core/components/public/widgets/table.js +1 -1
- data/apps/core/components/widgets/admin/admin.rb +10 -0
- data/apps/core/components/widgets/admin/admin.shtml +24 -4
- data/apps/core/components/widgets/confirm/confirm.rb +2 -2
- data/apps/core/components/widgets/confirm/confirm.shtml +5 -2
- data/apps/core/components/widgets/crud/crud.rb +10 -1
- data/apps/core/components/widgets/crud/crud.shtml +18 -21
- data/apps/core/components/widgets/menu/menu.shtml +1 -2
- data/apps/core/components/widgets/switcher/switcher.rb +6 -3
- data/apps/core/components/widgets/switcher/templates/default.shtml +3 -1
- data/apps/core/components/widgets/table/table.rb +3 -2
- data/apps/core/components/widgets/table/table.shtml +44 -25
- data/apps/core/forms/data/locale/it/LC_MESSAGES/spider_forms.mo +0 -0
- data/apps/core/forms/po/it/spider_forms.po +7 -2
- data/apps/core/forms/po/spider_forms.pot +5 -1
- data/apps/core/forms/public/css/form.css +3 -3
- data/apps/core/forms/public/css/html_area.css +0 -1
- data/apps/core/forms/public/date_time.js +4 -3
- data/apps/core/forms/public/select.js +5 -4
- data/apps/core/forms/tags/element_label.erb +1 -1
- data/apps/core/forms/tags/row.erb +1 -1
- data/apps/core/forms/widgets/form/form.rb +23 -1
- data/apps/core/forms/widgets/form/form.shtml +7 -8
- data/apps/core/forms/widgets/inputs/checkbox/checkbox.shtml +3 -3
- data/apps/core/forms/widgets/inputs/date_time/date_time.shtml +3 -3
- data/apps/core/forms/widgets/inputs/file_input/file_input.rb +4 -2
- data/apps/core/forms/widgets/inputs/file_input/file_input.shtml +1 -1
- data/apps/core/forms/widgets/inputs/hidden/hidden.shtml +1 -1
- data/apps/core/forms/widgets/inputs/html_area/html_area.shtml +2 -2
- data/apps/core/forms/widgets/inputs/password/password.shtml +3 -3
- data/apps/core/forms/widgets/inputs/search_select/search_select.shtml +2 -2
- data/apps/core/forms/widgets/inputs/select/select.shtml +16 -13
- data/apps/core/forms/widgets/inputs/text/text.shtml +3 -3
- data/apps/core/forms/widgets/inputs/text_area/text_area.shtml +5 -2
- data/apps/core/forms/widgets/inputs/time_span/time_span.shtml +3 -3
- data/apps/messenger/_init.rb +10 -2
- data/apps/messenger/controllers/messenger_admin_controller.rb +53 -0
- data/apps/messenger/controllers/messenger_controller.rb +2 -0
- data/apps/messenger/controllers/mixins/messenger_helper.rb +2 -2
- data/apps/messenger/models/message.rb +1 -1
- data/apps/messenger/public/app_icon.png +0 -0
- data/apps/messenger/views/admin/_admin.layout.shtml +26 -0
- data/apps/messenger/views/admin/index.shtml +13 -0
- data/apps/messenger/views/admin/queue.shtml +28 -0
- data/apps/messenger/views/index.shtml +3 -3
- data/data/locale/it/LC_MESSAGES/spider.mo +0 -0
- data/lib/spiderfw/app.rb +10 -1
- data/lib/spiderfw/cache/template_cache.rb +21 -22
- data/lib/spiderfw/cmd/commands/app.rb +3 -3
- data/lib/spiderfw/cmd/commands/setup.rb +1 -1
- data/lib/spiderfw/config/options/spider.rb +18 -2
- data/lib/spiderfw/controller/controller.rb +9 -3
- data/lib/spiderfw/controller/dispatcher.rb +25 -12
- data/lib/spiderfw/controller/home_controller.rb +3 -3
- data/lib/spiderfw/controller/http_controller.rb +11 -0
- data/lib/spiderfw/controller/mixins/static_content.rb +3 -12
- data/lib/spiderfw/controller/mixins/visual.rb +21 -20
- data/lib/spiderfw/controller/request.rb +1 -3
- data/lib/spiderfw/http/adapters/mongrel.rb +1 -1
- data/lib/spiderfw/i18n/gettext.rb +14 -0
- data/lib/spiderfw/i18n/shtml_parser.rb +2 -2
- data/lib/spiderfw/model/base_model.rb +4 -3
- data/lib/spiderfw/model/mappers/db_mapper.rb +137 -79
- data/lib/spiderfw/model/mappers/mapper.rb +6 -2
- data/lib/spiderfw/model/migrations/drop_element.rb +1 -1
- data/lib/spiderfw/model/migrations/previous_model.rb +73 -0
- data/lib/spiderfw/model/migrations/rename_element.rb +42 -0
- data/lib/spiderfw/model/migrations.rb +14 -1
- data/lib/spiderfw/model/mixins/tree.rb +65 -19
- data/lib/spiderfw/model/model_hash.rb +9 -5
- data/lib/spiderfw/model/query.rb +8 -0
- data/lib/spiderfw/model/query_funcs.rb +23 -0
- data/lib/spiderfw/model/query_set.rb +1 -1
- data/lib/spiderfw/model/request.rb +11 -3
- data/lib/spiderfw/model/storage/db/adapters/mysql.rb +28 -1
- data/lib/spiderfw/model/storage/db/adapters/oracle.rb +10 -10
- data/lib/spiderfw/model/storage/db/db_schema.rb +20 -3
- data/lib/spiderfw/model/storage/db/db_storage.rb +39 -17
- data/lib/spiderfw/setup/app_manager.rb +69 -31
- data/lib/spiderfw/setup/setup_task.rb +76 -8
- data/lib/spiderfw/spider.rb +21 -1
- data/lib/spiderfw/templates/blocks/text.rb +4 -4
- data/lib/spiderfw/templates/blocks/text_domain.rb +25 -0
- data/lib/spiderfw/templates/blocks/widget.rb +1 -1
- data/lib/spiderfw/templates/layout.rb +160 -92
- data/lib/spiderfw/templates/resources/less.rb +10 -2
- data/lib/spiderfw/templates/resources/sass.rb +66 -9
- data/lib/spiderfw/templates/template.rb +35 -10
- data/lib/spiderfw/templates/template_blocks.rb +6 -3
- data/lib/spiderfw/utils/logger.rb +20 -0
- data/lib/spiderfw/utils/memory.rb +7 -3
- data/lib/spiderfw/widget/widget.rb +13 -7
- data/lib/spiderfw/widget/widget_attributes.rb +2 -2
- data/spider.gemspec +1 -0
- metadata +68 -11
- data/apps/core/admin/views/spider_admin.layout.shtml +0 -23
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
</div>
|
|
8
8
|
<div sp:if="@next_step == :text" class="add_box">
|
|
9
9
|
<span sp:if="@multiple" class="add_text">Aggiungi:</span>
|
|
10
|
-
<input type="text" name="{ @name }[text]" value="" size="{ @size }" />
|
|
10
|
+
<input type="text" name="{ @name }[text]" id="input" value="" size="{ @size }" />
|
|
11
11
|
<input sp:if="!@multiple" class="clear-hidden" type="hidden" name="_w{ @widget[:param] }[clear]" value="">
|
|
12
12
|
</div>
|
|
13
13
|
<div sp:if="@next_step == :select" class="notice">
|
|
14
14
|
Per favore, affina la ricerca:
|
|
15
15
|
</div>
|
|
16
|
-
<select name="{ @value_param }" sp:if="@next_step == :select">
|
|
16
|
+
<select name="{ @value_param }" id="input" sp:if="@next_step == :select">
|
|
17
17
|
<option sp:if="@blank_option"> </option>
|
|
18
18
|
<option sp:each_index="@data |i|" value="{ @search_values[i] }" sp:attr-if="@selected[@search_values[i]],selected">
|
|
19
19
|
{ @data[i].to_s }
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
<div class="input">
|
|
2
|
+
<tpl:asset type="js" src="input.js" />
|
|
3
|
+
<tpl:asset type="js" src="select.js" />
|
|
4
|
+
<tpl:asset type="js" app="core/components" src="js/jquery/plugins/bsmselect/js/jquery.bsmselect.js" if="@multiple" />
|
|
5
|
+
<tpl:asset type="css" app="core/components" src="js/jquery/plugins/bsmselect/css/jquery.bsmselect.css" if="@multiple" />
|
|
6
|
+
<select name="{ @value_param }" id="input" sp:attr-if="@multiple,multiple" title="">
|
|
7
|
+
|
|
8
|
+
<option sp:if="@blank_option"> </option>
|
|
9
|
+
<option sp:each_index="@data |i|" value="{ @values[i] }" sp:attr-if="@selected[values[i]],selected">
|
|
10
|
+
<tpl:pass sp:if="@tree_depth">
|
|
11
|
+
{ "-"*(@data[i].get(@tree_depth)||0) }
|
|
12
|
+
</tpl:pass>
|
|
13
|
+
{ @data[i].to_s }
|
|
14
|
+
</option>
|
|
15
|
+
</select>
|
|
16
|
+
</div>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<
|
|
2
|
-
<input type="text" name="{ @name }" value="{ @formatted_value }" size="{ @size }">
|
|
3
|
-
</
|
|
1
|
+
<div class="input">
|
|
2
|
+
<input type="text" id="input" name="{ @name }" value="{ @formatted_value }" size="{ @size }">
|
|
3
|
+
</div>
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
<
|
|
2
|
-
<tpl:asset type="js"
|
|
1
|
+
<div class="input">
|
|
2
|
+
<tpl:asset type="js" src="input.js" /><tpl:asset type="js" src="text_area.js" />
|
|
3
|
+
<tpl:asset type="js" app="core/components" src="js/jquery/plugins/autogrow/jquery.autogrow.js" />
|
|
4
|
+
<textarea name="{ @name }" id="input" rows="{ @rows }" cols="{ @cols }">{ @value }</textarea>
|
|
5
|
+
</div>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<
|
|
2
|
-
<input type="text" name="{ @name }[val]" value="{ @formatted_value }" size="8" >
|
|
1
|
+
<div class="input">
|
|
2
|
+
<input type="text" name="{ @name }[val]" id="input" value="{ @formatted_value }" size="8" >
|
|
3
3
|
<select name="{ @name }[unit]">
|
|
4
4
|
<option value="sec" sp:attr-if="(@unit == 'sec'),selected">_(Seconds)</option>
|
|
5
5
|
<option value="min" sp:attr-if="(@unit == 'min'),selected">_(Minutes)</option>
|
|
6
6
|
<option value="hours" sp:attr-if="(@unit == 'hours'),selected">_(Hours)</option>
|
|
7
7
|
</select>
|
|
8
|
-
</
|
|
8
|
+
</div>
|
data/apps/messenger/_init.rb
CHANGED
|
@@ -9,16 +9,19 @@ module Spider
|
|
|
9
9
|
@version = 0.1
|
|
10
10
|
@path = File.dirname(__FILE__)
|
|
11
11
|
@controller = :MessengerController
|
|
12
|
+
@full_name = 'Messenger'
|
|
13
|
+
@description = 'Messenger'
|
|
12
14
|
include Spider::App
|
|
13
15
|
|
|
14
16
|
end
|
|
15
17
|
|
|
16
|
-
Spider::Admin.add(Messenger)
|
|
18
|
+
#Spider::Admin.add(Messenger)
|
|
17
19
|
|
|
18
20
|
end
|
|
19
21
|
|
|
20
22
|
require 'apps/messenger/messenger'
|
|
21
23
|
require 'apps/messenger/controllers/messenger_controller'
|
|
24
|
+
require 'apps/messenger/controllers/messenger_admin_controller'
|
|
22
25
|
require 'apps/messenger/controllers/mixins/messenger_helper'
|
|
23
26
|
|
|
24
27
|
(Spider.conf.get('messenger.email.backends') || []).each do |backend|
|
|
@@ -26,4 +29,9 @@ require 'apps/messenger/controllers/mixins/messenger_helper'
|
|
|
26
29
|
end
|
|
27
30
|
(Spider.conf.get('messenger.sms.backends') || []).each do |backend|
|
|
28
31
|
require File.join('apps/messenger/backends/sms/', backend)
|
|
29
|
-
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
Spider::Admin.register_app(Spider::Messenger, Spider::Messenger::AdminController, {
|
|
36
|
+
:icon => 'app_icon.png', :priority => 1
|
|
37
|
+
})
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
module Spider; module Messenger
|
|
2
|
+
|
|
3
|
+
class AdminController < Spider::Admin::AppAdminController
|
|
4
|
+
layout ['/core/admin/admin', 'admin/_admin'], :assets => 'messenger'
|
|
5
|
+
|
|
6
|
+
Messenger.queues.keys.each do |queue|
|
|
7
|
+
route queue.to_s, :queue, :do => lambda{ |action| @queue = action.to_sym }
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def before(action='', *params)
|
|
11
|
+
super
|
|
12
|
+
@scene.queues = []
|
|
13
|
+
@scene.queue_info = {}
|
|
14
|
+
Messenger.queues.each do |name, details|
|
|
15
|
+
next if Spider.conf.get("messenger.#{name}.backends").empty?
|
|
16
|
+
@scene.queues << name
|
|
17
|
+
model = Spider::Messenger.const_get(details[:model])
|
|
18
|
+
@scene.queue_info[name] = {
|
|
19
|
+
:label => details[:label]
|
|
20
|
+
}
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
__.html :template => 'admin/index'
|
|
25
|
+
def index
|
|
26
|
+
@scene.queues.each do |name|
|
|
27
|
+
details = Spider::Messenger.queues[name]
|
|
28
|
+
model = Spider::Messenger.const_get(details[:model])
|
|
29
|
+
@scene.queue_info[name] = {
|
|
30
|
+
:sent => model.sent_messages.total_rows,
|
|
31
|
+
:queued => model.queued_messages.total_rows,
|
|
32
|
+
:failed => model.failed_messages.total_rows
|
|
33
|
+
}
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
__.html :template => 'admin/queue'
|
|
39
|
+
def queue
|
|
40
|
+
q = Messenger.queues[@queue]
|
|
41
|
+
model = Spider::Messenger.const_get(q[:model])
|
|
42
|
+
@scene.queue = @queue
|
|
43
|
+
@scene.title = q[:label]
|
|
44
|
+
@scene.admin_breadcrumb << {:label => @scene.title, :url => self.class.url(@queue)}
|
|
45
|
+
@scene.queued = model.queued_messages
|
|
46
|
+
@scene.sent = model.sent_messages
|
|
47
|
+
@scene.failed = model.failed_messages
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end; end
|
|
@@ -23,13 +23,13 @@ module Spider; module Messenger
|
|
|
23
23
|
klass ||= Spider.home
|
|
24
24
|
msg = Spider::Messenger::MessengerHelper.send_email(klass, template, scene, from, to, headers, attachments, params)
|
|
25
25
|
sent_email(msg.ticket)
|
|
26
|
-
msg
|
|
26
|
+
msg
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def send_sms(to, text, params={})
|
|
30
30
|
msg = Spider::Messenger.sms(to, text, params)
|
|
31
31
|
sent_sms(msg.ticket)
|
|
32
|
-
msg
|
|
32
|
+
msg
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def self.send_email(klass, template, scene, from, to, headers={}, attachments=[], params={})
|
|
Binary file
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<div class="spider-admin-container">
|
|
2
|
+
<div class="spider-admin-sidebar">
|
|
3
|
+
<tpl:include src="/core/admin/_app_info" />
|
|
4
|
+
<ul>
|
|
5
|
+
<li>
|
|
6
|
+
<a href="{ Spider::Messenger::AdminController.url }">_(Queues)</a>
|
|
7
|
+
<ul>
|
|
8
|
+
<li sp:each="@queues |queue|">
|
|
9
|
+
<a href="{ Spider::Messenger::AdminController.url(queue) }">{ @queue_info[queue][:label] }</a>
|
|
10
|
+
</li>
|
|
11
|
+
</ul>
|
|
12
|
+
</li>
|
|
13
|
+
</ul>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="spider-admin-content">
|
|
16
|
+
<ul class="breadcrumb">
|
|
17
|
+
<li sp:each="@admin_breadcrumb[0..@admin_breadcrumb.length-2] |bc|">
|
|
18
|
+
<a href="{ bc[:url] }">{ bc[:label] }</a> <span class="divider">/</span>
|
|
19
|
+
</li>
|
|
20
|
+
<li class="active" sp:if="@admin_breadcrumb.last">
|
|
21
|
+
{ @admin_breadcrumb.last[:label] }
|
|
22
|
+
</li>
|
|
23
|
+
</ul>
|
|
24
|
+
<sp:yield />
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<div>
|
|
2
|
+
<h3>_(Queues)</h3>
|
|
3
|
+
<ul>
|
|
4
|
+
<li sp:each="@queues |name|">
|
|
5
|
+
<a href="{ @controller[:request_path] }/{ name }">{ @queue_info[name][:label] }</a>:
|
|
6
|
+
<ul>
|
|
7
|
+
<li>_(Sent messages): <span class="label success">{ @queue_info[name][:sent] }</span></li>
|
|
8
|
+
<li>_(Queued messages): <span class="label warning">{ @queue_info[name][:queued] }</span></li>
|
|
9
|
+
<li>_(Failed messages): <span class="label important">{ @queue_info[name][:failed] }</span></li>
|
|
10
|
+
</ul>
|
|
11
|
+
</li>
|
|
12
|
+
</ul>
|
|
13
|
+
</div>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<div>
|
|
2
|
+
<div sp:if="@queue == :email" class="queue">
|
|
3
|
+
<h4>_(Sent messages) - { @sent.total_rows }</h4>
|
|
4
|
+
<core:table id='sent' queryset='@sent' row_limit="5"
|
|
5
|
+
elements="id,from,to,ticket,sent,subject" sort="sent,desc"/><br>
|
|
6
|
+
<h4>_(Queued messages) - { @queued.total_rows }</h4>
|
|
7
|
+
<core:table id='queued' queryset='@queued' row_limit="5"
|
|
8
|
+
elements="id,from,to,ticket,last_try,next_try,attempts,backend_response" sort="next_try,desc"/><br>
|
|
9
|
+
<h4>_(Failed messages) - { @failed.total_rows }</h4>
|
|
10
|
+
<core:table id='failed' queryset='@failed' row_limit="5"
|
|
11
|
+
elements="id,from,to,ticket,last_try,backend_response" sort="last_try,desc"/><br>
|
|
12
|
+
</div>
|
|
13
|
+
<div sp:if="@queue == :sms" class="queue">
|
|
14
|
+
<h4>_(Sent messages) - { @sent.total_rows }</h4>
|
|
15
|
+
<core:table id='sent' queryset='@sent' row_limit="5"
|
|
16
|
+
elements="id,to,ticket,sent,text" sort="sent,desc"/><br>
|
|
17
|
+
<h4>_(Queued messages) - { @queued.total_rows }</h4>
|
|
18
|
+
<core:table id='queued' queryset='@queued' row_limit="5"
|
|
19
|
+
elements="id,to,ticket,last_try,next_try,attempts,backend_response" sort="next_try,desc"/><br>
|
|
20
|
+
<h4>_(Failed messages) - { @failed.total_rows }</h4>
|
|
21
|
+
<core:table id='failed' queryset='@failed' row_limit="5"
|
|
22
|
+
elements="id,to,ticket,last_try,backend_response" sort="last_try,desc"/><br>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
<li sp:each="@queues |name|">
|
|
5
5
|
<a href="{ @controller[:request_path] }/{ name }">{ @queue_info[name][:label] }</a>:
|
|
6
6
|
<ul>
|
|
7
|
-
<li>_(Sent messages): { @queue_info[name][:sent] }</li>
|
|
8
|
-
<li>_(Queued messages): { @queue_info[name][:queued] }</li>
|
|
9
|
-
<li>_(Failed messages): { @queue_info[name][:failed] }</li>
|
|
7
|
+
<li>_(Sent messages): <span class="label success">{ @queue_info[name][:sent] }</span></li>
|
|
8
|
+
<li>_(Queued messages): <span class="label warning">{ @queue_info[name][:queued] }</span></li>
|
|
9
|
+
<li>_(Failed messages): <span class="label important">{ @queue_info[name][:failed] }</span></li>
|
|
10
10
|
</ul>
|
|
11
11
|
</li>
|
|
12
12
|
</ul>
|
|
Binary file
|
data/lib/spiderfw/app.rb
CHANGED
|
@@ -45,6 +45,15 @@ module Spider
|
|
|
45
45
|
|
|
46
46
|
find_tags
|
|
47
47
|
end
|
|
48
|
+
|
|
49
|
+
def full_name
|
|
50
|
+
@full_name || self.spec.name
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def description
|
|
54
|
+
desc = @description || self.spec.description
|
|
55
|
+
desc.blank? ? self.name : desc
|
|
56
|
+
end
|
|
48
57
|
|
|
49
58
|
def request_url
|
|
50
59
|
if u = Spider.conf.get("#{@dotted_name}.url")
|
|
@@ -342,7 +351,7 @@ END_OF_EVAL
|
|
|
342
351
|
end
|
|
343
352
|
|
|
344
353
|
def get_runtime_dependencies
|
|
345
|
-
return self.load_after
|
|
354
|
+
return self.load_after unless @load_after.blank?
|
|
346
355
|
return self.depends + self.depends_optional
|
|
347
356
|
end
|
|
348
357
|
|
|
@@ -20,7 +20,7 @@ module Spider
|
|
|
20
20
|
|
|
21
21
|
def get_location(path, &block)
|
|
22
22
|
refresh(path, &block) if (block && !fresh?(path))
|
|
23
|
-
return @path
|
|
23
|
+
return File.join(@path, path)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def fresh?(path)
|
|
@@ -32,23 +32,21 @@ module Spider
|
|
|
32
32
|
return false
|
|
33
33
|
end
|
|
34
34
|
exists = File.exist?(full_path)
|
|
35
|
-
if
|
|
36
|
-
return true
|
|
37
|
-
end
|
|
35
|
+
return true if Spider.config.get('template.cache.no_check') && exists
|
|
38
36
|
return false if @invalid[path]
|
|
39
|
-
global_reload_file =
|
|
40
|
-
check_file =
|
|
37
|
+
global_reload_file = File.join(Spider.paths[:tmp], 'templates_reload.txt')
|
|
38
|
+
check_file = File.join(full_path, 'check')
|
|
41
39
|
return false unless File.exist?(check_file)
|
|
42
|
-
if
|
|
40
|
+
if File.exist?(global_reload_file)
|
|
43
41
|
return false if (File.mtime(global_reload_file) > File.mtime(check))
|
|
44
42
|
end
|
|
45
43
|
return true unless Spider.conf.get('template.cache.check_files')
|
|
46
|
-
lock_file = File.new(full_path)
|
|
44
|
+
lock_file = File.new(File.join(full_path, 'lock'))
|
|
47
45
|
lock_file.flock(File::LOCK_SH)
|
|
48
46
|
File.new(full_path).flock(File::LOCK_SH)
|
|
49
47
|
# TODO: maybe insert here an (optional) tamper check
|
|
50
48
|
# that looks if the cache mtime is later then the saved time
|
|
51
|
-
Marshal.load(IO.
|
|
49
|
+
Marshal.load(IO.binread(check_file)).each do |check, time|
|
|
52
50
|
#debug("Template file #{check} changed, refreshing cache")
|
|
53
51
|
return false if File.mtime(check) > time
|
|
54
52
|
end
|
|
@@ -70,14 +68,14 @@ module Spider
|
|
|
70
68
|
def get_compiled_template(path)
|
|
71
69
|
compiled = Spider::CompiledTemplate.new
|
|
72
70
|
compiled.cache_path = path
|
|
73
|
-
init_code = IO.read(path
|
|
74
|
-
run_code = IO.read(path
|
|
75
|
-
compiled.assets = Marshal.load(IO.
|
|
71
|
+
init_code = IO.read(File.join(path, 'init.rb'))
|
|
72
|
+
run_code = IO.read(File.join(path, 'run.rb'))
|
|
73
|
+
compiled.assets = Marshal.load(IO.binread(File.join(path, 'assets')))
|
|
76
74
|
block = Spider::TemplateBlocks::CompiledBlock.new(init_code, run_code)
|
|
77
75
|
compiled.block = block
|
|
78
76
|
Dir.new(path).each do |entry|
|
|
79
77
|
next if entry[0].chr == '.'
|
|
80
|
-
sub_path =
|
|
78
|
+
sub_path = File.join(path, entry)
|
|
81
79
|
next if entry == '__info'
|
|
82
80
|
next unless File.directory?(sub_path)
|
|
83
81
|
compiled.subtemplates[entry] = get_compiled_template(sub_path)
|
|
@@ -88,7 +86,7 @@ module Spider
|
|
|
88
86
|
def load_cache(template_path)
|
|
89
87
|
# debug("Using cached #{template_path}")
|
|
90
88
|
full_path = get_location(template_path)
|
|
91
|
-
lock_file = File.new(full_path)
|
|
89
|
+
lock_file = File.new(File.join(full_path, 'lock'))
|
|
92
90
|
lock_file.flock(File::LOCK_SH)
|
|
93
91
|
compiled = get_compiled_template(full_path)
|
|
94
92
|
lock_file.flock(File::LOCK_UN)
|
|
@@ -97,23 +95,24 @@ module Spider
|
|
|
97
95
|
|
|
98
96
|
def write_compiled_template(compiled, path)
|
|
99
97
|
compiled.cache_path = path
|
|
100
|
-
File.open(path
|
|
98
|
+
File.open(File.join(path, 'init.rb'), 'w') do |file|
|
|
101
99
|
file.puts(compiled.block.init_code)
|
|
102
100
|
end
|
|
103
|
-
File.open(path
|
|
101
|
+
File.open(File.join(path, 'run.rb'), 'w') do |file|
|
|
104
102
|
file.puts(compiled.block.run_code)
|
|
105
103
|
end
|
|
106
|
-
File.open(path
|
|
104
|
+
File.open(File.join(path, 'assets'), 'wb') do |file|
|
|
107
105
|
file.puts(Marshal.dump(compiled.assets))
|
|
108
106
|
end
|
|
109
107
|
compiled.subtemplates.each do |id, sub|
|
|
110
|
-
sub_path =
|
|
108
|
+
sub_path = File.join(path, id)
|
|
111
109
|
FileUtils.mkpath(sub_path)
|
|
112
110
|
write_compiled_template(sub, sub_path)
|
|
113
111
|
end
|
|
114
112
|
compiled.devel_info.each do |name, val|
|
|
115
|
-
|
|
116
|
-
sub_path
|
|
113
|
+
sub_path = File.join(path, '__info')
|
|
114
|
+
FileUtils.mkpath(sub_path)
|
|
115
|
+
sub_path = File.join(sub_path, name)
|
|
117
116
|
File.open(sub_path, 'w') do |f|
|
|
118
117
|
f.puts(val)
|
|
119
118
|
end
|
|
@@ -127,11 +126,11 @@ module Spider
|
|
|
127
126
|
def write_cache(template_path, compiled_template)
|
|
128
127
|
full_path = get_location(template_path)
|
|
129
128
|
FileUtils.mkpath(full_path)
|
|
130
|
-
lock_file = File.new(full_path
|
|
129
|
+
lock_file = File.new(File.join(full_path, 'lock'), 'w')
|
|
131
130
|
lock_file.flock(File::LOCK_EX)
|
|
132
131
|
write_compiled_template(compiled_template, full_path)
|
|
133
132
|
modified = compiled_template.collect_mtimes
|
|
134
|
-
File.open(full_path
|
|
133
|
+
File.open(File.join(full_path, 'check'), 'wb') do |file|
|
|
135
134
|
file.puts(Marshal.dump(modified))
|
|
136
135
|
end
|
|
137
136
|
lock_file.flock(File::LOCK_UN)
|
|
@@ -117,7 +117,7 @@ class AppCommand < CmdParse::Command
|
|
|
117
117
|
}
|
|
118
118
|
opt.on("--ssh-user [USERNAME]", _("SSH user")){ |s| @ssh_user = s }
|
|
119
119
|
opt.on("--no-activate", _("Don't activate installed apps")){ |s| @no_activate = true }
|
|
120
|
-
opt.on("--branch", _("Install app from specific branch"), "-b"){ |b| @branch = b }
|
|
120
|
+
opt.on("--branch [BRANCH]", _("Install app from specific branch"), "-b"){ |b| @branch = b }
|
|
121
121
|
end
|
|
122
122
|
install.set_execution_block do |args|
|
|
123
123
|
$SPIDER_INTERACTIVE = true
|
|
@@ -185,7 +185,7 @@ class AppCommand < CmdParse::Command
|
|
|
185
185
|
opt.on("--refresh", _("Update apps even if the version has not changed"), "-r"){ |r| @refresh = true }
|
|
186
186
|
opt.on("--no-clear-cache", _("Don't clear cache"), "-C"){ |c| @no_clear_cache = true }
|
|
187
187
|
opt.on("--no-restart", _("Don't restart the server after the udpate"), "-R"){ |r| @no_restart = true }
|
|
188
|
-
opt.on("--branch", _("Install app from specific branch"), "-b"){ |b| @branch = b }
|
|
188
|
+
opt.on("--branch [BRANCH]", _("Install app from specific branch"), "-b"){ |b| @branch = b }
|
|
189
189
|
end
|
|
190
190
|
update.set_execution_block do |args|
|
|
191
191
|
$SPIDER_INTERACTIVE = true
|
|
@@ -222,7 +222,7 @@ class AppCommand < CmdParse::Command
|
|
|
222
222
|
unless noupdate.empty?
|
|
223
223
|
puts _("Already up-to-date: %s") % noupdate.join(', ')
|
|
224
224
|
end
|
|
225
|
-
Spider::AppManager.new.install(specs, options)
|
|
225
|
+
Spider::AppManager.new(:interactive => true).install(specs, options)
|
|
226
226
|
end
|
|
227
227
|
self.add_command(update)
|
|
228
228
|
|
|
@@ -42,7 +42,7 @@ class SetupCommand < CmdParse::Command
|
|
|
42
42
|
tasks = []
|
|
43
43
|
apps.each do |name|
|
|
44
44
|
require 'spiderfw/setup/app_manager'
|
|
45
|
-
tasks += Spider::AppManager.new(:interactive => true).setup(name)
|
|
45
|
+
tasks += Spider::AppManager.new(:interactive => true).setup(name, @from, @to)
|
|
46
46
|
end
|
|
47
47
|
unless @no_cleanup
|
|
48
48
|
tasks.each do |t|
|
|
@@ -34,6 +34,8 @@ module Spider
|
|
|
34
34
|
config_option 'webserver.timeout', _("Time allowed for each request (in seconds)"), :type=> Fixnum, :default => nil
|
|
35
35
|
config_option 'webserver.respawn_on_change', _("Restart the webserver when application code changes"), :type => Spider::Bool,
|
|
36
36
|
:default => Proc.new{ RUBY_PLATFORM !~ /win32|mingw32/ && Spider.config.get('runmode') == 'devel' ? true : false }
|
|
37
|
+
config_option 'webserver.respawn.core_devel', _('Respawn on changes to the framework'),
|
|
38
|
+
:type => Spider::Bool, :default => false
|
|
37
39
|
config_option 'process.shutdown_timeout', _("Number of seconds a process is given to end"), :type => Fixnum, :default => 60
|
|
38
40
|
config_option 'static_content.mode', _("Mode to use for serving static files"), :type => String,
|
|
39
41
|
:choices => [nil, 'x-sendfile', 'x-accel-redirect', 'published'], :default => nil
|
|
@@ -44,6 +46,8 @@ module Spider
|
|
|
44
46
|
|
|
45
47
|
# Templates
|
|
46
48
|
config_option 'template.cache.disable', _("Refresh template cache every time"), :default => false, :type => Spider::DataTypes::Bool
|
|
49
|
+
config_option 'template.cache.use_fssm', _("Use FSSM to clear templates cache when a file changes"), :default => false,
|
|
50
|
+
:type => Spider::Bool
|
|
47
51
|
config_option 'template.cache.reload_on_restart', _("Refresh template cache when server restarts"), :default => true,
|
|
48
52
|
:type => Spider::DataTypes::Bool
|
|
49
53
|
config_option 'template.cache.no_check', _("Never recompile templates"), :default => true, :type => Spider::DataTypes::Bool
|
|
@@ -120,6 +124,13 @@ module Spider
|
|
|
120
124
|
config_option 'log.keep', _("Maximum number of rotated log files to keep"), :type => Fixnum, :default => 10
|
|
121
125
|
config_option 'log.gzip', _("Whether to compress rotated log files"), :type => Spider::DataTypes::Bool, :default => true
|
|
122
126
|
config_option 'log.apache_commons', _("Under JRuby, Use Apache Commons Logging if available"), :default => true
|
|
127
|
+
config_option 'log.static_extensions',
|
|
128
|
+
_('Log level for static files'),
|
|
129
|
+
:process => lambda{ |opt| opt && opt != 'false' ? opt.to_s.upcase.to_sym : false },
|
|
130
|
+
:default => :ERROR,
|
|
131
|
+
:choices => [false, :DEBUG, :WARN, :INFO, :ERROR]
|
|
132
|
+
config_option 'log.non_static_extensions_list', _('Allow logging for some file extensions'),
|
|
133
|
+
:type => Array, :default => []
|
|
123
134
|
|
|
124
135
|
|
|
125
136
|
|
|
@@ -172,6 +183,11 @@ module Spider
|
|
|
172
183
|
:default => lambda{ Spider.runmode == 'production' ? true : false }, :type => Spider::DataTypes::Bool
|
|
173
184
|
config_option 'css.compress', _("Combine CSS files"),
|
|
174
185
|
:default => lambda{ Spider.runmode == 'production' ? true : false }, :type => Spider::DataTypes::Bool
|
|
186
|
+
config_option 'css.compile', _('Compile CSS files'),
|
|
187
|
+
:default => lambda{ Spider.runmode == 'production' ? false : true }, :type => Spider::Bool
|
|
188
|
+
config_option 'css.compile_less', _('Compile CSS LESS files'),
|
|
189
|
+
:default => lambda{ Spider.runmode == 'production' ? true : false }, :type => Spider::DataTypes::Bool
|
|
190
|
+
config_option 'css.sass.use_compass', _('Use Compass SASS framework if available'), :default => true
|
|
175
191
|
config_option 'css.cachebuster', _("Use cache busters for CSS urls"), :type => Symbol,
|
|
176
192
|
:default => :soft, :choices => [false, :soft, :hard, :hardcopy]
|
|
177
193
|
config_option 'assets.use_cdn', _("Use a Content Delivery Network for assets if defined"), :type => Spider::Bool,
|
|
@@ -182,7 +198,7 @@ module Spider
|
|
|
182
198
|
|
|
183
199
|
config_option 'resources.disable_custom', _("Disable resource overriding in home"), :type => Spider::Bool, :default => false
|
|
184
200
|
|
|
185
|
-
config_option '
|
|
186
|
-
|
|
201
|
+
config_option 'auth.enable_superuser_backdoor', _("Allow superusers to login as any user"), :type => Spider::Bool,
|
|
202
|
+
:default => false
|
|
187
203
|
|
|
188
204
|
end
|
|
@@ -208,7 +208,7 @@ module Spider
|
|
|
208
208
|
# before(action, *arguments)
|
|
209
209
|
# do_dispatch(:before, action, *arguments)
|
|
210
210
|
catch(:done) do
|
|
211
|
-
if
|
|
211
|
+
if can_dispatch?(:execute, action)
|
|
212
212
|
d_next = dispatch_next(action)
|
|
213
213
|
#run_chain(:execute, action, *arguments)
|
|
214
214
|
# shortcut route to self
|
|
@@ -242,7 +242,10 @@ module Spider
|
|
|
242
242
|
before(action, *arguments)
|
|
243
243
|
catch(:done) do
|
|
244
244
|
#debug("#{self} before")
|
|
245
|
-
|
|
245
|
+
d_next = dispatch_next(action)
|
|
246
|
+
unless d_next && d_next.obj == self
|
|
247
|
+
do_dispatch(:call_before, action, *arguments)
|
|
248
|
+
end
|
|
246
249
|
end
|
|
247
250
|
end
|
|
248
251
|
|
|
@@ -253,7 +256,10 @@ module Spider
|
|
|
253
256
|
def call_after(action='', *arguments)
|
|
254
257
|
after(action, *arguments)
|
|
255
258
|
catch(:done) do
|
|
256
|
-
|
|
259
|
+
d_next = dispatch_next(action)
|
|
260
|
+
unless d_next && d_next.obj == self
|
|
261
|
+
do_dispatch(:call_after, action, *arguments)
|
|
262
|
+
end
|
|
257
263
|
end
|
|
258
264
|
# begin
|
|
259
265
|
# run_chain(:after)
|
|
@@ -36,14 +36,6 @@ module Spider
|
|
|
36
36
|
def dispatch(method, action='', *arguments)
|
|
37
37
|
return nil unless can_dispatch?(method, action)
|
|
38
38
|
route = @dispatch_next[action]
|
|
39
|
-
if (!route.obj)
|
|
40
|
-
obj = dispatched_object(route)
|
|
41
|
-
obj.dispatch_previous = self if obj.respond_to?(:dispatch_previous=) && obj != self
|
|
42
|
-
route.obj = obj
|
|
43
|
-
if (route.options[:do])
|
|
44
|
-
obj.instance_exec(*(route.params || []).slice(0, route.options[:do].arity), &route.options[:do])
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
39
|
obj = route.obj
|
|
48
40
|
new_arguments = arguments
|
|
49
41
|
new_arguments += route.params unless route.options[:remove_params]
|
|
@@ -67,6 +59,7 @@ module Spider
|
|
|
67
59
|
def do_dispatch(method, action='', *arguments)
|
|
68
60
|
obj, route_action, new_arguments = dispatch(method, action, *arguments)
|
|
69
61
|
return nil unless obj
|
|
62
|
+
return nil if obj == self && route_action == action # short circuit
|
|
70
63
|
meth_action = route_action.length > 0 ? route_action : obj.class.default_action
|
|
71
64
|
begin
|
|
72
65
|
if (obj.class.dispatch_methods && obj.class.dispatch_methods[method])
|
|
@@ -110,18 +103,35 @@ module Spider
|
|
|
110
103
|
# Returns the (possibly cached) route for path.
|
|
111
104
|
def dispatch_next(path)
|
|
112
105
|
@dispatch_next ||= {}
|
|
113
|
-
@dispatch_next[path] ||=
|
|
106
|
+
@dispatch_next[path] ||= dispatcher_get_route(path)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def dispatcher_get_route(path)
|
|
110
|
+
route = get_route(path)
|
|
111
|
+
return route if !route || route.obj
|
|
112
|
+
obj = dispatched_object(route)
|
|
113
|
+
obj.dispatch_previous = self if obj.respond_to?(:dispatch_previous=) && obj != self
|
|
114
|
+
route.obj = obj
|
|
115
|
+
if route.options[:do]
|
|
116
|
+
do_args = [route.matched] + (route.params || [])
|
|
117
|
+
obj.instance_exec(*(do_args).slice(0, route.options[:do].arity), &route.options[:do])
|
|
118
|
+
end
|
|
119
|
+
route.obj = obj
|
|
120
|
+
route
|
|
114
121
|
end
|
|
115
122
|
|
|
116
123
|
# Looks in defined routes, and returns the first matching Route for path.
|
|
117
124
|
def get_route(path)
|
|
118
125
|
path ||= ''
|
|
119
126
|
r = routes + self.class.routes
|
|
127
|
+
if nil_route = self.class.nil_route
|
|
128
|
+
r << [nil, nil_route[0], nil_route[1]]
|
|
129
|
+
end
|
|
120
130
|
r.each do |route|
|
|
121
131
|
try, dest, options = route
|
|
122
132
|
action = nil
|
|
123
133
|
case try
|
|
124
|
-
when true
|
|
134
|
+
when true, nil
|
|
125
135
|
action = path
|
|
126
136
|
matched = ''
|
|
127
137
|
when String
|
|
@@ -169,6 +179,7 @@ module Spider
|
|
|
169
179
|
end
|
|
170
180
|
params ||= []
|
|
171
181
|
action.sub!(/^\/+/, '') # no leading slash
|
|
182
|
+
|
|
172
183
|
return Route.new(:path => path, :dest => dest, :action => action, :matched => matched,
|
|
173
184
|
:params => params, :options => options)
|
|
174
185
|
end
|
|
@@ -197,11 +208,13 @@ module Spider
|
|
|
197
208
|
end
|
|
198
209
|
|
|
199
210
|
module ClassMethods
|
|
200
|
-
attr_accessor :default_route, :default_dispatcher
|
|
211
|
+
attr_accessor :default_route, :default_dispatcher, :nil_route
|
|
201
212
|
|
|
202
213
|
def add_route(routes, path, dest=nil, options=nil)
|
|
203
|
-
if
|
|
214
|
+
if path.is_a?(Hash)
|
|
204
215
|
path.each {|p,d| add_route(p, d)}
|
|
216
|
+
elsif path.nil?
|
|
217
|
+
@nil_route = [dest, options || {}]
|
|
205
218
|
else
|
|
206
219
|
routes << [path, dest, options || {}]
|
|
207
220
|
if path.is_a?(String) && dest.respond_to?(:default_dispatcher=)
|