def time time= Time.now return "#{time.year}_#{time.month}_#{time.day}_#{time.hour}_#{time.min}_#{time.sec}" end def read_ppage (fluxToSend, current_page) @fluxToSend=fluxToSend get_page= read_page(:pages, :title => current_page) if get_page.nil? pagecontent="default message to user, when empty page found" else pagecontent= get_page[:content] end # ------ read modules need on page # ------ requested_module_name=read_modules_on_page(:pages, :title => current_page) if !requested_module_name.nil? module_to_insert_on_page=requested_module_name.split(",") else module_to_insert_on_page=["vide"] end modules_content="" module_to_insert_on_page.each do |module_to_get| modules_content=get_modules_content(:modules, :title => module_to_get)+modules_content end pagecontent=pagecontent+modules_content set_page pagecontent, "page_content", "editablecontent" end def set_page content, id=time, css_class="standard_object" content=(content).to_json @fluxToSend.send content end def machinize(fluxToSend, current_page, message) msg_received=case message[:action] when "save" content= message[:pagecontent] pagename= message[:currentpage] save(:pages, :title => current_page, :content => content) when "save_list_of_modules_on_page" content= message[:pagecontent] pagename= message[:currentpage] save(:pages, :title => current_page, :modules_on_page => content.join(",")) when "save_menus_on_page" content= message[:pagecontent] pagename= message[:currentpage] save(:pages, :title => current_page, :menus_on_page => content) when "save_module" content= message[:pagecontent] pagename= message[:currentpage] save(:modules, :title => pagename, :content => content) when "get_module" content= message[:pagecontent] module_found=get_modules_content(:modules, :title => content) module_found="" module_found=(module_found).to_json @fluxToSend.send module_found when "read_modules_list" module_found= read_modules_list module_found= module_found.join("
  • ") module_found="" module_found="" module_found=(module_found).to_json @fluxToSend.send module_found when "list_modules_number" number_found= read_modules_list.length.to_s number_found="" number_found=(number_found).to_json @fluxToSend.send number_found when "read_modules_on_page" pagename= message[:currentpage] module_requested=read_modules_on_page(:pages, :title => pagename) if !module_requested.nil? module_requested=module_requested.split(",") module_requested= module_requested.join("
  • ") module_requested="" module_requested="" module_requested=(module_requested).to_json @fluxToSend.send module_requested end else end end