jinda 0.5.0 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/lib/generators/jinda/install_generator.rb +7 -1
  4. data/lib/generators/jinda/templates/README.md +1 -1
  5. data/lib/generators/jinda/templates/app/assets/stylesheets/app.scss +11 -5
  6. data/lib/generators/jinda/templates/app/assets/stylesheets/articles.scss +16 -6
  7. data/lib/generators/jinda/templates/app/controllers/concerns/jinda_general_concern.rb +179 -0
  8. data/lib/generators/jinda/templates/app/controllers/concerns/jinda_run_concern.rb +365 -0
  9. data/lib/generators/jinda/templates/app/controllers/jinda_org/docs_controller.rb +56 -0
  10. data/lib/generators/jinda/templates/app/controllers/jinda_org/jinda_controller.rb +29 -562
  11. data/lib/generators/jinda/templates/app/controllers/jinda_org/notes_controller.rb +6 -8
  12. data/lib/generators/jinda/templates/app/jinda/index.mm +71 -23
  13. data/lib/generators/jinda/templates/app/jinda/template/view.html.erb +22 -23
  14. data/lib/generators/jinda/templates/app/models/jinda/doc.rb +5 -0
  15. data/lib/generators/jinda/templates/app/views/articles/new_article/form_article.html.erb +2 -0
  16. data/lib/generators/jinda/templates/app/views/docs/doc_edit/doc_edit.html.erb +21 -0
  17. data/lib/generators/jinda/templates/app/views/docs/doc_edit/doc_select.html.erb +14 -0
  18. data/lib/generators/jinda/templates/app/views/docs/doc_new/doc_form.html.erb +26 -0
  19. data/lib/generators/jinda/templates/app/views/docs/doc_new/doc_form.md +36 -0
  20. data/lib/generators/jinda/templates/app/views/docs/doc_xedit/doc_edit.html.erb +21 -0
  21. data/lib/generators/jinda/templates/app/views/docs/edit/select_note.html.erb +14 -0
  22. data/lib/generators/jinda/templates/app/views/docs/index.haml +21 -0
  23. data/lib/generators/jinda/templates/app/views/docs/my.haml +27 -0
  24. data/lib/generators/jinda/templates/app/views/jinda/index.html.haml +3 -3
  25. data/lib/generators/jinda/templates/app/views/jinda/run_output.haml +3 -3
  26. data/lib/jinda/helpers.rb +205 -63
  27. data/lib/jinda/version.rb +1 -1
  28. metadata +15 -8
  29. data/lib/generators/jinda/templates/app/controllers/ctrs_controller.rb-gem-test +0 -2
  30. data/lib/jinda/ template/view.html.erb +0 -25
  31. data/lib/jinda/app/jinda/index.mm +0 -308
  32. data/lib/jinda/app/jinda/template/view.html.erb +0 -27
@@ -0,0 +1,21 @@
1
+ - @title= "My Articles"
2
+ %p
3
+ - @page_title = 'All Articlces'
4
+ = paginate @articles
5
+ %table#article-table
6
+ %tr
7
+ %th Title
8
+ %th Description
9
+ %th Created
10
+ %th Updated
11
+ %th Delete
12
+ %th Edit
13
+ - @articles.each do |article|
14
+ %tr
15
+ %td= link_to article.title, :controller=>"articles", :action=>"show", :id=>article.id
16
+ %td= article.text.html_safe
17
+ %td= article.created_at.strftime('%m/%d/%Y')
18
+ %td= article.updated_at.strftime('%m/%d/%Y')
19
+ %td(align='center')= link_to image_tag('delete.png', style:'border:none; float:none;'), "#", :onclick=>"if (confirm('Please Confirm')) {location.hash='/articles/destroy/#{article.id}';}"
20
+ %td(align='center')= link_to image_tag('pencil.png', style:'border:none; float:none;'), {controller: "jinda", action: "init", s: 'articles:xedit_article', article_id: article.id}, data: { confirm: "Please Confirm" }
21
+
@@ -0,0 +1,27 @@
1
+ - @title= "My Documents"
2
+ %p
3
+ - @page_title = 'All Documents'
4
+ = paginate @docs
5
+ %table#document-table
6
+ %tr
7
+ %th File Name
8
+ %th Description
9
+ %th Category
10
+ %th Created
11
+ %th Delete
12
+ %th Edit
13
+ - @docs.each do |doc|
14
+ %tr
15
+ - @temp = doc.dscan
16
+ - if !@temp.blank?
17
+ - @dscan = @temp.scan(/document\/([^*]*)/).last.last
18
+ %td= link_to doc.filename, "#{jinda_document_path}?id=#{@dscan}", target: :_blank
19
+ - else
20
+ %td= doc.filename
21
+ %td= doc.description
22
+ %td= doc.category
23
+ %td= doc.created_at.strftime('%m/%d/%Y')
24
+ %td(align='center')= link_to image_tag('delete.png', style:'border:none; float:none;'), {controller: "docs", action: "destroy", doc_id: doc.id}, data: { confirm: "Please Confirm" }
25
+ %td(align='center')= image_tag('pencil.png', style:'border:none; float:none;')
26
+ - # To do
27
+ - # %td(align='center')= link_to image_tag('pencil.png', style:'border:none; float:none;'), {controller: "jinda", action: "init", s: 'docs:xedit_doc', doc_id: doc.id}, data: { confirm: "Please Confirm" }
@@ -13,15 +13,15 @@
13
13
 
14
14
  %h2 Recently tested with:
15
15
  %ul
16
- %li Rubygems 2.6.3
17
- %li Rails 6.0.1
16
+ %li Rubygems 2.7.1
17
+ %li Rails 6.0.3
18
18
  %li rails new YOURAPP --skip-test-unit --skip-bundle --skip-active-record --skip-javascript --skip-turbolinks
19
19
  %li (rails new YOURAPP -BOTJ)
20
20
 
21
21
 
22
22
  %h2 Installation
23
23
  %ul
24
- %li add gem 'jinda', '0.5.0'
24
+ %li add gem 'jinda', '0.5.5'
25
25
  %li bundle
26
26
  %li rails generate jinda:install
27
27
  %li (run all with "sh install.sh" )
@@ -22,7 +22,7 @@
22
22
  %th= t "user"
23
23
  %th= "date"
24
24
  - @xmain.docs.each do |doc|
25
- - next unless doc.display
25
+ - next unless doc.ma_display
26
26
  %tr
27
27
  %td= doc.id
28
28
  %td
@@ -32,7 +32,7 @@
32
32
  = image_tag 'page_attach.png'
33
33
  = link_to_blank align_text(doc.name), :controller=>"jinda", :action=>:document, :id=>doc.id
34
34
  %td= doc.filename
35
- %td= doc.user.name
36
- %td= date_thai doc.updated_at
35
+ %td= doc.user.code
36
+ %td= doc.updated_at
37
37
  = submit_tag @message
38
38
  %p
@@ -22,7 +22,7 @@ require 'active_support/core_ext'
22
22
  #
23
23
  # xvar is (become) global variable of current program including user, runseq, and services
24
24
  #
25
- ################################################################################
25
+ ########################################################################]
26
26
 
27
27
 
28
28
  module Jinda
@@ -30,6 +30,142 @@ module Jinda
30
30
  require "rexml/document"
31
31
  include REXML
32
32
  # methods from application_controller
33
+
34
+ ########################################################################]
35
+ # Each Service at one moment will create one xmain
36
+ ########################################################################]
37
+ def create_xmain(service)
38
+ c = name2camel(service.module.code)
39
+ custom_controller= "#{c}Controller"
40
+ params["return"] = request.env['HTTP_REFERER']
41
+ Jinda::Xmain.create :service=>service,
42
+ :start=>Time.now,
43
+ :name=>service.name,
44
+ :ip=> get_ip,
45
+ :status=>'I', # init
46
+ :user=>current_ma_user,
47
+ :xvars=> {
48
+ :service_id=>service.id,
49
+ :p=>params.to_unsafe_h,
50
+ :id=>params[:id],
51
+ :user_id=>current_ma_user.try(:id),
52
+ :custom_controller=>custom_controller,
53
+ :host=>request.host,
54
+ :referer=>request.env['HTTP_REFERER']
55
+ }
56
+ end
57
+ def clear_xmains
58
+ Jinda::Xmain.where(:status =>{'$in'=>['R','I']}).update_all(:status=>'X')
59
+ redirect_to action:"pending"
60
+ end
61
+ def ajax_notice
62
+ if notice=Jinda::Notice.recent(current_ma_user, request.env["REMOTE_ADDR"])
63
+ notice.update_attribute :unread, false
64
+ js = "notice('#{notice.message}');"
65
+ else
66
+ js = ""
67
+ end
68
+ render plain: "<script>#{js}</script>"
69
+ end
70
+
71
+ ########################################################################]
72
+ # Each xmain will create many run_seq as many as steps and form_steps
73
+ ########################################################################]
74
+ #
75
+ ############################## @runseq ################################]
76
+ # @runseq => #<Jinda::Runseq _id: 5df31912a54d758417a7afc9,
77
+ # created_at: 2019-12-13 04:52:34 UTC,
78
+ # updated_at: 2019-12-13 04:52:43 UTC,
79
+ # user_id: nil,
80
+ # xmain_id: BSON::ObjectId('5df31912a54d758417a7afc7'),
81
+ # action: "do",
82
+ # status: "R",
83
+ # code: "create",
84
+ # name: "Create Article",
85
+ # role: "",
86
+ # rule: "true",
87
+ # rstep: 2,
88
+ # form_step: 1,
89
+ # start: 2019-12-13 04:52:43 UTC,
90
+ # stop: nil,
91
+ # end: true,
92
+ # xml: "<node CREATED='1493419491125' ID='ID_1687683396' MODIFIED='1493483244848' TEXT='create: Create Article'><icon BUILTIN='bookmark'/></node>",
93
+ # ip: nil>
94
+ ########################################################################]
95
+
96
+ def create_runseq(xmain)
97
+ @xvars= xmain.xvars
98
+ default_role= get_default_role
99
+ xml= xmain.service.xml
100
+ root = REXML::Document.new(xml).root
101
+ i= 0; j= 0 # i= step, j= form_step
102
+ root.elements.each('node') do |activity|
103
+ text= activity.attributes['TEXT']
104
+ next if ma_comment?(text)
105
+ next if text =~/^rule:\s*/
106
+ action= freemind2action(activity.elements['icon'].attributes['BUILTIN']) if activity.elements['icon']
107
+ return false unless action
108
+ i= i + 1
109
+ output_ma_display= false
110
+ if action== ('output'|| 'list' ||'folder')
111
+ ma_display= get_option_xml("display", activity)
112
+ if ma_display && !affirm(ma_display)
113
+ output_ma_display= false
114
+ else
115
+ output_ma_display= true
116
+ end
117
+ end
118
+ j= j + 1 if (action=='form' || output_ma_display)
119
+ @xvars['referer'] = activity.attributes['TEXT'] if action=='redirect'
120
+ if action!= 'if' && !text.blank?
121
+ scode, name= text.split(':', 2)
122
+ name ||= scode; name.strip!
123
+ code= name2code(scode)
124
+ else
125
+ code= text
126
+ name= text
127
+ end
128
+ role= get_option_xml("role", activity) || default_role
129
+ rule= get_option_xml("rule", activity) || "true"
130
+ runseq= Jinda::Runseq.create :xmain=>xmain.id,
131
+ :name=> name, :action=> action,
132
+ :code=> code, :role=>role.upcase, :rule=> rule,
133
+ :rstep=> i, :form_step=> j, :status=>'I',
134
+ :xml=>activity.to_s
135
+ xmain.current_runseq= runseq.id if i==1
136
+ end
137
+ @xvars['total_steps']= i
138
+ @xvars['total_form_steps']= j
139
+ end
140
+
141
+ def init_vars(xmain)
142
+ @xmain= Jinda::Xmain.find xmain
143
+ @xvars= @xmain.xvars
144
+ @runseq= @xmain.runseqs.find @xmain.current_runseq
145
+ # authorize?
146
+ @xvars['current_step']= @runseq.rstep
147
+ @xvars['referrer']= request.referrer
148
+ session[:xmain_id]= @xmain.id
149
+ session[:runseq_id]= @runseq.id
150
+ unless params[:action]=='run_call'
151
+ @runseq.start ||= Time.now
152
+ @runseq.status= 'R' # running
153
+ @runseq.save
154
+ end
155
+ $xmain= @xmain; $xvars= @xvars
156
+ $runseq_id= @runseq.id
157
+ $user_id= current_ma_user.try(:id)
158
+ end
159
+ def init_vars_by_runseq(runseq_id)
160
+ @runseq= Jinda::Runseq.find runseq_id
161
+ @xmain= @runseq.xmain
162
+ @xvars= @xmain.xvars
163
+ #@xvars[:current_step]= @runseq.rstep
164
+ @runseq.start ||= Time.now
165
+ @runseq.status= 'R' # running
166
+ @runseq.save
167
+ end
168
+
33
169
  def b(s)
34
170
  "<b>#{s}</b>".html_safe
35
171
  end
@@ -41,9 +177,9 @@ module Jinda
41
177
  end
42
178
 
43
179
  def refresh_to(url='/', option={})
44
- if option[:alert]
45
- ma_log option[:alert]
46
- end
180
+ if option[:alert]
181
+ ma_log option[:alert]
182
+ end
47
183
  # skip #
48
184
  # Rails 5.2 not allow to use js inline call
49
185
  render inline: "<script>window.location.replace('#{url}')</script>"
@@ -63,19 +199,16 @@ module Jinda
63
199
  def redirect_to_root
64
200
  redirect_to root_path
65
201
  end
202
+
66
203
  # Todo refactor code
67
204
  def get_option(opt, runseq=@runseq)
68
- ma_log("Todo in def get_option(opt, runseq=@runseq)")
69
205
  xml= REXML::Document.new(runseq.xml).root
70
206
  url=''
71
- # xml.each_element('///node') do |n|
72
- xml.each_element('/node') do |n|
207
+ # get option from second element of node using '//node'
208
+ xml.each_element('//node') do |n|
73
209
  if n.attributes['TEXT']
74
210
  text = n.attributes['TEXT']
75
- puts "text = " + text
76
211
  url= text if text =~ /^#{opt}:\s*/
77
- puts "url = " + url
78
- ma_log("Todo in def get_option(opt, runseq=@runseq)")
79
212
  end
80
213
  end
81
214
  return nil if url.blank?
@@ -160,7 +293,8 @@ module Jinda
160
293
  xml= @service.xml
161
294
  step1 = REXML::Document.new(xml).root.elements['node']
162
295
  role= get_option_xml("role", step1) || ""
163
- # rule= get_option_xml("rule", step1) || true
296
+ # rule= get_option_xml("rule", step1) || true
297
+ rule= get_option_xml("rule", step1) || true
164
298
  return true if role==""
165
299
  unless current_ma_user
166
300
  return role.blank?
@@ -168,17 +302,18 @@ module Jinda
168
302
  return false unless current_ma_user.role
169
303
  return current_ma_user.has_role(role)
170
304
  end
305
+
171
306
  end
172
307
  def ma_log(message)
173
308
  # Jinda::Notice.create :message => ERB::Util.html_escape(message.gsub("`","'")),
174
309
  # :unread=> true, :ip=> ($ip || request.env["REMOTE_ADDR"])
175
- if session[:user_id]
176
- Jinda::Notice.create :message => ERB::Util.html_escape(message.gsub("`","'")),
177
- :user_id => $user.id, :unread=> true, :ip=>request.env["REMOTE_ADDR"]
178
- else
179
- Jinda::Notice.create :message => ERB::Util.html_escape(message.gsub("`","'")),
180
- :unread=> true, :ip=>request.env["REMOTE_ADDR"]
181
- end
310
+ if session[:user_id]
311
+ Jinda::Notice.create :message => ERB::Util.html_escape(message.gsub("`","'")),
312
+ :user_id => $user.id, :unread=> true, :ip=>request.env["REMOTE_ADDR"]
313
+ else
314
+ Jinda::Notice.create :message => ERB::Util.html_escape(message.gsub("`","'")),
315
+ :unread=> true, :ip=>request.env["REMOTE_ADDR"]
316
+ end
182
317
  end
183
318
 
184
319
  alias :ma_notice :ma_log
@@ -245,7 +380,7 @@ module Jinda
245
380
  # end
246
381
  #@user ||= User.find_by_auth_token!(cookies[:auth_token]) if cookies[:auth_token]
247
382
  @user ||= User.where(:auth_token => cookies[:auth_token]).first if cookies[:auth_token]
248
- return @user
383
+ return @user
249
384
  end
250
385
 
251
386
  def ui_action?(s)
@@ -260,7 +395,7 @@ module Jinda
260
395
  # ""
261
396
  # end
262
397
  # end
263
-
398
+
264
399
  # ##########################################################################
265
400
  #
266
401
  # Create / Update Modules, Runseqs, Services from XML
@@ -290,9 +425,9 @@ module Jinda
290
425
  module_code= code.to_code
291
426
  menu_icon = m_icon(m)
292
427
 
293
- # ##########################################################################
294
- # First Node eg: Module Name
295
- # ##########################################################################
428
+ # ##########################################################################
429
+ # First Node eg: Module Name
430
+ # ##########################################################################
296
431
  # create or update to GmaModule
297
432
  ma_module= Jinda::Module.find_or_create_by :code=>module_code
298
433
  ma_module.update_attributes :uid=>ma_module.id.to_s, :icon=>menu_icon
@@ -302,9 +437,9 @@ module Jinda
302
437
  mseq += 1
303
438
  seq= 0
304
439
 
305
- # ##########################################################################
306
- # Second Nodes eg: Role, Link otherwise Services
307
- # ##########################################################################
440
+ # ##########################################################################
441
+ # Second Nodes eg: Role, Link otherwise Services
442
+ # ##########################################################################
308
443
  m.each_element('node') do |s|
309
444
  service_name= s.attributes["TEXT"].to_s
310
445
  scode, sname= service_name.split(':', 2)
@@ -327,9 +462,9 @@ module Jinda
327
462
  protected_services << ma_service.uid
328
463
  else
329
464
 
330
- # ##########################################################################
331
- # Second and Third Nodes eg: Role, Normal Services
332
- # ##########################################################################
465
+ # ##########################################################################
466
+ # Second and Third Nodes eg: Role, Normal Services
467
+ # ##########################################################################
333
468
  # normal service
334
469
  step1 = s.elements['node']
335
470
  role= get_option_xml("role", step1) || ""
@@ -385,7 +520,7 @@ module Jinda
385
520
  ########################################################################
386
521
  # Jinda Rake Task #
387
522
  ########################################################################
388
-
523
+
389
524
  def gen_views
390
525
  t = ["*** generate ui ***"]
391
526
 
@@ -398,7 +533,7 @@ module Jinda
398
533
  unless gen_view_file_exist?(dir)
399
534
  gen_view_mkdir(dir,t)
400
535
  end
401
-
536
+
402
537
  if s.code=='link'
403
538
  f= "app/views/#{s.module.code}/index.haml"
404
539
  $afile << f
@@ -409,7 +544,7 @@ module Jinda
409
544
  end
410
545
  next
411
546
  end
412
-
547
+
413
548
  dir ="app/views/#{s.module.code}/#{s.code}"
414
549
  unless gen_view_file_exist?(dir)
415
550
  gen_view_mkdir(dir,t)
@@ -453,18 +588,18 @@ module Jinda
453
588
 
454
589
  def process_models
455
590
 
456
- # app= get_app
457
- # t= ["process models"]
458
- # xml map sample from index.mm
459
- # node @CREATED=1273819432637 @ID=ID_1098419600 @MODIFIED=1334737006485 @TEXT=Jinda
460
- # node @CREATED=1273819462973 @ID=ID_282419531 @MODIFIED=1493705904561 @POSITION=right @TEXT=services
461
- # node @CREATED=1273819465949 @FOLDED=true @ID=ID_855471610 @MODIFIED=1493768913078 @POSITION=right @TEXT=roles
462
- # node @CREATED=1273819456867 @ID=ID_1677010054 @MODIFIED=1493418874718 @POSITION=left @TEXT=models
463
- # node @CREATED=1292122118499 @FOLDED=true @ID=ID_1957754752 @MODIFIED=1493705885123 @TEXT=person
464
- # node @CREATED=1292122236285 @FOLDED=true @ID=ID_959987887 @MODIFIED=1493768919147 @TEXT=address
465
- # node @CREATED=1493418879485 @ID=ID_1995497233 @MODIFIED=1493718770637 @TEXT=article
466
- # node @CREATED=1493418915637 @ID=ID_429078131 @MODIFIED=1493418930081 @TEXT=comment
467
-
591
+ # app= get_app
592
+ # t= ["process models"]
593
+ # xml map sample from index.mm
594
+ # node @CREATED=1273819432637 @ID=ID_1098419600 @MODIFIED=1334737006485 @TEXT=Jinda
595
+ # node @CREATED=1273819462973 @ID=ID_282419531 @MODIFIED=1493705904561 @POSITION=right @TEXT=services
596
+ # node @CREATED=1273819465949 @FOLDED=true @ID=ID_855471610 @MODIFIED=1493768913078 @POSITION=right @TEXT=roles
597
+ # node @CREATED=1273819456867 @ID=ID_1677010054 @MODIFIED=1493418874718 @POSITION=left @TEXT=models
598
+ # node @CREATED=1292122118499 @FOLDED=true @ID=ID_1957754752 @MODIFIED=1493705885123 @TEXT=person
599
+ # node @CREATED=1292122236285 @FOLDED=true @ID=ID_959987887 @MODIFIED=1493768919147 @TEXT=address
600
+ # node @CREATED=1493418879485 @ID=ID_1995497233 @MODIFIED=1493718770637 @TEXT=article
601
+ # node @CREATED=1493418915637 @ID=ID_429078131 @MODIFIED=1493418930081 @TEXT=comment
602
+
468
603
  models= @app.elements["//node[@TEXT='models']"] || REXML::Document.new
469
604
  models.each_element('node') do |model|
470
605
  # t << "= "+model.attributes["TEXT"]
@@ -472,14 +607,14 @@ module Jinda
472
607
  next if model_name.comment?
473
608
  model_code= name2code(model_name)
474
609
  model_file= "#{Rails.root}/app/models/#{model_code}.rb"
475
-
610
+
476
611
  if File.exists?(model_file)
477
612
  doc= File.read(model_file)
478
613
  else
479
614
  system("rails generate model #{model_code}")
480
615
  doc= File.read(model_file)
481
616
  end
482
-
617
+
483
618
  doc = add_utf8(doc)
484
619
  attr_hash= make_fields(model)
485
620
  doc = add_jinda(doc, attr_hash)
@@ -496,14 +631,14 @@ module Jinda
496
631
  def add_jinda(doc, attr_hash)
497
632
  if doc =~ /#{@btext}/
498
633
  s1,s2,s3= doc.partition(/ #{@btext}.*#{@etext}\n/m)
499
- s2= ""
634
+ s2= ""
500
635
  else
501
636
  s1,s2,s3= doc.partition("include Mongoid::Document\n")
502
637
  end
503
638
  doc= s1+s2+ <<-EOT
504
639
  #{@btext}
505
640
  include Mongoid::Timestamps
506
- EOT
641
+ EOT
507
642
 
508
643
  attr_hash.each do |a|
509
644
  # doc+= "\n*****"+a.to_s+"\n"
@@ -596,8 +731,8 @@ module Jinda
596
731
  ########################################################################
597
732
  # END code from jinda.rake #
598
733
  ########################################################################
599
-
600
-
734
+
735
+
601
736
  ########################################################################
602
737
  # Methods to be overrided by gemhelp #
603
738
  # for Rspec Test
@@ -617,7 +752,7 @@ module Jinda
617
752
  t << "create file #{f}"
618
753
  end
619
754
  ########################################################################
620
-
755
+
621
756
  def controller_exists?(modul)
622
757
  File.exists? "#{Rails.root}/app/controllers/#{modul}_controller.rb"
623
758
  end
@@ -642,11 +777,13 @@ module Jinda
642
777
  return true
643
778
  end
644
779
  end
780
+ # return nil or value of opt: if provided
645
781
  def get_option_xml(opt, xml)
646
782
  if xml
647
783
  url=''
648
784
  xml.each_element('node') do |n|
649
785
  text= n.attributes['TEXT']
786
+ # check if opt match from beginning of text
650
787
  url= text if text =~/^#{opt}/
651
788
  end
652
789
  return nil if url.blank?
@@ -661,7 +798,7 @@ module Jinda
661
798
  node.each_element("icon") do |mn|
662
799
  mcons << mn.attributes["BUILTIN"]
663
800
  end
664
- ticon = mcons[0].to_s
801
+ ticon = mcons[0].to_s
665
802
  return ticon
666
803
  end
667
804
 
@@ -691,8 +828,8 @@ module Jinda
691
828
 
692
829
  def freemind2action(s)
693
830
  case s.downcase
694
- #when 'bookmark' # Excellent
695
- # 'call'
831
+ #when 'bookmark' # Excellent
832
+ # 'call'
696
833
  when 'bookmark' # Excellent
697
834
  'do'
698
835
  when 'attach' # Look here
@@ -704,11 +841,16 @@ module Jinda
704
841
  when 'help' # Question
705
842
  'if'
706
843
  when 'forward' # Forward
707
- 'redirect'
844
+ # 'redirect'
845
+ 'direct_to'
708
846
  when 'kaddressbook' #Phone
709
847
  'invoke' # invoke new service along the way
710
- when 'list' # Output
848
+ when 'idea' # output
711
849
  'output'
850
+ when 'list' # List
851
+ 'list'
852
+ when 'folder' # Folder
853
+ 'folder'
712
854
  when 'mail'
713
855
  'mail'
714
856
  when 'xmag' # Tobe discussed
@@ -743,9 +885,9 @@ class String
743
885
  end
744
886
  def to_code
745
887
  s= self.dup
746
- # s.downcase!
747
- # s.gsub! /[\s\-_]/, ""
748
- # s
888
+ # s.downcase!
889
+ # s.gsub! /[\s\-_]/, ""
890
+ # s
749
891
  code, name = s.split(':')
750
892
  code.downcase.strip.gsub(' ','_').gsub(/[^#_\/a-zA-Z0-9]/,'')
751
893
  end
@@ -761,9 +903,9 @@ module ActionView
761
903
  end
762
904
  end
763
905
  class FormBuilder
764
- def date_select_thai(method)
765
- self.date_select method, :use_month_names=>THAI_MONTHS, :order=>[:day, :month, :year]
766
- end
906
+ def date_select_thai(method)
907
+ self.date_select method, :use_month_names=>THAI_MONTHS, :order=>[:day, :month, :year]
908
+ end
767
909
  def date_field(method, options = {})
768
910
  default= options[:default] || self.object.send(method) || Date.today
769
911
  data_options= ({"mode"=>"calbox"}).merge(options)
@@ -854,7 +996,7 @@ module ActionView
854
996
  init_map();
855
997
  });
856
998
  </script>
857
- EOT
999
+ EOT
858
1000
  out.html_safe
859
1001
  end
860
1002
  end