diff --git a/basic.json b/basic.json index 8f6ff9300..3a8be1ef4 100644 --- a/basic.json +++ b/basic.json @@ -11,19 +11,19 @@ { "Name": "notifications_roles", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1notifications_list).(this_table, @1notifications)\nInclude(@1pager_header)\n\nIf(#role_id#>0){\n DBFind(@1roles).Where({\"id\": #role_id#}).Vars(my)\n SetTitle($@1role_notifics$ (#my_role_name#))\n}.Else{\n SetTitle($@1role_notifics$)\n}\nDBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"System\"}).Vars(\"system_app\")\nSetVar(role_admin, AppParam(App: #system_app_id#, Name: \"role_admin\"))\nIf(And(#role_id# == #role_admin#, #ecosystem_id# == 1)){\n DBFind(@1ecosystems).Count(ecos_count)\n If(#ecos_count#>1){\n AddToolButton(Title: $@1broadcast$, Page: @1notifications_broadcast, Icon: icon-plus).Popup(Header: $@1notifications_broadcast$, Width: \"50\")\n }\n}\nAddToolButton(Title: $@1send$, Page: @1notifications_roles_send, Icon: icon-plus).Popup(Header: $@1send$, Width: \"50\")\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": #ecosystem_id#, \"recipient->role_id\": #role_id#, {\"$and\": [{\"notification->type\":2}, {\"$or\": [{\"sender->member_name\":{\"$ilike\": \"#search#\"}}, {\"sender->role_name\":{\"$ilike\": \"#search#\"}}]}]}})\n}.Else{\n SetVar(where, {\"ecosystem\": #ecosystem_id#, \"notification->type\": 2, \"recipient->role_id\": #role_id#})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1sender)).(page_par, #type#)\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order([{closed:\"1\"},{id:\"-1\"}]).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,recipient->role_id,recipient->role_name,recipient->image_id,sender->type,sender->member_id,sender->member_name,sender->role_id,sender->role_name,notification->icon,notification->popup,page_name,page_params,date_created,date_closed,date_start_processing,processing_info->member_name,closed\").Custom(_id){\n If(#closed# == 0){\n SetVar(style_text,\"text-normal\").(style_link,\"text-primary\")\n }.Else{\n SetVar(style_text,\"text-muted\").(style_link,\"text-muted\")\n }\n Span(Class: #style_text#, Body: #id#)\n}.Custom(_recipient){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1roles_view, PageParams: \"v_role_id=#recipient.role_id#\"){\n If(#recipient.image_id#>0){\n Image(Src: Binary().ById(#recipient.image_id#) \"#img_data#\", Class: mr-sm).Style(width: 30px; border: 1px solid #5A5D63;)\n #recipient.role_name#\n }.Else{\n Div(){\n Span(Em(Class: fa icon-settings fa-2x)).Style(margin-right:10px;)\n Span(#recipient.role_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n}.Custom(custom_arrow){\n Em(Class: fa fa-long-arrow-right fa-1x #style_text#)\n}.Custom(_sender){\n If(#sender.type#==1){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#sender.member_id#\"){#sender.member_name#}\n }\n If(#sender.type#==2){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1roles_view, PageParams: \"v_role_id=#sender.role_id#\"){#sender.role_name#}\n }\n}.Custom(_icon){\n Span(Class: fa #notification.icon# fa-2x #style_text#)\n}.Custom(_page){\n If(#notification.popup#==1){\n Button(Class: btn-link h5 text-bold m0, Page: #page_name#, PageParams: \"notific_id=#id#\"){\n Span(Class: #style_link#, Body: #page_name#)\n }.Popup(Header: $@1notifications_view$, Width: \"40\")\n }.Else{\n Button(Class: btn-link h5 text-bold m0, Page: #page_name#, PageParams: \"notific_id=#id#\"){\n Span(Class: #style_link#, Body: #page_name#)\n }\n }\n}.Custom(_date){\n Div(#style_text# h6 m0){DateTime(DateTime: #date_created#, Format: \"DD.MM.YYYY HH:MI\")}\n If(#date_closed# != 0){\n Div(#style_text# h6 m0){DateTime(DateTime: #date_closed#, Format: \"DD.MM.YYYY HH:MI\")}\n }\n}.Custom(_processing){\n Div(Class: #style_text# h6 m0){\n If(#date_start_processing# == 0){\n $@1not_started$\n }.Else{\n Span(LangRes(@1started_by) #processing_info.member_name#)\n Div(){DateTime(DateTime: #date_start_processing#, Format: \"DD.MM.YYYY HH:MI\")}\n }\n }\n}.Custom(_status){\n If(#closed# == 0){\n Span(Class: #style_text#){\n If(#date_start_processing# == 0){\n LangRes(@1active)\n }.Else{\n LangRes(@1processing)\n }\n }\n }.Else{\n Span(Class: #style_text#, Body: LangRes(@1closed))\n }\n}.Custom(_actions){\n Div(text-right){\n If(#closed# == 0){\n If(#date_start_processing# == NULL){\n Button(Class: btn btn-default fa fa-play, Contract: @1NotificationsProcess, Params: \"NotificId=#id#\", Page: @1notifications_list, PageParams: \"type=1\").Alert(Text: \"$@1want_start_processing_notification$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }.Else{\n Button(Class: btn btn-default fa fa-trash, Contract: @1NotificationsClose, Params: \"NotificId=#id#\", Page: @1notifications_list, PageParams: \"type=1\").Alert(Text: \"$@1want_close_notification$\", ConfirmButton:$@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1icon$=_icon,$@1page$=_page,$@1sender$=_sender,=custom_arrow,$@1recipient$=_recipient,$@1processing$=_processing,$@1sent$ / $@1closed$=_date,$@1status$=_status,=_actions\")\n }.ElseIf(#role_id#>0){\n Div(Class: text-center h4 text-muted, Body: \"$@1role_notifics$ $@1not_founded$\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1role_not_selected$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, @1notifications_list).(this_table, @1notifications)\nInclude(@1pager_header)\n\nIf(#role_id#>0){\n DBFind(\"@1roles\").Where({\"id\": \"#role_id#\"}).Vars(my)\n SetTitle($@1role_notifics$ (#my_role_name#))\n}.Else{\n SetTitle($@1role_notifics$)\n}\nDBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(system_app)\nSetVar(role_admin, AppParam(App: #system_app_id#, Name: \"role_admin\"))\nIf(And(#role_id# == #role_admin#, #ecosystem_id# == 1)){\n DBFind(\"@1ecosystems\").Count(ecos_count)\n If(#ecos_count#>1){\n AddToolButton(Title: $@1broadcast$, Page: @1notifications_broadcast, Icon: icon-plus).Popup(Header: $@1notifications_broadcast$, Width: \"50\")\n }\n}\nAddToolButton(Title: $@1send$, Page: @1notifications_roles_send, Icon: icon-plus).Popup(Header: $@1send$, Width: \"50\")\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"recipient->role_id\": \"#role_id#\", \"$and\": [{\"notification->type\": 2}, {\"$or\": [{\"sender->member_name\": {\"$ilike\": \"#search#\"}}, {\"sender->role_name\": {\"$ilike\": \"#search#\"}}]}]})\n}.Else{\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"notification->type\": 2, \"recipient->role_id\": \"#role_id#\"})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1sender)).(page_par, #type#)\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"closed\": 1, \"id\": \"-1\"}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,recipient->role_id,recipient->role_name,recipient->image_id,sender->type,sender->account,sender->member_name,sender->role_id,sender->role_name,notification->icon,notification->popup,page_name,page_params,date_created,date_closed,date_start_processing,processing_info->member_name,closed\").Custom(_id){\n If(#closed# == 0){\n SetVar(style_text,\"text-normal\").(style_link,\"text-primary\")\n }.Else{\n SetVar(style_text,\"text-muted\").(style_link,\"text-muted\")\n }\n Span(Class: #style_text#, Body: #id#)\n}.Custom(_recipient){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1roles_view, PageParams: \"v_role_id=#recipient.role_id#\"){\n If(#recipient.image_id#>0){\n Image(Src: Binary().ById(#recipient.image_id#) \"#img_data#\", Class: mr-sm).Style(width: 30px; border: 1px solid #5A5D63;)\n #recipient.role_name#\n }.Else{\n Div(){\n Span(Em(Class: fa icon-settings fa-2x)).Style(margin-right:10px;)\n Span(#recipient.role_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n}.Custom(custom_arrow){\n Em(Class: fa fa-long-arrow-right fa-1x #style_text#)\n}.Custom(_sender){\n If(#sender.type#==1){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#sender.account#\"){#sender.member_name#}\n }\n If(#sender.type#==2){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1roles_view, PageParams: \"v_role_id=#sender.role_id#\"){#sender.role_name#}\n }\n}.Custom(_icon){\n Span(Class: fa #notification.icon# fa-2x #style_text#)\n}.Custom(_page){\n If(#notification.popup#==1){\n Button(Class: btn-link h5 text-bold m0, Page: #page_name#, PageParams: \"notific_id=#id#\"){\n Span(Class: #style_link#, Body: #page_name#)\n }.Popup(Header: $@1notifications_view$, Width: \"40\")\n }.Else{\n Button(Class: btn-link h5 text-bold m0, Page: #page_name#, PageParams: \"notific_id=#id#\"){\n Span(Class: #style_link#, Body: #page_name#)\n }\n }\n}.Custom(_date){\n Div(#style_text# h6 m0){DateTime(DateTime: #date_created#, Format: \"DD.MM.YYYY HH:MI\")}\n If(#date_closed# != 0){\n Div(#style_text# h6 m0){DateTime(DateTime: #date_closed#, Format: \"DD.MM.YYYY HH:MI\")}\n }\n}.Custom(_processing){\n Div(Class: #style_text# h6 m0){\n If(#date_start_processing# == 0){\n $@1not_started$\n }.Else{\n Span(LangRes(@1started_by) #processing_info.member_name#)\n Div(){DateTime(DateTime: #date_start_processing#, Format: \"DD.MM.YYYY HH:MI\")}\n }\n }\n}.Custom(_status){\n If(#closed# == 0){\n Span(Class: #style_text#){\n If(#date_start_processing# == 0){\n LangRes(@1active)\n }.Else{\n LangRes(@1processing)\n }\n }\n }.Else{\n Span(Class: #style_text#, Body: LangRes(@1closed))\n }\n}.Custom(_actions){\n Div(text-right){\n If(#closed# == 0){\n If(#date_start_processing# == NULL){\n Button(Class: btn btn-default fa fa-play, Contract: @1NotificationsProcess, Params: \"NotificId=#id#\", Page: @1notifications_list, PageParams: \"type=1\").Alert(Text: \"$@1want_start_processing_notification$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }.Else{\n Button(Class: btn btn-default fa fa-trash, Contract: @1NotificationsClose, Params: \"NotificId=#id#\", Page: @1notifications_list, PageParams: \"type=1\").Alert(Text: \"$@1want_close_notification$\", ConfirmButton:$@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1icon$=_icon,$@1page$=_page,$@1sender$=_sender,=custom_arrow,$@1recipient$=_recipient,$@1processing$=_processing,$@1sent$ / $@1closed$=_date,$@1status$=_status,=_actions\")\n }.ElseIf(#role_id#>0){\n Div(Class: text-center h4 text-muted, Body: \"$@1role_notifics$ $@1not_founded$\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1role_not_selected$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", "Type": "blocks" }, { "Name": "notifications_single", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1notifications_list).(this_table, @1notifications)\nInclude(@1pager_header)\n\nSetTitle(\"$@1personal_notifics$\")\nDBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"System\"}).Vars(\"system_app\")\nSetVar(role_admin, AppParam(App: #system_app_id#, Name: \"role_admin\"))\nIf(And(#role_id# == #role_admin#, #ecosystem_id# == 1)){\n DBFind(@1ecosystems).Count(ecos_count)\n If(#ecos_count#>1){\n AddToolButton(Title: $@1broadcast$, Page: @1notifications_broadcast, Icon: icon-plus).Popup(Header: $@1notifications_broadcast$, Width: \"50\")\n }\n}\nAddToolButton(Title: $@1send$, Page: @1notifications_single_send, Icon: icon-plus).Popup(Header: $@1send$, Width: \"50\")\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": #ecosystem_id#, \"recipient->member_id\": #key_id#, {\"$and\": [{\"notification->type\":1}, {\"$or\": [{\"sender->member_name\":{\"$ilike\": \"#search#\"}}, {\"sender->role_name\":{\"$ilike\": \"#search#\"}}]}]}})\n}.Else{\n SetVar(where, {\"ecosystem\": #ecosystem_id#, \"notification->type\": 1, \"recipient->member_id\": #key_id#})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1sender)).(page_par, #type#)\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order([{closed:\"1\"}, {id:\"-1\"}]).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,recipient->member_id,recipient->member_name,recipient->image_id,sender->type,sender->member_id,sender->member_name,sender->role_id,sender->role_name,notification->icon,notification->popup,page_name,page_params,date_created,date_closed,closed\").Custom(custom_id){\n If(#closed# == 0){\n SetVar(Name: style_text, Value: \"text-normal\")\n SetVar(Name: style_link, Value: \"text-primary\")\n }.Else{\n SetVar(Name: style_text, Value: \"text-muted\")\n SetVar(Name: style_link, Value: \"text-muted\")\n }\n Span(Class: #style_text#, Body: #id#)\n}.Custom(custom_recipient){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#recipient.member_id#\"){\n If(#recipient.image_id#>0){\n Image(Src: Binary().ById(#recipient.image_id#), Class: img-circle).Style(width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(#recipient.member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(#recipient.member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n}.Custom(custom_arrow){\n Em(Class: fa fa-long-arrow-right fa-1x #style_text#)\n}.Custom(custom_sender){\n If(#sender.type#==1){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#sender.member_id#\"){\n Span(Body: #sender.member_name#)\n }\n }\n If(#sender.type#==2){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1roles_view, PageParams: \"v_role_id=#sender.role_id#\"){\n Span(Body: #sender.role_name#)\n }\n }\n}.Custom(custom_icon){\n Em(Class: fa #notification.icon# fa-2x #style_text#)\n}.Custom(custom_page){\n If(#notification.popup#==1){\n Button(Class: btn-link h5 text-bold m0, Page: #page_name#, PageParams: \"notific_id=#id#\"){\n Span(Class: #style_link#, Body: #page_name#)\n }.Popup(Header: $@1notifications_view$, Width: \"40\")\n }.Else{\n Button(Class: btn-link h5 text-bold m0, Page: #page_name#, PageParams: \"notific_id=#id#\"){\n Span(Class: #style_link#, Body: #page_name#)\n }\n }\n}.Custom(custom_date){\n Div(Class: #style_text# h6 m0, Body: DateTime(DateTime: #date_created#, Format: \"DD.MM.YYYY HH:MI\"))\n If(#date_closed# != 0){\n Div(Class: #style_text# h6 m0, Body: DateTime(DateTime: #date_closed#, Format: \"DD.MM.YYYY HH:MI\"))\n }\n}.Custom(custom_status){\n If(#closed# == 0){\n Span(Class: #style_text#, Body: LangRes(@1active))\n }.Else{\n Span(Class: #style_text#, Body: LangRes(@1closed))\n }\n}.Custom(actions){\n Div(pull-right){\n If(#closed# == 0){\n Button(Body: Em(Class: fa fa-trash), Class: btn btn-default, Contract: @1NotificationsClose, Params: \"NotificId=#id#\", Page: @1notifications_list).Alert(Text: \"$@1want_close_notification$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1icon$=custom_icon,$@1page$=custom_page,$@1sender$=custom_sender,=custom_arrow,$@1recipient$=custom_recipient,$@1sent$ / $@1closed$=custom_date,$@1status$=custom_status,=actions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1personal_notifics$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, @1notifications_list).(this_table, @1notifications)\nInclude(@1pager_header)\n\nSetTitle(\"$@1personal_notifics$\")\nDBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(system_app)\nSetVar(role_admin, AppParam(App: #system_app_id#, Name: \"role_admin\"))\nIf(And(#role_id# == #role_admin#, #ecosystem_id# == 1)){\n DBFind(\"@1ecosystems\").Count(ecos_count)\n If(#ecos_count#>1){\n AddToolButton(Title: $@1broadcast$, Page: @1notifications_broadcast, Icon: icon-plus).Popup(Header: $@1notifications_broadcast$, Width: \"50\")\n }\n}\nAddToolButton(Title: $@1send$, Page: @1notifications_single_send, Icon: icon-plus).Popup(Header: $@1send$, Width: \"50\")\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"recipient->account\": \"#account_id#\", \"$and\": [{\"notification->type\": 1}, {\"$or\": [{\"sender->member_name\": {\"$ilike\": \"#search#\"}}, {\"sender->role_name\": {\"$ilike\": \"#search#\"}}]}]})\n}.Else{\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"notification->type\": 1, \"recipient->account\": \"#account_id#\"})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1sender)).(page_par, #type#)\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"closed\": 1, \"id\": \"-1\"}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,recipient->account,recipient->member_name,recipient->image_id,sender->type,sender->account,sender->member_name,sender->role_id,sender->role_name,notification->icon,notification->popup,page_name,page_params,date_created,date_closed,closed\").Custom(custom_id){\n If(#closed# == 0){\n SetVar(Name: style_text, Value: \"text-normal\")\n SetVar(Name: style_link, Value: \"text-primary\")\n }.Else{\n SetVar(Name: style_text, Value: \"text-muted\")\n SetVar(Name: style_link, Value: \"text-muted\")\n }\n Span(Class: #style_text#, Body: #id#)\n}.Custom(custom_recipient){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#recipient.account#\"){\n If(#recipient.image_id#>0){\n Image(Src: Binary().ById(#recipient.image_id#), Class: img-circle).Style(width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(#recipient.member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(#recipient.member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n}.Custom(custom_arrow){\n Em(Class: fa fa-long-arrow-right fa-1x #style_text#)\n}.Custom(custom_sender){\n If(#sender.type#==1){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#sender.account#\"){\n Span(Body: #sender.member_name#)\n }\n }\n If(#sender.type#==2){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1roles_view, PageParams: \"v_role_id=#sender.role_id#\"){\n Span(Body: #sender.role_name#)\n }\n }\n}.Custom(custom_icon){\n Em(Class: fa #notification.icon# fa-2x #style_text#)\n}.Custom(custom_page){\n If(#notification.popup#==1){\n Button(Class: btn-link h5 text-bold m0, Page: #page_name#, PageParams: \"notific_id=#id#\"){\n Span(Class: #style_link#, Body: #page_name#)\n }.Popup(Header: $@1notifications_view$, Width: \"40\")\n }.Else{\n Button(Class: btn-link h5 text-bold m0, Page: #page_name#, PageParams: \"notific_id=#id#\"){\n Span(Class: #style_link#, Body: #page_name#)\n }\n }\n}.Custom(custom_date){\n Div(Class: #style_text# h6 m0, Body: DateTime(DateTime: #date_created#, Format: \"DD.MM.YYYY HH:MI\"))\n If(#date_closed# != 0){\n Div(Class: #style_text# h6 m0, Body: DateTime(DateTime: #date_closed#, Format: \"DD.MM.YYYY HH:MI\"))\n }\n}.Custom(custom_status){\n If(#closed# == 0){\n Span(Class: #style_text#, Body: LangRes(@1active))\n }.Else{\n Span(Class: #style_text#, Body: LangRes(@1closed))\n }\n}.Custom(actions){\n Div(pull-right){\n If(#closed# == 0){\n Button(Body: Em(Class: fa fa-trash), Class: btn btn-default, Contract: @1NotificationsClose, Params: \"NotificId=#id#\", Page: @1notifications_list).Alert(Text: \"$@1want_close_notification$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1icon$=custom_icon,$@1page$=custom_page,$@1sender$=custom_sender,=custom_arrow,$@1recipient$=custom_recipient,$@1sent$ / $@1closed$=custom_date,$@1status$=custom_status,=actions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1personal_notifics$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", "Type": "blocks" }, { "Name": "profile", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "If(Or(#v_key_id# > 0, #v_key_id# < 0)){\n}.Else{\n SetVar(v_key_id, #key_id#)\n}\nDBFind(@1members).Where({\"ecosystem\": #ecosystem_id#, \"id\": #v_key_id#}).Columns(\"id,image_id,member_name,member_info->information\").Vars(member)\n\nIf(Or(#member_id# > 0, #member_id# < 0)){\n SetVar(member_name, #member_member_name#).(member_info, #member_member_info_information#)\n}\n\nDiv(content-wrapper){\n Div(row){\n Div(col-sm-8 col-sm-offset-2 col-lg-6 col-lg-offset-3){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(@1user_info)\n }\n Div(row mt-lg){\n Div(col-md-12 text-center){\n If(Or(#member_id# > 0, #member_id# < 0)){\n If(#member_id# == #key_id#){\n Button(Class: btn btn-link, Page: @1profile_edit){\n If(#member_image_id# > 0){\n Image(Src: Binary().ById(#member_image_id#), Class: img-thumbnail).Style(width: 120px; border: 1px solid #5A5D63;)\n }.Else{\n Span(Class: fa icon-user fa-5x text-primary)\n }\n Div(m0 h4 text-bold){\n #member_name#\n If(#role_id# > 0){\n DBFind(@1roles).Where({\"ecosystem\": #ecosystem_id#, \"id\": #role_id#}).Columns(\"role_name\").Vars(role)\n Span(Body: \" (#role_role_name#)\")\n }\n }\n }.Popup(Header: $@1edit_profile$, Width: 50)\n }.Else{\n If(#member_image_id# > 0){\n Image(Src: Binary().ById(#member_image_id#), Class: img-thumbnail).Style(width: 120px; border: 1px solid #5A5D63;)\n }.Else{\n Span(Class: fa icon-user fa-5x)\n }\n Div(m0 h4 text-bold){#member_name#}\n }\n Div(Class: h5 text-muted m0, Body: #member_info#)\n }.Else{\n If(#v_key_id# == #key_id#){\n Button(Class: btn btn-link, Page: @1profile_edit){\n Div(Class: h4 m0, Body: LangRes(@1edit_profile))\n }.Popup(Header: $@1edit_profile$, Width: 50)\n }\n }\n }\n }\n Div(row mt-lg){\n Div(col-md-12 text-center){\n Div(text-bold m0 h5, Body: LangRes(@1wallet_address))\n Span(Class: h5, Body: Address(#v_key_id#))\n }\n }\n If(#v_key_id# == #key_id#){\n Div(row){\n Div(col-md-12 mt text-center){\n DBFind(@1keys).Where({\"ecosystem\": 1, \"id\": #v_key_id#}).Vars(apl)\n If(#ecosystem_id# > 1){\n DBFind(\"@1keys\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #v_key_id#}).Vars(\"tokens\")\n DBFind(\"@1ecosystems\").Where({\"id\": #ecosystem_id#}).Vars(\"custom\")\n }\n Div(text-bold m0 h5, Body: LangRes(@1balance))\n Div(Class: m0 h5, Body: Money(#apl_amount#) APLA)\n If(And(#ecosystem_id# > 1, #custom_token_title# != \"\")){\n Div(Class: m0 h5, Body: Money(#tokens_amount#) #custom_token_title#)\n }\n If(Or(#ecosystem_id# == 1, #custom_token_title# != \"\")){\n Button(Class: btn-xs btn-link, Page: @1profile_transactions, Body: LangRes(@1transactions_history))\n Button(Class: btn-xs btn-link, Page: @1tokens_send, PageParams: \"back_page=@1profile_view\", Body: LangRes(@1tokens_send)).Popup(Header: $@1tokens_send$, Width: \"50\")\n }\n }\n }\n Div(row){\n Div(col-md-12 mt text-center){\n Div(text-bold h5 m0, Body: LangRes(@1deposit))\n Div(Class: h5 m0, Body: Money(#apl_deposit#) APLA)\n }\n }\n }\n Div(list-group-item text-center mt-lg){\n Div(text-bold m0 h5, Body: LangRes(@1roles))\n DBFind(@1roles_participants).Where({\"ecosystem\": #ecosystem_id#, \"member->member_id\": #v_key_id#, \"deleted\": 0}).Columns(\"id\").Vars(check)\n If(#check_id# > 0){\n DBFind(@1roles_participants,src_roles).Where({\"ecosystem\": #ecosystem_id#, \"member->member_id\":#v_key_id#, \"deleted\": 0}).Columns(\"role->id,role->name\").Order(\"id\")\n ForList(src_roles){\n Span(){\n LinkPage(Class: h6 m0 text-primary, Page: @1roles_view, PageParams: \"v_role_id=#role.id#\", Body: \"#role.name#\")\n }.Style(margin-right: 5px; margin-left: 5px;)\n }\n }.Else{\n Span(LangRes(@1role_none))\n }\n If(#v_key_id# == #key_id#){\n SetVar(founder_account, EcosysParam(\"founder_account\"))\n If(#founder_account# != #key_id#){\n Div(row){\n Div(col-md-12 text-center){\n Button(Class: btn-xs btn-link, Page: @1roles_request, Body: LangRes(@1request)).Popup(Header: $@1request_to_role$, Width: \"50\")\n }\n }\n }\n }\n }\n }\n }\n }\n }\n}", + "Value": "If(#v_account# == \"\"){\n SetVar(v_account, #account_id#)\n}\nDBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#v_account#\"}).Columns(\"account,image_id,member_name,member_info->information\").Vars(member)\n\nIf(#member_account#){\n SetVar(member_name, #member_member_name#).(member_info, #member_member_info_information#)\n}\n\nDiv(content-wrapper){\n Div(row){\n Div(col-sm-8 col-sm-offset-2 col-lg-6 col-lg-offset-3){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(@1user_info)\n }\n Div(row mt-lg){\n Div(col-md-12 text-center){\n If(#member_account#){\n If(#member_account# == #account_id#){\n Button(Class: btn btn-link, Page: @1profile_edit){\n If(#member_image_id# > 0){\n Image(Src: Binary().ById(#member_image_id#), Class: img-thumbnail).Style(width: 120px; border: 1px solid #5A5D63;)\n }.Else{\n Span(Class: fa icon-user fa-5x text-primary)\n }\n Div(m0 h4 text-bold){\n #member_name#\n If(#role_id# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#role_id#\"}).Columns(\"role_name\").Vars(role)\n Span(Body: \" (#role_role_name#)\")\n }\n }\n }.Popup(Header: $@1edit_profile$, Width: 50)\n }.Else{\n If(#member_image_id# > 0){\n Image(Src: Binary().ById(#member_image_id#), Class: img-thumbnail).Style(width: 120px; border: 1px solid #5A5D63;)\n }.Else{\n Span(Class: fa icon-user fa-5x)\n }\n Div(m0 h4 text-bold){#member_name#}\n }\n Div(Class: h5 text-muted m0, Body: #member_info#)\n }.Else{\n If(#v_account# == #account_id#){\n Button(Class: btn btn-link, Page: @1profile_edit){\n Div(Class: h4 m0, Body: LangRes(@1edit_profile))\n }.Popup(Header: $@1edit_profile$, Width: 50)\n }\n }\n }\n }\n Div(row mt-lg){\n Div(col-md-12 text-center){\n Div(text-bold m0 h5, Body: LangRes(@1wallet_address))\n Span(Class: h5, Body: #v_account#)\n }\n }\n If(#v_account# == #account_id#){\n Div(row){\n Div(col-md-12 mt text-center){\n DBFind(\"@1keys\").Where({\"ecosystem\": 1, \"account\": \"#v_account#\", \"deleted\": 0}).Vars(apl)\n If(#ecosystem_id# > 1){\n DBFind(\"@1keys\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#v_account#\", \"deleted\": 0}).Vars(tokens)\n DBFind(\"@1ecosystems\").Where({\"id\": \"#ecosystem_id#\"}).Vars(custom)\n }\n Div(text-bold m0 h5, Body: LangRes(@1balance))\n Div(Class: m0 h5, Body: Money(#apl_amount#) APLA)\n If(And(#ecosystem_id# > 1, #custom_token_title# != \"\")){\n Div(Class: m0 h5, Body: Money(#tokens_amount#) #custom_token_title#)\n }\n If(Or(#ecosystem_id# == 1, #custom_token_title# != \"\")){\n Button(Class: btn-xs btn-link, Page: @1profile_transactions, Body: LangRes(@1transactions_history))\n Button(Class: btn-xs btn-link, Page: @1tokens_send, PageParams: \"back_page=@1profile_view\", Body: LangRes(@1tokens_send)).Popup(Header: $@1tokens_send$, Width: \"50\")\n }\n }\n }\n Div(row){\n Div(col-md-12 mt text-center){\n Div(text-bold h5 m0, Body: LangRes(@1deposit))\n Div(Class: h5 m0, Body: Money(#apl_deposit#) APLA)\n }\n }\n }\n Div(list-group-item text-center mt-lg){\n Div(text-bold m0 h5, Body: LangRes(@1roles))\n DBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"member->account\": \"#v_account#\", \"deleted\": 0}).Columns(\"id\").Vars(check)\n If(#check_id# > 0){\n DBFind(\"@1roles_participants\", src_roles).Where({\"ecosystem\": \"#ecosystem_id#\", \"member->account\": \"#v_account#\", \"deleted\": 0}).Columns(\"role->id,role->name\").Order(\"id\")\n ForList(src_roles){\n Span(){\n LinkPage(Class: h6 m0 text-primary, Page: @1roles_view, PageParams: \"v_role_id=#role.id#\", Body: \"#role.name#\")\n }.Style(margin-right: 5px; margin-left: 5px;)\n }\n }.Else{\n Span(LangRes(@1role_none))\n }\n If(#v_account# == #account_id#){\n SetVar(founder_account, Address(EcosysParam(\"founder_account\")))\n If(#founder_account# != #account_id#){\n Div(row){\n Div(col-md-12 text-center){\n Button(Class: btn-xs btn-link, Page: @1roles_request, Body: LangRes(@1request)).Popup(Header: $@1request_to_role$, Width: \"50\")\n }\n }\n }\n }\n }\n }\n }\n }\n }\n}", "Type": "blocks" }, { @@ -41,7 +41,7 @@ { "Name": "admin_menu", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "MenuItem(Title:$@1member_management$, Page:@1members_list_admin, Icon:\"icon-people\")\nMenuItem(Title:$@1ecosystems$, Page:@1ecosystems_list, Icon:\"icon-layers\")\nMenuItem(Title:$@1platform_parameters$, Page:@1sysparams_list, Icon:\"icon-settings\")\nMenuItem(Title:$@1roles$, Page:@1roles_list, Icon:\"icon-pie-chart\")\nMenuItem(Title:$@1groups$, Page:@1groups_list, Icon:\"icon-user-following\")\nMenuItem(Title:$@1tokens_refund$, Page:@1tokenrefund_list, Icon:\"icon-shuffle\")\nMenuItem(Title:$@1validators$, Page:@1validator_candidates_list, Icon:\"icon-graduation\")\nMenuItem(Title:$@1pa_settings$, Page:@1platform_apps_settings, Icon: \"icon-wrench\")", + "Value": "MenuItem(Title:$@1member_management$, Page:@1members_list_admin, Icon:\"icon-people\")\nMenuItem(Title:$@1ecosystems$, Page:@1ecosystems_list, Icon:\"icon-layers\")\nMenuItem(Title:$@1platform_parameters$, Page:@1sysparams_list, Icon:\"icon-settings\")\nMenuItem(Title:$@1roles$, Page:@1roles_list, Icon:\"icon-pie-chart\")\nMenuItem(Title:$@1groups$, Page:@1groups_list, Icon:\"icon-user-following\")\nMenuItem(Title:$@1tokens_refund$, Page:@1tokenrefund_list, Icon:\"icon-shuffle\")\nMenuItem(Title:$@1consortium_members$, Page:@1consortium_member_candidates, Icon:\"icon-graduation\")\nMenuItem(Title:$@1pa_settings$, Page:@1platform_apps_settings, Icon: \"icon-wrench\")", "Type": "menu" }, { @@ -50,51 +50,51 @@ "Value": "MenuItem(Title:$@1profile$, Page:@1profile_view, Icon:\"icon-wallet\")\nMenuItem(Title:$@1messenger$, Page:@1messages_list, Icon:\"icon-speech\")\nMenuItem(Title:$@1notifications$, Page:@1notifications_list, Icon:\"icon-flag\")\nMenuItem(Title:$@1ecosystem_members$, Page:@1members_list, Icon:\"icon-people\")\nMenuItem(Title:$@1votings$, Page:@1voting_list, Icon:\"icon-note\")", "Type": "menu" }, + { + "Name": "consortium_member_requests", + "Columns": "[\n {\n \"name\": \"api_address\",\n \"conditions\": \"false\",\n \"type\": \"text\"\n },\n {\n \"name\": \"candidate_account\",\n \"conditions\": \"false\",\n \"type\": \"varchar\"\n },\n {\n \"name\": \"comment\",\n \"conditions\": \"false\",\n \"type\": \"text\"\n },\n {\n \"name\": \"date_created\",\n \"conditions\": \"false\",\n \"type\": \"number\"\n },\n {\n \"name\": \"deleted\",\n \"conditions\": \"ContractAccess(\\\"@1ConsortiumMemberDelete\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"description\",\n \"conditions\": \"false\",\n \"type\": \"text\"\n },\n {\n \"name\": \"pub_key\",\n \"conditions\": \"false\",\n \"type\": \"text\"\n },\n {\n \"name\": \"tcp_address\",\n \"conditions\": \"false\",\n \"type\": \"text\"\n }\n]", + "Permissions": "{\"insert\": \"ContractAccess(\\\"@1ConsortiumMemberRequest\\\")\", \"update\": \"ContractAccess(\\\"@1ConsortiumMemberDelete\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", + "Type": "tables" + }, { "Name": "groups", - "Columns": "[\n {\n \"name\":\"creator\",\n \"conditions\":\"false\",\n \"type\":\"json\"\n },\n {\n \"name\":\"date_created\",\n \"conditions\":\"false\",\n \"type\":\"number\"\n },\n {\n \"name\":\"date_deleted\",\n \"conditions\": \"ContractAccess(\\\"@1GroupsDelete\\\")\",\n \"type\":\"number\"\n },\n {\n \"name\":\"deleted\",\n \"conditions\": \"ContractAccess(\\\"@1GroupsDelete\\\")\",\n \"type\":\"number\"\n },\n {\n \"name\":\"ecosystem\",\n \"conditions\":\"false\",\n \"type\":\"number\"\n },\n {\n \"name\":\"group_access\",\n \"conditions\": \"ContractAccess(\\\"@1GroupAccessManager\\\")\",\n \"type\":\"json\"\n },\n {\n \"name\":\"group_info\",\n \"conditions\": \"ContractAccess(\\\"@1GroupsCreate\\\")\",\n \"type\":\"text\"\n },\n {\n \"name\":\"group_name\",\n \"conditions\":\"false\",\n \"type\":\"text\"\n },\n {\n \"name\":\"group_type\",\n \"conditions\":\"false\",\n \"type\":\"number\"\n },\n {\n \"name\":\"image_id\",\n \"conditions\":\"false\",\n \"type\":\"number\"\n }\n]", + "Columns": "[\n {\n \"name\": \"creator\",\n \"conditions\": \"false\",\n \"type\": \"json\"\n },\n {\n \"name\": \"date_created\",\n \"conditions\": \"false\",\n \"type\": \"number\"\n },\n {\n \"name\": \"date_deleted\",\n \"conditions\": \"ContractAccess(\\\"@1GroupsDelete\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"deleted\",\n \"conditions\": \"ContractAccess(\\\"@1GroupsDelete\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"ecosystem\",\n \"conditions\": \"false\",\n \"type\": \"number\"\n },\n {\n \"name\": \"group_access\",\n \"conditions\": \"ContractAccess(\\\"@1GroupAccessManager\\\")\",\n \"type\": \"json\"\n },\n {\n \"name\": \"group_info\",\n \"conditions\": \"ContractAccess(\\\"@1GroupsCreate\\\")\",\n \"type\": \"text\"\n },\n {\n \"name\": \"group_name\",\n \"conditions\": \"false\",\n \"type\": \"text\"\n },\n {\n \"name\": \"group_type\",\n \"conditions\": \"false\",\n \"type\": \"number\"\n },\n {\n \"name\": \"image_id\",\n \"conditions\": \"false\",\n \"type\": \"number\"\n }\n]", "Permissions": "{\"read\": \"true\", \"insert\": \"ContractAccess(\\\"@1GroupsCreate\\\")\", \"update\": \"ContractAccess(\\\"@1GroupsCreate\\\",\\\"@1GroupsDelete\\\",\\\"@1GroupAccessManager\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", "Type": "tables" }, { "Name": "groups_participants", - "Columns": "[\n {\n \"name\":\"appointed\",\n \"conditions\":\"false\",\n \"type\":\"json\"\n },\n {\n \"name\":\"date_created\",\n \"conditions\":\"false\",\n \"type\":\"number\"\n },\n {\n \"name\":\"date_deleted\",\n \"conditions\": \"ContractAccess(\\\"@1GroupsUnassign\\\")\",\n \"type\":\"number\"\n },\n {\n \"name\":\"deleted\",\n \"conditions\": \"ContractAccess(\\\"@1GroupsUnassign\\\")\",\n \"type\":\"number\"\n },\n {\n \"name\":\"ecosystem\",\n \"conditions\":\"false\",\n \"type\":\"number\"\n },\n {\n \"name\":\"groups_info\",\n \"conditions\":\"false\",\n \"type\":\"json\"\n },\n {\n \"name\":\"member\",\n \"conditions\":\"false\",\n \"type\":\"json\"\n }\n]", + "Columns": "[\n {\n \"name\": \"appointed\",\n \"conditions\": \"false\",\n \"type\": \"json\"\n },\n {\n \"name\": \"date_created\",\n \"conditions\": \"false\",\n \"type\": \"number\"\n },\n {\n \"name\": \"date_deleted\",\n \"conditions\": \"ContractAccess(\\\"@1GroupsUnassign\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"deleted\",\n \"conditions\": \"ContractAccess(\\\"@1GroupsUnassign\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"ecosystem\",\n \"conditions\": \"false\",\n \"type\": \"number\"\n },\n {\n \"name\": \"groups_info\",\n \"conditions\": \"false\",\n \"type\": \"json\"\n },\n {\n \"name\": \"member\",\n \"conditions\": \"false\",\n \"type\": \"json\"\n }\n]", "Permissions": "{\"read\": \"true\", \"insert\": \"ContractAccess(\\\"@1GroupsAssign\\\")\", \"update\": \"ContractAccess(\\\"@1GroupsUnassign\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", "Type": "tables" }, { "Name": "tokens_refund", - "Columns": "[\n {\n \"conditions\":\"false\",\n \"name\":\"amount\",\n \"type\":\"money\"\n },\n {\n \"conditions\":\"ContractAccess(\\\"@1TokensRefundAccept\\\",\\\"@1TokensRefundReject\\\")\",\n \"name\":\"status\",\n \"type\":\"number\"\n },\n {\n \"conditions\":\"false\",\n \"name\":\"victim_key_id\",\n \"type\":\"number\"\n },\n {\n \"conditions\":\"false\",\n \"name\":\"attacker_key_id\",\n \"type\":\"number\"\n },\n {\n \"conditions\":\"false\",\n \"name\":\"validator_key_id\",\n \"type\":\"number\"\n },\n {\n \"conditions\":\"false\",\n \"name\":\"note\",\n \"type\":\"text\"\n },\n {\n \"conditions\":\"ContractAccess(\\\"@1TokensRefundAccept\\\",\\\"@1TokensRefundReject\\\")\",\n \"name\":\"result\",\n \"type\":\"number\"\n },\n {\n \"conditions\":\"ContractAccess(\\\"@1TokensRefundAccept\\\",\\\"@1TokensRefundReject\\\")\",\n \"name\":\"closed_at\",\n \"type\":\"number\"\n },\n {\n \"conditions\":\"false\",\n \"name\":\"blocked_at\",\n \"type\":\"number\"\n }\n]", + "Columns": "[\n {\n \"name\": \"amount\",\n \"conditions\": \"false\",\n \"type\": \"money\"\n },\n {\n \"name\": \"attacker_account\",\n \"conditions\": \"false\",\n \"type\": \"varchar\"\n },\n {\n \"name\": \"blocked_at\",\n \"conditions\": \"false\",\n \"type\": \"number\"\n },\n {\n \"name\": \"closed_at\",\n \"conditions\": \"ContractAccess(\\\"@1TokensRefundAccept\\\",\\\"@1TokensRefundReject\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"note\",\n \"conditions\": \"false\",\n \"type\": \"text\"\n },\n {\n \"name\": \"result\",\n \"conditions\": \"ContractAccess(\\\"@1TokensRefundAccept\\\",\\\"@1TokensRefundReject\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"status\",\n \"conditions\": \"ContractAccess(\\\"@1TokensRefundAccept\\\",\\\"@1TokensRefundReject\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"consortium_member_account\",\n \"conditions\": \"false\",\n \"type\": \"varchar\"\n },\n {\n \"name\": \"victim_account\",\n \"conditions\": \"false\",\n \"type\": \"varchar\"\n }\n]", "Permissions": "{\"insert\": \"ContractAccess(\\\"@1VotingRunTokenRefund\\\")\", \"update\": \"ContractAccess(\\\"@1TokensRefundAccept\\\",\\\"@1TokensRefundReject\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", "Type": "tables" }, - { - "Name": "validator_candidates", - "Columns": "[\n {\n \"conditions\":\"false\",\n \"name\":\"date_created\",\n \"type\":\"number\"\n },\n {\n \"conditions\":\"false\",\n \"name\":\"candidate_key_id\",\n \"type\":\"number\"\n },\n {\n \"conditions\":\"false\",\n \"name\":\"comment\",\n \"type\":\"text\"\n },\n {\n \"conditions\":\"ContractAccess(\\\"@1ValidatorDelete\\\")\",\n \"name\":\"deleted\",\n \"type\":\"number\"\n },\n {\n \"conditions\":\"false\",\n \"name\":\"tcp_address\",\n \"type\":\"text\"\n },\n {\n \"conditions\":\"false\",\n \"name\":\"api_address\",\n \"type\":\"text\"\n },\n {\n \"conditions\":\"false\",\n \"name\":\"pub_key\",\n \"type\":\"text\"\n },\n {\n \"conditions\":\"false\",\n \"name\":\"description\",\n \"type\":\"text\"\n }\n]", - "Permissions": "{\"insert\": \"ContractAccess(\\\"@1ValidatorRequest\\\")\", \"update\": \"ContractAccess(\\\"@1ValidatorDelete\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", - "Type": "tables" - }, { "Name": "voting_templates", - "Columns": "[\n {\n \"conditions\":\"false\",\n \"name\": \"voting\",\n \"type\": \"json\"\n },\n {\n \"conditions\":\"false\",\n \"name\": \"optional\",\n \"type\": \"json\"\n },\n {\n \"conditions\":\"false\",\n \"name\": \"subject\",\n \"type\": \"json\"\n },\n {\n \"conditions\":\"false\",\n \"name\":\"ecosystem\",\n \"type\":\"number\"\n }\n]", + "Columns": "[\n {\n \"name\": \"ecosystem\",\n \"conditions\": \"false\",\n \"type\": \"number\"\n },\n {\n \"name\": \"optional\",\n \"conditions\": \"false\",\n \"type\": \"json\"\n },\n {\n \"name\": \"subject\",\n \"conditions\": \"false\",\n \"type\": \"json\"\n },\n {\n \"name\": \"voting\",\n \"conditions\": \"false\",\n \"type\": \"json\"\n }\n]", "Permissions": "{\"insert\": \"ContractAccess(\\\"@1VotingTemplateCreate\\\",\\\"@1VotingTemplatesInstall\\\")\", \"update\": \"false\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", "Type": "tables" }, { "Name": "votings", - "Columns": "[\n {\n \"conditions\": \"ContractAccess(\\\"@1VotingInvite\\\")\",\n \"name\": \"voting\",\n \"type\": \"json\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1VotingSubjectCandidates\\\", \\\"@1VotingSubjectDocument\\\", \\\"@1VotingSubjectContract\\\", \\\"@1VotingSubjectSettings\\\")\",\n \"name\": \"optional\",\n \"type\": \"json\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1VotingUpdate\\\",\\\"@1VotingInvite\\\")\",\n \"name\": \"progress\",\n \"type\": \"json\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"date_ended\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1VotingDecisionCheck\\\", \\\"@1VotingNotificationSend\\\", \\\"@1VotingStatusUpdate\\\", \\\"@1VotingSubjectCheck\\\", \\\"@1VotingUpdate\\\")\",\n \"name\": \"flags\",\n \"type\": \"json\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1VotingStatusUpdate\\\",\\\"@1VotingUpdate\\\")\",\n \"name\": \"status\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"creator\",\n \"type\": \"json\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1VotingDelete\\\")\",\n \"name\": \"deleted\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"ecosystem\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"date_started\",\n \"type\": \"number\"\n }\n]", + "Columns": "[\n {\n \"name\": \"creator\",\n \"conditions\": \"false\",\n \"type\": \"json\"\n },\n {\n \"name\": \"date_ended\",\n \"conditions\": \"false\",\n \"type\": \"number\"\n },\n {\n \"name\": \"date_started\",\n \"conditions\": \"false\",\n \"type\": \"number\"\n },\n {\n \"name\": \"deleted\",\n \"conditions\": \"ContractAccess(\\\"@1VotingDelete\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"ecosystem\",\n \"conditions\": \"false\",\n \"type\": \"number\"\n },\n {\n \"name\": \"flags\",\n \"conditions\": \"ContractAccess(\\\"@1VotingDecisionCheck\\\", \\\"@1VotingNotificationSend\\\", \\\"@1VotingStatusUpdate\\\", \\\"@1VotingSubjectCheck\\\", \\\"@1VotingUpdate\\\")\",\n \"type\": \"json\"\n },\n {\n \"name\": \"optional\",\n \"conditions\": \"ContractAccess(\\\"@1VotingSubjectCandidates\\\", \\\"@1VotingSubjectDocument\\\", \\\"@1VotingSubjectContract\\\", \\\"@1VotingSubjectSettings\\\")\",\n \"type\": \"json\"\n },\n {\n \"name\": \"progress\",\n \"conditions\": \"ContractAccess(\\\"@1VotingUpdate\\\",\\\"@1VotingInvite\\\")\",\n \"type\": \"json\"\n },\n {\n \"name\": \"status\",\n \"conditions\": \"ContractAccess(\\\"@1VotingStatusUpdate\\\",\\\"@1VotingUpdate\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"voting\",\n \"conditions\": \"ContractAccess(\\\"@1VotingInvite\\\")\",\n \"type\": \"json\"\n }\n]", "Permissions": "{\"insert\": \"ContractAccess(\\\"@1VotingCreate\\\")\", \"update\": \"ContractAccess(\\\"@1VotingDecisionCheck\\\",\\\"@1VotingDelete\\\",\\\"@1VotingInvite\\\",\\\"@1VotingNotificationSend\\\",\\\"@1VotingStatusUpdate\\\",\\\"@1VotingSubjectCandidates\\\",\\\"@1VotingSubjectCheck\\\",\\\"@1VotingSubjectDocument\\\",\\\"@1VotingSubjectContract\\\",\\\"@1VotingSubjectSettings\\\",\\\"@1VotingUpdate\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", "Type": "tables" }, { "Name": "votings_participants", - "Columns": "[\n {\n \"conditions\": \"ContractAccess(\\\"@1VotingCandidateAccept\\\", \\\"@1VotingDecisionAccept\\\", \\\"@1VotingDecisionReject\\\")\",\n \"name\": \"member\",\n \"type\": \"json\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1VotingCandidateAccept\\\", \\\"@1VotingDecisionAccept\\\", \\\"@1VotingDecisionReject\\\")\",\n \"name\": \"decision\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"ecosystem\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"voting_id\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1VotingCandidateAccept\\\", \\\"@1VotingDecisionAccept\\\", \\\"@1VotingDecisionReject\\\")\",\n \"name\": \"decision_date\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1VotingStatusUpdate\\\")\",\n \"name\": \"rating\",\n \"type\": \"number\"\n }\n]", + "Columns": "[\n {\n \"name\": \"decision\",\n \"conditions\": \"ContractAccess(\\\"@1VotingCandidateAccept\\\", \\\"@1VotingDecisionAccept\\\", \\\"@1VotingDecisionReject\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"decision_date\",\n \"conditions\": \"ContractAccess(\\\"@1VotingCandidateAccept\\\", \\\"@1VotingDecisionAccept\\\", \\\"@1VotingDecisionReject\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"ecosystem\",\n \"conditions\": \"false\",\n \"type\": \"number\"\n },\n {\n \"name\": \"member\",\n \"conditions\": \"ContractAccess(\\\"@1VotingCandidateAccept\\\", \\\"@1VotingDecisionAccept\\\", \\\"@1VotingDecisionReject\\\")\",\n \"type\": \"json\"\n },\n {\n \"name\": \"rating\",\n \"conditions\": \"ContractAccess(\\\"@1VotingStatusUpdate\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"voting_id\",\n \"conditions\": \"false\",\n \"type\": \"number\"\n }\n]", "Permissions": "{\"insert\": \"ContractAccess(\\\"@1VotingInvite\\\")\", \"update\": \"ContractAccess(\\\"@1VotingDecisionReject\\\",\\\"@1VotingDecisionAccept\\\",\\\"@1VotingCandidateAccept\\\",\\\"@1VotingStatusUpdate\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", "Type": "tables" }, { "Name": "votings_subject", - "Columns": "[\n {\n \"conditions\": \"false\",\n \"name\": \"voting_id\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1VotingCandidateAccept\\\", \\\"@1VotingDecisionAccept\\\")\",\n \"name\": \"number_accept\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1VotingSubjectContract\\\", \\\"@1VotingSubjectDocument\\\")\",\n \"name\": \"subject\",\n \"type\": \"json\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"ecosystem\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1VotingCandidateAccept\\\", \\\"@1VotingDecisionAccept\\\", \\\"@1VotingDecisionReject\\\")\",\n \"name\": \"results\",\n \"type\": \"json\"\n }\n]", + "Columns": "[\n {\n \"name\": \"ecosystem\",\n \"conditions\": \"false\",\n \"type\": \"number\"\n },\n {\n \"name\": \"number_accept\",\n \"conditions\": \"ContractAccess(\\\"@1VotingCandidateAccept\\\", \\\"@1VotingDecisionAccept\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"results\",\n \"conditions\": \"ContractAccess(\\\"@1VotingCandidateAccept\\\", \\\"@1VotingDecisionAccept\\\", \\\"@1VotingDecisionReject\\\")\",\n \"type\": \"json\"\n },\n {\n \"name\": \"subject\",\n \"conditions\": \"ContractAccess(\\\"@1VotingSubjectContract\\\", \\\"@1VotingSubjectDocument\\\")\",\n \"type\": \"json\"\n },\n {\n \"name\": \"voting_id\",\n \"conditions\": \"false\",\n \"type\": \"number\"\n }\n]", "Permissions": "{\"insert\": \"ContractAccess(\\\"@1VotingSubjectCandidates\\\",\\\"@1VotingSubjectContract\\\",\\\"@1VotingSubjectDocument\\\")\", \"update\": \"ContractAccess(\\\"@1VotingCandidateAccept\\\",\\\"@1VotingDecisionAccept\\\",\\\"@1VotingDecisionReject\\\",\\\"@1VotingSubjectContract\\\",\\\"@1VotingSubjectDocument\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", "Type": "tables" }, @@ -230,6 +230,12 @@ "Value": "text-danger,text-warning,text-success,text-success", "Type": "app_params" }, + { + "Name": "voting_template_consortium_member", + "Conditions": "ContractConditions(\"@1DeveloperCondition\")", + "Value": "0", + "Type": "app_params" + }, { "Name": "voting_template_decision", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", @@ -255,42 +261,57 @@ "Type": "app_params" }, { - "Name": "voting_template_validators", + "Name": "voting_template_ves", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", "Value": "0", "Type": "app_params" }, { - "Name": "voting_template_ves", + "Name": "consortium_member_candidates", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "0", - "Type": "app_params" + "Value": "SetVar(this_page, @1consortium_member_candidates).(this_table, @1consortium_member_requests)\nInclude(@1pager_header)\n\nSetTitle(\"$@1consortium_member_candidates$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1consortium_member_candidates_list_desc$\"))\nAddToolButton(Title: $@1create_request$, Icon: icon-plus, Page: @1consortium_member_request).Popup(50, $@1consortium_member_request_form$)\n\nIf(#search#){\n SetVar(where, {\"host_ip\": {\"$ilike\": \"#search#\"}, \"deleted\": 0})\n}.Else{\n SetVar(where, {\"deleted\": 0})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1host_ip))\n Include(@1search)\n}\n\nDBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\nSetVar(template_id, AppParam(Ecosystem: 1, App: #application_id#, Name: voting_template_consortium_member))\nIf(#template_id# > 0){\n DBFind(\"@1voting_templates\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#template_id#\"}).Columns(\"subject->voters\").Vars(template)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_actions){\n If(And(#template_subject_voters# > 0, #template_subject_voters# == #role_id#)){\n Form(btn-group pull-right){\n Button(Contract: @1VotingRunNewConsortiumMember, Params: \"ConsortiumMemberId=#id#\", Page: @1voting_list, Class: btn btn-default fa fa-play)\n }\n }.Else{\n If(#template_id# > 0){\n Span($@1voting_not_participant$, text-muted)\n }.Else{\n Span($@1voting_template_not_found$, text-muted)\n }\n }\n}.Custom(_date){\n DateTime(DateTime: #date_created#, Format: YYYY-MM-DD HH:MI)\n}.Custom(_tcp_address){\n Span(Class: h6, Body: #tcp_address#)\n}.Custom(_api_address){\n Span(Class: h6, Body: #api_address#)\n}.Custom(_description){\n Span(Class: h6, Body: #description#)\n}.Custom(_comment){\n Span(Class: h6, Body: #comment#)\n}.Custom(custom_username){\n SetVar(user_member_name,)\n DBFind(\"@1members\").Where({\"account\": \"#candidate_account#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(user)\n If(#user_member_name# == \"\"){\n SetVar(user_member_name, #candidate_account#)\n }\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#candidate_account#\"){\n If(#user_image_id#>0){\n Image(Src: Binary().ById(#user_image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(#user_member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right: 10px;)\n Span(#user_member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1name$=custom_username,$@1api_address$=_api_address,$@1tcp_address$=_tcp_address,$@1hardware_description$=_description,$@1comment$=_comment,$@1date_created$=_date,$@1voting$=_actions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1consortium_member_candidates$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Menu": "admin_menu", + "Type": "pages" + }, + { + "Name": "consortium_member_request", + "Conditions": "ContractConditions(\"@1DeveloperCondition\")", + "Value": "Form(){\n Div(row){\n Div(col-md-4 mt-sm text-right){\n Label(LangRes(@1tcp_address))\n Span(Class: text-danger, Body:*)\n }\n Div(col-md-8 text-left){\n Input(Name: TcpAddress, Placeholder: \"xxx.xxx.xxx.xxx:port\")\n }\n }\n Div(row mt-sm){\n Div(col-md-4 mt-sm text-right){\n Label(LangRes(@1api_address))\n Span(Class: text-danger, Body:*)\n }\n Div(col-md-8 text-left){\n Input(Name: ApiAddress, Placeholder: \"protocol://xxx.xxx.xxx.xxx:port\")\n }\n }\n Div(row mt-sm){\n Div(col-md-4 mt-sm text-right){\n Label(LangRes(@1node_founder_account))\n Span(Class: text-danger, Body:*)\n }\n Div(col-md-8 text-left){\n Input(Name: CandidateAccount, Disabled: true, Value: #account_id#)\n Div(Class: m0 h6 text-muted, Body: LangRes(@1node_founder_key_id): AddressToId(#account_id#))\n }\n }\n Div(row mt-sm){\n Div(col-md-4 mt-sm text-right){\n Label(LangRes(@1node_pub_key))\n Span(Class: text-danger, Body:*)\n }\n Div(col-md-8 text-left){\n Input(Name: PubKey, Type: textarea).Style(resize:vertical)\n }\n }\n Div(row mt-sm){\n Div(col-md-4 mt-sm text-right){\n Label(LangRes(@1hardware_description))\n }\n Div(col-md-8 text-left){\n Input(Name: Description, Type: textarea).Style(resize:vertical)\n }\n }\n Div(row mt-sm){\n Div(col-md-4 mt-sm text-right){\n Label(LangRes(@1comment))\n }\n Div(col-md-8 text-left){\n Input(Name: Comment, Type: textarea).Style(resize:vertical)\n }\n }\n\n Button(Contract: @1ConsortiumMemberRequest, Class: btn btn-primary pull-right mt, Page: @1consortium_member_candidates, Body: $@1send_request$)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1consortium_member_candidates)\n}", + "Menu": "admin_menu", + "Type": "pages" + }, + { + "Name": "consortium_member_resign", + "Conditions": "ContractConditions(\"@1DeveloperCondition\")", + "Value": "Form(){\n Div(row){\n Div(col-sm-12 text-center h4){\n $@1consortium_member_removing_desc$\n }\n }\n DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(system_app)\n SetVar(role_consortium_member, AppParam(App: #system_app_id#, Name: \"role_consortium_member\"))\n DBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"member->account\": \"#account_id#\", \"role->id\": \"#role_consortium_member#\", \"deleted\": 0}).Columns(\"id\").Vars(consortium_member)\n If(#consortium_member_id# > 0){\n Button(Body: $@1resign$, Class: btn btn-danger pull-right mt-lg, Page: @1sysparams_list, Contract: @1ConsortiumMemberResign).Alert(Text: \"$@1want_resign$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n Button(Body: $@1back$, Class: btn btn-default pull-right mt-lg, Page: @1sysparams_list)\n}", + "Menu": "admin_menu", + "Type": "pages" }, { "Name": "contract_bind_request", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Div(content-wrapper){\n DBFind(@1notifications).Where({\"id\": #notific_id#, \"ecosystem\": #ecosystem_id#}).Columns(\"sender->image_id,sender->member_id,sender->member_name,closed,page_params->contract_id,page_params->contract_name\").Vars(notific)\n\n Div(row){\n Div(col-sm-8 col-sm-offset-2 col-lg-6 col-lg-offset-3){\n Form(panel panel-default){\n Div(panel-heading text-center){\n Span(Class: h3, Body: $@1request_contract_binding$)\n }\n Div(panel-body){\n Div(list-group-item text-center){\n Div(text-muted m0 h5, Body: LangRes(@1contract_binding_des))\n Span(Class: h5 text-bold, Body: LangRes(@1contract) - #notific_page_params_contract_name#)\n }\n If(#notific_closed# == 0){\n Div(row){\n Div(col-md-12 mt-lg text-center){\n Button(Class: btn btn-danger mr-lg, Body: LangRes(@1request_reject), Contract: NotificationsClose, Page: notifications_list, Params: \"NotificId=#notific_id#\").Alert(Text: $@1want_reject_request$, ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n Button(Class: btn btn-success, Body: LangRes(@1contract_binding_accept), Contract: @1BindWallet, Page: notifications_list, Params: \"Id=#notific_page_params_contract_id#,NotificId=#notific_id#\").Alert(Text: $@1want_bind_contract$, ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n }\n }\n }\n }\n }\n}", + "Value": "Div(content-wrapper){\n DBFind(\"@1notifications\").Where({\"id\": \"#notific_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Columns(\"closed,page_params->contract_id\").Vars(notific)\n\n Div(row){\n Div(col-sm-8 col-sm-offset-2 col-lg-6 col-lg-offset-3){\n Form(panel panel-default){\n Div(panel-heading text-center){\n Span(Class: h3, Body: $@1request_contract_binding$)\n }\n Div(panel-body){\n Div(list-group-item text-center){\n Div(text-muted m0 h5, Body: LangRes(@1contract_binding_des))\n Span(Class: h5 text-bold, Body: LangRes(@1contract) - #notific_page_params_contract_name#)\n }\n If(#notific_closed# == 0){\n Div(row){\n Div(col-md-12 mt-lg text-center){\n Button(Class: btn btn-danger mr-lg, Body: LangRes(@1request_reject), Contract: NotificationsClose, Page: notifications_list, Params: \"NotificId=#notific_id#\").Alert(Text: $@1want_reject_request$, ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n Button(Class: btn btn-success, Body: LangRes(@1contract_binding_accept), Contract: @1BindWallet, Page: notifications_list, Params: \"Id=#notific_page_params_contract_id#\").Alert(Text: $@1want_bind_contract$, ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n }\n }\n }\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "default_page", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "If(#key_id#==#guest_key#){\n Include(@1apps_description)\n}.Else{\n Include(@1profile)\n}", + "Value": "If(#account_id# == #guest_account#){\n Include(@1apps_description)\n}.Else{\n Include(@1profile)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "ecosystem_add_members", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Form(){\n Label(Public Key)\n P(Class: text-muted h6 m0, Body: \"$@1keys_must_be_separated$\")\n Input(Name: Keys, Type: textarea)\n Button(Contract: @1MembershipAdd, Class: btn btn-primary pull-right mt, Page:@1members_list, Body: $@1members_add$)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1members_list)\n}", + "Value": "Form(){\n Label(Public Key)\n P(Class: text-muted h6 m0, Body: \"$@1keys_must_be_separated$\")\n Input(Name: Keys, Type: textarea)\n Button(Contract: @1MembershipAdd, Class: btn btn-primary pull-right mt, Page: @1members_list, Body: $@1members_add$)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1members_list)\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "ecosystems_list", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1ecosystems_list).(this_table, @1ecosystems)\nInclude(@1pager_header)\n\nSetTitle(\"$@1ecosystems$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1ecosystems_list_desc$\"))\nAddToolButton(Title: $@1update_metrics$, Page: @1ecosystems_metrics_update, Icon: icon-refresh).Popup(Header: $@1update_metrics$, Width: \"30\")\n\nIf(#search#){\n SetVar(w_search, {\"name\": {\"$ilike\": \"#search#\"}})\n}\nSetVar(where, {#w_search#})\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1ecosystem_name))\n Include(@1search)\n}\n\nDBFind(@1buffer_data).Where({\"ecosystem\": #ecosystem_id#, \"member_id\": #key_id#, \"key\": \"metrics\"}).Vars(m)\nJsonToSource(src_metrics,#m_value#)\n\nDBFind(@1applications).Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\nSetVar(template_id, AppParam(Ecosystem:1, App:#application_id#, Name: voting_template_ves))\nIf(#template_id# > 0){\n DBFind(@1voting_templates).Where({\"ecosystem\": #ecosystem_id#, \"id\": #template_id#}).Columns(\"subject->voters\").Vars(template)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_id){\n Span(#id#)\n}.Custom(_name){\n Span(#name#)\n}.Custom(_metrics){\n If(#m_id#>0){\n SetVar(eco_id,#id#)\n ForList(src_metrics){\n If(#key#==#eco_id#){\n LinkPage(Body: `#value#`, Page: @1sysparams_metrics, PageParams:\"Id=#key#\")\n }\n }\n }\n}.Custom(valued){\n If(#is_valued# == 0){\n If(And(#template_subject_voters#>0,#template_subject_voters#==#role_id#)){\n Button(Body: $@1start_voting_ves$, Class: btn-xs btn-link, Page: @1voting_list, Contract: @1VotingRunVes, Params: \"EcosystemId=#id#\")\n }.Else{\n If(#template_id# > 0){\n Span($@1voting_not_participant$, text-muted)\n }.Else{\n Span($@1voting_template_not_found$, text-muted)\n }\n } \n }.ElseIf(#is_valued#==1){\n $@1is_valued$\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1id$=_id,$@1ecosystem_name$=_name,$@1metrics$=_metrics,$@1valued$=valued\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1ecosystems$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, @1ecosystems_list).(this_table, @1ecosystems)\nInclude(@1pager_header)\n\nSetTitle(\"$@1ecosystems$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1ecosystems_list_desc$\"))\nAddToolButton(Title: $@1update_metrics$, Page: @1ecosystems_metrics_update, Icon: icon-refresh).Popup(Header: $@1update_metrics$, Width: \"30\")\n\nIf(#search#){\n SetVar(where, {\"name\": {\"$ilike\": \"#search#\"}})\n}.Else{\n SetVar(where, {})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1ecosystem_name))\n Include(@1search)\n}\n\nDBFind(\"@1buffer_data\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#account_id#\", \"key\": \"metrics\"}).Vars(m)\nJsonToSource(src_metrics,#m_value#)\n\nDBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\nSetVar(template_id, AppParam(Ecosystem:1, App:#application_id#, Name: voting_template_ves))\nIf(#template_id# > 0){\n DBFind(\"@1voting_templates\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#template_id#\"}).Columns(\"subject->voters\").Vars(template)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_id){\n Span(#id#)\n}.Custom(_name){\n Span(#name#)\n}.Custom(_metrics){\n If(#m_id#>0){\n SetVar(eco_id, #id#)\n ForList(src_metrics){\n If(#key# == #eco_id#){\n LinkPage(Body: #value#, Page: @1sysparams_metrics, PageParams: \"Id=#key#\")\n }\n }\n }\n}.Custom(valued){\n If(#is_valued# == 0){\n If(And(#template_subject_voters# > 0, #template_subject_voters# == #role_id#)){\n Button(Body: $@1start_voting_ves$, Class: btn-xs btn-link, Page: @1voting_list, Contract: @1VotingRunVes, Params: \"EcosystemId=#id#\")\n }.Else{\n If(#template_id# > 0){\n Span($@1voting_not_participant$, text-muted)\n }.Else{\n Span($@1voting_template_not_found$, text-muted)\n }\n } \n }.ElseIf(#is_valued#==1){\n $@1is_valued$\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1id$=_id,$@1ecosystem_name$=_name,$@1metrics$=_metrics,$@1valued$=valued\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1ecosystems$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", "Menu": "admin_menu", "Type": "pages" }, @@ -311,98 +332,98 @@ { "Name": "groups_assign", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1applications).Columns(\"name,id\").Where({\"name\": \"Basic\", \"ecosystem\": 1}).Vars(application)\n\nIf(#Id#!=\"\"){\n SetVar(v_group_id, #Id#)\n}\n\nIf(#v_group_id#>0){\n DBFind(@1groups, src_groups).Where({\"ecosystem\": #ecosystem_id#, \"id\": #v_group_id#}).Columns(\"id,group_name,group_type,group_access,creator->member_id,deleted\").Vars(prefix)\n If(#prefix_creator_member_id#==#key_id#){\n SetVar(manager_id, 1)\n }.ElseIf(And(#prefix_group_access#!=\"NULL\",#prefix_group_access#!=\"\",#prefix_group_access#!=\"[]\",#prefix_deleted#==0)){\n DBFind(@1roles_participants).Where({\"ecosystem\": #ecosystem_id#, \"id\": {\"$in\": #prefix_group_access#}}).Columns(\"id\").Vars(manager)\n }\n\n Form(){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1group)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Type: hidden, Name: GroupId, Value: #prefix_id#)\n SetVar(Name: var_prefix_group_name, Value: LangRes(#prefix_group_name#))\n Input(Name: input_prefix_group_name, Value: #var_prefix_group_name#, Disabled: 1)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1type)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n SetVar(Name: var_prefix_group_type, Value: AppParam(Ecosystem:1, App:#application_id#, Name: groups_types, Index: #prefix_group_type#))\n Input(Name: input_prefix_group_type, Value: #var_prefix_group_type#, Disabled: 1)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1member)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n If(#MemberId# == \"\"){\n SetVar(MemberId, 0)\n }\n Input(Name: member_id, Type:hidden, Value: #MemberId#)\n Div(input-group){\n If(Or(#MemberId#>0,#MemberId#<0)){\n SetVar(AddressMemberId, Address(#MemberId#))\n }\n Input(Name: m_name, Disabled: 1, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\", Value: #AddressMemberId#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:\"back_page=@1groups_assign,back_header=$@1assign$,Id=#v_group_id#,EcosystemId=#ecosystem_id#\").Popup(Header: $@1member$, Width: \"50\")\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n )\n }\n }\n }\n If(#manager_id#>0){\n Button(Body: LangRes(@1assign), Class: btn btn-primary pull-right mt, Page: @1groups_view, PageParams: \"v_group_id=#v_group_id#\", Contract: @1GroupsAssign, Params: \"MemberId=Val(member_id)\").Alert(Text: \"$@1want_assign_member_to_role$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1groups_view, PageParams: \"v_group_id=#v_group_id#\")\n }\n}.Else{\n Div(md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n}", + "Value": "DBFind(\"@1applications\").Columns(\"name,id\").Where({\"name\": \"Basic\", \"ecosystem\": 1}).Vars(application)\n\nIf(#Id#!=\"\"){\n SetVar(v_group_id, #Id#)\n}\n\nIf(#v_group_id#>0){\n DBFind(\"@1groups\", src_groups).Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#v_group_id#\"}).Columns(\"id,group_name,group_type,group_access,creator->account,deleted\").Vars(prefix)\n If(#prefix_creator_account#==#account_id#){\n SetVar(manager_id, 1)\n }.ElseIf(And(#prefix_group_access#!=\"NULL\",#prefix_group_access#!=\"\",#prefix_group_access#!=\"[]\",#prefix_deleted#==0)){\n DBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": {\"$in\": #prefix_group_access#}}).Columns(\"id\").Vars(manager)\n }\n\n Form(){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1group)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Type: hidden, Name: GroupId, Value: #prefix_id#)\n SetVar(Name: var_prefix_group_name, Value: LangRes(#prefix_group_name#))\n Input(Name: input_prefix_group_name, Value: #var_prefix_group_name#, Disabled: 1)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1type)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n SetVar(Name: var_prefix_group_type, Value: AppParam(Ecosystem:1, App:#application_id#, Name: groups_types, Index: #prefix_group_type#))\n Input(Name: input_prefix_group_type, Value: #var_prefix_group_type#, Disabled: 1)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1member)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Div(input-group){\n If(#MemberAccount#){\n Input(Name: account, Type: hidden, Value: #MemberAccount#)\n Input(Name: m_name, Disabled: 1, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\", Value: #MemberAccount#)\n }.Else{\n Input(Name: account, Type: hidden, Value: 0)\n Input(Name: m_name, Disabled: 1, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\")\n }\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:\"back_page=@1groups_assign,back_header=$@1assign$,Id=#v_group_id#,EcosystemId=#ecosystem_id#\").Popup(Header: $@1member$, Width: \"50\")\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n )\n }\n }\n }\n If(#manager_id#>0){\n Button(Body: LangRes(@1assign), Class: btn btn-primary pull-right mt, Page: @1groups_view, PageParams: \"v_group_id=#v_group_id#\", Contract: @1GroupsAssign, Params: \"MemberAccount=Val(account)\").Alert(Text: \"$@1want_assign_member_to_role$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1groups_view, PageParams: \"v_group_id=#v_group_id#\")\n }\n}.Else{\n Div(md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "groups_create", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1applications).Columns(\"name,id\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Vars(application)\nDBFind(@1roles, src_roles).Columns(\"id,role_name\").Where({\"ecosystem\": #ecosystem_id#, \"deleted\": 0}).Order(id)\nIf(#back_page#==\"\"){\n SetVar(back_page, \"@1groups_list\")\n}\n\nIf(#GroupId#==\"\"){\n SetVar(title, $@1new_group$)\n DBFind(@1buffer_data).Columns(value).Where({\"ecosystem\": #ecosystem_id#, \"key\": \"group_access\", \"member_id\": #key_id#}).Columns(\"id,key,member_id,ecosystem,value->groups_access,value->group_information,value->group_type,value->group_name\").Vars(buffer)\n AppParam(Source: type_group, Ecosystem: 1, App: #application_id#, Name: groups_types)\n If(And(#buffer_value_groups_access#!=\"NULL\",#buffer_value_groups_access#!=\"\",#buffer_value_groups_access#!=\"[]\")){\n DBFind(@1roles, src_roles_access).Where({\"ecosystem\": #ecosystem_id#, \"id\": {\"$in\": #buffer_value_groups_access#}}).Columns(\"id,role_name\").Count(ra_count).Order(\"role_name\")\n }\n}.Else{\n SetVar(title, $@1edit_group$)\n DBFind(@1groups).Where({\"ecosystem\": #ecosystem_id#, \"id\": #GroupId#}).Columns(\"id,group_name,group_type,group_info,group_access\").Vars(gr_e)\n SetVar(type_group, AppParam(Ecosystem: 1, App: #application_id#, Name: groups_types, Index: #gr_e_group_type#))\n If(And(#gr_e_group_access#!=\"NULL\",#gr_e_group_access#!=\"\",#gr_e_group_access#!=\"[]\")){\n DBFind(@1roles, src_roles_access).Where({\"ecosystem\": #ecosystem_id#, \"id\": {\"$in\": #gr_e_group_access#}}).Columns(\"id,role_name\").Count(ra_count).Order(\"role_name\")\n }\n}\n\nForm(){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1name)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n If(#GroupId#==\"\"){\n Input(Name: GroupName, Value: #buffer_value_group_name#).Validate(minLength:3, maxLength:30)\n InputErr(Name: GroupName, minLength: $@1validate_role_name$, maxLength: $@1validate_role_name$)\n }.Else{\n Input(Name: eGroupName, Value: #gr_e_group_name#, Disabled: 1)\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1type)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n If(#GroupId#==\"\"){\n Select(Name: GroupType, Source: type_group, NameColumn: name, ValueColumn: id, Value: #buffer_value_group_type#)\n }.Else{\n Input(Name: eGroupType, Value: #type_group#, Disabled: 1)\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt text-right){\n Label(){\n LangRes(@1group_info)\n }\n }\n Div(col-md-9 text-left){\n If(#GroupId#==\"\"){\n Input(Name: GroupInfo, Type: textarea, Value: #buffer_value_group_information#)\n }.Else{\n Input(Name: GroupInfo, Type: textarea, Value: #gr_e_group_info#)\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1group_access)\n }\n }\n Div(col-md-9 text-left){\n Div(input-group mb-sm){\n Select(Name: roles_managers, Source: src_roles, NameColumn: role_name, ValueColumn: id)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-plus mtl buttons, Page: @1groups_create, Contract: @1GroupAccessManager, Params: \"ManagerRid=Val(roles_managers),Action=add,GroupId=#GroupId#\", PageParams: \"GroupId=#GroupId#\").Popup(50, #title#)\n }\n }\n If(#ra_count#>0){\n ForList(src_roles_access){\n SetVar(btn_class, \"bg-gray-lighter\")\n If(#id#==#role_id#){\n SetVar(btn_class, \"bg-primary\")\n }\n Button(Class: btn-xs #btn_class# mr-sm mb-sm, Page: @1groups_create, Contract: @1GroupAccessManager, Params: \"ManagerRid=#id#,Action=remove,GroupId=#GroupId#\", PageParams: \"GroupId=#GroupId#\", Body: Span(Class: fa fa-remove) #role_name#).Popup(50, #title#)\n }\n }\n }\n }\n If(#GroupId#==\"\"){\n Button(Body: LangRes(@1create), Class: btn btn-primary pull-right mt, Page: #back_page#, Contract: @1GroupsCreate)\n }.Else{\n Button(Body: LangRes(@1edit), Class: btn btn-primary pull-right mt, Page: #back_page#, Contract: @1GroupsCreate, Params:\"GroupId=#GroupId#\")\n }\n Button(Body: LangRes(@1back), Class: btn bg-gray-lighter pull-right mt, Page: #back_page#)\n}.Style(\n .buttons{border: 1px solid #dde6e9;}\n)\n", + "Value": "DBFind(\"@1applications\").Columns(\"name,id\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Vars(application)\nDBFind(\"@1roles\", src_roles).Columns(\"id,role_name\").Where({\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0}).Order(\"id\")\nIf(#back_page#==\"\"){\n SetVar(back_page, \"@1groups_list\")\n}\n\nIf(#GroupId#==\"\"){\n SetVar(title, $@1new_group$)\n DBFind(\"@1buffer_data\").Columns(value).Where({\"ecosystem\": \"#ecosystem_id#\", \"key\": \"group_access\", \"account\": \"#account_id#\"}).Columns(\"id,key,account,ecosystem,value->groups_access,value->group_information,value->group_type,value->group_name\").Vars(buffer)\n AppParam(Source: type_group, Ecosystem: 1, App: #application_id#, Name: groups_types)\n If(And(#buffer_value_groups_access#!=\"NULL\",#buffer_value_groups_access#!=\"\",#buffer_value_groups_access#!=\"[]\")){\n DBFind(\"@1roles\", src_roles_access).Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": {\"$in\": #buffer_value_groups_access#}}).Columns(\"id,role_name\").Count(ra_count).Order(\"role_name\")\n }\n}.Else{\n SetVar(title, $@1edit_group$)\n DBFind(\"@1groups\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#GroupId#\"}).Columns(\"id,group_name,group_type,group_info,group_access\").Vars(gr_e)\n SetVar(type_group, AppParam(Ecosystem: 1, App: #application_id#, Name: groups_types, Index: #gr_e_group_type#))\n If(And(#gr_e_group_access#!=\"NULL\",#gr_e_group_access#!=\"\",#gr_e_group_access#!=\"[]\")){\n DBFind(\"@1roles\", src_roles_access).Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": {\"$in\": #gr_e_group_access#}}).Columns(\"id,role_name\").Count(ra_count).Order(\"role_name\")\n }\n}\n\nForm(){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1name)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n If(#GroupId#==\"\"){\n Input(Name: GroupName, Value: #buffer_value_group_name#).Validate(minLength:3, maxLength:30)\n InputErr(Name: GroupName, minLength: $@1validate_role_name$, maxLength: $@1validate_role_name$)\n }.Else{\n Input(Name: eGroupName, Value: #gr_e_group_name#, Disabled: 1)\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1type)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n If(#GroupId#==\"\"){\n Select(Name: GroupType, Source: type_group, NameColumn: name, ValueColumn: id, Value: #buffer_value_group_type#)\n }.Else{\n Input(Name: eGroupType, Value: #type_group#, Disabled: 1)\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt text-right){\n Label(){\n LangRes(@1group_info)\n }\n }\n Div(col-md-9 text-left){\n If(#GroupId#==\"\"){\n Input(Name: GroupInfo, Type: textarea, Value: #buffer_value_group_information#)\n }.Else{\n Input(Name: GroupInfo, Type: textarea, Value: #gr_e_group_info#)\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1group_access)\n }\n }\n Div(col-md-9 text-left){\n Div(input-group mb-sm){\n Select(Name: roles_managers, Source: src_roles, NameColumn: role_name, ValueColumn: id)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-plus mtl buttons, Page: @1groups_create, Contract: @1GroupAccessManager, Params: \"ManagerRid=Val(roles_managers),Action=add,GroupId=#GroupId#\", PageParams: \"GroupId=#GroupId#\").Popup(50, #title#)\n }\n }\n If(#ra_count#>0){\n ForList(src_roles_access){\n SetVar(btn_class, \"bg-gray-lighter\")\n If(#id#==#role_id#){\n SetVar(btn_class, \"bg-primary\")\n }\n Button(Class: btn-xs #btn_class# mr-sm mb-sm, Page: @1groups_create, Contract: @1GroupAccessManager, Params: \"ManagerRid=#id#,Action=remove,GroupId=#GroupId#\", PageParams: \"GroupId=#GroupId#\", Body: Span(Class: fa fa-remove) #role_name#).Popup(50, #title#)\n }\n }\n }\n }\n If(#GroupId#==\"\"){\n Button(Body: LangRes(@1create), Class: btn btn-primary pull-right mt, Page: #back_page#, Contract: @1GroupsCreate)\n }.Else{\n Button(Body: LangRes(@1edit), Class: btn btn-primary pull-right mt, Page: #back_page#, Contract: @1GroupsCreate, Params:\"GroupId=#GroupId#\")\n }\n Button(Body: LangRes(@1back), Class: btn bg-gray-lighter pull-right mt, Page: #back_page#)\n}.Style(\n .buttons{border: 1px solid #dde6e9;}\n)\n", "Menu": "admin_menu", "Type": "pages" }, { "Name": "groups_list", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1groups_list).(this_table, @1groups)\nInclude(@1pager_header)\n\nSetTitle($@1groups$)\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: $@1group_desc$))\nAddToolButton(Page: @1groups_create, Icon: icon-plus, Title: $@1create$).Popup(50, $@1new_group$)\n\nIf(#search#){\n SetVar(w_search, {\"group_name\": {\"$ilike\": \"#search#\"}})\n}\nSetVar(where, {\"ecosystem\": #ecosystem_id#, {#w_search#}})\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, $@1groups$)\n Include(@1search)\n}\nDBFind(@1applications).Columns(\"id,name\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Vars(application)\n\nDBFind(#this_table#, src_groups).Where(#where#).Order({\"deleted\": \"1\", \"id\": \"1\"}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,group_name,image_id,creator->member_id,creator->member_name,date_created,date_deleted,deleted,group_access,group_info,group_type\").Custom(_id){\n If(#deleted# == 0){\n SetVar(style_text, \"text-normal\").(style_link, \"text-primary\")\n }.Else{\n SetVar(style_text, \"text-muted\").(style_link, \"text-muted\")\n }\n Span(Class: #style_text#, Body: #id#)\n}.Custom(_creator){\n If(And(#creator.member_name# != NULL, #creator.member_name# != \"\")){\n LinkPage(Class: #style_link# text-bold, Page: @1profile_view, PageParams: \"v_key_id=#creator.member_id#\"){\n #creator.member_name#\n }\n }\n}.Custom(_name){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1groups_view, PageParams: \"v_group_id=#id#\"){\n If(#image_id# > 0){\n Image(Src: Binary().ById(#image_id#), Class: mr-sm).Style(width: 30px; border: 1px solid #5A5D63;)\n #group_name#\n }.Else{\n Div(Class: #style_link#){\n Span(Class: fa icon-settings fa-2x mr-sm)\n }.Style(\n display: inline-block;\n )\n Span(Class: btn-link text-bold pb-sm){\n Span(Class: #style_link#, Body: #group_name#)\n }.Style(\n display: inline-block;\n vertical-align: top;\n padding-top: 7px;\n padding-left: 4px;\n )\n }\n }\n}.Custom(_date){\n Div(#style_text# small){\n Div(text-nowrap){DateTime(DateTime: #date_created#, Format: \"DD.MM.YYYY HH:MI\")}\n If(#deleted# == 1){\n Div(text-nowrap){DateTime(DateTime: #date_deleted#, Format: \"DD.MM.YYYY HH:MI\")}\n }\n }\n}.Custom(_status){\n Span(Class: #style_text#){\n If(#deleted# == 0){\n LangRes(@1active)\n }.Else{\n LangRes(@1deleted)\n }\n }\n}.Custom(_access){\n If(#creator.member_id# == #key_id#){\n SetVar(access,done)\n }.Else{\n SetVar(access,)\n }\n If(And(#group_access#!=\"NULL\",#group_access# != \"\",#group_access#!=[])){\n DBFind(@1roles,src_access_list).Where({\"id\": {\"$in\": #group_access#}}).Columns(\"id,role_name\").Count(access_count).Order(role_name)\n Div(#style_text# breaker){\n ForList(src_access_list){\n If(#role_id# == #id#){\n SetVar(access,done)\n }\n If(#access_count# != #src_access_list_index#){\n Span(\"#role_name#,\",mr-sm)\n }.Else{\n #role_name#\n }\n }\n }\n }\n}.Custom(_actions){\n Div(text-right button-group text-nowrap){\n If(#access# == done){\n If(#deleted# == 0){\n Button(Class: btn bg-gray-lighter, Contract: @1GroupsDelete, Params: \"Ops=D,GroupId=#id#\", Page: @1groups_list){\n Em(Class: text-danger fa fa-1x fa-trash)\n }.Alert(Text: \"$@1sure_want_delete$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n Button(Class: btn bg-gray-lighter mh-sm, PageParams: \"GroupId=#id#\", Page: @1groups_create){\n Em(Class: text-default fa fa-1x fa-edit)\n }.Popup(50, $@1edit_group$)\n }.ElseIf(#deleted# == 1){\n Button(Class: btn bg-gray-lighter mh-sm, Contract: @1GroupsDelete, Params: \"Ops=R,GroupId=#id#\", Page: @1groups_list){\n Em(Class: text-info fa fa-1x fa-recycle)\n }\n }\n }\n }\n}.Custom(type_group){\n If(#deleted# == 0){\n Span(Body: AppParam(Ecosystem:1, App: #application_id#, Name: groups_types, Index:#group_type#))\n }.Else{\n Span(Body: AppParam(Ecosystem:1, App: #application_id#, Name: groups_types, Index:#group_type#), Class: text-muted)\n }\n}.Custom(join_group){\n If(#deleted# == 0){\n DBFind(\"@1groups_participants\").Columns(\"id,groups_info,groups_info->id,deleted,member,member->member_id\").Where({\"groups_info->id\": #id#, \"deleted\": 0, \"member->member_id\": #key_id#}).Vars(j_l).Count(check_membership)\n If(And(#group_type# == 1, #check_membership# == 0)){\n Button(Body: $@1join_the_group$, Class: btn btn-link pull-right, Contract: @1GroupsAssign, Page: @1groups_view, PageParams: \"v_group_id=#id#\", Params: \"GroupId=#id#,MemberId=#key_id#\")\n }.ElseIf(And(#group_type# == 1,#check_membership# == 1)){\n Button(Body: $@1leave_the_group$, Class: btn btn-link pull-right, Contract: @1GroupsUnassign, Page: @1groups_list, Params:\"RowId=#j_l_id#\")\n }.ElseIf(And(#group_type# == 2,#check_membership# == 0)){\n Button(Body: $@1send_request$, Class: btn btn-link pull-right, Contract: @1GroupRequestMembership, Page: @1groups_view, PageParams:\"v_group_id=#id#\", Params: \"GroupId=#id#\")\n }\n }\n}.Custom(gr_info){\n If(#deleted# == 0){\n Span(Body: #group_info#)\n }.Else{\n Span(Body: #group_info#, Class: text-muted)\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src_groups, \"$@1group$=_name,$@1type$=type_group,$@1id$=_id,$@1group_info$=gr_info,$@1creator$=_creator,$@1role_created_deleted$=_date,$@1status$=_status,$@1access$=_access,=join_group,=_actions\")\n }.ElseIf(#all_roles_count# > 0){\n Div(Class: text-center h4 text-muted){\n Div(Class: text-center h4 text-muted, Body: \"$@1groups$ $@1not_founded$\")\n }\n }.Else{\n Div(Class: text-center){\n Div(Class: text-center h4 text-muted, Body: \"$@1groups$ $@1not_founded$\")\n }\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, @1groups_list).(this_table, @1groups)\nInclude(@1pager_header)\n\nSetTitle($@1groups$)\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: $@1group_desc$))\nAddToolButton(Page: @1groups_create, Icon: icon-plus, Title: $@1create$).Popup(50, $@1new_group$)\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"group_name\": {\"$ilike\": \"#search#\"}})\n}.Else{\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\"})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, $@1groups$)\n Include(@1search)\n}\nDBFind(\"@1applications\").Columns(\"id,name\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Vars(application)\n\nDBFind(#this_table#, src_groups).Where(#where#).Order({\"deleted\": 1, \"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,group_name,image_id,creator->account,creator->member_name,date_created,date_deleted,deleted,group_access,group_info,group_type\").Custom(_id){\n If(#deleted# == 0){\n SetVar(style_text, \"text-normal\").(style_link, \"text-primary\")\n }.Else{\n SetVar(style_text, \"text-muted\").(style_link, \"text-muted\")\n }\n Span(Class: #style_text#, Body: #id#)\n}.Custom(_creator){\n If(And(#creator.member_name# != NULL, #creator.member_name# != \"\")){\n LinkPage(Class: #style_link# text-bold, Page: @1profile_view, PageParams: \"v_account=#creator.account#\"){\n #creator.member_name#\n }\n }\n}.Custom(_name){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1groups_view, PageParams: \"v_group_id=#id#\"){\n If(#image_id# > 0){\n Image(Src: Binary().ById(#image_id#), Class: mr-sm).Style(width: 30px; border: 1px solid #5A5D63;)\n #group_name#\n }.Else{\n Div(Class: #style_link#){\n Span(Class: fa icon-settings fa-2x mr-sm)\n }.Style(\n display: inline-block;\n )\n Span(Class: btn-link text-bold pb-sm){\n Span(Class: #style_link#, Body: #group_name#)\n }.Style(\n display: inline-block;\n vertical-align: top;\n padding-top: 7px;\n padding-left: 4px;\n )\n }\n }\n}.Custom(_date){\n Div(#style_text# small){\n Div(text-nowrap){DateTime(DateTime: #date_created#, Format: \"DD.MM.YYYY HH:MI\")}\n If(#deleted# == 1){\n Div(text-nowrap){DateTime(DateTime: #date_deleted#, Format: \"DD.MM.YYYY HH:MI\")}\n }\n }\n}.Custom(_status){\n Span(Class: #style_text#){\n If(#deleted# == 0){\n LangRes(@1active)\n }.Else{\n LangRes(@1deleted)\n }\n }\n}.Custom(_access){\n If(#creator.account# == #account_id#){\n SetVar(access,done)\n }.Else{\n SetVar(access,)\n }\n If(And(#group_access#!=\"NULL\",#group_access# != \"\",#group_access#!=[])){\n DBFind(\"@1roles\", src_access_list).Where({\"id\": {\"$in\": #group_access#}}).Columns(\"id,role_name\").Count(access_count).Order(\"role_name\")\n Div(#style_text# breaker){\n ForList(src_access_list){\n If(#role_id# == #id#){\n SetVar(access,done)\n }\n If(#access_count# != #src_access_list_index#){\n Span(\"#role_name#,\",mr-sm)\n }.Else{\n #role_name#\n }\n }\n }\n }\n}.Custom(_actions){\n Div(text-right button-group text-nowrap){\n If(#access# == done){\n If(#deleted# == 0){\n Button(Class: btn bg-gray-lighter, Contract: @1GroupsDelete, Params: \"Ops=D,GroupId=#id#\", Page: @1groups_list){\n Em(Class: text-danger fa fa-1x fa-trash)\n }.Alert(Text: \"$@1sure_want_delete$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n Button(Class: btn bg-gray-lighter mh-sm, PageParams: \"GroupId=#id#\", Page: @1groups_create){\n Em(Class: text-default fa fa-1x fa-edit)\n }.Popup(50, $@1edit_group$)\n }.ElseIf(#deleted# == 1){\n Button(Class: btn bg-gray-lighter mh-sm, Contract: @1GroupsDelete, Params: \"Ops=R,GroupId=#id#\", Page: @1groups_list){\n Em(Class: text-info fa fa-1x fa-recycle)\n }\n }\n }\n }\n}.Custom(type_group){\n If(#deleted# == 0){\n Span(Body: AppParam(Ecosystem:1, App: #application_id#, Name: groups_types, Index:#group_type#))\n }.Else{\n Span(Body: AppParam(Ecosystem:1, App: #application_id#, Name: groups_types, Index:#group_type#), Class: text-muted)\n }\n}.Custom(join_group){\n If(#deleted# == 0){\n DBFind(\"@1groups_participants\").Columns(\"id,groups_info,groups_info->id,deleted,member,member->account\").Where({\"groups_info->id\": \"#id#\", \"deleted\": 0, \"member->account\": \"#account_id#\"}).Vars(j_l).Count(check_membership)\n If(And(#group_type# == 1, #check_membership# == 0)){\n Button(Body: $@1join_the_group$, Class: btn btn-link pull-right, Contract: @1GroupsAssign, Page: @1groups_view, PageParams: \"v_group_id=#id#\", Params: \"GroupId=#id#,MemberAccount=#account_id#\")\n }.ElseIf(And(#group_type# == 1,#check_membership# == 1)){\n Button(Body: $@1leave_the_group$, Class: btn btn-link pull-right, Contract: @1GroupsUnassign, Page: @1groups_list, Params:\"RowId=#j_l_id#\")\n }.ElseIf(And(#group_type# == 2,#check_membership# == 0)){\n Button(Body: $@1send_request$, Class: btn btn-link pull-right, Contract: @1GroupRequestMembership, Page: @1groups_view, PageParams:\"v_group_id=#id#\", Params: \"GroupId=#id#\")\n }\n }\n}.Custom(gr_info){\n If(#deleted# == 0){\n Span(Body: #group_info#)\n }.Else{\n Span(Body: #group_info#, Class: text-muted)\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src_groups, \"$@1group$=_name,$@1type$=type_group,$@1id$=_id,$@1group_info$=gr_info,$@1creator$=_creator,$@1role_created_deleted$=_date,$@1status$=_status,$@1access$=_access,=join_group,=_actions\")\n }.ElseIf(#all_roles_count# > 0){\n Div(Class: text-center h4 text-muted){\n Div(Class: text-center h4 text-muted, Body: \"$@1groups$ $@1not_founded$\")\n }\n }.Else{\n Div(Class: text-center){\n Div(Class: text-center h4 text-muted, Body: \"$@1groups$ $@1not_founded$\")\n }\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "groups_request_view", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Div(content-wrapper){\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"id\": #notific_id#}).Columns(\"page_params->gr_id,page_params->decide,sender->image_id,recipient->member_name,recipient->member_id,recipient->image_id,sender->member_id,sender->member_name,closed\").Vars(notific)\n\n Div(row){\n Div(col-sm-8 col-sm-offset-2 col-lg-6 col-lg-offset-3){\n Form(panel panel-default){\n Div(panel-heading text-center){\n If(#notific_page_params_decide# == 1){\n Span(Class: h3, Body: $@1your_request_approved$)\n }.ElseIf(#notific_page_params_decide# == -1){\n Span(Class: h3, Body: $@1your_request_denied$)\n }.Else{\n Span(Class: h3, Body: $@1request_group$)\n }\n }\n Div(panel-body){\n Div(form-group){\n Div(row){\n Div(col-md-12 mt-sm text-center){\n If(Or(#notific_page_params_decide# == 1,#notific_page_params_decide# == -1)){\n If(#notific_recipient_image_id# > 0){\n Image(Src: Binary().ById(#notific_recipient_image_id#), Class: img-thumbnail).Style(width: 120px; border: 1px solid #5A5D63;)\n }.Else{\n Span(Class: fa icon-user fa-5x)\n }\n Div(m0 h4 text-bold){#notific_recipient_member_name#}\n }.Else{\n If(#notific_sender_image_id# > 0){\n Image(Src: Binary().ById(#notific_sender_image_id#), Class: img-thumbnail).Style(width: 120px; border: 1px solid #5A5D63;)\n }.Else{\n Span(Class: fa icon-user fa-5x)\n }\n Div(m0 h4 text-bold){#notific_sender_member_name#}\n }\n }\n }\n }\n Div(list-group-item text-center){\n Div(text-muted m0 h5, Body: LangRes(@1address))\n If(Or(#notific_page_params_decide# == 1,#notific_page_params_decide# == -1)){\n Span(Class: h5 text-bold, Body: Address(#notific_recipient_member_id#))\n }.Else{\n Span(Class: h5 text-bold, Body: Address(#notific_sender_member_id#))\n }\n }\n Div(list-group-item text-center){\n DBFind(@1groups).Where({\"ecosystem\": #ecosystem_id#, \"id\": #notific_page_params_gr_id#}).Vars(group)\n Div(text-muted m0 h5, Body: $@1group$)\n Span(Class: h5 text-bold, Body: #group_group_name# (#group_id#))\n }\n If(#notific_closed# == 0){\n Div(row){\n Div(col-md-12 mt-lg text-center){\n If(Or(#notific_page_params_decide# == 1,#notific_page_params_decide# == -1)){\n Button(Class: btn btn-primary mh-sm, Body: $@1close$, Contract: @1NotificationsClose, Page: @1notifications_list, Params: \"NotificId=#notific_id#\")\n }.Else{\n Button(Class: btn btn-danger mh-sm, Body: $@1reject$, Contract: @1GroupRequestDecide, Page: @1notifications_list, Params: \"NotificId=#notific_id#,Accept=0\")\n Button(Class: btn btn-success mh-sm, Body: $@1accept$, Contract: @1GroupRequestDecide, Page: @1notifications_list, Params: \"NotificId=#notific_id#,Accept=1\")\n }\n }\n }\n }\n }\n }\n }\n }\n}", + "Value": "Div(content-wrapper){\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#notific_id#\"}).Columns(\"page_params->gr_id,page_params->decide,sender->image_id,recipient->member_name,recipient->account,recipient->image_id,sender->account,sender->member_name,closed\").Vars(notific)\n\n Div(row){\n Div(col-sm-8 col-sm-offset-2 col-lg-6 col-lg-offset-3){\n Form(panel panel-default){\n Div(panel-heading text-center){\n If(#notific_page_params_decide# == 1){\n Span(Class: h3, Body: $@1your_request_approved$)\n }.ElseIf(#notific_page_params_decide# == -1){\n Span(Class: h3, Body: $@1your_request_denied$)\n }.Else{\n Span(Class: h3, Body: $@1request_group$)\n }\n }\n Div(panel-body){\n Div(form-group){\n Div(row){\n Div(col-md-12 mt-sm text-center){\n If(Or(#notific_page_params_decide# == 1,#notific_page_params_decide# == -1)){\n If(#notific_recipient_image_id# > 0){\n Image(Src: Binary().ById(#notific_recipient_image_id#), Class: img-thumbnail).Style(width: 120px; border: 1px solid #5A5D63;)\n }.Else{\n Span(Class: fa icon-user fa-5x)\n }\n Div(m0 h4 text-bold){#notific_recipient_member_name#}\n }.Else{\n If(#notific_sender_image_id# > 0){\n Image(Src: Binary().ById(#notific_sender_image_id#), Class: img-thumbnail).Style(width: 120px; border: 1px solid #5A5D63;)\n }.Else{\n Span(Class: fa icon-user fa-5x)\n }\n Div(m0 h4 text-bold){#notific_sender_member_name#}\n }\n }\n }\n }\n Div(list-group-item text-center){\n Div(text-muted m0 h5, Body: LangRes(@1address))\n If(Or(#notific_page_params_decide# == 1,#notific_page_params_decide# == -1)){\n Span(Class: h5 text-bold, Body: #notific_recipient_account#)\n }.Else{\n Span(Class: h5 text-bold, Body: #notific_sender_account#)\n }\n }\n Div(list-group-item text-center){\n DBFind(\"@1groups\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#notific_page_params_gr_id#\"}).Vars(group)\n Div(text-muted m0 h5, Body: $@1group$)\n Span(Class: h5 text-bold, Body: #group_group_name# (#group_id#))\n }\n If(#notific_closed# == 0){\n Div(row){\n Div(col-md-12 mt-lg text-center){\n If(Or(#notific_page_params_decide# == 1,#notific_page_params_decide# == -1)){\n Button(Class: btn btn-primary mh-sm, Body: $@1close$, Contract: @1NotificationsClose, Page: @1notifications_list, Params: \"NotificId=#notific_id#\")\n }.Else{\n Button(Class: btn btn-danger mh-sm, Body: $@1reject$, Contract: @1GroupRequestDecide, Page: @1notifications_list, Params: \"NotificId=#notific_id#,Accept=0\")\n Button(Class: btn btn-success mh-sm, Body: $@1accept$, Contract: @1GroupRequestDecide, Page: @1notifications_list, Params: \"NotificId=#notific_id#,Accept=1\")\n }\n }\n }\n }\n }\n }\n }\n }\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "groups_view", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "If(#page_par#!=\"\"){\n SetVar(Name: v_group_id, Value: #page_par#)\n}\n\nIf(#v_group_id# > 0){\n SetVar(this_page, @1groups_view).(this_table, @1groups_participants)\n Include(@1pager_header)\n\n DBFind(@1groups).Where({\"ecosystem\": #ecosystem_id#, \"id\": #v_group_id#}).Columns(\"group_name,group_type,deleted,group_access,creator->member_id,deleted\").Vars(prefix)\n If(#prefix_creator_member_id#==#key_id#){\n SetVar(manager_id,1)\n }.ElseIf(And(#prefix_group_access#!=\"NULL\",#prefix_group_access#!=\"\",#prefix_group_access#!=\"[]\",#prefix_deleted#==0)){\n DBFind(@1roles_participants).Where({\"ecosystem\": #ecosystem_id#, \"id\": {\"$in\": #prefix_group_access#}}).Columns(\"id\").Vars(manager)\n }\n\n If(#manager_id#>0){\n AddToolButton(Page: @1groups_assign, PageParams: \"v_group_id=#v_group_id#\", Icon: icon-plus, Title: $@1assign$).Popup(50, $@1assign$)\n AddToolButton(Page: @1groups_add_members, PageParams: \"v_group_id=#v_group_id#\", Icon: icon-plus, Title: $@1members_add$).Popup(50, $@1add_members_to_group$)\n }\n\n SetTitle(\"$@1group$\": #prefix_group_name#)\n Span(Class: h5 m0 mb ml-lg){\n LinkPage(Class: ml-sm, Body: $@1groups$, Page: @1groups_list)\n Span(Class: text-muted mh-sm, Body: /)\n Span(Class: text-muted, Body: #prefix_group_name#)\n }.Style(\n display: inline-block;\n )\n\n If(#search#){\n SetVar(w_search, {\"member->member_name\": {\"$ilike\": \"#search#\"}})\n }\n SetVar(where, {\"ecosystem\": #ecosystem_id#, \"groups_info->id\": #v_group_id#, {#w_search#}})\n\n Div(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1member)).(page_par, #v_group_id#)\n Include(@1search)\n }\n\n DBFind(#this_table#, src_participants).Where(#where#).Order({\"deleted\": 1, \"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,member->member_id,groups_info,groups_info->id,member->member_name,member->image_id,appointed->member_id,appointed->member_name,date_created,date_deleted,deleted\").Custom(custom_id){\n If(#deleted# == 0){\n SetVar(Name: style_text, Value: \"text-normal\")\n SetVar(Name: style_link, Value: \"text-primary\")\n }.Else{\n SetVar(Name: style_text, Value: \"text-muted\")\n SetVar(Name: style_link, Value: \"text-muted\")\n }\n Span(Class: #style_text#, Body: #id#)\n }.Custom(custom_appointed){\n If(Or(#appointed.member_id#>0,#appointed.member_id#<0)){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#appointed.member_id#\"){\n Span(Body: #appointed.member_name#)\n }\n }\n }.Custom(custom_member){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#member.member_id#\"){\n If(#member.image_id#>0){\n Image(Src: Binary().ById(#member.image_id#), Class: img-circle).Style(width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(#member.member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(#member.member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n }.Custom(custom_address){\n Span(Class: #style_text#, Body: Address(#member.member_id#))\n }.Custom(custom_date){\n Div(Class: #style_text# h6 m0, Body: DateTime(DateTime: #date_created#, Format: \"DD.MM.YYYY HH:MI\"))\n If(#deleted# == 1){\n Div(Class: #style_text# h6 m0, Body: DateTime(DateTime: #date_deleted#, Format: \"DD.MM.YYYY HH:MI\"))\n }\n }.Custom(custom_status){\n If(#deleted# == 0){\n Span(Class: #style_text#, Body: LangRes(@1active))\n }.Else{\n Span(Class: #style_text#, Body: LangRes(@1deleted))\n }\n }.Custom(actions){\n Div(pull-right){\n If(#deleted#==0){\n Button(Class: btn bg-gray-lighter mh-sm, Contract: @1GroupsUnassign, Params: \"RowId=#id#\", Page: @1groups_view, PageParams: \"v_group_id=#v_group_id#\"){\n Em(Class: text-danger fa fa-1x fa-trash)\n }.Alert(Text: \"$@1sure_want_delete_member$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n }.Count(count)\n\n Div(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src_participants, \"$@1member$=custom_member,$@1address$=custom_address,$@1appointed$=custom_appointed,$@1appointed_deleted_member$=custom_date,$@1status$=custom_status,=actions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1participants$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n }\n Div(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n }\n}.Else{\n Div(md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n}", + "Value": "If(#page_par#!=\"\"){\n SetVar(Name: v_group_id, Value: #page_par#)\n}\n\nIf(#v_group_id# > 0){\n SetVar(this_page, @1groups_view).(this_table, @1groups_participants)\n Include(@1pager_header)\n\n DBFind(\"@1groups\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#v_group_id#\"}).Columns(\"group_name,group_type,deleted,group_access,creator->account,deleted\").Vars(prefix)\n If(#prefix_creator_account#==#account_id#){\n SetVar(manager_id,1)\n }.ElseIf(And(#prefix_group_access#!=\"NULL\",#prefix_group_access#!=\"\",#prefix_group_access#!=\"[]\",#prefix_deleted#==0)){\n DBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": {\"$in\": #prefix_group_access#}}).Columns(\"id\").Vars(manager)\n }\n\n If(#manager_id#>0){\n AddToolButton(Page: @1groups_assign, PageParams: \"v_group_id=#v_group_id#\", Icon: icon-plus, Title: $@1assign$).Popup(50, $@1assign$)\n AddToolButton(Page: @1groups_add_members, PageParams: \"v_group_id=#v_group_id#\", Icon: icon-plus, Title: $@1members_add$).Popup(50, $@1add_members_to_group$)\n }\n\n SetTitle(\"$@1group$\": #prefix_group_name#)\n Span(Class: h5 m0 mb ml-lg){\n LinkPage(Class: ml-sm, Body: $@1groups$, Page: @1groups_list)\n Span(Class: text-muted mh-sm, Body: /)\n Span(Class: text-muted, Body: #prefix_group_name#)\n }.Style(\n display: inline-block;\n )\n If(#search#){\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"groups_info->id\": \"#v_group_id#\", \"member->member_name\": {\"$ilike\": \"#search#\"}})\n }.Else{\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"groups_info->id\": \"#v_group_id#\"})\n }\n\n Div(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1member)).(page_par, #v_group_id#)\n Include(@1search)\n }\n\n DBFind(#this_table#, src_participants).Where(#where#).Order({\"deleted\": 1, \"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,member->account,groups_info,groups_info->id,member->member_name,member->image_id,appointed->account,appointed->member_name,date_created,date_deleted,deleted\").Custom(custom_id){\n If(#deleted# == 0){\n SetVar(Name: style_text, Value: \"text-normal\")\n SetVar(Name: style_link, Value: \"text-primary\")\n }.Else{\n SetVar(Name: style_text, Value: \"text-muted\")\n SetVar(Name: style_link, Value: \"text-muted\")\n }\n Span(Class: #style_text#, Body: #id#)\n }.Custom(custom_appointed){\n If(And(#appointed.account# != \"\", #appointed.account# != NULL)){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#appointed.account#\"){\n Span(Body: #appointed.member_name#)\n }\n }\n }.Custom(custom_member){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#member.account#\"){\n If(#member.image_id#>0){\n Image(Src: Binary().ById(#member.image_id#), Class: img-circle).Style(width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(#member.member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(#member.member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n }.Custom(custom_address){\n Span(Class: #style_text#, Body: #member.account#)\n }.Custom(custom_date){\n Div(Class: #style_text# h6 m0, Body: DateTime(DateTime: #date_created#, Format: \"DD.MM.YYYY HH:MI\"))\n If(#deleted# == 1){\n Div(Class: #style_text# h6 m0, Body: DateTime(DateTime: #date_deleted#, Format: \"DD.MM.YYYY HH:MI\"))\n }\n }.Custom(custom_status){\n If(#deleted# == 0){\n Span(Class: #style_text#, Body: LangRes(@1active))\n }.Else{\n Span(Class: #style_text#, Body: LangRes(@1deleted))\n }\n }.Custom(actions){\n Div(pull-right){\n If(#deleted#==0){\n Button(Class: btn bg-gray-lighter mh-sm, Contract: @1GroupsUnassign, Params: \"RowId=#id#\", Page: @1groups_view, PageParams: \"v_group_id=#v_group_id#\"){\n Em(Class: text-danger fa fa-1x fa-trash)\n }.Alert(Text: \"$@1sure_want_delete_member$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n }.Count(count)\n\n Div(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src_participants, \"$@1member$=custom_member,$@1address$=custom_address,$@1appointed$=custom_appointed,$@1appointed_deleted_member$=custom_date,$@1status$=custom_status,=actions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1participants$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n }\n Div(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n }\n}.Else{\n Div(md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "members_list", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1members_list).(this_table, @1keys)\nInclude(@1pager_header)\n\nSetTitle(\"$@1ecosystem_members$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1ecosystem_members_list_desc$\"))\nDBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"System\"}).Vars(\"system_app\")\nSetVar(role_admin, AppParam(App: #system_app_id#, Name: \"role_admin\"))\nIf(And(#role_id# == #role_admin#, #ecosystem_id# != 1)){\n AddToolButton(Title: $@1members_add$, Page:@1ecosystem_add_members, Icon: icon-plus).Popup(50, $@1ecosystem_add_members$)\n}\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": #ecosystem_id#, \"id\": {\"$neq\":#guest_key#}, \"deleted\": 0, \"id\": AddressToId(#search#)})\n}.Else{\n SetVar(where, {\"ecosystem\": #ecosystem_id#, \"id\": {\"$neq\":#guest_key#}, \"deleted\": 0})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1wallet))\n Include(@1search)\n}\n\nDBFind(\"@1ecosystems\").Where({\"id\": #ecosystem_id#}).Vars(\"custom\")\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(custom_id){\n SetVar(Name: style_text, Value: \"text-normal\")\n SetVar(Name: style_link, Value: \"text-primary\")\n Span(Class: h6 text-muted, Body: #id#)\n SetVar(m_id, 0)\n DBFind(@1members).Where({\"ecosystem\": #ecosystem_id#, \"id\": #id#}).Vars(m)\n If(Or(#m_id#>0,#m_id#<0)){\n SetVar(image_id, #m_image_id#)\n SetVar(member_name, #m_member_name#)\n }.Else{\n SetVar(image_id, 0)\n SetVar(member_name, Address(#id#))\n }\n}.Custom(custom_member_id){\n If(Or(#ecosystem_id# == 1, #custom_token_title# != \"\")){\n Button(Class: btn-xs btn-link, Page: @1tokens_send, PageParams: \"v_key_id=#id#\"){\n Span(Class: h5, Body: Address(#id#))\n }.Popup(Header: $@1tokens_send$, Width: \"50\")\n }.Else{\n Span(Class: h5, Body: Address(#id#))\n }\n}.Custom(custom_username){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#id#\"){\n If(#image_id#>0){\n Image(Src: Binary().ById(#image_id#), Class: img-circle).Style(height: 30px;width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(#member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(#member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1name$=custom_username,$@1wallet$=custom_member_id\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1members$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, @1members_list).(this_table, @1keys)\nInclude(@1pager_header)\n\nSetTitle(\"$@1ecosystem_members$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1ecosystem_members_list_desc$\"))\nDBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(system_app)\nSetVar(role_admin, AppParam(App: #system_app_id#, Name: \"role_admin\"))\nIf(And(#role_id# == #role_admin#, #ecosystem_id# != 1)){\n AddToolButton(Title: $@1members_add$, Page:@1ecosystem_add_members, Icon: icon-plus).Popup(50, $@1ecosystem_add_members$)\n}\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0, \"$and\": [{\"account\": {\"$ilike\": \"#search#\"}}, {\"account\": {\"$neq\": \"#guest_account#\"}}]})\n}.Else{\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"account\": {\"$neq\": \"#guest_account#\"}, \"deleted\": 0})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1wallet))\n Include(@1search)\n}\n\nDBFind(\"@1ecosystems\").Where({\"id\": \"#ecosystem_id#\"}).Vars(custom)\n\nDBFind(#this_table#, src).Where(#where#).Order({\"account\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(custom_id){\n SetVar(Name: style_text, Value: \"text-normal\")\n SetVar(Name: style_link, Value: \"text-primary\")\n Span(Class: h6 text-muted, Body: #account#)\n SetVar(m_account,)\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#account#\"}).Vars(m)\n If(#m_account#){\n SetVar(image_id, #m_image_id#)\n SetVar(member_name, #m_member_name#)\n }.Else{\n SetVar(image_id, 0)\n SetVar(member_name, #account#)\n }\n}.Custom(custom_account){\n If(Or(#ecosystem_id# == 1, #custom_token_title# != \"\")){\n Button(Class: btn-xs btn-link, Page: @1tokens_send, PageParams: \"v_account=#account#\"){\n Span(Class: h5, Body: #account#)\n }.Popup(Header: $@1tokens_send$, Width: \"50\")\n }.Else{\n Span(Class: h5, Body: #account#)\n }\n}.Custom(custom_username){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#account#\"){\n If(#image_id#>0){\n Image(Src: Binary().ById(#image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(#member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(#member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1name$=custom_username,$@1wallet$=custom_account\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1members$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "members_list_admin", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1members_list_admin).(this_table, @1keys)\nInclude(@1pager_header)\n\nSetTitle(\"$@1member_management$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1member_management_desc$\"))\nDBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"System\"}).Vars(\"system_app\")\nSetVar(role_admin, AppParam(App: #system_app_id#, Name: \"role_admin\"))\nIf(And(#role_id# == #role_admin#, #ecosystem_id# != 1)){\n AddToolButton(Title: $@1members_add$, Page: @1ecosystem_add_members, Icon: icon-plus).Popup(50, $@1ecosystem_add_members$)\n}\n\nIf(#search#){\n SetVar(w_search, {\"id\": AddressToId(#search#)})\n}\nSetVar(where, {\"ecosystem\": #ecosystem_id#, \"id\": {\"$neq\":#guest_key#}, {#w_search#}})\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1wallet))\n Include(@1search)\n}\n\nDBFind(\"@1ecosystems\").Where({\"id\": #ecosystem_id#}).Vars(\"custom\")\n\nDBFind(#this_table#, src).Where(#where#).Order({deleted:\"1\", id:\"1\"}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(custom_id){\n If(#deleted# == 0){\n SetVar(style_text, \"text-normal\").(style_link, \"text-primary\")\n }.Else{\n SetVar(style_text,\"text-muted\").(style_link,\"text-muted\")\n }\n Span(Class: h6 text-muted, Body: #id#)\n SetVar(m_id, 0)\n DBFind(@1members).Where({\"ecosystem\": #ecosystem_id#, \"id\": #id#}).Vars(m)\n If(Or(#m_id#>0,#m_id#<0)){\n SetVar(image_id, #m_image_id#)\n SetVar(member_name, #m_member_name#)\n }.Else{\n SetVar(image_id, 0)\n SetVar(member_name, Address(#id#))\n }\n}.Custom(custom_member_id){\n If(Or(#ecosystem_id# == 1, #custom_token_title# != \"\")){\n Button(Class: btn-xs btn-link, Page: @1tokens_send, PageParams: \"v_key_id=#id#,back_page=#this_page#\"){\n Span(Class: h5 #style_text#, Body: Address(#id#))\n }.Popup(Header: $@1tokens_send$, Width: \"50\")\n }.Else{\n Span(Class: h5 #style_text#, Body: Address(#id#))\n }\n}.Custom(custom_username){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#id#\"){\n If(#image_id#>0){\n Image(Src: Binary().ById(#image_id#), Class: img-circle).Style(height: 30px;width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(#member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(#member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n}.Custom(actions){\n If(#deleted#==0){\n Button(Body: LangRes(@1delete), Class: btn-xs btn-link pull-right, Page: #this_page#, Params:\"KeyId=#id#\", Contract: @1DeleteMember).Alert(Text: \"$@1want_delete_key$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n If(#blocked#==0){\n Button(Body: LangRes(@1block_key), Class: btn-xs btn-link pull-right, Page: #this_page#, Params:\"KeyId=#id#,Value=1\", Contract: @1BlockMember).Alert(Text: \"$@1want_block_key$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }.Else{\n Button(Body: LangRes(@1unblock_key), Class: btn-xs btn-link pull-right, Page: #this_page#, Params:\"KeyId=#id#,Value=0\", Contract: @1BlockMember).Alert(Text: \"$@1want_unblock_key$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }.Else{\n Span(Class: h6 text-muted pull-right, Body: $@1deleted$)\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1name$=custom_username,$@1id$=custom_id,$@1wallet$=custom_member_id,=actions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1members$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, @1members_list_admin).(this_table, @1keys)\nInclude(@1pager_header)\n\nSetTitle(\"$@1member_management$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1member_management_desc$\"))\nDBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(system_app)\nSetVar(role_admin, AppParam(App: #system_app_id#, Name: \"role_admin\"))\nIf(And(#role_id# == #role_admin#, #ecosystem_id# != 1)){\n AddToolButton(Title: $@1members_add$, Page: @1ecosystem_add_members, Icon: icon-plus).Popup(50, $@1ecosystem_add_members$)\n}\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"account\": {\"$ilike\": \"#search#\"}}, {\"account\": {\"$neq\": \"#guest_account#\"}}]})\n}.Else{\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"account\": {\"$neq\": \"#guest_account#\"}})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1wallet))\n Include(@1search)\n}\n\nDBFind(\"@1ecosystems\").Where({\"id\": \"#ecosystem_id#\"}).Vars(custom)\n\nDBFind(#this_table#, src).Where(#where#).Order({\"deleted\": 1, \"account\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(custom_id){\n If(#deleted# == 0){\n SetVar(style_text, \"text-normal\").(style_link, \"text-primary\")\n }.Else{\n SetVar(style_text,\"text-muted\").(style_link,\"text-muted\")\n }\n Span(Class: h6 text-muted, Body: #account#)\n}.Custom(custom_account){\n If(Or(#ecosystem_id# == 1, #custom_token_title# != \"\")){\n Button(Class: btn-xs btn-link, Page: @1tokens_send, PageParams: \"v_account=#account#,back_page=#this_page#\"){\n Span(Class: h5 #style_text#, Body: #account#)\n }.Popup(Header: $@1tokens_send$, Width: \"50\")\n }.Else{\n Span(Class: h5 #style_text#, Body: #account#)\n }\n}.Custom(custom_username){\n SetVar(m_account,)\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#account#\"}).Vars(m)\n If(#m_account#){\n SetVar(image_id, #m_image_id#)\n SetVar(member_name, #m_member_name#)\n }.Else{\n SetVar(image_id, 0)\n SetVar(member_name, #account#)\n }\n LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#account#\"){\n If(#image_id#>0){\n Image(Src: Binary().ById(#image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(#member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right: 10px;)\n Span(#member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n}.Custom(actions){\n If(#deleted#==0){\n Button(Body: LangRes(@1delete), Class: btn-xs btn-link pull-right, Page: #this_page#, Params: \"MemberAccount=#account#\", Contract: @1DeleteMember).Alert(Text: \"$@1want_delete_account$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n If(#blocked#==0){\n Button(Body: LangRes(@1block_account), Class: btn-xs btn-link pull-right, Page: #this_page#, Params: \"MemberAccount=#account#,Value=1\", Contract: @1BlockMember).Alert(Text: \"$@1want_block_account$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }.Else{\n Button(Body: LangRes(@1unblock_account), Class: btn-xs btn-link pull-right, Page: #this_page#, Params: \"MemberAccount=#account#,Value=0\", Contract: @1BlockMember).Alert(Text: \"$@1want_unblock_account$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }.Else{\n Span(Class: h6 text-muted pull-right, Body: $@1deleted$)\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1name$=custom_username,$@1id$=custom_id,$@1wallet$=custom_account,=actions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1members$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}\n", "Menu": "admin_menu", "Type": "pages" }, { "Name": "membership_admin_view", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Div(content-wrapper){\n DBFind(@1notifications).Where({\"id\": #notific_id#}).Columns(\"page_params->ecosystem_id,sender->image_id,sender->member_id,sender->member_name,closed\").Vars(notific)\n DBFind(@1ecosystems).Where({\"id\": #notific_page_params_ecosystem_id#}).Vars(ecosystem)\n\n Div(row){\n Div(col-sm-8 col-sm-offset-2 col-lg-6 col-lg-offset-3){\n Form(panel panel-default){\n Div(panel-heading text-center){\n Span(Class: h3, Body: $@1membership_request$)\n }\n Div(panel-body){\n Div(form-group){\n Div(row){\n Div(col-md-12 mt-sm text-center){\n If(#notific_sender_image_id#>0){\n Image(Src: Binary().ById(#notific_sender_image_id#), Class: img-thumbnail).Style(width: 120px; border: 1px solid #5A5D63;)\n }.Else{\n Span(Class: fa icon-user fa-5x)\n }\n Div(m0 h4 text-bold){#notific_sender_member_name#}\n }\n }\n }\n Div(list-group-item text-center){\n Div(text-muted m0 h5, Body: LangRes(@1address))\n Span(Class: h5 text-bold, Body: Address(#notific_sender_member_id#))\n }\n Div(list-group-item text-center){\n Div(text-muted m0 h5, Body: LangRes(@1ecosystem))\n Span(Class: h5 text-bold, Body: `\"#ecosystem_name#\" (#ecosystem_id#)`)\n }\n If(#notific_closed# == 0){\n Div(row){\n Div(col-md-12 mt-lg text-center){\n Button(Class: btn btn-danger mh-sm, Body: $@1reject$, Contract: @1MembershipDecide, Page: @1default_page, Params: \"NotificId=#notific_id#,Accept=0\")\n Button(Class: btn btn-success mh-sm, Body: $@1accept$, Contract: @1MembershipDecide, Page: @1default_page, Params: \"NotificId=#notific_id#,Accept=1\")\n }\n }\n }\n }\n }\n }\n }\n}", + "Value": "Div(content-wrapper){\n DBFind(\"@1notifications\").Where({\"id\": \"#notific_id#\"}).Columns(\"page_params->ecosystem_id,sender->image_id,sender->account,sender->member_name,closed\").Vars(notific)\n DBFind(\"@1ecosystems\").Where({\"id\": \"#notific_page_params_ecosystem_id#\"}).Vars(ecosystem)\n\n Div(row){\n Div(col-sm-8 col-sm-offset-2 col-lg-6 col-lg-offset-3){\n Form(panel panel-default){\n Div(panel-heading text-center){\n Span(Class: h3, Body: $@1membership_request$)\n }\n Div(panel-body){\n Div(form-group){\n Div(row){\n Div(col-md-12 mt-sm text-center){\n If(#notific_sender_image_id#>0){\n Image(Src: Binary().ById(#notific_sender_image_id#), Class: img-thumbnail).Style(width: 120px; border: 1px solid #5A5D63;)\n }.Else{\n Span(Class: fa icon-user fa-5x)\n }\n Div(m0 h4 text-bold){#notific_sender_member_name#}\n }\n }\n }\n Div(list-group-item text-center){\n Div(text-muted m0 h5, Body: LangRes(@1address))\n Span(Class: h5 text-bold, Body: #notific_sender_account#)\n }\n Div(list-group-item text-center){\n Div(text-muted m0 h5, Body: LangRes(@1ecosystem))\n Span(Class: h5 text-bold, Body: `\"#ecosystem_name#\" (#ecosystem_id#)`)\n }\n If(#notific_closed# == 0){\n Div(row){\n Div(col-md-12 mt-lg text-center){\n Button(Class: btn btn-danger mh-sm, Body: $@1reject$, Contract: @1MembershipDecide, Page: @1default_page, Params: \"NotificId=#notific_id#,Accept=0\")\n Button(Class: btn btn-success mh-sm, Body: $@1accept$, Contract: @1MembershipDecide, Page: @1default_page, Params: \"NotificId=#notific_id#,Accept=1\")\n }\n }\n }\n }\n }\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "membership_user_view", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Div(content-wrapper){\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"id\": #notific_id#}).Columns(\"page_params->ecosystem_id,page_params->status,recipient->image_id,recipient->member_name,closed\").Vars(notific)\n DBFind(@1ecosystems).Where({\"id\": #notific_page_params_ecosystem_id#}).Vars(ecosystem)\n\n Div(row){\n Div(col-sm-8 col-sm-offset-2 col-lg-6 col-lg-offset-3){\n Form(panel panel-default){\n Div(panel-heading text-center){\n Span(Class: h3, Body: $@1membership_request$)\n }\n Div(panel-body){\n Div(form-group){\n Div(row){\n Div(col-md-12 mt-sm text-center){\n If(#notific_recipient_image_id#>0){\n Image(Src: Binary().ById(#notific_recipient_image_id#), Class: img-thumbnail).Style(width: 120px; border: 1px solid #5A5D63;)\n }.Else{\n Span(Class: fa icon-user fa-5x)\n }\n Div(m0 h4 text-bold){#notific_recipient_member_name#}\n }\n }\n }\n If(#notific_page_params_status# == 1){\n Div(list-group-item text-center){\n Div(Class: m0 h5 text-bold, Body: $@1request_to_membership$:)\n Div(Class: m0 h5 text-normal, Body: `\"#ecosystem_name#\" (#ecosystem_id#)`)\n Div(Class: m0 h5 text-bold, Body: $@1is_accepted$!)\n }\n If(#notific_closed# == 0){\n Div(row){\n Div(col-md-12 mt-lg text-center){\n Button(Class: btn btn-success, Body: $@1close$, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\", Page: \"@1default_page\")\n }\n }\n }\n }.Else{\n Div(list-group-item text-center){\n Div(Class: m0 h5 text-bold, Body: $@1request_to_membership$:)\n Div(Class: m0 h5 text-normal, Body: \"#ecosystem_name#\" (#ecosystem_id#))\n Div(Class: m0 h5 text-bold, Body: $@1is_rejected$!)\n }\n If(#notific_closed# == 0){\n Div(row){\n Div(col-md-12 mt-lg text-center){\n Button(Class: btn btn-danger, Body: $@1close$, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\", Page: @1default_page)\n }\n }\n }\n }\n }\n }\n }\n }\n}", + "Value": "Div(content-wrapper){\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#notific_id#\"}).Columns(\"page_params->ecosystem_id,page_params->status,recipient->image_id,recipient->member_name,closed\").Vars(notific)\n DBFind(\"@1ecosystems\").Where({\"id\": \"#notific_page_params_ecosystem_id#\"}).Vars(ecosystem)\n\n Div(row){\n Div(col-sm-8 col-sm-offset-2 col-lg-6 col-lg-offset-3){\n Form(panel panel-default){\n Div(panel-heading text-center){\n Span(Class: h3, Body: $@1membership_request$)\n }\n Div(panel-body){\n Div(form-group){\n Div(row){\n Div(col-md-12 mt-sm text-center){\n If(#notific_recipient_image_id# > 0){\n Image(Src: Binary().ById(#notific_recipient_image_id#), Class: img-thumbnail).Style(width: 120px; border: 1px solid #5A5D63;)\n }.Else{\n Span(Class: fa icon-user fa-5x)\n }\n Div(m0 h4 text-bold){#notific_recipient_member_name#}\n }\n }\n }\n If(#notific_page_params_status# == 1){\n Div(list-group-item text-center){\n Div(Class: m0 h5 text-bold, Body: $@1request_to_membership$:)\n Div(Class: m0 h5 text-normal, Body: `\"#ecosystem_name#\" (#ecosystem_id#)`)\n Div(Class: m0 h5 text-bold, Body: $@1is_accepted$!)\n }\n If(#notific_closed# == 0){\n Div(row){\n Div(col-md-12 mt-lg text-center){\n Button(Class: btn btn-success, Body: $@1close$, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\", Page: \"@1default_page\")\n }\n }\n }\n }.Else{\n Div(list-group-item text-center){\n Div(Class: m0 h5 text-bold, Body: $@1request_to_membership$:)\n Div(Class: m0 h5 text-normal, Body: \"#ecosystem_name#\" (#ecosystem_id#))\n Div(Class: m0 h5 text-bold, Body: $@1is_rejected$!)\n }\n If(#notific_closed# == 0){\n Div(row){\n Div(col-md-12 mt-lg text-center){\n Button(Class: btn btn-danger, Body: $@1close$, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\", Page: @1default_page)\n }\n }\n }\n }\n }\n }\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "message_create", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1message_create)\n\nIf(#EcosystemId# == \"\"){\n SetVar(EcosystemId, #ecosystem_id#)\n}\nIf(#MemberId# == \"\"){\n SetVar(MemberId, 0)\n}\n\nIf(#RoleId#){\n SetVar(broadcast_type_value, \"role\")\n}.ElseIf(#GroupId#){\n SetVar(broadcast_type_value, \"group\")\n}.Else{\n SetVar(broadcast_type_value, \"member\")\n}\n\nIf(Or(#MemberId# > 0, #MemberId# < 0)){\n SetVar(AddressMemberId, Address(#MemberId#))\n}.Else{\n SetVar(AddressMemberId,)\n}\n\nForm(){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1recipient)).(Class: text-danger, Body: *)\n }\n }\n Div(col-md-9 text-left){\n Data(src_broadcast_type, \"type,translation\"){\n member,$@1member$\n role,$@1role$\n group,$@1group$\n }\n Select(Name: broadcast_type, Source: src_broadcast_type, NameColumn: translation, ValueColumn: type, Value: #broadcast_type_value#)\n }\n }\n Div(row mt){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1member)).(Class: text-danger, Body: *)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: MemberId, Type: hidden, Value: #MemberId#)\n Div(input-group){\n Input(Name: m_name, Disabled: 1, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\", Value: #AddressMemberId#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams: \"back_page=#this_page#,back_header=$@1message_create$,EcosystemId=#EcosystemId#\").Popup(Header: $@1member$, Width: \"50\")\n }\n }\n }\n }.Show(\"broadcast_type=member\")\n Div(row mt){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1role)).(Class: text-danger, Body: *)\n }\n }\n Div(col-md-9 text-left){\n If(RoleId == \"\"){\n SetVar(RoleId, 0)\n SetVar(RoleName, \"\")\n }.Else{\n Input(Name: Rid, Type: hidden, Value: #RoleId#)\n }\n Div(input-group){\n If(#RoleId# > 0){\n SetVar(Id, #RoleId#)\n DBFind(@1roles).WhereId(#RoleId#).Columns(\"role_name\").Vars(r)\n }\n Input(Name: m_name, Disabled: 1, Value: #r_role_name#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_role, PageParams: \"back_page=@1message_create,back_header=$@1message_create$,EcosystemId=#ecosystem_id#,Id=#vID#\").Popup(Header: $@1role$, Width: \"50\")\n }\n }\n }\n }.Show(\"broadcast_type=role\")\n Div(row mt){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1group)).(Class: text-danger, Body: *)\n }\n }\n Div(col-md-9 text-left){\n If(GroupId == \"\"){\n SetVar(GroupId, 0)\n SetVar(GroupName, \"\")\n }.Else{\n Input(Name: GroupId, Type: hidden, Value: #GroupId#)\n }\n Div(input-group){\n If(#GroupId# > 0){\n SetVar(Id, #GroupId#)\n DBFind(@1groups).WhereId(#GroupId#).Columns(\"group_name\").Vars(g)\n }\n Input(Name: m_name, Disabled: 1, Value: #g_group_name#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_group, PageParams: \"back_page=@1message_create,back_header=$@1message_create$,EcosystemId=#ecosystem_id#,Id=#vID#\").Popup(Header: $@1group$, Width: \"50\")\n }\n }\n }\n }.Show(\"broadcast_type=group\")\n Div(row mt){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1message_subject)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Header, Value: \"\", Placeholder: $@1message_subject_type_here$)\n }\n }\n Div(row mt){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1message_text)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Type: Hidden, Name: EcosystemId, Value: \"#ecosystem_id#\")\n Input(Type: Hidden, Name: Sender, Value: \"1\")\n Input(Type: Hidden, Name: Icon, Value: \"icon-speech\")\n Input(Type: Hidden, Name: Params, Value: `{\"type\": \"message\"}`)\n Input(Type: Hidden, Name: Page, Value: \"@1message_view\")\n Input(Type: textarea, Name: Body, Value: \"\", Placeholder: $@1message_type_here$).Style(resize: vertical; min-height: 6em;)\n }\n }\n Div(row mt){\n Div(col-md-12){\n Div(){\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right, Page: @1messages_list, Contract: @1NotificationsSend, Params: \"Rid=0,GroupId=0,CurrentRid=#role_id#\")\n }.Show(\"broadcast_type=member\")\n Div(){\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right, Page: @1messages_list, Contract: @1NotificationsSend, Params: \"MemberId=0,GroupId=0,CurrentRid=#role_id#,Closure=2\")\n }.Show(\"broadcast_type=role\")\n Div(){\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right, Page: @1messages_list, Contract: @1NotificationsSend, Params: \"MemberId=0,Rid=0,CurrentRid=#role_id#\")\n }.Show(\"broadcast_type=group\")\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: @1messages_list)\n }\n }\n}.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n)", + "Value": "SetVar(this_page, @1message_create)\n\nIf(#EcosystemId# == \"\"){\n SetVar(EcosystemId, #ecosystem_id#)\n}\nIf(#MemberAccount#){\n SetVar(MemberAccountInputValue, #MemberAccount#)\n}.Else{\n SetVar(MemberAccount, 0)\n SetVar(MemberAccountInputValue,)\n}\n\nIf(#RoleId#){\n SetVar(broadcast_type_value, \"role\")\n}.ElseIf(#GroupId#){\n SetVar(broadcast_type_value, \"group\")\n}.Else{\n SetVar(broadcast_type_value, \"member\")\n}\n\nForm(){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1recipient)).(Class: text-danger, Body: *)\n }\n }\n Div(col-md-9 text-left){\n Data(src_broadcast_type, \"type,translation\"){\n member,$@1member$\n role,$@1role$\n group,$@1group$\n }\n Select(Name: broadcast_type, Source: src_broadcast_type, NameColumn: translation, ValueColumn: type, Value: #broadcast_type_value#)\n }\n }\n Div(row mt){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1member)).(Class: text-danger, Body: *)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: MemberAccount, Type: hidden, Value: #MemberAccount#)\n Div(input-group){\n Input(Name: m_name, Disabled: 1, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\", Value: #MemberAccountInputValue#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams: \"back_page=#this_page#,back_header=$@1message_create$,EcosystemId=#EcosystemId#\").Popup(Header: $@1member$, Width: \"50\")\n }\n }\n }\n }.Show(\"broadcast_type=member\")\n Div(row mt){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1role)).(Class: text-danger, Body: *)\n }\n }\n Div(col-md-9 text-left){\n If(RoleId == \"\"){\n SetVar(RoleId, 0)\n SetVar(RoleName,)\n }.Else{\n Input(Name: Rid, Type: hidden, Value: #RoleId#)\n }\n Div(input-group){\n If(#RoleId# > 0){\n SetVar(Id, #RoleId#)\n DBFind(\"@1roles\").WhereId(#RoleId#).Columns(\"role_name\").Vars(r)\n }\n Input(Name: m_name, Disabled: 1, Value: #r_role_name#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_role, PageParams: \"back_page=@1message_create,back_header=$@1message_create$,EcosystemId=#ecosystem_id#,Id=#vID#\").Popup(Header: $@1role$, Width: \"50\")\n }\n }\n }\n }.Show(\"broadcast_type=role\")\n Div(row mt){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1group)).(Class: text-danger, Body: *)\n }\n }\n Div(col-md-9 text-left){\n If(GroupId == \"\"){\n SetVar(GroupId, 0)\n SetVar(GroupName,)\n }.Else{\n Input(Name: GroupId, Type: hidden, Value: #GroupId#)\n }\n Div(input-group){\n If(#GroupId# > 0){\n SetVar(Id, #GroupId#)\n DBFind(\"@1groups\").WhereId(#GroupId#).Columns(\"group_name\").Vars(g)\n }\n Input(Name: m_name, Disabled: 1, Value: #g_group_name#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_group, PageParams: \"back_page=@1message_create,back_header=$@1message_create$,EcosystemId=#ecosystem_id#,Id=#vID#\").Popup(Header: $@1group$, Width: \"50\")\n }\n }\n }\n }.Show(\"broadcast_type=group\")\n Div(row mt){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1message_subject)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Header, Value: \"\", Placeholder: $@1message_subject_type_here$)\n }\n }\n Div(row mt){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1message_text)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Type: Hidden, Name: EcosystemId, Value: \"#ecosystem_id#\")\n Input(Type: Hidden, Name: Sender, Value: \"1\")\n Input(Type: Hidden, Name: Icon, Value: \"icon-speech\")\n Input(Type: Hidden, Name: Params, Value: `{\"type\": \"message\"}`)\n Input(Type: Hidden, Name: Page, Value: \"@1message_view\")\n Input(Type: textarea, Name: Body, Value: \"\", Placeholder: $@1message_type_here$).Style(resize: vertical; min-height: 6em;)\n }\n }\n Div(row mt){\n Div(col-md-12){\n Div(){\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right, Page: @1messages_list, Contract: @1NotificationsSend, Params: \"Rid=0,GroupId=0,CurrentRid=#role_id#\")\n }.Show(\"broadcast_type=member\")\n Div(){\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right, Page: @1messages_list, Contract: @1NotificationsSend, Params: \"MemberAccount=0,GroupId=0,CurrentRid=#role_id#,Closure=2\")\n }.Show(\"broadcast_type=role\")\n Div(){\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right, Page: @1messages_list, Contract: @1NotificationsSend, Params: \"MemberAccount=0,Rid=0,CurrentRid=#role_id#\")\n }.Show(\"broadcast_type=group\")\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: @1messages_list)\n }\n }\n}.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n)", "Menu": "default_menu", "Type": "pages" }, { "Name": "message_view", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "If(#notific_id# > 0){\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"id\": #notific_id#}).Columns(\"id,sender->member_id,sender->member_name,sender->image_id,recipient->member_id,recipient->member_name,notification->body,notification->header,page_params->thread,date_created,closed\").Vars(message)\n DBFind(@1members).Where({\"ecosystem\": #ecosystem_id#, \"id\": #message_sender_member_id#}).Vars(highlighted)\n If(#highlighted_id#){\n SetVar(message_sender_member_name, #highlighted_member_name#)\n SetVar(message_sender_image_id, #highlighted_image_id#)\n }\n\n If(#message_page_params_thread# > 0){\n SetVar(thread, #message_page_params_thread#)\n DBFind(@1notifications,src_thread).Where({\"ecosystem\": #ecosystem_id#, \"page_params->thread\": #message_page_params_thread#}).Order(\"id\").Count(\"thread_quantity\").Columns(\"id,sender->member_id,sender->member_name,sender->image_id,notification->body,date_created\")\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"id\": #message_page_params_thread#}).Columns(\"id,sender->member_id,sender->member_name,sender->image_id,recipient->member_id,notification->body,date_created\").Vars(init_message)\n }.Else{\n SetVar(thread, #message_id#)\n DBFind(@1notifications,src_thread).Where({\"ecosystem\": #ecosystem_id#, \"page_params->thread\": #message_id#}).Order(\"id\").Count(\"thread_quantity\").Columns(\"id,sender->member_id,sender->member_name,sender->image_id,notification->body,date_created\")\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"id\": #message_id#}).Columns(\"id,sender->member_id,sender->member_name,sender->image_id,recipient->member_id,notification->body,date_created\").Vars(init_message)\n }\n DBFind(@1members).Where({\"ecosystem\": #ecosystem_id#, \"id\": #init_message_sender_member_id#}).Vars(starter)\n If(#starter_id#){\n SetVar(init_message_sender_member_name, #starter_member_name#)\n SetVar(init_message_sender_image_id, #starter_image_id#)\n }\n\n If(#init_message_sender_member_id# != #key_id#){\n SetVar(reply_recipient, #init_message_sender_member_id#)\n }.Else{\n SetVar(reply_recipient, #init_message_recipient_member_id#)\n }\n If(#message_notification_header# == \"\"){\n SetVar(thread_name, $@1message_subject_empty$)\n }.Else{\n SetVar(thread_name, #message_notification_header#)\n }\n\n SetTitle($@1messenger$)\n Span(Class: h5 m0 ml-lg){\n LinkPage(Class: ml-sm, Body: $@1messenger$, Page: @1messages_list)\n Span(Class: text-muted mh, Body: /)\n Span(Class: text-muted, Body: $@1message_view$)\n }.Style(\n display: inline-block;\n )\n\n Form(){\n Div(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(text-center pt){\n If(#message_sender_member_id# == #key_id#){\n Span(Class: h4 text-bold, Body: LangRes(@1message_from_you))\n }.Else{\n Span(Class: h4 text-bold, Body: LangRes(@1message_from) #message_sender_member_name#)\n }\n }\n Div(panel-body pt pb){\n Div(list-group-item wrapper-block){\n Div(avatar-block text-center){\n LinkPage(Page: @1profile_view, PageParams: \"v_key_id=#message_sender_member_id#\"){\n If(#message_sender_image_id# > 0){\n Image(Src: Binary().ById(#message_sender_image_id#), Class: img-circle avatar)\n }.Else{\n Span(Class: fa icon-user fa-3x)\n }\n Div(preview m0 h5){#message_sender_member_name#}\n }\n }\n Div(message-block){\n Span(Class: h5, Body: #message_notification_body#)\n }\n Div(datetime-block text-muted){\n Span(Class: mb-sm h6, Body: DateTime(#message_date_created#,HH:MI DD.MM.YYYY))\n }\n }\n Div(row mt-lg){\n Div(col-md-12 text-left){\n Label(){\n If(#message_sender_member_id# != #key_id#){\n Span(Body: LangRes(@1reply_text))\n }.Else{\n Span(Body: LangRes(@1message_text))\n }\n }\n Input(Type: Hidden, Name: MemberId, Value: \"#reply_recipient#\")\n Input(Type: Hidden, Name: EcosystemId, Value: \"#ecosystem_id#\")\n Input(Type: Hidden, Name: Sender, Value: \"1\")\n Input(Type: Hidden, Name: Icon, Value: \"icon-speech\")\n Input(Type: Hidden, Name: Params, Value: `{\"type\":\"message\",\"thread\":\"#thread#\"}`)\n Input(Type: Hidden, Name: Page, Value: \"@1message_view\")\n Input(Type: Hidden, Name: Header, Value: \"#thread_name#\")\n Input(Type: textarea, Name: Body, Value: \"\", Placeholder: $@1message_type_here$).Style(resize: vertical; min-height: 6em;)\n }\n }\n If(#message_sender_member_id# == #key_id#){\n SetVar(send_button, $@1send$)\n }.Else{\n SetVar(send_button, $@1reply$)\n }\n If(And(#message_closed# == 0, Or(#message_sender_member_id# != #key_id#, #message_recipient_member_id# == #key_id#))){\n Div(mt text-right){\n Button(Body: LangRes(@1mark_read), Class: btn btn-default, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\", Page: @1messages_list)\n Button(Body: #send_button#, Class: btn btn-primary, Contract: @1NotificationsSend, Params: \"CurrentRid=#role_id#\", Page: @1message_view, PageParams: \"notific_id=#message_id#\").CompositeContract(@1NotificationsClose, [{\"NotificId\": #notific_id#}])\n }\n }.Else{\n Div(mt text-right){\n Button(Body: #send_button#, Class: btn btn-primary, Contract: @1NotificationsSend, Params: \"CurrentRid=#role_id#\", Page: @1message_view, PageParams: \"notific_id=#message_id#\")\n }\n }\n }\n }\n }\n }\n If(#thread_quantity# > 0){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Div(list-group-item text-center){\n Span(Class: h4 text-bold, Body: #thread_name#)\n }\n Div(list-group-item wrapper-block){\n Div(avatar-block text-center){\n LinkPage(Page: @1profile_view, PageParams: \"v_key_id=#init_message_sender_member_id#\"){\n If(#init_message_sender_image_id# > 0){\n Image(Src: Binary().ById(#init_message_sender_image_id#), Class: img-circle avatar)\n }.Else{\n Span(Class: fa icon-user fa-3x)\n }\n Div(preview m0 h5){#init_message_sender_member_name#}\n }\n }\n Div(message-block){\n Span(Class: h5, Body: #init_message_notification_body#)\n }\n Div(datetime-block text-muted){\n Span(Class: badge mr, Body: 1)\n Span(Class: mb-sm h6, Body: DateTime(#init_message_date_created#,HH:MI DD.MM.YYYY))\n }\n }\n ForList(src_thread){\n Div(list-group-item wrapper-block){\n Div(avatar-block text-center){\n DBFind(@1members).Where({\"ecosystem\": #ecosystem_id#, \"id\": #sender.member_id#}).Vars(thread_message)\n If(#thread_message_id# == \"\"){\n SetVar(thread_message_member_name, #sender.member_name#)\n SetVar(thread_message_image_id, #sender.image_id#)\n }\n LinkPage(Page: @1profile_view, PageParams: \"v_key_id=#sender.member_id#\"){\n If(#thread_message_image_id# > 0){\n Image(Src: Binary().ById(#thread_message_image_id#), Class: img-circle avatar)\n }.Else{\n Span(Class: fa icon-user fa-3x)\n }\n Div(preview m0 h5){#thread_message_member_name#}\n }\n }\n Div(message-block){\n Span(Class: h5, Body: #notification.body#)\n }\n Div(datetime-block text-muted){\n Span(Class: badge mr, Body: Calculate(#src_thread_index# + 1))\n Span(Class: mb-sm h6, Body: DateTime(#date_created#, HH:MI DD.MM.YYYY))\n }\n }\n }\n }\n }\n }\n }\n }.Style(\n .preview {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n .wrapper-block {min-height: 80px;}\n .avatar-block {\n position: absolute;\n width: 70px;\n }\n .message-block {\n margin-left: 85px;\n margin-bottom: 15px;\n }\n .datetime-block {\n position: absolute;\n bottom: 5px;\n right: 10px;\n }\n .avatar {\n max-width: 42px;\n max-height: 42px;\n border: 1px solid #bbb;\n }\n .badge {margin-top: -2px;}\n )\n}.Else{\n Div(col-md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n}", + "Value": "If(#notific_id# > 0){\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#notific_id#\"}).Columns(\"id,sender->account,sender->member_name,sender->image_id,recipient->account,recipient->member_name,notification->body,notification->header,page_params->thread,date_created,closed\").Vars(message)\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#message_sender_account#\"}).Vars(highlighted)\n If(#highlighted_account#){\n SetVar(message_sender_member_name, #highlighted_member_name#)\n SetVar(message_sender_image_id, #highlighted_image_id#)\n }\n\n If(#message_page_params_thread# > 0){\n SetVar(thread, #message_page_params_thread#)\n DBFind(\"@1notifications\",src_thread).Where({\"ecosystem\": \"#ecosystem_id#\", \"page_params->thread\": \"#message_page_params_thread#\"}).Order(\"id\").Count(\"thread_quantity\").Columns(\"id,sender->account,sender->member_name,sender->image_id,notification->body,date_created\")\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#message_page_params_thread#\"}).Columns(\"id,sender->account,sender->member_name,sender->image_id,recipient->account,notification->body,date_created\").Vars(init_message)\n }.Else{\n SetVar(thread, #message_id#)\n DBFind(\"@1notifications\",src_thread).Where({\"ecosystem\": \"#ecosystem_id#\", \"page_params->thread\": \"#message_id#\"}).Order(\"id\").Count(\"thread_quantity\").Columns(\"id,sender->account,sender->member_name,sender->image_id,notification->body,date_created\")\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#message_id#\"}).Columns(\"id,sender->account,sender->member_name,sender->image_id,recipient->account,notification->body,date_created\").Vars(init_message)\n }\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#init_message_sender_account#\"}).Vars(starter)\n If(#starter_account#){\n SetVar(init_message_sender_member_name, #starter_member_name#)\n SetVar(init_message_sender_image_id, #starter_image_id#)\n }\n\n If(#init_message_sender_account# != #account_id#){\n SetVar(reply_recipient, #init_message_sender_account#)\n }.Else{\n SetVar(reply_recipient, #init_message_recipient_account#)\n }\n If(#message_notification_header# == \"\"){\n SetVar(thread_name, $@1message_subject_empty$)\n }.Else{\n SetVar(thread_name, #message_notification_header#)\n }\n\n SetTitle($@1messenger$)\n Span(Class: h5 m0 ml-lg){\n LinkPage(Class: ml-sm, Body: $@1messenger$, Page: @1messages_list)\n Span(Class: text-muted mh, Body: /)\n Span(Class: text-muted, Body: $@1message_view$)\n }.Style(\n display: inline-block;\n )\n\n Form(){\n Div(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(text-center pt){\n If(#message_sender_account# == #account_id#){\n Span(Class: h4 text-bold, Body: LangRes(@1message_from_you))\n }.Else{\n Span(Class: h4 text-bold, Body: LangRes(@1message_from) #message_sender_member_name#)\n }\n }\n Div(panel-body pt pb){\n Div(list-group-item wrapper-block){\n Div(avatar-block text-center){\n LinkPage(Page: @1profile_view, PageParams: \"v_account=#message_sender_account#\"){\n If(#message_sender_image_id# > 0){\n Image(Src: Binary().ById(#message_sender_image_id#), Class: img-circle avatar)\n }.Else{\n Span(Class: fa icon-user fa-3x)\n }\n Div(preview m0 h5){#message_sender_member_name#}\n }\n }\n Div(message-block){\n Span(Class: h5, Body: #message_notification_body#)\n }\n Div(datetime-block text-muted){\n Span(Class: mb-sm h6, Body: DateTime(#message_date_created#,HH:MI DD.MM.YYYY))\n }\n }\n Div(row mt-lg){\n Div(col-md-12 text-left){\n Label(){\n If(#message_sender_account# != #account_id#){\n Span(Body: LangRes(@1reply_text))\n }.Else{\n Span(Body: LangRes(@1message_text))\n }\n }\n Input(Type: Hidden, Name: MemberAccount, Value: \"#reply_recipient#\")\n Input(Type: Hidden, Name: EcosystemId, Value: \"#ecosystem_id#\")\n Input(Type: Hidden, Name: Sender, Value: \"1\")\n Input(Type: Hidden, Name: Icon, Value: \"icon-speech\")\n Input(Type: Hidden, Name: Params, Value: `{\"type\":\"message\",\"thread\":\"#thread#\"}`)\n Input(Type: Hidden, Name: Page, Value: \"@1message_view\")\n Input(Type: Hidden, Name: Header, Value: \"#thread_name#\")\n Input(Type: textarea, Name: Body, Value: \"\", Placeholder: $@1message_type_here$).Style(resize: vertical; min-height: 6em;)\n }\n }\n If(#message_sender_account# == #account_id#){\n SetVar(send_button, $@1send$)\n }.Else{\n SetVar(send_button, $@1reply$)\n }\n If(And(#message_closed# == 0, Or(#message_sender_account# != #account_id#, #message_recipient_account# == #account_id#))){\n Div(mt text-right){\n Button(Body: LangRes(@1mark_read), Class: btn btn-default, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\", Page: @1messages_list)\n Button(Body: #send_button#, Class: btn btn-primary, Contract: @1NotificationsSend, Params: \"CurrentRid=#role_id#\", Page: @1message_view, PageParams: \"notific_id=#message_id#\").CompositeContract(@1NotificationsClose, [{\"NotificId\": #notific_id#}])\n }\n }.Else{\n Div(mt text-right){\n Button(Body: #send_button#, Class: btn btn-primary, Contract: @1NotificationsSend, Params: \"CurrentRid=#role_id#\", Page: @1message_view, PageParams: \"notific_id=#message_id#\")\n }\n }\n }\n }\n }\n }\n If(#thread_quantity# > 0){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Div(list-group-item text-center){\n Span(Class: h4 text-bold, Body: #thread_name#)\n }\n Div(list-group-item wrapper-block){\n Div(avatar-block text-center){\n LinkPage(Page: @1profile_view, PageParams: \"v_account=#init_message_sender_account#\"){\n If(#init_message_sender_image_id# > 0){\n Image(Src: Binary().ById(#init_message_sender_image_id#), Class: img-circle avatar)\n }.Else{\n Span(Class: fa icon-user fa-3x)\n }\n Div(preview m0 h5){#init_message_sender_member_name#}\n }\n }\n Div(message-block){\n Span(Class: h5, Body: #init_message_notification_body#)\n }\n Div(datetime-block text-muted){\n Span(Class: badge mr, Body: 1)\n Span(Class: mb-sm h6, Body: DateTime(#init_message_date_created#,HH:MI DD.MM.YYYY))\n }\n }\n ForList(src_thread){\n Div(list-group-item wrapper-block){\n Div(avatar-block text-center){\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#sender.account#\"}).Vars(thread_message)\n If(#thread_message_account# == \"\"){\n SetVar(thread_message_member_name, #sender.member_name#)\n SetVar(thread_message_image_id, #sender.image_id#)\n }\n LinkPage(Page: @1profile_view, PageParams: \"v_account=#sender.account#\"){\n If(#thread_message_image_id# > 0){\n Image(Src: Binary().ById(#thread_message_image_id#), Class: img-circle avatar)\n }.Else{\n Span(Class: fa icon-user fa-3x)\n }\n Div(preview m0 h5){#thread_message_member_name#}\n }\n }\n Div(message-block){\n Span(Class: h5, Body: #notification.body#)\n }\n Div(datetime-block text-muted){\n Span(Class: badge mr, Body: Calculate(#src_thread_index# + 1))\n Span(Class: mb-sm h6, Body: DateTime(#date_created#, HH:MI DD.MM.YYYY))\n }\n }\n }\n }\n }\n }\n }\n }.Style(\n .preview {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n .wrapper-block {min-height: 80px;}\n .avatar-block {\n position: absolute;\n width: 70px;\n }\n .message-block {\n margin-left: 85px;\n margin-bottom: 15px;\n }\n .datetime-block {\n position: absolute;\n bottom: 5px;\n right: 10px;\n }\n .avatar {\n max-width: 42px;\n max-height: 42px;\n border: 1px solid #bbb;\n }\n .badge {margin-top: -2px;}\n )\n}.Else{\n Div(col-md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "messages_list", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1notifications,threads).Where({\"ecosystem\": #ecosystem_id#, \"page_params->type\": \"message\", {\"$or\": [{\"sender->member_id\": #key_id#}, {\"recipient->member_id\": #key_id#}]}}).Order({\"id\":\"-1\"}).Limit(250).Count(threads_count).Columns(\"id,sender->member_id,sender->member_name,sender->image_id,recipient->member_id,recipient->member_name,notification->body,notification->header,page_params->thread,date_created,closed\")\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Div(list-group-item text-center p0){\n Span(Class: h4 text-bold vc, Body: LangRes(@1message_active_threads))\n Button(Class: btn-xs btn-link plus-button p0 b0, Page: @1message_create){\n Span(Class: fa fa-2x icon-plus vc)\n }.Popup(50, $@1message_create$)\n }.Style(\n .plus-button {\n position: absolute;\n right: 10px;\n }\n )\n If(#threads_count# > 0){\n ForList(threads){\n If(#page_params.thread# > 0){\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"page_params->thread\": #page_params.thread#}).Order({\"id\":\"-1\"}).Limit(1).Columns(\"id\").Vars(last)\n }.Else{\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"page_params->thread\": #id#}).Count(thread_depth)\n }\n If(Or(#id# == #last_id#, #thread_depth# == 0)){\n If(And(#closed# == 0, Or(#sender.member_id# != #key_id#, #recipient.member_id# == #key_id#))){\n SetVar(status, \"unread\")\n }.Else{\n SetVar(status, \"read\")\n }\n Div(list-group-item col-sm-12 thread-block #status#){\n Div(avatar-block text-center){\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"id\": #id#}).Columns(\"sender->member_id,recipient->member_id,sender->member_name,recipient->member_name,sender->image_id,recipient->image_id\").Vars(init_message)\n If(#init_message_sender_member_id# != #key_id#){\n DBFind(@1members).Where({\"ecosystem\": #ecosystem_id#, \"id\": #init_message_sender_member_id#}).Vars(talker)\n If(#talker_id#){\n SetVar(talker_name, #talker_member_name#)\n SetVar(talker_picture, #talker_image_id#)\n }.Else{\n SetVar(talker_id, #init_message_sender_member_id#)\n SetVar(talker_name, #init_message_sender_member_name#)\n SetVar(talker_picture, #init_message_sender_image_id#)\n }\n }.Else{\n DBFind(@1members).Where({\"ecosystem\": #ecosystem_id#, \"id\": #init_message_recipient_member_id#}).Vars(talker)\n If(#talker_id#){\n SetVar(talker_name, #talker_member_name#)\n SetVar(talker_picture, #talker_image_id#)\n }.Else{\n SetVar(talker_id, #init_message_recipient_member_id#)\n SetVar(talker_name, #init_message_recipient_member_name#)\n SetVar(talker_picture, #init_message_recipient_image_id#)\n }\n }\n LinkPage(Page: @1profile_view, PageParams: \"v_key_id=#talker_id#\"){\n If(#talker_picture# > 0){\n Image(Src: Binary().ById(#talker_picture#), Class: img-circle avatar)\n }.Else{\n Span(Class: fa icon-user fa-3x)\n }\n Div(preview m0 h5){#talker_name#}\n }\n }\n Div(message-block){\n LinkPage(Page: @1message_view, PageParams: \"notific_id=#id#\"){\n If(#notification.header# == \"\"){\n Div(Class: preview h4 m0, Body: LangRes(@1message_subject_empty))\n }.Else{\n Div(Class: preview h4 m0, Body: #notification.header#)\n }\n If(#sender.member_id# == #key_id#){\n Div(Class: preview text-muted, Body: $@1you$: #notification.body#)\n }.Else{\n Div(Class: preview text-muted, Body: #notification.body#)\n }\n }\n }\n Div(datetime-block text-muted){\n If(#status# == \"unread\"){\n Span(Class: badge mr, Body: LangRes(@1unread))\n }\n Span(Class: h6, Body: DateTime(#date_created#, HH:MI DD.MM.YYYY))\n }\n }\n }\n }\n }.Else{\n Div(list-group-item text-center text-muted){\n $@1messages_empty$\n }\n }\n }\n }.Style(\n .thread-block {height: 80px;}\n .avatar-block {\n position: absolute;\n width: 70px;\n }\n .message-block {margin-left: 85px;}\n .datetime-block {\n position: absolute;\n bottom: 5px;\n right: 10px;\n }\n .preview {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n .avatar {\n max-width: 42px;\n max-height: 42px;\n border: 1px solid #bbb;\n }\n .badge {margin-top: -2px;}\n .unread {background-color: #f7fafe;}\n .vc {line-height: 44px;}\n )\n}", + "Value": "DBFind(\"@1notifications\",threads).Where({\"ecosystem\": \"#ecosystem_id#\", \"page_params->type\": \"message\", \"$or\": [{\"sender->account\": \"#account_id#\"}, {\"recipient->account\": \"#account_id#\"}]}).Order({\"id\": \"-1\"}).Limit(250).Count(threads_count).Columns(\"id,sender->account,sender->member_name,sender->image_id,recipient->account,recipient->member_name,notification->body,notification->header,page_params->thread,date_created,closed\")\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Div(list-group-item text-center p0){\n Span(Class: h4 text-bold vc, Body: LangRes(@1message_active_threads))\n Button(Class: btn-xs btn-link plus-button p0 b0, Page: @1message_create){\n Span(Class: fa fa-2x icon-plus vc)\n }.Popup(50, $@1message_create$)\n }.Style(\n .plus-button {\n position: absolute;\n right: 10px;\n }\n )\n If(#threads_count# > 0){\n ForList(threads){\n If(#page_params.thread# > 0){\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"page_params->thread\": \"#page_params.thread#\"}).Order({\"id\": \"-1\"}).Limit(1).Columns(\"id\").Vars(last)\n }.Else{\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"page_params->thread\": \"#id#\"}).Count(thread_depth)\n }\n If(Or(#id# == #last_id#, #thread_depth# == 0)){\n If(And(#closed# == 0, Or(#sender.account# != #account_id#, #recipient.account# == #account_id#))){\n SetVar(status, \"unread\")\n }.Else{\n SetVar(status, \"read\")\n }\n Div(list-group-item col-sm-12 thread-block #status#){\n Div(avatar-block text-center){\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#id#\"}).Columns(\"sender->account,recipient->account,sender->member_name,recipient->member_name,sender->image_id,recipient->image_id\").Vars(init_message)\n If(#init_message_sender_account# != #account_id#){\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#init_message_sender_account#\"}).Vars(talker)\n If(#talker_account#){\n SetVar(talker_name, #talker_member_name#)\n SetVar(talker_picture, #talker_image_id#)\n }.Else{\n SetVar(talker_account, #init_message_sender_account#)\n SetVar(talker_name, #init_message_sender_member_name#)\n SetVar(talker_picture, #init_message_sender_image_id#)\n }\n }.Else{\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#init_message_recipient_account#\"}).Vars(talker)\n If(#talker_account#){\n SetVar(talker_name, #talker_member_name#)\n SetVar(talker_picture, #talker_image_id#)\n }.Else{\n SetVar(talker_account, #init_message_recipient_account#)\n SetVar(talker_name, #init_message_recipient_member_name#)\n SetVar(talker_picture, #init_message_recipient_image_id#)\n }\n }\n LinkPage(Page: @1profile_view, PageParams: \"v_account=#talker_account#\"){\n If(#talker_picture# > 0){\n Image(Src: Binary().ById(#talker_picture#), Class: img-circle avatar)\n }.Else{\n Span(Class: fa icon-user fa-3x)\n }\n Div(preview m0 h5){#talker_name#}\n }\n }\n Div(message-block){\n LinkPage(Page: @1message_view, PageParams: \"notific_id=#id#\"){\n If(#notification.header# == \"\"){\n Div(Class: preview h4 m0, Body: LangRes(@1message_subject_empty))\n }.Else{\n Div(Class: preview h4 m0, Body: #notification.header#)\n }\n If(#sender.account# == #account_id#){\n Div(Class: preview text-muted, Body: $@1you$: #notification.body#)\n }.Else{\n Div(Class: preview text-muted, Body: #notification.body#)\n }\n }\n }\n Div(datetime-block text-muted){\n If(#status# == \"unread\"){\n Span(Class: badge mr, Body: LangRes(@1unread))\n }\n Span(Class: h6, Body: DateTime(#date_created#, HH:MI DD.MM.YYYY))\n }\n }\n }\n }\n }.Else{\n Div(list-group-item text-center text-muted){\n $@1messages_empty$\n }\n }\n }\n }.Style(\n .thread-block {height: 80px;}\n .avatar-block {\n position: absolute;\n width: 70px;\n }\n .message-block {margin-left: 85px;}\n .datetime-block {\n position: absolute;\n bottom: 5px;\n right: 10px;\n }\n .preview {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n .avatar {\n max-width: 42px;\n max-height: 42px;\n border: 1px solid #bbb;\n }\n .badge {margin-top: -2px;}\n .unread {background-color: #f7fafe;}\n .vc {line-height: 44px;}\n )\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "notifications", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1notifications,notification_singles).Where({\"ecosystem\": #ecosystem_id#, \"closed\": 0, \"notification->type\": 1, \"recipient->member_id\": #key_id#}).Columns(\"id,page_name,notification->icon,notification->header,notification->popup,notification->body\").Count(count_singles)\n\nDBFind(@1notifications,notification_roles).Where({\"ecosystem\": #ecosystem_id#, \"closed\": 0, \"notification->type\": 2, \"recipient->role_id\": #role_id#, {\"$or\": [{\"date_start_processing\": 0}, {\"processing_info->member_id\": #key_id#}]}}).Columns(\"id,page_name,notification->icon,notification->header,notification->popup,notification->body,recipient->role_id\").Count(count_current_role)\n\nSetVar(limit,10).(limit_count,#limit#)\nSetVar(remaining,Calculate(#count_singles#+#count_current_role#-#limit#))\n\nIf(And(#limit_count#>0,#count_singles#>0)){\n ForList(notification_singles){\n If(#limit_count#>0){\n SetVar(limit_count,Calculate(#limit_count#-1))\n If(#notification.popup#==1){\n Div(list-group-item){\n Button(Class: btn-link m0 p0 b0 text-left vm, Page: #page_name#, PageParams: \"notific_id=#id#\"){\n Div(media-box clearfix){\n Div(pull-left){\n Em(Class: fa #notification.icon# fa-1x text-primary)\n }\n Div(media-box-body){\n Div(Class: m0 text-normal h6, Body: #notification.header#)\n Div(Class: m0 text-muted h6, Body: #notification.body#)\n }\n }\n }.Popup(Header: $@1notifications_view$, Width: \"40\")\n }.Style(.vm{vertical-align: middle;})\n }.Else{\n Div(list-group-item){\n Button(Class: btn-link m0 p0 b0 text-left vm, Page: #page_name#, PageParams: \"notific_id=#id#\"){\n Div(media-box clearfix){\n Div(pull-left){\n Em(Class: fa #notification.icon# fa-1x text-primary)\n }\n Div(media-box-body){\n Div(Class: m0 text-normal h6, Body: #notification.header#)\n Div(Class: m0 text-muted h6, Body: #notification.body#)\n }\n }\n }\n }.Style(.vm{vertical-align: middle;})\n }\n }\n }\n}\n\nIf(And(#limit_count#>0,#count_current_role#>0)){\n DBFind(@1roles).Where({\"ecosystem\": #ecosystem_id#, \"id\": #role_id#}).Columns(\"role_name\").Vars(role)\n Div(dropdown-heading b0){\n $@1role_notifics$ (#role_role_name#)\n }\n ForList(notification_roles){\n If(#limit_count#>0){\n SetVar(limit_count,Calculate(#limit_count#-1))\n If(#notification.popup#==1){\n Div(list-group-item){\n Button(Class: btn-link m0 p0 b0 text-left vm, Page: #page_name#, PageParams: \"notific_id=#id#\"){\n Div(media-box clearfix){\n Div(pull-left){\n Em(Class: fa #notification.icon# fa-1x text-primary)\n }\n Div(media-box-body){\n Div(Class: m0 text-normal h6, Body: #notification.header#)\n Div(Class: m0 text-muted h6, Body: #notification.body#)\n }\n }\n }.Popup(Header: $@1notifications_view$, Width: \"40\")\n }.Style(.vm{vertical-align: middle;})\n }.Else{\n Div(list-group-item){\n Button(Class: btn-link m0 p0 b0 text-left vm, Page: #page_name#, PageParams: \"notific_id=#id#\"){\n Div(media-box clearfix){\n Div(pull-left){\n Em(Class: fa #notification.icon# fa-1x text-primary)\n }\n Div(media-box-body){\n Div(Class: m0 text-normal h6, Body: #notification.header#)\n Div(Class: m0 text-muted h6, Body: #notification.body#)\n }\n }\n }\n }.Style(.vm{vertical-align: middle;})\n }\n }\n }\n}\n\nIf(#remaining#>0){\n Button(Class: btn btn-block btn-default, Page: @1notifications_list){\n $@1notifications_show_all$ (#remaining# $@1more$)\n }\n}", + "Value": "DBFind(\"@1notifications\",notification_singles).Where({\"ecosystem\": \"#ecosystem_id#\", \"closed\": 0, \"notification->type\": 1, \"recipient->account\": \"#account_id#\"}).Columns(\"id,page_name,notification->icon,notification->header,notification->popup,notification->body\").Count(count_singles)\n\nDBFind(\"@1notifications\",notification_roles).Where({\"ecosystem\": \"#ecosystem_id#\", \"closed\": 0, \"notification->type\": 2, \"recipient->role_id\": \"#role_id#\", \"$or\": [{\"date_start_processing\": 0}, {\"processing_info->account\": \"#account_id#\"}]}).Columns(\"id,page_name,notification->icon,notification->header,notification->popup,notification->body,recipient->role_id\").Count(count_current_role)\n\nSetVar(limit,10).(limit_count,#limit#)\nSetVar(remaining,Calculate(#count_singles#+#count_current_role#-#limit#))\n\nIf(And(#limit_count#>0,#count_singles#>0)){\n ForList(notification_singles){\n If(#limit_count#>0){\n SetVar(limit_count,Calculate(#limit_count#-1))\n If(#notification.popup#==1){\n Div(list-group-item){\n Button(Class: btn-link m0 p0 b0 text-left vm, Page: #page_name#, PageParams: \"notific_id=#id#\"){\n Div(media-box clearfix){\n Div(pull-left){\n Em(Class: fa #notification.icon# fa-1x text-primary)\n }\n Div(media-box-body){\n Div(Class: m0 text-normal h6, Body: #notification.header#)\n Div(Class: m0 text-muted h6, Body: #notification.body#)\n }\n }\n }.Popup(Header: $@1notifications_view$, Width: \"40\")\n }.Style(.vm{vertical-align: middle;})\n }.Else{\n Div(list-group-item){\n Button(Class: btn-link m0 p0 b0 text-left vm, Page: #page_name#, PageParams: \"notific_id=#id#\"){\n Div(media-box clearfix){\n Div(pull-left){\n Em(Class: fa #notification.icon# fa-1x text-primary)\n }\n Div(media-box-body){\n Div(Class: m0 text-normal h6, Body: #notification.header#)\n Div(Class: m0 text-muted h6, Body: #notification.body#)\n }\n }\n }\n }.Style(.vm{vertical-align: middle;})\n }\n }\n }\n}\n\nIf(And(#limit_count#>0,#count_current_role#>0)){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#role_id#\"}).Columns(\"role_name\").Vars(role)\n Div(dropdown-heading b0){\n $@1role_notifics$ (#role_role_name#)\n }\n ForList(notification_roles){\n If(#limit_count#>0){\n SetVar(limit_count,Calculate(#limit_count#-1))\n If(#notification.popup#==1){\n Div(list-group-item){\n Button(Class: btn-link m0 p0 b0 text-left vm, Page: #page_name#, PageParams: \"notific_id=#id#\"){\n Div(media-box clearfix){\n Div(pull-left){\n Em(Class: fa #notification.icon# fa-1x text-primary)\n }\n Div(media-box-body){\n Div(Class: m0 text-normal h6, Body: #notification.header#)\n Div(Class: m0 text-muted h6, Body: #notification.body#)\n }\n }\n }.Popup(Header: $@1notifications_view$, Width: \"40\")\n }.Style(.vm{vertical-align: middle;})\n }.Else{\n Div(list-group-item){\n Button(Class: btn-link m0 p0 b0 text-left vm, Page: #page_name#, PageParams: \"notific_id=#id#\"){\n Div(media-box clearfix){\n Div(pull-left){\n Em(Class: fa #notification.icon# fa-1x text-primary)\n }\n Div(media-box-body){\n Div(Class: m0 text-normal h6, Body: #notification.header#)\n Div(Class: m0 text-muted h6, Body: #notification.body#)\n }\n }\n }\n }.Style(.vm{vertical-align: middle;})\n }\n }\n }\n}\n\nIf(#remaining#>0){\n Button(Class: btn btn-block btn-default, Page: @1notifications_list){\n $@1notifications_show_all$ (#remaining# $@1more$)\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "notifications_broadcast", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"System\"}).Vars(\"system_app\")\nSetVar(role_admin, AppParam(App: #system_app_id#, Name: \"role_admin\"))\nDBFind(@1ecosystems).Count(ecos_count)\nForm(){\n If(And(#role_id# == #role_admin#, #ecosystem_id# == 1, #ecos_count# > 1)){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1recipient)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Value: $@1ecosystems_administrators$, Disabled: true)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1header)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Header)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1body_text)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Body, Type: textarea).Style(resize: vertical;)\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1popup))\n }\n }.Style(line-height: 18px;)\n Div(col-md-9 text-left){\n Input(Name: Popup, Type: checkbox, Value: false, Class: mt-sm)\n }\n }\n }.Else{\n Div(col-sm-12 alert alert-warning text-center){\n If(#role_id# != #role_admin#){\n LangRes(@1only_admin_action)\n }\n If(#ecosystem_id#!=1){\n LangRes(@1only_first_ecosystem_action)\n }\n If(#ecos_count#==1){\n LangRes(@1other_ecosystems_not_found)\n }\n }\n }\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right mt, Page: @1notifications_list, Contract: @1NotificationsBroadcast, Params: \"RoleId=#role_id#\")\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1notifications_list)\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(system_app)\nSetVar(role_admin, AppParam(App: #system_app_id#, Name: \"role_admin\"))\nDBFind(\"@1ecosystems\").Count(ecos_count)\nForm(){\n If(And(#role_id# == #role_admin#, #ecosystem_id# == 1, #ecos_count# > 1)){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1recipient)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Value: $@1ecosystems_administrators$, Disabled: true)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1header)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Header)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1body_text)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Body, Type: textarea).Style(resize: vertical;)\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1popup))\n }\n }.Style(line-height: 18px;)\n Div(col-md-9 text-left){\n Input(Name: Popup, Type: checkbox, Value: false, Class: mt-sm)\n }\n }\n }.Else{\n Div(col-sm-12 alert alert-warning text-center){\n If(#role_id# != #role_admin#){\n LangRes(@1only_admin_action)\n }\n If(#ecosystem_id#!=1){\n LangRes(@1only_first_ecosystem_action)\n }\n If(#ecos_count#==1){\n LangRes(@1other_ecosystems_not_found)\n }\n }\n }\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right mt, Page: @1notifications_list, Contract: @1NotificationsBroadcast, Params: \"RoleId=#role_id#\")\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1notifications_list)\n}", "Menu": "default_menu", "Type": "pages" }, @@ -416,307 +437,286 @@ { "Name": "notifications_roles_send", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page,@1notifications_roles_send).(back_page,@1notifications_list)\nDBFind(@1applications).Columns(\"name,id\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Vars(application)\n\nIf(#EcosystemId# == \"\"){\n SetVar(EcosystemId, #ecosystem_id#)\n}\n\nForm(){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1ecosystem)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: EcosystemId, Type:hidden, Value: #EcosystemId#)\n Div(input-group){\n DBFind(@1ecosystems).Columns(\"id,name\").WhereId(#EcosystemId#).Vars(e)\n Input(Name: e_name, Disabled: 1, Value: #e_name#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_ecosystem, PageParams:\"back_page=#this_page#,back_header=$@1send$,EcosystemId=#EcosystemId#,Type=ALL_LIST\").Popup(Header: $@1ecosystem$, Width: \"40\")\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n )\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1recipient)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n DBFind(@1roles,source_roles).Where({\"ecosystem\": #EcosystemId#, \"deleted\": 0}).Columns(\"id,role_name\").Count(roles_count)\n If(#roles_count#>0){\n Select(Name: Rid, Source: source_roles, NameColumn: role_name, ValueColumn: id)\n }.Else{\n Div(mt-sm){\n $@1roles$ $@1not_founded$\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1closure_type)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n AppParam(Ecosystem: 1, App: #application_id#, Name: notification_closure, Source: src_closure_type)\n Select(Name: Closure, Source: src_closure_type, NameColumn: name, ValueColumn: id)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1sender)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n AppParam(Ecosystem: 1, App: #application_id#, Name: notification_sender, Source: src_sender)\n Select(Name: Sender, Source: src_sender, NameColumn: name, ValueColumn: id)\n }\n }\n Div(row mt-lg){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1icon)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n AppParam(Ecosystem: 1, App: #application_id#, Name: notification_icon, Source: src_icon)\n Select(Name: Icon, Source: src_icon, NameColumn: name, ValueColumn: name)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1header)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Header, Value: \"Header text\").Validate(minLength:3, maxLength:255)\n InputErr(Name: Header, minLength: $@1validate_name$, maxLength: $@1validate_role_name$)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1body_text))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Body, Type: textarea, Value: \"Body text\").Style(resize: vertical;)\n }\n }\n Div(row mt-lg){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1page)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Page, Value: \"@1notifications_testpage\").Validate(minLength:3, maxLength:255)\n InputErr(Name: Page, minLength: $@1validate_name$, maxLength: $@1validate_role_name$)\n }.Show(\"Popup=false\")\n Div(col-md-9 text-left){\n Input(Name: PagePopup, Value: \"@1notifications_testpage_popup\").Validate(minLength:3, maxLength:255)\n InputErr(Name: PagePopup, minLength: $@1validate_name$, maxLength: $@1validate_role_name$)\n }.Show(\"Popup=true\")\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Params, Value: `{\"param_int\":\"10\",\"param_str\":\"my_string\"}`)\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1popup))\n }\n }.Style(line-height: 18px;)\n Div(col-md-9 text-left){\n Input(Name: Popup, Type: checkbox, Value: false, Class: mt-sm)\n }\n }\n Div(){\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right mt, Page: #back_page#, PageParams: \"type=1\", Contract: @1NotificationsSend, Params: \"CurrentRid=#role_id#,Page=Val(Page)\")\n }.Show(\"Popup=false\")\n Div(){\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right mt, Page: #back_page#, PageParams: \"type=1\", Contract: @1NotificationsSend, Params: \"CurrentRid=#role_id#,Page=Val(PagePopup)\")\n }.Show(\"Popup=true\")\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#, PageParams: \"type=1\")\n}", + "Value": "SetVar(this_page,@1notifications_roles_send).(back_page,@1notifications_list)\nDBFind(\"@1applications\").Columns(\"name,id\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Vars(application)\n\nIf(#EcosystemId# == \"\"){\n SetVar(EcosystemId, #ecosystem_id#)\n}\n\nForm(){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1ecosystem)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: EcosystemId, Type:hidden, Value: #EcosystemId#)\n Div(input-group){\n DBFind(\"@1ecosystems\").Columns(\"id,name\").WhereId(#EcosystemId#).Vars(e)\n Input(Name: e_name, Disabled: 1, Value: #e_name#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_ecosystem, PageParams:\"back_page=#this_page#,back_header=$@1send$,EcosystemId=#EcosystemId#,Type=ALL_LIST\").Popup(Header: $@1ecosystem$, Width: \"40\")\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n )\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1recipient)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n DBFind(\"@1roles\", source_roles).Where({\"ecosystem\": \"#EcosystemId#\", \"deleted\": 0}).Columns(\"id,role_name\").Count(roles_count)\n If(#roles_count#>0){\n Select(Name: Rid, Source: source_roles, NameColumn: role_name, ValueColumn: id)\n }.Else{\n Div(mt-sm){\n $@1roles$ $@1not_founded$\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1closure_type)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n AppParam(Ecosystem: 1, App: #application_id#, Name: notification_closure, Source: src_closure_type)\n Select(Name: Closure, Source: src_closure_type, NameColumn: name, ValueColumn: id)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1sender)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n AppParam(Ecosystem: 1, App: #application_id#, Name: notification_sender, Source: src_sender)\n Select(Name: Sender, Source: src_sender, NameColumn: name, ValueColumn: id)\n }\n }\n Div(row mt-lg){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1icon)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n AppParam(Ecosystem: 1, App: #application_id#, Name: notification_icon, Source: src_icon)\n Select(Name: Icon, Source: src_icon, NameColumn: name, ValueColumn: name)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1header)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Header, Value: \"Header text\").Validate(minLength:3, maxLength:255)\n InputErr(Name: Header, minLength: $@1validate_name$, maxLength: $@1validate_role_name$)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1body_text))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Body, Type: textarea, Value: \"Body text\").Style(resize: vertical;)\n }\n }\n Div(row mt-lg){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1page)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Page, Value: \"@1notifications_testpage\").Validate(minLength:3, maxLength:255)\n InputErr(Name: Page, minLength: $@1validate_name$, maxLength: $@1validate_role_name$)\n }.Show(\"Popup=false\")\n Div(col-md-9 text-left){\n Input(Name: PagePopup, Value: \"@1notifications_testpage_popup\").Validate(minLength:3, maxLength:255)\n InputErr(Name: PagePopup, minLength: $@1validate_name$, maxLength: $@1validate_role_name$)\n }.Show(\"Popup=true\")\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Params, Value: `{\"param_int\":\"10\",\"param_str\":\"my_string\"}`)\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1popup))\n }\n }.Style(line-height: 18px;)\n Div(col-md-9 text-left){\n Input(Name: Popup, Type: checkbox, Value: false, Class: mt-sm)\n }\n }\n Div(){\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right mt, Page: #back_page#, PageParams: \"type=1\", Contract: @1NotificationsSend, Params: \"CurrentRid=#role_id#,Page=Val(Page)\")\n }.Show(\"Popup=false\")\n Div(){\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right mt, Page: #back_page#, PageParams: \"type=1\", Contract: @1NotificationsSend, Params: \"CurrentRid=#role_id#,Page=Val(PagePopup)\")\n }.Show(\"Popup=true\")\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#, PageParams: \"type=1\")\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "notifications_show", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1applications).Columns(\"name,id\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Vars(application)\nSetTitle($@1notifications_view$)\n\nSetVar(type,0).(header,).(body,)\nDiv(content-wrapper){\n\n If(#notific_id#>0){\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"id\": #notific_id#}).Columns(\"id,sender->type,notification->header,notification->body,date_start_processing,closed\").Vars(note)\n SetVar(type,#note_sender_type#)\n SetVar(header,#note_notification_header#)\n SetVar(body,#note_notification_body#)\n\n\n Div(row){\n Div(col-md-6 col-md-offset-3){\n Form(panel panel-primary){\n Div(panel-heading text-center){\n #header#\n }\n Div(panel-body){\n #body#\n }\n Div(panel-footer text-right){\n If(#type# == 1){\n If(#note_closed# == 0){\n Button(Body: LangRes(@1ok), Class: btn btn-primary, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\", Page: @1default_page)\n }.Else{\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: @1default_page)\n }\n }.ElseIf(#type# == 2){\n If(#note_closed#==0){\n If(#note_date_start_processing#==\"\"){\n Button(Body: LangRes(@1ok), Class: btn btn-primary, Contract: @1NotificationsProcess, Params: \"NotificId=#notific_id#\", Page: @1notifications_show)\n }.Else{\n Button(Body: LangRes(@1close), Class: btn btn-primary, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\", Page: @1default_page)\n }\n }.Else{\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: @1default_page)\n }\n }\n }\n }\n }\n }\n }.Else{\n Div(md-12 alert alert-danger text-center){\n LangRes(@1attention)\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Columns(\"name,id\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Vars(application)\nSetTitle($@1notifications_view$)\n\nSetVar(type,0).(header,).(body,)\nDiv(content-wrapper){\n\n If(#notific_id#>0){\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#notific_id#\"}).Columns(\"id,sender->type,notification->header,notification->body,date_start_processing,closed\").Vars(note)\n SetVar(type,#note_sender_type#)\n SetVar(header,#note_notification_header#)\n SetVar(body,#note_notification_body#)\n\n\n Div(row){\n Div(col-md-6 col-md-offset-3){\n Form(panel panel-primary){\n Div(panel-heading text-center){\n #header#\n }\n Div(panel-body){\n #body#\n }\n Div(panel-footer text-right){\n If(#type# == 1){\n If(#note_closed# == 0){\n Button(Body: LangRes(@1ok), Class: btn btn-primary, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\", Page: @1default_page)\n }.Else{\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: @1default_page)\n }\n }.ElseIf(#type# == 2){\n If(#note_closed#==0){\n If(#note_date_start_processing#==\"\"){\n Button(Body: LangRes(@1ok), Class: btn btn-primary, Contract: @1NotificationsProcess, Params: \"NotificId=#notific_id#\", Page: @1notifications_show)\n }.Else{\n Button(Body: LangRes(@1close), Class: btn btn-primary, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\", Page: @1default_page)\n }\n }.Else{\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: @1default_page)\n }\n }\n }\n }\n }\n }\n }.Else{\n Div(md-12 alert alert-danger text-center){\n LangRes(@1attention)\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "notifications_single_send", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page,@1notifications_single_send).(back_page,@1notifications_list)\nDBFind(@1applications).Columns(\"name,id\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Vars(application)\n\nIf(#EcosystemId# == \"\"){\n SetVar(EcosystemId, #ecosystem_id#)\n}\n\nIf(#MemberId# == \"\"){\n SetVar(MemberId, 0)\n}\n\nIf(Or(#MemberId#>0,#MemberId#<0)){\n SetVar(AddressMemberId, Address(#MemberId#))\n}.Else{\n SetVar(AddressMemberId,)\n}\n\nForm(){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1ecosystem)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: EcosystemId, Type:hidden, Value: #EcosystemId#)\n Div(input-group){\n DBFind(@1ecosystems).Columns(\"id,name\").WhereId(#EcosystemId#).Vars(e)\n Input(Name: e_name, Disabled: 1, Value: #e_name#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_ecosystem, PageParams:\"back_page=#this_page#,back_header=$@1send$,EcosystemId=#EcosystemId#,Type=ALL_LIST\").Popup(Header: $@1ecosystem$, Width: \"40\")\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n )\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1recipient)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: MemberId, Type:hidden, Value: #MemberId#)\n Div(input-group){\n Input(Name: m_name, Disabled: 1, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\", Value: #AddressMemberId#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:\"back_page=#this_page#,back_header=$@1send$,EcosystemId=#EcosystemId#\").Popup(Header: $@1member$, Width: \"50\")\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n )\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1sender)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n AppParam(Ecosystem: 1, App: #application_id#, Name: notification_sender, Source: src_sender)\n Select(Name: Sender, Source: src_sender, NameColumn: name, ValueColumn: id)\n }\n }\n Div(row mt-lg){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1icon)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n AppParam(Ecosystem: 1, App: #application_id#, Name: notification_icon, Source: src_icon)\n Select(Name: Icon, Source: src_icon, NameColumn: name, ValueColumn: name)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1header)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Header, Value: \"Header text\").Validate(minLength:3, maxLength:255)\n InputErr(Name: Header, minLength: $@1validate_name$, maxLength: $@1validate_role_name$)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1body_text))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Body, Type: textarea, Value: \"Body text\").Style(resize: vertical;)\n }\n }\n Div(row mt-lg){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1page)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Page, Value: \"@1notifications_testpage\").Validate(minLength:3, maxLength:255)\n InputErr(Name: Page, minLength: $@1validate_name$, maxLength: $@1validate_role_name$)\n }.Show(\"Popup=false\")\n Div(col-md-9 text-left){\n Input(Name: PagePopup, Value: \"@1notifications_testpage_popup\").Validate(minLength:3, maxLength:255)\n InputErr(Name: PagePopup, minLength: $@1validate_name$, maxLength: $@1validate_role_name$)\n }.Show(\"Popup=true\")\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Params, Value: `{\"param_int\":\"10\",\"param_str\":\"my_string\"}`)\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1popup))\n }\n }.Style(line-height: 18px;)\n Div(col-md-9 text-left){\n Input(Name: Popup, Type: checkbox, Value: false, Class: mt-sm)\n }\n }\n Div(){\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right mt, Page: #back_page#, Contract: @1NotificationsSend, Params: \"CurrentRid=#role_id#,Page=Val(Page)\")\n }.Show(\"Popup=false\")\n Div(){\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right mt, Page: #back_page#, Contract: @1NotificationsSend, Params: \"CurrentRid=#role_id#,Page=Val(PagePopup)\")\n }.Show(\"Popup=true\")\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#)\n}", + "Value": "SetVar(this_page,@1notifications_single_send).(back_page,@1notifications_list)\nDBFind(\"@1applications\").Columns(\"name,id\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Vars(application)\n\nIf(#EcosystemId# == \"\"){\n SetVar(EcosystemId, #ecosystem_id#)\n}\nIf(#MemberAccount#){\n SetVar(MemberAccountInputValue, #MemberAccount#)\n}.Else{\n SetVar(MemberAccount, 0)\n SetVar(MemberAccountInputValue,)\n}\n\nForm(){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1ecosystem)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: EcosystemId, Type: hidden, Value: #EcosystemId#)\n Div(input-group){\n DBFind(\"@1ecosystems\").Columns(\"id,name\").WhereId(#EcosystemId#).Vars(e)\n Input(Name: e_name, Disabled: 1, Value: #e_name#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_ecosystem, PageParams:\"back_page=#this_page#,back_header=$@1send$,EcosystemId=#EcosystemId#,Type=ALL_LIST\").Popup(Header: $@1ecosystem$, Width: \"40\")\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n )\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1recipient)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: MemberAccount, Type: hidden, Value: #MemberAccount#)\n Div(input-group){\n Input(Name: m_name, Disabled: 1, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\", Value: #MemberAccountInputValue#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:\"back_page=#this_page#,back_header=$@1send$,EcosystemId=#EcosystemId#\").Popup(Header: $@1member$, Width: \"50\")\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n )\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1sender)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n AppParam(Ecosystem: 1, App: #application_id#, Name: notification_sender, Source: src_sender)\n Select(Name: Sender, Source: src_sender, NameColumn: name, ValueColumn: id)\n }\n }\n Div(row mt-lg){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1icon)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n AppParam(Ecosystem: 1, App: #application_id#, Name: notification_icon, Source: src_icon)\n Select(Name: Icon, Source: src_icon, NameColumn: name, ValueColumn: name)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1header)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Header, Value: \"Header text\").Validate(minLength:3, maxLength:255)\n InputErr(Name: Header, minLength: $@1validate_name$, maxLength: $@1validate_role_name$)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1body_text))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Body, Type: textarea, Value: \"Body text\").Style(resize: vertical;)\n }\n }\n Div(row mt-lg){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1page)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Page, Value: \"@1notifications_testpage\").Validate(minLength:3, maxLength:255)\n InputErr(Name: Page, minLength: $@1validate_name$, maxLength: $@1validate_role_name$)\n }.Show(\"Popup=false\")\n Div(col-md-9 text-left){\n Input(Name: PagePopup, Value: \"@1notifications_testpage_popup\").Validate(minLength:3, maxLength:255)\n InputErr(Name: PagePopup, minLength: $@1validate_name$, maxLength: $@1validate_role_name$)\n }.Show(\"Popup=true\")\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Params, Value: `{\"param_int\":\"10\",\"param_str\":\"my_string\"}`)\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1popup))\n }\n }.Style(line-height: 18px;)\n Div(col-md-9 text-left){\n Input(Name: Popup, Type: checkbox, Value: false, Class: mt-sm)\n }\n }\n Div(){\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right mt, Page: #back_page#, Contract: @1NotificationsSend, Params: \"CurrentRid=#role_id#,Page=Val(Page)\")\n }.Show(\"Popup=false\")\n Div(){\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right mt, Page: #back_page#, Contract: @1NotificationsSend, Params: \"CurrentRid=#role_id#,Page=Val(PagePopup)\")\n }.Show(\"Popup=true\")\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "notifications_testpage", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Div(content-wrapper){\n DBFind(@1applications).Columns(\"name,id\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Vars(application)\n\n If(#notific_id#>0){\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"id\": #notific_id#}).Columns(\"id,sender->type,notification->type,notification->header,notification->body,page_params->param_int,page_params->param_str,date_start_processing,closed\").Vars(prefix)\n SetVar(sender_type,#prefix_sender_type#).(notification_type,#prefix_notification_type#).(notific_header,#prefix_notification_header#).(notific_body,#prefix_notification_body#).(notific_val_int,#prefix_page_params_param_int#).(notific_val_str,#prefix_page_params_param_str#)\n }.Else{\n Div(md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n SetVar(notific_id,\"0\").SetVar(sender_type,\"0\").(notification_type,\"0\").(notific_header,\"null\").(notific_body,\"null\").(notific_val_int,\"null\").(notific_val_str,\"null\")\n }\n\n Div(row){\n Div(col-md-6 col-md-offset-3){\n Form(){\n Div(list-group-item text-center){\n Span(Class: h3, Body: #notific_header#)\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1id))\n }\n Div(col-md-6 mt-sm text-left){\n Span(Class: h4, Body: #notific_id#)\n }\n }\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1type))\n }\n Div(col-md-6 mt-sm text-left){\n If(#notification_type# > 0){\n Span(Class: h4, Body: AppParam(Ecosystem: 1, App:#application_id#, Name: notification_type, Index: #notification_type#))\n }.Else{\n Span(Class: h4, Body: #notification_type#)\n }\n }\n }\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1sender))\n }\n Div(col-md-6 mt-sm text-left){\n If(#sender_type# > 0){\n If(#sender_type# == 1){\n Span(Class: h4, Body: $@1member$)\n }\n If(#sender_type# == 2){\n Span(Class: h4, Body: $@1role$)\n }\n }.Else{\n Span(Class: h4, Body: #sender_type#)\n }\n }\n }\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1body_text))\n }\n Div(col-md-6 mt-sm text-left){\n Span(Class: h4, Body: #notific_body#)\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1value_number))\n }\n Div(col-md-6 mt-sm text-left){\n Span(Class: h4, Body: #notific_val_int#)\n }\n }\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1value_string))\n }\n Div(col-md-6 mt-sm text-left){\n Span(Class: h4, Body: #notific_val_str#)\n }\n }\n }\n Div(list-group-item text-right){\n If(#prefix_closed# == 0){\n If(#notification_type# == 1){\n Button(Body: LangRes(@1close), Class: btn btn-primary, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\", Page: @1notifications_list).Alert(Text: \"$@1want_close_notification$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }.ElseIf(#notification_type# == 2){\n If(#prefix_date_start_processing# == 0){\n Button(Body: LangRes(@1begin), Class: btn btn-primary, Contract: @1NotificationsProcess, Params: \"NotificId=#notific_id#\", Page: @1notifications_list, PageParams: \"type=1\").Alert(Text: \"$@1want_start_processing_notification$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }.Else{\n Button(Body: LangRes(@1close), Class: btn btn-primary, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\", Page: @1notifications_list, PageParams: \"type=1\").Alert(Text: \"$@1want_close_notification$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n }.Else{\n If(#notification_type# == 1){\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: @1notifications_list, PageParams: \"type=0\")\n }.ElseIf(#notification_type# == 2){\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: @1notifications_list, PageParams: \"type=1\")\n }\n }\n }\n }\n }\n }\n}", + "Value": "Div(content-wrapper){\n DBFind(\"@1applications\").Columns(\"name,id\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Vars(application)\n\n If(#notific_id#>0){\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#notific_id#\"}).Columns(\"id,sender->type,notification->type,notification->header,notification->body,page_params->param_int,page_params->param_str,date_start_processing,closed\").Vars(prefix)\n SetVar(sender_type,#prefix_sender_type#).(notification_type,#prefix_notification_type#).(notific_header,#prefix_notification_header#).(notific_body,#prefix_notification_body#).(notific_val_int,#prefix_page_params_param_int#).(notific_val_str,#prefix_page_params_param_str#)\n }.Else{\n Div(md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n SetVar(notific_id,\"0\").SetVar(sender_type,\"0\").(notification_type,\"0\").(notific_header,\"null\").(notific_body,\"null\").(notific_val_int,\"null\").(notific_val_str,\"null\")\n }\n\n Div(row){\n Div(col-md-6 col-md-offset-3){\n Form(){\n Div(list-group-item text-center){\n Span(Class: h3, Body: #notific_header#)\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1id))\n }\n Div(col-md-6 mt-sm text-left){\n Span(Class: h4, Body: #notific_id#)\n }\n }\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1type))\n }\n Div(col-md-6 mt-sm text-left){\n If(#notification_type# > 0){\n Span(Class: h4, Body: AppParam(Ecosystem: 1, App:#application_id#, Name: notification_type, Index: #notification_type#))\n }.Else{\n Span(Class: h4, Body: #notification_type#)\n }\n }\n }\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1sender))\n }\n Div(col-md-6 mt-sm text-left){\n If(#sender_type# > 0){\n If(#sender_type# == 1){\n Span(Class: h4, Body: $@1member$)\n }\n If(#sender_type# == 2){\n Span(Class: h4, Body: $@1role$)\n }\n }.Else{\n Span(Class: h4, Body: #sender_type#)\n }\n }\n }\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1body_text))\n }\n Div(col-md-6 mt-sm text-left){\n Span(Class: h4, Body: #notific_body#)\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1value_number))\n }\n Div(col-md-6 mt-sm text-left){\n Span(Class: h4, Body: #notific_val_int#)\n }\n }\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1value_string))\n }\n Div(col-md-6 mt-sm text-left){\n Span(Class: h4, Body: #notific_val_str#)\n }\n }\n }\n Div(list-group-item text-right){\n If(#prefix_closed# == 0){\n If(#notification_type# == 1){\n Button(Body: LangRes(@1close), Class: btn btn-primary, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\", Page: @1notifications_list).Alert(Text: \"$@1want_close_notification$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }.ElseIf(#notification_type# == 2){\n If(#prefix_date_start_processing# == 0){\n Button(Body: LangRes(@1begin), Class: btn btn-primary, Contract: @1NotificationsProcess, Params: \"NotificId=#notific_id#\", Page: @1notifications_list, PageParams: \"type=1\").Alert(Text: \"$@1want_start_processing_notification$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }.Else{\n Button(Body: LangRes(@1close), Class: btn btn-primary, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\", Page: @1notifications_list, PageParams: \"type=1\").Alert(Text: \"$@1want_close_notification$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n }.Else{\n If(#notification_type# == 1){\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: @1notifications_list, PageParams: \"type=0\")\n }.ElseIf(#notification_type# == 2){\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: @1notifications_list, PageParams: \"type=1\")\n }\n }\n }\n }\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "notifications_testpage_popup", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1applications).Columns(\"name,id\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Vars(application)\n\nIf(#notific_id#>0){\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"id\": #notific_id#}).Columns(\"id,sender->type,notification->type,notification->header,notification->body,page_params->param_int,page_params->param_str,date_start_processing,closed\").Vars(prefix)\n SetVar(sender_type,#prefix_sender_type#).(notification_type,#prefix_notification_type#).(notific_header,#prefix_notification_header#).(notific_body,#prefix_notification_body#).(notific_val_int,#prefix_page_params_param_int#).(notific_val_str,#prefix_page_params_param_str#)\n}.Else{\n Div(md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n SetVar(notific_id,\"0\").SetVar(sender_type,\"0\").(notification_type,\"0\").(notific_header,\"null\").(notific_body,\"null\").(notific_val_int,\"null\").(notific_val_str,\"null\")\n}\n\nForm(){\n Div(list-group-item text-center){\n Span(Class: h3, Body: #notific_header#)\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1id))\n }\n Div(col-md-6 mt-sm text-left){\n Span(Class: h4, Body: #notific_id#)\n }\n }\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1type))\n }\n Div(col-md-6 mt-sm text-left){\n If(#notification_type# > 0){\n Span(Class: h4, Body: AppParam(Ecosystem: 1, App:#application_id#, Name: notification_type, Index: #notification_type#))\n }.Else{\n Span(Class: h4, Body: #notification_type#)\n }\n }\n }\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1sender))\n }\n Div(col-md-6 mt-sm text-left){\n If(#sender_type# > 0){\n If(#sender_type# == 1){\n Span(Class: h4, Body: $@1member$)\n }\n If(#sender_type# == 2){\n Span(Class: h4, Body: $@1role$)\n }\n }.Else{\n Span(Class: h4, Body: #sender_type#)\n }\n }\n }\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1body_text))\n }\n Div(col-md-6 mt-sm text-left){\n Span(Class: h4, Body: #notific_body#)\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1value_number))\n }\n Div(col-md-6 mt-sm text-left){\n Span(Class: h4, Body: #notific_val_int#)\n }\n }\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1value_string))\n }\n Div(col-md-6 mt-sm text-left){\n Span(Class: h4, Body: #notific_val_str#)\n }\n }\n }\n Div(list-group-item text-right){\n If(#prefix_closed# == 0){\n If(#notification_type# == 1){\n Button(Body: LangRes(@1close), Class: btn btn-primary, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\", Page: @1notifications_list).Alert(Text: \"$@1want_close_notification$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }.ElseIf(#notification_type# == 2){\n If(#prefix_date_start_processing# == 0){\n Button(Body: LangRes(@1begin), Class: btn btn-primary, Contract: @1NotificationsProcess, Params: \"NotificId=#notific_id#\", Page: @1notifications_list, PageParams: \"type=1\").Alert(Text: \"$@1want_start_processing_notification$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }.Else{\n Button(Body: LangRes(@1close), Class: btn btn-primary, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\", Page: @1notifications_list, PageParams: \"type=1\").Alert(Text: \"$@1want_close_notification$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n }.Else{\n If(#notification_type# == 1){\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: @1notifications_list, PageParams: \"type=0\")\n }.ElseIf(#notification_type# == 2){\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: @1notifications_list, PageParams: \"type=1\")\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Columns(\"name,id\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Vars(application)\n\nIf(#notific_id#>0){\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#notific_id#\"}).Columns(\"id,sender->type,notification->type,notification->header,notification->body,page_params->param_int,page_params->param_str,date_start_processing,closed\").Vars(prefix)\n SetVar(sender_type,#prefix_sender_type#).(notification_type,#prefix_notification_type#).(notific_header,#prefix_notification_header#).(notific_body,#prefix_notification_body#).(notific_val_int,#prefix_page_params_param_int#).(notific_val_str,#prefix_page_params_param_str#)\n}.Else{\n Div(md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n SetVar(notific_id,\"0\").SetVar(sender_type,\"0\").(notification_type,\"0\").(notific_header,\"null\").(notific_body,\"null\").(notific_val_int,\"null\").(notific_val_str,\"null\")\n}\n\nForm(){\n Div(list-group-item text-center){\n Span(Class: h3, Body: #notific_header#)\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1id))\n }\n Div(col-md-6 mt-sm text-left){\n Span(Class: h4, Body: #notific_id#)\n }\n }\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1type))\n }\n Div(col-md-6 mt-sm text-left){\n If(#notification_type# > 0){\n Span(Class: h4, Body: AppParam(Ecosystem: 1, App:#application_id#, Name: notification_type, Index: #notification_type#))\n }.Else{\n Span(Class: h4, Body: #notification_type#)\n }\n }\n }\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1sender))\n }\n Div(col-md-6 mt-sm text-left){\n If(#sender_type# > 0){\n If(#sender_type# == 1){\n Span(Class: h4, Body: $@1member$)\n }\n If(#sender_type# == 2){\n Span(Class: h4, Body: $@1role$)\n }\n }.Else{\n Span(Class: h4, Body: #sender_type#)\n }\n }\n }\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1body_text))\n }\n Div(col-md-6 mt-sm text-left){\n Span(Class: h4, Body: #notific_body#)\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1value_number))\n }\n Div(col-md-6 mt-sm text-left){\n Span(Class: h4, Body: #notific_val_int#)\n }\n }\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Span(Class: h4, Body: LangRes(@1value_string))\n }\n Div(col-md-6 mt-sm text-left){\n Span(Class: h4, Body: #notific_val_str#)\n }\n }\n }\n Div(list-group-item text-right){\n If(#prefix_closed# == 0){\n If(#notification_type# == 1){\n Button(Body: LangRes(@1close), Class: btn btn-primary, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\", Page: @1notifications_list).Alert(Text: \"$@1want_close_notification$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }.ElseIf(#notification_type# == 2){\n If(#prefix_date_start_processing# == 0){\n Button(Body: LangRes(@1begin), Class: btn btn-primary, Contract: @1NotificationsProcess, Params: \"NotificId=#notific_id#\", Page: @1notifications_list, PageParams: \"type=1\").Alert(Text: \"$@1want_start_processing_notification$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }.Else{\n Button(Body: LangRes(@1close), Class: btn btn-primary, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\", Page: @1notifications_list, PageParams: \"type=1\").Alert(Text: \"$@1want_close_notification$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n }.Else{\n If(#notification_type# == 1){\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: @1notifications_list, PageParams: \"type=0\")\n }.ElseIf(#notification_type# == 2){\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: @1notifications_list, PageParams: \"type=1\")\n }\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "platform_apps_settings", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"System\"}).Vars(\"app\")\n\nSetVar(this_page, \"@1platform_apps_settings\").(role_admin,0).(role_candidate_for_validators,0).(role_consensus,0).(role_delegate,0).(role_developer,0).(role_investor_with_voting_rights,0).(role_validator,0).(role_creates_roles,0)\nSetVar(role_admin, AppParam(App: #app_id#, Name: \"role_admin\"))\nSetVar(role_candidate_for_validators, AppParam(App: #app_id#, Name: \"role_candidate_for_validators\"))\nSetVar(role_consensus, AppParam(App: #app_id#, Name: \"role_consensus\"))\nSetVar(role_delegate, AppParam(App: #app_id#, Name: \"role_delegate\"))\nSetVar(role_developer, AppParam(App: #app_id#, Name: \"role_developer\"))\nSetVar(role_investor_with_voting_rights, AppParam(App: #app_id#, Name: \"role_investor_with_voting_rights\"))\nSetVar(role_validator, AppParam(App: #app_id#, Name: \"role_validator\"))\nSetVar(role_creates_roles, AppParam(App: #app_id#, Name: \"role_creates_roles\"))\n\nDBFind(\"@1roles\", src_roles).Where({\"ecosystem\": #ecosystem_id#, \"deleted\": 0}).Columns(\"role_name,id\").Limit(100)\n\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-4 text-right mt-sm\").(col_right,\"col-sm-8 text-left\")\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(@1pa_settings)\n }\n Div(text-center text-muted){\n LangRes(@1pa_settings_description)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n \"Admin\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleAdmin, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_admin#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_admin# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #role_admin#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n \"Developer\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleDeveloper, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_developer#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_developer# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #role_developer#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n If(#ecosystem_id# == 1){\n Div(#row#){\n Div(#col_left#){\n Label(){\n \"Candidate for validators\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleValidatorCandidate, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_candidate_for_validators#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_candidate_for_validators# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #role_candidate_for_validators#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n \"Consensus\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleConsensus, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_consensus#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_consensus# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #role_consensus#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n \"Delegate\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleDelegate, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_delegate#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_delegate# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #role_delegate#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n \"Investor with voting rights\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleInvestor, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_investor_with_voting_rights#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_investor_with_voting_rights# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #role_investor_with_voting_rights#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n \"Validator\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleValidator, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_validator#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_validator# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #role_validator#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(@1role_creates_roles)\n }\n }\n Div(#col_right#){\n Select(Name: RoleCreatesRoles, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_creates_roles#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_creates_roles# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #role_creates_roles#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1apply_settings$, Class: btn btn-primary, Page: #this_page#, Contract: @1PlatformAppsSettings)\n }\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(app)\n\nSetVar(this_page, \"@1platform_apps_settings\").(role_admin,0).(role_consortium_member_candidate,0).(role_consortium_member,0).(role_delegate,0).(role_developer,0).(role_investor_with_voting_rights,0).(role_creates_roles,0)\nSetVar(role_admin, AppParam(App: #app_id#, Name: \"role_admin\"))\nSetVar(role_consortium_member_candidate, AppParam(App: #app_id#, Name: \"role_consortium_member_candidate\"))\nSetVar(role_consortium_member, AppParam(App: #app_id#, Name: \"role_consortium_member\"))\nSetVar(role_delegate, AppParam(App: #app_id#, Name: \"role_delegate\"))\nSetVar(role_developer, AppParam(App: #app_id#, Name: \"role_developer\"))\nSetVar(role_investor_with_voting_rights, AppParam(App: #app_id#, Name: \"role_investor_with_voting_rights\"))\nSetVar(role_creates_roles, AppParam(App: #app_id#, Name: \"role_creates_roles\"))\n\nDBFind(\"@1roles\", src_roles).Where({\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0}).Columns(\"role_name,id\").Limit(100)\n\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-4 text-right mt-sm\").(col_right,\"col-sm-8 text-left\")\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(@1pa_settings)\n }\n Div(text-center text-muted){\n LangRes(@1pa_settings_description)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n \"Admin\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleAdmin, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_admin#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_admin# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#role_admin#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n \"Developer\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleDeveloper, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_developer#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_developer# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#role_developer#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n If(#ecosystem_id# == 1){\n Div(#row#){\n Div(#col_left#){\n Label(){\n \"Consortium Member Candidate\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleConsortiumMemberCandidate, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_consortium_member_candidate#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_consortium_member_candidate# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#role_consortium_member_candidate#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n \"Consortium Member\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleConsortiumMember, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_consortium_member#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_consortium_member# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#role_consortium_member#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n \"Delegate\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleDelegate, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_delegate#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_delegate# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#role_delegate#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n \"Investor with Voting Rights\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleInvestor, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_investor_with_voting_rights#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_investor_with_voting_rights# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#role_investor_with_voting_rights#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(@1role_creates_roles)\n }\n }\n Div(#col_right#){\n Select(Name: RoleCreatesRoles, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_creates_roles#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_creates_roles# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#role_creates_roles#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1apply_settings$, Class: btn btn-primary, Page: #this_page#, Contract: @1PlatformAppsSettings)\n }\n }\n }\n }\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "profile_edit", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1applications).Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\nSetVar(member_image_id, 0)\nDBFind(@1members).Where({\"ecosystem\": #ecosystem_id#, \"id\": #key_id#}).Columns(\"id,member_name,image_id,member_info->information\").Vars(member)\nDBFind(@1buffer_data).Columns(\"value->id,value->member_name,value->image_id,value->member_info_information\").Where({\"ecosystem\": #ecosystem_id#, \"key\": \"edit_profile_form\", \"member_id\": #key_id#}).Vars(buffer)\nIf(#buffered# == 1){\n SetVar(member_member_name, #buffer_value_member_name#)\n SetVar(member_member_info_information, #buffer_value_member_info_information#)\n}\nIf(#uploaded# == 1){\n DBFind(@1buffer_data).Columns(\"value->binary_id\").Where({\"ecosystem\": #ecosystem_id#, \"key\": \"avatar\", \"member_id\": #key_id#}).Vars(avatar)\n SetVar(member_image_id, #avatar_value_binary_id#)\n}.ElseIf(#buffered# == 1){\n SetVar(member_image_id, #buffer_value_image_id#)\n}\n\nForm(){\n Div(row){\n Div(col-md-4 mt-sm text-center){\n SetVar(ParamNames, \"id;member_name;image_id;member_info_information\")\n Button(Class: btn btn-link, Page: @1upload_page, PageParams: \"back_page=@1profile_edit,back_page_popup=50,back_page_popup_header=$@1editing_profile$,application_id=#application_id#,buffer_key=avatar\", Contract: @1FormStateSave, Params: \"AppId=#application_id#,FormName=edit_profile_form,ParamNames=#ParamNames#,Param1=#key_id#,Param2=Val(Name),Param3=Val(ImageId),Param4=Val(Info)\"){\n If(#member_image_id# > 0){\n Input(Name: ImageId, Type: hidden, Value: #member_image_id#)\n Image(Src: Binary().ById(#member_image_id#), Class: img-thumbnail).Style(width: 140px; border: 1px solid #5A5D63;)\n Div(Body: $@1edit_avatar$)\n }.Else{\n Input(Name: ImageId, Type: hidden, Value: 0)\n Span(Class: fa icon-user fa-5x).Style(margin-top:20px;)\n Div(Body: $@1edit_avatar$)\n }\n }.Popup(Header: $@1avatar$, Width: 30)\n }\n Div(col-md-8 mt-sm){\n Div(form-group){\n Label(){\n Span(Body: LangRes(@1member_name)).(Class: text-danger, Body: *)\n }\n If(Or(#member_id# > 0, #member_id# < 0)){\n Input(Name: Name, Value: #member_member_name#, Disabled: true)\n }.Else{\n Input(Name: Name, Value: #member_member_name#).Validate(minLength:5, maxLength:20)\n InputErr(Name: Name, minLength: $@1validate_member_name$, maxLength: $@1validate_member_name$)\n }\n }\n Div(form-group){\n Label(){\n Span(Body: LangRes(@1information))\n }\n Input(Name: Info, Type: textarea, Value: #member_member_info_information#).Style(resize: vertical;)\n }\n }\n }\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right, Page: @1profile_view, Contract: @1ProfileEdit).Alert(Text: \"$@1want_save_changes$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: @1profile_view)\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\nSetVar(member_image_id, 0)\nDBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#account_id#\"}).Columns(\"account,member_name,image_id,member_info->information\").Vars(member)\nDBFind(\"@1buffer_data\").Columns(\"value->id,value->member_name,value->image_id,value->member_info_information\").Where({\"ecosystem\": \"#ecosystem_id#\", \"key\": \"edit_profile_form\", \"account\": \"#account_id#\"}).Vars(buffer)\nIf(#buffered# == 1){\n SetVar(member_member_name, #buffer_value_member_name#)\n SetVar(member_member_info_information, #buffer_value_member_info_information#)\n}\nIf(#uploaded# == 1){\n DBFind(\"@1buffer_data\").Columns(\"value->binary_id\").Where({\"ecosystem\": \"#ecosystem_id#\", \"key\": \"avatar\", \"account\": \"#account_id#\"}).Vars(avatar)\n SetVar(member_image_id, #avatar_value_binary_id#)\n}.ElseIf(#buffered# == 1){\n SetVar(member_image_id, #buffer_value_image_id#)\n}\n\nForm(){\n Div(row){\n Div(col-md-4 mt-sm text-center){\n SetVar(ParamNames, \"id;member_name;image_id;member_info_information\")\n Button(Class: btn btn-link, Page: @1upload_page, PageParams: \"back_page=@1profile_edit,back_page_popup=50,back_page_popup_header=$@1editing_profile$,application_id=#application_id#,buffer_key=avatar\", Contract: @1FormStateSave, Params: \"AppId=#application_id#,FormName=edit_profile_form,ParamNames=#ParamNames#,Param1=#account_id#,Param2=Val(Name),Param3=Val(ImageId),Param4=Val(Info)\"){\n If(#member_image_id# > 0){\n Input(Name: ImageId, Type: hidden, Value: #member_image_id#)\n Image(Src: Binary().ById(#member_image_id#), Class: img-thumbnail).Style(width: 140px; border: 1px solid #5A5D63;)\n Div(Body: $@1edit_avatar$)\n }.Else{\n Input(Name: ImageId, Type: hidden, Value: 0)\n Span(Class: fa icon-user fa-5x).Style(margin-top:20px;)\n Div(Body: $@1edit_avatar$)\n }\n }.Popup(Header: $@1avatar$, Width: 30)\n }\n Div(col-md-8 mt-sm){\n Div(form-group){\n Label(){\n Span(Body: LangRes(@1member_name)).(Class: text-danger, Body: *)\n }\n If(#member_account#){\n Input(Name: Name, Value: #member_member_name#, Disabled: true)\n }.Else{\n Input(Name: Name, Value: #member_member_name#).Validate(minLength:5, maxLength:20)\n InputErr(Name: Name, minLength: $@1validate_member_name$, maxLength: $@1validate_member_name$)\n }\n }\n Div(form-group){\n Label(){\n Span(Body: LangRes(@1information))\n }\n Input(Name: Info, Type: textarea, Value: #member_member_info_information#).Style(resize: vertical;)\n }\n }\n }\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right, Page: @1profile_view, Contract: @1ProfileEdit).Alert(Text: \"$@1want_save_changes$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: @1profile_view)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "profile_transactions", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1profile_transactions).(this_table, @1history)\nInclude(@1pager_header)\n\nSetTitle($@1transactions_history$)\n\nIf(#ecosystem_id# == 1){\n SetVar(token_title, \"APLA\")\n}.Else{\n DBFind(\"@1ecosystems\").Where({\"id\": #ecosystem_id#}).Vars(\"custom\")\n SetVar(token_title, #custom_token_title#)\n}\n\nIf(#wallet# == \"\"){\n SetVar(wallet, 0)\n}\n\nIf(#new_filter#){\n If(#show_fees#!=\"true\"){\n SetVar(filter1, {\"type\": {\"$neq\": 1}})\n }\n If(#wallet# != 0){\n SetVar(filter2, {\"$or\": [{\"$and\": [{\"sender_id\": #key_id#}, {\"recipient_id\": #wallet#}]}, {\"$and\": [{\"sender_id\": #wallet#}, {\"recipient_id\": #key_id#}]}]})\n }.Else{\n SetVar(filter2, {\"$or\": [{\"sender_id\":#key_id#}, {\"recipient_id\":#key_id#}]})\n }\n If(#lower_limit#>0){\n If(#upper_limit#>0){\n SetVar(filter3, {\"amount\": [{\"$gte\": Calculate(Exp: #lower_limit#*1000000000000000000, Type: money)}, {\"$lte\": Calculate(Exp: #upper_limit#*1000000000000000000, Type: money)}]})\n }.Else{\n SetVar(filter3, {\"amount\": {\"$gte\": Calculate(Exp: #lower_limit#*1000000000000000000, Type: money)}})\n }\n }.ElseIf(#upper_limit#>0){\n SetVar(filter3, {\"amount\": {\"$lte\": Calculate(Exp: #upper_limit#*1000000000000000000, Type: money)}})\n }\n SetVar(filters, {\"$and\": [{\"ecosystem\":#ecosystem_id#}, #filter1#, #filter2#, #filter3#]})\n SetVar(page_par, #filters#)\n}.ElseIf(#page_par#){\n SetVar(filters, #page_par#)\n}.Else{\n SetVar(filters, {\"$and\": [{\"ecosystem\":#ecosystem_id#}, {\"type\": {\"$neq\": 1}}, {\"$or\": [{\"sender_id\":#key_id#}, {\"recipient_id\":#key_id#}]}]})\n}\n\nIf(#search#){\n SetVar(where, {\"$and\": [#filters#, {\"comment\": {\"$ilike\": \"#search#\"}}]})\n}.Else{\n SetVar(where, #filters#)\n}\n\nDiv(mr-lg text-right){\n Button(Page: @1profile_transactions_filter, Class: btn bg-gray-lighter mr-sm, PageParams: \"show_fees=#show_fees#,MemberId=#wallet#,lower_limit=#lower_limit#,upper_limit=#upper_limit#\", Body: Em(Class: fa fa-filter) $@1filter$).Popup(Header: $@1filter$, Width: \"50\")\n If(#page_par#){\n Button(Page: #this_page#, Class: btn bg-gray-lighter mr-sm, Body: Em(Class: fa fa-close))\n }\n}.Style(margin-top: -33px; z-index: 1001;)\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1comment))\n Include(@1search)\n}\n\nDBFind(@1applications).Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\n\nDBFind(@1history, src_history).Where(#where#).Order({\"id\": -1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(sender_wallet){\n If(#sender_id# != 0){\n LinkPage(Page: @1profile_view, PageParams: \"v_key_id=#sender_id#\"){\n Address(#sender_id#)\n }\n }\n}.Custom(recipient_wallet){\n LinkPage(Page: @1profile_view, PageParams: \"v_key_id=#recipient_id#\"){\n Address(#recipient_id#)\n }\n}.Custom(amount_apl){\n Span(Money(#amount#) #token_title#)\n}.Custom(_type){\n AppParam(Ecosystem:1, App:#application_id#, Name: type_tokens_transfer, Index: #type#)\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src_history, \"$@1block$=block_id,$@1sender$=sender_wallet,$@1recipient$=recipient_wallet,$@1amount$=amount_apl,$@1comment$=comment,$@1type$=_type\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1transactions_history_empty$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, @1profile_transactions).(this_table, @1history)\nInclude(@1pager_header)\n\nSetTitle($@1transactions_history$)\n\nIf(#ecosystem_id# == 1){\n SetVar(token_title, \"APLA\")\n}.Else{\n DBFind(\"@1ecosystems\").Where({\"id\": \"#ecosystem_id#\"}).Vars(custom)\n SetVar(token_title, #custom_token_title#)\n}\nIf(#wallet#){\n SetVar(wallet_address, #wallet#)\n SetVar(wallet, AddressToId(#wallet#))\n}.Else{\n SetVar(wallet, 0)\n}\nSetVar(account_key, AddressToId(#account_id#))\n\nIf(#new_filter#){\n If(#show_fees#!=\"true\"){\n SetVar(filter1, `, {\"type\": {\"$neq\": 1}}`)\n }\n If(#wallet# != 0){\n SetVar(filter2, `, {\"$or\": [{\"$and\": [{\"sender_id\": #account_key#}, {\"recipient_id\": #wallet#}]}, {\"$and\": [{\"sender_id\": #wallet#}, {\"recipient_id\": #account_key#}]}]}`)\n }.Else{\n SetVar(filter2, `, {\"$or\": [{\"sender_id\": #account_key#}, {\"recipient_id\": #account_key#}]}`)\n }\n If(#lower_limit#>0){\n If(#upper_limit#>0){\n SetVar(filter3, `, {\"amount\": [{\"$gte\": Calculate(Exp: #lower_limit#*1000000000000000000, Type: money)}, {\"$lte\": Calculate(Exp: #upper_limit#*1000000000000000000, Type: money)}]}`)\n }.Else{\n SetVar(filter3, `, {\"amount\": {\"$gte\": Calculate(Exp: #lower_limit#*1000000000000000000, Type: money)}}`)\n }\n }.ElseIf(#upper_limit#>0){\n SetVar(filter3, `, {\"amount\": {\"$lte\": Calculate(Exp: #upper_limit#*1000000000000000000, Type: money)}}`)\n }\n SetVar(filters, {\"$and\": [{\"ecosystem\": \"#ecosystem_id#\"} #filter1# #filter2# #filter3#]})\n SetVar(page_par, #filters#)\n}.ElseIf(#page_par#){\n SetVar(filters, #page_par#)\n}.Else{\n SetVar(filters, {\"$and\": [{\"ecosystem\": \"#ecosystem_id#\"}, {\"type\": {\"$neq\": 1}}, {\"$or\": [{\"sender_id\": #account_key#}, {\"recipient_id\": #account_key#}]}]})\n}\n\nIf(#search#){\n SetVar(where, {\"$and\": [#filters#, {\"comment\": {\"$ilike\": \"#search#\"}}]})\n}.Else{\n SetVar(where, #filters#)\n}\n\nDiv(mr-lg text-right){\n Button(Page: @1profile_transactions_filter, Class: btn bg-gray-lighter mr-sm, PageParams: \"show_fees=#show_fees#,MemberAccount=#wallet_address#,lower_limit=#lower_limit#,upper_limit=#upper_limit#\", Body: Em(Class: fa fa-filter) $@1filter$).Popup(Header: $@1filter$, Width: \"50\")\n If(#page_par#){\n Button(Page: #this_page#, Class: btn bg-gray-lighter mr-sm, Body: Em(Class: fa fa-close))\n }\n}.Style(margin-top: -33px; z-index: 1001;)\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1comment))\n Include(@1search)\n}\n\nDBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\n\nDBFind(\"@1history\", src_history).Where(#where#).Order({\"id\": \"-1\"}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(sender_wallet){\n If(#sender_id# != 0){\n SetVar(sender_address, Address(#sender_id#))\n LinkPage(Page: @1profile_view, PageParams: \"v_account=#sender_address#\"){\n #sender_address#\n }\n }\n}.Custom(recipient_wallet){\n SetVar(recipient_address, Address(#recipient_id#))\n LinkPage(Page: @1profile_view, PageParams: \"v_account=#recipient_address#\"){\n #recipient_address#\n }\n}.Custom(amount_apl){\n Span(Money(#amount#) #token_title#)\n}.Custom(_type){\n AppParam(Ecosystem: 1, App: #application_id#, Name: type_tokens_transfer, Index: #type#)\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src_history, \"$@1block$=block_id,$@1sender$=sender_wallet,$@1recipient$=recipient_wallet,$@1amount$=amount_apl,$@1comment$=comment,$@1type$=_type\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1transactions_history_empty$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "profile_transactions_filter", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page,@1profile_transactions_filter)\n\nIf(#EcosystemId# == \"\"){\n SetVar(EcosystemId, #ecosystem_id#)\n}\n\nIf(#MemberId# == \"\"){\n SetVar(MemberId, 0)\n}\n\nIf(Or(#MemberId#>0,#MemberId#<0)){\n SetVar(AddressMemberId, Address(#MemberId#))\n}.Else{\n SetVar(AddressMemberId,)\n}\n\nIf(#ecosystem_id# == 1){\n SetVar(token_title, \"APLA\")\n}.Else{\n DBFind(\"@1ecosystems\").Where({\"id\": #ecosystem_id#}).Vars(\"custom\")\n SetVar(token_title, #custom_token_title#)\n}\n\nForm(){\n Div(row){\n Div(col-md-4 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1wallet))\n }\n }\n Div(col-md-8){\n Input(Name: wallet, Type:hidden, Value: #MemberId#)\n Div(input-group){\n Input(Name: m_name, Disabled: 1, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\", Value: #AddressMemberId#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:\"back_page=#this_page#,back_header=$@1filter$,EcosystemId=#EcosystemId#\").Popup(Header: $@1member$, Width: \"50\")\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n )\n }\n Div(Class: m0 h6 text-muted, Body: LangRes(@1transactions_filter_wallet_desc))\n }\n }\n Div(row mt){\n Div(col-md-4 mt-sm text-right){\n Label(){\n Span(Body: $@1amount_range$ (#token_title#))\n }\n }\n Div(col-sm-3 pr0){\n If(#lower_limit#>0){\n Input(Name: lower_limit, Placeholder: \"$@1for_example$: 0.1\", Value: #lower_limit#)\n }.Else{\n Input(Name: lower_limit, Placeholder: \"$@1for_example$: 0.1\")\n }\n Div(Class: m0 h6 text-muted, Body: LangRes(@1transactions_filter_lower_desc))\n }\n Div(col-sm-2 ph0 mt-sm text-center){\n Label(Body: \"< $@1amount$ <\")\n }\n Div(col-sm-3 pl0){\n If(#upper_limit#>0){\n Input(Name: upper_limit, Placeholder: \"$@1for_example$: 100\", Value: #upper_limit#)\n }.Else{\n Input(Name: upper_limit, Placeholder: \"$@1for_example$: 100\")\n }\n Div(Class: m0 h6 text-muted, Body: LangRes(@1transactions_filter_upper_desc))\n }\n }\n Div(row){\n Div(col-md-4 mt text-right){\n Label(){\n Span(Body: LangRes(@1resources_fees_show))\n }\n }\n Div(col-md-8){\n If(#show_fees#==\"true\"){\n Input(Name: show_fees, Type: \"checkbox\", Value: \"true\")\n }.Else{\n Input(Name: show_fees, Type: \"checkbox\", Value: \"false\")\n }\n }\n }\n Button(Body: LangRes(@1filter), Class: btn btn-primary pull-right, Page: @1profile_transactions, PageParams: \"new_filter=1,show_fees=Val(show_fees),wallet=#MemberId#,lower_limit=Val(lower_limit),upper_limit=Val(upper_limit)\")\n Button(Body: LangRes(@1clear), Class: btn btn-default pull-right, Page: @1profile_transactions)\n}", + "Value": "SetVar(this_page,@1profile_transactions_filter)\n\nIf(#EcosystemId# == \"\"){\n SetVar(EcosystemId, #ecosystem_id#)\n}\nIf(#MemberAccount#){\n SetVar(MemberAccountInputValue, #MemberAccount#)\n SetVar(MemberAccount, AddressToId(#MemberAccount#))\n}.Else{\n SetVar(MemberAccount, 0)\n}\n\nIf(#ecosystem_id# == 1){\n SetVar(token_title, \"APLA\")\n}.Else{\n DBFind(\"@1ecosystems\").Where({\"id\": \"#ecosystem_id#\"}).Vars(custom)\n SetVar(token_title, #custom_token_title#)\n}\n\nForm(){\n Div(row){\n Div(col-md-4 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1wallet))\n }\n }\n Div(col-md-8){\n Input(Name: wallet, Type: hidden, Value: #MemberAccount#)\n Div(input-group){\n Input(Name: m_name, Disabled: 1, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\", Value: #MemberAccountInputValue#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:\"back_page=#this_page#,back_header=$@1filter$,EcosystemId=#EcosystemId#\").Popup(Header: $@1member$, Width: \"50\")\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n )\n }\n Div(Class: m0 h6 text-muted, Body: LangRes(@1transactions_filter_wallet_desc))\n }\n }\n Div(row mt){\n Div(col-md-4 mt-sm text-right){\n Label(){\n Span(Body: $@1amount_range$ (#token_title#))\n }\n }\n Div(col-sm-3 pr0){\n If(#lower_limit# > 0){\n Input(Name: lower_limit, Placeholder: \"$@1for_example$: 0.1\", Value: #lower_limit#)\n }.Else{\n Input(Name: lower_limit, Placeholder: \"$@1for_example$: 0.1\")\n }\n Div(Class: m0 h6 text-muted, Body: LangRes(@1transactions_filter_lower_desc))\n }\n Div(col-sm-2 ph0 mt-sm text-center){\n Label(Body: \"< $@1amount$ <\")\n }\n Div(col-sm-3 pl0){\n If(#upper_limit# > 0){\n Input(Name: upper_limit, Placeholder: \"$@1for_example$: 100\", Value: #upper_limit#)\n }.Else{\n Input(Name: upper_limit, Placeholder: \"$@1for_example$: 100\")\n }\n Div(Class: m0 h6 text-muted, Body: LangRes(@1transactions_filter_upper_desc))\n }\n }\n Div(row){\n Div(col-md-4 mt text-right){\n Label(){\n Span(Body: LangRes(@1resources_fees_show))\n }\n }\n Div(col-md-8){\n If(#show_fees# == \"true\"){\n Input(Name: show_fees, Type: \"checkbox\", Value: \"true\")\n }.Else{\n Input(Name: show_fees, Type: \"checkbox\", Value: \"false\")\n }\n }\n }\n Button(Body: LangRes(@1filter), Class: btn btn-primary pull-right, Page: @1profile_transactions, PageParams: \"new_filter=1,show_fees=Val(show_fees),wallet=#MemberAccountInputValue#,lower_limit=Val(lower_limit),upper_limit=Val(upper_limit)\")\n Button(Body: LangRes(@1clear), Class: btn btn-default pull-right, Page: @1profile_transactions)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "profile_view", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "If(#key_id#==#guest_key#){\n Include(@1apps_description)\n}.Else{\n Include(@1profile)\n}", + "Value": "If(#account_id# == #guest_account#){\n Include(@1apps_description)\n}.Else{\n Include(@1profile)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "roles_assign", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1applications).Columns(\"name,id\").Where({\"name\": \"Basic\", \"ecosystem\": 1}).Vars(application)\n\nIf(#Id#!=\"\"){\n SetVar(v_role_id, #Id#)\n}\n\nIf(#v_role_id#>0){\n DBFind(@1roles, src_roles).Where({\"ecosystem\": #ecosystem_id#, \"id\": #v_role_id#}).Columns(\"id,role_name,role_type,roles_access,creator->member_id,deleted\").Vars(prefix)\n If(#prefix_creator_member_id#==#key_id#){\n SetVar(manager_id, 1)\n }.ElseIf(And(#prefix_roles_access#!=\"NULL\",#prefix_roles_access#!=\"\",#prefix_roles_access#!=\"[]\",#role_id#>0,#prefix_deleted#==0,#prefix_role_type#!=2)){\n DBFind(@1roles_participants).Where({\"ecosystem\": #ecosystem_id#, \"id\": {\"$in\": #prefix_roles_access#}}).Columns(\"id\").Vars(manager)\n }\n\n Form(){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1role)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Type: hidden, Name: Rid, Value: #prefix_id#)\n SetVar(Name: var_prefix_role_name, Value: LangRes(#prefix_role_name#))\n Input(Name: input_prefix_role_name, Value: #var_prefix_role_name#, Disabled: 1)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1type)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n SetVar(Name: var_prefix_role_type, Value: AppParam(Ecosystem:1, App:#application_id#, Name: roles_types, Index: #prefix_role_type#))\n Input(Name: input_prefix_role_type, Value: #var_prefix_role_type#, Disabled: 1)\n If(#prefix_role_type#==2){\n P(Class: m0 text-danger h6, Body: LangRes(@1elective_role_voting_only))\n }\n }\n }\n If(#prefix_role_type#!=2){\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1member)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n If(#MemberId# == \"\"){\n SetVar(MemberId, 0)\n }\n Input(Name: member_id, Type:hidden, Value: #MemberId#)\n Div(input-group){\n If(Or(#MemberId#>0,#MemberId#<0)){\n SetVar(AddressMemberId, Address(#MemberId#))\n }\n Input(Name: m_name, Disabled: 1, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\", Value: #AddressMemberId#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:\"back_page=@1roles_assign,back_header=$@1assign$,Id=#v_role_id#,EcosystemId=#ecosystem_id#\").Popup(Header: $@1member$, Width: \"50\")\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n )\n }\n }\n }\n }\n If(And(#manager_id#>0,#prefix_role_type#!=2)){\n Button(Body: LangRes(@1assign), Class: btn bg-primary pull-right mt, Page: @1roles_view, PageParams: \"v_role_id=#v_role_id#\", Contract: @1RolesAssign, Params: \"MemberId=Val(member_id)\").Alert(Text: \"$@1want_assign_member_to_role$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n Button(Body: LangRes(@1back), Class: btn bg-gray-lighter pull-right mt, Page: @1roles_view, PageParams: \"v_role_id=#v_role_id#\")\n }\n}.Else{\n Div(md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n}", + "Value": "DBFind(\"@1applications\").Columns(\"name,id\").Where({\"name\": \"Basic\", \"ecosystem\": 1}).Vars(application)\n\nIf(#Id#!=\"\"){\n SetVar(v_role_id, #Id#)\n}\n\nIf(#v_role_id#>0){\n DBFind(\"@1roles\", src_roles).Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#v_role_id#\"}).Columns(\"id,role_name,role_type,roles_access,creator->account,deleted\").Vars(prefix)\n If(#prefix_creator_account#==#account_id#){\n SetVar(manager_id, 1)\n }.ElseIf(And(#prefix_roles_access#!=\"NULL\",#prefix_roles_access#!=\"\",#prefix_roles_access#!=\"[]\",#role_id#>0,#prefix_deleted#==0,#prefix_role_type#!=2)){\n DBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": {\"$in\": #prefix_roles_access#}}).Columns(\"id\").Vars(manager)\n }\n\n Form(){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1role)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Type: hidden, Name: Rid, Value: #prefix_id#)\n SetVar(Name: var_prefix_role_name, Value: LangRes(#prefix_role_name#))\n Input(Name: input_prefix_role_name, Value: #var_prefix_role_name#, Disabled: 1)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1type)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n SetVar(Name: var_prefix_role_type, Value: AppParam(Ecosystem:1, App:#application_id#, Name: roles_types, Index: #prefix_role_type#))\n Input(Name: input_prefix_role_type, Value: #var_prefix_role_type#, Disabled: 1)\n If(#prefix_role_type#==2){\n P(Class: m0 text-danger h6, Body: LangRes(@1elective_role_voting_only))\n }\n }\n }\n If(#prefix_role_type#!=2){\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1member)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Div(input-group){\n If(#MemberAccount#){\n Input(Name: account, Type: hidden, Value: #MemberAccount#)\n Input(Name: m_name, Disabled: 1, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\", Value: #MemberAccount#)\n }.Else{\n Input(Name: account, Type: hidden, Value: 0)\n Input(Name: m_name, Disabled: 1, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\")\n }\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:\"back_page=@1roles_assign,back_header=$@1assign$,Id=#v_role_id#,EcosystemId=#ecosystem_id#\").Popup(Header: $@1member$, Width: \"50\")\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n )\n }\n }\n }\n }\n If(And(#manager_id#>0,#prefix_role_type#!=2)){\n Button(Body: LangRes(@1assign), Class: btn bg-primary pull-right mt, Page: @1roles_view, PageParams: \"v_role_id=#v_role_id#\", Contract: @1RolesAssign, Params: \"MemberAccount=Val(account)\").Alert(Text: \"$@1want_assign_member_to_role$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n Button(Body: LangRes(@1back), Class: btn bg-gray-lighter pull-right mt, Page: @1roles_view, PageParams: \"v_role_id=#v_role_id#\")\n }\n}.Else{\n Div(md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "roles_create", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1applications).Columns(\"name,id\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Vars(application)\nDBFind(@1roles, src_roles).Columns(\"id,role_name\").Where({\"ecosystem\": #ecosystem_id#, \"deleted\": 0}).Order(id)\nIf(#back_page#==\"\"){\n SetVar(back_page, \"@1roles_list\")\n}\n\nIf(#rid#==\"\"){\n SetVar(title, $@1new_role$)\n DBFind(@1buffer_data).Where({\"ecosystem\": #ecosystem_id#, \"key\": \"roles_access\", \"member_id\": #key_id#}).Columns(\"id,key,member_id,ecosystem,value->roles_access,value->role_type,value->role_name\").Vars(buffer)\n AppParam(Source: app_roles_types, Ecosystem: 1, App: #application_id#, Name: roles_types_selection)\n If(And(#buffer_value_roles_access#!=\"NULL\",#buffer_value_roles_access#!=\"\",#buffer_value_roles_access#!=\"[]\")){\n DBFind(@1roles, src_roles_access).Where({\"ecosystem\": #ecosystem_id#, \"id\": {\"$in\": #buffer_value_roles_access#}}).Columns(\"id,role_name\").Count(ra_count).Order(\"role_name\")\n }\n}.Else{\n SetVar(title, $@1edit_role$)\n DBFind(@1roles).Where({\"ecosystem\": #ecosystem_id#, \"id\": #rid#}).Columns(\"roles_access,role_type,role_name\").Vars(r)\n SetVar(role_type, AppParam(Ecosystem: 1, App: #application_id#, Name: roles_types, Index: #r_role_type#))\n If(And(#r_roles_access#!=\"NULL\",#r_roles_access#!=\"\",#r_roles_access#!=\"[]\")){\n DBFind(@1roles, src_roles_access).Where({\"ecosystem\": #ecosystem_id#, \"id\": {\"$in\": #r_roles_access#}}).Columns(\"id,role_name\").Count(ra_count).Order(\"role_name\")\n }\n}\n\nForm(){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1name)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n If(#rid#==\"\"){\n Input(Name: Name, Value: #buffer_value_role_name#).Validate(minLength:3, maxLength:30)\n InputErr(Name: Name, minLength: $@1validate_role_name$, maxLength: $@1validate_role_name$)\n }.Else{\n Input(Name: Name, Value: #r_role_name#, Disabled: 1)\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1type)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n If(#rid#==\"\"){\n Select(Name: Type, Source: app_roles_types, NameColumn: name, ValueColumn: id, Value: #buffer_value_role_type#)\n }.Else{\n Input(Name: Type, Value: #role_type#, Disabled: 1)\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1roles_access)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Div(input-group mb-sm){\n Select(Name: roles_managers, Source: src_roles, NameColumn: role_name, ValueColumn: id)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-plus mtl buttons, Page: @1roles_create, PageParams: \"rid=#rid#,back_page=#back_page#\", Contract: @1RolesAccessManager, Params: \"Rid=#rid#,ManagerRid=Val(roles_managers),Action=add\").Popup(50, #title#)\n }\n }\n If(#ra_count#>0){\n ForList(src_roles_access){\n SetVar(btn_class, \"bg-gray-lighter\")\n If(#id#==#role_id#){\n SetVar(btn_class, \"bg-primary\")\n }\n Button(Class: btn-xs #btn_class# mr-sm mb-sm, Page: @1roles_create, PageParams: \"rid=#rid#\", Contract: @1RolesAccessManager, Params: \"Rid=#rid#,ManagerRid=#id#,Action=remove\", Body: Span(Class: fa fa-remove) #role_name#).Popup(50, #title#)\n }\n }\n }\n }\n If(#rid#==\"\"){\n Button(Body: LangRes(@1create), Class: btn bg-primary pull-right mt, Page: #back_page#, PageParams: \"vID=#vID#\", Contract: @1RolesCreate)\n }\n Button(Body: LangRes(@1back), Class: btn bg-gray-lighter pull-right mt, Page: #back_page#, PageParams: \"vID=#vID#\")\n}.Style(\n .buttons{border: 1px solid #dde6e9;}\n)", + "Value": "DBFind(\"@1applications\").Columns(\"name,id\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Vars(application)\nDBFind(\"@1roles\", src_roles).Columns(\"id,role_name\").Where({\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0}).Order(\"id\")\nIf(#back_page#==\"\"){\n SetVar(back_page, \"@1roles_list\")\n}\n\nIf(#rid#==\"\"){\n SetVar(title, $@1new_role$)\n DBFind(\"@1buffer_data\").Where({\"ecosystem\": \"#ecosystem_id#\", \"key\": \"roles_access\", \"account\": \"#account_id#\"}).Columns(\"id,key,account,ecosystem,value->roles_access,value->role_type,value->role_name\").Vars(buffer)\n AppParam(Source: app_roles_types, Ecosystem: 1, App: #application_id#, Name: roles_types_selection)\n If(And(#buffer_value_roles_access#!=\"NULL\",#buffer_value_roles_access#!=\"\",#buffer_value_roles_access#!=\"[]\")){\n DBFind(\"@1roles\", src_roles_access).Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": {\"$in\": #buffer_value_roles_access#}}).Columns(\"id,role_name\").Count(ra_count).Order(\"role_name\")\n }\n}.Else{\n SetVar(title, $@1edit_role$)\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#rid#\"}).Columns(\"roles_access,role_type,role_name\").Vars(r)\n SetVar(role_type, AppParam(Ecosystem: 1, App: #application_id#, Name: roles_types, Index: #r_role_type#))\n If(And(#r_roles_access#!=\"NULL\",#r_roles_access#!=\"\",#r_roles_access#!=\"[]\")){\n DBFind(\"@1roles\", src_roles_access).Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": {\"$in\": #r_roles_access#}}).Columns(\"id,role_name\").Count(ra_count).Order(\"role_name\")\n }\n}\n\nForm(){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1name)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n If(#rid#==\"\"){\n Input(Name: Name, Value: #buffer_value_role_name#).Validate(minLength:3, maxLength:30)\n InputErr(Name: Name, minLength: $@1validate_role_name$, maxLength: $@1validate_role_name$)\n }.Else{\n Input(Name: Name, Value: #r_role_name#, Disabled: 1)\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1type)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n If(#rid#==\"\"){\n Select(Name: Type, Source: app_roles_types, NameColumn: name, ValueColumn: id, Value: #buffer_value_role_type#)\n }.Else{\n Input(Name: Type, Value: #role_type#, Disabled: 1)\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1roles_access)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Div(input-group mb-sm){\n Select(Name: roles_managers, Source: src_roles, NameColumn: role_name, ValueColumn: id)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-plus mtl buttons, Page: @1roles_create, PageParams: \"rid=#rid#,back_page=#back_page#\", Contract: @1RolesAccessManager, Params: \"Rid=#rid#,ManagerRid=Val(roles_managers),Action=add\").Popup(50, #title#)\n }\n }\n If(#ra_count#>0){\n ForList(src_roles_access){\n SetVar(btn_class, \"bg-gray-lighter\")\n If(#id#==#role_id#){\n SetVar(btn_class, \"bg-primary\")\n }\n Button(Class: btn-xs #btn_class# mr-sm mb-sm, Page: @1roles_create, PageParams: \"rid=#rid#\", Contract: @1RolesAccessManager, Params: \"Rid=#rid#,ManagerRid=#id#,Action=remove\", Body: Span(Class: fa fa-remove) #role_name#).Popup(50, #title#)\n }\n }\n }\n }\n If(#rid#==\"\"){\n Button(Body: LangRes(@1create), Class: btn bg-primary pull-right mt, Page: #back_page#, PageParams: \"vID=#vID#\", Contract: @1RolesCreate)\n }\n Button(Body: LangRes(@1back), Class: btn bg-gray-lighter pull-right mt, Page: #back_page#, PageParams: \"vID=#vID#\")\n}.Style(\n .buttons{border: 1px solid #dde6e9;}\n)", "Menu": "admin_menu", "Type": "pages" }, { "Name": "roles_list", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1roles_list).(this_table, @1roles)\nInclude(@1pager_header)\n\nSetTitle(\"$@1roles$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1roles_list_desc$\"))\nAddToolButton(Page: @1roles_create, Icon: icon-plus, Title: $@1create$).Popup(50, $@1new_role$)\n\nIf(#search#){\n SetVar(w_search, {\"role_name\": {\"$ilike\": \"#search#\"}})\n}\nSetVar(where, {\"ecosystem\": #ecosystem_id#, {#w_search#}})\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1role))\n Include(@1search)\n}\n\nDBFind(#this_table#).Where({\"ecosystem\": #ecosystem_id#}).Count(all_roles_count)\nDBFind(#this_table#, src_roles).Where(#where#).Order({deleted:\"1\", id:\"1\"}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,role_name,role_type,image_id,creator->member_id,creator->member_name,date_created,date_deleted,deleted,roles_access\").Custom(_id){\n If(#deleted# == 0){\n SetVar(style_text,\"text-normal\").(style_link, \"text-primary\")\n }.Else{\n SetVar(style_text,\"text-muted\").(style_link, \"text-muted\")\n }\n Span(Class: #style_text#, Body: #id#)\n}.Custom(_creator){\n If(And(#creator.member_name#!=NULL,#creator.member_name#!=\"\")){\n LinkPage(Class: #style_link# text-bold, Page: @1profile_view, PageParams: \"v_key_id=#creator.member_id#\"){\n #creator.member_name#\n }\n }\n}.Custom(_name){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1roles_view, PageParams: \"v_role_id=#id#\"){\n If(#image_id#>0){\n Image(Src: Binary().ById(#image_id#), Class: mr-sm).Style(width: 30px; border: 1px solid #5A5D63;)\n #role_name#\n }.Else{\n Div(Class: #style_link#){\n Span(Class: fa icon-settings fa-2x mr-sm)\n }.Style(\n display: inline-block;\n )\n Span(Class: btn-link text-bold pb-sm){\n Span(Class: #style_link#, Body: #role_name#)\n }.Style(\n display: inline-block;\n vertical-align: top;\n padding-top: 7px;\n padding-left: 4px;\n )\n }\n }\n}.Custom(_date){\n Div(#style_text# small){\n Div(text-nowrap){DateTime(DateTime: #date_created#, Format: \"DD.MM.YYYY HH:MI\")}\n If(#deleted# == 1){\n Div(text-nowrap){DateTime(DateTime: #date_deleted#, Format: \"DD.MM.YYYY HH:MI\")}\n }\n }\n}.Custom(_type){\n DBFind(@1applications).Where({\"name\": \"Basic\", \"ecosystem\": 1}).Columns(\"name,id\").Vars(application)\n Span(Class: #style_text#, Body: AppParam(Ecosystem: 1, App: #application_id#, Name: roles_types, Index: #role_type#))\n}.Custom(_status){\n Span(Class:#style_text#){\n If(#deleted# == 0){\n LangRes(@1active)\n }.Else{\n LangRes(@1deleted)\n }\n }\n}.Custom(_access){\n If(#creator.member_id#==#key_id#){\n SetVar(access,done)\n }.Else{\n SetVar(access,)\n }\n If(And(#roles_access#!=\"NULL\",#roles_access#!=\"\",#roles_access#!=\"[]\")){\n DBFind(@1roles,src_access_list).Where({\"id\": {\"$in\": #roles_access#}}).Columns(\"id,role_name\").Count(access_count).Order(role_name)\n Div(#style_text# breaker){\n ForList(src_access_list){\n If(And(#role_id#==#id#)){\n SetVar(access,done)\n }\n If(#access_count#!=#src_access_list_index#){\n Span(\"#role_name#,\",mr-sm)\n }.Else{\n #role_name#\n }\n }\n }\n }\n}.Custom(_actions){\n Div(text-right button-group text-nowrap){\n If(#access#==\"done\"){\n If(And(#deleted#==0,#role_type#!=3)){\n Button(Class: btn bg-gray-lighter, Contract: @1RolesDelete, Params: \"Ops=D,Rid=#id#\", Page: @1roles_list){\n Em(Class: text-danger fa fa-1x fa-trash)\n }.Alert(Text: \"$@1sure_want_delete$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }.ElseIf(#deleted#==1){\n Button(Class: btn bg-gray-lighter mh-sm, Contract: @1RolesDelete, Params: \"Ops=R,Rid=#id#\", Page: @1roles_list){\n Em(Class: btn-default fa fa-1x fa-recycle)\n }\n }\n If(#deleted#==0){\n Button(Class: btn bg-gray-lighter mh-sm, PageParams: \"rid=#id#\", Page: @1roles_create){\n Em(Class: text-default fa fa-1x fa-edit)\n }.Popup(50, $@1edit_role$)\n }\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src_roles, \"$@1role$=_name,$@1type$=_type,$@1id$=_id,$@1creator$=_creator,$@1role_created_deleted$=_date,$@1status$=_status,$@1roles_access$=_access,=_actions\")\n }.ElseIf(#all_roles_count# > 0){\n Div(Class: text-center h4 text-muted){\n Div(Class: text-center h4 text-muted, Body: \"$@1roles$ $@1not_founded$\")\n }\n }.Else{\n Div(Class: text-center h4 text-muted){\n Button(Body: $@1install_default_roles$, Class: btn btn-primary, Page: @1roles_list, Contract: @1RolesInstall)\n }\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}\n", + "Value": "SetVar(this_page, @1roles_list).(this_table, @1roles)\nInclude(@1pager_header)\n\nSetTitle(\"$@1roles$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1roles_list_desc$\"))\nAddToolButton(Page: @1roles_create, Icon: icon-plus, Title: $@1create$).Popup(50, $@1new_role$)\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"role_name\": {\"$ilike\": \"#search#\"}})\n}.Else{\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\"})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1role))\n Include(@1search)\n}\n\nDBFind(#this_table#).Where({\"ecosystem\": \"#ecosystem_id#\"}).Count(all_roles_count)\nDBFind(#this_table#, src_roles).Where(#where#).Order({\"deleted\": 1, \"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,role_name,role_type,image_id,creator->account,creator->member_name,date_created,date_deleted,deleted,roles_access\").Custom(_id){\n If(#deleted# == 0){\n SetVar(style_text,\"text-normal\").(style_link, \"text-primary\")\n }.Else{\n SetVar(style_text,\"text-muted\").(style_link, \"text-muted\")\n }\n Span(Class: #style_text#, Body: #id#)\n}.Custom(_creator){\n If(And(#creator.member_name#!=NULL,#creator.member_name#!=\"\")){\n LinkPage(Class: #style_link# text-bold, Page: @1profile_view, PageParams: \"v_account=#creator.account#\"){\n #creator.member_name#\n }\n }\n}.Custom(_name){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1roles_view, PageParams: \"v_role_id=#id#\"){\n If(#image_id#>0){\n Image(Src: Binary().ById(#image_id#), Class: mr-sm).Style(width: 30px; border: 1px solid #5A5D63;)\n #role_name#\n }.Else{\n Div(Class: #style_link#){\n Span(Class: fa icon-settings fa-2x mr-sm)\n }.Style(\n display: inline-block;\n )\n Span(Class: btn-link text-bold pb-sm){\n Span(Class: #style_link#, Body: #role_name#)\n }.Style(\n display: inline-block;\n vertical-align: top;\n padding-top: 7px;\n padding-left: 4px;\n )\n }\n }\n}.Custom(_date){\n Div(#style_text# small){\n Div(text-nowrap){DateTime(DateTime: #date_created#, Format: \"DD.MM.YYYY HH:MI\")}\n If(#deleted# == 1){\n Div(text-nowrap){DateTime(DateTime: #date_deleted#, Format: \"DD.MM.YYYY HH:MI\")}\n }\n }\n}.Custom(_type){\n DBFind(\"@1applications\").Where({\"name\": \"Basic\", \"ecosystem\": 1}).Columns(\"name,id\").Vars(application)\n Span(Class: #style_text#, Body: AppParam(Ecosystem: 1, App: #application_id#, Name: roles_types, Index: #role_type#))\n}.Custom(_status){\n Span(Class:#style_text#){\n If(#deleted# == 0){\n LangRes(@1active)\n }.Else{\n LangRes(@1deleted)\n }\n }\n}.Custom(_access){\n If(#creator.account# == #account_id#){\n SetVar(access,done)\n }.Else{\n SetVar(access,)\n }\n If(And(#roles_access#!=\"NULL\",#roles_access#!=\"\",#roles_access#!=\"[]\")){\n DBFind(\"@1roles\", src_access_list).Where({\"id\": {\"$in\": #roles_access#}}).Columns(\"id,role_name\").Count(access_count).Order(\"role_name\")\n Div(#style_text# breaker){\n ForList(src_access_list){\n If(And(#role_id#==#id#)){\n SetVar(access,done)\n }\n If(#access_count#!=#src_access_list_index#){\n Span(\"#role_name#,\",mr-sm)\n }.Else{\n #role_name#\n }\n }\n }\n }\n}.Custom(_actions){\n Div(text-right button-group text-nowrap){\n If(#access#==\"done\"){\n If(And(#deleted#==0,#role_type#!=3)){\n Button(Class: btn bg-gray-lighter, Contract: @1RolesDelete, Params: \"Ops=D,Rid=#id#\", Page: @1roles_list){\n Em(Class: text-danger fa fa-1x fa-trash)\n }.Alert(Text: \"$@1sure_want_delete$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }.ElseIf(#deleted#==1){\n Button(Class: btn bg-gray-lighter mh-sm, Contract: @1RolesDelete, Params: \"Ops=R,Rid=#id#\", Page: @1roles_list){\n Em(Class: btn-default fa fa-1x fa-recycle)\n }\n }\n If(#deleted#==0){\n Button(Class: btn bg-gray-lighter mh-sm, PageParams: \"rid=#id#\", Page: @1roles_create){\n Em(Class: text-default fa fa-1x fa-edit)\n }.Popup(50, $@1edit_role$)\n }\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src_roles, \"$@1role$=_name,$@1type$=_type,$@1id$=_id,$@1creator$=_creator,$@1role_created_deleted$=_date,$@1status$=_status,$@1roles_access$=_access,=_actions\")\n }.ElseIf(#all_roles_count# > 0){\n Div(Class: text-center h4 text-muted){\n Div(Class: text-center h4 text-muted, Body: \"$@1roles$ $@1not_founded$\")\n }\n }.Else{\n Div(Class: text-center h4 text-muted){\n Button(Body: $@1install_default_roles$, Class: btn btn-primary, Page: @1roles_list, Contract: @1RolesInstall)\n }\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}\n", "Menu": "admin_menu", "Type": "pages" }, { "Name": "roles_request", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Form(){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1role)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n DBFind(@1roles,src_roles).Where({\"ecosystem\": #ecosystem_id#, \"role_type\": 1, \"deleted\": 0}).Columns(\"id,role_name\").Count(roles_count)\n If(#roles_count#==0){\n Div(Body: LangRes(@1no_assigned_roles))\n }.Else{\n Select(Name: Rid, Source: src_roles, NameColumn: role_name, ValueColumn: id)\n }\n }\n }\n If(#roles_count#>0){\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right mt, Contract: @1RolesRequest, Page: @1profile_view)\n }\n Button(Body: LangRes(@1close), Class: btn btn-default pull-right mt, Page: @1profile_view)\n}", + "Value": "Form(){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1role)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n DBFind(\"@1roles\", src_roles).Where({\"ecosystem\": \"#ecosystem_id#\", \"role_type\": 1, \"deleted\": 0}).Columns(\"id,role_name\").Count(roles_count)\n If(#roles_count#==0){\n Div(Body: LangRes(@1no_assigned_roles))\n }.Else{\n Select(Name: Rid, Source: src_roles, NameColumn: role_name, ValueColumn: id)\n }\n }\n }\n If(#roles_count#>0){\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right mt, Contract: @1RolesRequest, Page: @1profile_view)\n }\n Button(Body: LangRes(@1close), Class: btn btn-default pull-right mt, Page: @1profile_view)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "roles_request_view", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Div(content-wrapper){\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"id\": #notific_id#}).Columns(\"page_params->rid,sender->image_id,sender->member_id,sender->member_name,closed\").Vars(notific)\n\n Div(row){\n Div(col-sm-8 col-sm-offset-2 col-lg-6 col-lg-offset-3){\n Form(panel panel-default){\n Div(panel-heading text-center){\n Span(Class: h3, Body: $@1request_to_role$)\n }\n Div(panel-body){\n Div(form-group){\n Div(row){\n Div(col-md-12 mt-sm text-center){\n If(#notific_sender_image_id#>0){\n Image(Src: Binary().ById(#notific_sender_image_id#), Class: img-thumbnail).Style(width: 120px; border: 1px solid #5A5D63;)\n }.Else{\n Span(Class: fa icon-user fa-5x)\n }\n Div(m0 h4 text-bold){#notific_sender_member_name#}\n }\n }\n }\n Div(list-group-item text-center){\n Div(text-muted m0 h5, Body: LangRes(@1address))\n Span(Class: h5 text-bold, Body: Address(#notific_sender_member_id#))\n }\n Div(list-group-item text-center){\n DBFind(@1roles).Where({\"ecosystem\": #ecosystem_id#, \"id\": #notific_page_params_rid#}).Columns(\"role_name\").Vars(r)\n Div(text-muted m0 h5, Body: LangRes(@1role))\n Span(Class: h5 text-bold, Body: #notific_page_params_rid# - #r_role_name#)\n }\n If(#notific_closed# == 0){\n Div(row){\n Div(col-md-12 mt-lg text-center){\n Input(Name: MemberId, Class: hidden, Value: #notific_sender_member_id#)\n Input(Name: Rid, Class: hidden, Value: #notific_page_params_rid#)\n Button(Class: btn btn-danger mh-sm, Body: $@1reject$, Contract: @1RolesRequestDecision, Page: @1roles_list, Params: \"NotificId=#notific_id#,Decision=0\")\n Button(Class: btn btn-success mh-sm, Body: $@1accept$, Contract: @1RolesRequestDecision, Page: @1roles_list, Params: \"NotificId=#notific_id#,Decision=1\")\n }\n }\n }\n }\n }\n }\n }\n}", + "Value": "Div(content-wrapper){\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": #notific_id#}).Columns(\"page_params->rid,sender->image_id,sender->account,sender->member_name,closed\").Vars(notific)\n\n Div(row){\n Div(col-sm-8 col-sm-offset-2 col-lg-6 col-lg-offset-3){\n Form(panel panel-default){\n Div(panel-heading text-center){\n Span(Class: h3, Body: $@1request_to_role$)\n }\n Div(panel-body){\n Div(form-group){\n Div(row){\n Div(col-md-12 mt-sm text-center){\n If(#notific_sender_image_id#>0){\n Image(Src: Binary().ById(#notific_sender_image_id#), Class: img-thumbnail).Style(width: 120px; border: 1px solid #5A5D63;)\n }.Else{\n Span(Class: fa icon-user fa-5x)\n }\n Div(m0 h4 text-bold){#notific_sender_member_name#}\n }\n }\n }\n Div(list-group-item text-center){\n Div(text-muted m0 h5, Body: LangRes(@1address))\n Span(Class: h5 text-bold, Body: #notific_sender_account#)\n }\n Div(list-group-item text-center){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#notific_page_params_rid#\"}).Columns(\"role_name\").Vars(r)\n Div(text-muted m0 h5, Body: LangRes(@1role))\n Span(Class: h5 text-bold, Body: #notific_page_params_rid# - #r_role_name#)\n }\n If(#notific_closed# == 0){\n Div(row){\n Div(col-md-12 mt-lg text-center){\n Input(Name: MemberAccount, Class: hidden, Value: #notific_sender_account#)\n Input(Name: Rid, Class: hidden, Value: #notific_page_params_rid#)\n Button(Class: btn btn-danger mh-sm, Body: $@1reject$, Contract: @1RolesRequestDecision, Page: @1roles_list, Params: \"NotificId=#notific_id#,Decision=0\")\n Button(Class: btn btn-success mh-sm, Body: $@1accept$, Contract: @1RolesRequestDecision, Page: @1roles_list, Params: \"NotificId=#notific_id#,Decision=1\")\n }\n }\n }\n }\n }\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "roles_view", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "If(#page_par#!=\"\"){\n SetVar(Name: v_role_id, Value: #page_par#)\n}\n\nIf(#v_role_id#>0){\n SetVar(this_page, @1roles_view).(this_table, @1roles_participants)\n Include(@1pager_header)\n\n DBFind(@1roles).Where({\"ecosystem\": #ecosystem_id#, \"id\": #v_role_id#}).Columns(\"role_name,role_type,deleted,roles_access,creator->member_id\").Vars(prefix)\n If(#prefix_creator_member_id#==#key_id#){\n SetVar(manager_id,1)\n }.ElseIf(And(#prefix_roles_access#!=\"NULL\",#prefix_roles_access#!=\"\",#prefix_roles_access#!=\"[]\",#role_id#>0,#prefix_deleted#==0,#prefix_role_type#!=2)){\n DBFind(@1roles).Where({\"ecosystem\": #ecosystem_id#, \"id\": [{\"$in\": #prefix_roles_access#}, {\"$eq\": #role_id#}]}).Columns(\"id\").Vars(manager)\n }\n\n If(#manager_id#>0){\n AddToolButton(Page: @1roles_assign, PageParams: \"v_role_id=#v_role_id#\", Icon: icon-plus, Title: $@1assign$).Popup(50, $@1assign$)\n }\n\n SetTitle(\"$@1role$\": #prefix_role_name#)\n Span(Class: h5 m0 mb ml-lg){\n LinkPage(Class: ml-sm, Body: $@1roles$, Page: @1roles_list)\n Span(Class: text-muted mh-sm, Body: /)\n Span(Class: text-muted, Body: #prefix_role_name#)\n }.Style(\n display: inline-block;\n )\n\n If(#search#){\n SetVar(w_search, {\"member->member_name\": {\"$ilike\": \"#search#\"}})\n }\n SetVar(where, {\"ecosystem\":#ecosystem_id#, \"role->id\":#v_role_id#, {#w_search#}})\n\n Div(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1member)).(page_par, #v_role_id#)\n Include(@1search)\n }\n\n DBFind(#this_table#, src_participants).Where(#where#).Order({\"deleted\": 1, \"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,member->member_id,member->member_name,member->image_id,appointed->member_id,appointed->member_name,appointed->voting_id,appointed->voting_name,date_created,date_deleted,deleted\").Custom(custom_id){\n If(#deleted# == 0){\n SetVar(Name: style_text, Value: \"text-normal\")\n SetVar(Name: style_link, Value: \"text-primary\")\n }.Else{\n SetVar(Name: style_text, Value: \"text-muted\")\n SetVar(Name: style_link, Value: \"text-muted\")\n }\n Span(Class: #style_text#, Body: #id#)\n }.Custom(custom_appointed){\n If(Or(#appointed.member_id#>0,#appointed.member_id#<0)){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#appointed.member_id#\"){\n Span(Body: #appointed.member_name#)\n }\n }\n If(#appointed.voting_id#>0){\n LinkPage(Class:#style_link# h5 text-bold, Page: @1voting_view, PageParams: \"vID=#appointed.voting_id#\"){\n Span(Body: #appointed.voting_name#)\n }\n }\n }.Custom(custom_member){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#member.member_id#\"){\n If(#member.image_id#>0){\n Image(Src: Binary().ById(#member.image_id#), Class: img-circle).Style(width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(#member.member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(#member.member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n }.Custom(custom_address){\n Span(Class: #style_text#, Body: Address(#member.member_id#))\n }.Custom(custom_date){\n Div(Class: #style_text# h6 m0, Body: DateTime(DateTime: #date_created#, Format: \"DD.MM.YYYY HH:MI\"))\n Div(Class: #style_text# h6 m0, Body: DateTime(DateTime: #date_deleted#, Format: \"DD.MM.YYYY HH:MI\"))\n }.Custom(custom_status){\n If(#deleted# == 0){\n Span(Class: #style_text#, Body: LangRes(@1active))\n }.Else{\n Span(Class: #style_text#, Body: LangRes(@1deleted))\n }\n }.Custom(actions){\n Div(pull-right){\n If(#deleted#==0){\n Button(Class: btn bg-gray-lighter mh-sm, Contract: @1RolesUnassign, Params: \"RowId=#id#\", Page: @1roles_view, PageParams: \"v_role_id=#v_role_id#\"){\n Em(Class: text-danger fa fa-1x fa-trash)\n }.Alert(Text: \"$@1sure_want_delete_member$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n }.Count(count)\n\n Div(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src_participants, \"$@1member$=custom_member,$@1address$=custom_address,$@1appointed$=custom_appointed,$@1appointed_deleted_member$=custom_date,$@1status$=custom_status,=actions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1participants$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n }\n Div(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n }\n}.Else{\n Div(md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n}", + "Value": "If(#page_par#!=\"\"){\n SetVar(Name: v_role_id, Value: #page_par#)\n}\n\nIf(#v_role_id#>0){\n SetVar(this_page, @1roles_view).(this_table, @1roles_participants)\n Include(@1pager_header)\n\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#v_role_id#\"}).Columns(\"role_name,role_type,deleted,roles_access,creator->account\").Vars(prefix)\n If(#prefix_creator_account#==#account_id#){\n SetVar(manager_id,1)\n }.ElseIf(And(#prefix_roles_access#!=\"NULL\",#prefix_roles_access#!=\"\",#prefix_roles_access#!=\"[]\",#role_id#>0,#prefix_deleted#==0,#prefix_role_type#!=2)){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": [{\"$in\": #prefix_roles_access#}, {\"$eq\": \"#role_id#\"}]}).Columns(\"id\").Vars(manager)\n }\n\n If(#manager_id#>0){\n AddToolButton(Page: @1roles_assign, PageParams: \"v_role_id=#v_role_id#\", Icon: icon-plus, Title: $@1assign$).Popup(50, $@1assign$)\n }\n\n SetTitle(\"$@1role$\": #prefix_role_name#)\n Span(Class: h5 m0 mb ml-lg){\n LinkPage(Class: ml-sm, Body: $@1roles$, Page: @1roles_list)\n Span(Class: text-muted mh-sm, Body: /)\n Span(Class: text-muted, Body: #prefix_role_name#)\n }.Style(\n display: inline-block;\n )\n\n If(#search#){\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"role->id\": \"#v_role_id#\", \"member->member_name\": {\"$ilike\": \"#search#\"}})\n }.Else{\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"role->id\": \"#v_role_id#\"})\n }\n\n Div(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1member)).(page_par, #v_role_id#)\n Include(@1search)\n }\n\n DBFind(#this_table#, src_participants).Where(#where#).Order({\"deleted\": 1, \"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,member->account,member->member_name,member->image_id,appointed->account,appointed->member_name,appointed->voting_id,appointed->voting_name,date_created,date_deleted,deleted\").Custom(custom_id){\n If(#deleted# == 0){\n SetVar(Name: style_text, Value: \"text-normal\")\n SetVar(Name: style_link, Value: \"text-primary\")\n }.Else{\n SetVar(Name: style_text, Value: \"text-muted\")\n SetVar(Name: style_link, Value: \"text-muted\")\n }\n Span(Class: #style_text#, Body: #id#)\n }.Custom(custom_appointed){\n If(And(#appointed.account# != \"\", #appointed.account# != NULL)){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#appointed.account#\"){\n Span(Body: #appointed.member_name#)\n }\n }\n If(#appointed.voting_id#>0){\n LinkPage(Class:#style_link# h5 text-bold, Page: @1voting_view, PageParams: \"vID=#appointed.voting_id#\"){\n Span(Body: #appointed.voting_name#)\n }\n }\n }.Custom(custom_member){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#member.account#\"){\n If(#member.image_id#>0){\n Image(Src: Binary().ById(#member.image_id#), Class: img-circle).Style(width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(#member.member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(#member.member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n }.Custom(custom_address){\n Span(Class: #style_text#, Body: #member.account#)\n }.Custom(custom_date){\n Div(Class: #style_text# h6 m0, Body: DateTime(DateTime: #date_created#, Format: \"DD.MM.YYYY HH:MI\"))\n Div(Class: #style_text# h6 m0, Body: DateTime(DateTime: #date_deleted#, Format: \"DD.MM.YYYY HH:MI\"))\n }.Custom(custom_status){\n If(#deleted# == 0){\n Span(Class: #style_text#, Body: LangRes(@1active))\n }.Else{\n Span(Class: #style_text#, Body: LangRes(@1deleted))\n }\n }.Custom(actions){\n Div(pull-right){\n If(#deleted#==0){\n Button(Class: btn bg-gray-lighter mh-sm, Contract: @1RolesUnassign, Params: \"RowId=#id#\", Page: @1roles_view, PageParams: \"v_role_id=#v_role_id#\"){\n Em(Class: text-danger fa fa-1x fa-trash)\n }.Alert(Text: \"$@1sure_want_delete_member$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n }.Count(count)\n\n Div(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src_participants, \"$@1member$=custom_member,$@1address$=custom_address,$@1appointed$=custom_appointed,$@1appointed_deleted_member$=custom_date,$@1status$=custom_status,=actions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1participants$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n }\n Div(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n }\n}.Else{\n Div(md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "select_ecosystem", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "If(#Type#==ALL_LIST){\n DBFind(@1ecosystems,items).Limit(250).Columns(\"name,id\")\n SetVar(name_column,\"name\")\n SetVar(value_column,\"id\")\n}\nIf(#Type#==ONLY_MY){\n DBFind(@1parameters,items).Where({\"$and\": [{\"ecosystem\": {\"$neq\": 1}}, {\"$or\": [{\"$and\": [{\"name\": \"founder_account\"},{\"value\": #key_id#}]},{\"$and\": [{\"name\": \"delegate_account\"},{\"value\": #key_id#}]}]}]}).Columns(\"ecosystem\").Custom(\"custom_name\"){\n DBFind(@1ecosystems).Where({\"id\": #ecosystem#}).Vars(eco)\n Span(#eco_name#)\n }\n SetVar(name_column,\"custom_name\")\n SetVar(value_column,\"ecosystem\")\n}\n\nForm(){\n Div(row){\n Div(col-md-12 text-left){\n Select(Name: EcosystemId, Source: items, NameColumn: #name_column#, ValueColumn: #value_column#, Value: #EcosystemId#)\n }\n }\n If(#back_header#!=\"\"){\n Button(Body: LangRes(@1select), Class: btn btn-primary pull-right mt, Page: #back_page#, PageParams: \"EcosystemId=Val(EcosystemId)\").Popup(Header: #back_header#, Width: 50)\n If(#go_home# == 1) {\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1ec_list)\n }.Else{\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#, PageParams: \"EcosystemId=#EcosystemId#\").Popup(Header: #back_header#, Width: 50)\n }\n }.Else{\n Button(Body: LangRes(@1select), Class: btn btn-primary pull-right mt, Page: #back_page#, PageParams: \"EcosystemId=Val(EcosystemId)\")\n If(#go_home# == 1) {\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1ec_list)\n }.Else{\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#, PageParams: \"EcosystemId=#EcosystemId#\")\n }\n }\n}", + "Value": "If(#Type# == \"ALL_LIST\"){\n DBFind(\"@1ecosystems\", items).Limit(250).Columns(\"name,id\")\n SetVar(name_column, \"name\")\n SetVar(value_column, \"id\")\n}\nIf(#Type# == \"ONLY_MY\"){\n SetVar(account_key, AddressToId(#account_id#))\n DBFind(\"@1parameters\", items).Where({\"$and\": [{\"ecosystem\": {\"$neq\": 1}}, {\"$or\": [{\"$and\": [{\"name\": \"founder_account\"}, {\"value\": \"#account_key#\"}]}, {\"$and\": [{\"name\": \"delegate_account\"}, {\"value\": \"#account_key#\"}]}]}]}).Columns(\"ecosystem\").Custom(\"custom_name\"){\n DBFind(\"@1ecosystems\").Where({\"id\": \"#ecosystem#\"}).Vars(eco)\n Span(#eco_name#)\n }\n SetVar(name_column, \"custom_name\")\n SetVar(value_column, \"ecosystem\")\n}\n\nForm(){\n Div(row){\n Div(col-md-12 text-left){\n Select(Name: EcosystemId, Source: items, NameColumn: #name_column#, ValueColumn: #value_column#, Value: #EcosystemId#)\n }\n }\n If(#back_header#){\n Button(Body: LangRes(@1select), Class: btn btn-primary pull-right mt, Page: #back_page#, PageParams: \"EcosystemId=Val(EcosystemId)\").Popup(Header: #back_header#, Width: 50)\n If(#go_home# == 1) {\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1ec_list)\n }.Else{\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#, PageParams: \"EcosystemId=#EcosystemId#\").Popup(Header: #back_header#, Width: 50)\n }\n }.Else{\n Button(Body: LangRes(@1select), Class: btn btn-primary pull-right mt, Page: #back_page#, PageParams: \"EcosystemId=Val(EcosystemId)\")\n If(#go_home# == 1) {\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1ec_list)\n }.Else{\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#, PageParams: \"EcosystemId=#EcosystemId#\")\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "select_group", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1select_group).(this_table, @1groups).(current_header, $@1groups$).(pager_limit, 10)\nInclude(@1pager_header)\n\nIf(#page_par#){\n SetVar(EcosystemId, #page_par#)\n}.Else{\n SetVar(page_par, #EcosystemId#)\n}\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": #EcosystemId#, \"deleted\": 0, \"group_name\": #search#})\n}.Else{\n SetVar(where, {\"ecosystem\": #EcosystemId#, \"deleted\": 0})\n}\n\nDiv(){\n Form(input-group){\n Div(input-group-addon){\n LangRes(@1name)\n }\n Input(Name: search, Value: #search#, Placeholder: $@1text_to_search$)\n Div(input-group-btn){\n If(#search#!=\"\"){\n Button(Class: btn bg-gray-lighter fa fa-close mtl buttons, Page: #this_page#, PageParams: \"back_page=#back_page#,back_header=#back_header#,parent_back_page=#parent_back_page#,EcosystemId=#EcosystemId#,Id=#Id#\").Popup(Header: #current_header#, Width: \"50\")\n }\n Button(Class: btn bg-gray-lighter mtl buttons, Page: #this_page#, PageParams: \"back_page=#back_page#,back_header=#back_header#,parent_back_page=#parent_back_page#,EcosystemId=#EcosystemId#,search=Val(search),Id=#Id#\", Body: Em(Class: fa fa-search) $@1search$).Popup(Header: #current_header#, Width: \"50\")\n }\n }\n}.Style(\n .buttons {\n border: 1px solid #dde6e9;\n }\n)\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_id){\n Span(Class: h6 text-muted, Body: #id#)\n}.Custom(_name){\n If(#back_header#!=\"\"){\n Button(Class: btn-xs btn-link, Page: #back_page#, PageParams: \"GroupId=#id#,EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\"){\n Span(Class: h5 text-bold, Body: #group_name#)\n }.Popup(Header: #back_header#, Width: 50)\n }.Else{\n Button(Class: btn-xs btn-link, Page: #back_page#, PageParams: \"GroupId=#id#,EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\"){\n Span(Class: h5 text-bold, Body: #group_name#)\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n If(#count# > 0){\n Table(src,\"=_name\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1groups$ $@1not_founded$\")\n }\n}\nDiv(){\n Include(@1pager_for_popup)\n If(#back_header#!=\"\"){\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\").Popup(Header: #back_header#, Width: \"50\")\n }.Else{\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\")\n }\n}", + "Value": "SetVar(this_page, @1select_group).(this_table, @1groups).(current_header, $@1groups$).(pager_limit, 10)\nInclude(@1pager_header)\n\nIf(#page_par#){\n SetVar(EcosystemId, #page_par#)\n}.Else{\n SetVar(page_par, #EcosystemId#)\n}\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": \"#EcosystemId#\", \"deleted\": 0, \"group_name\": {\"$ilike\": \"#search#\"}})\n}.Else{\n SetVar(where, {\"ecosystem\": \"#EcosystemId#\", \"deleted\": 0})\n}\n\nDiv(){\n Form(input-group){\n Div(input-group-addon){\n LangRes(@1name)\n }\n Input(Name: search, Value: #search#, Placeholder: $@1text_to_search$)\n Div(input-group-btn){\n If(#search#!=\"\"){\n Button(Class: btn bg-gray-lighter fa fa-close mtl buttons, Page: #this_page#, PageParams: \"back_page=#back_page#,back_header=#back_header#,parent_back_page=#parent_back_page#,EcosystemId=#EcosystemId#,Id=#Id#\").Popup(Header: #current_header#, Width: \"50\")\n }\n Button(Class: btn bg-gray-lighter mtl buttons, Page: #this_page#, PageParams: \"back_page=#back_page#,back_header=#back_header#,parent_back_page=#parent_back_page#,EcosystemId=#EcosystemId#,search=Val(search),Id=#Id#\", Body: Em(Class: fa fa-search) $@1search$).Popup(Header: #current_header#, Width: \"50\")\n }\n }\n}.Style(\n .buttons {\n border: 1px solid #dde6e9;\n }\n)\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_id){\n Span(Class: h6 text-muted, Body: #id#)\n}.Custom(_name){\n If(#back_header#!=\"\"){\n Button(Class: btn-xs btn-link, Page: #back_page#, PageParams: \"GroupId=#id#,EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\"){\n Span(Class: h5 text-bold, Body: #group_name#)\n }.Popup(Header: #back_header#, Width: 50)\n }.Else{\n Button(Class: btn-xs btn-link, Page: #back_page#, PageParams: \"GroupId=#id#,EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\"){\n Span(Class: h5 text-bold, Body: #group_name#)\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n If(#count# > 0){\n Table(src,\"=_name\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1groups$ $@1not_founded$\")\n }\n}\nDiv(){\n Include(@1pager_for_popup)\n If(#back_header#!=\"\"){\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\").Popup(Header: #back_header#, Width: \"50\")\n }.Else{\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\")\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "select_role", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1select_role).(this_table, @1roles).(current_header, $@1roles$).(pager_limit, 10)\nInclude(@1pager_header)\n\nIf(#page_par#){\n SetVar(EcosystemId, #page_par#)\n}.Else{\n SetVar(page_par, #EcosystemId#)\n}\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": #EcosystemId#, \"deleted\": 0, \"role_name\": #search#})\n}.Else{\n SetVar(where, {\"ecosystem\": #EcosystemId#, \"deleted\": 0})\n}\n\nDiv(){\n Form(input-group){\n Div(input-group-addon){\n LangRes(@1name)\n }\n Input(Name: search, Value: #search#, Placeholder: $@1text_to_search$)\n Div(input-group-btn){\n If(#search#!=\"\"){\n Button(Class: btn bg-gray-lighter fa fa-close mtl buttons, Page: #this_page#, PageParams: \"back_page=#back_page#,back_header=#back_header#,parent_back_page=#parent_back_page#,EcosystemId=#EcosystemId#,Id=#Id#\").Popup(Header: #current_header#, Width: \"50\")\n }\n Button(Class: btn bg-gray-lighter mtl buttons, Page: #this_page#, PageParams: \"back_page=#back_page#,back_header=#back_header#,parent_back_page=#parent_back_page#,EcosystemId=#EcosystemId#,search=Val(search),Id=#Id#\", Body: Em(Class: fa fa-search) $@1search$).Popup(Header: #current_header#, Width: \"50\")\n }\n }\n}.Style(\n .buttons {\n border: 1px solid #dde6e9;\n }\n)\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_id){\n Span(Class: h6 text-muted, Body: #id#)\n}.Custom(_name){\n If(#back_header#!=\"\"){\n Button(Class: btn-xs btn-link, Page: #back_page#, PageParams: \"RoleId=#id#,EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\"){\n Span(Class: h5 text-bold, Body: #role_name#)\n }.Popup(Header: #back_header#, Width: 50)\n }.Else{\n Button(Class: btn-xs btn-link, Page: #back_page#, PageParams: \"RoleId=#id#,EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\"){\n Span(Class: h5 text-bold, Body: #role_name#)\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n If(#count# > 0){\n Table(src,\"=_name\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1roles$ $@1not_founded$\")\n }\n}\nDiv(){\n Include(@1pager_for_popup)\n If(#back_header#!=\"\"){\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\").Popup(Header: #back_header#, Width: \"50\")\n }.Else{\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\")\n }\n}", + "Value": "SetVar(this_page, @1select_role).(this_table, @1roles).(current_header, $@1roles$).(pager_limit, 10)\nInclude(@1pager_header)\n\nIf(#page_par#){\n SetVar(EcosystemId, #page_par#)\n}.Else{\n SetVar(page_par, #EcosystemId#)\n}\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": \"#EcosystemId#\", \"deleted\": 0, \"role_name\": {\"$ilike\": \"#search#\"}})\n}.Else{\n SetVar(where, {\"ecosystem\": \"#EcosystemId#\", \"deleted\": 0})\n}\n\nDiv(){\n Form(input-group){\n Div(input-group-addon){\n LangRes(@1name)\n }\n Input(Name: search, Value: #search#, Placeholder: $@1text_to_search$)\n Div(input-group-btn){\n If(#search#!=\"\"){\n Button(Class: btn bg-gray-lighter fa fa-close mtl buttons, Page: #this_page#, PageParams: \"back_page=#back_page#,back_header=#back_header#,parent_back_page=#parent_back_page#,EcosystemId=#EcosystemId#,Id=#Id#\").Popup(Header: #current_header#, Width: \"50\")\n }\n Button(Class: btn bg-gray-lighter mtl buttons, Page: #this_page#, PageParams: \"back_page=#back_page#,back_header=#back_header#,parent_back_page=#parent_back_page#,EcosystemId=#EcosystemId#,search=Val(search),Id=#Id#\", Body: Em(Class: fa fa-search) $@1search$).Popup(Header: #current_header#, Width: \"50\")\n }\n }\n}.Style(\n .buttons {\n border: 1px solid #dde6e9;\n }\n)\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_id){\n Span(Class: h6 text-muted, Body: #id#)\n}.Custom(_name){\n If(#back_header#!=\"\"){\n Button(Class: btn-xs btn-link, Page: #back_page#, PageParams: \"RoleId=#id#,EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\"){\n Span(Class: h5 text-bold, Body: #role_name#)\n }.Popup(Header: #back_header#, Width: 50)\n }.Else{\n Button(Class: btn-xs btn-link, Page: #back_page#, PageParams: \"RoleId=#id#,EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\"){\n Span(Class: h5 text-bold, Body: #role_name#)\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n If(#count# > 0){\n Table(src,\"=_name\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1roles$ $@1not_founded$\")\n }\n}\nDiv(){\n Include(@1pager_for_popup)\n If(#back_header#!=\"\"){\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\").Popup(Header: #back_header#, Width: \"50\")\n }.Else{\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\")\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "select_wallet", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1select_wallet).(this_table, @1keys).(current_header, $@1member$).(pager_limit, 10)\nInclude(@1pager_header)\n\nIf(#page_par#){\n SetVar(EcosystemId, #page_par#)\n}.Else{\n SetVar(page_par, #EcosystemId#)\n}\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": #EcosystemId#, \"id\": {\"$neq\":#guest_key#}, \"deleted\": 0, \"id\": AddressToId(#search#)})\n}.Else{\n SetVar(where, {\"ecosystem\": #EcosystemId#, \"id\": {\"$neq\":#guest_key#}, \"deleted\": 0})\n}\n\nDiv(){\n Form(input-group){\n Div(input-group-addon){\n LangRes(@1wallet)\n }\n Input(Name: search, Value: #search#, Placeholder: $@1text_to_search$)\n Div(input-group-btn){\n If(#search#){\n Button(Class: btn bg-gray-lighter fa fa-close mtl buttons, Page: #this_page#, PageParams: \"back_page=#back_page#,back_header=#back_header#,parent_back_page=#parent_back_page#,EcosystemId=#EcosystemId#,Id=#Id#\").Popup(Header: #current_header#, Width: \"50\")\n }\n Button(Class: btn bg-gray-lighter mtl buttons, Page: #this_page#, PageParams: \"back_page=#back_page#,back_header=#back_header#,parent_back_page=#parent_back_page#,EcosystemId=#EcosystemId#,search=Val(search),Id=#Id#\", Body: Em(Class: fa fa-search) $@1search$).Popup(Header: #current_header#, Width: \"50\")\n }\n }\n}.Style(\n .buttons{border: 1px solid #dde6e9;}\n)\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(custom_id){\n Span(Class: h6 text-muted, Body: #id#)\n SetVar(m_id, 0)\n DBFind(@1members).Where({\"ecosystem\": #ecosystem_id#, \"id\": #id#}).Vars(m)\n If(Or(#m_id#>0,#m_id#<0)){\n SetVar(image_id, #m_image_id#)\n SetVar(member_name, #m_member_name#)\n }.Else{\n SetVar(image_id, 0)\n SetVar(member_name, Address(#id#))\n }\n}.Custom(custom_member_id){\n If(#back_header#!=\"\"){\n Button(Class: btn-xs btn-link pull-right, Page: #back_page#, PageParams: \"MemberId=#id#,EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\"){\n Span(Class: h5 text-bold, Body: Address(#id#))\n }.Popup(Header: #back_header#, Width: 50)\n }.Else{\n Button(Class: btn-xs btn-link pull-right, Page: #back_page#, PageParams: \"MemberId=#id#,EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\"){\n Span(Class: h5 text-bold, Body: Address(#id#))\n }\n }\n}.Custom(custom_ecosystem){\n Span(Class: text-muted h5, Body: $@1ecosystem$ #EcosystemId#)\n}.Custom(custom_username){\n If(#image_id#>0){\n Image(Src: Binary().ById(#image_id#), Class: img-circle).Style(height: 30px;width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(Class: h5, Body: #member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(Class: h5, Body: #member_name#)\n }.Style(display:flex; align-items:center;)\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive){\n Div(){\n If(#count# > 0){\n Table(src, \"=custom_username,=custom_ecosystem,=custom_member_id\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1members$ $@1not_founded$\")\n }\n }.Style(\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(){\n Include(@1pager_for_popup)\n If(#back_header#!=\"\"){\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\").Popup(Header: #back_header#, Width: \"50\")\n }.Else{\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\")\n }\n}", + "Value": "SetVar(this_page, @1select_wallet).(this_table, @1keys).(current_header, $@1member$).(pager_limit, 10)\nInclude(@1pager_header)\n\nIf(#page_par#){\n SetVar(EcosystemId, #page_par#)\n}.Else{\n SetVar(page_par, #EcosystemId#)\n}\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": \"#EcosystemId#\", \"deleted\": 0, \"$and\": [{\"account\": {\"$ilike\": \"#search#\"}}, {\"account\": {\"$neq\": \"#guest_account#\"}}]})\n}.Else{\n SetVar(where, {\"ecosystem\": \"#EcosystemId#\", \"account\": {\"$neq\": \"#guest_account#\"}, \"deleted\": 0})\n}\n\nDiv(){\n Form(input-group){\n Div(input-group-addon){\n LangRes(@1wallet)\n }\n Input(Name: search, Value: #search#, Placeholder: $@1text_to_search$)\n Div(input-group-btn){\n If(#search#){\n Button(Class: btn bg-gray-lighter fa fa-close mtl buttons, Page: #this_page#, PageParams: \"back_page=#back_page#,back_header=#back_header#,parent_back_page=#parent_back_page#,EcosystemId=#EcosystemId#,Id=#Id#\").Popup(Header: #current_header#, Width: \"50\")\n }\n Button(Class: btn bg-gray-lighter mtl buttons, Page: #this_page#, PageParams: \"back_page=#back_page#,back_header=#back_header#,parent_back_page=#parent_back_page#,EcosystemId=#EcosystemId#,search=Val(search),Id=#Id#\", Body: Em(Class: fa fa-search) $@1search$).Popup(Header: #current_header#, Width: \"50\")\n }\n }\n}.Style(\n .buttons{border: 1px solid #dde6e9;}\n)\n\nDBFind(#this_table#, src).Where(#where#).Order({\"account\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(custom_id){\n Span(Class: h6 text-muted, Body: #account#)\n SetVar(m_account,)\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#account#\"}).Vars(m)\n If(#m_account#){\n SetVar(image_id, #m_image_id#)\n SetVar(member_name, #m_member_name#)\n }.Else{\n SetVar(image_id, 0)\n SetVar(member_name, #account#)\n }\n}.Custom(custom_account){\n If(#back_header#!=\"\"){\n Button(Class: btn-xs btn-link pull-right, Page: #back_page#, PageParams: \"MemberAccount=#account#,EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\"){\n Span(Class: h5 text-bold, Body: #account#)\n }.Popup(Header: #back_header#, Width: 50)\n }.Else{\n Button(Class: btn-xs btn-link pull-right, Page: #back_page#, PageParams: \"MemberAccount=#account#,EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\"){\n Span(Class: h5 text-bold, Body: #account#)\n }\n }\n}.Custom(custom_ecosystem){\n Span(Class: text-muted h5, Body: $@1ecosystem$ #EcosystemId#)\n}.Custom(custom_username){\n If(#image_id#>0){\n Image(Src: Binary().ById(#image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(Class: h5, Body: #member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right: 10px;)\n Span(Class: h5, Body: #member_name#)\n }.Style(display:flex; align-items:center;)\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive){\n Div(){\n If(#count# > 0){\n Table(src, \"=custom_username,=custom_ecosystem,=custom_account\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1members$ $@1not_founded$\")\n }\n }.Style(\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(){\n Include(@1pager_for_popup)\n If(#back_header#!=\"\"){\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\").Popup(Header: #back_header#, Width: \"50\")\n }.Else{\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#\")\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "sysparams_list", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1sysparams_list).(this_table, @1system_parameters)\nInclude(@1pager_header)\n\nSetTitle(\"$@1platform_parameters$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1platform_params_desc$\"))\nDBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"System\"}).Vars(\"system_app\")\nSetVar(role_validator, AppParam(App: #system_app_id#, Name: \"role_validator\"))\nDBFind(@1roles_participants).Where({\"ecosystem\": #ecosystem_id#, \"member->member_id\": #key_id#, \"role->id\": #role_validator#, \"deleted\": 0}).Columns(\"id\").Vars(validator)\nIf(#validator_id#>0){\n AddToolButton(Title: $@1sysparams_validator_resign$, Icon: icon-pin, Page: @1validator_resign).Popup(50, $@1sysparams_validator_resign$)\n}\n\nIf(#search#){\n SetVar(w_search, {\"name\": {\"$ilike\": \"#search#\"}})\n}\nSetVar(where, {#w_search#})\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1name))\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_actions){\n SetVar(sp_id,0)\n DBFind(@1contracts).Where({\"ecosystem\": 1, \"name\": #name#}).Columns(id).Vars(sp)\n If(#sp_id#>0){\n Span(Class: pull-right){\n LinkPage(Class: text-primary h4, Body: Em(Class: fa fa-cogs), Page: @1sysparams_voting, PageParams: \"param_index=#id#,param_name=#name#\")\n }\n }.Else{\n Span(Class: pull-right){\n $@1contract_404$\n }\n }\n}.Custom(_name){\n Div(){\n #name#\n }.Style(min-width:200px;)\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1name$=_name,$@1value$=value,=_actions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1platform_parameters$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, @1sysparams_list).(this_table, @1system_parameters)\nInclude(@1pager_header)\n\nSetTitle(\"$@1platform_parameters$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1platform_params_desc$\"))\nDBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(system_app)\nSetVar(role_consortium_member, AppParam(App: #system_app_id#, Name: \"role_consortium_member\"))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"member->account\": \"#account_id#\", \"role->id\": \"#role_consortium_member#\", \"deleted\": 0}).Columns(\"id\").Vars(consortium_member)\nIf(#consortium_member_id#>0){\n AddToolButton(Title: $@1consortium_member_resign$, Icon: icon-pin, Page: @1consortium_member_resign).Popup(50, $@1consortium_member_resign$)\n}\n\nIf(#search#){\n SetVar(where, {\"name\": {\"$ilike\": \"#search#\"}})\n}.Else{\n SetVar(where, {})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1name))\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_actions){\n SetVar(sp_id,0)\n DBFind(\"@1contracts\").Where({\"ecosystem\": 1, \"name\": \"#name#\"}).Columns(id).Vars(sp)\n If(#sp_id#>0){\n Span(Class: pull-right){\n LinkPage(Class: text-primary h4, Body: Em(Class: fa fa-cogs), Page: @1sysparams_voting, PageParams: \"param_index=#id#,param_name=#name#\")\n }\n }.Else{\n Span(Class: pull-right){\n $@1contract_404$\n }\n }\n}.Custom(_name){\n Div(){\n #name#\n }.Style(min-width:200px;)\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1name$=_name,$@1value$=value,=_actions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1platform_parameters$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "sysparams_metrics", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(\"@1ecosystems\").WhereId(#Id#).Vars(\"eco\")\n\nDiv(content-wrapper){\n Div(breadcrumb){\n LinkPage(Body: LangRes(@1ecosystems), Page: @1ecosystems_list)\n Span(\"/\",mh-sm)\n Span(LangRes(@1metrics), text-muted)\n }\n SetVar(title,\"LangRes(@1metrics)\")\n SetTitle(#title#)\n Div(container){\n If(#Id#){\n SetVar(title, LangRes(@1metrics): #eco_name# (#Id#))\n SetTitle(#title#)\n Data(tables, \"Name,Metric\"){\n pages,ecosystem_pages\n members,ecosystem_members\n tx,ecosystem_tx\n }\n ForList(tables){\n DBFind(@1metrics,src_metric).Where({\"key\": #Id#, \"metric\": #Metric#}).Order(\"time\").Count(count)\n If(#count#>0){\n Div(h3){LangRes(#Name#)}\n Table(src_metric,\"$@1timestam$=time,$@1value$=value\")\n }\n }\n }.Else{\n Div(alert alert-warning){\n Ecosystem id not found\n }\n }\n }\n}", + "Value": "DBFind(\"@1ecosystems\").WhereId(#Id#).Vars(eco)\n\nDiv(content-wrapper){\n Div(breadcrumb){\n LinkPage(Body: LangRes(@1ecosystems), Page: @1ecosystems_list)\n Span(\"/\",mh-sm)\n Span(LangRes(@1metrics), text-muted)\n }\n SetVar(title,\"LangRes(@1metrics)\")\n SetTitle(#title#)\n Div(container){\n If(#Id#){\n SetVar(title, LangRes(@1metrics): #eco_name# (#Id#))\n SetTitle(#title#)\n Data(tables, \"Name,Metric\"){\n pages,ecosystem_pages\n members,ecosystem_members\n tx,ecosystem_tx\n }\n ForList(tables){\n DBFind(\"@1metrics\", src_metric).Where({\"key\": \"#Id#\", \"metric\": \"#Metric#\"}).Order(\"time\").Count(count)\n If(#count#>0){\n Div(h3){LangRes(#Name#)}\n Table(src_metric,\"$@1timestam$=time,$@1value$=value\")\n }\n }\n }.Else{\n Div(alert alert-warning){\n Ecosystem id not found\n }\n }\n }\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "sysparams_voting", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetTitle($@1voting$: #param_name#)\nSpan(Class: h5 m0 mb ml-lg){\n LinkPage(Class: ml-sm, Body: $@1system_params$, Page: @1sysparams_list)\n Span(Class: text-muted mh-sm, Body: /)\n Span(Class: text-muted, Body: #param_name#)\n}.Style(\n display: inline-block;\n)\n\nForm(content-wrapper){\n If(#param_name#==\"\"){\n Div(text-danger text-center text-bold){\n LangRes(@1attention)\n }\n }\n\n DBFind(@1applications).Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\n If(#param_name# == full_nodes){\n SetVar(template_id, AppParam(Ecosystem:1, App:#application_id#, Name: voting_template_validators))\n }.Else{\n SetVar(template_id, AppParam(Ecosystem:1, App:#application_id#, Name: voting_template_platformparams))\n }\n If(#template_id#){\n DBFind(@1voting_templates).Where({\"ecosystem\": #ecosystem_id#, \"id\": #template_id#}).Columns(\"subject->voters\").Vars(template)\n }\n\n If(#template_id# > 0){}.Else{\n Div(text-danger text-center text-bold){\n Div(mb-sm){\n LangRes(@1voting_template_not_found)\n }\n LinkPage(Page: @1voting_templates_list, Class: btn btn-info){\n LangRes(@1template_set)\n }\n }\n }\n\n If(#template_id# > 0){\n If(#param_name# != full_nodes){\n DBFind(@1system_parameters).Where({\"name\": #param_name#}).Vars(param)\n Div(form-group){\n Label($@1name$)\n Input(Name: Name, Value: #param_name#, Disabled: true)\n }\n Div(form-group){\n Label($@1value$)\n Input(Name: OldValue, Value: #param_value#, Disabled: true)\n }\n Div(form-group){\n Label($@1new_value$) \n Input(Name: Value, Type: textarea)\n }\n Div(text-left){\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: @1sysparams_list)\n If(And(#template_subject_voters#>0,#template_subject_voters#==#role_id#)){\n Button(Body: LangRes(@1voting), Class: btn btn-primary pull-right, Contract: @1VotingRunEditPlatformParam, Page: @1voting_list)\n }.Else{\n If(#template_id# > 0){\n Span($@1voting_not_participant$, text-muted pull-right)\n }.Else{\n Span($@1voting_template_not_found$, text-muted pull-right)\n }\n }\n }\n }.Else{\n SetVar(full_nodes, SysParam(full_nodes))\n SetVar(first_node, AppParam(Ecosystem:1, App:#application_id#, Name: first_node)).(first_node_set, \"\")\n If(`#full_nodes#` == \"\"){\n JsonToSource(src_first_node, #first_node#)\n ForList(src_first_node){\n If(#value#==\"\"){\n SetVar(first_node_set, error)\n }\n }\n If(#first_node_set#==error){\n Div(text-center){\n ForList(src_first_node){\n If(#value#==\"\"){\n Div(){first node: '#key#' empty}\n }\n }\n }\n Div(text-center){\n DBFind(@1app_params).Where({\"ecosystem\": #ecosystem_id#, \"name\": first_node}).Vars(first_node_param)\n Button(Page: @1app_params_edit, Class: btn btn-info, PageParams: \"id=#first_node_param_id#,back_page=@1sysparams_list\", Body: $@1install_first_node$)\n }\n }\n }.Else{\n ArrayToSource(src_full_nodes, `#full_nodes#`)\n ForList(src_full_nodes){\n JsonToSource(src_node, `#value#`)\n Div(list-group-item){\n Div(row){\n Div(col-md-9 text-left){\n Label(){node #key#}\n ForList(src_node){\n P(Class: h6 m0, Body: Strong(#key#:) #value#)\n }\n }\n Div(col-md-3 text-right mt-lg){\n If(And(#template_subject_voters#>0,#template_subject_voters#==#role_id#)){\n SetVar(Index, Calculate(#src_full_nodes_index# - 1))\n Button(Body: $@1delete$, Class: btn btn-danger mt, Contract: @1VotingRunRemoveValidator, Params: \"Index=#Index#\" Page: @1voting_list)\n }.Else{\n Div(mt-lg){\n If(#template_id# > 0){\n Span($@1voting_not_participant$, text-muted)\n }.Else{\n Span($@1voting_template_not_found$, text-muted)\n }\n }\n }\n }\n }\n }.Style(word-break: break-all;)\n }\n }\n }\n }\n}", + "Value": "SetTitle($@1voting$: #param_name#)\nSpan(Class: h5 m0 mb ml-lg){\n LinkPage(Class: ml-sm, Body: $@1system_params$, Page: @1sysparams_list)\n Span(Class: text-muted mh-sm, Body: /)\n Span(Class: text-muted, Body: #param_name#)\n}.Style(\n display: inline-block;\n)\n\nForm(content-wrapper){\n If(#param_name#==\"\"){\n Div(text-danger text-center text-bold){\n LangRes(@1attention)\n }\n }\n\n DBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\n If(#param_name# == full_nodes){\n SetVar(template_id, AppParam(Ecosystem:1, App:#application_id#, Name: voting_template_consortium_member))\n }.Else{\n SetVar(template_id, AppParam(Ecosystem:1, App:#application_id#, Name: voting_template_platformparams))\n }\n If(#template_id#){\n DBFind(\"@1voting_templates\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#template_id#\"}).Columns(\"subject->voters\").Vars(template)\n }\n\n If(#template_id# > 0){}.Else{\n Div(text-danger text-center text-bold){\n Div(mb-sm){\n LangRes(@1voting_template_not_found)\n }\n LinkPage(Page: @1voting_templates_list, Class: btn btn-info){\n LangRes(@1template_set)\n }\n }\n }\n\n If(#template_id# > 0){\n If(#param_name# != full_nodes){\n DBFind(\"@1system_parameters\").Where({\"name\": \"#param_name#\"}).Vars(param)\n Div(form-group){\n Label($@1name$)\n Input(Name: Name, Value: #param_name#, Disabled: true)\n }\n Div(form-group){\n Label($@1value$)\n Input(Name: OldValue, Value: #param_value#, Disabled: true)\n }\n Div(form-group){\n Label($@1new_value$) \n Input(Name: Value, Type: textarea)\n }\n Div(text-left){\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: @1sysparams_list)\n If(And(#template_subject_voters#>0,#template_subject_voters#==#role_id#)){\n Button(Body: LangRes(@1voting), Class: btn btn-primary pull-right, Contract: @1VotingRunEditPlatformParam, Page: @1voting_list)\n }.Else{\n If(#template_id# > 0){\n Span($@1voting_not_participant$, text-muted pull-right)\n }.Else{\n Span($@1voting_template_not_found$, text-muted pull-right)\n }\n }\n }\n }.Else{\n SetVar(full_nodes, SysParam(full_nodes))\n SetVar(first_node, AppParam(Ecosystem: 1, App :#application_id#, Name: first_node)).(first_node_set,)\n If(#full_nodes# == \"\"){\n JsonToSource(src_first_node, #first_node#)\n ForList(src_first_node){\n If(#value# == \"\"){\n SetVar(first_node_set, error)\n }\n }\n If(#first_node_set# == error){\n Div(text-center){\n ForList(src_first_node){\n If(#value#==\"\"){\n Div(){first node: '#key#' empty}\n }\n }\n }\n Div(text-center){\n DBFind(\"@1app_params\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"first_node\"}).Vars(first_node_param)\n Button(Page: @1app_params_edit, Class: btn btn-info, PageParams: \"id=#first_node_param_id#,back_page=@1sysparams_list\", Body: $@1install_first_node$)\n }\n }\n }.Else{\n ArrayToSource(src_full_nodes, `#full_nodes#`)\n ForList(src_full_nodes){\n JsonToSource(src_node, `#value#`)\n Div(list-group-item){\n Div(row){\n Div(col-md-9 text-left){\n Label(){node #key#}\n ForList(src_node){\n P(Class: h6 m0, Body: Strong(#key#:) #value#)\n }\n }\n Div(col-md-3 text-right mt-lg){\n If(And(#template_subject_voters#>0,#template_subject_voters#==#role_id#)){\n SetVar(Index, Calculate(#src_full_nodes_index# - 1))\n Button(Body: $@1delete$, Class: btn btn-danger mt, Contract: @1VotingRunRemoveConsortiumMember, Params: \"Index=#Index#\" Page: @1voting_list)\n }.Else{\n Div(mt-lg){\n If(#template_id# > 0){\n Span($@1voting_not_participant$, text-muted)\n }.Else{\n Span($@1voting_template_not_found$, text-muted)\n }\n }\n }\n }\n }\n }.Style(word-break: break-all;)\n }\n }\n }\n }\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "tokenrefund_create", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Form(){\n Div(row){\n Div(col-sm-3 text-right mt-sm){\n Label(For: Amount){\n LangRes(@1amount)\n }\n }\n Div(col-sm-9){\n Input(Name: Amount, Type: number)\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 text-right mt-sm){\n Label(For: VictimAccount){\n LangRes(@1tokens_refund_victim)\n }\n }\n Div(col-sm-9){\n Input(Name: VictimAccount, Placeholder: $@1key_id_or_wallet$)\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 text-right mt-sm){\n Label(For: SuspectAccount){\n LangRes(@1tokens_refund_attacker)\n }\n }\n Div(col-sm-9){\n Input(Name: SuspectAccount, Placeholder: $@1key_id_or_wallet$)\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 text-right mt-sm){\n Label(For: Note){\n LangRes(@1description)\n }\n }\n Div(col-sm-9){\n Input(Name: Note, Type: textarea)\n }\n }\n Button(Body: $@1request_refund$, Contract: @1VotingRunTokenRefund, Page: @1tokenrefund_list, Class: btn pull-right btn-primary mt)\n Button(Body: LangRes(@1back), Class: btn pull-right btn-default mt, Page: @1tokenrefund_list)\n}", + "Value": "Form(){\n Div(row){\n Div(col-sm-3 text-right mt-sm){\n Label(For: Amount){\n LangRes(@1amount)\n }\n }\n Div(col-sm-9){\n Input(Name: Amount, Type: number)\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 text-right mt-sm){\n Label(For: VictimAccount){\n LangRes(@1tokens_refund_victim)\n }\n }\n Div(col-sm-9){\n Input(Name: VictimAccount, Placeholder: $@1wallet_address$)\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 text-right mt-sm){\n Label(For: SuspectAccount){\n LangRes(@1tokens_refund_attacker)\n }\n }\n Div(col-sm-9){\n Input(Name: SuspectAccount, Placeholder: $@1wallet_address$)\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 text-right mt-sm){\n Label(For: Note){\n LangRes(@1description)\n }\n }\n Div(col-sm-9){\n Input(Name: Note, Type: textarea)\n }\n }\n Button(Body: $@1request_refund$, Contract: @1VotingRunTokenRefund, Page: @1tokenrefund_list, Class: btn pull-right btn-primary mt)\n Button(Body: LangRes(@1back), Class: btn pull-right btn-default mt, Page: @1tokenrefund_list)\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "tokenrefund_list", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1tokenrefund_list).(this_table, @1tokens_refund)\nInclude(@1pager_header)\n\nSetTitle(\"$@1tokens_refunds_list$\")\nDBFind(@1applications).Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\nSetVar(tid, AppParam(App: #application_id#, Name: voting_template_tokenrefund, Ecosystem: 1))\nIf(#tid# > 0){\n DBFind(@1voting_templates).Where({\"ecosystem\": #ecosystem_id#, \"id\": #tid#}).Columns(\"subject->voters\").Vars(template)\n}\nIf(And(#template_subject_voters#>0,#template_subject_voters#==#role_id#)){\n Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: $@1tokens_refunds_list_desc$))\n AddToolButton(Title: $@1create_request$, Icon: icon-plus, Page: @1tokenrefund_create).Popup(50, $@1create_request$)\n}.Else{\n If(#template_subject_voters#>0){\n Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: $@1tokens_refunds_list_allowed_role$ #template_subject_voters#))\n }.Else{\n Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: $@1template_id_not_found$))\n }\n}\n\nIf(#search#){\n SetVar(w_search, {\"note\": {\"$ilike\": \"#search#\"}})\n}\nSetVar(where, {#w_search#})\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1description))\n Include(@1search)\n}\n\nDBFind(#this_table#, src_refunds_list).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_status){\n If(#status#>0){\n SetVar(sta, AppParam(Ecosystem:1, App:#application_id#, Name: tokenrefund_status, Index: #status#))\n LangRes(#sta#)\n }\n}.Custom(_result){\n If(#result# > 0){\n SetVar(res,AppParam(Ecosystem:1, App:#application_id#, Name: tokenrefund_result, Index: #result#))\n LangRes(#res#)\n }\n}.Custom(_blocked){\n DateTime(Format: YYYY-MM-DD HH:MI:SS, DateTime: #blocked_at#)\n}.Custom(_closed){\n DateTime(Format: YYYY-MM-DD HH:MI:SS, DateTime: #closed_at#)\n}.Custom(_accounts){\n Div(){$@1tokens_refund_victim$: Address(#victim_key_id#)}\n Div(){$@1tokens_refund_attacker$: Address(#attacker_key_id#)}\n}.Custom(_amount){\n Money(#amount#)\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src_refunds_list, \"$@1accounts$=_accounts,$@1description$=note,$@1validator_id$=validator_id,$@1blocked_at$=_blocked,$@1closed$=_closed,$@1result$=_result,$@1amount$=_amount,$@1status$=_status\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1tokens_refunds$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, @1tokenrefund_list).(this_table, @1tokens_refund)\nInclude(@1pager_header)\n\nSetTitle(\"$@1tokens_refunds_list$\")\nDBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\nSetVar(tid, AppParam(App: #application_id#, Name: voting_template_tokenrefund, Ecosystem: 1))\nIf(#tid# > 0){\n DBFind(\"@1voting_templates\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#tid#\"}).Columns(\"subject->voters\").Vars(template)\n}\nIf(And(#template_subject_voters#>0,#template_subject_voters#==#role_id#)){\n Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: $@1tokens_refunds_list_desc$))\n AddToolButton(Title: $@1create_request$, Icon: icon-plus, Page: @1tokenrefund_create).Popup(50, $@1create_request$)\n}.Else{\n If(#template_subject_voters#>0){\n Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: $@1tokens_refunds_list_allowed_role$ #template_subject_voters#))\n }.Else{\n Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: $@1template_id_not_found$))\n }\n}\n\nIf(#search#){\n SetVar(where, {\"note\": {\"$ilike\": \"#search#\"}})\n}.Else{\n SetVar(where, {})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1description))\n Include(@1search)\n}\n\nDBFind(#this_table#, src_refunds_list).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_status){\n If(#status#>0){\n SetVar(sta, AppParam(Ecosystem:1, App:#application_id#, Name: tokenrefund_status, Index: #status#))\n LangRes(#sta#)\n }\n}.Custom(_result){\n If(#result# > 0){\n SetVar(res,AppParam(Ecosystem:1, App:#application_id#, Name: tokenrefund_result, Index: #result#))\n LangRes(#res#)\n }\n}.Custom(_blocked){\n DateTime(Format: YYYY-MM-DD HH:MI:SS, DateTime: #blocked_at#)\n}.Custom(_closed){\n DateTime(Format: YYYY-MM-DD HH:MI:SS, DateTime: #closed_at#)\n}.Custom(_accounts){\n Div(){$@1tokens_refund_victim$: #victim_account#}\n Div(){$@1tokens_refund_attacker$: #attacker_account#}\n}.Custom(_amount){\n Money(#amount#)\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src_refunds_list, \"$@1accounts$=_accounts,$@1description$=note,$@1consortium_member$=consortium_member_account,$@1blocked_at$=_blocked,$@1closed$=_closed,$@1result$=_result,$@1amount$=_amount,$@1status$=_status\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1tokens_refunds$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "tokens_send", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, \"@1tokens_send\")\n\nIf(#back_page# == \"\"){\n If(#parent_back_page# != \"\"){\n SetVar(back_page, #parent_back_page#)\n }.Else{\n SetVar(back_page, \"@1members_list\")\n }\n}\nIf(#MemberId# != \"\"){\n SetVar(v_key_id, #MemberId#)\n}\nIf(Or(#v_key_id#>0,#v_key_id#<0)){\n SetVar(Name: v_address, Value: Address(#v_key_id#))\n}.Else{\n SetVar(Name: v_address, Value: \"\")\n}\nIf(#v_amount#==\"\"){\n SetVar(Name: v_amount, Value: \"\")\n}\n\nDBFind(\"@1keys\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #key_id#}).Vars(\"tokens\")\nDBFind(\"@1ecosystems\").Where({\"id\": #ecosystem_id#}).Vars(\"custom\")\nIf(#ecosystem_id# == 1){\n SetVar(token_title, \"APLA\")\n}.Else{\n SetVar(token_title, #custom_token_title#)\n}\n\nIf(Or(#ecosystem_id# == 1, #custom_token_title# != \"\")){\n Form(){\n Div(row){\n Div(col-sm-3 mt-sm text-right){\n Label($@1sender$)\n Span(Class: text-danger, Body:*)\n }\n Div(col-sm-9){\n SetVar(m_a, Address(#key_id#) (Money(#tokens_amount#) #token_title#))\n Input(Name: Sender, Disabled: 1, Value: #m_a#)\n Div(Class: m0 h6 text-muted, Body: $@1send_tokens_my_balance$)\n }\n }\n Div(row mt){\n Div(col-sm-3 mt-sm text-right){\n Label($@1recipient$)\n Span(Class: text-danger, Body:*)\n }\n Div(col-sm-9){\n Div(input-group){\n Input(Name: Recipient, Disabled: 1, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\", Value: #v_address#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:\"back_page=#this_page#,back_header=$@1tokens_send$,parent_back_page=#back_page#,EcosystemId=#ecosystem_id#\").Popup(Header: $@1member$, Width: \"50\")\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n )\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 mt-sm text-right){\n Label(){\n Span(Body: $@1amount$ (#token_title#))\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-sm-9){\n Input(Name: Amount, Type: Number, Value: #v_amount#)\n }\n }\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right mt, Page: #back_page#, Contract: @1TokensSend).Alert(Text: \"$@1want_send_tokens$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#)\n }\n}.Else{\n Form(){\n Div(row){\n Div(col-sm-12){\n Span(Body: $@1ecosystem_no_tokens$)\n }\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#)\n }\n}", + "Value": "SetVar(this_page, \"@1tokens_send\")\n\nIf(#back_page# == \"\"){\n If(#parent_back_page# != \"\"){\n SetVar(back_page, #parent_back_page#)\n }.Else{\n SetVar(back_page, \"@1members_list\")\n }\n}\nIf(#MemberAccount#){\n SetVar(v_account, #MemberAccount#)\n}\nIf(#v_account#){\n SetVar(Name: v_address, Value: #v_account#)\n}\n\nDBFind(\"@1keys\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#account_id#\", \"deleted\": 0}).Vars(tokens)\nDBFind(\"@1ecosystems\").Where({\"id\": \"#ecosystem_id#\"}).Vars(custom)\nIf(#ecosystem_id# == 1){\n SetVar(token_title, \"APLA\")\n}.Else{\n SetVar(token_title, #custom_token_title#)\n}\n\nIf(Or(#ecosystem_id# == 1, #custom_token_title# != \"\")){\n Form(){\n Div(row){\n Div(col-sm-3 mt-sm text-right){\n Label($@1sender$)\n Span(Class: text-danger, Body:*)\n }\n Div(col-sm-9){\n SetVar(m_a, #account_id# (Money(#tokens_amount#) #token_title#))\n Input(Name: Sender, Disabled: 1, Value: #m_a#)\n Div(Class: m0 h6 text-muted, Body: $@1send_tokens_my_balance$)\n }\n }\n Div(row mt){\n Div(col-sm-3 mt-sm text-right){\n Label($@1recipient$)\n Span(Class: text-danger, Body:*)\n }\n Div(col-sm-9){\n Div(input-group){\n Input(Name: Recipient, Disabled: 1, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\", Value: #v_address#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:\"back_page=#this_page#,back_header=$@1tokens_send$,parent_back_page=#back_page#,EcosystemId=#ecosystem_id#\").Popup(Header: $@1member$, Width: \"50\")\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n )\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 mt-sm text-right){\n Label(){\n Span(Body: $@1amount$ (#token_title#))\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-sm-9){\n Input(Name: Amount, Type: Number, Value: #v_amount#)\n }\n }\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right mt, Page: #back_page#, Contract: @1TokensSend).Alert(Text: \"$@1want_send_tokens$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#)\n }\n}.Else{\n Form(){\n Div(row){\n Div(col-sm-12){\n Span(Body: $@1ecosystem_no_tokens$)\n }\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#)\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "upload_page", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Form(){\n Div(row){\n Div(col-sm-12){\n Input(Name: FileData, Type: file)\n }\n }\n If(#back_page_popup# == 50){\n Button(Body: LangRes(@1button_upload), Class: btn btn-primary pull-right mt, Contract: @1BufferFileUpload, Params: \"AppId=#application_id#,BufferKey=#buffer_key#,FileName=#file_name#\", Page: #back_page#, PageParams:\"buffered=1,uploaded=1\").Popup(Header: #back_page_popup_header#, Width: 50)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#, PageParams: \"buffered=1\").Popup(Header: #back_page_popup_header#, Width: 50)\n }.ElseIf(#back_page_popup# == 30){\n Button(Body: LangRes(@1button_upload), Class: btn btn-primary pull-right mt, Contract: @1BufferFileUpload, Params: \"AppId=#application_id#,BufferKey=#buffer_key#,FileName=#file_name#\", Page: #back_page#, PageParams:\"buffered=1,uploaded=1\").Popup(Header: #back_page_popup_header#, Width: 30)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#, PageParams: \"buffered=1\").Popup(Header: #back_page_popup_header#, Width: 30)\n }.ElseIf(Or(#back_page_popup# == 40, #back_page_popup# == 1)){\n Button(Body: LangRes(@1button_upload), Class: btn btn-primary pull-right mt, Contract: @1BufferFileUpload, Params: \"AppId=#application_id#,BufferKey=#buffer_key#,FileName=#file_name#\", Page: #back_page#, PageParams:\"buffered=1,uploaded=1\").Popup(Header: #back_page_popup_header#, Width: 40)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#, PageParams: \"buffered=1\").Popup(Header: #back_page_popup_header#, Width: 40)\n }.Else{\n Button(Body: LangRes(@1button_upload), Class: btn btn-primary pull-right mt, Contract: @1BufferFileUpload, Params: \"AppId=#application_id#,BufferKey=#buffer_key#,FileName=#file_name#\", Page: #back_page#, PageParams:\"buffered=1,uploaded=1\")\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#, PageParams: \"buffered=1\")\n }\n}", + "Value": "Form(){\n Div(row){\n Div(col-sm-12){\n Input(Name: FileData, Type: file).Validate(required: \"1\")\n Div(Class: text-danger){\n InputErr(Name: FileData, required: $@1file_not_selected$)\n }\n }\n }\n If(#back_page_popup# == 50){\n Button(Body: LangRes(@1button_upload), Class: btn btn-primary pull-right mt, Contract: @1BufferFileUpload, Params: \"AppId=#application_id#,BufferKey=#buffer_key#,FileName=#file_name#\", Page: #back_page#, PageParams:\"buffered=1,uploaded=1\").Popup(Header: #back_page_popup_header#, Width: 50)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#, PageParams: \"buffered=1\").Popup(Header: #back_page_popup_header#, Width: 50)\n }.ElseIf(#back_page_popup# == 30){\n Button(Body: LangRes(@1button_upload), Class: btn btn-primary pull-right mt, Contract: @1BufferFileUpload, Params: \"AppId=#application_id#,BufferKey=#buffer_key#,FileName=#file_name#\", Page: #back_page#, PageParams:\"buffered=1,uploaded=1\").Popup(Header: #back_page_popup_header#, Width: 30)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#, PageParams: \"buffered=1\").Popup(Header: #back_page_popup_header#, Width: 30)\n }.ElseIf(Or(#back_page_popup# == 40, #back_page_popup# == 1)){\n Button(Body: LangRes(@1button_upload), Class: btn btn-primary pull-right mt, Contract: @1BufferFileUpload, Params: \"AppId=#application_id#,BufferKey=#buffer_key#,FileName=#file_name#\", Page: #back_page#, PageParams:\"buffered=1,uploaded=1\").Popup(Header: #back_page_popup_header#, Width: 40)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#, PageParams: \"buffered=1\").Popup(Header: #back_page_popup_header#, Width: 40)\n }.Else{\n Button(Body: LangRes(@1button_upload), Class: btn btn-primary pull-right mt, Contract: @1BufferFileUpload, Params: \"AppId=#application_id#,BufferKey=#buffer_key#,FileName=#file_name#\", Page: #back_page#, PageParams:\"buffered=1,uploaded=1\")\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#, PageParams: \"buffered=1\")\n }\n}", "Menu": "default_menu", "Type": "pages" }, - { - "Name": "validator_candidates_create", - "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Form(){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(LangRes(@1tcp_address))\n Span(Class: text-danger, Body:*)\n }\n Div(col-md-9 text-left){\n Input(Name: TcpAddress, Placeholder: \"xxx.xxx.xxx.xxx:port\")\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(LangRes(@1api_address))\n Span(Class: text-danger, Body:*)\n }\n Div(col-md-9 text-left){\n Input(Name: ApiAddress, Placeholder: \"protocol://xxx.xxx.xxx.xxx:port\")\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(LangRes(@1node_founder_key_id))\n Span(Class: text-danger, Body:*)\n }\n Div(col-md-9 text-left){\n Input(Name: KeyId,Type: number, Value: #key_id#)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(LangRes(@1node_pub_key))\n Span(Class: text-danger, Body:*)\n }\n Div(col-md-9 text-left){\n Input(Name: PubKey, Type: textarea)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(LangRes(@1hardware_description))\n }\n Div(col-md-9 text-left){\n Input(Name: Description, Type: textarea)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(LangRes(@1comment))\n }\n Div(col-md-9 text-left){\n Input(Name: Comment, Type: textarea)\n }\n }\n\n Button(Contract: @1ValidatorRequest, Class: btn btn-primary pull-right mt, Page: @1validator_candidates_list, Body: $@1send_request$)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1validator_candidates_list)\n}", - "Menu": "admin_menu", - "Type": "pages" - }, - { - "Name": "validator_candidates_list", - "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1validator_candidates_list).(this_table, @1validator_candidates)\nInclude(@1pager_header)\n\nSetTitle(\"$@1validators$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1sysparams_candidates_list_desc$\"))\nAddToolButton(Title: $@1create_request$, Icon: icon-plus, Page: @1validator_candidates_create).Popup(50, $@1sysparams_candidate_validators_form$)\n\nIf(#search#){\n SetVar(where, {{\"host_ip\": {\"$ilike\": \"#search#\"}}, \"deleted\": 0})\n}.Else{\n SetVar(where, {\"deleted\": 0})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1host_ip))\n Include(@1search)\n}\n\nDBFind(@1applications).Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\nSetVar(template_id, AppParam(Ecosystem:1, App:#application_id#, Name: voting_template_validators))\nIf(#template_id# > 0){\n DBFind(@1voting_templates).Where({\"ecosystem\": #ecosystem_id#, \"id\": #template_id#}).Columns(\"subject->voters\").Vars(template)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_actions){\n If(And(#template_subject_voters#>0,#template_subject_voters#==#role_id#)){\n Form(btn-group pull-right){\n Button(Contract: @1VotingRunNewValidator, Params: \"ValidatorId=#id#\", Page: @1voting_list, Class: btn btn-default fa fa-play)\n }\n }.Else{\n If(#template_id# > 0){\n Span($@1voting_not_participant$, text-muted)\n }.Else{\n Span($@1voting_template_not_found$, text-muted)\n }\n }\n}.Custom(_date){\n DateTime(DateTime: #date_created#, Format: YYYY-MM-DD HH:MI)\n}.Custom(_tcp_address){\n Span(Class: h6, Body: #tcp_address#)\n}.Custom(_api_address){\n Span(Class: h6, Body: #api_address#)\n}.Custom(_description){\n Span(Class: h6, Body: #description#)\n}.Custom(_comment){\n Span(Class: h6, Body: #comment#)\n}.Custom(custom_username){\n SetVar(user_member_name, \"\")\n DBFind(@1members).Where({\"id\": #candidate_key_id#, \"ecosystem\": #ecosystem_id#}).Vars(user)\n If(#user_member_name##==\"\"){\n SetVar(user_member_name, Address(#candidate_key_id#))\n }\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#candidate_key_id#\"){\n If(#user_image_id#>0){\n Image(Src: Binary().ById(#user_image_id#), Class: img-circle).Style(height: 30px;width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(#user_member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(#user_member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1name$=custom_username,$@1api_address$=_api_address,$@1tcp_address$=_tcp_address,$@1hardware_description$=_description,$@1comment$=_comment,$@1date_created$=_date,$@1voting$=_actions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1sysparams_candidates$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", - "Menu": "admin_menu", - "Type": "pages" - }, - { - "Name": "validator_resign", - "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Form(){\n Div(row){\n Div(col-sm-12 text-center h4){\n $@1validator_removing_desc$\n }\n }\n DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"System\"}).Vars(\"system_app\")\n SetVar(role_validator, AppParam(App: #system_app_id#, Name: \"role_validator\"))\n DBFind(@1roles_participants).Where({\"ecosystem\": #ecosystem_id#, \"member->member_id\": #key_id#, \"role->id\": #role_validator#, \"deleted\": 0}).Columns(\"id\").Vars(validator)\n If(#validator_id# > 0){\n Button(Body: $@1resign$, Class: btn btn-danger pull-right mt-lg, Page: @1sysparams_list, Contract: @1ValidatorResign).Alert(Text: \"$@1want_resign$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n Button(Body: $@1back$, Class: btn btn-default pull-right mt-lg, Page: @1sysparams_list)\n}", - "Menu": "admin_menu", - "Type": "pages" - }, { "Name": "voting_create", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1applications).Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\nSetVar(this_page, \"@1voting_create\")\n\nForm(){\n If(#type_decision#>0){\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1vote_count_type)\n }\n }\n Div(col-md-9 text-left){\n If(#count_type_voters#==1){\n Input(Name: InputCountTypeVoters, Disabled: 1, Value: $@1number_votes$)\n Input(Name: CountTypeVoters, Type: hidden, Value: 1)\n }.Else{\n Input(Name: InputCountTypeVoters, Disabled: 1, Value: $@1percent_votes$)\n Input(Name: CountTypeVoters, Type: hidden, Value: 0)\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_subject)\n }\n }\n Div(col-md-9 text-left){\n SetVar(var_type_voting_decisions, AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_decisions, Index: #type_decision#))\n Input(Name: Input_TypeVotingDecisions, Disabled: 1, Value: #var_type_voting_decisions#)\n Input(Name: TypeDecision, Type: hidden, Value: #type_decision#)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1participants)\n }\n }\n Div(col-md-9 text-left){\n SetVar(var_type_participants, AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_participants, Index: #type_participants#))\n Input(Name: Input_TypeParticipants, Disabled: 1, Value: #var_type_participants#)\n Input(Name: TypeParticipants, Type: hidden, Value: #type_participants#)\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1name)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Name, Value: \"New voting\")\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_quorum)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n If(#count_type_voters#==1){\n Input(Name: Quorum, Value: 3, Type: number)\n Div(m0 h6 text-muted){\n $@1voting_quorum_number_desc$\n }\n }.Else{\n Input(Name: Quorum, Value: 30, Type: number)\n Div(m0 h6 text-muted){\n $@1voting_quorum_desc$\n }\n }\n }\n }\n If(Or(#type_participants#==1,#type_participants#==2,#type_participants#==3,#type_participants#==4)){\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_rating)\n }\n }\n Div(col-md-9 mt-sm text-left){\n Input(Name: Rating, Placeholder: $@1voting_rating_desc$, Type: checkbox, Value: false, Class: m0 text-muted)\n }\n }\n }\n }\n If(Or(#count_type_voters#==1,#type_decision#==1,#type_decision#==2)){\n SetVar(hide_volume, 1)\n }\n If(#hide_volume# != 1){\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_volume)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Volume, Value: 51, Type: number)\n Div(m0 h6 text-muted){\n $@1voting_volume_desc$\n }\n }\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1date_start)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-6){\n Input(Name: StartDate, Type: date)\n }\n Div(col-md-6){\n Input(Name: StartTime, Type: time, Value: \"00:00\")\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1date_end)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-6){\n Input(Name: EndDate, Type: date)\n }\n Div(col-md-6){\n Input(Name: EndTime, Type: time, Value: \"00:00\")\n }\n }\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1description)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Description, Type: textarea).Style(resize:vertical)\n }\n }\n }\n Input(Name: Type, Type: hidden, Value: 1)\n If(#type_decision# == 1){\n SetVar(next_page,\"@1voting_decision_candidates\")\n }.ElseIf(#type_decision# == 2){\n SetVar(next_page,\"@1voting_decision_election\")\n }.ElseIf(#type_decision# == 3){\n SetVar(next_page,\"@1voting_decision_document\")\n }.ElseIf(#type_decision# == 4){\n SetVar(next_page,\"@1voting_decision_contract\")\n }\n Button(Body: LangRes(@1create), Class: btn btn-primary pull-right mt, Page: #next_page#, Contract: @1VotingCreate, Params: \"CountTypeVoters=#count_type_voters#\").Popup(60, $@1voting_subject$)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #this_page#).Popup(60, $@1new_voting$)\n }.Else{\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1vote_count_type)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 mt-sm text-left){\n If(#count_type_voters#==1){\n Button(Body: $@1percent_votes$, Page: #this_page#, PageParams: \"count_type_voters=0\", Class: btn-xs btn-default mr-lg).Popup(60, $@1new_voting$)\n Button(Body: $@1number_votes$, Page: #this_page#, PageParams: \"count_type_voters=1\", Class: btn-xs btn-primary disabled).Popup(60, $@1new_voting$)\n }.Else{\n Button(Body: $@1percent_votes$, Page: #this_page#, PageParams: \"count_type_voters=0\", Class: btn-xs btn-primary disabled mr-lg).Popup(60, $@1new_voting$)\n Button(Body: $@1number_votes$, Page: #this_page#, PageParams: \"count_type_voters=1\", Class: btn-xs btn-default).Popup(60, $@1new_voting$) \n }\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt text-right){\n Label(){\n LangRes(@1voting_subject)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n If(#count_type_voters#==1){\n Data(numbers_type_decisions, \"value,name\"){\n 3,$@1document$\n 4,$@1contract_run$\n }\n RadioGroup(Name: type_decision, Source: numbers_type_decisions, NameColumn: name, ValueColumn: value)\n }.Else{\n AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_decisions, Source: procent_type_decisions)\n RadioGroup(Name: type_decision, Source: procent_type_decisions, NameColumn: name, ValueColumn: id)\n }\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1participants)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_participants, Source: type_voting_participants)\n Select(Name: type_participants, Source: type_voting_participants, NameColumn: name, ValueColumn: id, Value: 2)\n }\n }\n }\n Button(Body: LangRes(@1next), Class: btn btn-primary pull-right mt, Page: #this_page#, PageParams: \"count_type_voters=#count_type_voters#,type_decision=Val(type_decision),type_participants=Val(type_participants)\").Popup(60, $@1new_voting$)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1voting_list)\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\nSetVar(this_page, \"@1voting_create\")\n\nForm(){\n If(#type_decision#>0){\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1vote_count_type)\n }\n }\n Div(col-md-9 text-left){\n If(#count_type_voters#==1){\n Input(Name: InputCountTypeVoters, Disabled: 1, Value: $@1number_votes$)\n Input(Name: CountTypeVoters, Type: hidden, Value: 1)\n }.Else{\n Input(Name: InputCountTypeVoters, Disabled: 1, Value: $@1percent_votes$)\n Input(Name: CountTypeVoters, Type: hidden, Value: 0)\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_subject)\n }\n }\n Div(col-md-9 text-left){\n SetVar(var_type_voting_decisions, AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_decisions, Index: #type_decision#))\n Input(Name: Input_TypeVotingDecisions, Disabled: 1, Value: #var_type_voting_decisions#)\n Input(Name: TypeDecision, Type: hidden, Value: #type_decision#)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1participants)\n }\n }\n Div(col-md-9 text-left){\n SetVar(var_type_participants, AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_participants, Index: #type_participants#))\n Input(Name: Input_TypeParticipants, Disabled: 1, Value: #var_type_participants#)\n Input(Name: TypeParticipants, Type: hidden, Value: #type_participants#)\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1name)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Name, Value: \"New voting\")\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_quorum)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n If(#count_type_voters#==1){\n Input(Name: Quorum, Value: 3, Type: number)\n Div(m0 h6 text-muted){\n $@1voting_quorum_number_desc$\n }\n }.Else{\n Input(Name: Quorum, Value: 30, Type: number)\n Div(m0 h6 text-muted){\n $@1voting_quorum_desc$\n }\n }\n }\n }\n If(Or(#type_participants#==1,#type_participants#==2,#type_participants#==3,#type_participants#==4)){\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_rating)\n }\n }\n Div(col-md-9 mt-sm text-left){\n Input(Name: Rating, Placeholder: $@1voting_rating_desc$, Type: checkbox, Value: false, Class: m0 text-muted)\n }\n }\n }\n }\n If(Or(#count_type_voters#==1,#type_decision#==1,#type_decision#==2)){\n SetVar(hide_volume, 1)\n }\n If(#hide_volume# != 1){\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_volume)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Volume, Value: 51, Type: number)\n Div(m0 h6 text-muted){\n $@1voting_volume_desc$\n }\n }\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1date_start)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-6){\n Input(Name: StartDate, Type: date)\n }\n Div(col-md-6){\n Input(Name: StartTime, Type: time, Value: \"00:00\")\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1date_end)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-6){\n Input(Name: EndDate, Type: date)\n }\n Div(col-md-6){\n Input(Name: EndTime, Type: time, Value: \"00:00\")\n }\n }\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1description)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Description, Type: textarea).Style(resize:vertical)\n }\n }\n }\n Input(Name: Type, Type: hidden, Value: 1)\n If(#type_decision# == 1){\n SetVar(next_page,\"@1voting_decision_candidates\")\n }.ElseIf(#type_decision# == 2){\n SetVar(next_page,\"@1voting_decision_election\")\n }.ElseIf(#type_decision# == 3){\n SetVar(next_page,\"@1voting_decision_document\")\n }.ElseIf(#type_decision# == 4){\n SetVar(next_page,\"@1voting_decision_contract\")\n }\n Button(Body: LangRes(@1create), Class: btn btn-primary pull-right mt, Page: #next_page#, Contract: @1VotingCreate, Params: \"CountTypeVoters=#count_type_voters#\").Popup(60, $@1voting_subject$)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #this_page#).Popup(60, $@1new_voting$)\n }.Else{\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1vote_count_type)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 mt-sm text-left){\n If(#count_type_voters#==1){\n Button(Body: $@1percent_votes$, Page: #this_page#, PageParams: \"count_type_voters=0\", Class: btn-xs btn-default mr-lg).Popup(60, $@1new_voting$)\n Button(Body: $@1number_votes$, Page: #this_page#, PageParams: \"count_type_voters=1\", Class: btn-xs btn-primary disabled).Popup(60, $@1new_voting$)\n }.Else{\n Button(Body: $@1percent_votes$, Page: #this_page#, PageParams: \"count_type_voters=0\", Class: btn-xs btn-primary disabled mr-lg).Popup(60, $@1new_voting$)\n Button(Body: $@1number_votes$, Page: #this_page#, PageParams: \"count_type_voters=1\", Class: btn-xs btn-default).Popup(60, $@1new_voting$) \n }\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt text-right){\n Label(){\n LangRes(@1voting_subject)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n If(#count_type_voters#==1){\n Data(numbers_type_decisions, \"value,name\"){\n 3,$@1document$\n 4,$@1contract_run$\n }\n RadioGroup(Name: type_decision, Source: numbers_type_decisions, NameColumn: name, ValueColumn: value)\n }.Else{\n AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_decisions, Source: procent_type_decisions)\n RadioGroup(Name: type_decision, Source: procent_type_decisions, NameColumn: name, ValueColumn: id)\n }\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1participants)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_participants, Source: type_voting_participants)\n Select(Name: type_participants, Source: type_voting_participants, NameColumn: name, ValueColumn: id, Value: 2)\n }\n }\n }\n Button(Body: LangRes(@1next), Class: btn btn-primary pull-right mt, Page: #this_page#, PageParams: \"count_type_voters=#count_type_voters#,type_decision=Val(type_decision),type_participants=Val(type_participants)\").Popup(60, $@1new_voting$)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1voting_list)\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "voting_decision_candidates", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "If(#vID# == \"\"){\n DBFind(@1buffer_data).Columns(\"value->voting_id\").Where({\"key\": \"voting\", \"member_id\": #key_id#, \"ecosystem\": #ecosystem_id#}).Vars(buffer)\n If(#buffer_value_voting_id#>0){\n SetVar(vID, #buffer_value_voting_id#)\n SetVar(toPageInvite, 1)\n }\n}\nIf(#vID# > 0){\n If(#back_page#){}.Else{\n SetVar(back_page,@1voting_view)\n }\n DBFind(@1votings).WhereId(#vID#).Columns(\"id,voting->name,optional->role_id,optional->role_vacancies,optional->contract_accept,optional->contract_reject,optional->contract_accept_params,optional->contract_reject_params\").Vars(instance)\n DBFind(@1votings_subject).Where({\"voting_id\": #vID#, \"subject->member_id\": #key_id#}).Columns(\"id\").Vars(already_candidate)\n DBFind(@1roles,src_roles).Where({\"ecosystem\": #ecosystem_id#, \"role_type\": 2, \"deleted\": 0}).Columns(\"id,role_name\").Count(elective_roles_count)\n If(#elective_roles_count#>0){\n Form(){\n Input(Name: MemberId, Type: hidden, Value: 0)\n Input(Name: VotingId, Type: hidden, Value: #vID#)\n\n If(#already_candidate_id#>0){\n SetVar(hidden,hidden)\n }.Else{\n SetVar(hidden,)\n }\n Div(row mt-sm #hidden#){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1candidates))\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n If(#apply# == 1){\n Input(Name: applied, Disabled: 1, Value: $@1applied_already$)\n }.Else{\n Div(input-group){\n Input(Name: can_apply_voting, Disabled: 1, Value: $@1can_apply_voting$)\n Div(input-group-btn){\n Button(Body: LangRes(@1apply), Class: btn bg-gray-lighter buttons, Page: @1voting_decision_candidates, PageParams: \"vID=#vID#,back_page=#back_page#,apply=1\", Contract: @1VotingSubjectCandidates).Popup(50, $@1subject_voting$)\n }.Style(\n .buttons{border: 1px solid #dde6e9;}\n )\n }\n }\n }\n }\n DBFind(@1votings_subject,src_voting_subject).Where({\"voting_id\": #vID#}).Columns(\"id,subject->member_id,subject->member_name\").Count(members_count).Custom(_address){\n Address(#subject.member_id#)\n }.Custom(_member){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#subject.member_id#\"){\n Span(Body: #subject.member_name#)\n }\n }\n If(Or(#members_count#>0,#apply#==1)){\n Div(row){\n Div(col-sm-9 col-sm-offset-3){\n Table(src_voting_subject, \"$@1candidates$=_member,=_address\").Style(margin-bottom: 5px;)\n }\n }\n }\n Div(form-group){\n Div(row mt-lg){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1role))\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Select(Name: RoleId, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #instance_optional_role_id#)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1vacancies))\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Vacancies, Type: number, Value: #instance_optional_role_vacancies#)\n }\n }\n }\n Div(form-group){\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1contract_accept))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: OptContractAcceptName, Value: #instance_optional_contract_accept#, Placeholder: \"$@1contract_accept_des$\").Validate(minLength:3, maxLength:255)\n InputErr(Name: OptContractAcceptName, minLength: $@1validate_name$, maxLength: $@1validate_name$)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: OptContractAcceptParams, Value: #instance_optional_contract_accept_params#, Placeholder: \"$@1contract_params_des$\")\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1contract_reject))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: OptContractRejectName, Value: #instance_optional_contract_reject#, Placeholder: \"$@1contract_reject_des$\").Validate(minLength:3, maxLength:255)\n InputErr(Name: OptContractRejectName, minLength: $@1validate_name$, maxLength: $@1validate_name$)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: OptContractRejectParams, Value: #instance_optional_contract_reject_params#, Placeholder: \"$@1contract_params_des$\")\n }\n }\n }\n If(#toPageInvite#==1){\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right, Page: @1voting_invite, PageParams: \"vID=#vID#\", Contract: @1VotingSubjectSettings).Popup(60, $@1participants_add$)\n }.Else{\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right, Page: #back_page#, PageParams: \"vID=#vID#\", Contract: @1VotingSubjectSettings)\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"vID=#vID#\")\n }\n }.Else{\n Div(row){\n Div(col-md-12 text-center h4){\n P(LangRes(@1elective_roles_not_found))\n Button(Class: btn btn-link, Page: @1roles_create, PageParams: \"vID=#vID#,back_page=#back_page#\"){\n Span(Class: h4, Body: LangRes(@1create_role))\n }.Popup(50, $@1edit_role$)\n }\n }\n }\n}.Else{\n Div(md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n}", + "Value": "If(#vID# == \"\"){\n DBFind(\"@1buffer_data\").Columns(\"value->voting_id\").Where({\"key\": \"voting\", \"account\": \"#account_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(buffer)\n If(#buffer_value_voting_id#>0){\n SetVar(vID, #buffer_value_voting_id#)\n SetVar(toPageInvite, 1)\n }\n}\nIf(#vID# > 0){\n If(#back_page#){}.Else{\n SetVar(back_page,@1voting_view)\n }\n DBFind(\"@1votings\").WhereId(#vID#).Columns(\"id,voting->name,optional->role_id,optional->role_vacancies,optional->contract_accept,optional->contract_reject,optional->contract_accept_params,optional->contract_reject_params\").Vars(instance)\n DBFind(\"@1votings_subject\").Where({\"voting_id\": \"#vID#\", \"subject->account\": \"#account_id#\"}).Columns(\"id\").Vars(already_candidate)\n DBFind(\"@1roles\", src_roles).Where({\"ecosystem\": \"#ecosystem_id#\", \"role_type\": 2, \"deleted\": 0}).Columns(\"id,role_name\").Count(elective_roles_count)\n If(#elective_roles_count#>0){\n Form(){\n Input(Name: MemberAccount, Type: hidden, Value: 0)\n Input(Name: VotingId, Type: hidden, Value: #vID#)\n\n If(#already_candidate_id#>0){\n SetVar(hidden,hidden)\n }.Else{\n SetVar(hidden,)\n }\n Div(row mt-sm #hidden#){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1candidates))\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n If(#apply# == 1){\n Input(Name: applied, Disabled: 1, Value: $@1applied_already$)\n }.Else{\n Div(input-group){\n Input(Name: can_apply_voting, Disabled: 1, Value: $@1can_apply_voting$)\n Div(input-group-btn){\n Button(Body: LangRes(@1apply), Class: btn bg-gray-lighter buttons, Page: @1voting_decision_candidates, PageParams: \"vID=#vID#,back_page=#back_page#,apply=1\", Contract: @1VotingSubjectCandidates).Popup(50, $@1subject_voting$)\n }.Style(\n .buttons{border: 1px solid #dde6e9;}\n )\n }\n }\n }\n }\n DBFind(\"@1votings_subject\",src_voting_subject).Where({\"voting_id\": \"#vID#\"}).Columns(\"id,subject->account,subject->member_name\").Count(members_count).Custom(_address){\n #subject.account#\n }.Custom(_member){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#subject.account#\"){\n Span(Body: #subject.member_name#)\n }\n }\n If(Or(#members_count#>0,#apply#==1)){\n Div(row){\n Div(col-sm-9 col-sm-offset-3){\n Table(src_voting_subject, \"$@1candidates$=_member,=_address\").Style(margin-bottom: 5px;)\n }\n }\n }\n Div(form-group){\n Div(row mt-lg){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1role))\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Select(Name: RoleId, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #instance_optional_role_id#)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1vacancies))\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Vacancies, Type: number, Value: #instance_optional_role_vacancies#)\n }\n }\n }\n Div(form-group){\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1contract_accept))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: OptContractAcceptName, Value: #instance_optional_contract_accept#, Placeholder: \"$@1contract_accept_des$\").Validate(minLength:3, maxLength:255)\n InputErr(Name: OptContractAcceptName, minLength: $@1validate_name$, maxLength: $@1validate_name$)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: OptContractAcceptParams, Value: #instance_optional_contract_accept_params#, Placeholder: \"$@1contract_params_des$\")\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1contract_reject))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: OptContractRejectName, Value: #instance_optional_contract_reject#, Placeholder: \"$@1contract_reject_des$\").Validate(minLength:3, maxLength:255)\n InputErr(Name: OptContractRejectName, minLength: $@1validate_name$, maxLength: $@1validate_name$)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: OptContractRejectParams, Value: #instance_optional_contract_reject_params#, Placeholder: \"$@1contract_params_des$\")\n }\n }\n }\n If(#toPageInvite#==1){\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right, Page: @1voting_invite, PageParams: \"vID=#vID#\", Contract: @1VotingSubjectSettings).Popup(60, $@1participants_add$)\n }.Else{\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right, Page: #back_page#, PageParams: \"vID=#vID#\", Contract: @1VotingSubjectSettings)\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"vID=#vID#\")\n }\n }.Else{\n Div(row){\n Div(col-md-12 text-center h4){\n P(LangRes(@1elective_roles_not_found))\n Button(Class: btn btn-link, Page: @1roles_create, PageParams: \"vID=#vID#,back_page=#back_page#\"){\n Span(Class: h4, Body: LangRes(@1create_role))\n }.Popup(50, $@1edit_role$)\n }\n }\n }\n}.Else{\n Div(md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "voting_decision_contract", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "If(#vID# == \"\"){\n DBFind(@1buffer_data).Columns(\"value->voting_id\").Where({\"key\": \"voting\", \"member_id\": #key_id#, \"ecosystem\": #ecosystem_id#}).Vars(buffer)\n If(#buffer_value_voting_id#>0){\n SetVar(vID, #buffer_value_voting_id#)\n SetVar(toPageInvite, 1)\n }\n}\nIf(#vID# > 0){\n If(#back_page#){}.Else{\n SetVar(back_page,@1voting_view)\n }\n\n DBFind(@1votings, src_voting).WhereId(#vID#).Columns(\"id,voting->name\").Vars(instance)\n DBFind(@1votings_subject, src_subject).Where({\"voting_id\": #vID#}).Columns(\"id,subject->contract_accept,subject->contract_reject,subject->contract_accept_params,subject->contract_reject_params\").Vars(prefix)\n\n If(#prefix_id#>0){\n }.Else{\n SetVar(prefix_subject_contract_accept,)\n SetVar(prefix_subject_contract_accept_params,)\n SetVar(prefix_subject_contract_reject,)\n SetVar(prefix_subject_contract_reject_params,)\n }\n\n Form(){\n Input(Name: VotingId, Type: hidden, Value: #vID#)\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1contract_accept)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 mb-sm text-left){\n Input(Name: ContractAcceptName, Value: #prefix_subject_contract_accept#, Placeholder: \"$@1contract_accept_des$\").Validate(minLength:3, maxLength:255)\n InputErr(Name: ContractAcceptName, minLength: $@1validate_name$, maxLength: $@1validate_name$)\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 mb-sm text-left){\n Input(Name: ContractAcceptParams, Value: #prefix_subject_contract_accept_params#, Placeholder: \"$@1contract_params_des$\")\n }\n }\n Div(form-group){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1contract_reject)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 mb-sm text-left){\n Input(Name: ContractRejectName, Value: #prefix_subject_contract_reject#, Placeholder: \"$@1contract_reject_des$\").Validate(minLength:3, maxLength:255)\n InputErr(Name: ContractRejectName, minLength: $@1validate_name$, maxLength: $@1validate_name$)\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: ContractRejectParams, Value: #prefix_subject_contract_reject_params#, Placeholder: \"$@1contract_params_des$\")\n }\n }\n }\n If(#toPageInvite#==1){\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right, Page: @1voting_invite, PageParams: \"vID=#vID#\", Contract: @1VotingSubjectContract).Popup(60, $@1participants_add$)\n }.Else{\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right, Page: #back_page#, PageParams: \"vID=#vID#\", Contract: @1VotingSubjectContract)\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"vID=#vID#\")\n }\n}.Else{\n Div(md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n}", + "Value": "If(#vID# == \"\"){\n DBFind(\"@1buffer_data\").Columns(\"value->voting_id\").Where({\"key\": \"voting\", \"account\": \"#account_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(buffer)\n If(#buffer_value_voting_id#>0){\n SetVar(vID, #buffer_value_voting_id#)\n SetVar(toPageInvite, 1)\n }\n}\nIf(#vID# > 0){\n If(#back_page#){}.Else{\n SetVar(back_page,@1voting_view)\n }\n\n DBFind(\"@1votings\", src_voting).WhereId(#vID#).Columns(\"id,voting->name\").Vars(instance)\n DBFind(\"@1votings_subject\", src_subject).Where({\"voting_id\": \"#vID#\"}).Columns(\"id,subject->contract_accept,subject->contract_reject,subject->contract_accept_params,subject->contract_reject_params\").Vars(prefix)\n\n If(#prefix_id#>0){\n }.Else{\n SetVar(prefix_subject_contract_accept,)\n SetVar(prefix_subject_contract_accept_params,)\n SetVar(prefix_subject_contract_reject,)\n SetVar(prefix_subject_contract_reject_params,)\n }\n\n Form(){\n Input(Name: VotingId, Type: hidden, Value: #vID#)\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1contract_accept)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 mb-sm text-left){\n Input(Name: ContractAcceptName, Value: #prefix_subject_contract_accept#, Placeholder: \"$@1contract_accept_des$\").Validate(minLength:3, maxLength:255)\n InputErr(Name: ContractAcceptName, minLength: $@1validate_name$, maxLength: $@1validate_name$)\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 mb-sm text-left){\n Input(Name: ContractAcceptParams, Value: #prefix_subject_contract_accept_params#, Placeholder: \"$@1contract_params_des$\")\n }\n }\n Div(form-group){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1contract_reject)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 mb-sm text-left){\n Input(Name: ContractRejectName, Value: #prefix_subject_contract_reject#, Placeholder: \"$@1contract_reject_des$\").Validate(minLength:3, maxLength:255)\n InputErr(Name: ContractRejectName, minLength: $@1validate_name$, maxLength: $@1validate_name$)\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: ContractRejectParams, Value: #prefix_subject_contract_reject_params#, Placeholder: \"$@1contract_params_des$\")\n }\n }\n }\n If(#toPageInvite#==1){\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right, Page: @1voting_invite, PageParams: \"vID=#vID#\", Contract: @1VotingSubjectContract).Popup(60, $@1participants_add$)\n }.Else{\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right, Page: #back_page#, PageParams: \"vID=#vID#\", Contract: @1VotingSubjectContract)\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"vID=#vID#\")\n }\n}.Else{\n Div(md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "voting_decision_document", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "If(#vID# == \"\"){\n DBFind(@1buffer_data).Columns(\"value->voting_id\").Where({\"key\": \"voting\", \"member_id\": #key_id#, \"ecosystem\": #ecosystem_id#}).Vars(buffer)\n If(#buffer_value_voting_id#>0){\n SetVar(vID, #buffer_value_voting_id#)\n SetVar(toPageInvite, 1)\n }\n}\nIf(#vID# > 0){\n If(#back_page#){}.Else{\n SetVar(back_page,@1voting_view)\n }\n\n DBFind(@1votings, src_voting).WhereId(#vID#).Columns(\"id,voting->name,optional->contract_accept,optional->contract_reject,optional->contract_accept_params,optional->contract_reject_params\").Vars(instance)\n DBFind(@1votings_subject, src_voting_subject).Where({\"voting_id\": #vID#}).Columns(\"id,subject->text\").Vars(prefix)\n\n If(#prefix_id#>0){\n }.Else{\n SetVar(Name: prefix_subject_text, Value: \"\")\n }\n\n Form(){\n Input(Name: VotingId, Type: hidden, Value: #vID#)\n Div(form-group){\n Div(row){\n Div(col-md-12 mt-sm){\n Label(){\n Span(Body: LangRes(@1text_document))\n Span(Class: text-danger, Body:*)\n }\n Input(Name: TextDocument, Type: textarea, Value: #prefix_subject_text#).Style(resize: vertical;)\n }\n }\n }\n Div(form-group){\n Div(row mb-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1contract_accept))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: OptContractAcceptName, Value: #instance_optional_contract_accept#, Placeholder: \"$@1contract_accept_des$\").Validate(minLength:3, maxLength:255)\n InputErr(Name: OptContractAcceptName, minLength: $@1validate_name$, maxLength: $@1validate_name$)\n }\n }\n Div(row mb-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: OptContractAcceptParams, Value: #instance_optional_contract_accept_params#, Placeholder: \"$@1contract_params_des$\")\n }\n }\n Div(row mb-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1contract_reject))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: OptContractRejectName, Value: #instance_optional_contract_reject#, Placeholder: \"$@1contract_reject_des$\").Validate(minLength:3, maxLength:255)\n InputErr(Name: OptContractRejectName, minLength: $@1validate_name$, maxLength: $@1validate_name$)\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 mc-sm text-left){\n Input(Name: OptContractRejectParams, Value: #instance_optional_contract_reject_params#, Placeholder: \"$@1contract_params_des$\")\n }\n }\n }\n If(#toPageInvite#==1){\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right, Page: @1voting_invite, PageParams: \"vID=#vID#\", Contract: @1VotingSubjectDocument).Popup(60, $@1participants_add$)\n }.Else{\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right, Page: #back_page#, PageParams: \"vID=#vID#\", Contract: @1VotingSubjectDocument)\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"vID=#vID#\")\n }\n}.Else{\n Div(md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n}", + "Value": "If(#vID# == \"\"){\n DBFind(\"@1buffer_data\").Columns(\"value->voting_id\").Where({\"key\": \"voting\", \"account\": \"#account_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(buffer)\n If(#buffer_value_voting_id#>0){\n SetVar(vID, #buffer_value_voting_id#)\n SetVar(toPageInvite, 1)\n }\n}\nIf(#vID# > 0){\n If(#back_page#){}.Else{\n SetVar(back_page,@1voting_view)\n }\n\n DBFind(\"@1votings\", src_voting).WhereId(#vID#).Columns(\"id,voting->name,optional->contract_accept,optional->contract_reject,optional->contract_accept_params,optional->contract_reject_params\").Vars(instance)\n DBFind(\"@1votings_subject\", src_voting_subject).Where({\"voting_id\": \"#vID#\"}).Columns(\"id,subject->text\").Vars(prefix)\n\n If(#prefix_id#>0){\n }.Else{\n SetVar(Name: prefix_subject_text, Value: \"\")\n }\n\n Form(){\n Input(Name: VotingId, Type: hidden, Value: #vID#)\n Div(form-group){\n Div(row){\n Div(col-md-12 mt-sm){\n Label(){\n Span(Body: LangRes(@1text_document))\n Span(Class: text-danger, Body:*)\n }\n Input(Name: TextDocument, Type: textarea, Value: #prefix_subject_text#).Style(resize: vertical;)\n }\n }\n }\n Div(form-group){\n Div(row mb-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1contract_accept))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: OptContractAcceptName, Value: #instance_optional_contract_accept#, Placeholder: \"$@1contract_accept_des$\").Validate(minLength:3, maxLength:255)\n InputErr(Name: OptContractAcceptName, minLength: $@1validate_name$, maxLength: $@1validate_name$)\n }\n }\n Div(row mb-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: OptContractAcceptParams, Value: #instance_optional_contract_accept_params#, Placeholder: \"$@1contract_params_des$\")\n }\n }\n Div(row mb-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1contract_reject))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: OptContractRejectName, Value: #instance_optional_contract_reject#, Placeholder: \"$@1contract_reject_des$\").Validate(minLength:3, maxLength:255)\n InputErr(Name: OptContractRejectName, minLength: $@1validate_name$, maxLength: $@1validate_name$)\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 mc-sm text-left){\n Input(Name: OptContractRejectParams, Value: #instance_optional_contract_reject_params#, Placeholder: \"$@1contract_params_des$\")\n }\n }\n }\n If(#toPageInvite#==1){\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right, Page: @1voting_invite, PageParams: \"vID=#vID#\", Contract: @1VotingSubjectDocument).Popup(60, $@1participants_add$)\n }.Else{\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right, Page: #back_page#, PageParams: \"vID=#vID#\", Contract: @1VotingSubjectDocument)\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"vID=#vID#\")\n }\n}.Else{\n Div(md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "voting_decision_election", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "If(#vID# == \"\"){\n DBFind(@1buffer_data).Columns(\"value->voting_id\").Where({\"key\": \"voting\", \"member_id\": #key_id#, \"ecosystem\": #ecosystem_id#}).Vars(buffer)\n If(#buffer_value_voting_id#>0){\n SetVar(vID, #buffer_value_voting_id#)\n }\n}\nIf(#vID# > 0){\n If(#candidates#==\"\"){\n SetVar(candidates,0)\n }\n If(#back_page#){}.Else{\n SetVar(back_page,@1voting_view)\n }\n DBFind(@1votings, src_voting).WhereId(#vID#).Columns(\"id,voting->name,optional->role_id,optional->role_vacancies,optional->contract_accept,optional->contract_reject,optional->contract_accept_params,optional->contract_reject_params\").Vars(instance)\n DBFind(@1votings_subject, src_subject).Where({\"voting_id\": #vID#}).Columns(\"id,subject->member_id,subject->member_name\").Custom(_address){\n SetVar(candidates,\"#candidates#,#subject.member_id#\")\n Address(#subject.member_id#)\n }.Custom(_member){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#subject.member_id#\"){\n Span(Body: #subject.member_name#)\n }\n }\n\n DBFind(@1roles,src_roles).Where({\"ecosystem\": #ecosystem_id#, \"role_type\": 2, \"deleted\": 0}).Columns(\"id,role_name\").Count(elective_roles_count)\n If(#elective_roles_count#>0){\n Form(){\n Input(Name: VotingId, Type: hidden, Value: #vID#)\n Div(form-group){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1candidates)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 mc-sm text-left){\n Div(input-group){\n If(#MemberId#!=\"\"){\n SetVar(AddressMemberId, Address(#MemberId#))\n }\n Input(Name: m_name, Disabled: 1, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\", Value: #AddressMemberId#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:\"back_page=@1voting_decision_election,back_header=$@1voting_subject$,EcosystemId=#ecosystem_id#,Id=#vID#\").Popup(Header: $@1member$, Width: \"50\")\n If(#MemberId#!=\"\"){\n Button(Class: btn bg-gray-lighter fa fa-plus buttons, Page: @1voting_decision_election, PageParams: \"vID=#vID#,back_page=#back_page#\", Contract: @1VotingSubjectCandidates, Params:\"MemberId=#MemberId#\").Popup(50, $@1subject_voting$)\n }\n }\n }\n }\n }\n If(Or(#members_count#>0,#candidates#!=0)){\n Div(row){\n Div(col-sm-9 col-sm-offset-3){\n Table(src_subject, \"$@1candidates$=_member,=_address\").Style(margin-bottom: 5px;)\n }\n }\n }\n }\n Div(form-group){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1role)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 mb-sm text-left){\n Select(Name: RoleId, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #instance_optional_role_id#)\n }\n }\n\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1vacancies)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 mc-sm text-left){\n Input(Name: Vacancies, Class: form-control, Type: Number, Value: #instance_optional_role_vacancies#)\n }\n }\n }\n Div(form-group){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1contract_accept))\n }\n }\n Div(col-md-9 mb-sm text-left){\n Input(Name: OptContractAcceptName, Value: #instance_optional_contract_accept#, Placeholder: \"$@1contract_accept_des$\").Validate(minLength:3, maxLength:255)\n InputErr(Name: OptContractAcceptName, minLength: $@1validate_name$, maxLength: $@1validate_name$)\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 mb-sm text-left){\n Input(Name: OptContractAcceptParams, Value: #instance_optional_contract_accept_params#, Placeholder: \"$@1contract_params_des$\")\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1contract_reject))\n }\n }\n Div(col-md-9 mb-sm text-left){\n Input(Name: OptContractRejectName, Value: #instance_optional_contract_reject#, Placeholder: \"$@1contract_reject_des$\").Validate(minLength:3, maxLength:255)\n InputErr(Name: OptContractRejectName, minLength: $@1validate_name$, maxLength: $@1validate_name$)\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 mc-sm text-left){\n Input(Name: OptContractRejectParams, Value: #instance_optional_contract_reject_params#, Placeholder: \"$@1contract_params_des$\")\n }\n }\n }\n If(#toPageInvite#==1){\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right, Page: @1voting_invite, PageParams: \"vID=#vID#\", Contract: @1VotingSubjectSettings).Popup(60, $@1participants_add$)\n }.Else{\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right, Page: #back_page#, PageParams: \"vID=#vID#\", Contract: @1VotingSubjectSettings)\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"vID=#vID#\")\n }\n }.Else{\n Div(row){\n Div(col-md-12 text-center h4){\n P(LangRes(@1elective_roles_not_found))\n Button(Class: btn btn-link, Page: @1roles_create, PageParams: \"vID=#vID#,back_page=#back_page#\"){\n Span(Class: h4, Body: LangRes(@1create_role))\n }.Popup(50, $@1edit_role$)\n }\n }\n }\n}.Else{\n Div(md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n}", + "Value": "If(#vID# == \"\"){\n DBFind(\"@1buffer_data\").Columns(\"value->voting_id\").Where({\"key\": \"voting\", \"account\": \"#account_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(buffer)\n If(#buffer_value_voting_id#>0){\n SetVar(vID, #buffer_value_voting_id#)\n }\n}\nIf(#vID# > 0){\n If(#candidates#==\"\"){\n SetVar(candidates,0)\n }\n If(#back_page#){}.Else{\n SetVar(back_page,@1voting_view)\n }\n DBFind(\"@1votings\", src_voting).WhereId(#vID#).Columns(\"id,voting->name,optional->role_id,optional->role_vacancies,optional->contract_accept,optional->contract_reject,optional->contract_accept_params,optional->contract_reject_params\").Vars(instance)\n DBFind(\"@1votings_subject\", src_subject).Where({\"voting_id\": \"#vID#\"}).Columns(\"id,subject->account,subject->member_name\").Custom(_address){\n SetVar(candidates,\"#candidates#,#subject.account#\")\n #subject.account#\n }.Custom(_member){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#subject.account#\"){\n Span(Body: #subject.member_name#)\n }\n }\n\n DBFind(\"@1roles\", src_roles).Where({\"ecosystem\": \"#ecosystem_id#\", \"role_type\": 2, \"deleted\": 0}).Columns(\"id,role_name\").Count(elective_roles_count)\n If(#elective_roles_count# > 0){\n Form(){\n Input(Name: VotingId, Type: hidden, Value: #vID#)\n Div(form-group){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1candidates)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 mc-sm text-left){\n Div(input-group){\n If(#MemberAccount#){\n Input(Name: m_name, Disabled: 1, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\", Value: #MemberAccount#)\n }.Else{\n Input(Name: m_name, Disabled: 1, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\")\n }\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams: \"back_page=@1voting_decision_election,back_header=$@1voting_subject$,EcosystemId=#ecosystem_id#,Id=#vID#\").Popup(Header: $@1member$, Width: \"50\")\n If(#MemberAccount#){\n Button(Class: btn bg-gray-lighter fa fa-plus buttons, Page: @1voting_decision_election, PageParams: \"vID=#vID#,back_page=#back_page#\", Contract: @1VotingSubjectCandidates, Params: \"MemberAccount=#MemberAccount#\").Popup(50, $@1subject_voting$)\n }\n }.Style(\n .buttons{border: 1px solid #dde6e9;}\n )\n }\n }\n }\n If(Or(#members_count#>0,#candidates#!=0)){\n Div(row){\n Div(col-sm-9 col-sm-offset-3){\n Table(src_subject, \"$@1candidates$=_member,=_address\").Style(margin-bottom: 5px;)\n }\n }\n }\n }\n Div(form-group){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1role)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 mb-sm text-left){\n Select(Name: RoleId, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #instance_optional_role_id#)\n }\n }\n\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1vacancies)).(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 mc-sm text-left){\n Input(Name: Vacancies, Class: form-control, Type: Number, Value: #instance_optional_role_vacancies#)\n }\n }\n }\n Div(form-group){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1contract_accept))\n }\n }\n Div(col-md-9 mb-sm text-left){\n Input(Name: OptContractAcceptName, Value: #instance_optional_contract_accept#, Placeholder: \"$@1contract_accept_des$\").Validate(minLength:3, maxLength:255)\n InputErr(Name: OptContractAcceptName, minLength: $@1validate_name$, maxLength: $@1validate_name$)\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 mb-sm text-left){\n Input(Name: OptContractAcceptParams, Value: #instance_optional_contract_accept_params#, Placeholder: \"$@1contract_params_des$\")\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1contract_reject))\n }\n }\n Div(col-md-9 mb-sm text-left){\n Input(Name: OptContractRejectName, Value: #instance_optional_contract_reject#, Placeholder: \"$@1contract_reject_des$\").Validate(minLength:3, maxLength:255)\n InputErr(Name: OptContractRejectName, minLength: $@1validate_name$, maxLength: $@1validate_name$)\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 mc-sm text-left){\n Input(Name: OptContractRejectParams, Value: #instance_optional_contract_reject_params#, Placeholder: \"$@1contract_params_des$\")\n }\n }\n }\n If(#toPageInvite#==1){\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right, Page: @1voting_invite, PageParams: \"vID=#vID#\", Contract: @1VotingSubjectSettings).Popup(60, $@1participants_add$)\n }.Else{\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right, Page: #back_page#, PageParams: \"vID=#vID#\", Contract: @1VotingSubjectSettings)\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"vID=#vID#\")\n }\n }.Else{\n Div(row){\n Div(col-md-12 text-center h4){\n P(LangRes(@1elective_roles_not_found))\n Button(Class: btn btn-link, Page: @1roles_create, PageParams: \"vID=#vID#,back_page=#back_page#\"){\n Span(Class: h4, Body: LangRes(@1create_role))\n }.Popup(50, $@1edit_role$)\n }\n }\n }\n}.Else{\n Div(md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "voting_invite", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "If(#Id# > 0){\n SetVar(vID, #Id#)\n}\nIf(Id==\"\"){\n SetVar(Id, 0)\n}\n\nIf(#vID# > 0){\n Form(){\n If(#back_page#==\"\"){\n SetVar(back_page,@1voting_view)\n }\n DBFind(@1votings).WhereId(#vID#).Columns(\"id,voting->name,voting->type_participants\").Vars(instance)\n DBFind(@1votings_participants, src_participants).Where({\"voting_id\": #vID#}).Columns(\"id,member->member_id,member->member_name,member->role_id,member->member->member_id,member->member->member_name\").Count(participants_count).Custom(_id){\n Address(#member.member_id#)\n }.Custom(_name){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#member.member_id#\", Body: #member.member_name#)\n }.Custom(_sent){\n $@1voting_role_added$\n }.Custom(_member_roles){\n SetVar(rl_id,0)\n DBFind(@1roles).Columns(\"id,role_name,image_id\").WhereId(#member.role_id#).Vars(rl)\n LinkPage(Class: text-primary h5 text-bold, Page: @1roles_view, PageParams: \"v_role_id=#rl_id#\"){\n If(#rl_image_id#>0){\n Image(Src: Binary().ById(#rl_image_id#), Class: mr-sm).Style(width: 30px; border: 1px solid #5A5D63;)\n #rl_role_name#\n }.Else{\n Div(){\n Span(Class: fa icon-settings fa-2x mr-sm).(#rl_role_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n }\n If(#participants_count#>0){\n Div(list-group-item mb-lg){\n If(#instance_voting_type_participants# == 5){\n Table(src_participants, \"$@1role$=_member_roles,=_sent\")\n }.ElseIf(#instance_voting_type_participants# == 4){\n Table(src_participants, \"$@1role$=_member_roles,=_sent,$@1member$=_name,=_id,\")\n }.Else{\n Table(src_participants, \"$@1member$=_name,=_id\")\n }\n }\n }\n\t\tInput(Name: VotingId, Type: hidden, Value: #vID#)\n\t\t \n\t\tIf(#instance_voting_type_participants#==2){\n\t\t\tDiv(row mb){\n\t\t\t\tDiv(col-md-3 mt-sm text-right){\n\t\t\t\t\tLabel(){\n\t\t\t\t\t\tLangRes(@1member)\n\t\t\t\t\t\tSpan(Class: text-danger, Body:*)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tDiv(col-md-9 text-left){\n\t\t\t\t\tIf(#MemberId# == \"\"){\n\t\t\t\t\t\tSetVar(MemberId, 0)\n\t\t\t\t\t}.Else{\n\t\t\t\t\t\tInput(Name: VarId, Type: hidden, Value: #MemberId#)\n\t\t\t\t\t}\n\t\t\t\t\tDiv(input-group){\n\t\t\t\t\t\tIf(Or(#MemberId#>0,#MemberId#<0)){\n\t\t\t\t\t\t\tSetVar(AddressMemberId, Address(#MemberId#))\n\t\t\t\t\t\t\tSetVar(Id, #MemberId#)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tInput(Name: m_name, Disabled: 1, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\", Value: #AddressMemberId#)\n\t\t\t\t\t\tDiv(input-group-btn){\n\t\t\t\t\t\t\tButton(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:\"back_page=@1voting_invite,back_header=$@1participants_add$,EcosystemId=#ecosystem_id#,Id=#vID#\").Popup(Header: $@1member$, Width: \"50\")\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tIf(Or(#instance_voting_type_participants#==3,#instance_voting_type_participants#==4,#instance_voting_type_participants#==5)){\n\t\t\tDiv(row mb){\n\t\t\t\tDiv(col-md-3 mt-sm text-right){\n\t\t\t\t\tLabel(){\n\t\t\t\t\t\tLangRes(@1role)\n\t\t\t\t\t\tSpan(Class: text-danger, Body:*)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tDiv(col-md-9 text-left){\n\t\t\t\t\tIf(RoleId == \"\"){\n\t\t\t\t\t\tSetVar(RoleId, 0)\n\t\t\t\t\t\tSetVar(RoleName, \"\")\n\t\t\t\t\t}.Else{\n\t\t\t\t\t\tInput(Name: VarId, Type: hidden, Value: #RoleId#)\n\t\t\t\t\t}\n\t\t\t\t\tDiv(input-group){\n\t\t\t\t\t\tIf(#RoleId#>0){\n\t\t\t\t\t\t\tSetVar(Id, #RoleId#)\n\t\t\t\t\t\t\tDBFind(@1roles).WhereId(#RoleId#).Columns(\"role_name\").Vars(r)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tInput(Name: m_name, Disabled: 1, Value: #r_role_name#)\n\t\t\t\t\t\tDiv(input-group-btn){\n\t\t\t\t\t\t\tButton(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_role, PageParams:\"back_page=@1voting_invite,back_header=$@1participants_add$,EcosystemId=#ecosystem_id#,Id=#vID#\").Popup(Header: $@1roles$, Width: \"50\")\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tIf(#instance_voting_type_participants#==6){\n\t\t\tDiv(row mb){\n\t\t\t\tDiv(col-md-3 mt-sm text-right){\n\t\t\t\t\tLabel(){\n\t\t\t\t\t\tLangRes(@1group)\n\t\t\t\t\t\tSpan(Class: text-danger, Body:*)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tDiv(col-md-9 text-left){\n\t\t\t\t\tIf(GroupId == \"\"){\n\t\t\t\t\t\tSetVar(GroupId, 0)\n\t\t\t\t\t\tSetVar(GroupName, \"\")\n\t\t\t\t\t}.Else{\n\t\t\t\t\t\tInput(Name: VarId, Type: hidden, Value: #GroupId#)\n\t\t\t\t\t}\n\t\t\t\t\tDiv(input-group){\n\t\t\t\t\t\tIf(#GroupId#>0){\n\t\t\t\t\t\t\tSetVar(Id, #GroupId#)\n\t\t\t\t\t\t\tDBFind(@1groups).WhereId(#GroupId#).Columns(\"group_name\").Vars(g)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tInput(Name: m_name, Disabled: 1, Value: #g_group_name#)\n\t\t\t\t\t\tDiv(input-group-btn){\n\t\t\t\t\t\t\tButton(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_group, PageParams:\"back_page=@1voting_invite,back_header=$@1participants_add$,EcosystemId=#ecosystem_id#,Id=#vID#\").Popup(Header: $@1groups$, Width: \"50\")\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n Div(text-right){\n Button(Body: $@1back$, Class: btn btn-default, Page: #back_page#, PageParams: \"vID=#vID#\")\n If(Or(#AddressMemberId#!=\"\",#RoleId#!=\"\",#GroupId#!=\"\")){\n Button(Body: $@1send$, Class: btn btn-primary, Page: @1voting_invite, PageParams: \"vID=#vID#,back_page=#back_page#\", Contract: @1VotingInvite).Popup(50, $@1participants_add$)\n }\n }\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n )\n}.Else{\n Div(alert alert-danger mb-lg text-center){\n Span(Body: LangRes(@1attention))\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"vID=#vID#\")\n}\n", + "Value": "If(#Id# > 0){\n SetVar(vID, #Id#)\n}\nIf(Id==\"\"){\n SetVar(Id, 0)\n}\n\nIf(#vID# > 0){\n Form(){\n If(#back_page#==\"\"){\n SetVar(back_page,@1voting_view)\n }\n DBFind(\"@1votings\").WhereId(#vID#).Columns(\"id,voting->name,voting->type_participants\").Vars(instance)\n DBFind(\"@1votings_participants\", src_participants).Where({\"voting_id\": \"#vID#\"}).Columns(\"id,member->account,member->member_name,member->role_id\").Count(participants_count).Custom(_id){\n #member.account#\n }.Custom(_name){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#member.account#\", Body: #member.member_name#)\n }.Custom(_sent){\n $@1voting_role_added$\n }.Custom(_member_roles){\n SetVar(rl_id,0)\n DBFind(\"@1roles\").Columns(\"id,role_name,image_id\").WhereId(#member.role_id#).Vars(rl)\n LinkPage(Class: text-primary h5 text-bold, Page: @1roles_view, PageParams: \"v_role_id=#rl_id#\"){\n If(#rl_image_id#>0){\n Image(Src: Binary().ById(#rl_image_id#), Class: mr-sm).Style(width: 30px; border: 1px solid #5A5D63;)\n #rl_role_name#\n }.Else{\n Div(){\n Span(Class: fa icon-settings fa-2x mr-sm).(#rl_role_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n }\n If(#participants_count#>0){\n Div(list-group-item mb-lg){\n If(#instance_voting_type_participants# == 5){\n Table(src_participants, \"$@1role$=_member_roles,=_sent\")\n }.ElseIf(#instance_voting_type_participants# == 4){\n Table(src_participants, \"$@1role$=_member_roles,=_sent,$@1member$=_name,=_id,\")\n }.Else{\n Table(src_participants, \"$@1member$=_name,=_id\")\n }\n }\n }\n\t\tInput(Name: VotingId, Type: hidden, Value: #vID#)\n\t\t \n\t\tIf(#instance_voting_type_participants#==2){\n\t\t\tDiv(row mb){\n\t\t\t\tDiv(col-md-3 mt-sm text-right){\n\t\t\t\t\tLabel(){\n\t\t\t\t\t\tLangRes(@1member)\n\t\t\t\t\t\tSpan(Class: text-danger, Body:*)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tDiv(col-md-9 text-left){\n\t\t\t\t\tDiv(input-group){\n\t\t\t\t\t\tIf(#MemberAccount#){\n\t\t\t\t\t\t\tSetVar(Id, #MemberAccount#)\n Input(Name: VarId, Type: hidden, Value: #MemberAccount#)\n Input(Name: m_name, Disabled: 1, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\", Value: #MemberAccount#)\n }.Else{\n Input(Name: VarId, Type: hidden, Value: 0)\n Input(Name: m_name, Disabled: 1, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\")\n }\n\t\t\t\t\t\tDiv(input-group-btn){\n\t\t\t\t\t\t\tButton(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:\"back_page=@1voting_invite,back_header=$@1participants_add$,EcosystemId=#ecosystem_id#,Id=#vID#\").Popup(Header: $@1member$, Width: \"50\")\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tIf(Or(#instance_voting_type_participants#==3,#instance_voting_type_participants#==4,#instance_voting_type_participants#==5)){\n\t\t\tDiv(row mb){\n\t\t\t\tDiv(col-md-3 mt-sm text-right){\n\t\t\t\t\tLabel(){\n\t\t\t\t\t\tLangRes(@1role)\n\t\t\t\t\t\tSpan(Class: text-danger, Body:*)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tDiv(col-md-9 text-left){\n\t\t\t\t\tIf(RoleId == \"\"){\n\t\t\t\t\t\tSetVar(RoleId, 0)\n\t\t\t\t\t\tSetVar(RoleName,)\n\t\t\t\t\t}.Else{\n\t\t\t\t\t\tInput(Name: VarId, Type: hidden, Value: #RoleId#)\n\t\t\t\t\t}\n\t\t\t\t\tDiv(input-group){\n\t\t\t\t\t\tIf(#RoleId#>0){\n\t\t\t\t\t\t\tSetVar(Id, #RoleId#)\n\t\t\t\t\t\t\tDBFind(\"@1roles\").WhereId(#RoleId#).Columns(\"role_name\").Vars(r)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tInput(Name: m_name, Disabled: 1, Value: #r_role_name#)\n\t\t\t\t\t\tDiv(input-group-btn){\n\t\t\t\t\t\t\tButton(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_role, PageParams:\"back_page=@1voting_invite,back_header=$@1participants_add$,EcosystemId=#ecosystem_id#,Id=#vID#\").Popup(Header: $@1roles$, Width: \"50\")\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tIf(#instance_voting_type_participants#==6){\n\t\t\tDiv(row mb){\n\t\t\t\tDiv(col-md-3 mt-sm text-right){\n\t\t\t\t\tLabel(){\n\t\t\t\t\t\tLangRes(@1group)\n\t\t\t\t\t\tSpan(Class: text-danger, Body:*)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tDiv(col-md-9 text-left){\n\t\t\t\t\tIf(GroupId == \"\"){\n\t\t\t\t\t\tSetVar(GroupId, 0)\n\t\t\t\t\t\tSetVar(GroupName,)\n\t\t\t\t\t}.Else{\n\t\t\t\t\t\tInput(Name: VarId, Type: hidden, Value: #GroupId#)\n\t\t\t\t\t}\n\t\t\t\t\tDiv(input-group){\n\t\t\t\t\t\tIf(#GroupId# > 0){\n\t\t\t\t\t\t\tSetVar(Id, #GroupId#)\n\t\t\t\t\t\t\tDBFind(\"@1groups\").WhereId(#GroupId#).Columns(\"group_name\").Vars(g)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tInput(Name: m_name, Disabled: 1, Value: #g_group_name#)\n\t\t\t\t\t\tDiv(input-group-btn){\n\t\t\t\t\t\t\tButton(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_group, PageParams:\"back_page=@1voting_invite,back_header=$@1participants_add$,EcosystemId=#ecosystem_id#,Id=#vID#\").Popup(Header: $@1groups$, Width: \"50\")\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n Div(text-right){\n Button(Body: $@1back$, Class: btn btn-default, Page: #back_page#, PageParams: \"vID=#vID#\")\n If(Or(#MemberAccount# != \"\", #RoleId# != \"\", #GroupId# != \"\")){\n Button(Body: $@1send$, Class: btn btn-primary, Page: @1voting_invite, PageParams: \"vID=#vID#,back_page=#back_page#\", Contract: @1VotingInvite).Popup(50, $@1participants_add$)\n }\n }\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n )\n}.Else{\n Div(alert alert-danger mb-lg text-center){\n Span(Body: LangRes(@1attention))\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"vID=#vID#\")\n}\n", "Menu": "default_menu", "Type": "pages" }, { "Name": "voting_list", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1voting_list).(this_table, @1votings)\nInclude(@1pager_header)\n\nSetTitle(\"$@1voting_list$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1votings_list_desc$\"))\nAddToolButton(Title: $@1voting_wizard$, Page: @1voting_wizard, Icon: icon-magic-wand).Popup(50, $@1voting_wizard$)\nAddToolButton(Title: $@1templates_list$, Page: @1voting_templates_list, Icon: icon-pin)\nAddToolButton(Title: $@1create$, Page: @1voting_create, Icon: icon-plus).Popup(60, $@1new_voting$)\nDBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"System\"}).Vars(\"system_app\")\nSetVar(role_admin, AppParam(App: #system_app_id#, Name: \"role_admin\"))\nIf(#role_id# == #role_admin#){\n Div(btn-group ml-lg){\n Button(Body: Em(Class: fa fa-refresh) $@1update_votings_statuses$, Class: btn bg-gray ml-sm, Page: #this_page#, Contract: @1VotingStatusUpdate)\n }\n}\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": #ecosystem_id#, \"deleted\": 0, \"voting->type\": {\"$in\":[1,2]}, \"voting->name\": {\"$ilike\": \"#search#\"}})\n}.Else{\n SetVar(where, {\"ecosystem\": #ecosystem_id#, \"deleted\": 0, \"voting->type\": {\"$in\":[1,2]}})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1voting))\n Include(@1search)\n}\n\nSetVar(INVALID,1).(WAITING,2).(STARTED,3).(FINISHED,4)\nDBFind(@1applications).Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": -1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,voting->name,voting->type,voting->type_decision,voting->type_participants,flags->success,flags->decision,flags->full_data,progress->percent_success,progress->number_participants,creator->member_id,creator->member_name,date_started,date_ended,deleted,status,voting->count_type_voters,voting->volume,progress->number_voters\").Count(count_votings).Custom(_id){\n Span(Class: h5, Body: #id#)\n}.Custom(_name){\n LinkPage(Page: @1voting_view, PageParams: \"vID=#id#\"){\n Span(Class: h5 text-bold m0, Body: #voting.name#)\n }\n}.Custom(_subject){\n SetVar(decision, AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_decisions, Index: #voting.type_decision#))\n Div(h6 m0){\n If(Or(#status#==#STARTED#,#status#==#FINISHED#,#voting.type#==2)){\n #decision#\n }.Else{\n If(#voting.type_decision# == 1){\n SetVar(link_page,\"@1voting_decision_candidates\")\n }.ElseIf(#voting.type_decision# == 2){\n SetVar(link_page,\"@1voting_decision_election\")\n }.ElseIf(#voting.type_decision# == 3){\n SetVar(link_page,\"@1voting_decision_document\")\n }.ElseIf(#voting.type_decision# == 4){\n SetVar(link_page,\"@1voting_decision_contract\")\n }\n Button(Class: btn-xs btn-link p0 text-bold text-left, Page: #link_page#, PageParams: \"vID=#id#,back_page=#this_page#\"){\n If(#flags.full_data# == 1){\n Span(Class: text-primary, Body: #decision#)\n }.Else{\n Span(Class: text-danger, Body: #decision#)\n }\n }.Popup(60, $@1voting_subject$)\n }\n }\n}.Custom(_participants){\n SetVar(participants, AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_participants, Index: #voting.type_participants#))\n Div(h6 m0){\n If(Or(#status#==#STARTED#,#status#==#FINISHED#,#voting.type#==2)){\n #participants#\n }.Else{\n Button(Class: btn-xs btn-link p0 text-bold text-left, Page: @1voting_invite, PageParams: \"vID=#id#,back_page=#this_page#\"){\n If(#progress.number_participants# > 0){\n Span(Class: text-primary, Body: #participants#)\n }.Else{\n Span(Class: text-danger, Body: #participants#)\n }\n }.Popup(60, $@1participants_add$)\n }\n }\n}.Custom(_creator){\n LinkPage(Class: text-primary h6, Page: @1profile_view, PageParams: \"v_key_id=#creator.member_id#\", Body: #creator.member_name#)\n}.Custom(_date){\n P(Class: text-center h6 m0, Body: DateTime(DateTime: #date_started#, Format: \"DD.MM.YYYY HH:MI\"))\n P(Class: text-center h6 m0, Body: DateTime(DateTime: #date_ended#, Format: \"DD.MM.YYYY HH:MI\"))\n}.Custom(_type){\n Div(h6 m0 p0){\n AppParam(Ecosystem:1, App:#application_id#, Name: type_voting, Index: #voting.type#) /\n If(#voting.count_type_voters#==1){\n $@1number_votes$\n }.Else{\n $@1percent_votes$\n }\n }\n}.Custom(_progress){\n Div(text-center h5 text-bold){\n #progress.percent_success# %\n }\n}.Custom(_decision){\n Div(text-center){\n If(#flags.decision# == 0){\n If(And(#status#==#FINISHED#,#creator.member_id#==#key_id#)){\n Button(Body: LangRes(@1decision), Class: btn btn-primary, Contract: @1VotingDecisionCheck, Params: \"VotingId=#id#\", Page: #this_page#)\n }.Else{\n Div(text-muted){LangRes(@1no)}\n }\n }.ElseIf(#flags.decision# == -2){\n Div(text-muted){LangRes(@1not_enough_votes)}\n }.ElseIf(#flags.decision# == 1){\n Div(text-success){LangRes(@1accepted)}\n }.ElseIf(#flags.decision# == -1){\n Div(text-danger){LangRes(@1rejected)}\n }\n }\n}.Custom(_status){\n SetVar(status_class, AppParam(Ecosystem:1, App:#application_id#, Name:voting_statuses_classes, Index:#status#))\n Div(text-center #status_class#){\n If(#status#==#STARTED#){\n Button(Class: btn btn-link icon-eye, Page: @1voting_view, PageParams: \"vID=#id#\")\n }.Else{\n If(And(#status# == #INVALID#, Or(#flags.full_data# == 0, #progress.number_participants# == 0))){\n LangRes(@1not_filled)\n }.Else{\n AppParam(Ecosystem: 1, App: #application_id#, Name: voting_statuses, Index: #status#)\n }\n }\n }\n}.Custom(_actions){\n Div(text-right){\n If(And(#creator.member_id#==#key_id#,#status#==#INVALID#)){\n Button(Class: fa fa-trash btn btn-default, Contract: @1VotingDelete, Params: \"VotingId=#id#\", Page: #this_page#).Alert(Text: \"$@1want_delete_voting$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1voting$=_name,$@1type$=_type,$@1voting_subject$=_subject,$@1participants$=_participants,$@1date_start$ / $@1date_end$=_date,$@1creator$=_creator,$@1progress$=_progress,$@1decision$=_decision,$@1status$=_status,=_actions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1votings$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, @1voting_list).(this_table, @1votings)\nInclude(@1pager_header)\n\nSetTitle(\"$@1voting_list$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1votings_list_desc$\"))\nAddToolButton(Title: $@1templates_list$, Page: @1voting_templates_list, Icon: icon-pin)\nAddToolButton(Title: $@1create$, Page: @1voting_create, Icon: icon-plus).Popup(60, $@1new_voting$)\nDBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(system_app)\nSetVar(role_admin, AppParam(App: #system_app_id#, Name: \"role_admin\"))\nIf(#role_id# == #role_admin#){\n Div(btn-group ml-lg){\n Button(Body: Em(Class: fa fa-refresh) $@1update_votings_statuses$, Class: btn bg-gray ml-sm, Page: #this_page#, Contract: @1VotingStatusUpdate)\n }\n}\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0, \"voting->type\": {\"$in\": [1, 2]}, \"voting->name\": {\"$ilike\": \"#search#\"}})\n}.Else{\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0, \"voting->type\": {\"$in\": [1, 2]}})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1voting))\n Include(@1search)\n}\n\nSetVar(INVALID,1).(WAITING,2).(STARTED,3).(FINISHED,4)\nDBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": \"-1\"}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,voting->name,voting->type,voting->type_decision,voting->type_participants,flags->success,flags->decision,flags->full_data,progress->percent_success,progress->number_participants,creator->account,creator->member_name,date_started,date_ended,deleted,status,voting->count_type_voters,voting->volume,progress->number_voters\").Count(count_votings).Custom(_id){\n Span(Class: h5, Body: #id#)\n}.Custom(_name){\n LinkPage(Page: @1voting_view, PageParams: \"vID=#id#\"){\n Span(Class: h5 text-bold m0, Body: #voting.name#)\n }\n}.Custom(_subject){\n SetVar(decision, AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_decisions, Index: #voting.type_decision#))\n Div(h6 m0){\n If(Or(#status#==#STARTED#,#status#==#FINISHED#,#voting.type#==2)){\n #decision#\n }.Else{\n If(#voting.type_decision# == 1){\n SetVar(link_page,\"@1voting_decision_candidates\")\n }.ElseIf(#voting.type_decision# == 2){\n SetVar(link_page,\"@1voting_decision_election\")\n }.ElseIf(#voting.type_decision# == 3){\n SetVar(link_page,\"@1voting_decision_document\")\n }.ElseIf(#voting.type_decision# == 4){\n SetVar(link_page,\"@1voting_decision_contract\")\n }\n Button(Class: btn-xs btn-link p0 text-bold text-left, Page: #link_page#, PageParams: \"vID=#id#,back_page=#this_page#\"){\n If(#flags.full_data# == 1){\n Span(Class: text-primary, Body: #decision#)\n }.Else{\n Span(Class: text-danger, Body: #decision#)\n }\n }.Popup(60, $@1voting_subject$)\n }\n }\n}.Custom(_participants){\n SetVar(participants, AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_participants, Index: #voting.type_participants#))\n Div(h6 m0){\n If(Or(#status#==#STARTED#,#status#==#FINISHED#,#voting.type#==2)){\n #participants#\n }.Else{\n Button(Class: btn-xs btn-link p0 text-bold text-left, Page: @1voting_invite, PageParams: \"vID=#id#,back_page=#this_page#\"){\n If(#progress.number_participants# > 0){\n Span(Class: text-primary, Body: #participants#)\n }.Else{\n Span(Class: text-danger, Body: #participants#)\n }\n }.Popup(60, $@1participants_add$)\n }\n }\n}.Custom(_creator){\n LinkPage(Class: text-primary h6, Page: @1profile_view, PageParams: \"v_account=#creator.account#\", Body: #creator.member_name#)\n}.Custom(_date){\n P(Class: text-center h6 m0, Body: DateTime(DateTime: #date_started#, Format: \"DD.MM.YYYY HH:MI\"))\n P(Class: text-center h6 m0, Body: DateTime(DateTime: #date_ended#, Format: \"DD.MM.YYYY HH:MI\"))\n}.Custom(_type){\n Div(h6 m0 p0){\n AppParam(Ecosystem:1, App:#application_id#, Name: type_voting, Index: #voting.type#) /\n If(#voting.count_type_voters#==1){\n $@1number_votes$\n }.Else{\n $@1percent_votes$\n }\n }\n}.Custom(_progress){\n Div(text-center h5 text-bold){\n #progress.percent_success# %\n }\n}.Custom(_decision){\n Div(text-center){\n If(#flags.decision# == 0){\n If(And(#status# = =#FINISHED#, #creator.account# == #account_id#)){\n Button(Body: LangRes(@1decision), Class: btn btn-primary, Contract: @1VotingDecisionCheck, Params: \"VotingId=#id#\", Page: #this_page#)\n }.Else{\n Div(text-muted){LangRes(@1no)}\n }\n }.ElseIf(#flags.decision# == -2){\n Div(text-muted){LangRes(@1not_enough_votes)}\n }.ElseIf(#flags.decision# == 1){\n Div(text-success){LangRes(@1accepted)}\n }.ElseIf(#flags.decision# == -1){\n Div(text-danger){LangRes(@1rejected)}\n }\n }\n}.Custom(_status){\n SetVar(status_class, AppParam(Ecosystem:1, App:#application_id#, Name:voting_statuses_classes, Index:#status#))\n Div(text-center #status_class#){\n If(#status#==#STARTED#){\n Button(Class: btn btn-link icon-eye, Page: @1voting_view, PageParams: \"vID=#id#\")\n }.Else{\n If(And(#status# == #INVALID#, Or(#flags.full_data# == 0, #progress.number_participants# == 0))){\n LangRes(@1not_filled)\n }.Else{\n AppParam(Ecosystem: 1, App: #application_id#, Name: voting_statuses, Index: #status#)\n }\n }\n }\n}.Custom(_actions){\n Div(text-right){\n If(And(#creator.account# == #account_id#, #status# == #INVALID#)){\n Button(Class: fa fa-trash btn btn-default, Contract: @1VotingDelete, Params: \"VotingId=#id#\", Page: #this_page#).Alert(Text: \"$@1want_delete_voting$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1voting$=_name,$@1type$=_type,$@1voting_subject$=_subject,$@1participants$=_participants,$@1date_start$ / $@1date_end$=_date,$@1creator$=_creator,$@1progress$=_progress,$@1decision$=_decision,$@1status$=_status,=_actions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1votings$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "voting_template_create", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1voting_template_create)\nDBFind(@1applications).Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\nSetVar(name, \"New voting\").(typevoting, 0).(volume, 50).(quorum, 51).(vacancies, 1)\n\nIf(#TemplateId#>0){\n DBFind(@1voting_templates).Where({\"id\": #TemplateId#, \"ecosystem\": #ecosystem_id#}).Columns(\"voting->count_type_voters,voting->name,voting->volume,voting->quorum,voting->type_decision,voting->type_participants,voting->type,voting->rating,subject->candidates,subject->vacancies,subject->voters,subject->contract_accept,subject->contract_reject,optional->contract_accept,optional->contract_reject,optional->init_contract,optional->contract_accept_params,optional->contract_reject_params,optional->init_contract_params\").Vars(template)\n\n If(#CountTypeVoters# == \"\"){\n SetVar(CountTypeVoters, #template_voting_count_type_voters#)\n }\n If(#TypeDecision# == \"\"){\n SetVar(ValTypeDec, #template_voting_type_decision#)\n }\n If(#TypeParticipants# == \"\"){\n SetVar(TypeParticipants, #template_voting_type_participants#)\n }\n SetVar(voters, #template_subject_voters#)\n SetVar(name, #template_voting_name#)\n SetVar(quorum, #template_voting_quorum#)\n If(#template_voting_rating# == 1){\n SetVar(rating, \"true\")\n }\n SetVar(volume, #template_voting_volume#)\n SetVar(candidates, #template_subject_candidates#)\n SetVar(vacancies, #template_subject_vacancies#)\n SetVar(contract_accept, #template_subject_contract_accept#)\n SetVar(contract_reject, #template_subject_contract_reject#)\n SetVar(init_contract, #template_optional_init_contract#)\n SetVar(init_params, #template_optional_init_contract_params#)\n SetVar(optional_accept_contract, #template_optional_contract_accept#)\n SetVar(optional_accept_params, #template_optional_contract_accept_params#)\n SetVar(optional_reject_contract, #template_optional_contract_reject#)\n SetVar(optional_reject_params, #template_optional_contract_reject_params#)\n}\n\nForm(){\n If(#TypeDecision#>0){\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1vote_count_type)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n If(#CountTypeVoters#==1){\n Input(Name: InputCountTypeVoters, Disabled: 1, Value: $@1number_votes$)\n Input(Name: CountTypeVoters, Type: hidden, Value: 1)\n }.Else{\n Input(Name: InputCountTypeVoters, Disabled: 1, Value: $@1percent_votes$)\n Input(Name: CountTypeVoters, Type: hidden, Value: 0)\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_subject)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n SetVar(var_type_voting_decisions, AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_decisions, Index: #TypeDecision#))\n Input(Name: Input_TypeVotingDecisions, Disabled: 1, Value: #var_type_voting_decisions#)\n Input(Name: TypeDecision, Type: hidden, Value: #TypeDecision#)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1participants)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n SetVar(var_type_participants, AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_participants, Index: #TypeParticipants#))\n Input(Name: InputTypeVotingParticipants, Disabled: 1, Value: #var_type_participants#)\n Input(Name: TypeParticipants, Type: hidden, Value: #TypeParticipants#)\n }\n }\n If(#TypeParticipants#==3){\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voters_role)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n DBFind(@1roles, src_roles1).Where({\"ecosystem\": #ecosystem_id#, \"deleted\": 0}).Order(id).Custom(name){\n #role_name#\n }\n Select(Name: Voters, Source: src_roles1, NameColumn: name, ValueColumn: id, Value: #voters#)\n }\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1name)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: VotingName, Value: #name#)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_quorum)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n If(#CountTypeVoters#==1){\n Input(Name: Quorum, Value: #quorum#, Type: number)\n Div(m0 h6 text-muted){\n $@1voting_quorum_number_desc$\n }\n }.Else{\n Input(Name: Quorum, Value: #quorum#, Type: number)\n Div(m0 h6 text-muted){\n $@1voting_quorum_desc$\n }\n }\n }\n }\n If(Or(#TypeParticipants#==1,#TypeParticipants#==2,#TypeParticipants#==3,#TypeParticipants#==4)){\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_rating)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 mt-sm text-left){\n Input(Name: Rating, Placeholder: $@1voting_rating_desc$, Type: checkbox, Value: #rating#, Class: m0 text-muted)\n }\n }\n }\n }\n If(Or(#CountTypeVoters#==1,#TypeDecision#==1,#TypeDecision#==2)){\n SetVar(hide_volume, 1)\n }\n If(#hide_volume# != 1){\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_volume)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Volume, Value: #volume#, Type: number)\n Div(m0 h6 text-muted){\n $@1voting_volume_desc$\n }\n }\n }\n }\n }\n\n If(Or(#TypeDecision#==1,#TypeDecision#==2)){\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1vacancies)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Vacancies, Value: #vacancies#, Type: number)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1candidates_role)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n DBFind(@1roles,src_roles2).Where({\"role_type\": 2, \"ecosystem\": #ecosystem_id#, \"deleted\": 0}).Order(id).Custom(name){\n #role_name#\n }\n Select(Name: Candidates, Source: src_roles2, NameColumn: name, ValueColumn: id, Value: #candidates#)\n }\n }\n }\n }\n If(#TypeDecision#==4){\n Div(list-group-item){\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1contract_accept)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-12){\n Input(Name: ContractAccept, Placeholder: $@1contract$, Value: #contract_accept#)\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1contract_reject)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-12){\n Input(Name: ContractReject, Placeholder: $@1contract$, Value: #contract_reject#)\n }\n }\n }\n }\n }\n }\n\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_init_contract)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-6){\n Input(Name: InitContract, Placeholder: $@1contract$, Value: #init_contract#)\n }\n Div(col-md-6){\n Input(Name: ParamsInit, Placeholder: $@1arguments$, Value: #init_params#)\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1contract_accept)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-6){\n Input(Name: OptionalContractAccept, Placeholder: $@1contract$, Value: #optional_accept_contract#)\n }\n Div(col-md-6){\n Input(Name: OptionalParamsAccept, Placeholder: $@1arguments$, Value: #optional_accept_params#)\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1contract_reject)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-6){\n Input(Name: OptionalContractReject, Placeholder: $@1contract$, Value: #optional_reject_contract#)\n }\n Div(col-md-6){\n Input(Name: OptionalParamsReject, Placeholder: $@1arguments$, Value: #optional_reject_params#)\n }\n }\n }\n }\n }\n Button(Body: LangRes(@1create), Class: btn btn-primary pull-right mt, Page: @1voting_templates_list, Contract: @1VotingTemplateCreate)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #this_page#, PageParams: \"TemplateId=#TemplateId#\").Popup(60, $@1voting_template_create$)\n }.Else{\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1vote_count_type)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 mt-sm text-left){\n If(#CountTypeVoters#==1){\n Button(Body: $@1percent_votes$, Page: #this_page#, PageParams: \"CountTypeVoters=0,TemplateId=#TemplateId#\", Class: btn-xs btn-default mr-lg).Popup(60, $@1voting_template_create$)\n Button(Body: $@1number_votes$, Page: #this_page#, PageParams: \"CountTypeVoters=1,TemplateId=#TemplateId#\", Class: btn-xs btn-primary disabled).Popup(60, $@1voting_template_create$)\n }.Else{\n Button(Body: $@1percent_votes$, Page: #this_page#, PageParams: \"CountTypeVoters=0,TemplateId=#TemplateId#\", Class: btn-xs btn-primary disabled mr-lg).Popup(60, $@1voting_template_create$)\n Button(Body: $@1number_votes$, Page: #this_page#, PageParams: \"CountTypeVoters=1,TemplateId=#TemplateId#\", Class: btn-xs btn-default).Popup(60, $@1voting_template_create$) \n }\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt text-right){\n Label(){\n LangRes(@1voting_subject)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n If(#CountTypeVoters#==1){\n Data(numbers_type_decisions, \"value,name\"){\n 3,$@1document$\n 4,$@1contract_run$\n }\n RadioGroup(Name: TypeDecision, Value: #ValTypeDec#, Source: numbers_type_decisions, ValueColumn: value, NameColumn: name)\n }.Else{\n AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_decisions, Source: procent_type_decisions)\n RadioGroup(Name: TypeDecision, Value: #ValTypeDec#, Source: procent_type_decisions, ValueColumn: id, NameColumn: name) \n }\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1participants)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_participants, Source: src_typepart)\n Select(Name: TypeParticipants, Source: src_typepart, NameColumn: name, ValueColumn: id, Value: #TypeParticipants#)\n }\n }\n }\n Button(Body: LangRes(@1next), Class: btn btn-primary pull-right mt, Page: #this_page#, PageParams: \"CountTypeVoters=#CountTypeVoters#,TypeDecision=Val(TypeDecision),TypeParticipants=Val(TypeParticipants),TemplateId=#TemplateId#\").Popup(60, $@1voting_template_create$)\n If(#TemplateId#>0){\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1voting_template_view, PageParams: \"TemplateId=#TemplateId#\")\n }.Else{\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1voting_templates_list)\n }\n }\n}", + "Value": "SetVar(this_page, @1voting_template_create)\nDBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\nSetVar(name, \"New voting\").(typevoting, 0).(volume, 50).(quorum, 51).(vacancies, 1)\n\nIf(#TemplateId#>0){\n DBFind(\"@1voting_templates\").Where({\"id\": \"#TemplateId#\", \"ecosystem\": \"#ecosystem_id#\"}).Columns(\"voting->count_type_voters,voting->name,voting->volume,voting->quorum,voting->type_decision,voting->type_participants,voting->type,voting->rating,subject->candidates,subject->vacancies,subject->voters,subject->contract_accept,subject->contract_reject,optional->contract_accept,optional->contract_reject,optional->init_contract,optional->contract_accept_params,optional->contract_reject_params,optional->init_contract_params\").Vars(template)\n\n If(#CountTypeVoters# == \"\"){\n SetVar(CountTypeVoters, #template_voting_count_type_voters#)\n }\n If(#TypeDecision# == \"\"){\n SetVar(ValTypeDec, #template_voting_type_decision#)\n }\n If(#TypeParticipants# == \"\"){\n SetVar(TypeParticipants, #template_voting_type_participants#)\n }\n SetVar(voters, #template_subject_voters#)\n SetVar(name, #template_voting_name#)\n SetVar(quorum, #template_voting_quorum#)\n If(#template_voting_rating# == 1){\n SetVar(rating, \"true\")\n }\n SetVar(volume, #template_voting_volume#)\n SetVar(candidates, #template_subject_candidates#)\n SetVar(vacancies, #template_subject_vacancies#)\n SetVar(contract_accept, #template_subject_contract_accept#)\n SetVar(contract_reject, #template_subject_contract_reject#)\n SetVar(init_contract, #template_optional_init_contract#)\n SetVar(init_params, #template_optional_init_contract_params#)\n SetVar(optional_accept_contract, #template_optional_contract_accept#)\n SetVar(optional_accept_params, #template_optional_contract_accept_params#)\n SetVar(optional_reject_contract, #template_optional_contract_reject#)\n SetVar(optional_reject_params, #template_optional_contract_reject_params#)\n}\n\nForm(){\n If(#TypeDecision#>0){\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1vote_count_type)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n If(#CountTypeVoters#==1){\n Input(Name: InputCountTypeVoters, Disabled: 1, Value: $@1number_votes$)\n Input(Name: CountTypeVoters, Type: hidden, Value: 1)\n }.Else{\n Input(Name: InputCountTypeVoters, Disabled: 1, Value: $@1percent_votes$)\n Input(Name: CountTypeVoters, Type: hidden, Value: 0)\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_subject)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n SetVar(var_type_voting_decisions, AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_decisions, Index: #TypeDecision#))\n Input(Name: Input_TypeVotingDecisions, Disabled: 1, Value: #var_type_voting_decisions#)\n Input(Name: TypeDecision, Type: hidden, Value: #TypeDecision#)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1participants)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n SetVar(var_type_participants, AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_participants, Index: #TypeParticipants#))\n Input(Name: InputTypeVotingParticipants, Disabled: 1, Value: #var_type_participants#)\n Input(Name: TypeParticipants, Type: hidden, Value: #TypeParticipants#)\n }\n }\n If(#TypeParticipants#==3){\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voters_role)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n DBFind(\"@1roles\", src_roles1).Where({\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0}).Order(\"id\").Custom(name){\n #role_name#\n }\n Select(Name: Voters, Source: src_roles1, NameColumn: name, ValueColumn: id, Value: #voters#)\n }\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1name)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: VotingName, Value: #name#)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_quorum)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n If(#CountTypeVoters#==1){\n Input(Name: Quorum, Value: #quorum#, Type: number)\n Div(m0 h6 text-muted){\n $@1voting_quorum_number_desc$\n }\n }.Else{\n Input(Name: Quorum, Value: #quorum#, Type: number)\n Div(m0 h6 text-muted){\n $@1voting_quorum_desc$\n }\n }\n }\n }\n If(Or(#TypeParticipants#==1,#TypeParticipants#==2,#TypeParticipants#==3,#TypeParticipants#==4)){\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_rating)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 mt-sm text-left){\n Input(Name: Rating, Placeholder: $@1voting_rating_desc$, Type: checkbox, Value: #rating#, Class: m0 text-muted)\n }\n }\n }\n }\n If(Or(#CountTypeVoters#==1,#TypeDecision#==1,#TypeDecision#==2)){\n SetVar(hide_volume, 1)\n }\n If(#hide_volume# != 1){\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_volume)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Volume, Value: #volume#, Type: number)\n Div(m0 h6 text-muted){\n $@1voting_volume_desc$\n }\n }\n }\n }\n }\n\n If(Or(#TypeDecision#==1,#TypeDecision#==2)){\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1vacancies)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Vacancies, Value: #vacancies#, Type: number)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1candidates_role)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n DBFind(\"@1roles\", src_roles2).Where({\"role_type\": 2, \"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0}).Order(\"id\").Custom(name){\n #role_name#\n }\n Select(Name: Candidates, Source: src_roles2, NameColumn: name, ValueColumn: id, Value: #candidates#)\n }\n }\n }\n }\n If(#TypeDecision#==4){\n Div(list-group-item){\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1contract_accept)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-12){\n Input(Name: ContractAccept, Placeholder: $@1contract$, Value: #contract_accept#)\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1contract_reject)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-12){\n Input(Name: ContractReject, Placeholder: $@1contract$, Value: #contract_reject#)\n }\n }\n }\n }\n }\n }\n\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_init_contract)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-6){\n Input(Name: InitContract, Placeholder: $@1contract$, Value: #init_contract#)\n }\n Div(col-md-6){\n Input(Name: ParamsInit, Placeholder: $@1arguments$, Value: #init_params#)\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1contract_accept)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-6){\n Input(Name: OptionalContractAccept, Placeholder: $@1contract$, Value: #optional_accept_contract#)\n }\n Div(col-md-6){\n Input(Name: OptionalParamsAccept, Placeholder: $@1arguments$, Value: #optional_accept_params#)\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1contract_reject)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-6){\n Input(Name: OptionalContractReject, Placeholder: $@1contract$, Value: #optional_reject_contract#)\n }\n Div(col-md-6){\n Input(Name: OptionalParamsReject, Placeholder: $@1arguments$, Value: #optional_reject_params#)\n }\n }\n }\n }\n }\n Button(Body: LangRes(@1create), Class: btn btn-primary pull-right mt, Page: @1voting_templates_list, Contract: @1VotingTemplateCreate)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #this_page#, PageParams: \"TemplateId=#TemplateId#\").Popup(60, $@1voting_template_create$)\n }.Else{\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1vote_count_type)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 mt-sm text-left){\n If(#CountTypeVoters#==1){\n Button(Body: $@1percent_votes$, Page: #this_page#, PageParams: \"CountTypeVoters=0,TemplateId=#TemplateId#\", Class: btn-xs btn-default mr-lg).Popup(60, $@1voting_template_create$)\n Button(Body: $@1number_votes$, Page: #this_page#, PageParams: \"CountTypeVoters=1,TemplateId=#TemplateId#\", Class: btn-xs btn-primary disabled).Popup(60, $@1voting_template_create$)\n }.Else{\n Button(Body: $@1percent_votes$, Page: #this_page#, PageParams: \"CountTypeVoters=0,TemplateId=#TemplateId#\", Class: btn-xs btn-primary disabled mr-lg).Popup(60, $@1voting_template_create$)\n Button(Body: $@1number_votes$, Page: #this_page#, PageParams: \"CountTypeVoters=1,TemplateId=#TemplateId#\", Class: btn-xs btn-default).Popup(60, $@1voting_template_create$) \n }\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt text-right){\n Label(){\n LangRes(@1voting_subject)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n If(#CountTypeVoters#==1){\n Data(numbers_type_decisions, \"value,name\"){\n 3,$@1document$\n 4,$@1contract_run$\n }\n RadioGroup(Name: TypeDecision, Value: #ValTypeDec#, Source: numbers_type_decisions, ValueColumn: value, NameColumn: name)\n }.Else{\n AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_decisions, Source: procent_type_decisions)\n RadioGroup(Name: TypeDecision, Value: #ValTypeDec#, Source: procent_type_decisions, ValueColumn: id, NameColumn: name) \n }\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1participants)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_participants, Source: src_typepart)\n Select(Name: TypeParticipants, Source: src_typepart, NameColumn: name, ValueColumn: id, Value: #TypeParticipants#)\n }\n }\n }\n Button(Body: LangRes(@1next), Class: btn btn-primary pull-right mt, Page: #this_page#, PageParams: \"CountTypeVoters=#CountTypeVoters#,TypeDecision=Val(TypeDecision),TypeParticipants=Val(TypeParticipants),TemplateId=#TemplateId#\").Popup(60, $@1voting_template_create$)\n If(#TemplateId#>0){\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1voting_template_view, PageParams: \"TemplateId=#TemplateId#\")\n }.Else{\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1voting_templates_list)\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "voting_template_view", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1applications).Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\nIf(#TemplateId#>0){\n DBFind(@1voting_templates).Where({\"id\": #TemplateId#, \"ecosystem\": #ecosystem_id#}).Columns(\"voting->count_type_voters,voting->name,voting->volume,voting->quorum,voting->type_decision,voting->type_participants,voting->type,voting->rating,subject->candidates,subject->vacancies,subject->voters,subject->contract_accept,subject->contract_reject,optional->contract_accept,optional->contract_reject,optional->init_contract,optional->contract_accept_params,optional->contract_reject_params,optional->init_contract_params\").Vars(template)\n If(#template_subject_voters#>0){\n DBFind(@1roles).Where({\"ecosystem\": #ecosystem_id#, \"id\": #template_subject_voters#}).Columns(\"role_name\").Vars(vid)\n SetVar(v_role, \"#vid_role_name#\")\n }\n If(#template_subject_candidates#>0){\n DBFind(@1roles).Where({\"ecosystem\": #ecosystem_id#, \"id\": #template_subject_candidates#}).Columns(\"role_name\").Vars(cid)\n SetVar(c_role, \"#cid_role_name#\")\n }\n}\n\nSetTitle(\"$@1template$\": #template_voting_name#)\nSpan(Class: h5 m0 mb ml-lg){\n LinkPage(Class: ml-sm, Body: $@1voting$, Page: @1voting_list)\n Span(Class: text-muted mh-sm, Body: /)\n LinkPage(Class: ml-sm, Body: $@1voting_templates$, Page: @1voting_templates_list)\n Span(Class: text-muted mh-sm, Body: /)\n Span(Class: text-muted, Body: #template_voting_name#)\n}.Style(\n display: inline-block;\n)\n\nDiv(content-wrapper){\n If(#template_id# > 0){\n Div(row){\n Div(col-lg-10 col-lg-offset-1){\n Form(panel panel-primary){\n Div(list-group-item text-center){\n P(Class: h3 text-bold m0, Body: #template_voting_name#)\n Div(row){\n Div(col-md-12){\n Div(Class: t5 text-muted m0, Body: AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_decisions, Index: #template_voting_type_decision#))\n }\n }\n }\n Div(list-group-item text-center){\n P(Class: h5 text-bold m0 mb, Body: $@1voting$)\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1type)\n }\n Div(col-md-6 text-left){\n AppParam(Ecosystem:1, App:#application_id#, Name: type_voting, Index: #template_voting_type#)\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1vote_count_type)\n }\n Div(col-md-6 text-left){\n If(#template_voting_count_type_voters#==1){\n $@1number_votes$\n }.Else{\n $@1percent_votes$\n }\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1voting_rating)\n }\n Div(col-md-6 text-left){\n If(#template_voting_rating#==1){\n $@1yes$ Span(Class:text-muted, Body: ($@1voting_rating_desc$))\n }.Else{\n $@1no$ Span(Class:text-muted, Body: ($@1voting_rating_not_used$))\n }\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1voting_quorum)\n }\n Div(col-md-6 text-left){\n If(#template_voting_count_type_voters#==1){\n #template_voting_quorum#\n }.Else{\n #template_voting_quorum#%\n }\n }\n }\n If(And(#template_voting_count_type_voters#!=1,#template_voting_type_decision#!=1,#template_voting_type_decision#!=2)){\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1voting_volume)\n }\n Div(col-md-6 text-left){\n #template_voting_volume#%\n }\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1participants)\n }\n Div(col-md-6 text-left){\n AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_participants, Index: #template_voting_type_participants#)\n }\n }\n If(#template_voting_type_participants#==3){\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1voters_role)\n }\n Div(col-md-6 text-left){\n #v_role#\n }\n }\n }\n }\n If(Or(#template_voting_type_decision#==1,#template_voting_type_decision#==2)){\n Div(list-group-item text-center){\n P(Class: h5 text-bold m0 mb, Body: $@1voting_subject$)\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1vacancies)\n }\n Div(col-md-6 text-left){\n #template_subject_vacancies#\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1candidates_role)\n }\n Div(col-md-6 text-left){\n #c_role#\n }\n }\n }\n }\n If(#template_voting_type_decision#==4){\n Div(list-group-item text-center){\n P(Class: h5 text-bold m0 mb, Body: $@1voting_subject$)\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1contract_accept)\n }\n Div(col-md-6 text-left){\n If(#template_subject_contract_accept# == \"\"){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #template_subject_contract_accept#\n }\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1contract_reject)\n }\n Div(col-md-6 text-left){\n If(#template_subject_contract_reject# == \"\"){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #template_subject_contract_reject#\n }\n }\n }\n }\n }\n Div(list-group-item text-center){\n P(Class: h5 m0 mb){\n Span(Class: text-bold, Body: $@1params$)\n Span(Class: text-normal text-muted ml, Body: $@1optional$)\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1voting_init_contract)\n Span(Class: text-muted ml, Body: LangRes(@1optional))\n }\n Div(col-md-6 text-left){\n If(#template_optional_init_contract# == \"\"){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #template_optional_init_contract#\n }\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1arguments)\n Span(Class: text-muted ml, Body: LangRes(@1optional))\n }\n Div(col-md-6 text-left){\n If(#template_optional_init_contract_params# == \"\"){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #template_optional_init_contract_params#\n }\n }\n }\n Div(row mt t6){\n Div(col-md-6 text-right){\n LangRes(@1contract_accept)\n Span(Class: text-muted ml, Body: LangRes(@1optional))\n }\n Div(col-md-6 text-left){\n If(#template_optional_contract_accept# == \"\"){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #template_optional_contract_accept#\n }\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1arguments)\n Span(Class: text-muted ml, Body: LangRes(@1optional))\n }\n Div(col-md-6 text-left){\n If(#template_optional_contract_accept_params# == \"\"){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #template_optional_contract_accept_params#\n }\n }\n }\n Div(row mt t6){\n Div(col-md-6 text-right){\n LangRes(@1contract_reject)\n Span(Class: text-muted ml, Body: LangRes(@1optional))\n }\n Div(col-md-6 text-left){\n If(#template_optional_contract_reject# == \"\"){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #template_optional_contract_reject#\n }\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1arguments)\n Span(Class: text-muted ml, Body: LangRes(@1optional))\n }\n Div(col-md-6 text-left){\n If(#template_optional_contract_reject_params# == \"\"){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #template_optional_contract_reject_params#\n }\n }\n }\n }\n If(#template_voting_type# == 1){\n Div(list-group-item){\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Label(){\n $@1duration$ ($@1days$)\n }\n }\n Div(col-md-6 text-left){\n Input(Name: Duration, Type: number, Value: 3)\n }\n }\n If(#template_voting_type_decision#==3){\n Div(row mt-sm){\n Div(col-md-6 mt-sm text-right){\n Label(){\n LangRes(@1text_document)\n }\n }\n Div(col-md-6 text-left){\n Input(Name: TextDocument, Type: textarea).Style(resize: vertical;)\n }\n }\n }\n }\n }\n Div(list-group-item){\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: @1voting_templates_list)\n Div(pull-right){\n Button(Class: fa fa-copy btn btn-default, Page: @1voting_template_create, PageParams: \"TemplateId=#TemplateId#\").Popup(60, $@1voting_template_create$)\n If(#template_voting_type# == 1){\n Button(Body: $@1voting_start_button$, Class: btn btn-primary, Page: @1voting_list, Contract: @1VotingTemplateRun, Params: \"TemplateId=#TemplateId#\")\n }\n }\n }\n }\n }\n }\n }.Else{\n Div(col-md-12 alert alert-danger text-center){\n LangRes(@1attention)\n }\n }\n}.Style(\n .t3 {font-size:24px;}\n .t4 {font-size:18px;}\n .t5 {font-size:14px;}\n .t6 {font-size:12px;}\n .break {word-break: break-all;}\n)", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\nIf(#TemplateId#>0){\n DBFind(\"@1voting_templates\").Where({\"id\": \"#TemplateId#\", \"ecosystem\": \"#ecosystem_id#\"}).Columns(\"voting->count_type_voters,voting->name,voting->volume,voting->quorum,voting->type_decision,voting->type_participants,voting->type,voting->rating,subject->candidates,subject->vacancies,subject->voters,subject->contract_accept,subject->contract_reject,optional->contract_accept,optional->contract_reject,optional->init_contract,optional->contract_accept_params,optional->contract_reject_params,optional->init_contract_params\").Vars(template)\n If(#template_subject_voters#>0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#template_subject_voters#\"}).Columns(\"role_name\").Vars(vid)\n SetVar(v_role, \"#vid_role_name#\")\n }\n If(#template_subject_candidates#>0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#template_subject_candidates#\"}).Columns(\"role_name\").Vars(cid)\n SetVar(c_role, \"#cid_role_name#\")\n }\n}\n\nSetTitle(\"$@1template$\": #template_voting_name#)\nSpan(Class: h5 m0 mb ml-lg){\n LinkPage(Class: ml-sm, Body: $@1voting$, Page: @1voting_list)\n Span(Class: text-muted mh-sm, Body: /)\n LinkPage(Class: ml-sm, Body: $@1voting_templates$, Page: @1voting_templates_list)\n Span(Class: text-muted mh-sm, Body: /)\n Span(Class: text-muted, Body: #template_voting_name#)\n}.Style(\n display: inline-block;\n)\n\nDiv(content-wrapper){\n If(#template_id# > 0){\n Div(row){\n Div(col-lg-10 col-lg-offset-1){\n Form(panel panel-primary){\n Div(list-group-item text-center){\n P(Class: h3 text-bold m0, Body: #template_voting_name#)\n Div(row){\n Div(col-md-12){\n Div(Class: t5 text-muted m0, Body: AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_decisions, Index: #template_voting_type_decision#))\n }\n }\n }\n Div(list-group-item text-center){\n P(Class: h5 text-bold m0 mb, Body: $@1voting$)\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1type)\n }\n Div(col-md-6 text-left){\n AppParam(Ecosystem:1, App:#application_id#, Name: type_voting, Index: #template_voting_type#)\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1vote_count_type)\n }\n Div(col-md-6 text-left){\n If(#template_voting_count_type_voters#==1){\n $@1number_votes$\n }.Else{\n $@1percent_votes$\n }\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1voting_rating)\n }\n Div(col-md-6 text-left){\n If(#template_voting_rating#==1){\n $@1yes$ Span(Class:text-muted, Body: ($@1voting_rating_desc$))\n }.Else{\n $@1no$ Span(Class:text-muted, Body: ($@1voting_rating_not_used$))\n }\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1voting_quorum)\n }\n Div(col-md-6 text-left){\n If(#template_voting_count_type_voters#==1){\n #template_voting_quorum#\n }.Else{\n #template_voting_quorum#%\n }\n }\n }\n If(And(#template_voting_count_type_voters#!=1,#template_voting_type_decision#!=1,#template_voting_type_decision#!=2)){\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1voting_volume)\n }\n Div(col-md-6 text-left){\n #template_voting_volume#%\n }\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1participants)\n }\n Div(col-md-6 text-left){\n AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_participants, Index: #template_voting_type_participants#)\n }\n }\n If(#template_voting_type_participants#==3){\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1voters_role)\n }\n Div(col-md-6 text-left){\n #v_role#\n }\n }\n }\n }\n If(Or(#template_voting_type_decision#==1,#template_voting_type_decision#==2)){\n Div(list-group-item text-center){\n P(Class: h5 text-bold m0 mb, Body: $@1voting_subject$)\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1vacancies)\n }\n Div(col-md-6 text-left){\n #template_subject_vacancies#\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1candidates_role)\n }\n Div(col-md-6 text-left){\n #c_role#\n }\n }\n }\n }\n If(#template_voting_type_decision#==4){\n Div(list-group-item text-center){\n P(Class: h5 text-bold m0 mb, Body: $@1voting_subject$)\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1contract_accept)\n }\n Div(col-md-6 text-left){\n If(#template_subject_contract_accept# == \"\"){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #template_subject_contract_accept#\n }\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1contract_reject)\n }\n Div(col-md-6 text-left){\n If(#template_subject_contract_reject# == \"\"){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #template_subject_contract_reject#\n }\n }\n }\n }\n }\n Div(list-group-item text-center){\n P(Class: h5 m0 mb){\n Span(Class: text-bold, Body: $@1params$)\n Span(Class: text-normal text-muted ml, Body: $@1optional$)\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1voting_init_contract)\n Span(Class: text-muted ml, Body: LangRes(@1optional))\n }\n Div(col-md-6 text-left){\n If(#template_optional_init_contract# == \"\"){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #template_optional_init_contract#\n }\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1arguments)\n Span(Class: text-muted ml, Body: LangRes(@1optional))\n }\n Div(col-md-6 text-left){\n If(#template_optional_init_contract_params# == \"\"){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #template_optional_init_contract_params#\n }\n }\n }\n Div(row mt t6){\n Div(col-md-6 text-right){\n LangRes(@1contract_accept)\n Span(Class: text-muted ml, Body: LangRes(@1optional))\n }\n Div(col-md-6 text-left){\n If(#template_optional_contract_accept# == \"\"){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #template_optional_contract_accept#\n }\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1arguments)\n Span(Class: text-muted ml, Body: LangRes(@1optional))\n }\n Div(col-md-6 text-left){\n If(#template_optional_contract_accept_params# == \"\"){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #template_optional_contract_accept_params#\n }\n }\n }\n Div(row mt t6){\n Div(col-md-6 text-right){\n LangRes(@1contract_reject)\n Span(Class: text-muted ml, Body: LangRes(@1optional))\n }\n Div(col-md-6 text-left){\n If(#template_optional_contract_reject# == \"\"){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #template_optional_contract_reject#\n }\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1arguments)\n Span(Class: text-muted ml, Body: LangRes(@1optional))\n }\n Div(col-md-6 text-left){\n If(#template_optional_contract_reject_params# == \"\"){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #template_optional_contract_reject_params#\n }\n }\n }\n }\n If(#template_voting_type# == 1){\n Div(list-group-item){\n Div(row){\n Div(col-md-6 mt-sm text-right){\n Label(){\n $@1duration$ ($@1days$)\n }\n }\n Div(col-md-6 text-left){\n Input(Name: Duration, Type: number, Value: 3)\n }\n }\n If(#template_voting_type_decision#==3){\n Div(row mt-sm){\n Div(col-md-6 mt-sm text-right){\n Label(){\n LangRes(@1text_document)\n }\n }\n Div(col-md-6 text-left){\n Input(Name: TextDocument, Type: textarea).Style(resize: vertical;)\n }\n }\n }\n }\n }\n Div(list-group-item){\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: @1voting_templates_list)\n Div(pull-right){\n Button(Class: fa fa-copy btn btn-default, Page: @1voting_template_create, PageParams: \"TemplateId=#TemplateId#\").Popup(60, $@1voting_template_create$)\n If(#template_voting_type# == 1){\n Button(Body: $@1voting_start_button$, Class: btn btn-primary, Page: @1voting_list, Contract: @1VotingTemplateRun, Params: \"TemplateId=#TemplateId#\")\n }\n }\n }\n }\n }\n }\n }.Else{\n Div(col-md-12 alert alert-danger text-center){\n LangRes(@1attention)\n }\n }\n}.Style(\n .t3 {font-size:24px;}\n .t4 {font-size:18px;}\n .t5 {font-size:14px;}\n .t6 {font-size:12px;}\n .break {word-break: break-all;}\n)", "Menu": "default_menu", "Type": "pages" }, { "Name": "voting_templates_list", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1voting_templates_list).(this_table, @1voting_templates)\nInclude(@1pager_header)\n\nSetTitle(\"$@1voting_templates$\")\nSpan(Class: h5 m0 mb ml-lg){\n LinkPage(Class: ml-sm, Body: $@1votings$, Page: @1voting_list)\n Span(Class: text-muted mh, Body: /)\n Span(Class: text-muted, Body: $@1voting_templates$)\n}.Style(\n display: inline-block;\n)\n\nIf(#search#){\n SetVar(w_search, {\"voting->name\": {\"$ilike\": \"#search#\"}})\n}\nSetVar(where, {\"ecosystem\": #ecosystem_id#, \"voting->type\": {\"$in\": [1,2]}, {#w_search#}})\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1template))\n Include(@1search)\n}\n\nDBFind(@1applications).Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"voting->name,voting->type_participants,voting->type_decision,voting->type\").Custom(_participants){\n P(Class: m0 h6, Body: AppParam(Ecosystem:1, App:#application_id#, Name:type_voting_participants, Index: #voting.type_participants#))\n}.Custom(_decision){\n P(Class: m0 h6, Body: AppParam(Ecosystem:1, App:#application_id#, Name:type_voting_decisions, Index: #voting.type_decision#))\n}.Custom(_type){\n AppParam(Ecosystem:1, App:#application_id#, Name:type_voting, Index: #voting.type#)\n}.Custom(_name){\n LinkPage(Body: #voting.name#, Page: @1voting_template_view, PageParams: \"TemplateId=#id#\")\n}.Count(count)\n\nIf(Or(#count#>0,#ecosystem_id#>1)){\n AddToolButton(Title: $@1create$, Page: @1voting_template_create, Icon: icon-plus).Popup(50, $@1voting_template_create$)\n}\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1template$=_name,$@1participants$=_participants,$@1decision$=_decision,$@1voting_type$=_type\")\n }.ElseIf(#ecosystem_id#==1){\n Form(Class: text-center h6){\n Data(autofill, \"value,description\"){\n yes,$@1use_default_voting_templates$\n no,$@1select_default_templates_manually$\n }\n RadioGroup(Name: SetDefault, Source: autofill, NameColumn: description, ValueColumn: value).Style(line-height: 20px;)\n Button(Body: $@1install_default_templates$, Class: btn btn-primary, Page: @1voting_templates_list, Contract: @1VotingTemplatesInstall)\n }\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1voting_templates_not_found$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, @1voting_templates_list).(this_table, @1voting_templates)\nInclude(@1pager_header)\n\nSetTitle(\"$@1voting_templates$\")\nSpan(Class: h5 m0 mb ml-lg){\n LinkPage(Class: ml-sm, Body: $@1votings$, Page: @1voting_list)\n Span(Class: text-muted mh, Body: /)\n Span(Class: text-muted, Body: $@1voting_templates$)\n}.Style(\n display: inline-block;\n)\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"voting->type\": {\"$in\": [1, 2]}, \"voting->name\": {\"$ilike\": \"#search#\"}})\n}.Else{\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"voting->type\": {\"$in\": [1, 2]}})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1template))\n Include(@1search)\n}\n\nDBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\n\nSetVar(all_templates_count, 0)\nDBFind(#this_table#).Where({\"ecosystem\": \"#ecosystem_id#\"}).Count(all_templates_count)\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"voting->name,voting->type_participants,voting->type_decision,voting->type\").Custom(_participants){\n P(Class: m0 h6, Body: AppParam(Ecosystem:1, App:#application_id#, Name:type_voting_participants, Index: #voting.type_participants#))\n}.Custom(_decision){\n P(Class: m0 h6, Body: AppParam(Ecosystem:1, App:#application_id#, Name:type_voting_decisions, Index: #voting.type_decision#))\n}.Custom(_type){\n AppParam(Ecosystem:1, App:#application_id#, Name:type_voting, Index: #voting.type#)\n}.Custom(_name){\n LinkPage(Body: #voting.name#, Page: @1voting_template_view, PageParams: \"TemplateId=#id#\")\n}.Count(count)\n\nIf(Or(#count#>0,#ecosystem_id#>1)){\n AddToolButton(Title: $@1create$, Page: @1voting_template_create, Icon: icon-plus).Popup(50, $@1voting_template_create$)\n}\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1template$=_name,$@1participants$=_participants,$@1decision$=_decision,$@1voting_type$=_type\")\n }.ElseIf(And(#ecosystem_id# == 1, #all_templates_count# == 0)){\n Form(Class: text-center h6){\n Data(autofill, \"value,description\"){\n yes,$@1use_default_voting_templates$\n no,$@1select_default_templates_manually$\n }\n RadioGroup(Name: SetDefault, Source: autofill, NameColumn: description, ValueColumn: value).Style(line-height: 20px;)\n Button(Body: $@1install_default_templates$, Class: btn btn-primary, Page: @1voting_templates_list, Contract: @1VotingTemplatesInstall)\n }\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1voting_templates_not_found$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "voting_view", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1applications).Columns(\"name,id\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Vars(application)\nIf(#notific_id#>0){\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"id\": #notific_id#}).Columns(\"page_params->voting_id\").Vars(notific)\n SetVar(vID,#notific_page_params_voting_id#)\n}\n\nSetVar(INVALID,1).(WAITING,2).(STARTED,3).(FINISHED,4)\nSetVar(date_format,\"DD.MM.YYYY HH:MI\")\nSetVar(this_page,\"@1voting_view\")\n\nDiv(content-wrapper){\n If(#vID# > 0){\n DBFind(@1votings).WhereId(#vID#).Columns(\"id,voting->rating,voting->name,voting->volume,voting->quorum,voting->type_participants,voting->type,voting->count_type_voters,voting->type_decision,voting->description,optional->role_id,optional->role_vacancies,optional->number_candidates,optional->contract_accept,optional->contract_reject,optional->contract_accept_params,optional->contract_reject_params,progress->number_participants,progress->number_voters,progress->percent_success,progress->percent_voters,flags->success,flags->full_data,flags->decision,flags->notifics,date_started,date_ended,status,creator->member_id\").Vars(instance)\n SetVar(type_decision,#instance_voting_type_decision#)\n SetVar(type_participants,#instance_voting_type_participants#)\n\n SetVar(isVotingAllowed,0)\n SetVar(isStartProcessing,0)\n If(Or(#type_participants#==1,#type_participants#==2,#type_participants#==3,#type_participants#==4,#type_participants#==6)){\n DBFind(@1votings_participants).Where({\"voting_id\": #vID#, \"member->member_id\": #key_id#, \"decision\": 0, \"ecosystem\": #ecosystem_id#}).Columns(\"id\").Vars(flag_participant)\n If(And(#instance_status#==#STARTED#,#flag_participant_id#>0)){\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"recipient->member_id\": #key_id#, \"page_name\": #this_page#, \"page_params->voting_id\": #vID#, \"closed\": 0}).Columns(\"id,notification->type,date_start_processing\").Vars(notificcc)\n If(#notificcc_id#>0){\n SetVar(isVotingAllowed,1)\n SetVar(notific_id,#notificcc_id#)\n If(And(#notificcc_notification_type#==2,#notificcc_date_start_processing#==0)){\n SetVar(isStartProcessing,1)\n }\n }.Else{\n DBFind(@1votings_participants).Where({\"ecosystem\": #ecosystem_id#, \"member->member_id\": #key_id#, \"voting_id\": #vID#}).Columns(\"id,decision_date\").Vars(md)\n If(And(#md_id#>0, #md_decision_date#==0)){\n SetVar(isVotingAllowed,1)\n }\n }\n }\n }\n If(#type_participants#==5){\n DBFind(@1votings_participants).Where({\"voting_id\": #vID#, \"member->role_id\": #role_id#, \"decision\": 0, \"ecosystem\": #ecosystem_id#}).Columns(\"id\").Vars(flag_participant)\n If(And(#instance_status#==#STARTED#,#flag_participant_id#>0)){\n DBFind(@1notifications).Where({{\"$or\":[{\"date_start_processing\": 0}, {\"processing_info->member_id\": #key_id#}]}, \"ecosystem\": #ecosystem_id#, \"recipient->role_id\": #role_id#, \"page_name\": #this_page#, \"page_params->voting_id\": #vID#, \"closed\": 0}).Columns(\"id,notification->type,date_start_processing\").Vars(notificcc)\n If(#notificcc_id#>0){\n SetVar(isVotingAllowed,1)\n SetVar(notific_id,#notificcc_id#)\n If(And(#notificcc_notification_type#==2,#notificcc_date_start_processing#==0)){\n SetVar(isStartProcessing,1)\n }\n }\n }\n }\n\n Div(row mt-sm){\n Div(col-lg-10 col-lg-offset-1){\n Form(panel panel-primary){\n Input(Type: hidden, Name: VotingId, Value: #vID#)\n\n Div(list-group-item text-center){\n P(Class: h3 text-bold m0, Body: #instance_voting_name# (#instance_id#))\n Div(row mt-sm){\n Div(col-md-12){\n Div(Class: t5 text-muted m0, Body: AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_decisions, Index: #type_decision#))\n }\n }\n If(#instance_voting_description# != \"\"){\n Div(row){\n Div(col-md-6 text-right){\n Div(Class: t5 text-muted m0, Body: LangRes(@1description))\n }\n Div(col-md-6 text-left break){\n Div(Class: t5 text-muted m0, Body: #instance_voting_description#)\n }\n }\n }\n }\n Div(list-group-item text-center){\n P(Class: h5 text-bold m0 mb, Body: $@1voting_subject$)\n If(Or(#type_decision#==1,#type_decision#==2)){\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1role)\n }\n Div(col-md-6 text-left){\n If(#instance_optional_role_id# > 0){\n DBFind(@1roles).Where({\"ecosystem\": #ecosystem_id#, \"id\": #instance_optional_role_id#}).Columns(\"id,role_name\").Vars(prefix)\n #prefix_role_name# (LangRes(@1id): #prefix_id#)\n }.Else{\n Span(Class:text-danger, Body: LangRes(@1not_filled))\n }\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1vacancies)\n }\n Div(col-md-6 text-left){\n If(#instance_optional_role_vacancies# > 0){\n #instance_optional_role_vacancies#\n }.Else{\n Span(Class: text-danger, Body: LangRes(@1not_filled))\n }\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1candidates)\n }\n Div(col-md-6 text-left){\n If(#instance_optional_number_candidates# > 0){\n #instance_optional_number_candidates#\n }.Else{\n Span(Class:text-danger, Body: LangRes(@1not_filled))\n }\n }\n }\n DBFind(@1votings_subject, src_voting_subject).Where({\"voting_id\": #vID#}).Order(\"id\").Columns(\"id,subject->member_id,subject->member_name\").Custom(_address){\n Address(#subject.member_id#)\n }.Custom(_member){\n LinkPage(Class: text-primary t6 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#subject.member_id#\"){\n #subject.member_name#\n }\n }.Custom(_voting){\n If(#isStartProcessing#==1){\n Button(Body: LangRes(@1process), Class: btn btn-info text-capitalize, Contract: @1NotificationsProcess, Params: \"NotificId=#notific_id#\", Page: #this_page#, PageParams: \"notific_id=#notific_id#\")\n }.Else{\n If(#isVotingAllowed#==1){\n Button(Body: LangRes(@1vote), Class: btn btn-success, Page: #this_page#, PageParams: \"vID=#vID#\", Contract: @1VotingCandidateAccept, Params: \"CandidateId=#subject.member_id#,RoleId=#role_id#\")\n }\n }\n }\n Div(row t6){\n Div(col-sm-8 col-sm-offset-2 col-lg-8 col-lg-offset-2){\n Table(src_voting_subject, \"=_member,=_address,=_voting\")\n }\n }\n Div(row mt-sm t6){\n Div(col-md-12){\n If(And(Or(#instance_status#==#INVALID#,#instance_status#==#WAITING#),#instance_voting_type#==1)){\n If(#type_decision#==1){\n If(#instance_creator_member_id#==#key_id#){\n Button(Class: btn btn-link, Page: @1voting_decision_candidates, PageParams: \"vID=#vID#\"){\n Strong(LangRes(@1subject_voting_edit))\n }.Popup(60, $@1subject_voting$)\n }.Else{\n DBFind(@1votings_subject).Where({\"voting_id\": #vID#, \"subject->member_id\": #key_id#}).Columns(\"id\").Vars(already_candidate)\n If(#already_candidate_id#>0){\n SetVar(hidden,hidden)\n }.Else{\n SetVar(hidden,)\n }\n Div(#hidden#){\n Button(Body: $@1can_apply_voting$, Class: btn btn-link, Page: #this_page#, PageParams: \"vID=#vID#\", Contract: @1VotingSubjectCandidates, Params: \"VotingId=#vID#,MemberId=#key_id#\")\n }\n }\n }\n If(#instance_creator_member_id#==#key_id#){\n If(#type_decision#==2){\n Button(Class: btn btn-link, Page: @1voting_decision_election, PageParams: \"vID=#vID#\"){\n Strong(LangRes(@1subject_voting_edit))\n }.Popup(60, $@1subject_voting$)\n }\n }\n }\n }\n }\n }\n If(#type_decision#==3){\n DBFind(@1votings_subject, src_voting_subject).Where({\"voting_id\": #vID#}).Columns(\"id,subject->text,subject->hash,results->percent_accepted\").Vars(subject)\n Div(row t6 mt-lg){\n Div(col-sm-8 col-sm-offset-2 col-lg-8 col-lg-offset-2){\n Div(list-group-item){\n If(#subject_id# > 0){\n #subject_subject_text#\n }.Else{\n Span(Class:text-danger, Body: LangRes(@1not_filled))\n }\n }\n Div(list-group-item t6 text-muted){\n If(#subject_id# > 0){\n Hash: #subject_subject_hash#\n }.Else{\n Hash: LangRes(@1empty)\n }\n }\n }\n }\n Div(row mt-sm t6){\n Div(col-md-12){\n If(And(Or(#instance_status#==#INVALID#,#instance_status#==#WAITING#),#instance_voting_type#==1)){\n If(#instance_creator_member_id#==#key_id#){\n Button(Class: btn btn-link, Page: @1voting_decision_document, PageParams: \"vID=#vID#\"){\n Strong(LangRes(@1subject_voting_edit))\n }.Popup(60, $@1subject_voting$)\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-8 col-sm-offset-2 col-lg-8 col-lg-offset-2){\n If(#isStartProcessing#==1){\n Button(Body: LangRes(@1process), Class: btn btn-info text-capitalize, Contract: @1NotificationsProcess, Params: \"NotificId=#notific_id#\", Page: #this_page#, PageParams: \"notific_id=#notific_id#\")\n }.Else{\n If(#isVotingAllowed#==1){\n Button(Body: LangRes(@1reject), Class: btn btn-danger pull-left, Contract: @1VotingDecisionReject, PageParams: \"vID=#vID#\", Page: #this_page#, Params: \"RoleId=#role_id#\")\n Button(Body: LangRes(@1accept), Class: btn btn-success pull-right, Contract: @1VotingDecisionAccept, PageParams: \"vID=#vID#\", Page: #this_page#, Params: \"RoleId=#role_id#\")\n }\n }\n }\n }\n }\n If(#type_decision#==4){\n DBFind(@1votings_subject, src_voting_subject).Where({\"voting_id\": #vID#}).Columns(\"id,subject->contract_accept,subject->contract_accept_params,subject->contract_reject,subject->contract_reject_params,results->percent_accepted\").Vars(subject)\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1contract_accept)\n }\n Div(col-md-6 text-left){\n If(#subject_subject_contract_accept#){\n #subject_subject_contract_accept#\n }.Else{\n Span(Class:text-danger, Body: LangRes(@1not_filled))\n }\n }\n }\n If(#subject_subject_contract_accept#){\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1arguments)\n }\n Div(col-md-6 text-left arguments){\n If(Or(#subject_subject_contract_accept_params#==\"\",#subject_subject_contract_accept_params#=={})){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #subject_subject_contract_accept_params#\n }\n }\n }\n }\n Div(row t6 mt-sm){\n Div(col-md-6 text-right){\n LangRes(@1contract_reject)\n }\n Div(col-md-6 text-left){\n If(#subject_subject_contract_reject#){\n #subject_subject_contract_reject#\n }.Else{\n Span(Class: text-muted, Body: LangRes(@1no))\n }\n }\n }\n If(#subject_subject_contract_reject#){\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1arguments)\n }\n Div(col-md-6 text-left arguments){\n If(Or(#subject_subject_contract_reject_params#==\"\",#subject_subject_contract_reject_params#=={})){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #subject_subject_contract_reject_params#\n }\n }\n }\n }\n Div(row mt-sm t6){\n Div(col-md-12){\n If(And(Or(#instance_status#==#INVALID#,#instance_status#==#WAITING#),#instance_voting_type#==1)){\n If(#instance_creator_member_id#==#key_id#){\n Button(Class: btn btn-link, Page: @1voting_decision_contract, PageParams: \"vID=#vID#\"){\n Strong(LangRes(@1subject_voting_edit))\n }.Popup(60, $@1subject_voting$)\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 col-sm-offset-4 col-lg-4 col-lg-offset-4){\n If(#isStartProcessing#==1){\n Button(Body: LangRes(@1process), Class: btn btn-info text-capitalize, Contract: @1NotificationsProcess, Params: \"NotificId=#notific_id#\", Page: #this_page#, PageParams: \"notific_id=#notific_id#\")\n }.Else{\n If(#isVotingAllowed#==1){\n Button(Body: LangRes(@1reject), Class: btn btn-danger pull-left, Contract: @1VotingDecisionReject, PageParams: \"vID=#vID#\", Page: #this_page#, Params: \"RoleId=#role_id#\")\n Button(Body: LangRes(@1accept), Class: btn btn-success pull-right, Contract: @1VotingDecisionAccept, PageParams: \"vID=#vID#\", Page: #this_page#, Params: \"RoleId=#role_id#\")\n }\n }\n }\n }\n }\n }\n Div(list-group-item text-center t6){\n P(Class: h5 text-bold m0 mb, Body: $@1voting$)\n Div(row){\n Div(col-md-6 text-right){\n LangRes(@1type)\n }\n Div(col-md-6 text-left){\n AppParam(Ecosystem:1, App:#application_id#, Name: type_voting, Index: #instance_voting_type#)\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n LangRes(@1status)\n }\n Div(col-md-6 text-left){\n SetVar(status_class, AppParam(Ecosystem:1, App:#application_id#, Name:voting_statuses_classes, Index:#instance_status#))\n Div(#status_class#){\n If(And(#instance_status# == #INVALID#, Or(#instance_flags_full_data# == 0, #instance_progress_number_participants# == 0))){\n LangRes(@1not_filled)\n }.Else{\n AppParam(Ecosystem: 1, App: #application_id#, Name: voting_statuses, Index: #instance_status#)\n }\n If(#instance_flags_full_data#==0){\n Div(Class: text-muted){(LangRes(@1voting_subject_not_filled))}\n }\n If(#instance_progress_number_participants#==0){\n Div(Class: text-muted){(LangRes(@1voting_no_participants))}\n }\n }\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n LangRes(@1vote_count_type)\n }\n Div(col-md-6 text-left){\n If(#instance_voting_count_type_voters#==1){\n $@1number_votes$\n }.Else{\n $@1percent_votes$\n }\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n LangRes(@1voting_rating)\n }\n Div(col-md-6 text-left){\n If(#instance_voting_rating#==1){\n $@1yes$ Span(Class:text-muted, Body: ($@1voting_rating_desc$))\n }.Else{\n $@1no$ Span(Class:text-muted, Body: ($@1voting_rating_not_used$))\n }\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n LangRes(@1filled)\n }\n Div(col-md-6 text-left){\n If(#instance_flags_full_data# == 1){\n Span(Class: text-success, Body: LangRes(@1yes))\n }.Else{\n Span(Class: text-danger, Body: LangRes(@1no))\n }\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n LangRes(@1decision)\n }\n Div(col-md-6 text-left){\n If(#instance_flags_decision#==-2){\n LangRes(@1not_enough_votes)\n }\n If(#instance_flags_decision#==-1){\n Span(Class:text-danger, Body: LangRes(@1rejected))\n }\n If(#instance_flags_decision#==0){\n LangRes(@1no)\n }\n If(#instance_flags_decision#==1){\n Span(Class:text-success, Body: LangRes(@1accepted))\n }\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n LangRes(@1date_start)\n }\n SetVar(date_started_class,)\n If(Or(#instance_status#==#STARTED#,#instance_status#==#FINISHED#)){\n SetVar(date_started_class,\"text-muted\")\n }\n Div(col-md-6 text-left #date_started_class#){\n DateTime(DateTime: #instance_date_started#, Format: #date_format#)\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n LangRes(@1date_end)\n }\n SetVar(date_started_class,)\n If(#instance_status#==#FINISHED#){\n SetVar(date_ended_class,\"text-muted\")\n }\n Div(col-md-6 text-left #date_ended_class#){\n DateTime(DateTime: #instance_date_ended#, Format: #date_format#)\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n LangRes(@1voting_quorum)\n }\n Div(col-md-6 text-left){\n If(#instance_voting_count_type_voters#==1){\n #instance_voting_quorum#\n }.Else{\n #instance_voting_quorum#%\n }\n }\n }\n If(And(#instance_voting_count_type_voters#!=1,#type_decision#!=1,#type_decision#!=2)){\n Div(row){\n Div(col-md-6 text-right){\n LangRes(@1voting_volume)\n }\n Div(col-md-6 text-left){\n #instance_voting_volume#%\n }\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n LangRes(@1participants)\n }\n Div(col-md-6 text-left){\n If(#instance_progress_number_participants# > 0){\n #instance_progress_number_participants#\n }.Else{\n Span(Class:text-danger, Body: #instance_progress_number_participants#)\n }\n If(#instance_voting_type#==1){\n If(Or(#instance_status#==#INVALID#,#instance_status#==#WAITING#)){\n If(#instance_creator_member_id#==#key_id#){\n Button(Class: btn-xs btn-link text-bold ml, Page: @1voting_invite, PageParams: \"vID=#vID#\"){\n LangRes(@1participants_add)\n }.Popup(60, $@1participants_add$)\n }\n }\n }\n }.Style(margin-top: -3px;)\n }\n }\n If(Or(#instance_optional_contract_accept#!=\"\",#instance_optional_contract_reject#!=\"\")){\n Div(list-group-item text-center){\n P(Class: h5 m0 mb){\n Span(Class: text-bold, Body: $@1params$)\n Span(Class: text-normal text-muted ml, Body: $@1optional$)\n }\n Div(row mt t6){\n Div(col-md-6 text-right){\n LangRes(@1contract_accept)\n Span(Class: text-muted ml, Body: LangRes(@1optional))\n }\n Div(col-md-6 text-left){\n If(#instance_optional_contract_accept# == \"\"){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #instance_optional_contract_accept#\n }\n }\n }\n If(#instance_optional_contract_accept#){\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1arguments)\n Span(Class: text-muted ml, Body: LangRes(@1optional))\n }\n Div(col-md-6 text-left arguments){\n If(Or(#instance_optional_contract_accept_params#==\"\",#instance_optional_contract_accept_params#=={})){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #instance_optional_contract_accept_params#\n }\n }\n }\n }\n Div(row mt-sm t6){\n Div(col-md-6 text-right){\n LangRes(@1contract_reject)\n Span(Class: text-muted ml, Body: LangRes(@1optional))\n }\n Div(col-md-6 text-left){\n If(#instance_optional_contract_reject# == \"\"){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #instance_optional_contract_reject#\n }\n }\n }\n If(#instance_optional_contract_reject#){\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1arguments)\n Span(Class: text-muted ml, Body: LangRes(@1optional))\n }\n Div(col-md-6 text-left arguments){\n If(Or(#instance_optional_contract_reject_params#==\"\",#instance_optional_contract_reject_params#=={})){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #instance_optional_contract_reject_params#\n }\n }\n }\n }\n }\n }\n Div(list-group-item){\n Include(@1voting_charts)\n }\n }\n }\n }\n }.Else{\n Div(md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n }\n}.Style(\n .t3 {font-size:24px;}\n .t4 {font-size:18px;}\n .t5 {font-size:14px;}\n .t6 {font-size:12px;}\n .break {word-break: break-all;}\n .arguments {word-wrap: break-word;}\n)", + "Value": "DBFind(\"@1applications\").Columns(\"name,id\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Vars(application)\nIf(#notific_id#>0){\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#notific_id#\"}).Columns(\"page_params->voting_id\").Vars(notific)\n SetVar(vID,#notific_page_params_voting_id#)\n}\n\nSetVar(INVALID,1).(WAITING,2).(STARTED,3).(FINISHED,4)\nSetVar(date_format,\"DD.MM.YYYY HH:MI\")\nSetVar(this_page,\"@1voting_view\")\n\nDiv(content-wrapper){\n If(#vID# > 0){\n DBFind(\"@1votings\").WhereId(#vID#).Columns(\"id,voting->rating,voting->name,voting->volume,voting->quorum,voting->type_participants,voting->type,voting->count_type_voters,voting->type_decision,voting->description,optional->role_id,optional->role_vacancies,optional->number_candidates,optional->contract_accept,optional->contract_reject,optional->contract_accept_params,optional->contract_reject_params,progress->number_participants,progress->number_voters,progress->percent_success,progress->percent_voters,flags->success,flags->full_data,flags->decision,flags->notifics,date_started,date_ended,status,creator->account\").Vars(instance)\n SetVar(type_decision,#instance_voting_type_decision#)\n SetVar(type_participants,#instance_voting_type_participants#)\n\n SetVar(isVotingAllowed,0)\n SetVar(isStartProcessing,0)\n If(Or(#type_participants#==1,#type_participants#==2,#type_participants#==3,#type_participants#==4,#type_participants#==6)){\n DBFind(\"@1votings_participants\").Where({\"voting_id\": \"#vID#\", \"member->account\": \"#account_id#\", \"decision\": 0, \"ecosystem\": \"#ecosystem_id#\"}).Columns(\"id\").Vars(flag_participant)\n If(And(#instance_status#==#STARTED#,#flag_participant_id#>0)){\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"recipient->account\": \"#account_id#\", \"page_name\": \"#this_page#\", \"page_params->voting_id\": \"#vID#\", \"closed\": 0}).Columns(\"id,notification->type,date_start_processing\").Vars(notificcc)\n If(#notificcc_id#>0){\n SetVar(isVotingAllowed,1)\n SetVar(notific_id,#notificcc_id#)\n If(And(#notificcc_notification_type#==2,#notificcc_date_start_processing#==0)){\n SetVar(isStartProcessing,1)\n }\n }.Else{\n DBFind(\"@1votings_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"member->account\": \"#account_id#\", \"voting_id\": \"#vID#\"}).Columns(\"id,decision_date\").Vars(md)\n If(And(#md_id#>0, #md_decision_date#==0)){\n SetVar(isVotingAllowed,1)\n }\n }\n }\n }\n If(#type_participants#==5){\n DBFind(\"@1votings_participants\").Where({\"voting_id\": \"#vID#\", \"member->role_id\": \"#role_id#\", \"decision\": 0, \"ecosystem\": \"#ecosystem_id#\"}).Columns(\"id\").Vars(flag_participant)\n If(And(#instance_status#==#STARTED#,#flag_participant_id#>0)){\n DBFind(\"@1notifications\").Where({\"$or\": [{\"date_start_processing\": 0}, {\"processing_info->account\": \"#account_id#\"}], \"ecosystem\": \"#ecosystem_id#\", \"recipient->role_id\": \"#role_id#\", \"page_name\": \"#this_page#\", \"page_params->voting_id\": \"#vID#\", \"closed\": 0}).Columns(\"id,notification->type,date_start_processing\").Vars(notificcc)\n If(#notificcc_id#>0){\n SetVar(isVotingAllowed,1)\n SetVar(notific_id,#notificcc_id#)\n If(And(#notificcc_notification_type#==2,#notificcc_date_start_processing#==0)){\n SetVar(isStartProcessing,1)\n }\n }\n }\n }\n\n Div(row mt-sm){\n Div(col-lg-10 col-lg-offset-1){\n Form(panel panel-primary){\n Input(Type: hidden, Name: VotingId, Value: #vID#)\n\n Div(list-group-item text-center){\n P(Class: h3 text-bold m0, Body: #instance_voting_name# (#instance_id#))\n Div(row mt-sm){\n Div(col-md-12){\n Div(Class: t5 text-muted m0, Body: AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_decisions, Index: #type_decision#))\n }\n }\n If(#instance_voting_description# != \"\"){\n Div(row){\n Div(col-md-6 text-right){\n Div(Class: t5 text-muted m0, Body: LangRes(@1description))\n }\n Div(col-md-6 text-left break){\n Div(Class: t5 text-muted m0, Body: #instance_voting_description#)\n }\n }\n }\n }\n Div(list-group-item text-center){\n P(Class: h5 text-bold m0 mb, Body: $@1voting_subject$)\n If(Or(#type_decision#==1,#type_decision#==2)){\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1role)\n }\n Div(col-md-6 text-left){\n If(#instance_optional_role_id# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#instance_optional_role_id#\"}).Columns(\"id,role_name\").Vars(prefix)\n #prefix_role_name# (LangRes(@1id): #prefix_id#)\n }.Else{\n Span(Class:text-danger, Body: LangRes(@1not_filled))\n }\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1vacancies)\n }\n Div(col-md-6 text-left){\n If(#instance_optional_role_vacancies# > 0){\n #instance_optional_role_vacancies#\n }.Else{\n Span(Class: text-danger, Body: LangRes(@1not_filled))\n }\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1candidates)\n }\n Div(col-md-6 text-left){\n If(#instance_optional_number_candidates# > 0){\n #instance_optional_number_candidates#\n }.Else{\n Span(Class:text-danger, Body: LangRes(@1not_filled))\n }\n }\n }\n DBFind(\"@1votings_subject\", src_voting_subject).Where({\"voting_id\": \"#vID#\"}).Order(\"id\").Columns(\"id,subject->account,subject->member_name\").Custom(_address){\n #subject.account#\n }.Custom(_member){\n LinkPage(Class: text-primary t6 text-bold, Page: @1profile_view, PageParams: \"v_account=#subject.account#\"){\n #subject.member_name#\n }\n }.Custom(_voting){\n If(#isStartProcessing#==1){\n Button(Body: LangRes(@1process), Class: btn btn-info text-capitalize, Contract: @1NotificationsProcess, Params: \"NotificId=#notific_id#\", Page: #this_page#, PageParams: \"notific_id=#notific_id#\")\n }.Else{\n If(#isVotingAllowed#==1){\n Button(Body: LangRes(@1vote), Class: btn btn-success, Page: #this_page#, PageParams: \"vID=#vID#\", Contract: @1VotingCandidateAccept, Params: \"CandidateAccount=#subject.account#,RoleId=#role_id#\")\n }\n }\n }\n Div(row t6){\n Div(col-sm-8 col-sm-offset-2 col-lg-8 col-lg-offset-2){\n Table(src_voting_subject, \"=_member,=_address,=_voting\")\n }\n }\n Div(row mt-sm t6){\n Div(col-md-12){\n If(And(Or(#instance_status#==#INVALID#,#instance_status#==#WAITING#),#instance_voting_type#==1)){\n If(#type_decision#==1){\n If(#instance_creator_account#==#account_id#){\n Button(Class: btn btn-link, Page: @1voting_decision_candidates, PageParams: \"vID=#vID#\"){\n Strong(LangRes(@1subject_voting_edit))\n }.Popup(60, $@1subject_voting$)\n }.Else{\n DBFind(\"@1votings_subject\").Where({\"voting_id\": \"#vID#\", \"subject->account\": \"#account_id#\"}).Columns(\"id\").Vars(already_candidate)\n If(#already_candidate_id#>0){\n SetVar(hidden,hidden)\n }.Else{\n SetVar(hidden,)\n }\n Div(#hidden#){\n Button(Body: $@1can_apply_voting$, Class: btn btn-link, Page: #this_page#, PageParams: \"vID=#vID#\", Contract: @1VotingSubjectCandidates, Params: \"VotingId=#vID#,MemberAccount=#account_id#\")\n }\n }\n }\n If(#instance_creator_account#==#account_id#){\n If(#type_decision#==2){\n Button(Class: btn btn-link, Page: @1voting_decision_election, PageParams: \"vID=#vID#\"){\n Strong(LangRes(@1subject_voting_edit))\n }.Popup(60, $@1subject_voting$)\n }\n }\n }\n }\n }\n }\n If(#type_decision#==3){\n DBFind(\"@1votings_subject\", src_voting_subject).Where({\"voting_id\": \"#vID#\"}).Columns(\"id,subject->text,subject->hash,results->percent_accepted\").Vars(subject)\n Div(row t6 mt-lg){\n Div(col-sm-8 col-sm-offset-2 col-lg-8 col-lg-offset-2){\n Div(list-group-item){\n If(#subject_id# > 0){\n #subject_subject_text#\n }.Else{\n Span(Class:text-danger, Body: LangRes(@1not_filled))\n }\n }\n Div(list-group-item t6 text-muted){\n If(#subject_id# > 0){\n Hash: #subject_subject_hash#\n }.Else{\n Hash: LangRes(@1empty)\n }\n }\n }\n }\n Div(row mt-sm t6){\n Div(col-md-12){\n If(And(Or(#instance_status#==#INVALID#,#instance_status#==#WAITING#),#instance_voting_type#==1)){\n If(#instance_creator_account#==#account_id#){\n Button(Class: btn btn-link, Page: @1voting_decision_document, PageParams: \"vID=#vID#\"){\n Strong(LangRes(@1subject_voting_edit))\n }.Popup(60, $@1subject_voting$)\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-8 col-sm-offset-2 col-lg-8 col-lg-offset-2){\n If(#isStartProcessing#==1){\n Button(Body: LangRes(@1process), Class: btn btn-info text-capitalize, Contract: @1NotificationsProcess, Params: \"NotificId=#notific_id#\", Page: #this_page#, PageParams: \"notific_id=#notific_id#\")\n }.Else{\n If(#isVotingAllowed#==1){\n Button(Body: LangRes(@1reject), Class: btn btn-danger pull-left, Contract: @1VotingDecisionReject, PageParams: \"vID=#vID#\", Page: #this_page#, Params: \"RoleId=#role_id#\")\n Button(Body: LangRes(@1accept), Class: btn btn-success pull-right, Contract: @1VotingDecisionAccept, PageParams: \"vID=#vID#\", Page: #this_page#, Params: \"RoleId=#role_id#\")\n }\n }\n }\n }\n }\n If(#type_decision#==4){\n DBFind(\"@1votings_subject\", src_voting_subject).Where({\"voting_id\": \"#vID#\"}).Columns(\"id,subject->contract_accept,subject->contract_accept_params,subject->contract_reject,subject->contract_reject_params,results->percent_accepted\").Vars(subject)\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1contract_accept)\n }\n Div(col-md-6 text-left){\n If(#subject_subject_contract_accept#){\n #subject_subject_contract_accept#\n }.Else{\n Span(Class:text-danger, Body: LangRes(@1not_filled))\n }\n }\n }\n If(#subject_subject_contract_accept#){\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1arguments)\n }\n Div(col-md-6 text-left arguments){\n If(Or(#subject_subject_contract_accept_params#==\"\",#subject_subject_contract_accept_params#=={})){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #subject_subject_contract_accept_params#\n }\n }\n }\n }\n Div(row t6 mt-sm){\n Div(col-md-6 text-right){\n LangRes(@1contract_reject)\n }\n Div(col-md-6 text-left){\n If(#subject_subject_contract_reject#){\n #subject_subject_contract_reject#\n }.Else{\n Span(Class: text-muted, Body: LangRes(@1no))\n }\n }\n }\n If(#subject_subject_contract_reject#){\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1arguments)\n }\n Div(col-md-6 text-left arguments){\n If(Or(#subject_subject_contract_reject_params#==\"\",#subject_subject_contract_reject_params#=={})){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #subject_subject_contract_reject_params#\n }\n }\n }\n }\n Div(row mt-sm t6){\n Div(col-md-12){\n If(And(Or(#instance_status#==#INVALID#,#instance_status#==#WAITING#),#instance_voting_type#==1)){\n If(#instance_creator_account#==#account_id#){\n Button(Class: btn btn-link, Page: @1voting_decision_contract, PageParams: \"vID=#vID#\"){\n Strong(LangRes(@1subject_voting_edit))\n }.Popup(60, $@1subject_voting$)\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 col-sm-offset-4 col-lg-4 col-lg-offset-4){\n If(#isStartProcessing#==1){\n Button(Body: LangRes(@1process), Class: btn btn-info text-capitalize, Contract: @1NotificationsProcess, Params: \"NotificId=#notific_id#\", Page: #this_page#, PageParams: \"notific_id=#notific_id#\")\n }.Else{\n If(#isVotingAllowed#==1){\n Button(Body: LangRes(@1reject), Class: btn btn-danger pull-left, Contract: @1VotingDecisionReject, PageParams: \"vID=#vID#\", Page: #this_page#, Params: \"RoleId=#role_id#\")\n Button(Body: LangRes(@1accept), Class: btn btn-success pull-right, Contract: @1VotingDecisionAccept, PageParams: \"vID=#vID#\", Page: #this_page#, Params: \"RoleId=#role_id#\")\n }\n }\n }\n }\n }\n }\n Div(list-group-item text-center t6){\n P(Class: h5 text-bold m0 mb, Body: $@1voting$)\n Div(row){\n Div(col-md-6 text-right){\n LangRes(@1type)\n }\n Div(col-md-6 text-left){\n AppParam(Ecosystem:1, App:#application_id#, Name: type_voting, Index: #instance_voting_type#)\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n LangRes(@1status)\n }\n Div(col-md-6 text-left){\n SetVar(status_class, AppParam(Ecosystem:1, App:#application_id#, Name:voting_statuses_classes, Index:#instance_status#))\n Div(#status_class#){\n If(And(#instance_status# == #INVALID#, Or(#instance_flags_full_data# == 0, #instance_progress_number_participants# == 0))){\n LangRes(@1not_filled)\n }.Else{\n AppParam(Ecosystem: 1, App: #application_id#, Name: voting_statuses, Index: #instance_status#)\n }\n If(#instance_flags_full_data#==0){\n Div(Class: text-muted){(LangRes(@1voting_subject_not_filled))}\n }\n If(#instance_progress_number_participants#==0){\n Div(Class: text-muted){(LangRes(@1voting_no_participants))}\n }\n }\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n LangRes(@1vote_count_type)\n }\n Div(col-md-6 text-left){\n If(#instance_voting_count_type_voters#==1){\n $@1number_votes$\n }.Else{\n $@1percent_votes$\n }\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n LangRes(@1voting_rating)\n }\n Div(col-md-6 text-left){\n If(#instance_voting_rating#==1){\n $@1yes$ Span(Class:text-muted, Body: ($@1voting_rating_desc$))\n }.Else{\n $@1no$ Span(Class:text-muted, Body: ($@1voting_rating_not_used$))\n }\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n LangRes(@1filled)\n }\n Div(col-md-6 text-left){\n If(#instance_flags_full_data# == 1){\n Span(Class: text-success, Body: LangRes(@1yes))\n }.Else{\n Span(Class: text-danger, Body: LangRes(@1no))\n }\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n LangRes(@1decision)\n }\n Div(col-md-6 text-left){\n If(#instance_flags_decision#==-2){\n LangRes(@1not_enough_votes)\n }\n If(#instance_flags_decision#==-1){\n Span(Class:text-danger, Body: LangRes(@1rejected))\n }\n If(#instance_flags_decision#==0){\n LangRes(@1no)\n }\n If(#instance_flags_decision#==1){\n Span(Class:text-success, Body: LangRes(@1accepted))\n }\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n LangRes(@1date_start)\n }\n SetVar(date_started_class,)\n If(Or(#instance_status#==#STARTED#,#instance_status#==#FINISHED#)){\n SetVar(date_started_class,\"text-muted\")\n }\n Div(col-md-6 text-left #date_started_class#){\n DateTime(DateTime: #instance_date_started#, Format: #date_format#)\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n LangRes(@1date_end)\n }\n SetVar(date_started_class,)\n If(#instance_status#==#FINISHED#){\n SetVar(date_ended_class,\"text-muted\")\n }\n Div(col-md-6 text-left #date_ended_class#){\n DateTime(DateTime: #instance_date_ended#, Format: #date_format#)\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n LangRes(@1voting_quorum)\n }\n Div(col-md-6 text-left){\n If(#instance_voting_count_type_voters#==1){\n #instance_voting_quorum#\n }.Else{\n #instance_voting_quorum#%\n }\n }\n }\n If(And(#instance_voting_count_type_voters#!=1,#type_decision#!=1,#type_decision#!=2)){\n Div(row){\n Div(col-md-6 text-right){\n LangRes(@1voting_volume)\n }\n Div(col-md-6 text-left){\n #instance_voting_volume#%\n }\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n LangRes(@1participants)\n }\n Div(col-md-6 text-left){\n If(#instance_progress_number_participants# > 0){\n #instance_progress_number_participants#\n }.Else{\n Span(Class:text-danger, Body: #instance_progress_number_participants#)\n }\n If(#instance_voting_type#==1){\n If(Or(#instance_status#==#INVALID#,#instance_status#==#WAITING#)){\n If(#instance_creator_account#==#account_id#){\n Button(Class: btn-xs btn-link text-bold ml, Page: @1voting_invite, PageParams: \"vID=#vID#\"){\n LangRes(@1participants_add)\n }.Popup(60, $@1participants_add$)\n }\n }\n }\n }.Style(margin-top: -3px;)\n }\n }\n If(Or(#instance_optional_contract_accept#!=\"\",#instance_optional_contract_reject#!=\"\")){\n Div(list-group-item text-center){\n P(Class: h5 m0 mb){\n Span(Class: text-bold, Body: $@1params$)\n Span(Class: text-normal text-muted ml, Body: $@1optional$)\n }\n Div(row mt t6){\n Div(col-md-6 text-right){\n LangRes(@1contract_accept)\n Span(Class: text-muted ml, Body: LangRes(@1optional))\n }\n Div(col-md-6 text-left){\n If(#instance_optional_contract_accept# == \"\"){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #instance_optional_contract_accept#\n }\n }\n }\n If(#instance_optional_contract_accept#){\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1arguments)\n Span(Class: text-muted ml, Body: LangRes(@1optional))\n }\n Div(col-md-6 text-left arguments){\n If(Or(#instance_optional_contract_accept_params#==\"\",#instance_optional_contract_accept_params#=={})){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #instance_optional_contract_accept_params#\n }\n }\n }\n }\n Div(row mt-sm t6){\n Div(col-md-6 text-right){\n LangRes(@1contract_reject)\n Span(Class: text-muted ml, Body: LangRes(@1optional))\n }\n Div(col-md-6 text-left){\n If(#instance_optional_contract_reject# == \"\"){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #instance_optional_contract_reject#\n }\n }\n }\n If(#instance_optional_contract_reject#){\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1arguments)\n Span(Class: text-muted ml, Body: LangRes(@1optional))\n }\n Div(col-md-6 text-left arguments){\n If(Or(#instance_optional_contract_reject_params#==\"\",#instance_optional_contract_reject_params#=={})){\n Span(Class: text-muted, Body: LangRes(@1no))\n }.Else{\n #instance_optional_contract_reject_params#\n }\n }\n }\n }\n }\n }\n Div(list-group-item){\n Include(@1voting_charts)\n }\n }\n }\n }\n }.Else{\n Div(md-12 alert alert-danger text-center){\n Span(Body: LangRes(@1attention))\n }\n }\n}.Style(\n .t3 {font-size:24px;}\n .t4 {font-size:18px;}\n .t5 {font-size:14px;}\n .t6 {font-size:12px;}\n .break {word-break: break-all;}\n .arguments {word-wrap: break-word;}\n)", "Menu": "default_menu", "Type": "pages" }, { "Name": "voting_wizard", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, \"@1voting_wizard\")\nSetVar(back_page, \"@1voting_list\")\nDBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\nDBFind(\"@1buffer_data\").Where({\"key\": \"voting_wizard_buffer\", \"member_id\": #key_id#, \"ecosystem\": #ecosystem_id#}).Columns(\"value->save_time,value->voting_name,value->voting_type,value->type_participants,value->type_decision,value->volume,value->quorum,value->rating,value->count_type_voters,value->description,value->interval,value->start_date,value->start_time,value->end_date,value->end_time,value->member_participants,value->role_participants,value->group_participants,value->execute_contract,value->contract_accept_name,value->contract_accept_params,value->contract_reject_name,value->contract_reject_params,value->text_document,value->candidates,value->apply,value->role_id,value->vacancies\").Vars(buffer)\n\nIf(#stage# == \"\"){\n If(#buffer_value_save_time# == \"\"){\n SetVar(stage, 1)\n }.Else{\n SetVar(stage, 0)\n }\n}\nSetVar(debug, 0)\nSetVar(square, \"fa fa-circle-o mr-sm\")\nSetVar(square-filled, \"fa fa-dot-circle-o mr-sm\")\n\nForm(){\n If(#stage# == 0){\n Div(text-center){\n Div(Body: LangRes(@1voting_wizard_draft_message))\n Div(h6 m0 text-muted){$@1last_save$: DateTime(#buffer_value_save_time#, \"HH:MI DD.MM.YYYY\")}\n Data(src_autosave, \"id,name\"){\n yes,$@1voting_wizard_use_draft$\n no,$@1start_over$\n }\n RadioGroup(Name: LoadAutosave, Source: src_autosave, NameColumn: name, ValueColumn: id)\n }\n Button(Body: LangRes(@1next), Class: btn btn-primary pull-right, Page: #this_page#, PageParams: \"stage=1\", Contract: @1VotingWizardBuffer).Popup(50, $@1voting_wizard$)\n Button(Body: LangRes(@1cancel), Class: btn btn-default pull-right, Page: #back_page#)\n\n }.ElseIf(#stage# == 1){\n Div(row){\n Div(col-md-3 mt-lg text-right){\n Label(){\n LangRes(@1voting_subject)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n AppParam(Ecosystem: 1, App: #application_id#, Name: type_voting_decisions, Source: procent_type_decisions)\n RadioGroup(Name: TypeDecision, Source: procent_type_decisions, NameColumn: name, ValueColumn: id, Value: #buffer_value_type_decision#)\n }\n }\n Button(Class: btn btn-primary pull-right fa fa-chevron-right, Page: #this_page#, PageParams: \"stage=2\", Contract: @1VotingWizardBuffer).Popup(50, $@1voting_wizard$)\n Button(Class: btn btn-default pull-right fa fa-pause, Page: #back_page#)\n Div(progress-wrapper pull-right mr-sm text-muted){Em(Class: #square-filled#)Em(Class: #square#)Em(Class: #square#)Em(Class: #square#)Em(Class: #square#)Em(Class: #square#)Em(Class: #square#)}\n\n\n }.ElseIf(#stage# == 2){\n If(#val_contract_accept_name# != \"\"){\n SetVar(buffer_value_contract_accept_name, #val_contract_accept_name#)\n }\n If(#val_contract_accept_params# != \"\"){\n SetVar(buffer_value_contract_accept_params, #val_contract_accept_params#)\n }\n If(#val_contract_reject_name# != \"\"){\n SetVar(buffer_value_contract_reject_name, #val_contract_reject_name#)\n }\n If(#val_contract_reject_params# != \"\"){\n SetVar(buffer_value_contract_reject_params, #val_contract_reject_params#)\n }\n\n\n If(#buffer_value_type_decision# == 1){\n If(#val_role_id# != \"\"){\n SetVar(buffer_value_role_id, #val_role_id#)\n }\n If(#val_role_vacancies# != \"\"){\n SetVar(buffer_value_vacancies, #val_role_vacancies#)\n }\n If(#val_execute_contract# != \"\"){\n SetVar(buffer_value_execute_contract, #val_execute_contract#)\n }\n If(And(#apply# == \"\", #buffer_value_apply# == 1)){\n SetVar(apply, 1)\n }\n\n DBFind(@1roles,src_roles).Where({\"ecosystem\": #ecosystem_id#, \"role_type\": 2, \"deleted\": 0}).Columns(\"id,role_name\").Count(elective_roles_count)\n If(#elective_roles_count# > 0){\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1candidates))\n Span(Class: text-danger, Body: *)\n }\n }\n Div(col-md-9 text-left){\n Div(input-group){\n If(#apply# == 1){\n Input(Name: applied, Disabled: 1, Value: $@1applied_already$)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter buttons fa fa-undo, Page: #this_page#, PageParams: \"stage=2,apply=0,val_role_id=Val(RoleId),val_role_vacancies=Val(Vacancies),val_execute_contract=Val(ExecuteContract),val_contract_accept_name=Val(ContractAcceptName),val_contract_accept_params=Val(ContractAcceptParams),val_contract_reject_name=Val(ContractRejectName),val_contract_reject_params=Val(ContractRejectParams)\").Popup(50, $@1voting_wizard$)\n }\n }.Else{\n Input(Name: can_apply_voting, Disabled: 1, Value: $@1can_apply_voting$)\n Div(input-group-btn){\n Button(Body: LangRes(@1apply), Class: btn bg-gray-lighter buttons, Page: #this_page#, PageParams: \"stage=2,apply=1,val_role_id=Val(RoleId),val_role_vacancies=Val(Vacancies),val_execute_contract=Val(ExecuteContract),val_contract_accept_name=Val(ContractAcceptName),val_contract_accept_params=Val(ContractAcceptParams),val_contract_reject_name=Val(ContractRejectName),val_contract_reject_params=Val(ContractRejectParams)\").Popup(50, $@1voting_wizard$)\n }\n }\n }\n }\n }\n If(#apply# == 1){\n DBFind(\"@1members\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #key_id#}).Vars(my)\n If(#my_member_name# == \"\"){\n SetVar(my_member_name, Address(#key_id#))\n }\n Data(src_voting_subject,\"id,name\"){\n #key_id#,#my_member_name#\n }.Custom(_address){\n Address(#id#)\n }.Custom(_member){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#id#\"){\n Span(Body: #name#)\n }\n }\n }.Else{\n Data(src_voting_subject,\"id,name\"){}\n }\n If(#apply# == 1){\n Div(row){\n Div(col-sm-9 col-sm-offset-3){\n Table(src_voting_subject, \"$@1candidates$=_member,=_address\").Style(margin-bottom: 5px;)\n }\n }\n }\n Div(form-group){\n Div(row mt-lg){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1role))\n Span(Class: text-danger, Body: *)\n }\n }\n Div(col-md-9 text-left){\n Select(Name: RoleId, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #buffer_value_role_id#)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1vacancies))\n Span(Class: text-danger, Body: *)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Vacancies, Type: Number, Value: #buffer_value_vacancies#)\n }\n }\n }\n }.Else{\n Div(row){\n Div(col-md-12 text-center h4){\n P(Class: m0, Body: LangRes(@1elective_roles_not_found))\n Button(Class: btn btn-link, Page: @1roles_create, PageParams: \"back_page=#back_page#\"){\n Span(Class: h4, Body: LangRes(@1create_role))\n }.Popup(50, $@1edit_role$)\n }\n }\n }\n\n\n }.ElseIf(#buffer_value_type_decision# == 2){\n If(#val_role_id# != \"\"){\n SetVar(buffer_value_role_id, #val_role_id#)\n }\n If(#val_role_vacancies# != \"\"){\n SetVar(buffer_value_vacancies, #val_role_vacancies#)\n }\n If(#val_execute_contract# != \"\"){\n SetVar(buffer_value_execute_contract, #val_execute_contract#)\n }\n If(#new_candidate# == \"\"){\n SetVar(new_candidate, 0)\n }\n If(#candidates# == \"\"){\n If(#buffer_value_candidates# != \"\"){\n SetVar(candidates, #buffer_value_candidates#)\n }.Else{\n SetVar(candidates, 0)\n }\n }\n If(#new_candidate# != 0){\n If(#candidates# == 0){\n SetVar(candidates, \"#new_candidate#\")\n }.Else{\n SetVar(candidates, \"#candidates#,#new_candidate#\")\n }\n }\n\n DBFind(@1keys, src_subject).Where({\"ecosystem\": #ecosystem_id#, \"id\": {\"$in\": [#candidates#]}}).Custom(_address){\n Address(#id#)\n }.Custom(_member){\n DBFind(@1members).WhereId(#id#).Count(have_name).Vars(participant)\n If(#have_name# > 0){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#id#\", Body: #participant_member_name#)\n }.Else{\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#id#\", Body: Address(#id#))\n }\n }\n\n DBFind(@1keys,src_keys).Where({\"ecosystem\": #ecosystem_id#, {\"$and\": [{\"id\": {\"$neq\": #guest_key#}}, {\"id\": {\"$nin\": [#candidates#]}}]}}).Columns(\"id\").Count(members_count).Custom(_name){\n DBFind(@1members).Where({\"ecosystem\": #ecosystem_id#, \"id\": #id#}).Columns(\"id,member_name\").Count(have_name).Vars(m)\n Address(#id#)\n If(#have_name# > 0){\n \" (#m_member_name#)\"\n }\n }\n\n DBFind(@1roles,src_roles).Where({\"ecosystem\": #ecosystem_id#, \"role_type\": 2, \"deleted\": 0}).Columns(\"id,role_name\").Count(elective_roles_count)\n If(#elective_roles_count# > 0){\n Div(form-group){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1candidates)).(Class: text-danger, Body: *)\n }\n }\n Div(col-md-9 mc-sm text-left){\n Div(input-group){\n If(#members_count# > 0){\n Select(Name: MemberId, Source: src_keys, NameColumn: _name, ValueColumn: id)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-plus buttons, Page: #this_page#, PageParams: \"stage=2,new_candidate=Val(MemberId),candidates=#candidates#,val_role_id=Val(RoleId),val_role_vacancies=Val(Vacancies),val_execute_contract=Val(ExecuteContract),val_contract_accept_name=Val(ContractAcceptName),val_contract_accept_params=Val(ContractAcceptParams),val_contract_reject_name=Val(ContractRejectName),val_contract_reject_params=Val(ContractRejectParams)\").Popup(50, $@1voting_wizard$)\n Button(Class: btn bg-gray-lighter fa fa-undo buttons, Page: #this_page#, PageParams: \"stage=2,candidates=0,val_role_id=Val(RoleId),val_role_vacancies=Val(Vacancies),val_execute_contract=Val(ExecuteContract),val_contract_accept_name=Val(ContractAcceptName),val_contract_accept_params=Val(ContractAcceptParams),val_contract_reject_name=Val(ContractRejectName),val_contract_reject_params=Val(ContractRejectParams)\").Popup(50, $@1voting_wizard$)\n }\n }.Else{\n Input(Class: mb, Disabled: 1, Value: \"$@1voting_all_keys_added$\")\n Div(input-group-btn input-group-top){\n Button(Class: btn bg-gray-lighter fa fa-undo buttons, Page: #this_page#, PageParams: \"stage=2,candidates=0,val_role_id=Val(RoleId),val_role_vacancies=Val(Vacancies),val_execute_contract=Val(ExecuteContract),val_contract_accept_name=Val(ContractAcceptName),val_contract_accept_params=Val(ContractAcceptParams),val_contract_reject_name=Val(ContractRejectName),val_contract_reject_params=Val(ContractRejectParams)\").Popup(50, $@1voting_wizard$)\n }\n }\n }\n }\n }\n If(Or(#members_count# > 0, #candidates# != 0)){\n Div(row){\n Div(col-sm-9 col-sm-offset-3){\n Table(src_subject, \"$@1candidates$=_member,=_address\").Style(margin-bottom: 5px;)\n }\n }\n }\n }\n Div(form-group){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1role)).(Class: text-danger, Body: *)\n }\n }\n Div(col-md-9 mb-sm text-left){\n Select(Name: RoleId, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #buffer_value_role_id#)\n }\n }\n\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1vacancies)).(Class: text-danger, Body: *)\n }\n }\n Div(col-md-9 mc-sm text-left){\n Input(Name: Vacancies, Class: form-control, Type: Number, Value: #buffer_value_vacancies#)\n }\n }\n }\n }.Else{\n Div(row){\n Div(col-md-12 text-center h4){\n P(Class: m0, Body: LangRes(@1elective_roles_not_found))\n Button(Class: btn btn-link, Page: @1roles_create, PageParams: \"back_page=#back_page#\"){\n Span(Class: h4, Body: LangRes(@1create_role))\n }.Popup(50, $@1edit_role$)\n }\n }\n }\n\n\n }.ElseIf(#buffer_value_type_decision# == 3){\n Div(form-group){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1text_document))\n Span(Class: text-danger, Body: *)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: TextDocument, Type: textarea, Value: #buffer_value_text_document#).Style(resize: vertical;)\n }\n }\n }\n }\n\n If(Or(And(#buffer_value_type_decision# == 1, #elective_roles_count# > 0), And(#buffer_value_type_decision# == 2, #elective_roles_count# > 0), #buffer_value_type_decision# == 3)){\n Div(form-group){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1contract_execute))\n }\n }\n Div(col-md-9 mc-sm text-left){\n Data(src_execute, \"id,name\"){\n no,$@1no$\n yes,$@1yes$\n }\n Select(Name: ExecuteContract, Source: src_execute, NameColumn: name, ValueColumn: id, Value: #buffer_value_execute_contract#)\n }\n }\n }\n }.ElseIf(#buffer_value_type_decision# == 4){\n Input(Name: ExecuteContract, Type: \"hidden\", Value: \"yes\")\n }\n\n Div(){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1contract_accept))\n If(#buffer_value_type_decision# == 4){\n Span(Class: text-danger, Body: *)\n }\n }\n }\n Div(col-md-9 mb-sm text-left){\n Input(Name: ContractAcceptName, Value: #buffer_value_contract_accept_name#).Validate(minLength:3, maxLength:255)\n InputErr(Name: ContractAcceptName, minLength: $@1validate_name$, maxLength: $@1validate_name$)\n Div(Class: m0 h6 text-muted, Body: \"$@1contract_accept_des$\")\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 mb-sm text-left){\n Input(Name: ContractAcceptParams, Value: #buffer_value_contract_accept_params#)\n Div(Class: m0 h6 text-muted, Body: \"$@1contract_params_des$\")\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1contract_reject))\n If(#buffer_value_type_decision# == 4){\n Span(Class: text-danger, Body: *)\n }\n }\n }\n Div(col-md-9 mb-sm text-left){\n Input(Name: ContractRejectName, Value: #buffer_value_contract_reject_name#).Validate(minLength:3, maxLength:255)\n InputErr(Name: ContractRejectName, minLength: $@1validate_name$, maxLength: $@1validate_name$)\n Div(Class: m0 h6 text-muted, Body: \"$@1contract_reject_des$\")\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: ContractRejectParams, Value: #buffer_value_contract_reject_params#)\n Div(Class: m0 h6 text-muted, Body: \"$@1contract_params_des$\")\n }\n }\n }.Show(ExecuteContract=yes)\n\n If(#buffer_value_type_decision# == 1){\n Button(Class: btn btn-primary pull-right mt-sm fa fa-chevron-right, Page: #this_page#, PageParams: \"stage=3\", Contract: @1VotingWizardBuffer, Params: \"Apply=#apply#,RoleId=Val(RoleId),Vacancies=Val(Vacancies),ExecuteContract=Val(ExecuteContract)\").Popup(50, $@1voting_wizard$)\n }.ElseIf(#buffer_value_type_decision# == 2){\n Button(Class: btn btn-primary pull-right mt-sm fa fa-chevron-right, Page: #this_page#, PageParams: \"stage=3\", Contract: @1VotingWizardBuffer, Params: \"Candidates=#candidates#,RoleId=Val(RoleId),Vacancies=Val(Vacancies),ExecuteContract=Val(ExecuteContract)\").Popup(50, $@1voting_wizard$)\n }.Else{\n Button(Class: btn btn-primary pull-right mt-sm fa fa-chevron-right, Page: #this_page#, PageParams: \"stage=3\", Contract: @1VotingWizardBuffer, Params: \"ExecuteContract=Val(ExecuteContract)\").Popup(50, $@1voting_wizard$)\n }\n Button(Class: btn btn-default pull-right mt-sm fa fa-pause, Page: #back_page#)\n Button(Class: btn btn-default pull-right mt-sm fa fa-chevron-left, Page: #this_page#, PageParams: \"stage=1\").Popup(50, $@1voting_wizard$)\n Div(progress-wrapper pull-right mt-sm mr-sm text-muted){Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square#)Em(Class: #square#)Em(Class: #square#)Em(Class: #square#)Em(Class: #square#)}\n\n }.ElseIf(#stage# == 3){\n Div(row){\n Div(col-md-3 mt-lg text-right){\n Label(){\n LangRes(@1participants)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_participants, Source: type_voting_participants)\n RadioGroup(Name: TypeParticipants, Source: type_voting_participants, NameColumn: name, ValueColumn: id, Value: #buffer_value_type_participants#)\n }\n }\n Button(Class: btn btn-primary pull-right fa fa-chevron-right, Page: #this_page#, PageParams: \"stage=4\", Contract: @1VotingWizardBuffer).Popup(50, $@1voting_wizard$)\n Button(Class: btn btn-default pull-right fa fa-pause, Page: #back_page#)\n Button(Class: btn btn-default pull-right fa fa-chevron-left, Page: #this_page#, PageParams: \"stage=2\").Popup(50, $@1voting_wizard$)\n Div(progress-wrapper pull-right mr-sm text-muted){Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square#)Em(Class: #square#)Em(Class: #square#)Em(Class: #square#)}\n\n\n }.ElseIf(And(#stage# == 4, #buffer_value_type_participants# != 1)){\n If(#new_participant# == \"\"){\n SetVar(new_participant, 0)\n }\n If(#member_participants# == \"\"){\n If(#buffer_value_member_participants# != \"\"){\n SetVar(member_participants, #buffer_value_member_participants#)\n }.Else{\n SetVar(member_participants, 0)\n }\n }\n If(#role_participants# == \"\"){\n If(#buffer_value_role_participants# != \"\"){\n SetVar(role_participants, #buffer_value_role_participants#)\n }.Else{\n SetVar(role_participants, 0)\n }\n }\n If(#group_participants# == \"\"){\n If(#buffer_value_group_participants# != \"\"){\n SetVar(group_participants, #buffer_value_group_participants#)\n }.Else{\n SetVar(group_participants, 0)\n }\n }\n\n If(#buffer_value_type_participants# == 2){\n If(#new_participant# != 0){\n If(#member_participants# == 0){\n SetVar(member_participants, #new_participant#)\n }.Else{\n SetVar(member_participants, \"#member_participants#,#new_participant#\")\n }\n }\n DBFind(@1keys, src_participants).Where({\"ecosystem\": #ecosystem_id#, \"id\": {\"$in\": [#member_participants#]}}).Count(participants_count).Custom(_id){\n Address(#id#)\n }.Custom(_name){\n DBFind(@1members).WhereId(#id#).Count(have_name).Vars(participant)\n If(#have_name# > 0){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#id#\", Body: #participant_member_name#)\n }.Else{\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#id#\", Body: Address(#id#))\n }\n }\n }.ElseIf(#buffer_value_type_participants# == 6){\n If(#new_participant# != 0){\n If(#group_participants# == 0){\n SetVar(group_participants, #new_participant#)\n }.Else{\n SetVar(group_participants, \"#group_participants#,#new_participant#\")\n }\n }\n If(#group_participants# != 0){\n DBFind(@1groups_participants, src_participants).Where({\"ecosystem\": #ecosystem_id#, \"groups_info->id\": {\"$in\": [#group_participants#]}}).Columns(\"member->member_id,groups_info->id\").Count(participants_count).Custom(_id){\n Address(#member.member_id#)\n }.Custom(_name){\n DBFind(@1members).WhereId(#member.member_id#).Count(have_name).Vars(participant)\n If(#have_name# > 0){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#id#\", Body: #participant_member_name#)\n }.Else{\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#id#\", Body: Address(#id#))\n }\n }\n }\n }.ElseIf(#buffer_value_type_participants# > 2){\n If(#new_participant# != 0){\n If(#role_participants# == 0){\n SetVar(role_participants, #new_participant#)\n }.Else{\n SetVar(role_participants, \"#role_participants#,#new_participant#\")\n }\n }\n If(And(Or(#buffer_value_type_participants# == 3, #buffer_value_type_participants# == 4), #role_participants# != 0)){\n DBFind(@1roles_participants, src_participants).Where({\"ecosystem\": #ecosystem_id#, \"role->id\": {\"$in\": [#role_participants#]}}).Columns(\"member->member_id,role->id\").Count(participants_count).Custom(_id){\n Address(#member.member_id#)\n }.Custom(_name){\n DBFind(@1members).WhereId(#member.member_id#).Count(have_name).Vars(participant)\n If(#have_name# > 0){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#id#\", Body: #participant_member_name#)\n }.Else{\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#id#\", Body: Address(#id#))\n }\n }.Custom(_sent){\n $@1voting_role_added$\n }.Custom(_member_roles){\n DBFind(@1roles).Columns(\"id,role_name,image_id\").WhereId(#role.id#).Vars(rl)\n LinkPage(Class: text-primary h5 text-bold, Page: @1roles_view, PageParams: \"v_role_id=#rl_id#\"){\n If(#rl_image_id# > 0){\n Image(Src: Binary().ById(#rl_image_id#), Class: mr-sm).Style(width: 30px; border: 1px solid #5A5D63;)\n #rl_role_name#\n }.Else{\n Div(){\n Span(Class: fa icon-settings fa-2x mr-sm).(#rl_role_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n }\n }.ElseIf(And(#buffer_value_type_participants# == 5, #role_participants# != 0)){\n DBFind(@1roles, src_participants).Columns(\"id,role_name,image_id\").Where({\"id\": {\"$in\": [#role_participants#]}}).Count(participants_count).Custom(_sent){\n $@1voting_role_added$\n }.Custom(_member_roles){\n LinkPage(Class: text-primary h5 text-bold, Page: @1roles_view, PageParams: \"v_role_id=#id#\"){\n If(#image_id# > 0){\n Image(Src: Binary().ById(#image_id#), Class: mr-sm).Style(width: 30px; border: 1px solid #5A5D63;)\n #role_name#\n }.Else{\n Div(){\n Span(Class: fa icon-settings fa-2x mr-sm).(#role_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n }\n }\n }\n\n If(#participants_count# > 0){\n Div(list-group-item mb-lg){\n If(#buffer_value_type_participants# == 5){\n Table(src_participants, \"$@1role$=_member_roles,=_sent\")\n }.ElseIf(#buffer_value_type_participants# == 4){\n Table(src_participants, \"$@1role$=_member_roles,=_sent,$@1member$=_name,=_id,\")\n }.Else{\n Table(src_participants, \"$@1member$=_name,=_id\")\n }\n }\n }\n If(#buffer_value_type_participants# != 1){\n Div(row){\n If(#buffer_value_type_participants# == 2){\n DBFind(@1keys,src_keys).Where({\"ecosystem\": #ecosystem_id#, {\"$and\": [{\"id\": {\"$neq\": #guest_key#}}, {\"id\": {\"$nin\": [#member_participants#]}}]}}).Columns(\"id\").Count(keys_count).Custom(_name){\n SetVar(m_member_name,)\n DBFind(@1members).Where({\"ecosystem\": #ecosystem_id#, \"id\": #id#}).Columns(\"id,member_name\").Count(have_name).Vars(m)\n Address(#id#)\n If(#have_name# > 0){\n \" (#m_member_name#)\"\n }\n }\n SetVar(source, src_keys)\n SetVar(select_label, $@1member$)\n SetVar(hint, $@1select_member$)\n }.ElseIf(#buffer_value_type_participants# == 6){\n DBFind(@1groups, src_groups).Where({\"ecosystem\": #ecosystem_id#, \"deleted\": 0, \"id\": {\"$nin\": [#group_participants#]}}).Count(groups_count).Columns(\"id,group_name\").Custom(_name){\n Span(#group_name#)\n }\n SetVar(source, src_groups)\n SetVar(select_label, $@1group$)\n SetVar(hint, $@1select_group$)\n }.ElseIf(#buffer_value_type_participants# > 2){\n DBFind(@1roles, src_roles).Where({\"ecosystem\": #ecosystem_id#, \"deleted\": 0, \"id\": {\"$nin\": [#role_participants#]}}).Count(roles_count).Columns(\"id,role_name\").Custom(_name){\n Span(#role_name#)\n }\n SetVar(source, src_roles)\n SetVar(select_label, $@1role$)\n SetVar(hint, $@1select_role$)\n }\n Div(col-md-2 mt-sm text-right){\n Label(){\n Span(#select_label#)\n Span(*, text-danger)\n }\n }\n Div(col-md-10 text-left){\n If(#participants_count# == \"\"){\n SetVar(participants_count, 0)\n }\n If(#roles_count# == \"\"){\n SetVar(roles_count, 0)\n }\n If(#groups_count# == \"\"){\n SetVar(groups_count, 0)\n }\n If(Or(And(#buffer_value_type_participants# == 2, #keys_count# > 0), And(#buffer_value_type_participants# == 3, #participants_count# == 0), And(#buffer_value_type_participants# == 6, #participants_count# == 0), And(#buffer_value_type_participants# > 3, #roles_count# > 0))){\n Div(input-group){\n Select(Name: VarId, Source: #source#, NameColumn: _name, ValueColumn: id)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-plus buttons, Page: #this_page#, PageParams: \"stage=4,new_participant=Val(VarId),member_participants=#member_participants#,role_participants=#role_participants#,group_participants=#group_participants#\").Popup(50, $@1voting_wizard$)\n Button(Class: btn bg-gray-lighter fa fa-undo buttons, Page: #this_page#, PageParams: \"stage=4,member_participants=0,role_participants=0,group_participants=0\").Popup(50, $@1voting_wizard$)\n }\n }\n Div(Class: m0 h6 text-muted, Body: #hint#)\n }.ElseIf(#buffer_value_type_participants# == 3){\n Div(input-group){\n Input(Class: mb, Disabled: 1, Value: \"$@1voting_one_role_allowed$\")\n Div(input-group-btn input-group-top){\n Button(Class: btn bg-gray-lighter fa fa-undo buttons, Page: #this_page#, PageParams: \"stage=4,member_participants=0,role_participants=0,group_participants=0\").Popup(50, $@1voting_wizard$)\n }\n }\n }.ElseIf(#buffer_value_type_participants# == 6){\n Div(input-group){\n Input(Class: mb, Disabled: 1, Value: \"$@1voting_one_group_allowed$\")\n Div(input-group-btn input-group-top){\n Button(Class: btn bg-gray-lighter fa fa-undo buttons, Page: #this_page#, PageParams: \"stage=4,member_participants=0,role_participants=0,group_participants=0\").Popup(50, $@1voting_wizard$)\n }\n }\n }.ElseIf(#buffer_value_type_participants# > 3){\n Div(input-group){\n Input(Class: mb, Disabled: 1, Value: \"$@1voting_all_roles_added$\")\n Div(input-group-btn input-group-top){\n Button(Class: btn bg-gray-lighter fa fa-undo buttons, Page: #this_page#, PageParams: \"stage=4,member_participants=0,role_participants=0,group_participants=0\").Popup(50, $@1voting_wizard$)\n }\n }\n }.Else{\n Div(input-group){\n Input(Class: mb, Disabled: 1, Value: \"$@1voting_all_keys_added$\")\n Div(input-group-btn input-group-top){\n Button(Class: btn bg-gray-lighter fa fa-undo buttons, Page: #this_page#, PageParams: \"stage=4,member_participants=0,role_participants=0,group_participants=0\").Popup(50, $@1voting_wizard$)\n }\n }\n }\n }\n }\n }\n Button(Class: btn btn-primary pull-right mt-sm fa fa-chevron-right, Page: #this_page#, PageParams: \"stage=5\", Contract: @1VotingWizardBuffer, Params: \"MemberParticipants=#member_participants#,RoleParticipants=#role_participants#,GroupParticipants=#group_participants#\").Popup(50, $@1voting_wizard$)\n Button(Class: btn btn-default pull-right mt-sm fa fa-pause, Page: #back_page#)\n Button(Class: btn btn-default pull-right mt-sm fa fa-chevron-left, Page: #this_page#, PageParams: \"stage=3\").Popup(50, $@1voting_wizard$)\n Div(progress-wrapper pull-right mt-sm mr-sm text-muted){Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square#)Em(Class: #square#)Em(Class: #square#)}\n\n\n }.ElseIf(Or(#stage# == 5, And(#stage# == 4, #buffer_value_type_participants# == 1))){\n If(#count_type_voters# == \"\"){\n SetVar(count_type_voters, 0)\n }\n If(#buffer_value_volume# == \"\"){\n SetVar(buffer_value_volume, 51)\n }\n If(#buffer_value_rating# == \"\"){\n SetVar(buffer_value_rating, \"false\")\n }\n If(And(#buffer_value_type_decision# != 1, #buffer_value_type_decision# != 2)){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1vote_count_type)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Data(type_voters,\"id,name\"){\n 0,$@1percent_votes$\n 1,$@1number_votes$\n }\n Select(Name: CountTypeVoters, Source: type_voters, NameColumn: name, ValueColumn: id, Value: #buffer_value_count_type_voters#)\n }\n }\n }.Else{\n Input(Name: CountTypeVoters, Type: hidden, Value: 0)\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_quorum)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(m0 h6 text-muted){\n If(#buffer_value_quorum# != \"\"){\n Input(Name: Quorum, Type: number, Value: #buffer_value_quorum#)\n }.Else{\n Input(Name: Quorum, Type: number, Value: 30)\n }\n $@1voting_quorum_desc$\n }.Show(CountTypeVoters=0)\n Div(m0 h6 text-muted){\n If(#buffer_value_quorum# != \"\"){\n Input(Name: Quorum, Type: number, Value: #buffer_value_quorum#)\n }.Else{\n Input(Name: Quorum, Type: number, Value: 3)\n }\n $@1voting_quorum_number_desc$\n }.Show(CountTypeVoters=1)\n }\n }\n If(#buffer_value_type_participants# != 5){\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_rating)\n }\n }\n Div(col-md-9 mt-sm text-left){\n Input(Name: rating_switch, Placeholder: $@1voting_rating_desc$, Type: checkbox, Value: #buffer_value_rating#, Class: m0 text-muted)\n }\n }\n }.Else{\n Input(Name: rating_switch, Type: hidden, Value: \"false\")\n }\n If(And(#buffer_value_type_decision# != 1, #buffer_value_type_decision# != 2)){\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_volume)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Volume, Type: number, Value: #buffer_value_volume#)\n Div(m0 h6 text-muted){\n $@1voting_volume_desc$\n }\n }\n }.Show(CountTypeVoters=0)\n }\n If(#buffer_value_type_participants# == 1){\n SetVar(previous_stage_button, 3)\n }.Else{\n SetVar(previous_stage_button, 4)\n }\n Div(){\n Button(Class: btn btn-primary pull-right mt-sm fa fa-chevron-right, Page: #this_page#, PageParams: \"stage=6\", Contract: @1VotingWizardBuffer, Params: \"Rating=true\").Popup(50, $@1voting_wizard$)\n }.Show(rating_switch=true)\n Div(){\n Button(Class: btn btn-primary pull-right mt-sm fa fa-chevron-right, Page: #this_page#, PageParams: \"stage=6\", Contract: @1VotingWizardBuffer, Params: \"Rating=false\").Popup(50, $@1voting_wizard$)\n }.Hide(rating_switch=true)\n Button(Class: btn btn-default pull-right mt-sm fa fa-pause, Page: #back_page#)\n Button(Class: btn btn-default pull-right mt-sm fa fa-chevron-left, Page: #this_page#, PageParams: \"stage=#previous_stage_button#\").Popup(50, $@1voting_wizard$)\n Div(progress-wrapper pull-right mt-sm mr-sm text-muted){Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square#)Em(Class: #square#)}\n\n\n }.ElseIf(#stage# == 6){\n If(#buffer_value_start_time# == \"\"){\n SetVar(buffer_value_start_time, \"00:00\")\n }\n If(#buffer_value_end_time# == \"\"){\n SetVar(buffer_value_end_time, \"00:00\")\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1date_start)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-6){\n Input(Name: StartDate, Type: date, Value: #buffer_value_start_date#)\n }\n Div(col-md-6){\n Input(Name: StartTime, Type: time, Value: #buffer_value_start_time#)\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1date_end)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-6){\n Input(Name: EndDate, Type: date, Value: #buffer_value_end_date#)\n }\n Div(col-md-6){\n Input(Name: EndTime, Type: time, Value: #buffer_value_end_time#)\n }\n }\n }\n }\n Button(Class: btn btn-primary pull-right mt fa fa-chevron-right, Page: #this_page#, PageParams: \"stage=7\", Contract: @1VotingWizardBuffer).Popup(50, $@1voting_wizard$)\n Button(Class: btn btn-default pull-right mt fa fa-pause, Page: #back_page#)\n Button(Class: btn btn-default pull-right mt fa fa-chevron-left, Page: #this_page#, PageParams: \"stage=5\").Popup(50, $@1voting_wizard$)\n Div(progress-wrapper pull-right mt mr-sm text-muted){Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square#)}\n\n\n }.ElseIf(#stage# == 7){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_title)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Name, Value: \"New voting\")\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1description)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Description, Type: textarea).Style(resize:vertical)\n }\n }\n Input(Name: Type, Type: hidden, Value: 1)\n Button(Class: btn btn-primary pull-right mt fa fa-play, Page: #back_page#, Contract: @1VotingWizardCreate, Params: \"TypeDecision=#buffer_value_type_decision#,CountTypeVoters=#buffer_value_count_type_voters#,TypeParticipants=#buffer_value_type_participants#,MemberParticipants=#buffer_value_member_participants#,RoleParticipants=#buffer_value_role_participants#,GroupParticipants=#buffer_value_group_participants#,Volume=#buffer_value_volume#,Quorum=#buffer_value_quorum#,Rating=#buffer_value_rating#,StartDate=#buffer_value_start_date#,StartTime=#buffer_value_start_time#,EndDate=#buffer_value_end_date#,EndTime=#buffer_value_end_time#,Name=Val(Name),Description=Val(Description),Apply=#buffer_value_apply#,Candidates=#buffer_value_candidates#,RoleId=#buffer_value_role_id#,Vacancies=#buffer_value_vacancies#,ExecuteContract=#buffer_value_execute_contract#,ContractAcceptName=#buffer_value_contract_accept_name#,ContractAcceptParams=#buffer_value_contract_accept_params#,ContractRejectName=#buffer_value_contract_reject_name#,ContractRejectParams=#buffer_value_contract_reject_params#,TextDocument=#buffer_value_text_document#\")\n Button(Class: btn btn-default pull-right mt fa fa-pause, Page: #back_page#)\n Button(Class: btn btn-default pull-right mt fa fa-chevron-left, Page: #this_page#, PageParams: \"stage=6\").Popup(50, $@1voting_wizard$)\n Div(progress-wrapper pull-right mt mr-sm text-muted){Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)}\n }\n}.Style(\n .progress-wrapper{line-height: 33px;}\n .input-group-top{vertical-align: top;}\n .buttons{\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n)\nIf(#debug# == 1){\n Div(Class: h6 text-muted){\n Div(Body: stage = #stage#)\n Div(Body: type_decision = #buffer_value_type_decision#)\n Div(Body: type_participants = #buffer_value_type_participants#)\n Div(Body: count_type_voters = #buffer_value_count_type_voters#)\n Div(Body: volume = #buffer_value_volume#)\n Div(Body: quorum = #buffer_value_quorum#)\n Div(Body: rating = #buffer_value_rating#)\n Div(Body: start_date = #buffer_value_start_date#)\n Div(Body: start_time = #buffer_value_start_time#)\n Div(Body: end_date = #buffer_value_end_date#)\n Div(Body: end_time = #buffer_value_end_time#)\n Div(Body: voting_name = #buffer_value_voting_name#)\n Div(Body: description = #buffer_value_description#)\n\n Div(Body: member_participants = #buffer_value_member_participants#)\n Div(Body: role_participants = #buffer_value_role_participants#)\n Div(Body: group_participants = #buffer_value_group_participants#)\n\n Div(Body: execute_contract = #buffer_value_execute_contract#)\n Div(Body: contract_accept_name = #buffer_value_contract_accept_name#)\n Div(Body: contract_accept_params = #buffer_value_contract_accept_params#)\n Div(Body: contract_reject_name = #buffer_value_contract_reject_name#)\n Div(Body: contract_reject_params = #buffer_value_contract_reject_params#)\n\n Div(Body: text_document = #buffer_value_text_document#)\n\n Div(Body: candidates = #buffer_value_candidates#)\n Div(Body: apply = #buffer_value_apply#)\n Div(Body: role_id = #buffer_value_role_id#)\n Div(Body: vacancies = #buffer_value_vacancies#)\n }\n}", + "Value": "SetVar(this_page, \"@1voting_wizard\")\nSetVar(back_page, \"@1voting_list\")\nDBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\nDBFind(\"@1buffer_data\").Where({\"key\": \"voting_wizard_buffer\", \"account\": \"#account_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Columns(\"value->save_time,value->voting_name,value->voting_type,value->type_participants,value->type_decision,value->volume,value->quorum,value->rating,value->count_type_voters,value->description,value->interval,value->start_date,value->start_time,value->end_date,value->end_time,value->member_participants,value->role_participants,value->group_participants,value->execute_contract,value->contract_accept_name,value->contract_accept_params,value->contract_reject_name,value->contract_reject_params,value->text_document,value->candidates,value->apply,value->role_id,value->vacancies\").Vars(buffer)\n\nIf(#stage# == \"\"){\n If(#buffer_value_save_time# == \"\"){\n SetVar(stage, 1)\n }.Else{\n SetVar(stage, 0)\n }\n}\nSetVar(debug, 0)\nSetVar(square, \"fa fa-circle-o mr-sm\")\nSetVar(square-filled, \"fa fa-dot-circle-o mr-sm\")\n\nForm(){\n If(#stage# == 0){\n Div(text-center){\n Div(Body: LangRes(@1voting_wizard_draft_message))\n Div(h6 m0 text-muted){$@1last_save$: DateTime(#buffer_value_save_time#, \"HH:MI DD.MM.YYYY\")}\n Data(src_autosave, \"id,name\"){\n yes,$@1voting_wizard_use_draft$\n no,$@1start_over$\n }\n RadioGroup(Name: LoadAutosave, Source: src_autosave, NameColumn: name, ValueColumn: id)\n }\n Button(Body: LangRes(@1next), Class: btn btn-primary pull-right, Page: #this_page#, PageParams: \"stage=1\", Contract: @1VotingWizardBuffer).Popup(50, $@1voting_wizard$)\n Button(Body: LangRes(@1cancel), Class: btn btn-default pull-right, Page: #back_page#)\n\n }.ElseIf(#stage# == 1){\n Div(row){\n Div(col-md-3 mt-lg text-right){\n Label(){\n LangRes(@1voting_subject)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n AppParam(Ecosystem: 1, App: #application_id#, Name: type_voting_decisions, Source: procent_type_decisions)\n RadioGroup(Name: TypeDecision, Source: procent_type_decisions, NameColumn: name, ValueColumn: id, Value: #buffer_value_type_decision#)\n }\n }\n Button(Class: btn btn-primary pull-right fa fa-chevron-right, Page: #this_page#, PageParams: \"stage=2\", Contract: @1VotingWizardBuffer).Popup(50, $@1voting_wizard$)\n Button(Class: btn btn-default pull-right fa fa-pause, Page: #back_page#)\n Div(progress-wrapper pull-right mr-sm text-muted){Em(Class: #square-filled#)Em(Class: #square#)Em(Class: #square#)Em(Class: #square#)Em(Class: #square#)Em(Class: #square#)Em(Class: #square#)}\n\n\n }.ElseIf(#stage# == 2){\n If(#val_contract_accept_name# != \"\"){\n SetVar(buffer_value_contract_accept_name, #val_contract_accept_name#)\n }\n If(#val_contract_accept_params# != \"\"){\n SetVar(buffer_value_contract_accept_params, #val_contract_accept_params#)\n }\n If(#val_contract_reject_name# != \"\"){\n SetVar(buffer_value_contract_reject_name, #val_contract_reject_name#)\n }\n If(#val_contract_reject_params# != \"\"){\n SetVar(buffer_value_contract_reject_params, #val_contract_reject_params#)\n }\n\n\n If(#buffer_value_type_decision# == 1){\n If(#val_role_id# != \"\"){\n SetVar(buffer_value_role_id, #val_role_id#)\n }\n If(#val_role_vacancies# != \"\"){\n SetVar(buffer_value_vacancies, #val_role_vacancies#)\n }\n If(#val_execute_contract# != \"\"){\n SetVar(buffer_value_execute_contract, #val_execute_contract#)\n }\n If(And(#apply# == \"\", #buffer_value_apply# == 1)){\n SetVar(apply, 1)\n }\n\n DBFind(\"@1roles\", src_roles).Where({\"ecosystem\": \"#ecosystem_id#\", \"role_type\": 2, \"deleted\": 0}).Columns(\"id,role_name\").Count(elective_roles_count)\n If(#elective_roles_count# > 0){\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1candidates))\n Span(Class: text-danger, Body: *)\n }\n }\n Div(col-md-9 text-left){\n Div(input-group){\n If(#apply# == 1){\n Input(Name: applied, Disabled: 1, Value: $@1applied_already$)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter buttons fa fa-undo, Page: #this_page#, PageParams: \"stage=2,apply=0,val_role_id=Val(RoleId),val_role_vacancies=Val(Vacancies),val_execute_contract=Val(ExecuteContract),val_contract_accept_name=Val(ContractAcceptName),val_contract_accept_params=Val(ContractAcceptParams),val_contract_reject_name=Val(ContractRejectName),val_contract_reject_params=Val(ContractRejectParams)\").Popup(50, $@1voting_wizard$)\n }\n }.Else{\n Input(Name: can_apply_voting, Disabled: 1, Value: $@1can_apply_voting$)\n Div(input-group-btn){\n Button(Body: LangRes(@1apply), Class: btn bg-gray-lighter buttons, Page: #this_page#, PageParams: \"stage=2,apply=1,val_role_id=Val(RoleId),val_role_vacancies=Val(Vacancies),val_execute_contract=Val(ExecuteContract),val_contract_accept_name=Val(ContractAcceptName),val_contract_accept_params=Val(ContractAcceptParams),val_contract_reject_name=Val(ContractRejectName),val_contract_reject_params=Val(ContractRejectParams)\").Popup(50, $@1voting_wizard$)\n }\n }\n }\n }\n }\n If(#apply# == 1){\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#account_id#\"}).Vars(my)\n If(#my_member_name# == \"\"){\n SetVar(my_member_name, #account_id#)\n }\n Data(src_voting_subject,\"id,name\"){\n #account_id#,#my_member_name#\n }.Custom(_address){\n #account#\n }.Custom(_member){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#account#\"){\n Span(Body: #name#)\n }\n }\n }.Else{\n Data(src_voting_subject,\"id,name\"){}\n }\n If(#apply# == 1){\n Div(row){\n Div(col-sm-9 col-sm-offset-3){\n Table(src_voting_subject, \"$@1candidates$=_member,=_address\").Style(margin-bottom: 5px;)\n }\n }\n }\n Div(form-group){\n Div(row mt-lg){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1role))\n Span(Class: text-danger, Body: *)\n }\n }\n Div(col-md-9 text-left){\n Select(Name: RoleId, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #buffer_value_role_id#)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1vacancies))\n Span(Class: text-danger, Body: *)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Vacancies, Type: Number, Value: #buffer_value_vacancies#)\n }\n }\n }\n }.Else{\n Div(row){\n Div(col-md-12 text-center h4){\n P(Class: m0, Body: LangRes(@1elective_roles_not_found))\n Button(Class: btn btn-link, Page: @1roles_create, PageParams: \"back_page=#back_page#\"){\n Span(Class: h4, Body: LangRes(@1create_role))\n }.Popup(50, $@1edit_role$)\n }\n }\n }\n\n\n }.ElseIf(#buffer_value_type_decision# == 2){\n If(#val_role_id# != \"\"){\n SetVar(buffer_value_role_id, #val_role_id#)\n }\n If(#val_role_vacancies# != \"\"){\n SetVar(buffer_value_vacancies, #val_role_vacancies#)\n }\n If(#val_execute_contract# != \"\"){\n SetVar(buffer_value_execute_contract, #val_execute_contract#)\n }\n If(#new_candidate# == \"\"){\n SetVar(new_candidate, 0)\n }\n If(#candidates# == \"\"){\n If(#buffer_value_candidates# != \"\"){\n SetVar(candidates, #buffer_value_candidates#)\n }.Else{\n SetVar(candidates, 0)\n }\n }\n If(#new_candidate# != 0){\n If(#candidates# == 0){\n SetVar(candidates, \"#new_candidate#\")\n }.Else{\n SetVar(candidates, \"#candidates#,#new_candidate#\")\n }\n }\n\n DBFind(\"@1keys\", src_subject).Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": {\"$in\": [#candidates#]}, \"deleted\": 0}).Custom(_address){\n #account#\n }.Custom(_member){\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#account#\"}).Count(have_name).Vars(participant)\n If(#have_name# > 0){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#account#\", Body: #participant_member_name#)\n }.Else{\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#account#\", Body: #account#)\n }\n }\n\n DBFind(\"@1keys\", src_accounts).Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"account\": {\"$neq\": \"#guest_account#\"}}, {\"account\": {\"$nin\": [#candidates#]}}], \"deleted\": 0}).Columns(\"account\").Count(members_count).Custom(_name){\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#account#\"}).Columns(\"account,member_name\").Count(have_name).Vars(m)\n #account#\n If(#have_name# > 0){\n \" (#m_member_name#)\"\n }\n }\n\n DBFind(\"@1roles\", src_roles).Where({\"ecosystem\": \"#ecosystem_id#\", \"role_type\": 2, \"deleted\": 0}).Columns(\"id,role_name\").Count(elective_roles_count)\n If(#elective_roles_count# > 0){\n Div(form-group){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1candidates)).(Class: text-danger, Body: *)\n }\n }\n Div(col-md-9 mc-sm text-left){\n Div(input-group){\n If(#members_count# > 0){\n Select(Name: MemberAccount, Source: src_accounts, NameColumn: _name, ValueColumn: account)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-plus buttons, Page: #this_page#, PageParams: \"stage=2,new_candidate=Val(MemberAccount),candidates=#candidates#,val_role_id=Val(RoleId),val_role_vacancies=Val(Vacancies),val_execute_contract=Val(ExecuteContract),val_contract_accept_name=Val(ContractAcceptName),val_contract_accept_params=Val(ContractAcceptParams),val_contract_reject_name=Val(ContractRejectName),val_contract_reject_params=Val(ContractRejectParams)\").Popup(50, $@1voting_wizard$)\n Button(Class: btn bg-gray-lighter fa fa-undo buttons, Page: #this_page#, PageParams: \"stage=2,candidates=0,val_role_id=Val(RoleId),val_role_vacancies=Val(Vacancies),val_execute_contract=Val(ExecuteContract),val_contract_accept_name=Val(ContractAcceptName),val_contract_accept_params=Val(ContractAcceptParams),val_contract_reject_name=Val(ContractRejectName),val_contract_reject_params=Val(ContractRejectParams)\").Popup(50, $@1voting_wizard$)\n }\n }.Else{\n Input(Class: mb, Disabled: 1, Value: \"$@1voting_all_members_added$\")\n Div(input-group-btn input-group-top){\n Button(Class: btn bg-gray-lighter fa fa-undo buttons, Page: #this_page#, PageParams: \"stage=2,candidates=0,val_role_id=Val(RoleId),val_role_vacancies=Val(Vacancies),val_execute_contract=Val(ExecuteContract),val_contract_accept_name=Val(ContractAcceptName),val_contract_accept_params=Val(ContractAcceptParams),val_contract_reject_name=Val(ContractRejectName),val_contract_reject_params=Val(ContractRejectParams)\").Popup(50, $@1voting_wizard$)\n }\n }\n }\n }\n }\n If(Or(#members_count# > 0, #candidates# != 0)){\n Div(row){\n Div(col-sm-9 col-sm-offset-3){\n Table(src_subject, \"$@1candidates$=_member,=_address\").Style(margin-bottom: 5px;)\n }\n }\n }\n }\n Div(form-group){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1role)).(Class: text-danger, Body: *)\n }\n }\n Div(col-md-9 mb-sm text-left){\n Select(Name: RoleId, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #buffer_value_role_id#)\n }\n }\n\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1vacancies)).(Class: text-danger, Body: *)\n }\n }\n Div(col-md-9 mc-sm text-left){\n Input(Name: Vacancies, Class: form-control, Type: Number, Value: #buffer_value_vacancies#)\n }\n }\n }\n }.Else{\n Div(row){\n Div(col-md-12 text-center h4){\n P(Class: m0, Body: LangRes(@1elective_roles_not_found))\n Button(Class: btn btn-link, Page: @1roles_create, PageParams: \"back_page=#back_page#\"){\n Span(Class: h4, Body: LangRes(@1create_role))\n }.Popup(50, $@1edit_role$)\n }\n }\n }\n\n\n }.ElseIf(#buffer_value_type_decision# == 3){\n Div(form-group){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1text_document))\n Span(Class: text-danger, Body: *)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: TextDocument, Type: textarea, Value: #buffer_value_text_document#).Style(resize: vertical;)\n }\n }\n }\n }\n\n If(Or(And(#buffer_value_type_decision# == 1, #elective_roles_count# > 0), And(#buffer_value_type_decision# == 2, #elective_roles_count# > 0), #buffer_value_type_decision# == 3)){\n Div(form-group){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1contract_execute))\n }\n }\n Div(col-md-9 mc-sm text-left){\n Data(src_execute, \"id,name\"){\n no,$@1no$\n yes,$@1yes$\n }\n Select(Name: ExecuteContract, Source: src_execute, NameColumn: name, ValueColumn: id, Value: #buffer_value_execute_contract#)\n }\n }\n }\n }.ElseIf(#buffer_value_type_decision# == 4){\n Input(Name: ExecuteContract, Type: \"hidden\", Value: \"yes\")\n }\n\n Div(){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1contract_accept))\n If(#buffer_value_type_decision# == 4){\n Span(Class: text-danger, Body: *)\n }\n }\n }\n Div(col-md-9 mb-sm text-left){\n Input(Name: ContractAcceptName, Value: #buffer_value_contract_accept_name#).Validate(minLength:3, maxLength:255)\n InputErr(Name: ContractAcceptName, minLength: $@1validate_name$, maxLength: $@1validate_name$)\n Div(Class: m0 h6 text-muted, Body: \"$@1contract_accept_des$\")\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 mb-sm text-left){\n Input(Name: ContractAcceptParams, Value: #buffer_value_contract_accept_params#)\n Div(Class: m0 h6 text-muted, Body: \"$@1contract_params_des$\")\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1contract_reject))\n If(#buffer_value_type_decision# == 4){\n Span(Class: text-danger, Body: *)\n }\n }\n }\n Div(col-md-9 mb-sm text-left){\n Input(Name: ContractRejectName, Value: #buffer_value_contract_reject_name#).Validate(minLength:3, maxLength:255)\n InputErr(Name: ContractRejectName, minLength: $@1validate_name$, maxLength: $@1validate_name$)\n Div(Class: m0 h6 text-muted, Body: \"$@1contract_reject_des$\")\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1params))\n }\n }\n Div(col-md-9 text-left){\n Input(Name: ContractRejectParams, Value: #buffer_value_contract_reject_params#)\n Div(Class: m0 h6 text-muted, Body: \"$@1contract_params_des$\")\n }\n }\n }.Show(ExecuteContract=yes)\n\n If(#buffer_value_type_decision# == 1){\n Button(Class: btn btn-primary pull-right mt-sm fa fa-chevron-right, Page: #this_page#, PageParams: \"stage=3\", Contract: @1VotingWizardBuffer, Params: \"Apply=#apply#,RoleId=Val(RoleId),Vacancies=Val(Vacancies),ExecuteContract=Val(ExecuteContract)\").Popup(50, $@1voting_wizard$)\n }.ElseIf(#buffer_value_type_decision# == 2){\n Button(Class: btn btn-primary pull-right mt-sm fa fa-chevron-right, Page: #this_page#, PageParams: \"stage=3\", Contract: @1VotingWizardBuffer, Params: \"Candidates=#candidates#,RoleId=Val(RoleId),Vacancies=Val(Vacancies),ExecuteContract=Val(ExecuteContract)\").Popup(50, $@1voting_wizard$)\n }.Else{\n Button(Class: btn btn-primary pull-right mt-sm fa fa-chevron-right, Page: #this_page#, PageParams: \"stage=3\", Contract: @1VotingWizardBuffer, Params: \"ExecuteContract=Val(ExecuteContract)\").Popup(50, $@1voting_wizard$)\n }\n Button(Class: btn btn-default pull-right mt-sm fa fa-pause, Page: #back_page#)\n Button(Class: btn btn-default pull-right mt-sm fa fa-chevron-left, Page: #this_page#, PageParams: \"stage=1\").Popup(50, $@1voting_wizard$)\n Div(progress-wrapper pull-right mt-sm mr-sm text-muted){Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square#)Em(Class: #square#)Em(Class: #square#)Em(Class: #square#)Em(Class: #square#)}\n\n }.ElseIf(#stage# == 3){\n Div(row){\n Div(col-md-3 mt-lg text-right){\n Label(){\n LangRes(@1participants)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n AppParam(Ecosystem:1, App:#application_id#, Name: type_voting_participants, Source: type_voting_participants)\n RadioGroup(Name: TypeParticipants, Source: type_voting_participants, NameColumn: name, ValueColumn: id, Value: #buffer_value_type_participants#)\n }\n }\n Button(Class: btn btn-primary pull-right fa fa-chevron-right, Page: #this_page#, PageParams: \"stage=4\", Contract: @1VotingWizardBuffer).Popup(50, $@1voting_wizard$)\n Button(Class: btn btn-default pull-right fa fa-pause, Page: #back_page#)\n Button(Class: btn btn-default pull-right fa fa-chevron-left, Page: #this_page#, PageParams: \"stage=2\").Popup(50, $@1voting_wizard$)\n Div(progress-wrapper pull-right mr-sm text-muted){Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square#)Em(Class: #square#)Em(Class: #square#)Em(Class: #square#)}\n\n\n }.ElseIf(And(#stage# == 4, #buffer_value_type_participants# != 1)){\n If(#new_participant# == \"\"){\n SetVar(new_participant, 0)\n }\n If(#member_participants# == \"\"){\n If(#buffer_value_member_participants# != \"\"){\n SetVar(member_participants, #buffer_value_member_participants#)\n }.Else{\n SetVar(member_participants, 0)\n }\n }\n If(#role_participants# == \"\"){\n If(#buffer_value_role_participants# != \"\"){\n SetVar(role_participants, #buffer_value_role_participants#)\n }.Else{\n SetVar(role_participants, 0)\n }\n }\n If(#group_participants# == \"\"){\n If(#buffer_value_group_participants# != \"\"){\n SetVar(group_participants, #buffer_value_group_participants#)\n }.Else{\n SetVar(group_participants, 0)\n }\n }\n\n If(#buffer_value_type_participants# == 2){\n If(#new_participant# != 0){\n If(#member_participants# == 0){\n SetVar(member_participants, #new_participant#)\n }.Else{\n SetVar(member_participants, \"#member_participants#,#new_participant#\")\n }\n }\n DBFind(\"@1keys\", src_participants).Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": {\"$in\": [#member_participants#]}, \"deleted\": 0}).Count(participants_count).Custom(_id){\n #account#\n }.Custom(_name){\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#account#\"}).Count(have_name).Vars(participant)\n If(#have_name# > 0){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#account#\", Body: #participant_member_name#)\n }.Else{\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#account#\", Body: #account#)\n }\n }\n }.ElseIf(#buffer_value_type_participants# == 6){\n If(#new_participant# != 0){\n If(#group_participants# == 0){\n SetVar(group_participants, #new_participant#)\n }.Else{\n SetVar(group_participants, \"#group_participants#,#new_participant#\")\n }\n }\n If(#group_participants# != 0){\n DBFind(\"@1groups_participants\", src_participants).Where({\"ecosystem\": \"#ecosystem_id#\", \"groups_info->id\": {\"$in\": [#group_participants#]}}).Columns(\"member->account,groups_info->id\").Count(participants_count).Custom(_id){\n #member.account#\n }.Custom(_name){\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#member.account#\"}).Count(have_name).Vars(participant)\n If(#have_name# > 0){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#account#\", Body: #participant_member_name#)\n }.Else{\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#account#\", Body: #account#)\n }\n }\n }\n }.ElseIf(#buffer_value_type_participants# > 2){\n If(#new_participant# != 0){\n If(#role_participants# == 0){\n SetVar(role_participants, #new_participant#)\n }.Else{\n SetVar(role_participants, \"#role_participants#,#new_participant#\")\n }\n }\n If(And(Or(#buffer_value_type_participants# == 3, #buffer_value_type_participants# == 4), #role_participants# != 0)){\n DBFind(\"@1roles_participants\", src_participants).Where({\"ecosystem\": \"#ecosystem_id#\", \"role->id\": {\"$in\": [#role_participants#]}}).Columns(\"member->account,role->id\").Count(participants_count).Custom(_id){\n #member.account#\n }.Custom(_name){\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#member.account#\"}).Count(have_name).Vars(participant)\n If(#have_name# > 0){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#account#\", Body: #participant_member_name#)\n }.Else{\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#account#\", Body: #account#)\n }\n }.Custom(_sent){\n $@1voting_role_added$\n }.Custom(_member_roles){\n DBFind(\"@1roles\").Columns(\"id,role_name,image_id\").WhereId(#role.id#).Vars(rl)\n LinkPage(Class: text-primary h5 text-bold, Page: @1roles_view, PageParams: \"v_role_id=#rl_id#\"){\n If(#rl_image_id# > 0){\n Image(Src: Binary().ById(#rl_image_id#), Class: mr-sm).Style(width: 30px; border: 1px solid #5A5D63;)\n #rl_role_name#\n }.Else{\n Div(){\n Span(Class: fa icon-settings fa-2x mr-sm).(#rl_role_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n }\n }.ElseIf(And(#buffer_value_type_participants# == 5, #role_participants# != 0)){\n DBFind(\"@1roles\", src_participants).Columns(\"id,role_name,image_id\").Where({\"id\": {\"$in\": [#role_participants#]}}).Count(participants_count).Custom(_sent){\n $@1voting_role_added$\n }.Custom(_member_roles){\n LinkPage(Class: text-primary h5 text-bold, Page: @1roles_view, PageParams: \"v_role_id=#id#\"){\n If(#image_id# > 0){\n Image(Src: Binary().ById(#image_id#), Class: mr-sm).Style(width: 30px; border: 1px solid #5A5D63;)\n #role_name#\n }.Else{\n Div(){\n Span(Class: fa icon-settings fa-2x mr-sm).(#role_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n }\n }\n }\n\n If(#participants_count# > 0){\n Div(list-group-item mb-lg){\n If(#buffer_value_type_participants# == 5){\n Table(src_participants, \"$@1role$=_member_roles,=_sent\")\n }.ElseIf(#buffer_value_type_participants# == 4){\n Table(src_participants, \"$@1role$=_member_roles,=_sent,$@1member$=_name,=_id,\")\n }.Else{\n Table(src_participants, \"$@1member$=_name,=_id\")\n }\n }\n }\n If(#buffer_value_type_participants# != 1){\n Div(row){\n If(#buffer_value_type_participants# == 2){\n DBFind(\"@1keys\", src_keys).Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"account\": {\"$neq\": \"#guest_account#\"}}, {\"account\": {\"$nin\": [#member_participants#]}}], \"deleted\": 0}).Columns(\"account\").Count(keys_count).Custom(_name){\n SetVar(m_member_name,)\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#account#\"}).Columns(\"account,member_name\").Count(have_name).Vars(m)\n #account#\n If(#have_name# > 0){\n \" (#m_member_name#)\"\n }\n }\n SetVar(source, \"src_keys\")\n SetVar(value, \"account\")\n SetVar(select_label, $@1member$)\n SetVar(hint, $@1select_member$)\n }.ElseIf(#buffer_value_type_participants# == 6){\n DBFind(\"@1groups\", src_groups).Where({\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0, \"id\": {\"$nin\": [#group_participants#]}}).Count(groups_count).Columns(\"id,group_name\").Custom(_name){\n Span(#group_name#)\n }\n SetVar(source, \"src_groups\")\n SetVar(value, \"id\")\n SetVar(select_label, $@1group$)\n SetVar(hint, $@1select_group$)\n }.ElseIf(#buffer_value_type_participants# > 2){\n DBFind(\"@1roles\", src_roles).Where({\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0, \"id\": {\"$nin\": [#role_participants#]}}).Count(roles_count).Columns(\"id,role_name\").Custom(_name){\n Span(#role_name#)\n }\n SetVar(source, \"src_roles\")\n SetVar(value, \"id\")\n SetVar(select_label, $@1role$)\n SetVar(hint, $@1select_role$)\n }\n Div(col-md-2 mt-sm text-right){\n Label(){\n Span(#select_label#)\n Span(*, text-danger)\n }\n }\n Div(col-md-10 text-left){\n If(#participants_count# == \"\"){\n SetVar(participants_count, 0)\n }\n If(#roles_count# == \"\"){\n SetVar(roles_count, 0)\n }\n If(#groups_count# == \"\"){\n SetVar(groups_count, 0)\n }\n If(Or(And(#buffer_value_type_participants# == 2, #keys_count# > 0), And(#buffer_value_type_participants# == 3, #participants_count# == 0), And(#buffer_value_type_participants# == 6, #participants_count# == 0), And(#buffer_value_type_participants# > 3, #roles_count# > 0))){\n Div(input-group){\n Select(Name: VarId, Source: #source#, NameColumn: _name, ValueColumn: #value#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-plus buttons, Page: #this_page#, PageParams: \"stage=4,new_participant=Val(VarId),member_participants=#member_participants#,role_participants=#role_participants#,group_participants=#group_participants#\").Popup(50, $@1voting_wizard$)\n Button(Class: btn bg-gray-lighter fa fa-undo buttons, Page: #this_page#, PageParams: \"stage=4,member_participants=0,role_participants=0,group_participants=0\").Popup(50, $@1voting_wizard$)\n }\n }\n Div(Class: m0 h6 text-muted, Body: #hint#)\n }.ElseIf(#buffer_value_type_participants# == 3){\n Div(input-group){\n Input(Class: mb, Disabled: 1, Value: \"$@1voting_one_role_allowed$\")\n Div(input-group-btn input-group-top){\n Button(Class: btn bg-gray-lighter fa fa-undo buttons, Page: #this_page#, PageParams: \"stage=4,member_participants=0,role_participants=0,group_participants=0\").Popup(50, $@1voting_wizard$)\n }\n }\n }.ElseIf(#buffer_value_type_participants# == 6){\n Div(input-group){\n Input(Class: mb, Disabled: 1, Value: \"$@1voting_one_group_allowed$\")\n Div(input-group-btn input-group-top){\n Button(Class: btn bg-gray-lighter fa fa-undo buttons, Page: #this_page#, PageParams: \"stage=4,member_participants=0,role_participants=0,group_participants=0\").Popup(50, $@1voting_wizard$)\n }\n }\n }.ElseIf(#buffer_value_type_participants# > 3){\n Div(input-group){\n Input(Class: mb, Disabled: 1, Value: \"$@1voting_all_roles_added$\")\n Div(input-group-btn input-group-top){\n Button(Class: btn bg-gray-lighter fa fa-undo buttons, Page: #this_page#, PageParams: \"stage=4,member_participants=0,role_participants=0,group_participants=0\").Popup(50, $@1voting_wizard$)\n }\n }\n }.Else{\n Div(input-group){\n Input(Class: mb, Disabled: 1, Value: \"$@1voting_all_members_added$\")\n Div(input-group-btn input-group-top){\n Button(Class: btn bg-gray-lighter fa fa-undo buttons, Page: #this_page#, PageParams: \"stage=4,member_participants=0,role_participants=0,group_participants=0\").Popup(50, $@1voting_wizard$)\n }\n }\n }\n }\n }\n }\n Button(Class: btn btn-primary pull-right mt-sm fa fa-chevron-right, Page: #this_page#, PageParams: \"stage=5\", Contract: @1VotingWizardBuffer, Params: \"MemberParticipants=#member_participants#,RoleParticipants=#role_participants#,GroupParticipants=#group_participants#\").Popup(50, $@1voting_wizard$)\n Button(Class: btn btn-default pull-right mt-sm fa fa-pause, Page: #back_page#)\n Button(Class: btn btn-default pull-right mt-sm fa fa-chevron-left, Page: #this_page#, PageParams: \"stage=3\").Popup(50, $@1voting_wizard$)\n Div(progress-wrapper pull-right mt-sm mr-sm text-muted){Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square#)Em(Class: #square#)Em(Class: #square#)}\n\n\n }.ElseIf(Or(#stage# == 5, And(#stage# == 4, #buffer_value_type_participants# == 1))){\n If(#count_type_voters# == \"\"){\n SetVar(count_type_voters, 0)\n }\n If(#buffer_value_volume# == \"\"){\n SetVar(buffer_value_volume, 51)\n }\n If(#buffer_value_rating# == \"\"){\n SetVar(buffer_value_rating, \"false\")\n }\n If(And(#buffer_value_type_decision# != 1, #buffer_value_type_decision# != 2)){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1vote_count_type)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Data(type_voters,\"id,name\"){\n 0,$@1percent_votes$\n 1,$@1number_votes$\n }\n Select(Name: CountTypeVoters, Source: type_voters, NameColumn: name, ValueColumn: id, Value: #buffer_value_count_type_voters#)\n }\n }\n }.Else{\n Input(Name: CountTypeVoters, Type: hidden, Value: 0)\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_quorum)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(m0 h6 text-muted){\n If(#buffer_value_quorum# != \"\"){\n Input(Name: Quorum, Type: number, Value: #buffer_value_quorum#)\n }.Else{\n Input(Name: Quorum, Type: number, Value: 30)\n }\n $@1voting_quorum_desc$\n }.Show(CountTypeVoters=0)\n Div(m0 h6 text-muted){\n If(#buffer_value_quorum# != \"\"){\n Input(Name: Quorum, Type: number, Value: #buffer_value_quorum#)\n }.Else{\n Input(Name: Quorum, Type: number, Value: 3)\n }\n $@1voting_quorum_number_desc$\n }.Show(CountTypeVoters=1)\n }\n }\n If(#buffer_value_type_participants# != 5){\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_rating)\n }\n }\n Div(col-md-9 mt-sm text-left){\n Input(Name: rating_switch, Placeholder: $@1voting_rating_desc$, Type: checkbox, Value: #buffer_value_rating#, Class: m0 text-muted)\n }\n }\n }.Else{\n Input(Name: rating_switch, Type: hidden, Value: \"false\")\n }\n If(And(#buffer_value_type_decision# != 1, #buffer_value_type_decision# != 2)){\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_volume)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Volume, Type: number, Value: #buffer_value_volume#)\n Div(m0 h6 text-muted){\n $@1voting_volume_desc$\n }\n }\n }.Show(CountTypeVoters=0)\n }\n If(#buffer_value_type_participants# == 1){\n SetVar(previous_stage_button, 3)\n }.Else{\n SetVar(previous_stage_button, 4)\n }\n Div(){\n Button(Class: btn btn-primary pull-right mt-sm fa fa-chevron-right, Page: #this_page#, PageParams: \"stage=6\", Contract: @1VotingWizardBuffer, Params: \"Rating=true\").Popup(50, $@1voting_wizard$)\n }.Show(rating_switch=true)\n Div(){\n Button(Class: btn btn-primary pull-right mt-sm fa fa-chevron-right, Page: #this_page#, PageParams: \"stage=6\", Contract: @1VotingWizardBuffer, Params: \"Rating=false\").Popup(50, $@1voting_wizard$)\n }.Hide(rating_switch=true)\n Button(Class: btn btn-default pull-right mt-sm fa fa-pause, Page: #back_page#)\n Button(Class: btn btn-default pull-right mt-sm fa fa-chevron-left, Page: #this_page#, PageParams: \"stage=#previous_stage_button#\").Popup(50, $@1voting_wizard$)\n Div(progress-wrapper pull-right mt-sm mr-sm text-muted){Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square#)Em(Class: #square#)}\n\n\n }.ElseIf(#stage# == 6){\n If(#buffer_value_start_time# == \"\"){\n SetVar(buffer_value_start_time, \"00:00\")\n }\n If(#buffer_value_end_time# == \"\"){\n SetVar(buffer_value_end_time, \"00:00\")\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1date_start)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-6){\n Input(Name: StartDate, Type: date, Value: #buffer_value_start_date#)\n }\n Div(col-md-6){\n Input(Name: StartTime, Type: time, Value: #buffer_value_start_time#)\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1date_end)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-6){\n Input(Name: EndDate, Type: date, Value: #buffer_value_end_date#)\n }\n Div(col-md-6){\n Input(Name: EndTime, Type: time, Value: #buffer_value_end_time#)\n }\n }\n }\n }\n Button(Class: btn btn-primary pull-right mt fa fa-chevron-right, Page: #this_page#, PageParams: \"stage=7\", Contract: @1VotingWizardBuffer).Popup(50, $@1voting_wizard$)\n Button(Class: btn btn-default pull-right mt fa fa-pause, Page: #back_page#)\n Button(Class: btn btn-default pull-right mt fa fa-chevron-left, Page: #this_page#, PageParams: \"stage=5\").Popup(50, $@1voting_wizard$)\n Div(progress-wrapper pull-right mt mr-sm text-muted){Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square#)}\n\n\n }.ElseIf(#stage# == 7){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1voting_title)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Name, Value: \"New voting\")\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1description)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Description, Type: textarea).Style(resize:vertical)\n }\n }\n Input(Name: Type, Type: hidden, Value: 1)\n Button(Class: btn btn-primary pull-right mt fa fa-play, Page: #back_page#, Contract: @1VotingWizardCreate, Params: \"TypeDecision=#buffer_value_type_decision#,CountTypeVoters=#buffer_value_count_type_voters#,TypeParticipants=#buffer_value_type_participants#,MemberParticipants=#buffer_value_member_participants#,RoleParticipants=#buffer_value_role_participants#,GroupParticipants=#buffer_value_group_participants#,Volume=#buffer_value_volume#,Quorum=#buffer_value_quorum#,Rating=#buffer_value_rating#,StartDate=#buffer_value_start_date#,StartTime=#buffer_value_start_time#,EndDate=#buffer_value_end_date#,EndTime=#buffer_value_end_time#,Name=Val(Name),Description=Val(Description),Apply=#buffer_value_apply#,Candidates=#buffer_value_candidates#,RoleId=#buffer_value_role_id#,Vacancies=#buffer_value_vacancies#,ExecuteContract=#buffer_value_execute_contract#,ContractAcceptName=#buffer_value_contract_accept_name#,ContractAcceptParams=#buffer_value_contract_accept_params#,ContractRejectName=#buffer_value_contract_reject_name#,ContractRejectParams=#buffer_value_contract_reject_params#,TextDocument=#buffer_value_text_document#\")\n Button(Class: btn btn-default pull-right mt fa fa-pause, Page: #back_page#)\n Button(Class: btn btn-default pull-right mt fa fa-chevron-left, Page: #this_page#, PageParams: \"stage=6\").Popup(50, $@1voting_wizard$)\n Div(progress-wrapper pull-right mt mr-sm text-muted){Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)Em(Class: #square-filled#)}\n }\n}.Style(\n .progress-wrapper{line-height: 33px;}\n .input-group-top{vertical-align: top;}\n .buttons{\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n)\nIf(#debug# == 1){\n Div(Class: h6 text-muted){\n Div(Body: stage = #stage#)\n Div(Body: type_decision = #buffer_value_type_decision#)\n Div(Body: type_participants = #buffer_value_type_participants#)\n Div(Body: count_type_voters = #buffer_value_count_type_voters#)\n Div(Body: volume = #buffer_value_volume#)\n Div(Body: quorum = #buffer_value_quorum#)\n Div(Body: rating = #buffer_value_rating#)\n Div(Body: start_date = #buffer_value_start_date#)\n Div(Body: start_time = #buffer_value_start_time#)\n Div(Body: end_date = #buffer_value_end_date#)\n Div(Body: end_time = #buffer_value_end_time#)\n Div(Body: voting_name = #buffer_value_voting_name#)\n Div(Body: description = #buffer_value_description#)\n\n Div(Body: member_participants = #buffer_value_member_participants#)\n Div(Body: role_participants = #buffer_value_role_participants#)\n Div(Body: group_participants = #buffer_value_group_participants#)\n\n Div(Body: execute_contract = #buffer_value_execute_contract#)\n Div(Body: contract_accept_name = #buffer_value_contract_accept_name#)\n Div(Body: contract_accept_params = #buffer_value_contract_accept_params#)\n Div(Body: contract_reject_name = #buffer_value_contract_reject_name#)\n Div(Body: contract_reject_params = #buffer_value_contract_reject_params#)\n\n Div(Body: text_document = #buffer_value_text_document#)\n\n Div(Body: candidates = #buffer_value_candidates#)\n Div(Body: apply = #buffer_value_apply#)\n Div(Body: role_id = #buffer_value_role_id#)\n Div(Body: vacancies = #buffer_value_vacancies#)\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "TokensLockoutMember", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract TokensLockoutMember {\n data {\n KeyId int\n Value int\n }\n\n func getPermission() {\n var array_permissions array result i int prevContract string\n array_permissions = [\"@1VotingRunTokenRefund\", \"@1TokensRefundAccept\", \"@1TokensRefundReject\", \"@1BlockMember\"]\n\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n while i < Len(array_permissions) {\n var contract_name string\n contract_name = array_permissions[i]\n if contract_name==prevContract {\n result = 1\n }\n i = i + 1\n }\n\n if result == 0 {\n warning LangRes(\"@1contract_chain_distorted\", \"en\")\n }\n }\n\n conditions {\n getPermission()\n\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": $KeyId}).One(\"id\") {\n warning LangRes(\"@1key_not_found\", \"en\")\n }\n\n if Int($Value) < 0 || Int($Value) > 1 {\n warning LangRes(\"@1value_between_0_and_1\", \"en\")\n }\n }\n\n action {\n DBUpdateExt(\"@1keys\", {\"ecosystem\": $ecosystem_id, \"id\": $KeyId}, {\"blocked\": $Value})\n }\n}", + "Value": "contract TokensLockoutMember {\n data {\n MemberAccount string\n Value int\n }\n\n func getPermission() {\n var array_permissions array result i int prevContract string\n array_permissions = [\"@1VotingRunTokenRefund\", \"@1TokensRefundAccept\", \"@1TokensRefundReject\", \"@1BlockMember\"]\n\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n while i < Len(array_permissions) {\n var contract_name string\n contract_name = array_permissions[i]\n if contract_name == prevContract {\n result = 1\n }\n i = i + 1\n }\n\n if result == 0 {\n warning LangRes(\"@1contract_chain_distorted\", \"en\")\n }\n }\n\n conditions {\n getPermission()\n\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": $MemberAccount, \"deleted\": 0}).One(\"account\") {\n warning LangRes(\"@1account_not_found\", \"en\")\n }\n\n if Int($Value) < 0 || Int($Value) > 1 {\n warning LangRes(\"@1value_between_0_and_1\", \"en\")\n }\n }\n\n action {\n DBUpdateExt(\"@1keys\", {\"ecosystem\": $ecosystem_id, \"account\": $MemberAccount, \"deleted\": 0}, {\"blocked\": $Value})\n }\n}", "Type": "contracts" }, { "Name": "BufferManager", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract BufferManager {\n data {\n Action string\n Key string\n Val string \"optional\"\n }\n\n func decodeArray(s string) array {\n var ar array\n if HasPrefix($buf[\"value\"], \"[\") {\n ar = JSONDecode($buf[\"value\"])\n }\n return ar\n }\n\n action {\n $emptyVal = JSONEncode(\"\")\n $buf = DBFind(\"@1buffer_data\").Where({\"ecosystem\": $ecosystem_id, \"key\": $Key, \"member_id\": $key_id}).Row()\n if !$buf {\n var buf map, id int\n id = DBInsert(\"@1buffer_data\", {ecosystem:$ecosystem_id, key:$Key, value:$emptyVal, member_id:$key_id})\n buf[\"id\"] = Str(id)\n buf[\"value\"] = \"\"\n buf[\"member_id\"] = Str($key_id)\n buf[\"key\"] = Str($Key)\n $buf = buf\n }\n var id int\n id = Int($buf[\"id\"])\n if $Action == \"clean\" {\n DBUpdate(\"@1buffer_data\", id, {value:$emptyVal})\n }\n if $Action == \"set\" {\n DBUpdate(\"@1buffer_data\", id, {value:$Val})\n }\n if $Action == \"array_add_value\" {\n var ar array enc string\n ar = decodeArray($buf[\"value\"])\n ar = Append(ar, $Val)\n enc = JSONEncode(ar)\n DBUpdate(\"@1buffer_data\", id, {value:enc})\n }\n if $Action == \"array_remove_value\" {\n var ar arNew array i int enc string\n ar = decodeArray($buf[\"value\"])\n while i < Len(ar){\n if ar[i] != $Val{\n arNew = Append(arNew, ar[i])\n }\n i = i + 1\n }\n enc = JSONEncode(arNew)\n DBUpdate(\"@1buffer_data\", id, {value:enc})\n }\n }\n}\n", + "Value": "contract BufferManager {\n data {\n Action string\n Key string\n Val string \"optional\"\n }\n\n func decodeArray(s string) array {\n var ar array\n if HasPrefix($buf[\"value\"], \"[\") {\n ar = JSONDecode($buf[\"value\"])\n }\n return ar\n }\n\n action {\n $emptyVal = JSONEncode(\"\")\n $buf = DBFind(\"@1buffer_data\").Where({\"ecosystem\": $ecosystem_id, \"key\": $Key, \"account\": $account_id}).Row()\n if !$buf {\n var buf map, id int\n id = DBInsert(\"@1buffer_data\", {ecosystem: $ecosystem_id, key: $Key, value: $emptyVal, account: $account_id})\n buf[\"id\"] = Str(id)\n buf[\"value\"] = \"\"\n buf[\"account\"] = Str($account_id)\n buf[\"key\"] = Str($Key)\n $buf = buf\n }\n var id int\n id = Int($buf[\"id\"])\n if $Action == \"clean\" {\n DBUpdate(\"@1buffer_data\", id, {value:$emptyVal})\n }\n if $Action == \"set\" {\n DBUpdate(\"@1buffer_data\", id, {value:$Val})\n }\n if $Action == \"array_add_value\" {\n var ar array enc string\n ar = decodeArray($buf[\"value\"])\n ar = Append(ar, $Val)\n enc = JSONEncode(ar)\n DBUpdate(\"@1buffer_data\", id, {value:enc})\n }\n if $Action == \"array_remove_value\" {\n var ar arNew array i int enc string\n ar = decodeArray($buf[\"value\"])\n while i < Len(ar){\n if ar[i] != $Val{\n arNew = Append(arNew, ar[i])\n }\n i = i + 1\n }\n enc = JSONEncode(arNew)\n DBUpdate(\"@1buffer_data\", id, {value:enc})\n }\n }\n}\n", "Type": "contracts" }, { @@ -728,67 +728,85 @@ { "Name": "RolesAccessCheck", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract RolesAccessCheck {\n data {\n Rid int\n }\n\n conditions {\n var role map\n role = DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": $Rid}).Columns(\"id,role_name,deleted,roles_access,role_type,creator->member_id\").Row()\n if !role {\n warning Sprintf(\"%v: \" + LangRes(\"@1role_not_found\", \"en\"), $this_contract)\n }\n\n if role[\"creator.member_id\"] == $key_id {\n return\n }\n\n var rids array\n rids = JSONDecode(role[\"roles_access\"])\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning Sprintf(LangRes(\"@1role_change_no_permission\", \"en\"), role[\"role_name\"])\n }\n }\n}", + "Value": "contract RolesAccessCheck {\n data {\n Rid int\n }\n\n conditions {\n var role map\n role = DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": $Rid}).Columns(\"id,role_name,deleted,roles_access,role_type,creator->account\").Row()\n if !role {\n warning Sprintf(\"%v: \" + LangRes(\"@1role_not_found\", \"en\"), $this_contract)\n }\n\n if role[\"creator.account\"] == $account_id {\n return\n }\n\n var rids array\n rids = JSONDecode(role[\"roles_access\"])\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning Sprintf(LangRes(\"@1role_change_no_permission\", \"en\"), role[\"role_name\"])\n }\n }\n}", + "Type": "contracts" + }, + { + "Name": "RolesUnassign", + "Conditions": "ContractConditions(\"@1DeveloperCondition\")", + "Value": "contract RolesUnassign {\n data {\n RowId int\n }\n\n conditions {\n var assigned map roleId int\n assigned = DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"id\": $RowId, \"deleted\": 0}).Columns(\"id,role->id\").Row()\n if !assigned {\n warning LangRes(\"@1role_participant_not_found\", \"en\")\n }\n var buffer_id int\n buffer_id = Int(assigned[\"role.id\"])\n roleId = Int(DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": buffer_id}).One(\"id\"))\n if roleId == 0 {\n warning LangRes(\"@1role_not_found_in_registry\", \"en\")\n }\n\n var specialRules map prev_contract string\n prev_contract = $stack[0]\n if Len($stack) > 2{\n prev_contract = $stack[Len($stack) - 2]\n }\n specialRules[\"@1VotingConsortiumMemberAccept\"] = 1\n specialRules[\"@1DelegateRefresh\"] = 1\n specialRules[\"@1ConsortiumMemberRequest\"] = 1\n specialRules[\"@1InvestorRefresh\"] = 1\n\n if specialRules[prev_contract] != 1 {\n @1RolesAccessCheck(\"Rid\", roleId)\n }\n }\n\n action {\n var m map\n m[\"deleted\"] = $block_time\n m[\"date_deleted\"] = $block_time\n DBUpdate(\"@1roles_participants\", $RowId, m)\n }\n}", + "Type": "contracts" + }, + { + "Name": "RolesAssign", + "Conditions": "ContractConditions(\"@1DeveloperCondition\")", + "Value": "contract RolesAssign {\n data {\n Rid int\n MemberAccount string\n }\n\n func getMemberInfo(account string) map {\n var res member map\n member = DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"account\": account}).Row()\n if member {\n res[\"account\"] = member[\"account\"]\n res[\"member_name\"] = member[\"member_name\"]\n res[\"image_id\"] = member[\"image_id\"]\n } else {\n if DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": account, \"deleted\": 0}).Row() {\n res[\"account\"] = account\n res[\"member_name\"] = account\n res[\"image_id\"] = \"0\"\n }\n }\n return res\n }\n\n conditions {\n $role = DBFind(\"@1roles\").Where({\"id\": $Rid}).Columns(\"id,deleted,role_type,role_name,image_id,creator->account\").Row()\n if Int($role[\"role_type\"]) == 2 {\n warning LangRes(\"@1elective_role_voting_only\", \"en\")\n }\n if !$role {\n warning LangRes(\"@1role_not_found\", \"en\")\n }\n\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": $MemberAccount, \"deleted\": 0}).Row() {\n warning LangRes(\"@1account_not_found\", \"en\")\n }\n\n if $role[\"deleted\"] == 1 {\n warning LangRes(\"@1role_deleted_request_impossible\", \"en\")\n }\n\n var specRules map prev_contract string\n prev_contract = $stack[0]\n if Len($stack) > 2{\n prev_contract = $stack[Len($stack) - 2]\n }\n specRules[\"@1VotingConsortiumMemberAccept\"] = 1\n specRules[\"@1DelegateRefresh\"] = 1\n specRules[\"@1ConsortiumMemberRequest\"] = 1\n specRules[\"@1InvestorRefresh\"] = 1\n\n if specRules[prev_contract] != 1 {\n @1RolesAccessCheck(\"Rid\", $Rid)\n }\n }\n\n action {\n if DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": $Rid, \"member->account\": $MemberAccount, \"deleted\": 0}).One(\"id\") {\n // do not re-assign and do not warning because this contract may be called for other\n return\n }\n var role member appointer map\n role[\"id\"] = $role[\"id\"]\n role[\"type\"] = $role[\"role_type\"]\n role[\"name\"] = $role[\"role_name\"]\n role[\"image_id\"] = $role[\"image_id\"]\n\n member = getMemberInfo($MemberAccount)\n appointer = getMemberInfo($account_id)\n var m map\n m[\"role\"] = role\n m[\"member\"] = member\n m[\"appointed\"] = appointer\n m[\"date_created\"] = $block_time\n m[\"ecosystem\"] = $ecosystem_id\n DBInsert(\"@1roles_participants\", m)\n }\n}", + "Type": "contracts" + }, + { + "Name": "ConsortiumMemberDelete", + "Conditions": "ContractConditions(\"@1DeveloperCondition\")", + "Value": "contract ConsortiumMemberDelete {\n data {\n Id int\n }\n\n conditions {\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n var roleId int candidateAccount string\n roleId = Int(AppParam(Int($system_app_id), \"role_consortium_member_candidate\", $ecosystem_id))\n candidateAccount = DBFind(\"@1consortium_member_requests\").Where({\"ecosystem\": $ecosystem_id, \"id\": $Id}).One(\"candidate_account\")\n\n $role = DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"deleted\": 0, \"role->id\": roleId, \"member->account\": candidateAccount}).Row()\n if !$role {\n warning LangRes(\"@1candidate_role_not_found\", \"en\")\n }\n }\n\n action {\n DBUpdate(\"@1consortium_member_requests\", $Id, {\"deleted\": 1})\n @1RolesUnassign(\"RowId\", Int($role[\"id\"]))\n }\n}", "Type": "contracts" }, { "Name": "DeleteMember", "Conditions": "ContractConditions(\"@1AdminCondition\")", - "Value": "contract DeleteMember {\n data {\n KeyId int\n }\n\n func getPermission() {\n var array_permissions array result i int prevContract string\n array_permissions = [\"@1DeleteMember\"]\n\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n while i < Len(array_permissions) {\n var contract_name string\n contract_name = array_permissions[i]\n if contract_name==prevContract {\n result = 1\n }\n i = i + 1\n }\n\n if result == 0 {\n warning LangRes(\"@1contract_chain_distorted\", \"en\")\n }\n }\n\n conditions {\n ContractConditions(\"@1AdminCondition\")\n\n getPermission()\n\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": $KeyId}).One(\"id\"){\n warning LangRes(\"@1key_not_found\", \"en\")\n }\n }\n\n action {\n DBUpdateExt(\"@1keys\", {\"ecosystem\": $ecosystem_id, \"id\": $KeyId}, {\"deleted\": 1})\n }\n}", + "Value": "contract DeleteMember {\n data {\n MemberAccount string\n }\n\n func getPermission() {\n var array_permissions array result i int prevContract string\n array_permissions = [\"@1DeleteMember\"]\n\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n while i < Len(array_permissions) {\n var contract_name string\n contract_name = array_permissions[i]\n if contract_name == prevContract {\n result = 1\n }\n i = i + 1\n }\n\n if result == 0 {\n warning LangRes(\"@1contract_chain_distorted\", \"en\")\n }\n }\n\n conditions {\n ContractConditions(\"@1AdminCondition\")\n\n getPermission()\n\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": $MemberAccount}).One(\"account\"){\n warning LangRes(\"@1account_not_found\", \"en\")\n }\n }\n\n action {\n DBUpdateExt(\"@1keys\", {\"ecosystem\": $ecosystem_id, \"account\": $MemberAccount}, {\"deleted\": 1})\n }\n}", "Type": "contracts" }, { "Name": "FormStateSave", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract FormStateSave {\n data {\n FormName string\n ParamNames string\n Param1 string \"optional\"\n Param2 string \"optional\"\n Param3 string \"optional\"\n Param4 string \"optional\"\n Param5 string \"optional\"\n Param6 string \"optional\"\n Param7 string \"optional\"\n Param8 string \"optional\"\n Param9 string \"optional\"\n Param10 string \"optional\"\n Param11 string \"optional\"\n Param12 string \"optional\"\n Param13 string \"optional\"\n Param14 string \"optional\"\n Param15 string \"optional\"\n Param16 string \"optional\"\n Param17 string \"optional\"\n Param18 string \"optional\"\n Param19 string \"optional\"\n Param20 string \"optional\"\n }\n\n conditions {\n if $FormName == \"\" {\n warning LangRes(\"@1form_state_name_needed\", \"en\")\n }\n if $ParamNames == \"\" {\n warning LangRes(\"@1form_state_param_names_needed\", \"en\")\n }\n }\n\n action {\n var values string\n values = $Param1+\";\"+$Param2+\";\"+ $Param3+\";\"+ $Param4+\";\"+ $Param5+\";\"+ $Param6+\";\"+$Param7+\";\"+$Param8+\";\"+$Param9+\";\"+$Param10+\";\"+$Param11+\";\"+$Param12+\";\"+$Param13+\";\"+ $Param14+\";\"+ $Param15+\";\"+ $Param16+\";\"+$Param17+\";\"+$Param18+\";\"+$Param19+\";\"+$Param20\n $ParamValue = Split(values, \";\")\n $ParamName = Split($ParamNames, \";\")\n var buffer_data map, i int\n i = 0\n while i < Len($ParamName) {\n buffer_data[$ParamName[i]] = $ParamValue[i]\n i = i + 1\n }\n @1BufferManager(\"Action,Key,Val\", \"set\", $FormName, JSONEncode(buffer_data))\n }\n}", + "Value": "contract FormStateSave {\n data {\n FormName string\n ParamNames string\n Param1 string \"optional\"\n Param2 string \"optional\"\n Param3 string \"optional\"\n Param4 string \"optional\"\n Param5 string \"optional\"\n Param6 string \"optional\"\n Param7 string \"optional\"\n Param8 string \"optional\"\n Param9 string \"optional\"\n Param10 string \"optional\"\n Param11 string \"optional\"\n Param12 string \"optional\"\n Param13 string \"optional\"\n Param14 string \"optional\"\n Param15 string \"optional\"\n Param16 string \"optional\"\n Param17 string \"optional\"\n Param18 string \"optional\"\n Param19 string \"optional\"\n Param20 string \"optional\"\n }\n\n conditions {\n if $FormName == \"\" {\n warning LangRes(\"@1form_state_name_needed\", \"en\")\n }\n if $ParamNames == \"\" {\n warning LangRes(\"@1form_state_param_names_needed\", \"en\")\n }\n }\n\n action {\n var val_array array\n val_array = [$Param1,$Param2,$Param3,$Param4,$Param5,$Param6,$Param7,$Param8,$Param9,$Param10,$Param11,$Param12,$Param13,$Param14,$Param15,$Param16,$Param17,$Param18,$Param19,$Param20]\n $ParamName = Split($ParamNames, \";\")\n var buffer_data map, i int\n i = 0\n while i < Len($ParamName) {\n buffer_data[$ParamName[i]] = val_array[i]\n i = i + 1\n }\n @1BufferManager(\"Action,Key,Val\", \"set\", $FormName, JSONEncode(buffer_data))\n }\n}", "Type": "contracts" }, { "Name": "GroupsAccessCheck", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract GroupsAccessCheck {\n data {\n GroupId int\n }\n\n conditions {\n var group map\n group = DBFind(\"@1groups\").Where({\"ecosystem\": $ecosystem_id, \"id\": $GroupId}).Columns(\"id,group_name,deleted,group_access,creator->member_id\").Row()\n if !group {\n warning Sprintf(\"%v: \" + \"group not found\", $this_contract)\n }\n\n if group[\"creator.member_id\"] == $key_id {\n return\n }\n\n var gr_ids array\n gr_ids = JSONDecode(group[\"group_access\"])\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": gr_ids}, \"member->member_id\":$key_id, \"deleted\": 0}).Row() {\n warning Sprintf(LangRes(\"@1group_change_no_permission\", \"en\"), group[\"group_name\"])\n }\n }\n}", + "Value": "contract GroupsAccessCheck {\n data {\n GroupId int\n }\n\n conditions {\n var group map\n group = DBFind(\"@1groups\").Where({\"ecosystem\": $ecosystem_id, \"id\": $GroupId}).Columns(\"id,group_name,deleted,group_access,creator->account\").Row()\n if !group {\n warning Sprintf(\"%v: \" + \"group not found\", $this_contract)\n }\n\n if group[\"creator.account\"] == $account_id {\n return\n }\n\n var gr_ids array\n gr_ids = JSONDecode(group[\"group_access\"])\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": gr_ids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning Sprintf(LangRes(\"@1group_change_no_permission\", \"en\"), group[\"group_name\"])\n }\n }\n}", "Type": "contracts" }, { "Name": "NotificationsProcess", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract NotificationsProcess {\n data {\n NotificId int\n }\n\n func getMemberInfo(kid int) map {\n var res member map\n member = DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"id\": kid}).Row()\n if member {\n res[\"member_id\"] = member[\"id\"]\n res[\"member_name\"] = member[\"member_name\"]\n res[\"image_id\"] = member[\"image_id\"]\n } else {\n member = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": kid}).Row()\n if member {\n res[\"member_id\"] = member[\"id\"]\n res[\"member_name\"] = IdToAddress(Int(member[\"id\"]))\n res[\"image_id\"] = 0\n }\n }\n return res\n }\n\n conditions {\n $notify = DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"id\": $NotificId}).Columns(\"recipient->role_id,sender->type,date_start_processing\").Row()\n if !$notify {\n warning LangRes(\"@1notification_not_found\", \"en\")\n }\n\n if $notify[\"sender.type\"] == 2 {\n if Int($notify[\"date_start_processing\"]) != 0 {\n warning LangRes(\"@1notification_processing_started_already\", \"en\")\n }\n var rid string\n rid = Int($notify[\"recipient.role_id\"])\n if rid > 0{\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": rid, \"member->member_id\": $key_id, \"deleted\": 0}).One(\"id\") {\n warning LangRes(\"@1notification_not_part_of_role\", \"en\")\n }\n }\n } else {\n if $notify[\"sender.type\"] != 1 {\n warning LangRes(\"@1notification_type_not_found\", \"en\")\n }\n }\n }\n\n action {\n var model map\n model[\"processing_info\"] = getMemberInfo($key_id)\n model[\"date_start_processing\"] = $block_time\n DBUpdate(\"@1notifications\", $NotificId, model)\n }\n}", + "Value": "contract NotificationsProcess {\n data {\n NotificId int\n }\n\n func getMemberInfo(account string) map {\n var res member map\n member = DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"account\": account}).Row()\n if member {\n res[\"account\"] = member[\"account\"]\n res[\"member_name\"] = member[\"member_name\"]\n res[\"image_id\"] = member[\"image_id\"]\n } else {\n if DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": account, \"deleted\": 0}).Row() {\n res[\"account\"] = account\n res[\"member_name\"] = account\n res[\"image_id\"] = \"0\"\n }\n }\n return res\n }\n\n conditions {\n $notify = DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"id\": $NotificId}).Columns(\"recipient->role_id,sender->type,date_start_processing\").Row()\n if !$notify {\n warning LangRes(\"@1notification_not_found\", \"en\")\n }\n\n if $notify[\"sender.type\"] == 2 {\n if Int($notify[\"date_start_processing\"]) != 0 {\n warning LangRes(\"@1notification_processing_started_already\", \"en\")\n }\n var rid string\n rid = Int($notify[\"recipient.role_id\"])\n if rid > 0{\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": rid, \"member->account\": $account_id, \"deleted\": 0}).One(\"id\") {\n warning LangRes(\"@1notification_not_part_of_role\", \"en\")\n }\n }\n } else {\n if $notify[\"sender.type\"] != 1 {\n warning LangRes(\"@1notification_type_not_found\", \"en\")\n }\n }\n }\n\n action {\n var model map\n model[\"processing_info\"] = getMemberInfo($account_id)\n model[\"date_start_processing\"] = $block_time\n DBUpdate(\"@1notifications\", $NotificId, model)\n }\n}", "Type": "contracts" }, { "Name": "NotificationsSend", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract NotificationsSend {\n data {\n MemberId int \"optional\"\n Rid int \"optional\"\n GroupId int \"optional\"\n Closure int \"optional\"\n Sender int\n Icon string \"optional\"\n Header string\n Body string \"optional\"\n Page string\n Params string // json encoded expected\n CurrentRid int \"optional\"\n EcosystemId int \"optional\"\n Popup string \"optional\"\n }\n\n func getMemberInfo(kid, ecoId int) map {\n var res member map\n member = DBFind(\"@1members\").Where({\"ecosystem\": ecoId, \"id\": kid}).Row()\n if member {\n res[\"member_id\"] = member[\"id\"]\n res[\"member_name\"] = member[\"member_name\"]\n res[\"image_id\"] = member[\"image_id\"]\n } else {\n if DBFind(\"@1keys\").Where({\"ecosystem\": ecoId, \"id\": kid}).Columns(\"id\").Row() {\n res[\"member_id\"] = Str(kid)\n res[\"member_name\"] = IdToAddress(kid)\n res[\"image_id\"] = \"0\"\n }\n }\n return res\n }\n\n func sendNotify(recipient map) {\n var notification map\n notification[\"header\"] = $Header\n notification[\"type\"] = $notify_type\n notification[\"icon\"] = $Icon\n notification[\"body\"] = $Body\n if $Popup == \"true\" || $Popup == \"1\" {\n notification[\"popup\"] = 1\n } else {\n notification[\"popup\"] = 0\n }\n var sender map\n if $Sender == 1 && $senderMember {\n // send from member\n sender[\"type\"] = $Sender\n sender[\"member_id\"] = $senderMember[\"member_id\"]\n sender[\"member_name\"] = $senderMember[\"member_name\"]\n sender[\"image_id\"] = $senderMember[\"image_id\"]\n } else {\n if $Sender == 2 && $senderRole {\n // send from role\n sender[\"type\"] = $Sender\n sender[\"role_id\"] = $senderRole[\"id\"]\n sender[\"role_name\"] = $senderRole[\"role_name\"]\n sender[\"image_id\"] = $senderRole[\"image_id\"]\n }\n }\n var model map\n model[\"recipient\"] = recipient\n model[\"sender\"] = sender\n model[\"notification\"] = notification\n model[\"page_name\"] = $Page\n model[\"page_params\"] = $Params\n model[\"date_created\"] = $block_time\n model[\"ecosystem\"] = $EcosystemId\n DBInsert(\"@1notifications\", model)\n }\n\n func sendToRole(roleId, ecoId int) {\n var role recipient map\n role = DBFind(\"@1roles\").Where({\"ecosystem\": ecoId, \"id\": roleId}).Row()\n recipient[\"role_id\"] = role[\"id\"]\n recipient[\"role_name\"] = role[\"role_name\"]\n recipient[\"image_id\"] = role[\"image_id\"]\n sendNotify(recipient)\n }\n\n conditions {\n if $EcosystemId == 0 {\n $EcosystemId = $ecosystem_id\n }\n $MemberId = Int($MemberId)\n if Size($Icon) < 1 {\n $Icon = \"icon-envelope\"\n }\n if $MemberId != 0 {\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $EcosystemId, \"id\": $MemberId}).Row() {\n warning LangRes(\"@1key_not_found\", \"en\")\n }\n $notify_type = 1\n } elif $Rid > 0 {\n $notify_type = 2\n if !DBFind(\"@1roles\").Where({\"ecosystem\": $EcosystemId, \"id\": $Rid}).One(\"id\") {\n warning $this_contract + \": \" + LangRes(\"@1recipient_role_not_found\", \"en\")\n }\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $EcosystemId, \"role->id\": $Rid, \"deleted\": 0}).One(\"id\") {\n warning $this_contract + \": \" + LangRes(\"@1recipient_role_no_members\", \"en\")\n }\n } elif $GroupId > 0 {\n $notify_type = 1\n if !DBFind(\"@1groups\").Where({\"ecosystem\": $EcosystemId, \"id\": $GroupId}).One(\"id\") {\n warning $this_contract + \": \" + LangRes(\"@1recipient_group_not_found\", \"en\")\n }\n if !DBFind(\"@1groups_participants\").Where({\"ecosystem\": $EcosystemId, \"groups_info->id\": $GroupId, \"deleted\": 0}).One(\"id\") {\n warning $this_contract + \": \" + LangRes(\"@1recipient_group_no_members\", \"en\")\n }\n } else {\n warning $this_contract + \": \" + LangRes(\"@1notification_type_not_defined\", \"en\")\n }\n $senderMember = nil\n $senderRole = nil\n if $Sender == 1 {\n $senderMember = getMemberInfo($key_id, $ecosystem_id)\n } elif $Sender == 2 {\n if !RoleAccess($CurrentRid) {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n $senderRole = DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": $CurrentRid}).Row()\n if !$senderRole {\n warning $this_contract + \": \" + LangRes(\"@1sender_role_not_found\", \"en\")\n }\n } else {\n warning $this_contract + \": \" + LangRes(\"@1sender_invalid\", \"en\")\n }\n }\n\n action {\n if $MemberId != 0 {\n sendNotify(getMemberInfo($MemberId, $EcosystemId))\n UpdateNotifications($EcosystemId, Int($MemberId))\n } elif $Rid > 0 {\n if $Closure == 1 {\n // Single closure: one begins the process - the others do not see\n sendToRole($Rid, $EcosystemId)\n UpdateRolesNotifications($EcosystemId, Int($Rid))\n } else {\n // Multiple closure: to each his own notification\n $notify_type = 1\n var participants array\n participants = DBFind(\"@1roles_participants\").Where({\"ecosystem\": $EcosystemId, \"role->id\": $Rid, \"deleted\": 0}).Columns(\"member->member_id\")\n var i int\n while i < Len(participants) {\n var p map\n p = participants[i]\n sendNotify(getMemberInfo(Int(p[\"member.member_id\"]), $EcosystemId))\n UpdateNotifications($EcosystemId, Int(p[\"member.member_id\"]))\n i = i + 1\n }\n }\n } elif $GroupId > 0 {\n var participants array\n participants = DBFind(\"@1groups_participants\").Where({\"ecosystem\": $EcosystemId, \"groups_info->id\": $GroupId, \"deleted\": 0}).Columns(\"member->member_id\")\n var i int\n while i < Len(participants) {\n var p map\n p = participants[i]\n sendNotify(getMemberInfo(Int(p[\"member.member_id\"]), $EcosystemId))\n UpdateNotifications($EcosystemId, Int(p[\"member.member_id\"]))\n i = i + 1\n }\n }\n }\n}", + "Value": "contract NotificationsSend {\n data {\n MemberAccount string \"optional\"\n Rid int \"optional\"\n GroupId int \"optional\"\n Closure int \"optional\"\n Sender int\n Icon string \"optional\"\n Header string\n Body string \"optional\"\n Page string\n Params string // json encoded expected\n CurrentRid int \"optional\"\n EcosystemId int \"optional\"\n Popup string \"optional\"\n }\n\n func getMemberInfo(account string, ecoId int) map {\n var res member map\n member = DBFind(\"@1members\").Where({\"ecosystem\": ecoId, \"account\": account}).Row()\n if member {\n res[\"account\"] = member[\"account\"]\n res[\"member_name\"] = member[\"member_name\"]\n res[\"image_id\"] = member[\"image_id\"]\n } else {\n if DBFind(\"@1keys\").Where({\"ecosystem\": ecoId, \"account\": account, \"deleted\": 0}).Row() {\n res[\"account\"] = account\n res[\"member_name\"] = account\n res[\"image_id\"] = \"0\"\n }\n }\n return res\n }\n\n func sendNotify(recipient map) {\n var notification map\n notification[\"header\"] = $Header\n notification[\"type\"] = $notify_type\n notification[\"icon\"] = $Icon\n notification[\"body\"] = $Body\n if $Popup == \"true\" || $Popup == \"1\" {\n notification[\"popup\"] = 1\n } else {\n notification[\"popup\"] = 0\n }\n var sender map\n if $Sender == 1 && $senderMember {\n // send from member\n sender[\"type\"] = $Sender\n sender[\"account\"] = $senderMember[\"account\"]\n sender[\"member_name\"] = $senderMember[\"member_name\"]\n sender[\"image_id\"] = $senderMember[\"image_id\"]\n } else {\n if $Sender == 2 && $senderRole {\n // send from role\n sender[\"type\"] = $Sender\n sender[\"role_id\"] = $senderRole[\"id\"]\n sender[\"role_name\"] = $senderRole[\"role_name\"]\n sender[\"image_id\"] = $senderRole[\"image_id\"]\n }\n }\n var model map\n model[\"recipient\"] = recipient\n model[\"sender\"] = sender\n model[\"notification\"] = notification\n model[\"page_name\"] = $Page\n model[\"page_params\"] = $Params\n model[\"date_created\"] = $block_time\n model[\"ecosystem\"] = $EcosystemId\n DBInsert(\"@1notifications\", model)\n }\n\n func sendToRole(roleId, ecoId int) {\n var role recipient map\n role = DBFind(\"@1roles\").Where({\"ecosystem\": ecoId, \"id\": roleId}).Row()\n recipient[\"role_id\"] = role[\"id\"]\n recipient[\"role_name\"] = role[\"role_name\"]\n recipient[\"image_id\"] = role[\"image_id\"]\n sendNotify(recipient)\n }\n\n conditions {\n if $EcosystemId == 0 {\n $EcosystemId = $ecosystem_id\n }\n if Size($Icon) < 1 {\n $Icon = \"icon-envelope\"\n }\n if $MemberAccount && $MemberAccount != \"0\" {\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $EcosystemId, \"account\": $MemberAccount, \"deleted\": 0}).Row() {\n warning LangRes(\"@1account_not_found\", \"en\")\n }\n $notify_type = 1\n } elif $Rid > 0 {\n $notify_type = 2\n if !DBFind(\"@1roles\").Where({\"ecosystem\": $EcosystemId, \"id\": $Rid}).One(\"id\") {\n warning $this_contract + \": \" + LangRes(\"@1recipient_role_not_found\", \"en\")\n }\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $EcosystemId, \"role->id\": $Rid, \"deleted\": 0}).One(\"id\") {\n warning $this_contract + \": \" + LangRes(\"@1recipient_role_no_members\", \"en\")\n }\n } elif $GroupId > 0 {\n $notify_type = 1\n if !DBFind(\"@1groups\").Where({\"ecosystem\": $EcosystemId, \"id\": $GroupId}).One(\"id\") {\n warning $this_contract + \": \" + LangRes(\"@1recipient_group_not_found\", \"en\")\n }\n if !DBFind(\"@1groups_participants\").Where({\"ecosystem\": $EcosystemId, \"groups_info->id\": $GroupId, \"deleted\": 0}).One(\"id\") {\n warning $this_contract + \": \" + LangRes(\"@1recipient_group_no_members\", \"en\")\n }\n } else {\n warning $this_contract + \": \" + LangRes(\"@1notification_type_not_defined\", \"en\")\n }\n $senderMember = nil\n $senderRole = nil\n if $Sender == 1 {\n $senderMember = getMemberInfo($account_id, $ecosystem_id)\n } elif $Sender == 2 {\n if !RoleAccess($CurrentRid) {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n $senderRole = DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": $CurrentRid}).Row()\n if !$senderRole {\n warning $this_contract + \": \" + LangRes(\"@1sender_role_not_found\", \"en\")\n }\n } else {\n warning $this_contract + \": \" + LangRes(\"@1sender_invalid\", \"en\")\n }\n }\n\n action {\n if $MemberAccount && $MemberAccount != \"0\" {\n sendNotify(getMemberInfo($MemberAccount, $EcosystemId))\n UpdateNotifications($EcosystemId, $MemberAccount)\n } elif $Rid > 0 {\n if $Closure == 1 {\n // Single closure: one begins the process - the others do not see\n sendToRole($Rid, $EcosystemId)\n UpdateRolesNotifications($EcosystemId, Int($Rid))\n } else {\n // Multiple closure: to each his own notification\n $notify_type = 1\n var participants array\n participants = DBFind(\"@1roles_participants\").Where({\"ecosystem\": $EcosystemId, \"role->id\": $Rid, \"deleted\": 0}).Columns(\"member->account\")\n var i int\n while i < Len(participants) {\n var p map\n p = participants[i]\n sendNotify(getMemberInfo(p[\"member.account\"], $EcosystemId))\n UpdateNotifications($EcosystemId, p[\"member.account\"])\n i = i + 1\n }\n }\n } elif $GroupId > 0 {\n var participants array\n participants = DBFind(\"@1groups_participants\").Where({\"ecosystem\": $EcosystemId, \"groups_info->id\": $GroupId, \"deleted\": 0}).Columns(\"member->account\")\n var i int\n while i < Len(participants) {\n var p map\n p = participants[i]\n sendNotify(getMemberInfo(p[\"member.account\"], $EcosystemId))\n UpdateNotifications($EcosystemId, p[\"member.account\"])\n i = i + 1\n }\n }\n }\n}", "Type": "contracts" }, { "Name": "GroupAccessManager", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract GroupAccessManager {\n data {\n Action string\n ManagerRid string \"optional\"\n GroupId int \"optional\"\n GroupName string \"optional\"\n GroupType int \"optional\"\n GroupInfo string \"optional\"\n }\n\n func updateAccess(ra array) {\n var group_access string\n group_access = JSONEncode(ra)\n DBUpdate(\"@1groups\", $GroupId, {\"group_access\": group_access})\n }\n\n func updateBufferAccess(ra array) {\n var groups_access string\n groups_access = JSONEncode(ra)\n var filled map\n filled[\"groups_access\"] = groups_access\n filled[\"group_name\"] = $GroupName\n filled[\"group_type\"] = $GroupType\n filled[\"group_information\"] = $GroupInfo\n if !$buffer_id {\n DBInsert(\"@1buffer_data\", {\"ecosystem\": $ecosystem_id, \"member_id\": $key_id, \"key\": \"group_access\", \"value\": filled})\n } else {\n DBUpdate(\"@1buffer_data\", Int($buffer_id), {\"value\": filled})\n }\n }\n\n conditions {\n $ManagerRid = Int($ManagerRid)\n if $GroupId > 0 {\n @1GroupsAccessCheck(\"GroupId\", $GroupId)\n $role = DBFind(\"@1groups\").Where({\"ecosystem\": $ecosystem_id, \"id\": $GroupId}).Columns(\"id,group_access\").Row()\n if !$role {\n warning LangRes(\"@1group\" \"@1not_founded\", \"en\")\n }\n if $ManagerRid > 0 {\n if !DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": $ManagerRid}).One(\"id\") {\n warning LangRes(\"@1role_not_found\", \"en\")\n }\n }\n var ids array, i int\n $ids = ids\n ids = JSONDecode($role[\"group_access\"])\n while i < Len(ids){\n if ids[i] > 0 {\n $ids = Append($ids, ids[i])\n }\n i = i + 1\n }\n } else {\n $buffer_managers = 0\n $buffer_id = 0\n $ids = []\n var buffer map\n buffer = DBFind(\"@1buffer_data\").Where({\"ecosystem\": $ecosystem_id, \"member_id\": $key_id, \"key\": \"group_access\"}).Columns(\"id,value,value->groups_access\").Row()\n if buffer {\n $buffer_managers = buffer[\"value.groups_access\"]\n $buffer_id = buffer[\"id\"]\n }\n }\n }\n\n action {\n if $GroupId == 0 {\n if $buffer_managers {\n $ids = JSONDecode($buffer_managers)\n }\n }\n if $ManagerRid > 0 {\n var i int idsNew array\n if $Action == \"remove\" {\n while i < Len($ids) {\n if $ids[i] != $ManagerRid{\n idsNew = Append(idsNew, $ids[i])\n }\n i = i + 1\n }\n if $GroupId == 0 {\n updateBufferAccess(idsNew)\n } else {\n updateAccess(idsNew)\n }\n }\n if $Action == \"add\" {\n var double bool\n while i < Len($ids) {\n if $ids[i] == $ManagerRid{\n double = true\n }\n i = i + 1\n }\n if !double {\n $ids = Append($ids, $ManagerRid)\n }\n if $GroupId == 0 {\n updateBufferAccess($ids)\n } else {\n updateAccess($ids)\n }\n }\n }\n }\n}", + "Value": "contract GroupAccessManager {\n data {\n Action string\n ManagerRid string \"optional\"\n GroupId int \"optional\"\n GroupName string \"optional\"\n GroupType int \"optional\"\n GroupInfo string \"optional\"\n }\n\n func updateAccess(ra array) {\n var group_access string\n group_access = JSONEncode(ra)\n DBUpdate(\"@1groups\", $GroupId, {\"group_access\": group_access})\n }\n\n func updateBufferAccess(ra array) {\n var groups_access string\n groups_access = JSONEncode(ra)\n var filled map\n filled[\"groups_access\"] = groups_access\n filled[\"group_name\"] = $GroupName\n filled[\"group_type\"] = $GroupType\n filled[\"group_information\"] = $GroupInfo\n if !$buffer_id {\n DBInsert(\"@1buffer_data\", {\"ecosystem\": $ecosystem_id, \"account\": $account_id, \"key\": \"group_access\", \"value\": filled})\n } else {\n DBUpdate(\"@1buffer_data\", Int($buffer_id), {\"value\": filled})\n }\n }\n\n conditions {\n $ManagerRid = Int($ManagerRid)\n if $GroupId > 0 {\n @1GroupsAccessCheck(\"GroupId\", $GroupId)\n $role = DBFind(\"@1groups\").Where({\"ecosystem\": $ecosystem_id, \"id\": $GroupId}).Columns(\"id,group_access\").Row()\n if !$role {\n warning LangRes(\"@1group\" \"@1not_founded\", \"en\")\n }\n if $ManagerRid > 0 {\n if !DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": $ManagerRid}).One(\"id\") {\n warning LangRes(\"@1role_not_found\", \"en\")\n }\n }\n var ids array, i int\n $ids = ids\n ids = JSONDecode($role[\"group_access\"])\n while i < Len(ids){\n if ids[i] > 0 {\n $ids = Append($ids, ids[i])\n }\n i = i + 1\n }\n } else {\n $buffer_managers = 0\n $buffer_id = 0\n $ids = []\n var buffer map\n buffer = DBFind(\"@1buffer_data\").Where({\"ecosystem\": $ecosystem_id, \"account\": $account_id, \"key\": \"group_access\"}).Columns(\"id,value,value->groups_access\").Row()\n if buffer {\n $buffer_managers = buffer[\"value.groups_access\"]\n $buffer_id = buffer[\"id\"]\n }\n }\n }\n\n action {\n if $GroupId == 0 {\n if $buffer_managers {\n $ids = JSONDecode($buffer_managers)\n }\n }\n if $ManagerRid > 0 {\n var i int idsNew array\n if $Action == \"remove\" {\n while i < Len($ids) {\n if $ids[i] != $ManagerRid{\n idsNew = Append(idsNew, $ids[i])\n }\n i = i + 1\n }\n if $GroupId == 0 {\n updateBufferAccess(idsNew)\n } else {\n updateAccess(idsNew)\n }\n }\n if $Action == \"add\" {\n var double bool\n while i < Len($ids) {\n if $ids[i] == $ManagerRid{\n double = true\n }\n i = i + 1\n }\n if !double {\n $ids = Append($ids, $ManagerRid)\n }\n if $GroupId == 0 {\n updateBufferAccess($ids)\n } else {\n updateAccess($ids)\n }\n }\n }\n }\n}", "Type": "contracts" }, { "Name": "GroupsAssign", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract GroupsAssign {\n data {\n GroupId int\n MemberId int\n }\n\n func getMemberInfo(kid int) map {\n var res member map\n member = DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"id\": kid}).Row()\n if member {\n res[\"member_id\"] = member[\"id\"]\n res[\"member_name\"] = member[\"member_name\"]\n res[\"image_id\"] = member[\"image_id\"]\n } else {\n member = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": kid}).Row()\n if member {\n res[\"member_id\"] = member[\"id\"]\n res[\"member_name\"] = IdToAddress(Int(member[\"id\"]))\n res[\"image_id\"] = 0\n }\n }\n return res\n }\n\n conditions {\n $group = DBFind(\"@1groups\").Where({\"id\": $GroupId}).Columns(\"id,deleted,group_type,group_name,image_id,creator->member_id\").Row()\n if !$group {\n warning LangRes(\"@1group_not_found\", \"en\")\n }\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": $MemberId}).Row() {\n warning LangRes(\"@1key_not_found\", \"en\")\n }\n if Int($group[\"deleted\"]) == 1 {\n warning LangRes(\"@1group_deleted_request_impossible\", \"en\")\n }\n if Int($group[\"group_type\"]) != 1 {\n @1GroupsAccessCheck(\"GroupId\", $GroupId)\n }\n }\n\n action {\n if DBFind(\"@1groups_participants\").Where({\"ecosystem\": $ecosystem_id, \"groups_info->id\": $GroupId, \"member->member_id\": $MemberId, \"deleted\": 0}).One(\"id\") {\n // do not re-assign and do not warning because this contract may be called for other\n return\n }\n\n var group member appointer map\n group[\"id\"] = $group[\"id\"]\n group[\"type\"] = $group[\"group_type\"]\n group[\"name\"] = $group[\"group_name\"]\n group[\"image_id\"] = $group[\"image_id\"]\n member = getMemberInfo($MemberId)\n appointer = getMemberInfo($key_id)\n\n var m map\n m[\"groups_info\"] = group\n m[\"member\"] = member\n m[\"appointed\"] = appointer\n m[\"date_created\"] = $block_time\n m[\"ecosystem\"] = $ecosystem_id\n DBInsert(\"@1groups_participants\", m)\n }\n}", + "Value": "contract GroupsAssign {\n data {\n GroupId int\n MemberAccount string\n }\n\n func getMemberInfo(account string) map {\n var res member map\n member = DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"account\": account}).Row()\n if member {\n res[\"account\"] = member[\"account\"]\n res[\"member_name\"] = member[\"member_name\"]\n res[\"image_id\"] = member[\"image_id\"]\n } else {\n if DBFind(\"@1keys\").Columns(\"id\").Where({\"ecosystem\": $ecosystem_id, \"account\": account, \"deleted\": 0}).Row() {\n res[\"account\"] = account\n res[\"member_name\"] = account\n res[\"image_id\"] = \"0\"\n }\n }\n return res\n }\n\n conditions {\n $group = DBFind(\"@1groups\").Where({\"id\": $GroupId}).Columns(\"id,deleted,group_type,group_name,image_id,creator->account\").Row()\n if !$group {\n warning LangRes(\"@1group_not_found\", \"en\")\n }\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": $MemberAccount, \"deleted\": 0}).Row() {\n warning LangRes(\"@1account_not_found\", \"en\")\n }\n if Int($group[\"deleted\"]) == 1 {\n warning LangRes(\"@1group_deleted_request_impossible\", \"en\")\n }\n if Int($group[\"group_type\"]) != 1 {\n @1GroupsAccessCheck(\"GroupId\", $GroupId)\n }\n }\n\n action {\n if DBFind(\"@1groups_participants\").Where({\"ecosystem\": $ecosystem_id, \"groups_info->id\": $GroupId, \"member->account\": $MemberAccount, \"deleted\": 0}).One(\"id\") {\n // do not re-assign and do not warning because this contract may be called for other\n return\n }\n\n var group member appointer map\n group[\"id\"] = $group[\"id\"]\n group[\"type\"] = $group[\"group_type\"]\n group[\"name\"] = $group[\"group_name\"]\n group[\"image_id\"] = $group[\"image_id\"]\n member = getMemberInfo($MemberAccount)\n appointer = getMemberInfo($account_id)\n\n var m map\n m[\"groups_info\"] = group\n m[\"member\"] = member\n m[\"appointed\"] = appointer\n m[\"date_created\"] = $block_time\n m[\"ecosystem\"] = $ecosystem_id\n DBInsert(\"@1groups_participants\", m)\n }\n}", "Type": "contracts" }, { "Name": "GroupsAssignList", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract GroupsAssignList {\n data {\n Keys string\n GroupId int\n }\n\n func addPub(pub_key string) {\n if HasPrefix(pub_key, \"04\") {\n pub_key = Substr(pub_key, 2, Size(pub_key) - 2)\n }\n if Size(pub_key) < 128 {\n warning LangRes(\"@1key_too_short\", \"en\")\n }\n if Size(pub_key) > 128 {\n warning LangRes(\"@1key_too_long\", \"en\")\n }\n\n var k_id int\n k_id = PubToID(pub_key)\n if k_id == 0 {\n warning LangRes(\"@1public_key_invalid\", \"en\")\n }\n $check_user = DBFind(\"@1keys\").Where({\"id\": k_id, \"ecosystem\": $ecosystem_id})\n if !$check_user {\n warning Sprintf(\"%v: \" + \"key not found\", pub_key)\n }\n\n @1GroupsAssign(\"GroupId,MemberId\",$GroupId,k_id)\n }\n\n conditions {\n if $Keys == \"\" {\n warning LangRes(\"@1public_key_empty\", \"en\")\n }\n $Keys = Replace($Keys, \" \", \"\")\n $Keys = Replace($Keys, \"\\n\", \"\")\n $Keys = Replace($Keys, \"\\r\", \"\")\n }\n\n action {\n if Contains($Keys, \",\") {\n var pub_array array i int\n pub_array = Split($Keys, \",\")\n while i < Len(pub_array) {\n var pub_key string\n pub_key = Str(pub_array[i])\n addPub(pub_key)\n i = i + 1\n }\n } else {\n addPub($Keys)\n }\n }\n}", + "Value": "contract GroupsAssignList {\n data {\n Keys string\n GroupId int\n }\n\n func addPub(pub_key string) {\n if HasPrefix(pub_key, \"04\") {\n pub_key = Substr(pub_key, 2, Size(pub_key) - 2)\n }\n if Size(pub_key) < 128 {\n warning LangRes(\"@1key_too_short\", \"en\")\n }\n if Size(pub_key) > 128 {\n warning LangRes(\"@1key_too_long\", \"en\")\n }\n\n var account_key int account string\n account_key = PubToID(pub_key)\n if account_key == 0 {\n warning LangRes(\"@1public_key_invalid\", \"en\")\n }\n account = IdToAddress(account_key)\n $check_user = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": account, \"deleted\": 0})\n if !$check_user {\n warning Sprintf(\"%v: \" + \"key not found\", pub_key)\n }\n\n @1GroupsAssign(\"GroupId,MemberAccount\", $GroupId, account)\n }\n\n conditions {\n if $Keys == \"\" {\n warning LangRes(\"@1public_key_empty\", \"en\")\n }\n $Keys = Replace($Keys, \" \", \"\")\n $Keys = Replace($Keys, \"\\n\", \"\")\n $Keys = Replace($Keys, \"\\r\", \"\")\n }\n\n action {\n if Contains($Keys, \",\") {\n var pub_array array i int\n pub_array = Split($Keys, \",\")\n while i < Len(pub_array) {\n var pub_key string\n pub_key = Str(pub_array[i])\n addPub(pub_key)\n i = i + 1\n }\n } else {\n addPub($Keys)\n }\n }\n}", "Type": "contracts" }, { "Name": "GroupsCreate", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract GroupsCreate {\n data {\n GroupName string \"optional\"\n GroupType int \"optional\"\n GroupInfo string \"optional\"\n GroupId int \"optional\"\n }\n\n func getMemberInfo(kid int) map {\n var res member map\n member = DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"id\": kid}).Row()\n if member {\n res[\"member_id\"] = member[\"id\"]\n res[\"member_name\"] = member[\"member_name\"]\n res[\"image_id\"] = member[\"image_id\"]\n } else {\n member = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": kid}).Row()\n if member {\n res[\"member_id\"] = member[\"id\"]\n res[\"member_name\"] = IdToAddress(Int(member[\"id\"]))\n res[\"image_id\"] = 0\n }\n }\n return res\n }\n\n conditions {\n if $GroupId == 0 {\n if $GroupName == \"\" {\n info LangRes(\"@1group_name_cannot_be_empty\", \"en\")\n }\n if $GroupType == 0 {\n info LangRes(\"@1group_type_error\", \"en\")\n }\n }\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n $check_access = AppParam(Int($system_app_id), \"role_creates_groups\", $ecosystem_id)\n if $check_access != \"\" {\n var rids array\n rids = JSONDecode(\"[\" + $check_access + \"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\":rids}, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n } else {\n var admin_id string\n admin_id = AppParam(Int($system_app_id), \"role_admin\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\" + admin_id + \"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n if $GroupName == DBFind(\"@1groups\").Where({\"ecosystem\": $ecosystem_id, \"group_name\": $GroupName}).One(\"group_name\") {\n warning LangRes(\"@1group_name_already\", \"en\")\n }\n }\n\n action {\n if $GroupId == 0 {\n var roles_access_arr array, buffer map\n buffer = DBFind(\"@1buffer_data\").Where({\"ecosystem\": $ecosystem_id, \"member_id\": $key_id, \"key\": \"group_access\"}).Columns(\"id,value,value->groups_access\").Row()\n if buffer {\n roles_access_arr = JSONDecode(buffer[\"value.groups_access\"])\n var filled map\n filled[\"groups_access\"] = []\n filled[\"group_name\"] = \"\"\n filled[\"group_type\"] = \"\"\n filled[\"group_information\"] = \"\"\n DBUpdate(\"@1buffer_data\", Int(buffer[\"id\"]), {\"value\": filled})\n }\n\n var m map\n m[\"creator\"] = getMemberInfo($key_id)\n m[\"group_name\"] = $GroupName\n m[\"group_type\"] = $GroupType\n m[\"date_created\"] = $block_time\n m[\"group_access\"] = JSONEncode(roles_access_arr)\n m[\"group_info\"] = $GroupInfo\n m[\"ecosystem\"] = $ecosystem_id\n DBInsert(\"@1groups\", m)\n } else {\n var m map\n m[\"group_info\"] = $GroupInfo\n DBUpdate(\"@1groups\",$GroupId, m)\n }\n }\n}", + "Value": "contract GroupsCreate {\n data {\n GroupName string \"optional\"\n GroupType int \"optional\"\n GroupInfo string \"optional\"\n GroupId int \"optional\"\n }\n\n func getMemberInfo(account string) map {\n var res member map\n member = DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"account\": account}).Row()\n if member {\n res[\"account\"] = member[\"account\"]\n res[\"member_name\"] = member[\"member_name\"]\n res[\"image_id\"] = member[\"image_id\"]\n } else {\n if DBFind(\"@1keys\").Columns(\"id\").Where({\"ecosystem\": $ecosystem_id, \"account\": account, \"deleted\": 0}).Row() {\n res[\"account\"] = account\n res[\"member_name\"] = account\n res[\"image_id\"] = \"0\"\n }\n }\n return res\n }\n\n conditions {\n if $GroupId == 0 {\n if $GroupName == \"\" {\n info LangRes(\"@1group_name_cannot_be_empty\", \"en\")\n }\n if $GroupType == 0 {\n info LangRes(\"@1group_type_error\", \"en\")\n }\n }\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n $check_access = AppParam(Int($system_app_id), \"role_creates_groups\", $ecosystem_id)\n if $check_access != \"\" {\n var rids array\n rids = JSONDecode(\"[\" + $check_access + \"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n } else {\n var admin_id string\n admin_id = AppParam(Int($system_app_id), \"role_admin\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\" + admin_id + \"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n if $GroupName == DBFind(\"@1groups\").Where({\"ecosystem\": $ecosystem_id, \"group_name\": $GroupName}).One(\"group_name\") {\n warning LangRes(\"@1group_name_already\", \"en\")\n }\n }\n\n action {\n if $GroupId == 0 {\n var roles_access_arr array, buffer map\n buffer = DBFind(\"@1buffer_data\").Where({\"ecosystem\": $ecosystem_id, \"account\": $account_id, \"key\": \"group_access\"}).Columns(\"id,value,value->groups_access\").Row()\n if buffer {\n roles_access_arr = JSONDecode(buffer[\"value.groups_access\"])\n var filled map\n filled[\"groups_access\"] = []\n filled[\"group_name\"] = \"\"\n filled[\"group_type\"] = \"\"\n filled[\"group_information\"] = \"\"\n DBUpdate(\"@1buffer_data\", Int(buffer[\"id\"]), {\"value\": filled})\n }\n\n var m map\n m[\"creator\"] = getMemberInfo($account_id)\n m[\"group_name\"] = $GroupName\n m[\"group_type\"] = $GroupType\n m[\"date_created\"] = $block_time\n m[\"group_access\"] = JSONEncode(roles_access_arr)\n m[\"group_info\"] = $GroupInfo\n m[\"ecosystem\"] = $ecosystem_id\n DBInsert(\"@1groups\", m)\n } else {\n var m map\n m[\"group_info\"] = $GroupInfo\n DBUpdate(\"@1groups\",$GroupId, m)\n }\n }\n}", "Type": "contracts" }, { "Name": "GroupsUnassign", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract GroupsUnassign {\n data {\n RowId int\n }\n\n conditions {\n var assigned map\n assigned = DBFind(\"@1groups_participants\").Where({\"ecosystem\": $ecosystem_id, \"id\": $RowId, \"deleted\": 0}).Columns(\"id,ecosystem,deleted,groups_info->id,member->member_id\").Row()\n if !assigned {\n warning LangRes(\"@1group_participant_not_found\", \"en\")\n }\n\n var buffer_id int group map\n buffer_id = Int(assigned[\"groups_info.id\"])\n\n group = DBFind(\"@1groups\").Where({\"ecosystem\": $ecosystem_id, \"id\": buffer_id}).Row()\n $groupId = Int(group[\"id\"])\n $groupType = Int(group[\"group_type\"])\n\n if $groupId == 0 {\n warning LangRes(\"@1group_not_found\", \"en\")\n }\n if $groupType == 1 {\n if Int(assigned[\"member.member_id\"]) != $key_id {\n @1GroupsAccessCheck(\"GroupId\", $groupId)\n }\n } else {\n @1GroupsAccessCheck(\"GroupId\", $groupId)\n }\n }\n\n action {\n var m map\n m[\"deleted\"] = 1\n m[\"date_deleted\"] = $block_time\n DBUpdate(\"@1groups_participants\", $RowId, m)\n }\n}", + "Value": "contract GroupsUnassign {\n data {\n RowId int\n }\n\n conditions {\n var assigned map\n assigned = DBFind(\"@1groups_participants\").Where({\"ecosystem\": $ecosystem_id, \"id\": $RowId, \"deleted\": 0}).Columns(\"id,ecosystem,deleted,groups_info->id,member->account\").Row()\n if !assigned {\n warning LangRes(\"@1group_participant_not_found\", \"en\")\n }\n\n var buffer_id int group map\n buffer_id = Int(assigned[\"groups_info.id\"])\n\n group = DBFind(\"@1groups\").Where({\"ecosystem\": $ecosystem_id, \"id\": buffer_id}).Row()\n $groupId = Int(group[\"id\"])\n $groupType = Int(group[\"group_type\"])\n\n if $groupId == 0 {\n warning LangRes(\"@1group_not_found\", \"en\")\n }\n if $groupType == 1 {\n if assigned[\"member.account\"] != $account_id {\n @1GroupsAccessCheck(\"GroupId\", $groupId)\n }\n } else {\n @1GroupsAccessCheck(\"GroupId\", $groupId)\n }\n }\n\n action {\n var m map\n m[\"deleted\"] = 1\n m[\"date_deleted\"] = $block_time\n DBUpdate(\"@1groups_participants\", $RowId, m)\n }\n}", "Type": "contracts" }, { @@ -798,27 +816,27 @@ "Type": "contracts" }, { - "Name": "RolesAssign", + "Name": "ConsortiumMemberRequest", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract RolesAssign {\n data {\n Rid int\n MemberId int\n }\n\n func getMemberInfo(kid int) map {\n var res member map\n member = DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"id\": kid}).Row()\n if member {\n res[\"member_id\"] = member[\"id\"]\n res[\"member_name\"] = member[\"member_name\"]\n res[\"image_id\"] = member[\"image_id\"]\n } else {\n member = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": kid}).Row()\n if member {\n res[\"member_id\"] = member[\"id\"]\n res[\"member_name\"] = IdToAddress(Int(member[\"id\"]))\n res[\"image_id\"] = 0\n }\n }\n return res\n }\n\n conditions {\n $role = DBFind(\"@1roles\").Where({\"id\": $Rid}).Columns(\"id,deleted,role_type,role_name,image_id,creator->member_id\").Row()\n if Int($role[\"role_type\"]) == 2 {\n warning LangRes(\"@1elective_role_voting_only\", \"en\")\n }\n if !$role {\n warning LangRes(\"@1role_not_found\", \"en\")\n }\n\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": $MemberId}).Row() {\n warning LangRes(\"@1key_not_found\", \"en\")\n }\n\n if $role[\"deleted\"] == 1 {\n warning LangRes(\"@1role_deleted_request_impossible\", \"en\")\n }\n\n var specRules map prev_contract string\n prev_contract = $stack[0]\n if Len($stack) > 2{\n prev_contract = $stack[Len($stack) - 2]\n }\n specRules[\"@1VotingValidatorAccept\"] = 1\n specRules[\"@1DelegateRefresh\"] = 1\n specRules[\"@1ValidatorRequest\"] = 1\n specRules[\"@1InvestorRefresh\"] = 1\n\n if specRules[prev_contract] != 1 {\n @1RolesAccessCheck(\"Rid\", $Rid)\n }\n }\n\n action {\n if DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": $Rid, \"member->member_id\": $MemberId, \"deleted\": 0}).One(\"id\") {\n // do not re-assign and do not warning because this contract may be called for other\n return\n }\n var role member appointer map\n role[\"id\"] = $role[\"id\"]\n role[\"type\"] = $role[\"role_type\"]\n role[\"name\"] = $role[\"role_name\"]\n role[\"image_id\"] = $role[\"image_id\"]\n\n member = getMemberInfo($MemberId)\n appointer = getMemberInfo($key_id)\n var m map\n m[\"role\"] = role\n m[\"member\"] = member\n m[\"appointed\"] = appointer\n m[\"date_created\"] = $block_time\n m[\"ecosystem\"] = $ecosystem_id\n DBInsert(\"@1roles_participants\", m)\n }\n}", + "Value": "contract ConsortiumMemberRequest {\n data {\n TcpAddress string\n ApiAddress string\n CandidateAccount string\n PubKey string\n Description string \"optional\"\n Comment string \"optional\"\n }\n\n conditions {\n if $ecosystem_id != 1 {\n warning LangRes(\"@1contract_first_ecosystem_only\", \"en\")\n }\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": $CandidateAccount, \"deleted\": 0}).Row() {\n warning LangRes(\"@1address_invalid\", \"en\")\n }\n }\n\n action {\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n var roleId int\n roleId = Int(AppParam(Int($system_app_id), \"role_consortium_member_candidate\", $ecosystem_id))\n if !DBFind(\"@1roles\").Where({\"ecosystem\": 1, \"id\": roleId, \"deleted\": 0}).One(\"id\") {\n warning Sprintf(LangRes(\"@1role_app_param_not_found\", \"en\"), \"role_consortium_member_candidate\")\n }\n @1RolesAssign(\"Rid,MemberAccount\", roleId, $account_id)\n\n var m map\n m[\"candidate_account\"] = $CandidateAccount\n m[\"tcp_address\"] = $TcpAddress\n m[\"api_address\"] = $ApiAddress\n m[\"pub_key\"] = $PubKey\n m[\"description\"] = $Description\n m[\"comment\"] = $Comment\n m[\"date_created\"] = $block_time\n m[\"deleted\"] = 0\n DBInsert(\"@1consortium_member_requests\", m)\n }\n}", "Type": "contracts" }, { "Name": "MembershipAdd", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract MembershipAdd {\n data {\n Keys string\n }\n\n func addPub(pub string) {\n pub = Replace(pub, \" \", \"\")\n if Size(pub) < 128 {\n warning LangRes(\"@1key_too_short\", \"en\")\n }\n if Size(pub) > 130 {\n warning LangRes(\"@1key_too_long\", \"en\")\n }\n\n var k_id int\n k_id = PubToID(pub)\n if k_id == 0 {\n warning LangRes(\"@1public_key_invalid\", \"en\")\n }\n $check_user = DBFind(\"@1keys\").Where({\"id\": k_id, \"ecosystem\": $ecosystem_id})\n if $check_user {\n warning LangRes(\"@1key_already_exists\", \"en\")\n }\n var pub_bytes bytes\n pub_bytes = HexToPub(pub)\n DBInsert(\"@1keys\",{id:k_id, pub:pub_bytes, ecosystem:$ecosystem_id})\n }\n\n conditions {\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n if $Keys == \"\" {\n warning LangRes(\"@1public_key_empty\", \"en\")\n }\n $Keys = Replace($Keys, \" \", \"\")\n $Keys = Replace($Keys, \"\\n\", \"\")\n $Keys = Replace($Keys, \"\\r\", \"\")\n\n var admin_id int\n admin_id = Int(AppParam(Int($system_app_id), \"role_admin\", $ecosystem_id))\n\n if !RoleAccess(admin_id) {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n if $ecosystem_id == 1 {\n warning LangRes(\"@1impossible_for_platform_ecosystem\", \"en\")\n }\n }\n\n action {\n if Contains($Keys, \",\") {\n var pub_array array\n pub_array = Split($Keys, \",\")\n\n var i int\n while i < Len(pub_array) {\n var pub_key string\n pub_key = Str(pub_array[i])\n addPub(pub_key)\n i = i + 1\n }\n } else {\n addPub($Keys)\n }\n }\n}", + "Value": "contract MembershipAdd {\n data {\n Keys string\n }\n\n func addPub(pub string) {\n pub = Replace(pub, \" \", \"\")\n if Size(pub) < 128 {\n warning LangRes(\"@1key_too_short\", \"en\")\n }\n if Size(pub) > 130 {\n warning LangRes(\"@1key_too_long\", \"en\")\n }\n\n var account_key int account string\n account_key = PubToID(pub)\n if account_key == 0 {\n warning LangRes(\"@1public_key_invalid\", \"en\")\n }\n account = IdToAddress(account_key)\n $check_user = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": account, \"deleted\": 0})\n if $check_user {\n warning LangRes(\"@1wallet_already_exists\", \"en\")\n }\n var pub_bytes bytes\n pub_bytes = HexToPub(pub)\n DBInsert(\"@1keys\", {\"ecosystem\": $ecosystem_id, \"id\": account_key, \"account\": account, \"pub\": pub_bytes, \"deleted\": 0})\n }\n\n conditions {\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n if $Keys == \"\" {\n warning LangRes(\"@1public_key_empty\", \"en\")\n }\n $Keys = Replace($Keys, \" \", \"\")\n $Keys = Replace($Keys, \"\\n\", \"\")\n $Keys = Replace($Keys, \"\\r\", \"\")\n\n var admin_id int\n admin_id = Int(AppParam(Int($system_app_id), \"role_admin\", $ecosystem_id))\n\n if !RoleAccess(admin_id) {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n if $ecosystem_id == 1 {\n warning LangRes(\"@1impossible_for_platform_ecosystem\", \"en\")\n }\n }\n\n action {\n if Contains($Keys, \",\") {\n var pub_array array\n pub_array = Split($Keys, \",\")\n\n var i int\n while i < Len(pub_array) {\n var pub_key string\n pub_key = Str(pub_array[i])\n addPub(pub_key)\n i = i + 1\n }\n } else {\n addPub($Keys)\n }\n }\n}", "Type": "contracts" }, { "Name": "NotificationsClose", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract NotificationsClose {\n data {\n NotificId int\n }\n\n func getPermission() int {\n var array_permissions array result i int prevContract string\n array_permissions = [\"@1TokensRefundAccept\", \"@1TokensRefundReject\", \"@1VotingDecisionCheck\", \"@1VotingDelete\", \"@1QAnswer\", \"@1QOperations\", \"@1ErrandDelete\", \"@1GroupRequestDecide\"]\n\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n while i < Len(array_permissions) {\n var contract_name string\n contract_name = array_permissions[i]\n if contract_name==prevContract {\n result = 1\n }\n i = i + 1\n }\n return result\n }\n\n conditions {\n $notify = DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"id\": $NotificId}).Columns(\"id,date_start_processing,processing_info->member_id,closed,notification->type,recipient->member_id,recipient->role_id\").Row()\n if !$notify {\n warning LangRes(\"@1notification_not_found\", \"en\")\n }\n\n // checking the type of notification\n if $notify[\"notification.type\"] != 1 && $notify[\"notification.type\"] != 2 {\n warning LangRes(\"@1notification_type_not_found\", \"en\")\n }\n\n // getting permission\n var flag_permission int\n flag_permission = getPermission()\n\n // checking personal notification\n if $notify[\"notification.type\"] == 1 && flag_permission == 0 {\n if $notify[\"recipient.member_id\"] != $key_id {\n warning LangRes(\"@1notification_another_member\", \"en\")\n }\n }\n\n // checking role notification\n if $notify[\"notification.type\"] == 2 && flag_permission == 0 {\n if $notify[\"date_start_processing\"] == 0 {\n warning LangRes(\"@1notification_processing_not_started\", \"en\")\n }\n\n if $notify[\"processing_info.member_id\"] != $key_id {\n warning LangRes(\"@1notice_processing_started_another_member\", \"en\")\n }\n }\n }\n\n action {\n if $notify[\"closed\"] > 0 {\n return\n }\n if $notify[\"notification.type\"] == 1 {\n @1NotificationsProcess(\"NotificId\", $NotificId)\n }\n var m map\n m[\"date_closed\"] = $block_time\n m[\"closed\"] = 1\n DBUpdate(\"@1notifications\", $NotificId, m)\n\n if $notify[\"notification.type\"] == 1 {\n UpdateNotifications($ecosystem_id, Int($notify[\"recipient.member_id\"]))\n } else {\n UpdateRolesNotifications($ecosystem_id, Int($notify[\"recipient.role_id\"]))\n }\n }\n}\n", + "Value": "contract NotificationsClose {\n data {\n NotificId int\n }\n\n func getPermission() int {\n var array_permissions array result i int prevContract string\n array_permissions = [\"@1TokensRefundAccept\", \"@1TokensRefundReject\", \"@1VotingDecisionCheck\", \"@1VotingDelete\", \"@1QAnswer\", \"@1QOperations\", \"@1ErrandDelete\", \"@1GroupRequestDecide\"]\n\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n while i < Len(array_permissions) {\n var contract_name string\n contract_name = array_permissions[i]\n if contract_name==prevContract {\n result = 1\n }\n i = i + 1\n }\n return result\n }\n\n conditions {\n $notify = DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"id\": $NotificId}).Columns(\"id,date_start_processing,processing_info->account,closed,notification->type,recipient->account,recipient->role_id\").Row()\n if !$notify {\n warning LangRes(\"@1notification_not_found\", \"en\")\n }\n\n // checking the type of notification\n if $notify[\"notification.type\"] != 1 && $notify[\"notification.type\"] != 2 {\n warning LangRes(\"@1notification_type_not_found\", \"en\")\n }\n\n // getting permission\n var flag_permission int\n flag_permission = getPermission()\n\n // checking personal notification\n if $notify[\"notification.type\"] == 1 && flag_permission == 0 {\n if $notify[\"recipient.account\"] != $account_id {\n warning LangRes(\"@1notification_another_member\", \"en\")\n }\n }\n\n // checking role notification\n if $notify[\"notification.type\"] == 2 && flag_permission == 0 {\n if $notify[\"date_start_processing\"] == 0 {\n warning LangRes(\"@1notification_processing_not_started\", \"en\")\n }\n\n if $notify[\"processing_info.account\"] != $account_id {\n warning LangRes(\"@1notice_processing_started_another_member\", \"en\")\n }\n }\n }\n\n action {\n if $notify[\"closed\"] > 0 {\n return\n }\n if $notify[\"notification.type\"] == 1 {\n @1NotificationsProcess(\"NotificId\", $NotificId)\n }\n var m map\n m[\"date_closed\"] = $block_time\n m[\"closed\"] = 1\n DBUpdate(\"@1notifications\", $NotificId, m)\n\n if $notify[\"notification.type\"] == 1 {\n UpdateNotifications($ecosystem_id, $notify[\"recipient.account\"])\n } else {\n UpdateRolesNotifications($ecosystem_id, Int($notify[\"recipient.role_id\"]))\n }\n }\n}\n", "Type": "contracts" }, { "Name": "GroupRequestMembership", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract GroupRequestMembership {\n data {\n GroupId int\n }\n\n conditions {\n $group = DBFind(\"@1groups\").Where({\"id\": $GroupId}).Columns(\"id,deleted,group_type,group_name,image_id,creator->member_id,group_access,group_name\").Row()\n if !$group {\n warning LangRes(\"@1group_not_found\", \"en\")\n }\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": $key_id}).Row() {\n warning LangRes(\"@1key_not_found\", \"en\")\n }\n if $group[\"deleted\"] == 1 {\n warning LangRes(\"@1group_deleted_request_impossible\", \"en\")\n }\n $check_join = DBFind(\"@1groups_participants\").Where({\"deleted\": 0, \"member->member_id\": $key_id, \"groups_info->id\": $GroupId, \"ecosystem\": $ecosystem_id}).Columns(\"id,deleted,member,member->member_id,groups_info,groups_info->id,ecosystem\").One(\"id\")\n if $check_join {\n warning LangRes(\"@1already_group\", \"en\")\n }\n $check_send_notific = DBFind(\"@1notifications\").Where({\"sender->member_id\": $key_id, \"page_params->gr_id\": $GroupId, \"closed\": 0, \"ecosystem\": $ecosystem_id}).Columns(\"id,closed,ecosystem,sender,sender->member_id,page_params->gr_id\").One(\"id\")\n if $check_send_notific {\n info LangRes(\"@1request_to_group\", \"en\")\n }\n }\n\n action {\n var gr_ids array i int icon header body page ecoName string\n\n var params map\n params[\"gr_id\"] = $GroupId\n params[\"member_id\"] = $key_id\n icon = \"icon icon-user-follow\"\n header = \"New request\"\n body = \"New request to the group \" + Str($group[\"group_name\"])\n page = \"@1groups_request_view\"\n\n gr_ids = JSONDecode($group[\"group_access\"])\n if Len(gr_ids) > 0 {\n while i < Len(gr_ids) {\n var id_role int\n id_role = Int(gr_ids[i])\n @1NotificationsSend(\"Rid,Sender,Icon,Header,Body,Page,Params,EcosystemId,Closure\", id_role, 1, icon, header, body, page, params, $ecosystem_id,1)\n i = i + 1\n }\n } else {\n $creator_id = Int($group[\"creator.member_id\"])\n @1NotificationsSend(\"MemberId,Sender,Icon,Header,Body,Page,Params,EcosystemId\", $creator_id, 1, icon, header, body, page, params, $ecosystem_id)\n }\n }\n}\n", + "Value": "contract GroupRequestMembership {\n data {\n GroupId int\n }\n\n conditions {\n $group = DBFind(\"@1groups\").Where({\"id\": $GroupId}).Columns(\"id,deleted,group_type,group_name,image_id,creator->account,group_access,group_name\").Row()\n if !$group {\n warning LangRes(\"@1group_not_found\", \"en\")\n }\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": $account_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1account_not_found\", \"en\")\n }\n if $group[\"deleted\"] == 1 {\n warning LangRes(\"@1group_deleted_request_impossible\", \"en\")\n }\n $check_join = DBFind(\"@1groups_participants\").Where({\"deleted\": 0, \"member->account\": $account_id, \"groups_info->id\": $GroupId, \"ecosystem\": $ecosystem_id}).Columns(\"id,deleted,member,member->account,groups_info,groups_info->id,ecosystem\").One(\"id\")\n if $check_join {\n warning LangRes(\"@1already_group\", \"en\")\n }\n $check_send_notific = DBFind(\"@1notifications\").Where({\"sender->account\": $account_id, \"page_params->gr_id\": $GroupId, \"closed\": 0, \"ecosystem\": $ecosystem_id}).Columns(\"id,closed,ecosystem,sender,sender->account,page_params->gr_id\").One(\"id\")\n if $check_send_notific {\n info LangRes(\"@1request_to_group\", \"en\")\n }\n }\n\n action {\n var gr_ids array i int icon header body page ecoName string\n\n var params map\n params[\"gr_id\"] = $GroupId\n params[\"account\"] = $account_id\n icon = \"icon icon-user-follow\"\n header = \"New request\"\n body = \"New request to the group \" + Str($group[\"group_name\"])\n page = \"@1groups_request_view\"\n\n gr_ids = JSONDecode($group[\"group_access\"])\n if Len(gr_ids) > 0 {\n while i < Len(gr_ids) {\n var id_role int\n id_role = Int(gr_ids[i])\n @1NotificationsSend(\"Rid,Sender,Icon,Header,Body,Page,Params,EcosystemId,Closure\", id_role, 1, icon, header, body, page, params, $ecosystem_id, 1)\n i = i + 1\n }\n } else {\n $creator_id = $group[\"creator.account\"]\n @1NotificationsSend(\"MemberAccount,Sender,Icon,Header,Body,Page,Params,EcosystemId\", $creator_id, 1, icon, header, body, page, params, $ecosystem_id)\n }\n }\n}\n", "Type": "contracts" }, { @@ -830,31 +848,31 @@ { "Name": "NodeRemoveByKey", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract NodeRemoveByKey {\n data {}\n\n func nodesRemove(keyId int) array {\n var nodesJSON string nodes res array\n nodesJSON = SysParamString(\"full_nodes\")\n if !HasPrefix(nodesJSON, \"[\") {\n // empty string nodes\n return res\n }\n nodes = JSONDecode(nodesJSON)\n var i int\n while i < Len(nodes) {\n var node map\n node = nodes[i]\n if node[\"key_id\"] != keyId {\n res = Append(res, node)\n }\n i = i + 1\n }\n return res\n }\n\n conditions {\n if $original_contract != \"ValidatorResign\" {\n warning LangRes(\"@1contract_chain_distorted\", \"en\")\n }\n }\n\n action {\n var nodes array fullNodes string\n nodes = nodesRemove($key_id)\n fullNodes = JSONEncode(nodes)\n DBUpdateSysParam(\"full_nodes\", fullNodes, \"\")\n }\n}", + "Value": "contract NodeRemoveByKey {\n data {}\n\n func nodesRemove(key int) array {\n var nodesJSON string nodes res array\n nodesJSON = SysParamString(\"full_nodes\")\n if !HasPrefix(nodesJSON, \"[\") {\n // empty string nodes\n return res\n }\n nodes = JSONDecode(nodesJSON)\n var i int\n while i < Len(nodes) {\n var node map\n node = nodes[i]\n if node[\"key_id\"] != key {\n res = Append(res, node)\n }\n i = i + 1\n }\n return res\n }\n\n conditions {\n if $original_contract != \"ConsortiumMemberResign\" {\n warning LangRes(\"@1contract_chain_distorted\", \"en\")\n }\n }\n\n action {\n var nodes array fullNodes string\n nodes = nodesRemove(Int(AddressToId($account_id)))\n fullNodes = JSONEncode(nodes)\n DBUpdateSysParam(\"full_nodes\", fullNodes, \"\")\n }\n}", "Type": "contracts" }, { "Name": "NotificationsBroadcast", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract NotificationsBroadcast {\n data {\n RoleId int\n Header string\n Body string\n Popup string \"optional\"\n }\n\n func getMemberInfo(kid int) map {\n var res member map\n member = DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"id\": kid}).Row()\n if member {\n res[\"member_id\"] = member[\"id\"]\n res[\"member_name\"] = member[\"member_name\"]\n res[\"image_id\"] = member[\"image_id\"]\n } else {\n if DBFind(\"@1keys\").Columns(\"id\").Where({\"ecosystem\": $ecosystem_id, \"id\": kid}).Row() {\n res[\"member_id\"] = Str(kid)\n res[\"member_name\"] = IdToAddress(kid)\n res[\"image_id\"] = \"0\"\n }\n }\n return res\n }\n\n conditions {\n if $RoleId != 1 {\n warning LangRes(\"@1admin_only_action\", \"en\")\n }\n if $ecosystem_id != 1 {\n warning LangRes(\"@1first_ecosystem_admin_only_action\", \"en\")\n }\n $ecos = DBFind(\"@1ecosystems\").Columns(\"id\")\n $lenEcos = Len($ecos)\n if $lenEcos == 1 {\n warning LangRes(\"@1other_ecosystems_not_found\", \"en\")\n }\n }\n\n action {\n var i lenIds int eco map ids array sender recipient params note map\n sender = getMemberInfo($key_id)\n sender[\"type\"] = 1\n note[\"header\"] = $Header\n note[\"type\"] = 1\n note[\"icon\"] = \"icon-envelope\"\n note[\"body\"] = $Body\n if $Popup == \"true\" || $Popup == \"1\" {\n note[\"popup\"] = 1\n } else {\n note[\"popup\"] = 0\n }\n\n while i < $lenEcos {\n eco = $ecos[i]\n var ecoId int\n ecoId = Int(eco[\"id\"])\n if ecoId != 1 {\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": ecoId, \"name\": \"System\"}).One(\"id\")\n var adminRoleId int\n adminRoleId = Int(AppParam(Int($system_app_id), \"role_admin\", $ecosystem_id))\n ids = DBFind(\"@1roles_participants\").Where({\"ecosystem\": ecoId, \"role->id\": adminRoleId, \"role->type\": 3}).Columns(\"member->member_id\")\n lenIds = Len(ids)\n var i_ids int\n while i_ids < lenIds {\n recipient = ids[i_ids]\n recipient = getMemberInfo(Int(recipient[\"member.member_id\"]))\n var m map\n m[\"recipient\"] = recipient\n m[\"sender\"] = sender\n m[\"notification\"] = note\n m[\"page_name\"] = \"@1notifications_show\"\n m[\"page_params\"] = params\n m[\"date_created\"] = $block_time\n m[\"ecosystem\"] = ecoId\n DBInsert(\"@1notifications\", m)\n i_ids = i_ids + 1\n }\n }\n i = i + 1\n }\n }\n}", + "Value": "contract NotificationsBroadcast {\n data {\n RoleId int\n Header string\n Body string\n Popup string \"optional\"\n }\n\n func getMemberInfo(account string) map {\n var res member map\n member = DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"account\": account}).Row()\n if member {\n res[\"account\"] = member[\"account\"]\n res[\"member_name\"] = member[\"member_name\"]\n res[\"image_id\"] = member[\"image_id\"]\n } else {\n if DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": account, \"deleted\": 0}).Row() {\n res[\"account\"] = account\n res[\"member_name\"] = account\n res[\"image_id\"] = \"0\"\n }\n }\n return res\n }\n\n conditions {\n if $RoleId != 1 {\n warning LangRes(\"@1admin_only_action\", \"en\")\n }\n if $ecosystem_id != 1 {\n warning LangRes(\"@1first_ecosystem_admin_only_action\", \"en\")\n }\n $ecos = DBFind(\"@1ecosystems\").Columns(\"id\")\n $lenEcos = Len($ecos)\n if $lenEcos == 1 {\n warning LangRes(\"@1other_ecosystems_not_found\", \"en\")\n }\n }\n\n action {\n var i lenIds int eco map ids array sender recipient params note map\n sender = getMemberInfo($account_id)\n sender[\"type\"] = 1\n note[\"header\"] = $Header\n note[\"type\"] = 1\n note[\"icon\"] = \"icon-envelope\"\n note[\"body\"] = $Body\n if $Popup == \"true\" || $Popup == \"1\" {\n note[\"popup\"] = 1\n } else {\n note[\"popup\"] = 0\n }\n\n while i < $lenEcos {\n eco = $ecos[i]\n var ecoId int\n ecoId = Int(eco[\"id\"])\n if ecoId != 1 {\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": ecoId, \"name\": \"System\"}).One(\"id\")\n var adminRoleId int\n adminRoleId = Int(AppParam(Int($system_app_id), \"role_admin\", $ecosystem_id))\n ids = DBFind(\"@1roles_participants\").Where({\"ecosystem\": ecoId, \"role->id\": adminRoleId, \"role->type\": 3}).Columns(\"member->account\")\n lenIds = Len(ids)\n var i_ids int\n while i_ids < lenIds {\n recipient = ids[i_ids]\n recipient = getMemberInfo(recipient[\"member.account\"])\n var m map\n m[\"recipient\"] = recipient\n m[\"sender\"] = sender\n m[\"notification\"] = note\n m[\"page_name\"] = \"@1notifications_show\"\n m[\"page_params\"] = params\n m[\"date_created\"] = $block_time\n m[\"ecosystem\"] = ecoId\n DBInsert(\"@1notifications\", m)\n i_ids = i_ids + 1\n }\n }\n i = i + 1\n }\n }\n}", "Type": "contracts" }, { "Name": "GroupRequestDecide", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract GroupRequestDecide {\n data {\n NotificId int\n Accept int\n }\n\n conditions {\n $notific = DBFind(\"@1notifications\").WhereId($NotificId).Columns(\"id,closed,page_params->gr_id,page_params->member_id,sender,sender->member_id,recipient,recipient->role_id\").Row()\n if $notific[\"closed\"] == 1 {\n warning LangRes(\"@1request_already\", \"en\")\n }\n }\n\n action {\n $gr_id = Int($notific[\"page_params.gr_id\"])\n $member_id = Int($notific[\"page_params.member_id\"])\n if $Accept == 1 {\n @1GroupsAssign(\"GroupId,MemberId\", $gr_id, $member_id)\n }\n var params map\n params[\"gr_id\"] = $gr_id\n if $Accept == 1 {\n params[\"decide\"] = 1\n } else {\n params[\"decide\"] = -1\n }\n var icon header body page ecoName string member i int\n icon = \"icon icon-user-follow\"\n header = \"Request to group\"\n body = \"Solution for your request\"\n page = \"@1groups_request_view\"\n member = Int($notific[\"sender.member_id\"])\n if $notific[\"recipient.role_id\"] > 0 {\n var check_send_notific array v map i int\n check_send_notific = DBFind(\"@1notifications\").Columns(\"id,closed,ecosystem,sender,sender->member_id,page_params->gr_id,page_params->member_id\").Where({\"sender->member_id\":member,\"page_params->gr_id\":$gr_id,\"page_params->member_id\":member,\"closed\":0,\"ecosystem\":$ecosystem_id})\n while i < Len(check_send_notific) {\n v = check_send_notific[i]\n @1NotificationsProcess(\"NotificId\", Int(v[\"id\"]))\n @1NotificationsClose(\"NotificId\", Int(v[\"id\"]))\n i = i + 1\n }\n @1NotificationsSend(\"MemberId,Sender,Icon,Header,Body,Page,Params,EcosystemId,CurrentRid\", member, 2, icon, header, body, page, params, $ecosystem_id, Int($notific[\"recipient.role_id\"]))\n } else{\n @1NotificationsSend(\"MemberId,Sender,Icon,Header,Body,Page,Params,EcosystemId\", member, 1, icon, header, body, page, params, $ecosystem_id)\n @1NotificationsClose(\"NotificId\", $NotificId)\n }\n }\n}\n", + "Value": "contract GroupRequestDecide {\n data {\n NotificId int\n Accept int\n }\n\n conditions {\n $notific = DBFind(\"@1notifications\").WhereId($NotificId).Columns(\"id,closed,page_params->gr_id,page_params->account,sender,sender->account,recipient,recipient->role_id\").Row()\n if $notific[\"closed\"] == 1 {\n warning LangRes(\"@1request_already\", \"en\")\n }\n }\n\n action {\n $gr_id = Int($notific[\"page_params.gr_id\"])\n $account = Int($notific[\"page_params.account\"])\n if $Accept == 1 {\n @1GroupsAssign(\"GroupId,MemberAccount\", $gr_id, $account)\n }\n var params map\n params[\"gr_id\"] = $gr_id\n if $Accept == 1 {\n params[\"decide\"] = 1\n } else {\n params[\"decide\"] = -1\n }\n var icon header body page ecoName string member i int\n icon = \"icon icon-user-follow\"\n header = \"Request to group\"\n body = \"Solution for your request\"\n page = \"@1groups_request_view\"\n member = $notific[\"sender.account\"]\n if $notific[\"recipient.role_id\"] > 0 {\n var check_send_notific array v map i int\n check_send_notific = DBFind(\"@1notifications\").Columns(\"id,closed,ecosystem,sender,sender->account,page_params->gr_id,page_params->account\").Where({\"sender->account\": member, \"page_params->gr_id\": $gr_id, \"page_params->account\": member, \"closed\": 0, \"ecosystem\": $ecosystem_id})\n while i < Len(check_send_notific) {\n v = check_send_notific[i]\n @1NotificationsProcess(\"NotificId\", Int(v[\"id\"]))\n @1NotificationsClose(\"NotificId\", Int(v[\"id\"]))\n i = i + 1\n }\n @1NotificationsSend(\"MemberAccount,Sender,Icon,Header,Body,Page,Params,EcosystemId,CurrentRid\", member, 2, icon, header, body, page, params, $ecosystem_id, Int($notific[\"recipient.role_id\"]))\n } else{\n @1NotificationsSend(\"MemberAccount,Sender,Icon,Header,Body,Page,Params,EcosystemId\", member, 1, icon, header, body, page, params, $ecosystem_id)\n @1NotificationsClose(\"NotificId\", $NotificId)\n }\n }\n}\n", "Type": "contracts" }, { "Name": "MembershipDecide", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract MembershipDecide {\n data {\n NotificId int\n Accept int\n }\n\n conditions {\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n $request = DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"id\": $NotificId}).Columns(\"id,closed,sender->member_id,page_params->ecosystem_id,page_params->ecosystem_sender\").Row()\n var ecoId int\n ecoId = Int($request[\"page_params.ecosystem_id\"])\n\n if Int($request[\"closed\"]) == 1 {\n warning LangRes(\"@1request_processed_already\", \"en\")\n }\n\n var admin_id int\n admin_id = Int(AppParam(Int($system_app_id), \"role_admin\", $ecosystem_id))\n if !RoleAccess(admin_id) {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n\n action {\n var params map\n params[\"ecosystem_id\"] = $request[\"page_params.ecosystem_id\"]\n if $Accept == 1 {\n params[\"status\"] = 1\n var pub string mid eco_id int\n mid = Int($request[\"sender.member_id\"])\n eco_id = Int($request[\"page_params.ecosystem_id\"])\n pub = DBFind(\"@1keys\").Where({\"ecosystem\": 1, \"id\": mid}).One(\"pub\")\n DBInsert(\"@1keys\", {id:mid, pub:pub, ecosystem:$ecosystem_id})\n } else {\n params[\"status\"] = 0\n }\n\n var icon header body page ecoName ecoId string\n ecoId = $request[\"page_params.ecosystem_id\"]\n ecoName = DBFind(\"@1ecosystems\").Where({\"id\": ecoId}).One(\"name\")\n icon = \"icon icon-user-follow\"\n header = LangRes(\"@1request_approved\", \"en\")\n body = Sprintf(LangRes(\"@1ecosystem_request_approved\", \"en\"), ecoName, ecoId)\n page = \"@1membership_user_view\"\n\n @1NotificationsSend(\"MemberId,Sender,Icon,Header,Body,Page,Params,EcosystemId\", Int($request[\"sender.member_id\"]), 1, icon, header, body, page, params, Int($request[\"page_params.ecosystem_sender\"]))\n @1NotificationsProcess(\"NotificId\", $NotificId)\n @1NotificationsClose(\"NotificId\", $NotificId)\n }\n}", + "Value": "contract MembershipDecide {\n data {\n NotificId int\n Accept int\n }\n\n conditions {\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n $request = DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"id\": $NotificId}).Columns(\"id,closed,sender->account,page_params->ecosystem_id,page_params->ecosystem_sender\").Row()\n var ecoId int\n ecoId = Int($request[\"page_params.ecosystem_id\"])\n\n if Int($request[\"closed\"]) == 1 {\n warning LangRes(\"@1request_processed_already\", \"en\")\n }\n\n var admin_id int\n admin_id = Int(AppParam(Int($system_app_id), \"role_admin\", $ecosystem_id))\n if !RoleAccess(admin_id) {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n\n action {\n var params map\n params[\"ecosystem_id\"] = $request[\"page_params.ecosystem_id\"]\n if $Accept == 1 {\n params[\"status\"] = 1\n var pub account string eco_id account_key int\n account = $request[\"sender.account\"]\n account_key = AddressToId(account)\n eco_id = Int($request[\"page_params.ecosystem_id\"])\n pub = DBFind(\"@1keys\").Where({\"ecosystem\": 1, \"account\": account, \"deleted\": 0}).One(\"pub\")\n DBInsert(\"@1keys\", {\"ecosystem\": $ecosystem_id, \"id\": account_key, \"account\": account, \"pub\": pub, \"deleted\": 0})\n } else {\n params[\"status\"] = 0\n }\n\n var icon header body page ecoName ecoId string\n ecoId = $request[\"page_params.ecosystem_id\"]\n ecoName = DBFind(\"@1ecosystems\").Where({\"id\": ecoId}).One(\"name\")\n icon = \"icon icon-user-follow\"\n header = LangRes(\"@1request_approved\", \"en\")\n body = Sprintf(LangRes(\"@1ecosystem_request_approved\", \"en\"), ecoName, ecoId)\n page = \"@1membership_user_view\"\n\n @1NotificationsSend(\"MemberAccount,Sender,Icon,Header,Body,Page,Params,EcosystemId\", $request[\"sender.account\"], 1, icon, header, body, page, params, Int($request[\"page_params.ecosystem_sender\"]))\n @1NotificationsProcess(\"NotificId\", $NotificId)\n @1NotificationsClose(\"NotificId\", $NotificId)\n }\n}", "Type": "contracts" }, { "Name": "MembershipRequest", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract MembershipRequest {\n data {\n EcosystemId int\n }\n\n conditions {\n if $ecosystem_id != 1 {\n warning LangRes(\"@1contract_first_ecosystem_only\", \"en\")\n }\n\n if $EcosystemId == 1 {\n warning LangRes(\"@1impossible_for_platform_ecosystem\", \"en\")\n }\n\n if !DBFind(\"@1ecosystems\").Where({\"id\": $EcosystemId}).One(\"id\"){\n warning Sprintf(LangRes(\"@1template_eco_not_exist\", \"en\"), $EcosystemId)\n }\n\n if DBFind(\"@1keys\").Where({\"id\": $key_id, \"ecosystem\": $EcosystemId}) {\n warning LangRes(\"@1member_added_before\", \"en\")\n }\n\n $free_membership = Int(DBFind(\"@1parameters\").Where({\"ecosystem\": $EcosystemId, \"name\": \"free_membership\"}).One(\"value\"))\n if $free_membership == 0 {\n if DBFind(\"@1notifications\").Where({\"ecosystem\": $EcosystemId, \"page_params->ecosystem_id\": $EcosystemId, \"sender->member_id\": $key_id, \"closed\": 0, \"page_name\": \"@1membership_admin_view\"}).Row(){\n warning LangRes(\"@1request_sent_already\", \"en\")\n }\n\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $EcosystemId, \"name\": \"System\"}).One(\"id\")\n $admin_id = Int(AppParam(Int($system_app_id), \"role_admin\", $EcosystemId))\n \n if $admin_id == 0 {\n warning LangRes(\"@1recipient_role_not_found\", \"en\")\n }\n }\n }\n\n action {\n if $free_membership == 0 {\n var notific_params map\n notific_params[\"ecosystem_id\"] = $EcosystemId\n notific_params[\"ecosystem_sender\"] = $ecosystem_id\n\n @1NotificationsSend(\"Rid,Sender,Icon,Header,Body,Page,Params,Closure,EcosystemId\", $admin_id, 1, \"icon icon-user-follow\", LangRes(\"@1membership_request_new\", \"en\"), LangRes(\"@1details_view\", \"en\"), \"@1membership_admin_view\", notific_params,1,$EcosystemId)\n }\n if $free_membership == 1 {\n var pub string\n pub = DBFind(\"@1keys\").Where({\"ecosystem\": 1, \"id\": $key_id}).One(\"pub\")\n DBInsert(\"@1keys\", {id:$key_id, pub:pub, ecosystem:$EcosystemId})\n\n var params map\n params[\"ecosystem_id\"] = $EcosystemId\n params[\"status\"] = 1\n\n var icon header body page ecoName string\n ecoName = DBFind(\"@1ecosystems\").Where({\"id\": $EcosystemId}).One(\"name\")\n icon = \"icon icon-user-follow\"\n header = LangRes(\"@1request_approved\", \"en\")\n body = Sprintf(LangRes(\"@1ecosystem_request_approved\", \"en\"), ecoName, $EcosystemId)\n page = \"@1membership_user_view\"\n\n @1NotificationsSend(\"MemberId,Sender,Icon,Header,Body,Page,Params,EcosystemId\", $key_id, 1, icon, header, body, page, params, $ecosystem_id)\n }\n }\n}", + "Value": "contract MembershipRequest {\n data {\n EcosystemId int\n }\n\n conditions {\n if $ecosystem_id != 1 {\n warning LangRes(\"@1contract_first_ecosystem_only\", \"en\")\n }\n\n if $EcosystemId == 1 {\n warning LangRes(\"@1impossible_for_platform_ecosystem\", \"en\")\n }\n\n if !DBFind(\"@1ecosystems\").Where({\"id\": $EcosystemId}).One(\"id\"){\n warning Sprintf(LangRes(\"@1template_eco_not_exist\", \"en\"), $EcosystemId)\n }\n\n if DBFind(\"@1keys\").Where({\"ecosystem\": $EcosystemId, \"account\": $account_id, \"deleted\": 0}) {\n warning LangRes(\"@1member_added_before\", \"en\")\n }\n\n $free_membership = Int(DBFind(\"@1parameters\").Where({\"ecosystem\": $EcosystemId, \"name\": \"free_membership\"}).One(\"value\"))\n if $free_membership == 0 {\n if DBFind(\"@1notifications\").Where({\"ecosystem\": $EcosystemId, \"page_params->ecosystem_id\": $EcosystemId, \"sender->account\": $account_id, \"closed\": 0, \"page_name\": \"@1membership_admin_view\"}).Row(){\n warning LangRes(\"@1request_sent_already\", \"en\")\n }\n\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $EcosystemId, \"name\": \"System\"}).One(\"id\")\n $admin_id = Int(AppParam(Int($system_app_id), \"role_admin\", $EcosystemId))\n \n if $admin_id == 0 {\n warning LangRes(\"@1recipient_role_not_found\", \"en\")\n }\n }\n }\n\n action {\n if $free_membership == 0 {\n var notific_params map\n notific_params[\"ecosystem_id\"] = $EcosystemId\n notific_params[\"ecosystem_sender\"] = $ecosystem_id\n\n @1NotificationsSend(\"Rid,Sender,Icon,Header,Body,Page,Params,Closure,EcosystemId\", $admin_id, 1, \"icon icon-user-follow\", LangRes(\"@1membership_request_new\", \"en\"), LangRes(\"@1details_view\", \"en\"), \"@1membership_admin_view\", notific_params,1,$EcosystemId)\n }\n if $free_membership == 1 {\n var pub string account_key int\n account_key = AddressToId($account_id)\n pub = DBFind(\"@1keys\").Where({\"ecosystem\": 1, \"account\": $account_id, \"deleted\": 0}).One(\"pub\")\n DBInsert(\"@1keys\", {\"ecosystem\": $EcosystemId, \"id\": account_key, \"account\": $account_id, \"pub\": pub, \"deleted\": 0})\n\n var params map\n params[\"ecosystem_id\"] = $EcosystemId\n params[\"status\"] = 1\n\n var icon header body page ecoName string\n ecoName = DBFind(\"@1ecosystems\").Where({\"id\": $EcosystemId}).One(\"name\")\n icon = \"icon icon-user-follow\"\n header = LangRes(\"@1request_approved\", \"en\")\n body = Sprintf(LangRes(\"@1ecosystem_request_approved\", \"en\"), ecoName, $EcosystemId)\n page = \"@1membership_user_view\"\n\n @1NotificationsSend(\"MemberAccount,Sender,Icon,Header,Body,Page,Params,EcosystemId\", $account_id, 1, icon, header, body, page, params, $ecosystem_id)\n }\n }\n}", "Type": "contracts" }, { @@ -866,67 +884,67 @@ { "Name": "PlatformAppsSettings", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract PlatformAppsSettings {\n data {\n RoleAdmin int\n RoleValidatorCandidate int\n RoleConsensus int\n RoleDelegate int\n RoleDeveloper int\n RoleInvestor int\n RoleValidator int\n RoleCreatesRoles int\n }\n \n conditions {\n MainCondition()\n }\n\n func updateParam(name string, value int) {\n if value > 0 {\n var param paramsNew map\n if $app_id > 0 {\n param = DBFind(\"@1app_params\").Where({\"ecosystem\": $ecosystem_id, \"app_id\": $app_id, \"name\": name}).Row()\n if param {\n paramsNew[\"Id\"] = Int(param[\"id\"])\n paramsNew[\"Value\"] = Str(value)\n paramsNew[\"Conditions\"] = param[\"conditions\"]\n CallContract(\"@1EditAppParam\", paramsNew)\n } else {\n paramsNew[\"ApplicationId\"] = $app_id\n paramsNew[\"Name\"] = name\n paramsNew[\"Value\"] = Str(value)\n paramsNew[\"Conditions\"] = \"ContractConditions(\\\"AdminCondition\\\")\"\n CallContract(\"@1NewAppParam\", paramsNew)\n }\n } else {\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n }\n }\n\n action {\n $app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n updateParam(\"role_admin\", $RoleAdmin)\n updateParam(\"role_candidate_for_validators\", $RoleValidatorCandidate)\n updateParam(\"role_consensus\", $RoleConsensus)\n updateParam(\"role_delegate\", $RoleDelegate)\n updateParam(\"role_developer\", $RoleDeveloper)\n updateParam(\"role_investor_with_voting_rights\", $RoleInvestor)\n updateParam(\"role_validator\", $RoleValidator)\n updateParam(\"role_creates_roles\", $RoleCreatesRoles)\n }\n}", + "Value": "contract PlatformAppsSettings {\n data {\n RoleAdmin int\n RoleConsortiumMemberCandidate int\n RoleConsortiumMember int\n RoleDelegate int\n RoleDeveloper int\n RoleInvestor int\n RoleCreatesRoles int\n }\n \n conditions {\n MainCondition()\n }\n\n func updateParam(name string, value int) {\n if value > 0 {\n var param paramsNew map\n if $app_id > 0 {\n param = DBFind(\"@1app_params\").Where({\"ecosystem\": $ecosystem_id, \"app_id\": $app_id, \"name\": name}).Row()\n if param {\n paramsNew[\"Id\"] = Int(param[\"id\"])\n paramsNew[\"Value\"] = Str(value)\n paramsNew[\"Conditions\"] = param[\"conditions\"]\n CallContract(\"@1EditAppParam\", paramsNew)\n } else {\n paramsNew[\"ApplicationId\"] = $app_id\n paramsNew[\"Name\"] = name\n paramsNew[\"Value\"] = Str(value)\n paramsNew[\"Conditions\"] = \"ContractConditions(\\\"AdminCondition\\\")\"\n CallContract(\"@1NewAppParam\", paramsNew)\n }\n } else {\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n }\n }\n\n action {\n $app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n updateParam(\"role_admin\", $RoleAdmin)\n updateParam(\"role_consortium_member_candidate\", $RoleConsortiumMemberCandidate)\n updateParam(\"role_consortium_member\", $RoleConsortiumMember)\n updateParam(\"role_delegate\", $RoleDelegate)\n updateParam(\"role_developer\", $RoleDeveloper)\n updateParam(\"role_investor_with_voting_rights\", $RoleInvestor)\n updateParam(\"role_creates_roles\", $RoleCreatesRoles)\n }\n}", "Type": "contracts" }, { "Name": "ProfileEdit", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract ProfileEdit {\n data {\n Name string\n Info string \"optional\"\n ImageId string \"optional\"\n }\n\n conditions {\n $member = DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"id\": $key_id}).Row()\n $app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Basic\", \"deleted\": 0}).One(\"id\")\n $ImageId = Int($ImageId)\n\n if !$Name {\n warning LangRes(\"@1member_name_empty\", \"en\")\n }\n if !$member {\n // check member_name\n if DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"member_name\": $Name}).One(\"id\") {\n warning LangRes(\"@1member_name_taken\", \"en\")\n }\n }\n }\n\n action {\n if $ImageId > 0 {\n $Data = DBFind(\"@1binaries\").Where({\"ecosystem\": $ecosystem_id, \"id\": $ImageId}).One(\"data\")\n $ImageId = @1UploadBinary(\"Name,Data,ApplicationId\", \"avatar\", $Data, Int($app_id))\n }\n\n var m map\n m[\"member_info\"] = {information: $Info}\n m[\"image_id\"] = $ImageId\n\n if $member {\n DBUpdateExt(\"@1members\", {\"ecosystem\": $ecosystem_id, \"id\": $key_id}, m)\n } else {\n m[\"id\"] = $key_id\n m[\"member_name\"] = $Name\n m[\"ecosystem\"] = $ecosystem_id\n DBInsert(\"@1members\", m)\n }\n }\n}", + "Value": "contract ProfileEdit {\n data {\n Name string\n Info string \"optional\"\n ImageId string \"optional\"\n }\n\n conditions {\n $member = DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"account\": $account_id}).Row()\n $app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Basic\", \"deleted\": 0}).One(\"id\")\n $ImageId = Int($ImageId)\n\n if !$Name {\n warning LangRes(\"@1member_name_empty\", \"en\")\n }\n if !$member {\n // check member_name\n if DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"member_name\": $Name}).One(\"id\") {\n warning LangRes(\"@1member_name_taken\", \"en\")\n }\n }\n }\n\n action {\n if $ImageId > 0 {\n $Data = DBFind(\"@1binaries\").Where({\"ecosystem\": $ecosystem_id, \"id\": $ImageId}).One(\"data\")\n $ImageId = @1UploadBinary(\"Name,Data,ApplicationId\", \"avatar\", $Data, Int($app_id))\n }\n\n var m map\n m[\"member_info\"] = {information: $Info}\n m[\"image_id\"] = $ImageId\n\n if $member {\n DBUpdateExt(\"@1members\", {\"ecosystem\": $ecosystem_id, \"account\": $account_id}, m)\n } else {\n m[\"account\"] = $account_id\n m[\"member_name\"] = $Name\n m[\"ecosystem\"] = $ecosystem_id\n DBInsert(\"@1members\", m)\n }\n }\n}", "Type": "contracts" }, { "Name": "RoleConditions", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract RoleConditions {\n data {\n Role string\n }\n\n conditions {\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->name\": $Role, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning Sprintf(LangRes(\"@1x_role_only_action\", \"en\"), $Role)\n }\n }\n}", + "Value": "contract RoleConditions {\n data {\n Role string\n }\n\n conditions {\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->name\": $Role, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning Sprintf(LangRes(\"@1x_role_only_action\", \"en\"), $Role)\n }\n }\n}", "Type": "contracts" }, { - "Name": "RolesUnassign", + "Name": "ConsortiumMemberResign", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract RolesUnassign {\n data {\n RowId int\n }\n\n conditions {\n var assigned map roleId int\n assigned = DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"id\": $RowId, \"deleted\": 0}).Columns(\"id,role->id\").Row()\n if !assigned {\n warning LangRes(\"@1role_participant_not_found\", \"en\")\n }\n var buffer_id int\n buffer_id = Int(assigned[\"role.id\"])\n roleId = Int(DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": buffer_id}).One(\"id\"))\n if roleId == 0 {\n warning LangRes(\"@1role_not_found_in_registry\", \"en\")\n }\n\n var specialRules map prev_contract string\n prev_contract = $stack[0]\n if Len($stack) > 2{\n prev_contract = $stack[Len($stack) - 2]\n }\n specialRules[\"@1VotingValidatorAccept\"] = 1\n specialRules[\"@1DelegateRefresh\"] = 1\n specialRules[\"@1ValidatorRequest\"] = 1\n specialRules[\"@1InvestorRefresh\"] = 1\n\n if specialRules[prev_contract] != 1 {\n @1RolesAccessCheck(\"Rid\", roleId)\n }\n }\n\n action {\n var m map\n m[\"deleted\"] = $block_time\n m[\"date_deleted\"] = $block_time\n DBUpdate(\"@1roles_participants\", $RowId, m)\n }\n}", + "Value": "contract ConsortiumMemberResign {\n\n func getRoleId(name string) int {\n var rid int\n rid = Int(AppParam(Int($system_app_id), name, $ecosystem_id))\n if rid == 0 {\n warning Sprintf(LangRes(\"@role_not_set_application_parameter\", \"en\"), name)\n }\n return rid\n }\n\n conditions {\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n var roleConsortiumMember int\n roleConsortiumMember = getRoleId(\"role_consortium_member\")\n if !RoleAccess(roleConsortiumMember) {\n warning LangRes(\"@1consortium_members_only\", \"en\")\n }\n $assigned = DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"member->account\": $account_id, \"role->id\": roleConsortiumMember, \"deleted\": 0}).One(\"id\")\n }\n\n action {\n @1RolesUnassign(\"RowId\", Int($assigned))\n @1NodeRemoveByKey()\n }\n}", "Type": "contracts" }, { "Name": "RolesAccessManager", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract RolesAccessManager {\n data {\n Action string\n Rid int\n ManagerRid string \"optional\"\n Name string \"optional\"\n Type int \"optional\"\n }\n\n func updateAccess(ra array) {\n var roles_access string\n roles_access = JSONEncode(ra)\n DBUpdate(\"@1roles\", $Rid, {\"roles_access\": roles_access})\n }\n\n func updateBufferAccess(ra array) {\n var roles_access string\n roles_access = JSONEncode(ra)\n var filled map\n filled[\"roles_access\"] = roles_access\n filled[\"role_name\"] = $Name\n filled[\"role_type\"] = $Type\n\n if !$buffer_id {\n DBInsert(\"@1buffer_data\", {ecosystem:$ecosystem_id, \"member_id\": $key_id, \"key\": \"roles_access\", \"value\": filled})\n } else {\n DBUpdate(\"@1buffer_data\", Int($buffer_id), {\"value\": filled})\n }\n }\n\n conditions {\n $ManagerRid = Int($ManagerRid)\n if $Rid > 0 {\n @1RolesAccessCheck(\"Rid\", $Rid)\n\n $role = DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": $Rid}).Columns(\"id,roles_access\").Row()\n if !$role {\n warning LangRes(\"@1role_not_found\", \"en\")\n }\n if $ManagerRid > 0 {\n if !DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": $ManagerRid}).One(\"id\") {\n warning LangRes(\"@1role_not_found\", \"en\")\n }\n }\n var ids array, i int\n $ids = ids\n ids = JSONDecode($role[\"roles_access\"])\n while i < Len(ids){\n if ids[i] > 0 {\n $ids = Append($ids, ids[i])\n }\n i = i + 1\n }\n } else {\n $buffer_managers = 0\n $buffer_id = 0\n $ids = []\n var buffer map\n buffer = DBFind(\"@1buffer_data\").Where({\"ecosystem\": $ecosystem_id, \"member_id\": $key_id, \"key\": \"roles_access\"}).Columns(\"id,value,value->roles_access\").Row()\n if buffer {\n $buffer_managers = buffer[\"value.roles_access\"]\n $buffer_id = buffer[\"id\"]\n }\n }\n }\n\n action {\n if $Rid == 0 {\n if $buffer_managers {\n $ids = JSONDecode($buffer_managers)\n }\n }\n if $Action == \"clean\" {\n updateAccess([])\n }\n if $ManagerRid > 0 {\n var i int, idsNew array\n if $Action == \"remove\" {\n while i < Len($ids) {\n if $ids[i] != $ManagerRid {\n idsNew = Append(idsNew, $ids[i])\n }\n i = i + 1\n }\n if $Rid == 0 {\n updateBufferAccess(idsNew)\n } else {\n updateAccess(idsNew)\n }\n }\n if $Action == \"add\" {\n var double bool\n while i < Len($ids) {\n if $ids[i] == $ManagerRid {\n double = true\n }\n i = i + 1\n }\n if !double {\n $ids = Append($ids, $ManagerRid)\n }\n if $Rid == 0 {\n updateBufferAccess($ids)\n } else {\n updateAccess($ids)\n }\n }\n }\n }\n}", + "Value": "contract RolesAccessManager {\n data {\n Action string\n Rid int\n ManagerRid string \"optional\"\n Name string \"optional\"\n Type int \"optional\"\n }\n\n func updateAccess(ra array) {\n var roles_access string\n roles_access = JSONEncode(ra)\n DBUpdate(\"@1roles\", $Rid, {\"roles_access\": roles_access})\n }\n\n func updateBufferAccess(ra array) {\n var roles_access string\n roles_access = JSONEncode(ra)\n var filled map\n filled[\"roles_access\"] = roles_access\n filled[\"role_name\"] = $Name\n filled[\"role_type\"] = $Type\n\n if !$buffer_id {\n DBInsert(\"@1buffer_data\", {ecosystem:$ecosystem_id, \"account\": $account_id, \"key\": \"roles_access\", \"value\": filled})\n } else {\n DBUpdate(\"@1buffer_data\", Int($buffer_id), {\"value\": filled})\n }\n }\n\n conditions {\n $ManagerRid = Int($ManagerRid)\n if $Rid > 0 {\n @1RolesAccessCheck(\"Rid\", $Rid)\n\n $role = DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": $Rid}).Columns(\"id,roles_access\").Row()\n if !$role {\n warning LangRes(\"@1role_not_found\", \"en\")\n }\n if $ManagerRid > 0 {\n if !DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": $ManagerRid}).One(\"id\") {\n warning LangRes(\"@1role_not_found\", \"en\")\n }\n }\n var ids array, i int\n $ids = ids\n ids = JSONDecode($role[\"roles_access\"])\n while i < Len(ids){\n if ids[i] > 0 {\n $ids = Append($ids, ids[i])\n }\n i = i + 1\n }\n } else {\n $buffer_managers = 0\n $buffer_id = 0\n $ids = []\n var buffer map\n buffer = DBFind(\"@1buffer_data\").Where({\"ecosystem\": $ecosystem_id, \"account\": $account_id, \"key\": \"roles_access\"}).Columns(\"id,value,value->roles_access\").Row()\n if buffer {\n $buffer_managers = buffer[\"value.roles_access\"]\n $buffer_id = buffer[\"id\"]\n }\n }\n }\n\n action {\n if $Rid == 0 {\n if $buffer_managers {\n $ids = JSONDecode($buffer_managers)\n }\n }\n if $Action == \"clean\" {\n updateAccess([])\n }\n if $ManagerRid > 0 {\n var i int, idsNew array\n if $Action == \"remove\" {\n while i < Len($ids) {\n if $ids[i] != $ManagerRid {\n idsNew = Append(idsNew, $ids[i])\n }\n i = i + 1\n }\n if $Rid == 0 {\n updateBufferAccess(idsNew)\n } else {\n updateAccess(idsNew)\n }\n }\n if $Action == \"add\" {\n var double bool\n while i < Len($ids) {\n if $ids[i] == $ManagerRid {\n double = true\n }\n i = i + 1\n }\n if !double {\n $ids = Append($ids, $ManagerRid)\n }\n if $Rid == 0 {\n updateBufferAccess($ids)\n } else {\n updateAccess($ids)\n }\n }\n }\n }\n}", "Type": "contracts" }, { "Name": "DelegateRefresh", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract DelegateRefresh {\n\n func notInArray(val string, arr array) bool {\n var i int\n // info arr\n while i < Len(arr) {\n if val == arr[i] {\n return false\n }\n i = i + 1\n }\n return true\n }\n\n func getRoleId(name string) int {\n var rid int\n rid = Int(AppParam(Int($system_app_id), name, $ecosystem_id))\n if rid == 0 {\n warning Sprintf(LangRes(\"@role_not_set_application_parameter\", \"en\"), name)\n }\n return rid\n }\n\n conditions {\n MainCondition()\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n var roleId int\n roleId = getRoleId(\"role_delegate\")\n $role = DBFind(\"@1roles\").Where({\"id\": roleId, \"deleted\": 0}).Row()\n if !$role {\n warning LangRes(\"@1role_not_found\", \"en\")\n }\n }\n\n action {\n // get delegates ids\n var delegateIds currentDelegates ecosystems array i ecoId int rid string\n ecosystems = DBFind(\"@1ecosystems\").Columns(\"id\")\n while i < Len(ecosystems) {\n var eco delegateParam map\n eco = ecosystems[i]\n ecoId = Int(eco[\"id\"])\n delegateParam = DBFind(\"@1parameters\").Where({\"name\": \"delegate_account\", \"ecosystem\": ecoId}).Row()\n if !delegateParam{\n delegateParam = DBFind(\"@1parameters\").Where({\"name\": \"founder_account\", \"ecosystem\": ecoId}).Row()\n }\n\n if notInArray(delegateParam[\"value\"], delegateIds){\n delegateIds = Append(delegateIds, delegateParam[\"value\"])\n }\n i = i + 1\n }\n\n // remove old role assigns\n rid = Int($role[\"id\"])\n currentDelegates = DBFind(\"@1roles_participants\").Where({\"role->id\": rid, \"deleted\": 0}).Columns(\"id,member->member_id\")\n var delegate map id int\n i = 0\n while i < Len(currentDelegates) {\n delegate = currentDelegates[i]\n if notInArray(delegate[\"member.member_id\"], delegateIds){\n id = Int(delegate[\"id\"])\n @1RolesUnassign(\"RowId\", id)\n }\n i = i + 1\n }\n\n // assign new roles\n var key map delegateId int\n i = 0\n while i < Len(delegateIds) {\n delegateId = Int(delegateIds[i])\n key = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": delegateId}).Row()\n if key {\n // check role dup\n if !DBFind(\"@1roles_participants\").Where({\"member->member_id\": delegateId, \"role->id\": rid, \"deleted\": 0}).Row(){\n @1RolesAssign(\"Rid,MemberId\", rid, Int(key[\"id\"]))\n }\n }\n i = i + 1\n }\n }\n}", + "Value": "contract DelegateRefresh {\n\n func notInArray(val string, arr array) bool {\n var i int\n // info arr\n while i < Len(arr) {\n if val == arr[i] {\n return false\n }\n i = i + 1\n }\n return true\n }\n\n func getRoleId(name string) int {\n var rid int\n rid = Int(AppParam(Int($system_app_id), name, $ecosystem_id))\n if rid == 0 {\n warning Sprintf(LangRes(\"@role_not_set_application_parameter\", \"en\"), name)\n }\n return rid\n }\n\n conditions {\n MainCondition()\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n var roleId int\n roleId = getRoleId(\"role_delegate\")\n $role = DBFind(\"@1roles\").Where({\"id\": roleId, \"deleted\": 0}).Row()\n if !$role {\n warning LangRes(\"@1role_not_found\", \"en\")\n }\n }\n\n action {\n // get delegates ids\n var delegateIds currentDelegates ecosystems array i ecoId int rid string\n ecosystems = DBFind(\"@1ecosystems\").Columns(\"id\")\n while i < Len(ecosystems) {\n var eco delegateParam map\n eco = ecosystems[i]\n ecoId = Int(eco[\"id\"])\n delegateParam = DBFind(\"@1parameters\").Where({\"name\": \"delegate_account\", \"ecosystem\": ecoId}).Row()\n if !delegateParam{\n delegateParam = DBFind(\"@1parameters\").Where({\"name\": \"founder_account\", \"ecosystem\": ecoId}).Row()\n }\n\n if notInArray(delegateParam[\"value\"], delegateIds){\n delegateIds = Append(delegateIds, delegateParam[\"value\"])\n }\n i = i + 1\n }\n\n // remove old role assigns\n rid = Int($role[\"id\"])\n currentDelegates = DBFind(\"@1roles_participants\").Where({\"role->id\": rid, \"deleted\": 0}).Columns(\"id,member->account\")\n var delegate map id int\n i = 0\n while i < Len(currentDelegates) {\n delegate = currentDelegates[i]\n var memberKey string\n memberKey = Str(AddressToId(delegate[\"member.account\"]))\n if notInArray(memberKey, delegateIds){\n id = Int(delegate[\"id\"])\n @1RolesUnassign(\"RowId\", id)\n }\n i = i + 1\n }\n\n // assign new roles\n var key map delegateId int\n i = 0\n while i < Len(delegateIds) {\n delegateId = Int(delegateIds[i])\n var delegateAccount string\n delegateAccount = IdToAddress(delegateId)\n key = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": delegateAccount, \"deleted\": 0}).Row()\n if key {\n // check role dup\n if !DBFind(\"@1roles_participants\").Where({\"member->account\": delegateAccount, \"role->id\": rid, \"deleted\": 0}).Row(){\n @1RolesAssign(\"Rid,MemberAccount\", rid, delegateAccount)\n }\n }\n i = i + 1\n }\n }\n}", "Type": "contracts" }, { "Name": "RolesCreate", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract RolesCreate {\n data {\n Name string\n Type int\n }\n\n func getMemberInfo(kid int) map {\n var res member map\n member = DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"id\": kid}).Row()\n if member {\n res[\"member_id\"] = member[\"id\"]\n res[\"member_name\"] = member[\"member_name\"]\n res[\"image_id\"] = member[\"image_id\"]\n } else {\n member = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": kid}).Row()\n if member {\n res[\"member_id\"] = member[\"id\"]\n res[\"member_name\"] = IdToAddress(Int(member[\"id\"]))\n res[\"image_id\"] = 0\n }\n }\n return res\n }\n\n conditions {\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n // system role\n if $Type == 3 {\n warning LangRes(\"@1system_role_can_not_create\", \"en\")\n }\n\n // check role_creates_roles\n $check_access = AppParam(Int($system_app_id), \"role_creates_roles\", $ecosystem_id)\n if $check_access && Str($check_access) != \"0\" {\n var rids array\n rids = JSONDecode(\"[\"+$check_access+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n } else {\n var admin_id string\n admin_id = AppParam(Int($system_app_id), \"role_admin\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+admin_id+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n if $Name == DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"role_name\": $Name}).One(\"role_name\") {\n warning LangRes(\"@1role_exists\", \"en\")\n }\n if Size($Name) < 3 || Size($Name) > 30 {\n warning LangRes(\"@1name\", \"en\") + \" \" + LangRes(\"@1validate_role_name\", \"en\")\n }\n }\n\n action {\n var roles_access_arr array, buffer map\n buffer = DBFind(\"@1buffer_data\").Where({\"ecosystem\": $ecosystem_id, \"member_id\": $key_id, \"key\": \"roles_access\"}).Columns(\"id,value,value->roles_access\").Row()\n if buffer {\n roles_access_arr = JSONDecode(buffer[\"value.roles_access\"])\n var filled map\n filled[\"roles_access\"] = []\n filled[\"role_name\"] = \"\"\n filled[\"role_type\"] = \"\"\n DBUpdate(\"@1buffer_data\", Int(buffer[\"id\"]), {\"value\": filled})\n }\n var m map\n m[\"creator\"] = getMemberInfo($key_id)\n m[\"role_name\"] = $Name\n m[\"role_type\"] = $Type\n m[\"date_created\"] = $block_time\n m[\"roles_access\"] = JSONEncode(roles_access_arr)\n m[\"ecosystem\"] = $ecosystem_id\n $result = DBInsert(\"@1roles\", m)\n }\n}", + "Value": "contract RolesCreate {\n data {\n Name string\n Type int\n }\n\n func getMemberInfo(account string) map {\n var res member map\n member = DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"account\": account}).Row()\n if member {\n res[\"account\"] = member[\"account\"]\n res[\"member_name\"] = member[\"member_name\"]\n res[\"image_id\"] = member[\"image_id\"]\n } else {\n if DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": account, \"deleted\": 0}).Row() {\n res[\"account\"] = account\n res[\"member_name\"] = account\n res[\"image_id\"] = \"0\"\n }\n }\n return res\n }\n\n conditions {\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n // system role\n if $Type == 3 {\n warning LangRes(\"@1system_role_can_not_create\", \"en\")\n }\n\n // check role_creates_roles\n $check_access = AppParam(Int($system_app_id), \"role_creates_roles\", $ecosystem_id)\n if $check_access && Str($check_access) != \"0\" {\n var rids array\n rids = JSONDecode(\"[\"+$check_access+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n } else {\n var admin_id string\n admin_id = AppParam(Int($system_app_id), \"role_admin\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+admin_id+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n if $Name == DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"role_name\": $Name}).One(\"role_name\") {\n warning LangRes(\"@1role_exists\", \"en\")\n }\n if Size($Name) < 3 || Size($Name) > 30 {\n warning LangRes(\"@1name\", \"en\") + \" \" + LangRes(\"@1validate_role_name\", \"en\")\n }\n }\n\n action {\n var roles_access_arr array, buffer map\n buffer = DBFind(\"@1buffer_data\").Where({\"ecosystem\": $ecosystem_id, \"account\": $account_id, \"key\": \"roles_access\"}).Columns(\"id,value,value->roles_access\").Row()\n if buffer {\n roles_access_arr = JSONDecode(buffer[\"value.roles_access\"])\n var filled map\n filled[\"roles_access\"] = []\n filled[\"role_name\"] = \"\"\n filled[\"role_type\"] = \"\"\n DBUpdate(\"@1buffer_data\", Int(buffer[\"id\"]), {\"value\": filled})\n }\n var m map\n m[\"creator\"] = getMemberInfo($account_id)\n m[\"role_name\"] = $Name\n m[\"role_type\"] = $Type\n m[\"date_created\"] = $block_time\n m[\"roles_access\"] = JSONEncode(roles_access_arr)\n m[\"ecosystem\"] = $ecosystem_id\n $result = DBInsert(\"@1roles\", m)\n }\n}", "Type": "contracts" }, { "Name": "InvestorRefresh", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract InvestorRefresh {\n data {\n RoleId int\n }\n\n func notInArray(val string, arr array) bool {\n var i lenArr int\n lenArr = Len(arr)\n while i < lenArr {\n if val == Str(arr[i]) {\n return false\n }\n i = i + 1\n }\n return true\n }\n\n func getParamInt(id int, name string) int {\n var param int\n param = Int(AppParam(id, name, 1))\n if param == 0 {\n warning Sprintf(LangRes(\"@1application_parameter_not_set\", \"en\"), name)\n }\n return param\n }\n\n func getRoleId(name string) int {\n var rid int\n rid = Int(AppParam(Int($system_app_id), name, $ecosystem_id))\n if rid == 0 {\n warning Sprintf(LangRes(\"@role_not_set_application_parameter\", \"en\"), name)\n }\n return rid\n }\n\n conditions {\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n var appId int\n appId = Int(DBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\", \"deleted\": 0}).One(\"id\"))\n if appId == 0 {\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n\n var roleValidatorId roleInvestorId string\n\n roleValidatorId = getRoleId(\"role_validator\")\n if !RoleAccess(roleValidatorId) {\n warning LangRes(\"@1not_validator_can_not_run\", \"en\")\n }\n\n roleInvestorId = getRoleId(\"role_investor_with_voting_rights\")\n $roleId = Int(DBFind(\"@1roles\").Where({\"id\": roleInvestorId, \"deleted\": 0}).One(\"id\"))\n if $roleId == 0 {\n warning LangRes(\"@1investor_role_not_found_or_removed\", \"en\")\n }\n\n $limitInvestors = getParamInt(appId, \"investors_number\")\n }\n\n action {\n // get investors ids\n var keysInvestors assignedInvestors investorsIds assignedIds array\n keysInvestors = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id}).Columns(\"id\").Order([{amount:\"-1\"},{id:\"-1\"}]).Limit($limitInvestors)\n assignedInvestors = DBFind(\"@1roles_participants\").Where({\"role->id\": $roleId, \"deleted\": 0}).Columns(\"member->member_id\")\n\n // get ids\n var i int\n while i < Len(keysInvestors) {\n var inv map\n inv = keysInvestors[i]\n investorsIds[i] = inv[\"id\"]\n i = i + 1\n }\n i = 0\n while i < Len(assignedInvestors) {\n var inv map\n inv = assignedInvestors[i]\n assignedIds[i] = inv[\"member.member_id\"]\n i = i + 1\n }\n\n // remove old investors\n var assigned map mid string\n i = 0\n while i < Len(assignedIds) {\n if notInArray(assignedIds[i], investorsIds){\n mid = assignedIds[i]\n assigned = DBFind(\"@1roles_participants\").Where({\"member->member_id\": mid, \"role->id\": $roleId}).Row()\n if assigned {\n @1RolesUnassign(\"RowId\", Int(assigned[\"id\"]))\n }\n }\n i = i + 1\n }\n // add new investors\n i = 0\n while i < Len(investorsIds) {\n if notInArray(investorsIds[i], assignedIds){\n var id int\n id = Int(investorsIds[i])\n if DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": id}).Row(){\n @1RolesAssign(\"Rid,MemberId\", $roleId, id)\n }\n }\n i = i + 1\n }\n }\n}", + "Value": "contract InvestorRefresh {\n data {\n RoleId int\n }\n\n func notInArray(val string, arr array) bool {\n var i lenArr int\n lenArr = Len(arr)\n while i < lenArr {\n if val == Str(arr[i]) {\n return false\n }\n i = i + 1\n }\n return true\n }\n\n func getParamInt(id int, name string) int {\n var param int\n param = Int(AppParam(id, name, 1))\n if param == 0 {\n warning Sprintf(LangRes(\"@1application_parameter_not_set\", \"en\"), name)\n }\n return param\n }\n\n func getRoleId(name string) int {\n var rid int\n rid = Int(AppParam(Int($system_app_id), name, $ecosystem_id))\n if rid == 0 {\n warning Sprintf(LangRes(\"@role_not_set_application_parameter\", \"en\"), name)\n }\n return rid\n }\n\n conditions {\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n var appId int\n appId = Int(DBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\", \"deleted\": 0}).One(\"id\"))\n if appId == 0 {\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n\n var roleConsortiumMemberId roleInvestorId string\n\n roleConsortiumMemberId = getRoleId(\"role_consortium_member\")\n if !RoleAccess(roleConsortiumMemberId) {\n warning LangRes(\"@1consortium_members_only\", \"en\")\n }\n\n roleInvestorId = getRoleId(\"role_investor_with_voting_rights\")\n $roleId = Int(DBFind(\"@1roles\").Where({\"id\": roleInvestorId, \"deleted\": 0}).One(\"id\"))\n if $roleId == 0 {\n warning LangRes(\"@1investor_role_not_found_or_removed\", \"en\")\n }\n\n $limitInvestors = getParamInt(appId, \"investors_number\")\n }\n\n action {\n // get investors ids\n var keysInvestors assignedInvestors investorsIds assignedIds array\n keysInvestors = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"deleted\": 0}).Columns(\"account\").Order({\"amount\": \"-1\", \"id\": \"-1\"}).Limit($limitInvestors)\n assignedInvestors = DBFind(\"@1roles_participants\").Where({\"role->id\": $roleId, \"deleted\": 0}).Columns(\"member->account\")\n\n // get ids\n var i int\n while i < Len(keysInvestors) {\n var inv map\n inv = keysInvestors[i]\n investorsIds[i] = inv[\"account\"]\n i = i + 1\n }\n i = 0\n while i < Len(assignedInvestors) {\n var inv map\n inv = assignedInvestors[i]\n assignedIds[i] = inv[\"member.account\"]\n i = i + 1\n }\n\n // remove old investors\n var assigned map mid string\n i = 0\n while i < Len(assignedIds) {\n if notInArray(assignedIds[i], investorsIds){\n mid = assignedIds[i]\n assigned = DBFind(\"@1roles_participants\").Where({\"member->account\": mid, \"role->id\": $roleId}).Row()\n if assigned {\n @1RolesUnassign(\"RowId\", Int(assigned[\"id\"]))\n }\n }\n i = i + 1\n }\n // add new investors\n i = 0\n while i < Len(investorsIds) {\n if notInArray(investorsIds[i], assignedIds){\n var account string\n account = investorsIds[i]\n if DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": account, \"deleted\": 0}).Row(){\n @1RolesAssign(\"Rid,MemberAccount\", $roleId, account)\n }\n }\n i = i + 1\n }\n }\n}", "Type": "contracts" }, { "Name": "RolesInstall", "Conditions": "ContractConditions(\"@1AdminCondition\")", - "Value": "contract RolesInstall {\n\n func updateParam(name string, value int) {\n var app_param map\n app_param = DBFind(\"@1app_params\").Where({\"ecosystem\": $ecosystem_id, \"app_id\": $app_id, \"name\": name}).Row()\n if app_param {\n var params map\n params[\"Id\"] = Int(app_param[\"id\"])\n params[\"Value\"] = value\n params[\"Conditions\"] = \"ContractConditions(\\\"MainCondition\\\")\"\n CallContract(\"@1EditAppParam\", params)\n } else {\n var params map\n params[\"ApplicationId\"] = $app_id\n params[\"Name\"] = name\n params[\"Value\"] = value\n params[\"Conditions\"] = \"ContractConditions(\\\"MainCondition\\\")\"\n CallContract(\"@1NewAppParam\", params)\n }\n }\n\n func addRole(name string, withParticipant bool, managerId int) int{\n var m map paramName string id int\n m[\"role_name\"] = name\n m[\"role_type\"] = 3\n m[\"ecosystem\"] = $ecosystem_id\n id = Int(DBFind(\"@1roles\").Where(m).One(\"id\"))\n if id == 0 {\n m[\"default_page\"] = \"\"\n m[\"deleted\"] = 0\n m[\"creator->image_id\"] = 0\n m[\"creator->member_name\"] = \"founder\"\n m[\"creator->member_id\"] = Str($key_id)\n m[\"date_created\"] = $block_time\n if managerId > 0 {\n m[\"roles_access\"] = Sprintf(\"[%v]\", managerId)\n } else {\n m[\"roles_access\"] = \"[]\"\n }\n id = DBInsert(\"@1roles\", m)\n }\n paramName = \"role_\" + Replace(ToLower(name), \" \", \"_\")\n updateParam(paramName, id)\n\n if withParticipant {\n var participant map\n participant[\"role->id\"] = id\n participant[\"role->type\"] = m[\"role_type\"]\n participant[\"role->name\"] = m[\"role_name\"]\n participant[\"role->image_id\"] = 0\n participant[\"member->member_id\"] = Str($key_id)\n participant[\"member->member_name\"] = \"founder\"\n participant[\"member->image_id\"] = 0\n participant[\"ecosystem\"] = $ecosystem_id\n\n if !DBFind(\"@1roles_participants\").Where(participant).One(\"id\") {\n participant[\"date_created\"] = $block_time\n DBInsert(\"@1roles_participants\", participant)\n }\n }\n return id\n }\n\n conditions {\n MainCondition()\n }\n\n action {\n $app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n var managerId int\n managerId = addRole(\"Admin\", true, 0)\n @1RolesAccessManager(\"Action,Rid,ManagerRid\", \"add\", managerId, managerId)\n addRole(\"Developer\", true, managerId)\n\n if $ecosystem_id == 1 {\n addRole(\"Consensus\", false, managerId)\n addRole(\"Candidate for validators\", false, managerId)\n addRole(\"Validator\", false, managerId)\n addRole(\"Investor with voting rights\", false, managerId)\n addRole(\"Delegate\", false, managerId)\n }\n\n updateParam(\"role_creates_roles\", 0)\n }\n}", + "Value": "contract RolesInstall {\n\n func updateParam(name string, value int) {\n var app_param map\n app_param = DBFind(\"@1app_params\").Where({\"ecosystem\": $ecosystem_id, \"app_id\": $app_id, \"name\": name}).Row()\n if app_param {\n var params map\n params[\"Id\"] = Int(app_param[\"id\"])\n params[\"Value\"] = value\n params[\"Conditions\"] = \"ContractConditions(\\\"MainCondition\\\")\"\n CallContract(\"@1EditAppParam\", params)\n } else {\n var params map\n params[\"ApplicationId\"] = $app_id\n params[\"Name\"] = name\n params[\"Value\"] = value\n params[\"Conditions\"] = \"ContractConditions(\\\"MainCondition\\\")\"\n CallContract(\"@1NewAppParam\", params)\n }\n }\n\n func addRole(name string, withParticipant bool, managerId int) int{\n var m map paramName string id int\n m[\"role_name\"] = name\n m[\"role_type\"] = 3\n m[\"ecosystem\"] = $ecosystem_id\n id = Int(DBFind(\"@1roles\").Where(m).One(\"id\"))\n if id == 0 {\n m[\"default_page\"] = \"\"\n m[\"deleted\"] = 0\n m[\"creator->image_id\"] = 0\n m[\"creator->member_name\"] = \"founder\"\n m[\"creator->account\"] = Str($account_id)\n m[\"date_created\"] = $block_time\n if managerId > 0 {\n m[\"roles_access\"] = Sprintf(\"[%v]\", managerId)\n } else {\n m[\"roles_access\"] = \"[]\"\n }\n id = DBInsert(\"@1roles\", m)\n }\n paramName = \"role_\" + Replace(ToLower(name), \" \", \"_\")\n updateParam(paramName, id)\n\n if withParticipant {\n var participant map\n participant[\"role->id\"] = id\n participant[\"role->type\"] = m[\"role_type\"]\n participant[\"role->name\"] = m[\"role_name\"]\n participant[\"role->image_id\"] = 0\n participant[\"member->account\"] = Str($account_id)\n participant[\"member->member_name\"] = \"founder\"\n participant[\"member->image_id\"] = 0\n participant[\"ecosystem\"] = $ecosystem_id\n\n if !DBFind(\"@1roles_participants\").Where(participant).One(\"id\") {\n participant[\"date_created\"] = $block_time\n DBInsert(\"@1roles_participants\", participant)\n }\n }\n return id\n }\n\n conditions {\n MainCondition()\n }\n\n action {\n $app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n var managerId int\n managerId = addRole(\"Admin\", true, 0)\n @1RolesAccessManager(\"Action,Rid,ManagerRid\", \"add\", managerId, managerId)\n addRole(\"Developer\", true, managerId)\n\n if $ecosystem_id == 1 {\n addRole(\"Consortium Member\", true, managerId)\n addRole(\"Consortium Member Candidate\", false, managerId)\n addRole(\"Sidechain Node\", true, managerId)\n addRole(\"Investor with Voting Rights\", false, managerId)\n addRole(\"Delegate\", false, managerId)\n }\n\n updateParam(\"role_creates_roles\", 0)\n }\n}", "Type": "contracts" }, { "Name": "RolesRequest", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract RolesRequest {\n data {\n Rid int\n }\n\n conditions {\n if !DBFind(\"@1roles\").WhereId($Rid).One(\"id\") {\n warning LangRes(\"@1role_not_found\", \"en\")\n }\n\n if DBFind(\"@1roles_participants\").Where({\"role->id\": $Rid, \"member->member_id\":$key_id, \"deleted\": 0}).One(\"id\") {\n warning LangRes(\"@1role_you_added_already\", \"en\")\n }\n\n if DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"page_name\": \"@1roles_request_view\", \"page_params->rid\": $Rid, \"sender->member_id\": $key_id, \"closed\": 0}).One(\"id\") {\n warning LangRes(\"@1request_sent_already\", \"en\")\n }\n }\n\n action {\n var params map\n params[\"rid\"] = $Rid\n\n var member_id int\n member_id = EcosysParam(\"founder_account\")\n\n @1NotificationsSend(\"MemberId,Sender,Icon,Header,Body,Page,Params\", member_id, 1, \"fa-bars\", LangRes(\"@1roles\", \"en\"), LangRes(\"@1new_request_received\", \"en\"), \"@1roles_request_view\", params)\n }\n}", + "Value": "contract RolesRequest {\n data {\n Rid int\n }\n\n conditions {\n if !DBFind(\"@1roles\").WhereId($Rid).One(\"id\") {\n warning LangRes(\"@1role_not_found\", \"en\")\n }\n\n if DBFind(\"@1roles_participants\").Where({\"role->id\": $Rid, \"member->account\": $account_id, \"deleted\": 0}).One(\"id\") {\n warning LangRes(\"@1role_you_added_already\", \"en\")\n }\n\n if DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"page_name\": \"@1roles_request_view\", \"page_params->rid\": $Rid, \"sender->account\": $account_id, \"closed\": 0}).One(\"id\") {\n warning LangRes(\"@1request_sent_already\", \"en\")\n }\n }\n\n action {\n var params map\n params[\"rid\"] = $Rid\n\n var founder_id int founder_account string\n founder_id = Int(EcosysParam(\"founder_account\"))\n founder_account = IdToAddress(founder_id)\n\n @1NotificationsSend(\"MemberAccount,Sender,Icon,Header,Body,Page,Params\", founder_account, 1, \"fa-bars\", LangRes(\"@1roles\", \"en\"), LangRes(\"@1new_request_received\", \"en\"), \"@1roles_request_view\", params)\n }\n}", "Type": "contracts" }, { "Name": "RolesRequestDecision", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract RolesRequestDecision {\n data {\n Decision int\n NotificId int\n Rid int \"optional\"\n MemberId int \"optional\"\n }\n\n conditions {}\n\n action {\n if $Decision == 1 {\n @1RolesAssign(\"Rid,MemberId\", $Rid, $MemberId)\n }\n\n if $NotificId > 0 {\n @1NotificationsClose(\"NotificId\", $NotificId)\n }\n }\n}", + "Value": "contract RolesRequestDecision {\n data {\n Decision int\n NotificId int\n Rid int \"optional\"\n MemberAccount string \"optional\"\n }\n\n conditions {}\n\n action {\n if $Decision == 1 {\n @1RolesAssign(\"Rid,MemberAccount\", $Rid, $MemberAccount)\n }\n\n if $NotificId > 0 {\n @1NotificationsClose(\"NotificId\", $NotificId)\n }\n }\n}", "Type": "contracts" }, { @@ -944,73 +962,61 @@ { "Name": "TokensDecDeposit", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract TokensDecDeposit {\n data {\n MemberId int\n Amount money\n }\n\n func getPermission() {\n var array_permissions array result i int prevContract string\n array_permissions = [\"@1InvestTransfer\"]\n\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n while i < Len(array_permissions) {\n var contract_name string\n contract_name = array_permissions[i]\n if contract_name==prevContract {\n result = 1\n }\n i = i + 1\n }\n\n if result == 0 {\n warning LangRes(\"@1deposit_cannot_be_made\", \"en\")\n }\n }\n \n conditions {\n getPermission() //getting permission to run\n }\n\n action {\n var s map\n s[\"-deposit\"] = $Amount\n DBUpdate(\"@1keys\",Int($MemberId),s)\n }\n}", + "Value": "contract TokensDecDeposit {\n data {\n MemberAccount string\n Amount money\n }\n\n func getPermission() {\n var array_permissions array result i int prevContract string\n array_permissions = [\"@1InvestTransfer\"]\n\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n while i < Len(array_permissions) {\n var contract_name string\n contract_name = array_permissions[i]\n if contract_name == prevContract {\n result = 1\n }\n i = i + 1\n }\n\n if result == 0 {\n warning LangRes(\"@1deposit_cannot_be_made\", \"en\")\n }\n }\n \n conditions {\n getPermission() //getting permission to run\n }\n\n action {\n var s map\n s[\"-deposit\"] = $Amount\n DBUpdateExt(\"@1keys\", {\"account\": $MemberAccount, \"deleted\": 0}, s)\n }\n}", "Type": "contracts" }, { "Name": "TokensIncDeposit", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract TokensIncDeposit {\n data {\n Amount money\n }\n\n conditions {\n $amount = DBFind(\"@1keys\").WhereId($key_id).Row()\n if Money($Amount) > (Money($amount[\"amount\"]) - Money($amount[\"deposit\"])){\n warning LangRes(\"@1insufficient_funds\", \"en\")\n }\n }\n \n action {\n var s map\n s[\"+deposit\"] = $Amount\n DBUpdate(\"@1keys\",$key_id,s)\n }\n}", + "Value": "contract TokensIncDeposit {\n data {\n Amount money\n }\n\n conditions {\n $amount = DBFind(\"@1keys\").Where({\"account\": $account_id, \"deleted\": 0}).Row()\n if Money($Amount) > (Money($amount[\"amount\"]) - Money($amount[\"deposit\"])){\n warning LangRes(\"@1insufficient_funds\", \"en\")\n }\n }\n \n action {\n var s map\n s[\"+deposit\"] = $Amount\n DBUpdateExt(\"@1keys\", {\"account\": $account_id, \"deleted\": 0}, s)\n }\n}", "Type": "contracts" }, { "Name": "BlockMember", "Conditions": "ContractConditions(\"@1AdminCondition\")", - "Value": "contract BlockMember {\n data {\n KeyId int\n Value int\n }\n\n conditions {\n ContractConditions(\"@1AdminCondition\")\n }\n\n action {\n @1TokensLockoutMember(\"KeyId,Value\", $KeyId, $Value)\n }\n}", + "Value": "contract BlockMember {\n data {\n MemberAccount string\n Value int\n }\n\n conditions {\n ContractConditions(\"@1AdminCondition\")\n }\n\n action {\n @1TokensLockoutMember(\"MemberAccount,Value\", $MemberAccount, $Value)\n }\n}", "Type": "contracts" }, { "Name": "TokensTransfer", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract TokensTransfer {\n data {\n Amount money\n SenderId int\n RecipientId int\n Comment string \"optional\"\n Ecosystem int \"optional\"\n }\n\n func getEcosystem() {\n $e_id = Int($Ecosystem)\n if $e_id == 0 {\n $e_id = $ecosystem_id\n } else {\n if !DBFind(\"@1ecosystems\").Where({\"id\": $e_id}).One(\"id\") {\n warning Sprintf(LangRes(\"@1ecosystem_not_found\", \"en\"), $e_id)\n }\n }\n }\n\n func getPermission() {\n var array_permissions array result i int prevContract string\n array_permissions = [\"@1TokensSend\", \"@1PoaTokensSend\", \"@1TokensRefundAccept\", \"@1ExCancel\", \"@1ExCancelOrder\",\"@1ExCancelOrders\", \"@1ExMatching\", \"@1ExMatchingOTC\", \"@1ExOrder\", \"@1InvestTransfer\"]\n\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n while i < Len(array_permissions) {\n var contract_name string\n contract_name = array_permissions[i]\n if contract_name==prevContract {\n result = 1\n }\n i = i + 1\n }\n\n if result == 0 {\n warning LangRes(\"@1tokens_transfer_cannot_be_made\", \"en\")\n }\n }\n\n func checkSender() {\n var sender_map map check_dep money\n sender_map = DBFind(\"@1keys\").Where({\"id\": $SenderId, \"ecosystem\": $e_id}).Row()\n\n if !sender_map {\n warning Sprintf(LangRes(\"@1sender_x_invalid\", \"en\"), $SenderId)\n }\n if Int(sender_map[\"blocked\"]) != 0 {\n warning LangRes(\"@1sender_blocked\", \"en\")\n }\n if Int(sender_map[\"deleted\"]) != 0 {\n warning LangRes(\"@1sender_deleted\", \"en\")\n }\n if Money(sender_map[\"amount\"]) < $Amount {\n warning LangRes(\"@1amount_less_than_needed\", \"en\")\n }\n check_dep = Money(sender_map[\"amount\"]) - Money(sender_map[\"deposit\"])\n if Money(check_dep) < $Amount {\n warning LangRes(\"@1amount_less_than_needed\", \"en\")\n }\n }\n\n func checkRecipient() {\n var recipient_map map\n recipient_map = DBFind(\"@1keys\").Where({\"id\": $RecipientId, \"ecosystem\": $e_id}).Row()\n\n if !recipient_map {\n warning Sprintf(LangRes(\"@1recipient_x_invalid\", \"en\"), $RecipientId)\n }\n if Int(recipient_map[\"blocked\"]) != 0 {\n warning LangRes(\"@1recipient_blocked\", \"en\")\n }\n if Int(recipient_map[\"deleted\"]) != 0 {\n warning LangRes(\"@1recipient_deleted\", \"en\")\n }\n }\n\n conditions {\n getEcosystem() //getting an ecosystem number\n getPermission() //getting permission to run\n checkSender() //check the sender\n checkRecipient() //check the recipient\n\n //check amount\n if $Amount == 0 {\n warning LangRes(\"@1amount_zero\", \"en\")\n }\n if $Amount < 0 {\n warning LangRes(\"@1amount_less_zero\", \"en\")\n }\n }\n\n action {\n DBUpdateExt(\"@1keys\", {\"id\": $SenderId, \"ecosystem\": $e_id}, {\"-amount\": $Amount})\n DBUpdateExt(\"@1keys\", {\"id\": $RecipientId, \"ecosystem\": $e_id}, {\"+amount\": $Amount})\n\n var m map\n m[\"sender_id\"] = $SenderId\n m[\"recipient_id\"] = $RecipientId\n m[\"amount\"] = $Amount\n m[\"comment\"] = $Comment\n m[\"block_id\"] = $block\n m[\"txhash\"] = $txhash\n m[\"ecosystem\"] = $e_id\n m[\"type\"] = 3\n m[\"created_at\"] = $block_time\n DBInsert(\"@1history\", m)\n }\n}", + "Value": "contract TokensTransfer {\n data {\n Amount money\n SenderAccount string\n RecipientAccount string\n Comment string \"optional\"\n Ecosystem int \"optional\"\n }\n\n func getEcosystem() {\n $e_id = Int($Ecosystem)\n if $e_id == 0 {\n $e_id = $ecosystem_id\n } else {\n if !DBFind(\"@1ecosystems\").Where({\"id\": $e_id}).One(\"id\") {\n warning Sprintf(LangRes(\"@1ecosystem_not_found\", \"en\"), $e_id)\n }\n }\n }\n\n func getPermission() {\n var array_permissions array result i int prevContract string\n array_permissions = [\"@1TokensSend\", \"@1PoaTokensSend\", \"@1TokensRefundAccept\", \"@1ExCancel\", \"@1ExCancelOrder\",\"@1ExCancelOrders\", \"@1ExMatching\", \"@1ExMatchingOTC\", \"@1ExOrder\", \"@1InvestTransfer\"]\n\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n while i < Len(array_permissions) {\n var contract_name string\n contract_name = array_permissions[i]\n if contract_name == prevContract {\n result = 1\n }\n i = i + 1\n }\n\n if result == 0 {\n warning LangRes(\"@1tokens_transfer_cannot_be_made\", \"en\")\n }\n }\n\n func checkSender() {\n var sender_map map check_dep money\n sender_map = DBFind(\"@1keys\").Where({\"ecosystem\": $e_id, \"account\": $SenderAccount, \"deleted\": 0}).Row()\n\n if !sender_map {\n warning Sprintf(LangRes(\"@1sender_x_invalid\", \"en\"), $SenderAccount)\n }\n if Int(sender_map[\"blocked\"]) != 0 {\n warning LangRes(\"@1sender_blocked\", \"en\")\n }\n if Int(sender_map[\"deleted\"]) != 0 {\n warning LangRes(\"@1sender_deleted\", \"en\")\n }\n if Money(sender_map[\"amount\"]) < $Amount {\n warning LangRes(\"@1amount_less_than_needed\", \"en\")\n }\n check_dep = Money(sender_map[\"amount\"]) - Money(sender_map[\"deposit\"])\n if Money(check_dep) < $Amount {\n warning LangRes(\"@1amount_less_than_needed\", \"en\")\n }\n }\n\n func checkRecipient() {\n var recipient_map map\n recipient_map = DBFind(\"@1keys\").Where({\"ecosystem\": $e_id, \"account\": $RecipientAccount, \"deleted\": 0}).Row()\n\n if !recipient_map {\n warning Sprintf(LangRes(\"@1recipient_x_invalid\", \"en\"), $RecipientAccount)\n }\n if Int(recipient_map[\"blocked\"]) != 0 {\n warning LangRes(\"@1recipient_blocked\", \"en\")\n }\n if Int(recipient_map[\"deleted\"]) != 0 {\n warning LangRes(\"@1recipient_deleted\", \"en\")\n }\n }\n\n conditions {\n getEcosystem() //getting an ecosystem number\n getPermission() //getting permission to run\n checkSender() //check the sender\n checkRecipient() //check the recipient\n\n //check amount\n if $Amount == 0 {\n warning LangRes(\"@1amount_zero\", \"en\")\n }\n if $Amount < 0 {\n warning LangRes(\"@1amount_less_zero\", \"en\")\n }\n }\n\n action {\n DBUpdateExt(\"@1keys\", {\"ecosystem\": $e_id, \"account\": $SenderAccount, \"deleted\": 0}, {\"-amount\": $Amount})\n DBUpdateExt(\"@1keys\", {\"ecosystem\": $e_id, \"account\": $RecipientAccount, \"deleted\": 0}, {\"+amount\": $Amount})\n\n var m map\n m[\"sender_id\"] = AddressToId($SenderAccount)\n m[\"recipient_id\"] = AddressToId($RecipientAccount)\n m[\"amount\"] = $Amount\n m[\"comment\"] = $Comment\n m[\"block_id\"] = $block\n m[\"txhash\"] = $txhash\n m[\"ecosystem\"] = $e_id\n m[\"type\"] = 3\n m[\"created_at\"] = $block_time\n DBInsert(\"@1history\", m)\n }\n}", "Type": "contracts" }, { "Name": "TokensRefundReject", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract TokensRefundReject {\n data {\n RefundId int\n }\n\n conditions {\n var prevContract string\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n if prevContract != \"@1VotingDecisionCheck\" {\n warning LangRes(\"@1contract_start_votingdecisioncheck_only\", \"en\")\n }\n \n $tokenrefund = DBFind(\"@1tokens_refund\").Where({\"id\": $RefundId}).Row()\n if !$tokenrefund {\n warning LangRes(\"@1tokens_refund_not_found\", \"en\")\n }\n\n $RecipientId = Int($tokenrefund[\"victim_key_id\"])\n $SenderId = Int($tokenrefund[\"attacker_key_id\"])\n $amount = Money($tokenrefund[\"amount\"])\n $votingID = Int($tokenrefund[\"voting_id\"])\n }\n\n action {\n if $tokenrefund[\"result\"] == 0 {\n TokensLockoutMember(\"KeyId,Value\", $RecipientId, 0)\n TokensLockoutMember(\"KeyId,Value\", $SenderId, 0)\n\n var m map\n m[\"status\"] = 2\n m[\"result\"] = 1\n m[\"closed_at\"] = $block_time\n DBUpdate(\"@1tokens_refund\", Int($RefundId), m)\n }\n }\n}", + "Value": "contract TokensRefundReject {\n data {\n RefundId int\n }\n\n conditions {\n var prevContract string\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n if prevContract != \"@1VotingDecisionCheck\" {\n warning LangRes(\"@1contract_start_votingdecisioncheck_only\", \"en\")\n }\n \n $tokenrefund = DBFind(\"@1tokens_refund\").Where({\"id\": $RefundId}).Row()\n if !$tokenrefund {\n warning LangRes(\"@1tokens_refund_not_found\", \"en\")\n }\n\n $RecipientAccount = $tokenrefund[\"victim_account\"]\n $SenderAccount = $tokenrefund[\"attacker_account\"]\n $amount = Money($tokenrefund[\"amount\"])\n $votingID = Int($tokenrefund[\"voting_id\"])\n }\n\n action {\n if $tokenrefund[\"result\"] == 0 {\n TokensLockoutMember(\"MemberAccount,Value\", $RecipientAccount, 0)\n TokensLockoutMember(\"MemberAccount,Value\", $SenderAccount, 0)\n\n var m map\n m[\"status\"] = 2\n m[\"result\"] = 1\n m[\"closed_at\"] = $block_time\n DBUpdate(\"@1tokens_refund\", Int($RefundId), m)\n }\n }\n}", "Type": "contracts" }, { "Name": "TokensRefundAccept", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract TokensRefundAccept {\n data {\n RefundId int\n }\n\n conditions {\n var prevContract string\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n if prevContract != \"@1VotingDecisionCheck\"{\n warning LangRes(\"@1contract_start_votingdecisioncheck_only\", \"en\")\n }\n\n $tokenrefund = DBFind(\"@1tokens_refund\").Where({\"id\": $RefundId}).Row()\n if !$tokenrefund {\n warning LangRes(\"@1tokens_refund_not_found\", \"en\")\n }\n\n $RecipientId = Int($tokenrefund[\"victim_key_id\"])\n $SenderId = Int($tokenrefund[\"attacker_key_id\"])\n $amount = Money($tokenrefund[\"amount\"])\n $votingID = Int($tokenrefund[\"voting_id\"])\n\n if $amount <= 0 {\n warning LangRes(\"@1amount_less_equal_zero\", \"en\")\n }\n \n var sender map\n sender = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": $SenderId}).Row()\n if !sender {\n warning LangRes(\"@1sender_invalid\", \"en\")\n }\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": $RecipientId}).Row() {\n warning LangRes(\"@1recipient_invalid\", \"en\")\n }\n if sender[\"amount\"] < $amount {\n warning Sprintf(LangRes(\"@1sender_amount_not_enough\", \"en\"), sender[\"amount\"])\n }\n }\n\n action {\n if $tokenrefund[\"result\"] == 0 {\n TokensLockoutMember(\"KeyId,Value\", $RecipientId, 0)\n TokensLockoutMember(\"KeyId,Value\", $SenderId, 0)\n\n @1TokensTransfer(\"Amount,SenderId,RecipientId,Comment\", $amount, $SenderId, $RecipientId, \"Refund tokens\")\n\n var m map\n m[\"status\"] = 2\n m[\"result\"] = 2\n m[\"closed_at\"] = $block_time\n DBUpdate(\"@1tokens_refund\", Int($RefundId), m)\n }\n }\n}", + "Value": "contract TokensRefundAccept {\n data {\n RefundId int\n }\n\n conditions {\n var prevContract string\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n if prevContract != \"@1VotingDecisionCheck\"{\n warning LangRes(\"@1contract_start_votingdecisioncheck_only\", \"en\")\n }\n\n $tokenrefund = DBFind(\"@1tokens_refund\").Where({\"id\": $RefundId}).Row()\n if !$tokenrefund {\n warning LangRes(\"@1tokens_refund_not_found\", \"en\")\n }\n\n $RecipientAccount = $tokenrefund[\"victim_account\"]\n $SenderAccount = $tokenrefund[\"attacker_account\"]\n $amount = Money($tokenrefund[\"amount\"])\n $votingID = Int($tokenrefund[\"voting_id\"])\n\n if $amount <= 0 {\n warning LangRes(\"@1amount_less_equal_zero\", \"en\")\n }\n \n var sender map\n sender = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": $SenderAccount, \"deleted\": 0}).Row()\n if !sender {\n warning LangRes(\"@1sender_invalid\", \"en\")\n }\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": $RecipientAccount, \"deleted\": 0}).Row() {\n warning LangRes(\"@1recipient_invalid\", \"en\")\n }\n if sender[\"amount\"] < $amount {\n warning Sprintf(LangRes(\"@1sender_amount_not_enough\", \"en\"), sender[\"amount\"])\n }\n }\n\n action {\n if $tokenrefund[\"result\"] == 0 {\n TokensLockoutMember(\"MemberAccount,Value\", $RecipientAccount, 0)\n TokensLockoutMember(\"MemberAccount,Value\", $SenderAccount, 0)\n\n @1TokensTransfer(\"Amount,SenderAccount,RecipientAccount,Comment\", $amount, $SenderAccount, $RecipientAccount, \"Refund tokens\")\n\n var m map\n m[\"status\"] = 2\n m[\"result\"] = 2\n m[\"closed_at\"] = $block_time\n DBUpdate(\"@1tokens_refund\", Int($RefundId), m)\n }\n }\n}", "Type": "contracts" }, { "Name": "TokensSend", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract TokensSend {\n data {\n Amount money\n Recipient string\n Comment string \"optional\"\n }\n\n func getPermission() {\n var array_permissions array result i int prevContract string\n array_permissions = [\"@1TokensSend\", \"@1TsKeyApprove\", \"@1TsTransferSeller\", \"@1CreditingSignAccept\"]\n\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n while i < Len(array_permissions) {\n var contract_name string\n contract_name = array_permissions[i]\n if contract_name==prevContract {\n result = 1\n }\n i = i + 1\n }\n\n if result == 0 {\n warning LangRes(\"@1tokens_transfer_cannot_be_made\", \"en\")\n }\n }\n\n conditions {\n getPermission()\n\n $recipient_id = AddressToId($Recipient)\n if $recipient_id == 0 {\n warning Sprintf(LangRes(\"@1recipient_x_invalid\", \"en\"), $Recipient)\n }\n }\n\n action {\n @1TokensTransfer(\"Amount,SenderId,RecipientId,Comment,Ecosystem\", $Amount, $key_id, $recipient_id, $Comment, $ecosystem_id)\n }\n}", - "Type": "contracts" - }, - { - "Name": "ValidatorDelete", - "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract ValidatorDelete {\n data {\n Id int\n }\n\n conditions {\n var candidateId roleId int\n roleId = 2 // Candidate for validators\n candidateId = DBFind(\"@1validator_candidates\").Where({\"ecosystem\": $ecosystem_id, \"id\": $Id}).One(\"candidate_key_id\")\n\n $role = DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"deleted\": 0, \"role->id\": roleId, \"member->member_id\": candidateId}).Row()\n if !$role {\n warning LangRes(\"@1candidate_role_not_found\", \"en\")\n }\n }\n\n action {\n DBUpdate(\"@1validator_candidates\", $Id, {deleted:1})\n @1RolesUnassign(\"RowId\", Int($role[\"id\"]))\n }\n}", - "Type": "contracts" - }, - { - "Name": "ValidatorRequest", - "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract ValidatorRequest {\n data {\n TcpAddress string\n ApiAddress string\n KeyId int\n PubKey string\n Description string \"optional\"\n Comment string \"optional\"\n }\n\n conditions {\n if $ecosystem_id != 1 {\n warning LangRes(\"@1contract_first_ecosystem_only\", \"en\")\n }\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": $KeyId}).Row() {\n warning LangRes(\"@1address_invalid\", \"en\")\n }\n }\n\n action {\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n var roleId int\n roleId = Int(AppParam(Int($system_app_id), \"role_candidate_for_validators\", $ecosystem_id))\n if !DBFind(\"@1roles\").Where({\"ecosystem\": 1, \"id\": roleId, \"deleted\": 0}).One(\"id\") {\n warning Sprintf(LangRes(\"@1role_app_param_not_found\", \"en\"), \"role_candidate_for_validators\")\n }\n @1RolesAssign(\"Rid,MemberId\", roleId, $key_id)\n\n var m map\n m[\"candidate_key_id\"] = $KeyId\n m[\"tcp_address\"] = $TcpAddress\n m[\"api_address\"] = $ApiAddress\n m[\"pub_key\"] = $PubKey\n m[\"description\"] = $Description\n m[\"comment\"] = $Comment\n m[\"date_created\"] = $block_time\n m[\"deleted\"] = 0\n DBInsert(\"@1validator_candidates\", m)\n }\n}", + "Value": "contract TokensSend {\n data {\n Amount money\n Recipient string\n Comment string \"optional\"\n }\n\n func getPermission() {\n var array_permissions array result i int prevContract string\n array_permissions = [\"@1TokensSend\", \"@1TsKeyApprove\", \"@1TsTransferSeller\", \"@1CreditingSignAccept\"]\n\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n while i < Len(array_permissions) {\n var contract_name string\n contract_name = array_permissions[i]\n if contract_name==prevContract {\n result = 1\n }\n i = i + 1\n }\n\n if result == 0 {\n warning LangRes(\"@1tokens_transfer_cannot_be_made\", \"en\")\n }\n }\n\n conditions {\n getPermission()\n }\n\n action {\n @1TokensTransfer(\"Amount,SenderAccount,RecipientAccount,Comment,Ecosystem\", $Amount, $account_id, $Recipient, $Comment, $ecosystem_id)\n }\n}", "Type": "contracts" }, { - "Name": "ValidatorResign", + "Name": "VotingDecisionCheck", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract ValidatorResign {\n\n func getRoleId(name string) int {\n var rid int\n rid = Int(AppParam(Int($system_app_id), name, $ecosystem_id))\n if rid == 0 {\n warning Sprintf(LangRes(\"@role_not_set_application_parameter\", \"en\"), name)\n }\n return rid\n }\n\n conditions {\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n var roleValidatorId int\n roleValidatorId = getRoleId(\"role_validator\")\n if !RoleAccess(roleValidatorId) {\n warning LangRes(\"@1not_validator_can_not_run\", \"en\")\n }\n $assigned = DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"member->member_id\": $key_id, \"role->id\": roleValidatorId, \"deleted\": 0}).One(\"id\")\n }\n\n action {\n @1RolesUnassign(\"RowId\", Int($assigned))\n @1NodeRemoveByKey()\n }\n}", + "Value": "contract VotingDecisionCheck {\n data {\n VotingId int\n }\n\n func runContract(cont, p string) {\n if Size(cont) > 0 {\n var params map\n if Size(p) > 0 {\n params = JSONToMap(p)\n }\n CallContract(cont, params)\n }\n }\n\n func closeNotes() {\n var notes array i int\n notes = DBFind(\"@1notifications\").Where({\"closed\": 0, \"ecosystem\": $ecosystem_id, \"page_name\": \"@1voting_view\", \"page_params->voting_id\": $VotingId})\n while i < Len(notes){\n var note map\n note = notes[i]\n @1NotificationsClose(\"NotificId\", Int(note[\"id\"]))\n i = i + 1\n }\n }\n\n conditions {\n $ACCEPT = 1\n $REJECT = -1\n\n $INVALID = 1\n $WAITING = 2\n $STARTED = 3\n $FINISHED = 4\n\n $voting = DBFind(\"@1votings\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId}).Columns(\"voting->name,voting->count_type_voters,voting->type,voting->volume,voting->type_decision,flags->success,progress->number_voters,progress->percent_voters,optional->role_id,optional->role_vacancies,optional->contract_accept,optional->contract_reject,optional->contract_accept_params,optional->contract_reject_params,status\").Row()\n $type_decision = Int($voting[\"voting.type_decision\"])\n $volume = $voting[\"voting.volume\"]\n\n var prevContract string\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n if prevContract != \"@1VotingUpdate\" {\n if Int($voting[\"status\"]) != $FINISHED {\n warning LangRes(\"@1voting_not_expired\", \"en\")\n }\n }\n\n $subject_id = DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId}).One(\"id\")\n if !$subject_id {\n warning LangRes(\"@1voting_subject_not_found\", \"en\")\n }\n }\n\n action {\n var flag_decision i int\n flag_decision = -2 // decision can not be made (not enough participants to make a decision)\n if $voting[\"flags.success\"] == $ACCEPT { //now enough participants to make a decision\n if $type_decision == 1 || $type_decision == 2 {\n var candidates_added_count int\n candidates_added_count = 0 // candidates who have already been added\n flag_decision = $REJECT // none of the candidates has been added yet\n\n var subjects array\n subjects = DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"results\": {\"$gt\": 0}}).Order({\"results\": \"-1\"}).Columns(\"subject->account,subject->member_name\")\n i = 0\n while i < Len(subjects) {\n var subject map\n subject = subjects[i]\n\n // if there are still vacancies\n if candidates_added_count < Int($voting[\"optional.role_vacancies\"]) {\n // added candidate to the role\n var buffer_id int role map\n buffer_id = Int($voting[\"optional.role_id\"])\n role = DBFind(\"@1roles\").Columns(\"id,role_type,role_name,image_id\").Where({\"ecosystem\": $ecosystem_id, \"id\": buffer_id}).Row()\n if role {\n var member assignedMember map mid rid string\n member[\"account\"] = subject[\"subject.account\"]\n mid = member[\"account\"]\n rid = role[\"id\"]\n assignedMember = DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"member->account\": mid, \"role->id\": rid, \"deleted\": 0}).Row()\n\n if !assignedMember {\n member[\"member_name\"] = subject[\"subject.member_name\"]\n\n var rolePart appointed m map\n rolePart[\"id\"] = role[\"id\"]\n rolePart[\"type\"] = role[\"role_type\"]\n rolePart[\"name\"] = role[\"role_name\"]\n rolePart[\"image_id\"] = role[\"image_id\"]\n appointed[\"voting_id\"] = $VotingId\n appointed[\"voting_name\"] = $voting[\"voting.name\"]\n\n // add a candidate to the role\n m[\"role\"] = rolePart\n m[\"member\"] = member\n m[\"appointed\"] = appointed\n m[\"date_created\"] = $block_time\n m[\"ecosystem\"] = $ecosystem_id\n DBInsert(\"@1roles_participants\", m)\n\n candidates_added_count = candidates_added_count + 1\n\n // if at least one of the candidates was added to the role, then the voting decision is considered successful\n flag_decision = $ACCEPT\n }\n }\n }\n i = i + 1\n }\n }\n\n if $type_decision == 3 {\n var subject map\n subject = DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId}).Columns(\"id,results->percent_accepted,results->percent_rejected\").Row()\n if subject {\n var percent_accepted percent_rejected float\n percent_accepted = Float(subject[\"results.percent_accepted\"])\n percent_rejected = Float(subject[\"results.percent_rejected\"])\n if ( Int($voting[\"voting.count_type_voters\"]) == 0 && percent_accepted >= Float($volume) ) ||\n ( Int($voting[\"voting.count_type_voters\"]) == 1 && percent_accepted > percent_rejected ) {\n flag_decision = $ACCEPT\n } else {\n flag_decision = $REJECT\n }\n }\n }\n\n if $type_decision == 4 {\n var subject map\n subject = DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId}).Columns(\"id,results->percent_accepted,results->percent_rejected,subject->contract_accept,subject->contract_reject,subject->contract_accept_params,subject->contract_reject_params\").Row()\n if subject {\n var percent_accepted percent_rejected float\n percent_accepted = Float(subject[\"results.percent_accepted\"])\n percent_rejected = Float(subject[\"results.percent_rejected\"])\n if ( Int($voting[\"voting.count_type_voters\"]) == 0 && percent_accepted >= Float($volume) ) ||\n ( Int($voting[\"voting.count_type_voters\"]) == 1 && percent_accepted > percent_rejected ) {\n flag_decision = $ACCEPT\n runContract(subject[\"subject.contract_accept\"], subject[\"subject.contract_accept_params\"])\n } else {\n flag_decision = $REJECT\n runContract(subject[\"subject.contract_reject\"], subject[\"subject.contract_reject_params\"])\n }\n }\n }\n\n if flag_decision == $ACCEPT {\n runContract($voting[\"optional.contract_accept\"], $voting[\"optional.contract_accept_params\"])\n }\n if flag_decision == $REJECT {\n runContract($voting[\"optional.contract_reject\"], $voting[\"optional.contract_reject_params\"])\n }\n\n closeNotes()\n }\n\n DBUpdate(\"@1votings\", $VotingId, {\"flags->decision\": flag_decision})\n }\n}", "Type": "contracts" }, { - "Name": "VotingDecisionCheck", + "Name": "VotingConsortiumMemberAccept", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract VotingDecisionCheck {\n data {\n VotingId int\n }\n\n func runContract(cont, p string) {\n if Size(cont) > 0 {\n var params map\n if Size(p) > 0 {\n params = JSONToMap(p)\n }\n CallContract(cont, params)\n }\n }\n\n func closeNotes() {\n var notes array i int\n notes = DBFind(\"@1notifications\").Where({\"closed\": 0, \"ecosystem\": $ecosystem_id, \"page_name\": \"@1voting_view\", \"page_params->voting_id\": $VotingId})\n while i < Len(notes){\n var note map\n note = notes[i]\n @1NotificationsClose(\"NotificId\", Int(note[\"id\"]))\n i = i + 1\n }\n }\n\n conditions {\n $ACCEPT = 1\n $REJECT = -1\n\n $INVALID = 1\n $WAITING = 2\n $STARTED = 3\n $FINISHED = 4\n\n $voting = DBFind(\"@1votings\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId}).Columns(\"voting->name,voting->count_type_voters,voting->type,voting->volume,voting->type_decision,flags->success,progress->number_voters,progress->percent_voters,optional->role_id,optional->role_vacancies,optional->contract_accept,optional->contract_reject,optional->contract_accept_params,optional->contract_reject_params,status\").Row()\n $type_decision = Int($voting[\"voting.type_decision\"])\n $volume = $voting[\"voting.volume\"]\n\n var prevContract string\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n if prevContract != \"@1VotingUpdate\" {\n if Int($voting[\"status\"]) != $FINISHED {\n warning LangRes(\"@1voting_not_expired\", \"en\")\n }\n }\n\n $subject_id = DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId}).One(\"id\")\n if !$subject_id {\n warning LangRes(\"@1voting_subject_not_found\", \"en\")\n }\n }\n\n action {\n var flag_decision i int\n flag_decision = -2 // decision can not be made (not enough participants to make a decision)\n if $voting[\"flags.success\"] == $ACCEPT { //now enough participants to make a decision\n if $type_decision == 1 || $type_decision == 2 {\n var candidates_added_count int\n candidates_added_count = 0 // candidates who have already been added\n flag_decision = $REJECT // none of the candidates has been added yet\n\n var subjects array\n subjects = DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"results\": {\"$gt\":0}}).Order({\"results\":\"-1\"}).Columns(\"subject->member_id,subject->member_name\")\n i = 0\n while i < Len(subjects) {\n var subject map\n subject = subjects[i]\n\n // if there are still vacancies\n if candidates_added_count < Int($voting[\"optional.role_vacancies\"]) {\n // added candidate to the role\n var buffer_id int role map\n buffer_id = Int($voting[\"optional.role_id\"])\n role = DBFind(\"@1roles\").Columns(\"id,role_type,role_name,image_id\").Where({\"ecosystem\": $ecosystem_id, \"id\": buffer_id}).Row()\n if role {\n var member assignedMember map mid rid string\n member[\"member_id\"] = subject[\"subject.member_id\"]\n mid = member[\"member_id\"]\n rid = role[\"id\"]\n assignedMember = DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"member->member_id\": mid, \"role->id\": rid, \"deleted\": 0}).Row()\n\n if !assignedMember {\n member[\"member_name\"] = subject[\"subject.member_name\"]\n\n var rolePart appointed m map\n rolePart[\"id\"] = role[\"id\"]\n rolePart[\"type\"] = role[\"role_type\"]\n rolePart[\"name\"] = role[\"role_name\"]\n rolePart[\"image_id\"] = role[\"image_id\"]\n appointed[\"voting_id\"] = $VotingId\n appointed[\"voting_name\"] = $voting[\"voting.name\"]\n\n // add a candidate to the role\n m[\"role\"] = rolePart\n m[\"member\"] = member\n m[\"appointed\"] = appointed\n m[\"date_created\"] = $block_time\n m[\"ecosystem\"] = $ecosystem_id\n DBInsert(\"@1roles_participants\", m)\n\n candidates_added_count = candidates_added_count + 1\n\n // if at least one of the candidates was added to the role, then the voting decision is considered successful\n flag_decision = $ACCEPT\n }\n }\n }\n i = i + 1\n }\n }\n\n if $type_decision == 3 {\n var subject map\n subject = DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId}).Columns(\"id,results->percent_accepted,results->percent_rejected\").Row()\n if subject {\n var percent_accepted percent_rejected float\n percent_accepted = Float(subject[\"results.percent_accepted\"])\n percent_rejected = Float(subject[\"results.percent_rejected\"])\n if ( Int($voting[\"voting.count_type_voters\"]) == 0 && percent_accepted >= Float($volume) ) ||\n ( Int($voting[\"voting.count_type_voters\"]) == 1 && percent_accepted > percent_rejected ) {\n flag_decision = $ACCEPT\n } else {\n flag_decision = $REJECT\n }\n }\n }\n\n if $type_decision == 4 {\n var subject map\n subject = DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId}).Columns(\"id,results->percent_accepted,results->percent_rejected,subject->contract_accept,subject->contract_reject,subject->contract_accept_params,subject->contract_reject_params\").Row()\n if subject {\n var percent_accepted percent_rejected float\n percent_accepted = Float(subject[\"results.percent_accepted\"])\n percent_rejected = Float(subject[\"results.percent_rejected\"])\n if ( Int($voting[\"voting.count_type_voters\"]) == 0 && percent_accepted >= Float($volume) ) ||\n ( Int($voting[\"voting.count_type_voters\"]) == 1 && percent_accepted > percent_rejected ) {\n flag_decision = $ACCEPT\n runContract(subject[\"subject.contract_accept\"], subject[\"subject.contract_accept_params\"])\n } else {\n flag_decision = $REJECT\n runContract(subject[\"subject.contract_reject\"], subject[\"subject.contract_reject_params\"])\n }\n }\n }\n\n if flag_decision == $ACCEPT {\n runContract($voting[\"optional.contract_accept\"], $voting[\"optional.contract_accept_params\"])\n }\n if flag_decision == $REJECT {\n runContract($voting[\"optional.contract_reject\"], $voting[\"optional.contract_reject_params\"])\n }\n\n closeNotes()\n }\n\n DBUpdate(\"@1votings\", $VotingId, {\"flags->decision\": flag_decision})\n }\n}", + "Value": "contract VotingConsortiumMemberAccept {\n data {\n TemplateId string\n VotingId string\n }\n\n func getRoleId(name string, warn bool) int {\n var rid int\n rid = Int(AppParam(Int($system_app_id), name, $ecosystem_id))\n if rid == 0 && warn {\n warning Sprintf(LangRes(\"@role_not_set_application_parameter\", \"en\"), name)\n }\n return rid\n }\n\n conditions {\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n var prev string\n prev = $stack[0]\n if Len($stack) > 2 {\n prev = $stack[Len($stack) - 2]\n }\n if prev != \"@1VotingDecisionCheck\" {\n warning LangRes(\"@1contract_start_votingdecisioncheck_only\", \"en\")\n }\n\n var appId tId int\n appId = Int(DBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").One(\"id\"))\n tId = Int(AppParam(appId,\"voting_template_consortium_member\", 1))\n if !DBFind(\"@1voting_templates\").Where({\"ecosystem\": $ecosystem_id, \"id\": tId}).One(\"id\") {\n warning LangRes(\"@1voting_template_not_found\", \"en\")\n }\n if $TemplateId != tId {\n warning LangRes(\"@1template_incorrect\", \"en\")\n }\n\n var oldRoleId roleId int roleName string\n oldRoleId = getRoleId(\"role_consortium_member_candidate\", false)\n roleId = getRoleId(\"role_consortium_member\", true)\n\n var consortium_member_map map\n consortium_member_map = DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId}).Columns(\"subject->contract_accept_params\").One(\"subject->contract_accept_params\")\n if !consortium_member_map {\n warning LangRes(\"@1voting_subject_not_found\", \"en\")\n }\n consortium_member_map = JSONDecode(consortium_member_map)\n $consortium_member = IdToAddress(Int(consortium_member_map[\"ConsortiumMemberId\"]))\n $flag = consortium_member_map[\"flag\"]\n\n $oldRoleRowId = Int(DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"deleted\": 0, \"role->id\": oldRoleId, \"member->account\": $consortium_member}).One(\"id\"))\n $roleRowId = Int(DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"deleted\": 0, \"role->id\": roleId, \"member->account\": $consortium_member}).One(\"id\"))\n\n $roleId = Int(DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": roleId, \"deleted\": 0}).One(\"id\"))\n if $roleId == 0 {\n warning LangRes(\"@1consortium_member_role_not_found\", \"en\")\n }\n }\n\n action {\n if $flag == \"add\" {\n if $oldRoleRowId > 0 {\n @1RolesUnassign(\"RowId\", $oldRoleRowId)\n }\n @1RolesAssign(\"Rid,MemberAccount\", $roleId, $consortium_member)\n }\n if $flag == \"remove\" {\n if $roleRowId > 0 { \n @1RolesUnassign(\"RowId\", $roleRowId)\n }\n }\n }\n}", "Type": "contracts" }, { "Name": "VotingStatusUpdate", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract VotingStatusUpdate {\n data {}\n\n func notificationSend(voting map) {\n var title string id i lenVoters int voters array\n $page_name = \"@1voting_view\"\n title = voting[\"voting.name\"]\n id = Int(voting[\"id\"])\n if voting[\"voting.type_participants\"] == 5 {\n voters = DBFind(\"@1votings_participants\").Columns(\"member->role_id\").Limit(10000).Where({\"ecosystem\": $ecosystem_id, \"voting_id\": id, \"decision\": 0})\n lenVoters = Len(voters)\n while i < lenVoters {\n var voter roleId params map\n voter = voters[i]\n roleId = Int(voter[\"member.role_id\"])\n params[\"voting_id\"] = id\n @1NotificationsSend(\"Rid,Sender,Icon,Header,Body,Page,Params,Closure\", roleId, 1, \"fa-check\", LangRes(\"@1voting\", \"en\"), title, $page_name, params, 1)\n i = i + 1\n }\n } else {\n voters = DBFind(\"@1votings_participants\").Columns(\"member->member_id\").Limit(10000).Where({\"ecosystem\": $ecosystem_id, \"voting_id\": id, \"decision\": 0})\n lenVoters = Len(voters)\n while i < lenVoters {\n var voter memberId params map\n voter = voters[i]\n memberId = Int(voter[\"member.member_id\"])\n params[\"voting_id\"] = id\n @1NotificationsSend(\"MemberId,Sender,Icon,Header,Body,Page,Params\", memberId, 1, \"fa-check\", LangRes(\"@1voting\", \"en\"), title, $page_name, params)\n i = i + 1\n }\n }\n }\n\n func updateRatings(voting map) {\n if voting[\"voting.rating\"] == 1 && voting[\"voting.type_participants\"] != 5 {\n var id i lenVoters int voters array\n id = Int(voting[\"id\"])\n voters = DBFind(\"@1votings_participants\").Columns(\"id,member->member_id\").Limit(10000).Where({\"ecosystem\": $ecosystem_id, \"voting_id\": id})\n lenVoters = Len(voters)\n\n while i < lenVoters {\n var voter map memberId int\n voter = voters[i]\n memberId = Int(voter[\"member.member_id\"])\n\n var where rating map\n where[$rating_wallet] = IdToAddress(memberId)\n where[\"ecosystem\"] = $ecosystem_id\n if GetColumnType($rating_table, $rating_amount) != \"\" {\n rating = DBFind($rating_table).Columns($request_columns).Where(where).Row()\n }\n\n var rating_amount_i int rating_amount_f float\n rating_amount_f = Float(rating[$rating_amount]) * Float($rating_weight)\n if rating_amount_f < 1.0 {\n rating_amount_f = 1.0\n }\n rating_amount_f = 1 + Log(rating_amount_f)\n rating_amount_i = Int(rating_amount_f * 1000)\n\n DBUpdate(\"@1votings_participants\", Int(voter[\"id\"]), {rating: rating_amount_i})\n i = i + 1\n }\n }\n }\n\n func changeVotings(from, to map) {\n var votings array i lenVotings int v map\n from[\"deleted\"] = 0\n votings = DBFind(\"@1votings\").Columns(\"id,date_started,date_ended,voting->name,voting->type,voting->rating,voting->type_participants\").Where(from)\n\n lenVotings = Len(votings)\n while i < lenVotings {\n v = votings[i]\n if to[\"status\"] == $STARTED {\n notificationSend(v)\n updateRatings(v)\n to[\"flags->notifics\"] = 1\n }\n DBUpdate(\"@1votings\", Int(v[\"id\"]), to)\n i = i + 1\n }\n }\n\n func checkPrev(names array) {\n var i lenNames int prev string\n lenNames = Len(names)\n prev = $stack[0]\n if Len($stack) > 2 {\n prev = $stack[Len($stack) - 2]\n }\n while i < lenNames {\n if prev == names[i] {\n return\n }\n i = i + 1\n }\n @1AdminCondition()\n }\n\n conditions {\n checkPrev([\"@1VotingSubjectCheck\", \"@1VotingInvite\"])\n\n $INVALID = 1\n $WAITING = 2\n $STARTED = 3\n $FINISHED = 4\n\n var app_id int\n app_id = Int(DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Basic\"}).One(\"id\"))\n $rating_table = AppParam(app_id, \"voting_rating_table\", $ecosystem_id)\n $rating_wallet = AppParam(app_id, \"voting_rating_wallet\", $ecosystem_id)\n $rating_amount = AppParam(app_id, \"voting_rating_amount\", $ecosystem_id)\n $rating_weight = AppParam(app_id, \"voting_rating_weight\", $ecosystem_id)\n $request_columns = \"id,\" + $rating_wallet + \",\" + $rating_amount\n }\n\n action {\n //setting status INVALID\n changeVotings({status:$WAITING, \"flags->full_data\":0}, {\"status\":$INVALID})\n changeVotings({status:$WAITING, \"progress->number_participants\":0}, {\"status\":$INVALID})\n //setting status WAITING\n changeVotings({status:$INVALID, \"flags->full_data\":1, \"progress->number_participants\":{\"$gt\":0}}, {\"status\":$WAITING})\n //setting status STARTED\n changeVotings({status:$INVALID, \"date_started\":{\"$lte\":$block_time}, \"flags->full_data\":1, \"progress->number_participants\":{\"$gt\":0}}, {\"status\":$STARTED})\n changeVotings({status:$WAITING, \"date_started\":{\"$lte\":$block_time}}, {status:$STARTED})\n //setting status FINISHED\n changeVotings({status:$STARTED, \"date_ended\":{\"$lte\":$block_time}}, {\"status\":$FINISHED})\n }\n}", + "Value": "contract VotingStatusUpdate {\n data {}\n\n func notificationSend(voting map) {\n var title string id i lenVoters int voters array\n $page_name = \"@1voting_view\"\n title = voting[\"voting.name\"]\n id = Int(voting[\"id\"])\n if voting[\"voting.type_participants\"] == 5 {\n voters = DBFind(\"@1votings_participants\").Columns(\"member->role_id\").Limit(10000).Where({\"ecosystem\": $ecosystem_id, \"voting_id\": id, \"decision\": 0})\n lenVoters = Len(voters)\n while i < lenVoters {\n var voter roleId params map\n voter = voters[i]\n roleId = Int(voter[\"member.role_id\"])\n params[\"voting_id\"] = id\n @1NotificationsSend(\"Rid,Sender,Icon,Header,Body,Page,Params,Closure\", roleId, 1, \"fa-check\", LangRes(\"@1voting\", \"en\"), title, $page_name, params, 1)\n i = i + 1\n }\n } else {\n voters = DBFind(\"@1votings_participants\").Columns(\"member->account\").Limit(10000).Where({\"ecosystem\": $ecosystem_id, \"voting_id\": id, \"decision\": 0})\n lenVoters = Len(voters)\n while i < lenVoters {\n var voter memberAccount params map\n voter = voters[i]\n memberAccount = voter[\"member.account\"]\n params[\"voting_id\"] = id\n @1NotificationsSend(\"MemberAccount,Sender,Icon,Header,Body,Page,Params\", memberAccount, 1, \"fa-check\", LangRes(\"@1voting\", \"en\"), title, $page_name, params)\n i = i + 1\n }\n }\n }\n\n func updateRatings(voting map) {\n if voting[\"voting.rating\"] == 1 && voting[\"voting.type_participants\"] != 5 {\n var id i lenVoters int voters array\n id = Int(voting[\"id\"])\n voters = DBFind(\"@1votings_participants\").Columns(\"id,member->account\").Limit(10000).Where({\"ecosystem\": $ecosystem_id, \"voting_id\": id})\n lenVoters = Len(voters)\n\n while i < lenVoters {\n var voter map memberAccount string\n voter = voters[i]\n memberAccount = voter[\"member.account\"]\n\n var where rating map\n where[$rating_wallet] = memberAccount\n where[\"ecosystem\"] = $ecosystem_id\n if GetColumnType($rating_table, $rating_amount) != \"\" {\n rating = DBFind($rating_table).Columns($request_columns).Where(where).Row()\n }\n\n var rating_amount_i int rating_amount_f float\n rating_amount_f = Float(rating[$rating_amount]) * Float($rating_weight)\n if rating_amount_f < 1.0 {\n rating_amount_f = 1.0\n }\n rating_amount_f = 1 + Log(rating_amount_f)\n rating_amount_i = Int(rating_amount_f * 1000)\n\n DBUpdate(\"@1votings_participants\", Int(voter[\"id\"]), {rating: rating_amount_i})\n i = i + 1\n }\n }\n }\n\n func changeVotings(from, to map) {\n var votings array i lenVotings int v map\n from[\"deleted\"] = 0\n votings = DBFind(\"@1votings\").Columns(\"id,date_started,date_ended,voting->name,voting->type,voting->rating,voting->type_participants\").Where(from)\n\n lenVotings = Len(votings)\n while i < lenVotings {\n v = votings[i]\n if to[\"status\"] == $STARTED {\n notificationSend(v)\n updateRatings(v)\n to[\"flags->notifics\"] = 1\n }\n DBUpdate(\"@1votings\", Int(v[\"id\"]), to)\n i = i + 1\n }\n }\n\n func checkPrev(names array) {\n var i lenNames int prev string\n lenNames = Len(names)\n prev = $stack[0]\n if Len($stack) > 2 {\n prev = $stack[Len($stack) - 2]\n }\n while i < lenNames {\n if prev == names[i] {\n return\n }\n i = i + 1\n }\n @1AdminCondition()\n }\n\n conditions {\n checkPrev([\"@1VotingSubjectCheck\", \"@1VotingInvite\"])\n\n $INVALID = 1\n $WAITING = 2\n $STARTED = 3\n $FINISHED = 4\n\n var app_id int\n app_id = Int(DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Basic\"}).One(\"id\"))\n $rating_table = AppParam(app_id, \"voting_rating_table\", $ecosystem_id)\n $rating_wallet = AppParam(app_id, \"voting_rating_wallet\", $ecosystem_id)\n $rating_amount = AppParam(app_id, \"voting_rating_amount\", $ecosystem_id)\n $rating_weight = AppParam(app_id, \"voting_rating_weight\", $ecosystem_id)\n $request_columns = \"id,\" + $rating_wallet + \",\" + $rating_amount\n }\n\n action {\n //setting status INVALID\n changeVotings({\"status\": $WAITING, \"flags->full_data\": 0}, {\"status\": $INVALID})\n changeVotings({\"status\": $WAITING, \"progress->number_participants\": 0}, {\"status\": $INVALID})\n //setting status WAITING\n changeVotings({\"status\": $INVALID, \"flags->full_data\": 1, \"progress->number_participants\": {\"$gt\": 0}}, {\"status\": $WAITING})\n //setting status STARTED\n changeVotings({\"status\": $INVALID, \"date_started\": {\"$lte\": $block_time}, \"flags->full_data\": 1, \"progress->number_participants\": {\"$gt\": 0}}, {\"status\": $STARTED})\n changeVotings({\"status\": $WAITING, \"date_started\": {\"$lte\": $block_time}}, {\"status\": $STARTED})\n //setting status FINISHED\n changeVotings({\"status\": $STARTED, \"date_ended\": {\"$lte\": $block_time}}, {\"status\": $FINISHED})\n }\n}", "Type": "contracts" }, { @@ -1022,37 +1028,37 @@ { "Name": "VotingCandidateAccept", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract VotingCandidateAccept {\n data {\n VotingId int\n CandidateId int\n RoleId int\n }\n\n func closeNotification() {\n var role_id_search int\n role_id_search = Int(DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"recipient->role_id\": $RoleId, \"page_name\": \"@1voting_view\", \"page_params->voting_id\": $VotingId, \"closed\": 0}).One(\"id\"))\n if role_id_search > 0 {\n @1NotificationsClose(\"NotificId\", role_id_search)\n } else {\n var id int\n id = Int(DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"recipient->member_id\": $key_id, \"page_name\": \"@1voting_view\", \"page_params->voting_id\": $VotingId, \"closed\": 0}).One(\"id\"))\n if id > 0 {\n @1NotificationsClose(\"NotificId\", id)\n }\n }\n }\n\n conditions {\n $INVALID = 1\n $WAITING = 2\n $STARTED = 3\n $FINISHED = 4\n\n $voting = DBFind(\"@1votings\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId}).Columns(\"id,flags->decision,flags->notifics,voting->type_participants,voting->role_id,status,date_ended\").Row()\n if !$voting {\n warning LangRes(\"@1voting_not_found\", \"en\")\n }\n if $voting[\"status\"] == $FINISHED || $block_time > Int($voting[\"date_ended\"]) {\n warning LangRes(\"@1voting_expired_can_not_vote\", \"en\")\n }\n if $voting[\"status\"] != $STARTED {\n warning LangRes(\"@1voting_not_started\", \"en\")\n }\n $subject = DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"subject->member_id\": $CandidateId}).Columns(\"id,number_accept,results\").Row()\n if !$subject {\n warning LangRes(\"@1voting_subject_not_found\", \"en\")\n }\n\n if Int($voting[\"voting.type_participants\"]) != 5 {\n $participant = DBFind(\"@1votings_participants\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"member->member_id\": $key_id, \"decision\": 0}).Columns(\"id,rating\").Row()\n }\n if Int($voting[\"voting.type_participants\"]) == 5 {\n $participant = DBFind(\"@1votings_participants\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"member->member_id\": 0, \"member->role_id\": $RoleId, \"decision\": 0}).Columns(\"id,rating\").Row()\n }\n if !$participant {\n warning LangRes(\"@1voting_not_participant\", \"en\")\n }\n }\n\n action {\n if Int($voting[\"voting.type_participants\"]) == 5 {\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"member->member_id\": $key_id, \"role->id\": $RoleId, \"deleted\": 0}).One(\"id\") {\n warning LangRes(\"@1voting_not_participant\", \"en\")\n } else {\n var member map\n member[\"member_id\"] = $key_id\n member[\"member_name\"] = IdToAddress($key_id)\n member[\"role_id\"] = $RoleId\n var member_json string\n member_json = JSONEncode(member)\n DBUpdate(\"@1votings_participants\", Int($participant[\"id\"]), {\"member\":member_json})\n }\n }\n\n if $voting[\"flags.notifics\"] == 1 {\n closeNotification()\n }\n\n if $voting[\"flags.decision\"] != 1 {\n var m map\n m[\"decision_date\"] = $block_time\n m[\"decision\"] = $CandidateId\n DBUpdate(\"@1votings_participants\", Int($participant[\"id\"]), m)\n\n var p map\n p[\"number_accept\"] = Int($subject[\"number_accept\"]) + 1\n p[\"results\"] = Int($subject[\"results\"]) + Int($participant[\"rating\"])\n DBUpdate(\"@1votings_subject\", Int($subject[\"id\"]), p)\n\n @1VotingUpdate(\"VotingId\", $VotingId)\n }\n }\n}", + "Value": "contract VotingCandidateAccept {\n data {\n VotingId int\n CandidateAccount string\n RoleId int\n }\n\n func closeNotification() {\n var role_id_search int\n role_id_search = Int(DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"recipient->role_id\": $RoleId, \"page_name\": \"@1voting_view\", \"page_params->voting_id\": $VotingId, \"closed\": 0}).One(\"id\"))\n if role_id_search > 0 {\n @1NotificationsClose(\"NotificId\", role_id_search)\n } else {\n var id int\n id = Int(DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"recipient->account\": $account_id, \"page_name\": \"@1voting_view\", \"page_params->voting_id\": $VotingId, \"closed\": 0}).One(\"id\"))\n if id > 0 {\n @1NotificationsClose(\"NotificId\", id)\n }\n }\n }\n\n conditions {\n $INVALID = 1\n $WAITING = 2\n $STARTED = 3\n $FINISHED = 4\n\n $voting = DBFind(\"@1votings\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId}).Columns(\"id,flags->decision,flags->notifics,voting->type_participants,voting->role_id,status,date_ended\").Row()\n if !$voting {\n warning LangRes(\"@1voting_not_found\", \"en\")\n }\n if $voting[\"status\"] == $FINISHED || $block_time > Int($voting[\"date_ended\"]) {\n warning LangRes(\"@1voting_expired_can_not_vote\", \"en\")\n }\n if $voting[\"status\"] != $STARTED {\n warning LangRes(\"@1voting_not_started\", \"en\")\n }\n $subject = DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"subject->account\": $CandidateAccount}).Columns(\"id,number_accept,results\").Row()\n if !$subject {\n warning LangRes(\"@1voting_subject_not_found\", \"en\")\n }\n\n if Int($voting[\"voting.type_participants\"]) != 5 {\n $participant = DBFind(\"@1votings_participants\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"member->account\": $account_id, \"decision\": 0}).Columns(\"id,rating\").Row()\n }\n if Int($voting[\"voting.type_participants\"]) == 5 {\n $participant = DBFind(\"@1votings_participants\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"member->account\": 0, \"member->role_id\": $RoleId, \"decision\": 0}).Columns(\"id,rating\").Row()\n }\n if !$participant {\n warning LangRes(\"@1voting_not_participant\", \"en\")\n }\n }\n\n action {\n if Int($voting[\"voting.type_participants\"]) == 5 {\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"member->account\": $account_id, \"role->id\": $RoleId, \"deleted\": 0}).One(\"id\") {\n warning LangRes(\"@1voting_not_participant\", \"en\")\n } else {\n var member map\n member[\"account\"] = $account_id\n member[\"member_name\"] = $account_id\n member[\"role_id\"] = $RoleId\n var member_json string\n member_json = JSONEncode(member)\n DBUpdate(\"@1votings_participants\", Int($participant[\"id\"]), {\"member\": member_json})\n }\n }\n\n if $voting[\"flags.notifics\"] == 1 {\n closeNotification()\n }\n\n if $voting[\"flags.decision\"] != 1 {\n var m map\n m[\"decision_date\"] = $block_time\n m[\"decision\"] = AddressToId($CandidateAccount)\n DBUpdate(\"@1votings_participants\", Int($participant[\"id\"]), m)\n\n var p map\n p[\"number_accept\"] = Int($subject[\"number_accept\"]) + 1\n p[\"results\"] = Int($subject[\"results\"]) + Int($participant[\"rating\"])\n DBUpdate(\"@1votings_subject\", Int($subject[\"id\"]), p)\n\n @1VotingUpdate(\"VotingId\", $VotingId)\n }\n }\n}", "Type": "contracts" }, { "Name": "VotingDecisionAccept", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract VotingDecisionAccept {\n data {\n VotingId int\n RoleId int\n }\n\n func closeNotification() {\n var role_id_search int\n role_id_search = Int(DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"recipient->role_id\": $RoleId, \"page_params->voting_id\": $VotingId, \"closed\": 0}).One(\"id\"))\n if role_id_search > 0 {\n @1NotificationsClose(\"NotificId\", role_id_search)\n } else {\n var id int\n id = Int(DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"recipient->member_id\": $key_id, \"page_params->voting_id\": $VotingId, \"closed\": 0}).One(\"id\"))\n if id > 0 {\n @1NotificationsClose(\"NotificId\", id)\n }\n }\n }\n\n conditions {\n $INVALID = 1\n $WAITING = 2\n $STARTED = 3\n $FINISHED = 4\n\n $voting = DBFind(\"@1votings\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId}).Columns(\"id,flags->decision,flags->notifics,voting->type_participants,voting->role_id,status,date_ended\").Row()\n if !$voting {\n warning LangRes(\"@1voting_not_found\", \"en\")\n }\n if $voting[\"voting.type_participants\"] == 3 {\n if $voting[\"voting.role_id\"] != $RoleId {\n warning LangRes(\"@1voting_role_incorrect\", \"en\")\n }\n }\n if $voting[\"status\"] == $FINISHED || $block_time > Int($voting[\"date_ended\"]) {\n warning LangRes(\"@1voting_expired_can_not_vote\", \"en\")\n }\n if $voting[\"status\"] != $STARTED {\n warning LangRes(\"@1voting_not_started\", \"en\")\n }\n $subject = DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId}).Columns(\"id,number_accept,results->rating_accepted,results->rating_rejected\").Row()\n if !$subject {\n warning LangRes(\"@1voting_subject_not_found\", \"en\")\n }\n\n if Int($voting[\"voting.type_participants\"]) != 5 {\n $participant = DBFind(\"@1votings_participants\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"member->member_id\": $key_id, \"decision\": 0}).Columns(\"id,rating\").Row()\n }\n if Int($voting[\"voting.type_participants\"]) == 5 {\n $participant = DBFind(\"@1votings_participants\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"member->member_id\": 0, \"member->role_id\": $RoleId, \"decision\": 0}).Columns(\"id,rating\").Row()\n }\n if !$participant {\n warning LangRes(\"@1voting_not_participant\", \"en\")\n }\n }\n\n action {\n if Int($voting[\"voting.type_participants\"]) == 5 {\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"member->member_id\": $key_id, \"role->id\": $RoleId, \"deleted\": 0}).One(\"id\") {\n warning LangRes(\"@1voting_not_participant\", \"en\")\n } else {\n var member map\n member[\"member_id\"] = $key_id\n member[\"member_name\"] = IdToAddress($key_id)\n member[\"role_id\"] = $RoleId\n var member_json string\n member_json = JSONEncode(member)\n DBUpdate(\"@1votings_participants\", Int($participant[\"id\"]), {\"member\":member_json})\n }\n }\n\n if $voting[\"flags.notifics\"] == 1 {\n closeNotification()\n }\n\n if $voting[\"flags.decision\"] != 1 {\n var m map\n m[\"decision_date\"] = $block_time\n m[\"decision\"] = 1\n DBUpdate(\"@1votings_participants\", Int($participant[\"id\"]), m)\n\n var p map\n var rating_accepted rating_rejected summ_rating int\n rating_accepted = Int($subject[\"results.rating_accepted\"]) + Int($participant[\"rating\"])\n rating_rejected = Int($subject[\"results.rating_rejected\"])\n summ_rating = rating_accepted + rating_rejected\n var percent_accepted percent_rejected float\n percent_accepted = (Float(rating_accepted)*Float(100))/Float(summ_rating)\n percent_rejected = (Float(rating_rejected)*Float(100))/Float(summ_rating)\n p[\"results->rating_accepted\"] = rating_accepted\n p[\"results->rating_rejected\"] = rating_rejected\n p[\"results->percent_accepted\"] = percent_accepted\n p[\"results->percent_rejected\"] = percent_rejected\n p[\"number_accept\"] = Int($subject[\"number_accept\"]) + 1\n DBUpdate(\"@1votings_subject\", Int($subject[\"id\"]), p)\n\n @1VotingUpdate(\"VotingId\", $VotingId)\n }\n }\n}", + "Value": "contract VotingDecisionAccept {\n data {\n VotingId int\n RoleId int\n }\n\n func closeNotification() {\n var role_id_search int\n role_id_search = Int(DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"recipient->role_id\": $RoleId, \"page_params->voting_id\": $VotingId, \"closed\": 0}).One(\"id\"))\n if role_id_search > 0 {\n @1NotificationsClose(\"NotificId\", role_id_search)\n } else {\n var id int\n id = Int(DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"recipient->account\": $account_id, \"page_params->voting_id\": $VotingId, \"closed\": 0}).One(\"id\"))\n if id > 0 {\n @1NotificationsClose(\"NotificId\", id)\n }\n }\n }\n\n conditions {\n $INVALID = 1\n $WAITING = 2\n $STARTED = 3\n $FINISHED = 4\n\n $voting = DBFind(\"@1votings\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId}).Columns(\"id,flags->decision,flags->notifics,voting->type_participants,voting->role_id,status,date_ended\").Row()\n if !$voting {\n warning LangRes(\"@1voting_not_found\", \"en\")\n }\n if $voting[\"voting.type_participants\"] == 3 {\n if $voting[\"voting.role_id\"] != $RoleId {\n warning LangRes(\"@1voting_role_incorrect\", \"en\")\n }\n }\n if $voting[\"status\"] == $FINISHED || $block_time > Int($voting[\"date_ended\"]) {\n warning LangRes(\"@1voting_expired_can_not_vote\", \"en\")\n }\n if $voting[\"status\"] != $STARTED {\n warning LangRes(\"@1voting_not_started\", \"en\")\n }\n $subject = DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId}).Columns(\"id,number_accept,results->rating_accepted,results->rating_rejected\").Row()\n if !$subject {\n warning LangRes(\"@1voting_subject_not_found\", \"en\")\n }\n\n if Int($voting[\"voting.type_participants\"]) != 5 {\n $participant = DBFind(\"@1votings_participants\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"member->account\": $account_id, \"decision\": 0}).Columns(\"id,rating\").Row()\n }\n if Int($voting[\"voting.type_participants\"]) == 5 {\n $participant = DBFind(\"@1votings_participants\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"member->account\": 0, \"member->role_id\": $RoleId, \"decision\": 0}).Columns(\"id,rating\").Row()\n }\n if !$participant {\n warning LangRes(\"@1voting_not_participant\", \"en\")\n }\n }\n\n action {\n if Int($voting[\"voting.type_participants\"]) == 5 {\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"member->account\": $account_id, \"role->id\": $RoleId, \"deleted\": 0}).One(\"id\") {\n warning LangRes(\"@1voting_not_participant\", \"en\")\n } else {\n var member map\n member[\"account\"] = $account_id\n member[\"member_name\"] = $account_id\n member[\"role_id\"] = $RoleId\n var member_json string\n member_json = JSONEncode(member)\n DBUpdate(\"@1votings_participants\", Int($participant[\"id\"]), {\"member\": member_json})\n }\n }\n\n if $voting[\"flags.notifics\"] == 1 {\n closeNotification()\n }\n\n if $voting[\"flags.decision\"] != 1 {\n var m map\n m[\"decision_date\"] = $block_time\n m[\"decision\"] = 1\n DBUpdate(\"@1votings_participants\", Int($participant[\"id\"]), m)\n\n var p map\n var rating_accepted rating_rejected summ_rating int\n rating_accepted = Int($subject[\"results.rating_accepted\"]) + Int($participant[\"rating\"])\n rating_rejected = Int($subject[\"results.rating_rejected\"])\n summ_rating = rating_accepted + rating_rejected\n var percent_accepted percent_rejected float\n percent_accepted = (Float(rating_accepted)*Float(100))/Float(summ_rating)\n percent_rejected = (Float(rating_rejected)*Float(100))/Float(summ_rating)\n p[\"results->rating_accepted\"] = rating_accepted\n p[\"results->rating_rejected\"] = rating_rejected\n p[\"results->percent_accepted\"] = percent_accepted\n p[\"results->percent_rejected\"] = percent_rejected\n p[\"number_accept\"] = Int($subject[\"number_accept\"]) + 1\n DBUpdate(\"@1votings_subject\", Int($subject[\"id\"]), p)\n\n @1VotingUpdate(\"VotingId\", $VotingId)\n }\n }\n}", "Type": "contracts" }, { "Name": "VotingDelete", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract VotingDelete {\n data {\n VotingId int\n }\n\n conditions {\n $INVALID = 1\n $WAITING = 2\n $STARTED = 3\n $FINISHED = 4\n\n var voting map\n voting = DBFind(\"@1votings\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId, \"creator->member_id\": $key_id, \"status\": $INVALID}).Columns(\"id\").Row()\n if !voting {\n warning LangRes(\"@1voting_delete_impossible\", \"en\")\n }\n }\n\n action {\n DBUpdate(\"@1votings\", $VotingId, {deleted:$block_time})\n var notes array\n notes = DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"page_name\": \"@1voting_view\", \"page_params->voting_id\": $VotingId})\n var i int\n while i < Len(notes){\n var note map noteId int\n note = notes[i]\n noteId = Int(note[\"id\"])\n @1NotificationsClose(\"NotificId\", noteId)\n i = i + 1\n }\n }\n}", + "Value": "contract VotingDelete {\n data {\n VotingId int\n }\n\n conditions {\n $INVALID = 1\n $WAITING = 2\n $STARTED = 3\n $FINISHED = 4\n\n var voting map\n voting = DBFind(\"@1votings\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId, \"creator->account\": $account_id, \"status\": $INVALID}).Columns(\"id\").Row()\n if !voting {\n warning LangRes(\"@1voting_delete_impossible\", \"en\")\n }\n }\n\n action {\n DBUpdate(\"@1votings\", $VotingId, {deleted:$block_time})\n var notes array\n notes = DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"page_name\": \"@1voting_view\", \"page_params->voting_id\": $VotingId})\n var i int\n while i < Len(notes){\n var note map noteId int\n note = notes[i]\n noteId = Int(note[\"id\"])\n @1NotificationsClose(\"NotificId\", noteId)\n i = i + 1\n }\n }\n}", "Type": "contracts" }, { "Name": "VotingInvite", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract VotingInvite {\n data {\n VotingId int\n VarId int //0, member_id, role_id, group_id\n }\n\n func addVotingParticipant(votingId int, k_id int, r_id int) {\n var m member role map\n\n if k_id != 0 {\n member[\"member_id\"] = k_id\n member[\"member_name\"] = IdToAddress(k_id)\n } else {\n member[\"member_id\"] = 0\n }\n\n if r_id != 0 {\n member[\"role_id\"] = r_id\n }\n\n m[\"member\"] = member\n m[\"voting_id\"] = votingId\n m[\"ecosystem\"] = $ecosystem_id\n m[\"rating\"] = 1\n DBInsert(\"@1votings_participants\", m)\n }\n\n conditions {\n $INVALID = 1\n $WAITING = 2\n $STARTED = 3\n $FINISHED = 4\n\n $voting = DBFind(\"@1votings\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId, \"status\": [{\"$neq\": $STARTED},{\"$neq\": $FINISHED}]}).Columns(\"progress,progress->number_participants,voting->type_participants,voting->type,id,date_ended,creator->member_id\").Row()\n if !$voting {\n warning LangRes(\"@1voting_expired_can_not_add_participants\", \"en\")\n }\n if $voting[\"creator.member_id\"] != $key_id {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n $type_participants = $voting[\"voting.type_participants\"]\n $type_voting = $voting[\"voting.type\"]\n $number_participants = Int($voting[\"progress.number_participants\"])\n\n if $number_participants > 1 && $type_voting == 2 {\n warning LangRes(\"@1system_voting_can_not_add_participants\", \"en\")\n }\n var isAdded string\n if $type_participants == 2 {\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VarId}).Row(){\n warning LangRes(\"@1key_not_found\", \"en\")\n }\n isAdded = DBFind(\"@1votings_participants\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"member->member_id\": $VarId}).One(\"id\")\n if isAdded {\n warning LangRes(\"@1member_added_before\", \"en\")\n }\n }\n if $type_participants == 3 {\n isAdded = DBFind(\"@1votings_participants\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId}).One(\"id\")\n if isAdded {\n warning LangRes(\"@1voting_one_role_allowed\", \"en\")\n }\n if Len(DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": $VarId, \"deleted\": 0})) == 0 {\n warning LangRes(\"@1roles_participants_not_found\", \"en\")\n }\n }\n if $type_participants == 4 || $type_participants == 5 {\n isAdded = DBFind(\"@1votings_participants\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"member->role_id\": $VarId}).One(\"id\")\n if isAdded {\n if ($type_participants == 4){\n warning LangRes(\"@1role_members_added_before\", \"en\")\n }\n if ($type_participants == 5){\n warning LangRes(\"@1role_added_before\", \"en\")\n }\n }\n if Len(DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": $VarId, \"deleted\": 0})) == 0 {\n warning LangRes(\"@1roles_participants_not_found\", \"en\")\n }\n }\n if $type_participants == 6 {\n isAdded = DBFind(\"@1votings_participants\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId}).One(\"id\")\n if isAdded {\n warning LangRes(\"@1voting_one_group_allowed\", \"en\")\n }\n if Len(DBFind(\"@1groups_participants\").Where({\"ecosystem\": $ecosystem_id, \"groups_info->id\": $VarId, \"deleted\": 0})) == 0 {\n warning LangRes(\"@1groups_participants_not_found\", \"en\")\n }\n }\n }\n\n action {\n var i int\n if $type_participants == 1 { // everybody\n var keys array\n keys = DBFind(\"@1keys\").Where({\"id\": {\"$neq\": $guest_key}, ecosystem:$ecosystem_id})\n while i < Len(keys) {\n var key map\n key = keys[i]\n addVotingParticipant($VotingId, Int(key[\"id\"]), 0)\n $number_participants = $number_participants + 1\n i = i + 1\n }\n }\n if $type_participants == 2 { // manual\n var key map\n key = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VarId}).Row()\n addVotingParticipant($VotingId, Int(key[\"id\"]), 0)\n $number_participants = $number_participants + 1\n }\n if $type_participants == 3 { // one role\n var roles array\n roles = DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": $VarId, \"deleted\": 0}).Columns(\"member->member_id\").Order(\"id\")\n while i < Len(roles) {\n var role m map\n role = roles[i]\n addVotingParticipant($VotingId, Int(role[\"member.member_id\"]), 0)\n $number_participants = $number_participants + 1\n i = i + 1\n }\n }\n if $type_participants == 4 { // all participants in the selected roles vote\n var roles array\n roles = DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": $VarId, \"deleted\": 0}).Columns(\"member->member_id\").Order(\"id\")\n while i < Len(roles) {\n var role m map\n role = roles[i]\n addVotingParticipant($VotingId, Int(role[\"member.member_id\"]), $VarId)\n $number_participants = $number_participants + 1\n i = i + 1\n }\n }\n if $type_participants == 5 { // one participant of the selected roles votes\n var rl map\n rl = DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VarId}).Row()\n addVotingParticipant($VotingId, 0, Int(rl[\"id\"]))\n $number_participants = $number_participants + 1\n }\n if $type_participants == 6 { // one group\n var groups array\n groups = DBFind(\"@1groups_participants\").Where({\"ecosystem\": $ecosystem_id, \"groups_info->id\": $VarId, \"deleted\": 0}).Columns(\"member->member_id\").Order(\"id\")\n while i < Len(groups) {\n var group m map\n group = groups[i]\n addVotingParticipant($VotingId, Int(group[\"member.member_id\"]), 0)\n $number_participants = $number_participants + 1\n i = i + 1\n }\n }\n\n var v map\n if $type_participants == 3 {\n v[\"voting->role_id\"] = $VarId\n }\n v[\"progress->number_participants\"] = $number_participants\n DBUpdate(\"@1votings\", $VotingId, v)\n @1VotingStatusUpdate()\n }\n}", + "Value": "contract VotingInvite {\n data {\n VotingId int\n VarId string //0, account, role_id, group_id\n }\n\n func addVotingParticipant(votingId int, k_id string, r_id string) {\n var m member role map\n\n if k_id && k_id != \"0\" {\n member[\"account\"] = k_id\n member[\"member_name\"] = k_id\n } else {\n member[\"account\"] = 0\n }\n\n if r_id && r_id != \"0\" {\n member[\"role_id\"] = r_id\n }\n\n m[\"member\"] = member\n m[\"voting_id\"] = votingId\n m[\"ecosystem\"] = $ecosystem_id\n m[\"rating\"] = 1\n DBInsert(\"@1votings_participants\", m)\n }\n\n conditions {\n $INVALID = 1\n $WAITING = 2\n $STARTED = 3\n $FINISHED = 4\n\n $voting = DBFind(\"@1votings\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId, \"status\": [{\"$neq\": $STARTED}, {\"$neq\": $FINISHED}]}).Columns(\"progress,progress->number_participants,voting->type_participants,voting->type,id,date_ended,creator->account\").Row()\n if !$voting {\n warning LangRes(\"@1voting_expired_can_not_add_participants\", \"en\")\n }\n if $voting[\"creator.account\"] != $account_id {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n $type_participants = $voting[\"voting.type_participants\"]\n $type_voting = $voting[\"voting.type\"]\n $number_participants = Int($voting[\"progress.number_participants\"])\n\n if $number_participants > 1 && $type_voting == 2 {\n warning LangRes(\"@1system_voting_can_not_add_participants\", \"en\")\n }\n var isAdded string\n if $type_participants == 2 {\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": $VarId, \"deleted\": 0}).Row(){\n warning LangRes(\"@1account_not_found\", \"en\")\n }\n isAdded = DBFind(\"@1votings_participants\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"member->account\": $VarId}).One(\"id\")\n if isAdded {\n warning LangRes(\"@1member_added_before\", \"en\")\n }\n }\n if $type_participants == 3 {\n isAdded = DBFind(\"@1votings_participants\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId}).One(\"id\")\n if isAdded {\n warning LangRes(\"@1voting_one_role_allowed\", \"en\")\n }\n if Len(DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": $VarId, \"deleted\": 0})) == 0 {\n warning LangRes(\"@1roles_participants_not_found\", \"en\")\n }\n }\n if $type_participants == 4 || $type_participants == 5 {\n isAdded = DBFind(\"@1votings_participants\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"member->role_id\": $VarId}).One(\"id\")\n if isAdded {\n if ($type_participants == 4){\n warning LangRes(\"@1role_members_added_before\", \"en\")\n }\n if ($type_participants == 5){\n warning LangRes(\"@1role_added_before\", \"en\")\n }\n }\n if Len(DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": $VarId, \"deleted\": 0})) == 0 {\n warning LangRes(\"@1roles_participants_not_found\", \"en\")\n }\n }\n if $type_participants == 6 {\n isAdded = DBFind(\"@1votings_participants\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId}).One(\"id\")\n if isAdded {\n warning LangRes(\"@1voting_one_group_allowed\", \"en\")\n }\n if Len(DBFind(\"@1groups_participants\").Where({\"ecosystem\": $ecosystem_id, \"groups_info->id\": $VarId, \"deleted\": 0})) == 0 {\n warning LangRes(\"@1groups_participants_not_found\", \"en\")\n }\n }\n }\n\n action {\n var i int\n if $type_participants == 1 { // everybody\n var keys array guest_account string\n guest_account = IdToAddress(Int($guest_key))\n keys = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": {\"$neq\": guest_account}, \"deleted\": 0})\n while i < Len(keys) {\n var key map\n key = keys[i]\n addVotingParticipant($VotingId, key[\"account\"], \"0\")\n $number_participants = $number_participants + 1\n i = i + 1\n }\n }\n if $type_participants == 2 { // manual\n var key map\n key = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": $VarId, \"deleted\": 0}).Row()\n addVotingParticipant($VotingId, key[\"account\"], \"0\")\n $number_participants = $number_participants + 1\n }\n if $type_participants == 3 { // one role\n var roles array\n roles = DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": $VarId, \"deleted\": 0}).Columns(\"member->account\").Order(\"id\")\n while i < Len(roles) {\n var role m map\n role = roles[i]\n addVotingParticipant($VotingId, role[\"member.account\"], \"0\")\n $number_participants = $number_participants + 1\n i = i + 1\n }\n }\n if $type_participants == 4 { // all participants in the selected roles vote\n var roles array\n roles = DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": $VarId, \"deleted\": 0}).Columns(\"member->account\").Order(\"id\")\n while i < Len(roles) {\n var role m map\n role = roles[i]\n addVotingParticipant($VotingId, role[\"member.account\"], $VarId)\n $number_participants = $number_participants + 1\n i = i + 1\n }\n }\n if $type_participants == 5 { // one participant of the selected roles votes\n var rl map\n rl = DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VarId}).Row()\n addVotingParticipant($VotingId, \"0\", rl[\"id\"])\n $number_participants = $number_participants + 1\n }\n if $type_participants == 6 { // one group\n var groups array\n groups = DBFind(\"@1groups_participants\").Where({\"ecosystem\": $ecosystem_id, \"groups_info->id\": $VarId, \"deleted\": 0}).Columns(\"member->account\").Order(\"id\")\n while i < Len(groups) {\n var group m map\n group = groups[i]\n addVotingParticipant($VotingId, group[\"member.account\"], \"0\")\n $number_participants = $number_participants + 1\n i = i + 1\n }\n }\n\n var v map\n if $type_participants == 3 {\n v[\"voting->role_id\"] = $VarId\n }\n v[\"progress->number_participants\"] = $number_participants\n\n DBUpdate(\"@1votings\", $VotingId, v)\n @1VotingStatusUpdate()\n }\n}", "Type": "contracts" }, { "Name": "VotingNotificationSend", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract VotingNotificationSend {\n data {\n VotingId int\n }\n\n func safeJsonToMap(m string) map {\n var res map\n if Size(m) > 0 {\n res = JSONToMap(m)\n }\n return res\n }\n\n conditions {\n $voting = DBFind(\"@1votings\").Columns(\"id,date_ended\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId, \"date_ended\":[{\"$gt\": $block_time}]}).One(\"id\")\n if !$voting {\n warning LangRes(\"@1voting_expired_can_not_notify\", \"en\")\n }\n\n $voting = DBFind(\"@1votings\").Columns(\"voting->name,creator->member_id,flags->notifics,flags,date_started\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId, \"date_started\":[{\"$gt\": $block_time}]}).Row()\n if !$voting {\n warning LangRes(\"@1voting_not_started\", \"en\")\n }\n if $voting[\"creator.member_id\"] != $key_id {\n warning LangRes(\"@1voting_not_creator\", \"en\")\n }\n if $voting[\"flags.notifics\"] == 1 {\n warning LangRes(\"@1notifications_sent_already\", \"en\")\n }\n\n $voting_name = $voting[\"voting.name\"]\n }\n\n action {\n var participants array\n participants = DBFind(\"@1votings_participants\").Limit(10000).Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"decision\": 0})\n var i int\n while i < Len(participants) {\n var participant member params map\n participant = participants[i]\n member = safeJsonToMap(participant[\"member\"])\n params[\"voting_id\"] = $VotingId\n @1NotificationsSend(\"MemberId,Sender,Icon,Header,Body,Page,Params\", Int(member[\"member_id\"]), 1, \"fa-check\", LangRes(\"@1voting\", \"en\"), $voting_name, \"voting_view\", JSONEncode(params))\n\n i = i + 1\n }\n\n DBUpdate(\"@1votings\", $VotingId, {\"flags->notifics\": 1})\n }\n}", + "Value": "contract VotingNotificationSend {\n data {\n VotingId int\n }\n\n func safeJsonToMap(m string) map {\n var res map\n if Size(m) > 0 {\n res = JSONToMap(m)\n }\n return res\n }\n\n conditions {\n $voting = DBFind(\"@1votings\").Columns(\"id,date_ended\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId, \"date_ended\": [{\"$gt\": $block_time}]}).One(\"id\")\n if !$voting {\n warning LangRes(\"@1voting_expired_can_not_notify\", \"en\")\n }\n\n $voting = DBFind(\"@1votings\").Columns(\"voting->name,creator->account,flags->notifics,flags,date_started\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId, \"date_started\": [{\"$gt\": $block_time}]}).Row()\n if !$voting {\n warning LangRes(\"@1voting_not_started\", \"en\")\n }\n if $voting[\"creator.account\"] != $account_id {\n warning LangRes(\"@1voting_not_creator\", \"en\")\n }\n if $voting[\"flags.notifics\"] == 1 {\n warning LangRes(\"@1notifications_sent_already\", \"en\")\n }\n\n $voting_name = $voting[\"voting.name\"]\n }\n\n action {\n var participants array\n participants = DBFind(\"@1votings_participants\").Limit(10000).Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"decision\": 0})\n var i int\n while i < Len(participants) {\n var participant member params map\n participant = participants[i]\n member = safeJsonToMap(participant[\"member\"])\n params[\"voting_id\"] = $VotingId\n @1NotificationsSend(\"MemberAccount,Sender,Icon,Header,Body,Page,Params\", member[\"account\"], 1, \"fa-check\", LangRes(\"@1voting\", \"en\"), $voting_name, \"voting_view\", JSONEncode(params))\n\n i = i + 1\n }\n\n DBUpdate(\"@1votings\", $VotingId, {\"flags->notifics\": 1})\n }\n}", "Type": "contracts" }, { "Name": "VotingCreate", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract VotingCreate {\n data {\n Name string\n Type int\n TypeParticipants int\n TypeDecision int\n\n Quorum int\n Rating string \"optional\"\n Volume int \"optional\"\n CountTypeVoters string \"optional\"\n Description string \"optional\"\n Interval string \"optional\"\n StartDate string \"optional\"\n StartTime string \"optional\"\n EndDate string \"optional\"\n EndTime string \"optional\"\n }\n\n func trimZeroTime(s string) string {\n if Contains(s, \"T00:00:00Z\") {\n s = Replace(s, \"T00:00:00Z\", \"\")\n }\n return s\n }\n\n func dateAddTime(d, t string) string {\n var dt string\n if Size(t) == 5 {\n dt = Sprintf(\"%v %v:00\", trimZeroTime(d), t)\n }\n return dt\n }\n\n func isCalledFromPage() bool {\n return $stack[0] == Sprintf(\"@%v%v\", $ecosystem_id, $this_contract)\n }\n\n func fixDatetimes() {\n $date_started = UnixDateTime(dateAddTime($StartDate, $StartTime))\n $date_ended = UnixDateTime(dateAddTime($EndDate, $EndTime))\n\n if $date_started == 0 || $date_ended == 0 { // invalid datetimes\n if isCalledFromPage() {\n var errs array\n if Size($StartDate) < 10 {\n errs = Append(errs, \"starting date\")\n }\n if Size($StartTime) < 5 {\n errs = Append(errs, \"starting time\")\n }\n if Size($EndDate) < 10 {\n errs = Append(errs, \"ending date\")\n }\n if Size($EndTime) < 5 {\n errs = Append(errs, \"ending time\")\n }\n warning Sprintf(LangRes(\"@1voting_creation_error_x_unspecified\", \"en\"), Join(errs, \", \"))\n } else {\n $date_started = $block_time\n $Interval = Int($Interval)\n if $Interval == 0 {\n $Interval = 3\n }\n $date_ended = $date_started + 3600 * 24 * $Interval\n }\n }\n if $date_started < $block_time {\n warning LangRes(\"@1starting_date_invalid\", \"en\")\n }\n if $date_started >= $date_ended {\n warning LangRes(\"@1ending_date_invalid\", \"en\")\n }\n }\n\n conditions {\n $INVALID = 1\n $WAITING = 2\n $STARTED = 3\n $FINISHED = 4\n\n if (($TypeDecision == 1 || $TypeDecision == 2) && $CountTypeVoters == 1) {\n info LangRes(\"@1voting_type_not_suitable\", \"en\")\n }\n if ($Quorum < 1) || ($Quorum > 100) {\n warning Sprintf(LangRes(\"@1quorum_range_must_be\", \"en\"), $Quorum)\n }\n if $CountTypeVoters == 0 && $TypeDecision != 1 && $TypeDecision != 2 {\n if ($Volume < 1) || ($Volume > 100) {\n warning Sprintf(LangRes(\"@1volume_range_must_be\", \"en\"), $Volume)\n }\n }\n if $CountTypeVoters == 1 {\n if $Quorum < 1 {\n info LangRes(\"@1voters_number_less_one\", \"en\")\n }\n $Volume = 0\n }\n if $Type == 2 {\n var systemAllowed map\n systemAllowed[\"@1VotingRunEditPlatformParam\"] = 1\n systemAllowed[\"@1VotingRunNewValidator\"] = 1\n systemAllowed[\"@1VotingRunRemoveValidator\"] = 1\n systemAllowed[\"@1VotingRunVes\"] = 1\n systemAllowed[\"@1VotingRunTokenRefund\"] = 1\n systemAllowed[\"@1VotingRunEditEcosysParam\"] = 1\n if systemAllowed[$stack[0]] != 1 {\n warning Sprintf(LangRes(\"@1system_voting_can_not_start_from_x\", \"en\"), $stack[0])\n }\n }\n\n $key = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": $key_id}).Row()\n if !$key {\n warning LangRes(\"@1ecosystem_not_member\", \"en\")\n }\n\n fixDatetimes()\n }\n\n action {\n var voting progress flags creator map votingId int\n voting[\"name\"] = $Name\n voting[\"type\"] = $Type\n voting[\"description\"] = $Description\n voting[\"type_participants\"] = $TypeParticipants\n voting[\"type_decision\"] = $TypeDecision\n voting[\"volume\"] = $Volume\n voting[\"quorum\"] = $Quorum\n voting[\"count_type_voters\"] = $CountTypeVoters\n if $Rating == \"true\" || $Rating == \"1\" {\n voting[\"rating\"] = 1\n } else {\n voting[\"rating\"] = 0\n }\n\n progress[\"number_participants\"] = \"0\"\n progress[\"number_voters\"] = \"0\"\n progress[\"percent_success\"] = \"0\"\n progress[\"percent_voters\"] = \"0\"\n\n flags[\"success\"] = \"0\"\n flags[\"decision\"] = \"0\"\n flags[\"full_data\"] = \"0\"\n flags[\"notifics\"] = \"0\"\n\n creator[\"member_id\"] = $key[\"id\"]\n creator[\"member_name\"] = IdToAddress($key_id)\n var m map\n m[\"voting\"] = voting\n m[\"progress\"] = progress\n m[\"flags\"] = flags\n m[\"creator\"] = creator\n m[\"status\"] = $INVALID\n m[\"date_started\"] = $date_started\n m[\"date_ended\"] = $date_ended\n m[\"ecosystem\"] = $ecosystem_id\n\n votingId = DBInsert(\"@1votings\", m)\n\n // if all members are voting participants\n if $TypeParticipants == 1 {\n @1VotingInvite(\"VotingId,VarId\", votingId, 0)\n }\n\n var buffer_data map\n buffer_data[\"voting_id\"] = votingId\n @1BufferManager(\"Action,Key,Val\", \"set\", \"voting\", JSONEncode(buffer_data))\n\n $result = votingId\n }\n}", + "Value": "contract VotingCreate {\n data {\n Name string\n Type int\n TypeParticipants int\n TypeDecision int\n\n Quorum int\n Rating string \"optional\"\n Volume int \"optional\"\n CountTypeVoters string \"optional\"\n Description string \"optional\"\n Interval string \"optional\"\n StartDate string \"optional\"\n StartTime string \"optional\"\n EndDate string \"optional\"\n EndTime string \"optional\"\n }\n\n func trimZeroTime(s string) string {\n if Contains(s, \"T00:00:00Z\") {\n s = Replace(s, \"T00:00:00Z\", \"\")\n }\n return s\n }\n\n func dateAddTime(d, t string) string {\n var dt string\n if Size(t) == 5 {\n dt = Sprintf(\"%v %v:00\", trimZeroTime(d), t)\n }\n return dt\n }\n\n func isCalledFromPage() bool {\n return $stack[0] == Sprintf(\"@%v%v\", $ecosystem_id, $this_contract)\n }\n\n func fixDatetimes() {\n $date_started = UnixDateTime(dateAddTime($StartDate, $StartTime))\n $date_ended = UnixDateTime(dateAddTime($EndDate, $EndTime))\n\n if $date_started == 0 || $date_ended == 0 { // invalid datetimes\n if isCalledFromPage() {\n var errs array\n if Size($StartDate) < 10 {\n errs = Append(errs, \"starting date\")\n }\n if Size($StartTime) < 5 {\n errs = Append(errs, \"starting time\")\n }\n if Size($EndDate) < 10 {\n errs = Append(errs, \"ending date\")\n }\n if Size($EndTime) < 5 {\n errs = Append(errs, \"ending time\")\n }\n warning Sprintf(LangRes(\"@1voting_creation_error_x_unspecified\", \"en\"), Join(errs, \", \"))\n } else {\n $date_started = $block_time\n $Interval = Int($Interval)\n if $Interval == 0 {\n $Interval = 3\n }\n $date_ended = $date_started + 3600 * 24 * $Interval\n }\n }\n if $date_started < $block_time {\n warning LangRes(\"@1starting_date_invalid\", \"en\")\n }\n if $date_started >= $date_ended {\n warning LangRes(\"@1ending_date_invalid\", \"en\")\n }\n }\n\n conditions {\n $INVALID = 1\n $WAITING = 2\n $STARTED = 3\n $FINISHED = 4\n\n if (($TypeDecision == 1 || $TypeDecision == 2) && $CountTypeVoters == 1) {\n info LangRes(\"@1voting_type_not_suitable\", \"en\")\n }\n if ($Quorum < 1) || ($Quorum > 100) {\n warning Sprintf(LangRes(\"@1quorum_range_must_be\", \"en\"), $Quorum)\n }\n if $CountTypeVoters == 0 && $TypeDecision != 1 && $TypeDecision != 2 {\n if ($Volume < 1) || ($Volume > 100) {\n warning Sprintf(LangRes(\"@1volume_range_must_be\", \"en\"), $Volume)\n }\n }\n if $CountTypeVoters == 1 {\n if $Quorum < 1 {\n info LangRes(\"@1voters_number_less_one\", \"en\")\n }\n $Volume = 0\n }\n if $Type == 2 {\n var systemAllowed map\n systemAllowed[\"@1VotingRunEditPlatformParam\"] = 1\n systemAllowed[\"@1VotingRunNewConsortiumMember\"] = 1\n systemAllowed[\"@1VotingRunRemoveConsortiumMember\"] = 1\n systemAllowed[\"@1VotingRunVes\"] = 1\n systemAllowed[\"@1VotingRunTokenRefund\"] = 1\n systemAllowed[\"@1VotingRunEditEcosysParam\"] = 1\n if systemAllowed[$stack[0]] != 1 {\n warning Sprintf(LangRes(\"@1system_voting_can_not_start_from_x\", \"en\"), $stack[0])\n }\n }\n\n $key = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": $account_id, \"deleted\": 0}).Row()\n if !$key {\n warning LangRes(\"@1ecosystem_not_member\", \"en\")\n }\n\n fixDatetimes()\n }\n\n action {\n var voting progress flags creator map votingId int\n voting[\"name\"] = $Name\n voting[\"type\"] = $Type\n voting[\"description\"] = $Description\n voting[\"type_participants\"] = $TypeParticipants\n voting[\"type_decision\"] = $TypeDecision\n voting[\"volume\"] = $Volume\n voting[\"quorum\"] = $Quorum\n voting[\"count_type_voters\"] = $CountTypeVoters\n if $Rating == \"true\" || $Rating == \"1\" {\n voting[\"rating\"] = 1\n } else {\n voting[\"rating\"] = 0\n }\n\n progress[\"number_participants\"] = \"0\"\n progress[\"number_voters\"] = \"0\"\n progress[\"percent_success\"] = \"0\"\n progress[\"percent_voters\"] = \"0\"\n\n flags[\"success\"] = \"0\"\n flags[\"decision\"] = \"0\"\n flags[\"full_data\"] = \"0\"\n flags[\"notifics\"] = \"0\"\n\n creator[\"account\"] = $account_id\n creator[\"member_name\"] = $account_id\n var m map\n m[\"voting\"] = voting\n m[\"progress\"] = progress\n m[\"flags\"] = flags\n m[\"creator\"] = creator\n m[\"status\"] = $INVALID\n m[\"date_started\"] = $date_started\n m[\"date_ended\"] = $date_ended\n m[\"ecosystem\"] = $ecosystem_id\n\n votingId = DBInsert(\"@1votings\", m)\n\n // if all members are voting participants\n if $TypeParticipants == 1 {\n @1VotingInvite(\"VotingId,VarId\", votingId, 0)\n }\n\n var buffer_data map\n buffer_data[\"voting_id\"] = votingId\n @1BufferManager(\"Action,Key,Val\", \"set\", \"voting\", JSONEncode(buffer_data))\n\n $result = votingId\n }\n}", "Type": "contracts" }, { @@ -1064,31 +1070,31 @@ { "Name": "VotingSubjectDocument", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract VotingSubjectDocument {\n data {\n VotingId int\n TextDocument string\n\n OptContractAcceptName string \"optional\"\n OptContractAcceptParams string \"optional\"\n OptContractRejectName string \"optional\"\n OptContractRejectParams string \"optional\"\n }\n\n func safeJsonToMap(m string) map {\n var res map\n if Size(m) > 0 { res = JSONToMap(m) }\n return res\n }\n\n conditions {\n $STARTED = 3\n $FINISHED = 4\n $voting = DBFind(\"@1votings\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId, \"status\":[{\"$neq\":$STARTED},{\"$neq\":$FINISHED}]}).Columns(\"id,date_started,flags->full_data,voting->type,optional,creator->member_id\").Row()\n if !$voting {\n warning LangRes(\"@1voting_started_can_not_edit\", \"en\")\n }\n if $voting[\"creator.member_id\"] != $key_id {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n if $voting[\"flags.full_data\"] == 1 && $voting[\"voting.type\"] == 2 {\n warning LangRes(\"@1system_voting_can_not_edit\", \"en\")\n }\n }\n\n action {\n var subject map\n subject[\"text\"] = $TextDocument\n subject[\"hash\"] = Sha256($TextDocument)\n\n $subject_id = DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId}).One(\"id\")\n if $subject_id {\n DBUpdate(\"@1votings_subject\", Int($subject_id), {subject:subject})\n } else {\n DBInsert(\"@1votings_subject\", {\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"subject\": subject})\n }\n var accept_params reject_params map\n accept_params = safeJsonToMap($OptContractAcceptParams)\n reject_params = safeJsonToMap($OptContractRejectParams)\n\n var optional map\n optional = safeJsonToMap($voting[\"optional\"])\n\n optional[\"contract_accept\"] = $OptContractAcceptName\n optional[\"contract_accept_params\"] = accept_params\n optional[\"contract_reject\"] = $OptContractRejectName\n optional[\"contract_reject_params\"] = reject_params\n\n DBUpdate(\"@1votings\", $VotingId, {optional:optional})\n\n @1VotingSubjectCheck(\"VotingId\", $VotingId)\n }\n}", + "Value": "contract VotingSubjectDocument {\n data {\n VotingId int\n TextDocument string\n\n OptContractAcceptName string \"optional\"\n OptContractAcceptParams string \"optional\"\n OptContractRejectName string \"optional\"\n OptContractRejectParams string \"optional\"\n }\n\n func safeJsonToMap(m string) map {\n var res map\n if Size(m) > 0 { res = JSONToMap(m) }\n return res\n }\n\n conditions {\n $STARTED = 3\n $FINISHED = 4\n $voting = DBFind(\"@1votings\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId, \"status\": [{\"$neq\": $STARTED}, {\"$neq\": $FINISHED}]}).Columns(\"id,date_started,flags->full_data,voting->type,optional,creator->account\").Row()\n if !$voting {\n warning LangRes(\"@1voting_started_can_not_edit\", \"en\")\n }\n if $voting[\"creator.account\"] != $account_id {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n if $voting[\"flags.full_data\"] == 1 && $voting[\"voting.type\"] == 2 {\n warning LangRes(\"@1system_voting_can_not_edit\", \"en\")\n }\n }\n\n action {\n var subject map\n subject[\"text\"] = $TextDocument\n subject[\"hash\"] = Sha256($TextDocument)\n\n $subject_id = DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId}).One(\"id\")\n if $subject_id {\n DBUpdate(\"@1votings_subject\", Int($subject_id), {subject:subject})\n } else {\n DBInsert(\"@1votings_subject\", {\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"subject\": subject})\n }\n var accept_params reject_params map\n accept_params = safeJsonToMap($OptContractAcceptParams)\n reject_params = safeJsonToMap($OptContractRejectParams)\n\n var optional map\n optional = safeJsonToMap($voting[\"optional\"])\n\n optional[\"contract_accept\"] = $OptContractAcceptName\n optional[\"contract_accept_params\"] = accept_params\n optional[\"contract_reject\"] = $OptContractRejectName\n optional[\"contract_reject_params\"] = reject_params\n\n DBUpdate(\"@1votings\", $VotingId, {optional:optional})\n\n @1VotingSubjectCheck(\"VotingId\", $VotingId)\n }\n}", "Type": "contracts" }, { "Name": "VotingSubjectSettings", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract VotingSubjectSettings {\n data {\n VotingId int\n RoleId int\n Vacancies int\n\n OptContractAcceptName string \"optional\"\n OptContractAcceptParams string \"optional\"\n OptContractRejectName string \"optional\"\n OptContractRejectParams string \"optional\"\n }\n\n func safeJsonToMap(m string) map {\n var res map\n if Size(m) > 0 { res = JSONToMap(m) }\n return res\n }\n\n conditions {\n if $Vacancies < 1 {\n warning LangRes(\"@1vacancies_number_less_one\", \"en\")\n }\n\n $STARTED = 3\n $FINISHED = 4\n $voting = DBFind(\"@1votings\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId, \"status\":[{\"$neq\": $STARTED},{\"$neq\": $FINISHED}]}).Columns(\"optional,voting->type,flags->full_data,creator->member_id\").Row()\n\n if !$voting {\n warning LangRes(\"@1voting_started_can_not_edit\", \"en\")\n }\n if $voting[\"creator.member_id\"] != $key_id {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n if $voting[\"flags.full_data\"] == 1 && $voting[\"voting.type\"] == 2 {\n warning LangRes(\"@1system_voting_can_not_edit\", \"en\")\n }\n var role map\n role = DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": $RoleId, \"deleted\": 0}).Row()\n if !role {\n warning LangRes(\"@1specified_role_not_found\", \"en\")\n }\n // roles_types: 1. assigned_role, 2. elective_role, 3. system_role, 4. company_role\n if !(role[\"role_type\"] == 2 || role[\"role_type\"] == 3) {\n warning LangRes(\"@1role_not_elective_or_removed\", \"en\")\n }\n }\n\n action {\n var optional map\n optional = safeJsonToMap($voting[\"optional\"])\n\n optional[\"contract_accept\"] = $OptContractAcceptName\n optional[\"contract_accept_params\"] = safeJsonToMap($OptContractAcceptParams)\n optional[\"contract_reject\"] = $OptContractRejectName\n optional[\"contract_reject_params\"] = safeJsonToMap($OptContractRejectParams)\n optional[\"role_id\"] = $RoleId\n optional[\"role_vacancies\"] = $Vacancies\n\n DBUpdate(\"@1votings\", $VotingId, {optional:optional})\n\n $subject_map = DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId}).Row()\n if $subject_map {\n @1VotingSubjectCheck(\"VotingId\", $VotingId)\n }\n }\n}", + "Value": "contract VotingSubjectSettings {\n data {\n VotingId int\n RoleId int\n Vacancies int\n\n OptContractAcceptName string \"optional\"\n OptContractAcceptParams string \"optional\"\n OptContractRejectName string \"optional\"\n OptContractRejectParams string \"optional\"\n }\n\n func safeJsonToMap(m string) map {\n var res map\n if Size(m) > 0 { res = JSONToMap(m) }\n return res\n }\n\n conditions {\n if $Vacancies < 1 {\n warning LangRes(\"@1vacancies_number_less_one\", \"en\")\n }\n\n $STARTED = 3\n $FINISHED = 4\n $voting = DBFind(\"@1votings\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId, \"status\": [{\"$neq\": $STARTED}, {\"$neq\": $FINISHED}]}).Columns(\"optional,voting->type,flags->full_data,creator->account\").Row()\n\n if !$voting {\n warning LangRes(\"@1voting_started_can_not_edit\", \"en\")\n }\n if $voting[\"creator.account\"] != $account_id {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n if $voting[\"flags.full_data\"] == 1 && $voting[\"voting.type\"] == 2 {\n warning LangRes(\"@1system_voting_can_not_edit\", \"en\")\n }\n var role map\n role = DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": $RoleId, \"deleted\": 0}).Row()\n if !role {\n warning LangRes(\"@1specified_role_not_found\", \"en\")\n }\n // roles_types: 1. assigned_role, 2. elective_role, 3. system_role, 4. company_role\n if !(role[\"role_type\"] == 2 || role[\"role_type\"] == 3) {\n warning LangRes(\"@1role_not_elective_or_removed\", \"en\")\n }\n }\n\n action {\n var optional map\n optional = safeJsonToMap($voting[\"optional\"])\n\n optional[\"contract_accept\"] = $OptContractAcceptName\n optional[\"contract_accept_params\"] = safeJsonToMap($OptContractAcceptParams)\n optional[\"contract_reject\"] = $OptContractRejectName\n optional[\"contract_reject_params\"] = safeJsonToMap($OptContractRejectParams)\n optional[\"role_id\"] = $RoleId\n optional[\"role_vacancies\"] = $Vacancies\n\n DBUpdate(\"@1votings\", $VotingId, {optional:optional})\n\n $subject_map = DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId}).Row()\n if $subject_map {\n @1VotingSubjectCheck(\"VotingId\", $VotingId)\n }\n }\n}", "Type": "contracts" }, { "Name": "VotingSubjectCandidates", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract VotingSubjectCandidates {\n data {\n VotingId int\n MemberId int\n }\n\n func getMemberInfo(kid int) map {\n var res member map\n member = DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"id\": kid}).Row()\n if member {\n res[\"member_id\"] = member[\"id\"]\n res[\"member_name\"] = member[\"member_name\"]\n res[\"image_id\"] = member[\"image_id\"]\n } else {\n member = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": kid}).Row()\n if member {\n res[\"member_id\"] = member[\"id\"]\n res[\"member_name\"] = IdToAddress(Int(member[\"id\"]))\n res[\"image_id\"] = 0\n }\n }\n return res\n }\n\n conditions {\n $STARTED = 3\n $FINISHED = 4\n $voting = DBFind(\"@1votings\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId}).Columns(\"id,optional->number_candidates,voting->type,flags->full_data,status,creator->member_id,voting->type_decision\").Row()\n if !$voting {\n warning LangRes(\"@1voting_started_can_not_edit\", \"en\")\n }\n if $voting[\"creator.member_id\"] != $key_id {\n if $voting[\"voting.type_decision\"] != 1 && $MemberId != $key_id {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n if $voting[\"status\"] == $STARTED {\n warning LangRes(\"@1voting_started_can_not_add_candidates\", \"en\")\n }\n if $voting[\"status\"] == $FINISHED {\n warning LangRes(\"@1voting_finished_can_not_add_candidates\", \"en\")\n }\n\n if $voting[\"flags.full_data\"] == 1 && $voting[\"voting.type\"] == 2 {\n warning LangRes(\"@1system_voting_can_not_edit\", \"en\")\n }\n\n if $MemberId == 0 {\n $MemberId = $key_id\n }\n\n if DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"subject->member_id\": $MemberId}).One(\"id\") {\n warning LangRes(\"@1candidate_added_before\", \"en\")\n }\n\n $member = getMemberInfo($MemberId)\n if !$member {\n warning Sprintf(LangRes(\"@1key_not_found\", \"en\") + \" (%v)\", $MemberId)\n }\n }\n\n action {\n DBInsert(\"@1votings_subject\", {ecosystem: $ecosystem_id, voting_id:$VotingId, subject:$member})\n var m map\n m[\"optional->number_candidates\"] = Int($voting[\"optional.number_candidates\"]) + 1\n DBUpdate(\"@1votings\", $VotingId, m)\n @1VotingSubjectCheck(\"VotingId\", $VotingId)\n }\n}", + "Value": "contract VotingSubjectCandidates {\n data {\n VotingId int\n MemberAccount string\n }\n\n func getMemberInfo(account string) map {\n var res member map\n member = DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"account\": account}).Row()\n if member {\n res[\"account\"] = member[\"account\"]\n res[\"member_name\"] = member[\"member_name\"]\n res[\"image_id\"] = member[\"image_id\"]\n } else {\n if DBFind(\"@1keys\").Columns(\"id\").Where({\"ecosystem\": $ecosystem_id, \"account\": account, \"deleted\": 0}).Row() {\n res[\"account\"] = account\n res[\"member_name\"] = account\n res[\"image_id\"] = \"0\"\n }\n }\n return res\n }\n\n conditions {\n $STARTED = 3\n $FINISHED = 4\n $voting = DBFind(\"@1votings\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId}).Columns(\"id,optional->number_candidates,voting->type,flags->full_data,status,creator->account,voting->type_decision\").Row()\n if !$voting {\n warning LangRes(\"@1voting_started_can_not_edit\", \"en\")\n }\n if $voting[\"creator.account\"] != $account_id {\n if $voting[\"voting.type_decision\"] != 1 && $MemberAccount != $account_id {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n if $voting[\"status\"] == $STARTED {\n warning LangRes(\"@1voting_started_can_not_add_candidates\", \"en\")\n }\n if $voting[\"status\"] == $FINISHED {\n warning LangRes(\"@1voting_finished_can_not_add_candidates\", \"en\")\n }\n\n if $voting[\"flags.full_data\"] == 1 && $voting[\"voting.type\"] == 2 {\n warning LangRes(\"@1system_voting_can_not_edit\", \"en\")\n }\n\n if !$MemberAccount || $MemberAccount == \"0\" {\n $MemberAccount = $account_id\n }\n\n if DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"subject->account\": $MemberAccount}).One(\"id\") {\n warning LangRes(\"@1candidate_added_before\", \"en\")\n }\n\n $member = getMemberInfo($MemberAccount)\n if !$member {\n warning Sprintf(LangRes(\"@1account_not_found\", \"en\") + \" (%v)\", $MemberAccount)\n }\n }\n\n action {\n DBInsert(\"@1votings_subject\", {ecosystem: $ecosystem_id, voting_id: $VotingId, subject: $member})\n var m map\n m[\"optional->number_candidates\"] = Int($voting[\"optional.number_candidates\"]) + 1\n DBUpdate(\"@1votings\", $VotingId, m)\n @1VotingSubjectCheck(\"VotingId\", $VotingId)\n }\n}", "Type": "contracts" }, { "Name": "VotingSubjectContract", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract VotingSubjectContract {\n data {\n VotingId int\n ContractAcceptName string\n ContractAcceptParams string \"optional\"\n ContractRejectName string\n ContractRejectParams string \"optional\"\n\n OptContractAcceptName string \"optional\"\n OptContractAcceptParams string \"optional\"\n OptContractRejectName string \"optional\"\n OptContractRejectParams string \"optional\"\n }\n\n func safeJsonToMap(m string) map {\n var res map\n if Size(m) > 0 { res = JSONToMap(m) }\n return res\n }\n\n conditions {\n $STARTED = 3\n $FINISHED = 4\n\n $voting = DBFind(\"@1votings\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId, \"status\":[{\"$neq\":$STARTED},{\"$neq\":$FINISHED}]}).Columns(\"id,date_started,voting->type,flags->full_data,optional,creator->member_id\").Row()\n if !$voting {\n warning LangRes(\"@1voting_started_can_not_edit\", \"en\")\n }\n if $voting[\"creator.member_id\"] != $key_id {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n if $voting[\"flags.full_data\"] == 1 && $voting[\"voting.type\"] == 2 {\n warning LangRes(\"@1system_voting_can_not_edit\", \"en\")\n }\n }\n\n action {\n var accept_params, reject_params map\n accept_params = safeJsonToMap($ContractAcceptParams)\n reject_params = safeJsonToMap($ContractRejectParams)\n\n var subject map\n subject[\"contract_accept\"] = $ContractAcceptName\n subject[\"contract_accept_params\"] = accept_params\n subject[\"contract_reject\"] = $ContractRejectName\n subject[\"contract_reject_params\"] = reject_params\n\n $subject_id = DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId}).One(\"id\")\n if $subject_id {\n DBUpdate(\"@1votings_subject\", Int($subject_id), {subject:subject})\n } else {\n DBInsert(\"@1votings_subject\", {ecosystem:$ecosystem_id, voting_id:$VotingId, subject:subject})\n }\n\n var o_accept_params o_reject_params map\n o_accept_params = safeJsonToMap($OptContractAcceptParams)\n o_reject_params = safeJsonToMap($OptContractRejectParams)\n\n var optional map\n optional = safeJsonToMap($voting[\"optional\"])\n optional[\"contract_accept\"] = $OptContractAcceptName\n optional[\"contract_accept_params\"] = o_accept_params\n optional[\"contract_reject\"] = $OptContractRejectName\n optional[\"contract_reject_params\"] = o_reject_params\n DBUpdate(\"@1votings\", $VotingId, {optional:optional})\n\n @1VotingSubjectCheck(\"VotingId\", $VotingId)\n }\n}", + "Value": "contract VotingSubjectContract {\n data {\n VotingId int\n ContractAcceptName string\n ContractAcceptParams string \"optional\"\n ContractRejectName string\n ContractRejectParams string \"optional\"\n\n OptContractAcceptName string \"optional\"\n OptContractAcceptParams string \"optional\"\n OptContractRejectName string \"optional\"\n OptContractRejectParams string \"optional\"\n }\n\n func safeJsonToMap(m string) map {\n var res map\n if Size(m) > 0 { res = JSONToMap(m) }\n return res\n }\n\n conditions {\n $STARTED = 3\n $FINISHED = 4\n\n $voting = DBFind(\"@1votings\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId, \"status\": [{\"$neq\": $STARTED}, {\"$neq\": $FINISHED}]}).Columns(\"id,date_started,voting->type,flags->full_data,optional,creator->account\").Row()\n if !$voting {\n warning LangRes(\"@1voting_started_can_not_edit\", \"en\")\n }\n if $voting[\"creator.account\"] != $account_id {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n if $voting[\"flags.full_data\"] == 1 && $voting[\"voting.type\"] == 2 {\n warning LangRes(\"@1system_voting_can_not_edit\", \"en\")\n }\n }\n\n action {\n var accept_params, reject_params map\n accept_params = safeJsonToMap($ContractAcceptParams)\n reject_params = safeJsonToMap($ContractRejectParams)\n\n var subject map\n subject[\"contract_accept\"] = $ContractAcceptName\n subject[\"contract_accept_params\"] = accept_params\n subject[\"contract_reject\"] = $ContractRejectName\n subject[\"contract_reject_params\"] = reject_params\n\n $subject_id = DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId}).One(\"id\")\n if $subject_id {\n DBUpdate(\"@1votings_subject\", Int($subject_id), {subject:subject})\n } else {\n DBInsert(\"@1votings_subject\", {ecosystem:$ecosystem_id, voting_id:$VotingId, subject:subject})\n }\n\n var o_accept_params o_reject_params map\n o_accept_params = safeJsonToMap($OptContractAcceptParams)\n o_reject_params = safeJsonToMap($OptContractRejectParams)\n\n var optional map\n optional = safeJsonToMap($voting[\"optional\"])\n optional[\"contract_accept\"] = $OptContractAcceptName\n optional[\"contract_accept_params\"] = o_accept_params\n optional[\"contract_reject\"] = $OptContractRejectName\n optional[\"contract_reject_params\"] = o_reject_params\n DBUpdate(\"@1votings\", $VotingId, {optional:optional})\n\n @1VotingSubjectCheck(\"VotingId\", $VotingId)\n }\n}", "Type": "contracts" }, { "Name": "VotingTemplateRun", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract VotingTemplateRun {\n data {\n TemplateId int\n Duration int\n\n TextDocument string \"optional\"\n ContractAcceptParams string \"optional\"\n ContractRejectParams string \"optional\"\n }\n\n func checkInput(value, name string) {\n if Size(value) == 0 || value == \"NULL\" {\n warning Sprintf(LangRes(\"@1x_not_found\", \"en\"), name)\n }\n }\n\n func getPermission() {\n var array_permissions array result i int prevContract string\n array_permissions = [\"@1VotingRunEditPlatformParam\", \"@1VotingRunNewValidator\", \"@1VotingRunRemoveValidator\", \"@1VotingRunVes\", \"@1VotingRunTokenRefund\", \"@1VotingRunEditEcosysParam\"]\n\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n while i < Len(array_permissions) {\n var contract_name string\n contract_name = array_permissions[i]\n if contract_name==prevContract {\n result = 1\n }\n i = i + 1\n }\n\n if result == 0 {\n warning Sprintf(LangRes(\"@1system_voting_can_not_start_from_x\", \"en\"), $stack[0])\n }\n }\n\n conditions {\n $template = DBFind(\"@1voting_templates\").Where({\"ecosystem\": $ecosystem_id, \"id\": $TemplateId}).Columns(\"voting->count_type_voters,voting->name,voting->volume,voting->quorum,voting->type_decision,voting->type_participants,voting->type,voting->rating,subject->candidates,subject->vacancies,subject->voters,subject->contract_accept,subject->contract_reject,optional->contract_accept,optional->contract_reject,optional->init_contract,optional->contract_accept_params,optional->contract_reject_params,optional->init_contract_params\").Row()\n if !$template {\n warning LangRes(\"@1voting_template_not_found\", \"en\")\n }\n\n $v_name = Sprintf(\"%v [\" + LangRes(\"@1template_id\", \"en\") + \": %v]\", $template[\"voting.name\"], $TemplateId)\n $v_count_type_voters = Int($template[\"voting.count_type_voters\"])\n $v_volume = Int($template[\"voting.volume\"])\n $v_quorum = Int($template[\"voting.quorum\"])\n $v_type_decision = Int($template[\"voting.type_decision\"])\n $v_type_participants = Int($template[\"voting.type_participants\"])\n $v_type = Int($template[\"voting.type\"])\n $v_rating = $template[\"voting.rating\"]\n\n $s_candidates = Int($template[\"subject.candidates\"])\n $s_vacancies = $template[\"subject.vacancies\"]\n $s_voters = Int($template[\"subject.voters\"])\n $s_contract_accept = $template[\"subject.contract_accept\"]\n $s_contract_reject = $template[\"subject.contract_reject\"]\n \n $o_contract_accept = $template[\"optional.contract_accept\"]\n $o_contract_reject = $template[\"optional.contract_reject\"]\n $o_init_contract = $template[\"optional.init_contract\"]\n $o_contract_accept_params = $template[\"optional.contract_accept_params\"]\n $o_contract_reject_params = $template[\"optional.contract_reject_params\"]\n $o_init_contract_params = $template[\"optional.init_contract_params\"]\n \n $desc = Sprintf(LangRes(\"@1template\", \"en\") + \" #%v\", $TemplateId) \n if $Duration <= 0 {\n $Duration = 3\n }\n\n if $v_type < 1 || $v_type > 3 {\n warning LangRes(\"@1voting_type_invalid\", \"en\")\n }\n\n if $v_type == 2 {\n getPermission()\n\n // check duplicated\n if DBFind(\"@1votings\").Where({\"ecosystem\": $ecosystem_id, \"voting->name\": $v_name, \"voting->type\": 2, \"flags->decision\": {\"$nin\": [\"1\", \"-1\"]}, \"deleted\": 0}).Row() {\n warning LangRes(\"@1same_voting_created\", \"en\")\n }\n } \n\n // candidates\n if $v_type_decision == 1 || $v_type_decision == 2 {\n if !DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": $s_candidates, \"deleted\": 0}).One(\"id\") {\n warning Sprintf(LangRes(\"@1candidate_role_id_not_found\", \"en\"), $s_candidates)\n }\n }\n\n // document\n if $v_type_decision == 3 {\n checkInput($TextDocument, \"TextDocument\")\n }\n\n // contracts\n if $v_type_decision == 4 {\n if GetContractByName($s_contract_accept) == 0 {\n warning LangRes(\"@1accepted_contract_not_found\", \"en\")\n }\n if Size($s_contract_reject) > 0 {\n if GetContractByName($s_contract_reject) == 0 {\n warning LangRes(\"@1rejected_contract_not_found\", \"en\")\n }\n }\n }\n\n if $v_type_participants == 3 {\n // if the type of the participants \"in role\" - check the role\n if !DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": $s_voters, \"deleted\": 0}).One(\"id\") {\n warning Sprintf(LangRes(\"@1voters_role_id_not_found\", \"en\"), $s_voters)\n }\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"deleted\": 0, \"role->id\": $s_voters, \"member->member_id\": $key_id}).One(\"id\") {\n warning LangRes(\"@1role_not_involved\", \"en\")\n }\n }\n }\n\n action {\n // start init contract\n if Size($o_init_contract) > 0 {\n var params map\n if Size($o_init_contract_params) > 0 {\n params = JSONToMap($o_init_contract_params)\n }\n params[\"TemplateId\"] = $TemplateId\n CallContract($o_init_contract, params)\n }\n\n // creating a vote\n var votingId int\n votingId = @1VotingCreate(\"Name,Type,TypeParticipants,TypeDecision,Quorum,Rating,Volume,CountTypeVoters,Description,Interval\", \n $v_name, $v_type, $v_type_participants, $v_type_decision, $v_quorum, $v_rating, $v_volume, $v_count_type_voters, $desc, $Duration)\n\n // new optional parameters\n var o_accept_params o_reject_params map\n if Size($o_contract_accept) > 0 {\n if Size($o_contract_accept_params) > 0 {\n o_accept_params = JSONToMap($o_contract_accept_params)\n }\n o_accept_params[\"VotingId\"] = votingId\n o_accept_params[\"TemplateId\"] = $TemplateId\n }\n if Size($o_contract_reject) > 0 {\n if Size($o_contract_reject_params) > 0 {\n o_reject_params = JSONToMap($o_contract_reject_params)\n }\n o_reject_params[\"VotingId\"] = votingId\n o_reject_params[\"TemplateId\"] = $TemplateId\n }\n\n // setting the subject of the vote\n if $v_type_decision == 1 || $v_type_decision == 2 {\n @1VotingSubjectCandidates(\"VotingId,MemberId\", votingId, $key_id)\n @1VotingSubjectSettings(\"VotingId,RoleId,Vacancies,OptContractAcceptName,OptContractAcceptParams,OptContractRejectName,OptContractRejectParams\", \n votingId, $s_candidates, $s_vacancies, $o_contract_accept, JSONEncode(o_accept_params), $o_contract_reject, JSONEncode(o_reject_params))\n }\n if $v_type_decision == 3 {\n @1VotingSubjectDocument(\"VotingId,TextDocument,OptContractAcceptName,OptContractAcceptParams,OptContractRejectName,OptContractRejectParams\", \n votingId, $TextDocument, $o_contract_accept, JSONEncode(o_accept_params), $o_contract_reject, JSONEncode(o_reject_params))\n }\n if $v_type_decision == 4 {\n var accept_params reject_params map\n if Size($s_contract_accept) > 0 {\n if Size($ContractAcceptParams) > 0 {\n accept_params = JSONToMap($ContractAcceptParams)\n }\n accept_params[\"VotingId\"] = votingId\n accept_params[\"TemplateId\"] = $TemplateId\n }\n if Size($s_contract_reject) > 0 {\n if Size($ContractRejectParams) > 0 {\n reject_params = JSONToMap($ContractRejectParams)\n }\n reject_params[\"VotingId\"] = votingId\n reject_params[\"TemplateId\"] = $TemplateId\n }\n @1VotingSubjectContract(\"VotingId,ContractAcceptName,ContractAcceptParams,ContractRejectName,ContractRejectParams,OptContractAcceptName,OptContractAcceptParams,OptContractRejectName,OptContractRejectParams\",\n votingId, $s_contract_accept, JSONEncode(accept_params), $s_contract_reject, JSONEncode(reject_params), $o_contract_accept, JSONEncode(o_accept_params), $o_contract_reject, JSONEncode(o_reject_params))\n }\n\n // setting the participants of the vote\n if $v_type_participants == 1 {\n // if the participants are \"all\", the invite has already occurred in \"@1VotingCreate\"\n }\n if $v_type_participants == 3 {\n @1VotingInvite(\"VotingId,VarId\", votingId, $s_voters)\n }\n }\n}", + "Value": "contract VotingTemplateRun {\n data {\n TemplateId int\n Duration int\n\n TextDocument string \"optional\"\n ContractAcceptParams string \"optional\"\n ContractRejectParams string \"optional\"\n }\n\n func checkInput(value, name string) {\n if Size(value) == 0 || value == \"NULL\" {\n warning Sprintf(LangRes(\"@1x_not_found\", \"en\"), name)\n }\n }\n\n func getPermission() {\n var array_permissions array result i int prevContract string\n array_permissions = [\"@1VotingRunEditPlatformParam\", \"@1VotingRunNewConsortiumMember\", \"@1VotingRunRemoveConsortiumMember\", \"@1VotingRunVes\", \"@1VotingRunTokenRefund\", \"@1VotingRunEditEcosysParam\"]\n\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n while i < Len(array_permissions) {\n var contract_name string\n contract_name = array_permissions[i]\n if contract_name==prevContract {\n result = 1\n }\n i = i + 1\n }\n\n if result == 0 {\n warning Sprintf(LangRes(\"@1system_voting_can_not_start_from_x\", \"en\"), $stack[0])\n }\n }\n\n conditions {\n $template = DBFind(\"@1voting_templates\").Where({\"ecosystem\": $ecosystem_id, \"id\": $TemplateId}).Columns(\"voting->count_type_voters,voting->name,voting->volume,voting->quorum,voting->type_decision,voting->type_participants,voting->type,voting->rating,subject->candidates,subject->vacancies,subject->voters,subject->contract_accept,subject->contract_reject,optional->contract_accept,optional->contract_reject,optional->init_contract,optional->contract_accept_params,optional->contract_reject_params,optional->init_contract_params\").Row()\n if !$template {\n warning LangRes(\"@1voting_template_not_found\", \"en\")\n }\n\n $v_name = Sprintf(\"%v [\" + LangRes(\"@1template_id\", \"en\") + \": %v]\", $template[\"voting.name\"], $TemplateId)\n $v_count_type_voters = Int($template[\"voting.count_type_voters\"])\n $v_volume = Int($template[\"voting.volume\"])\n $v_quorum = Int($template[\"voting.quorum\"])\n $v_type_decision = Int($template[\"voting.type_decision\"])\n $v_type_participants = Int($template[\"voting.type_participants\"])\n $v_type = Int($template[\"voting.type\"])\n $v_rating = $template[\"voting.rating\"]\n\n $s_candidates = Int($template[\"subject.candidates\"])\n $s_vacancies = $template[\"subject.vacancies\"]\n $s_voters = Int($template[\"subject.voters\"])\n $s_contract_accept = $template[\"subject.contract_accept\"]\n $s_contract_reject = $template[\"subject.contract_reject\"]\n \n $o_contract_accept = $template[\"optional.contract_accept\"]\n $o_contract_reject = $template[\"optional.contract_reject\"]\n $o_init_contract = $template[\"optional.init_contract\"]\n $o_contract_accept_params = $template[\"optional.contract_accept_params\"]\n $o_contract_reject_params = $template[\"optional.contract_reject_params\"]\n $o_init_contract_params = $template[\"optional.init_contract_params\"]\n \n $desc = Sprintf(LangRes(\"@1template\", \"en\") + \" #%v\", $TemplateId) \n if $Duration <= 0 {\n $Duration = 3\n }\n\n if $v_type < 1 || $v_type > 3 {\n warning LangRes(\"@1voting_type_invalid\", \"en\")\n }\n\n if $v_type == 2 {\n getPermission()\n\n // check duplicated\n if DBFind(\"@1votings\").Where({\"ecosystem\": $ecosystem_id, \"voting->name\": $v_name, \"voting->type\": 2, \"flags->decision\": {\"$nin\": [\"1\", \"-1\"]}, \"deleted\": 0}).Row() {\n warning LangRes(\"@1same_voting_created\", \"en\")\n }\n } \n\n // candidates\n if $v_type_decision == 1 || $v_type_decision == 2 {\n if !DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": $s_candidates, \"deleted\": 0}).One(\"id\") {\n warning Sprintf(LangRes(\"@1candidate_role_id_not_found\", \"en\"), $s_candidates)\n }\n }\n\n // document\n if $v_type_decision == 3 {\n checkInput($TextDocument, \"TextDocument\")\n }\n\n // contracts\n if $v_type_decision == 4 {\n if GetContractByName($s_contract_accept) == 0 {\n warning LangRes(\"@1accepted_contract_not_found\", \"en\")\n }\n if Size($s_contract_reject) > 0 {\n if GetContractByName($s_contract_reject) == 0 {\n warning LangRes(\"@1rejected_contract_not_found\", \"en\")\n }\n }\n }\n\n if $v_type_participants == 3 {\n // if the type of the participants \"in role\" - check the role\n if !DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": $s_voters, \"deleted\": 0}).One(\"id\") {\n warning Sprintf(LangRes(\"@1voters_role_id_not_found\", \"en\"), $s_voters)\n }\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"deleted\": 0, \"role->id\": $s_voters, \"member->account\": $account_id}).One(\"id\") {\n warning LangRes(\"@1role_not_involved\", \"en\")\n }\n }\n }\n\n action {\n // start init contract\n if Size($o_init_contract) > 0 {\n var params map\n if Size($o_init_contract_params) > 0 {\n params = JSONToMap($o_init_contract_params)\n }\n params[\"TemplateId\"] = $TemplateId\n CallContract($o_init_contract, params)\n }\n\n // creating a vote\n var votingId int\n votingId = @1VotingCreate(\"Name,Type,TypeParticipants,TypeDecision,Quorum,Rating,Volume,CountTypeVoters,Description,Interval\", \n $v_name, $v_type, $v_type_participants, $v_type_decision, $v_quorum, $v_rating, $v_volume, $v_count_type_voters, $desc, $Duration)\n\n // new optional parameters\n var o_accept_params o_reject_params map\n if Size($o_contract_accept) > 0 {\n if Size($o_contract_accept_params) > 0 {\n o_accept_params = JSONToMap($o_contract_accept_params)\n }\n o_accept_params[\"VotingId\"] = votingId\n o_accept_params[\"TemplateId\"] = $TemplateId\n }\n if Size($o_contract_reject) > 0 {\n if Size($o_contract_reject_params) > 0 {\n o_reject_params = JSONToMap($o_contract_reject_params)\n }\n o_reject_params[\"VotingId\"] = votingId\n o_reject_params[\"TemplateId\"] = $TemplateId\n }\n\n // setting the subject of the vote\n if $v_type_decision == 1 || $v_type_decision == 2 {\n @1VotingSubjectCandidates(\"VotingId,MemberAccount\", votingId, $account_id)\n @1VotingSubjectSettings(\"VotingId,RoleId,Vacancies,OptContractAcceptName,OptContractAcceptParams,OptContractRejectName,OptContractRejectParams\", \n votingId, $s_candidates, $s_vacancies, $o_contract_accept, JSONEncode(o_accept_params), $o_contract_reject, JSONEncode(o_reject_params))\n }\n if $v_type_decision == 3 {\n @1VotingSubjectDocument(\"VotingId,TextDocument,OptContractAcceptName,OptContractAcceptParams,OptContractRejectName,OptContractRejectParams\", \n votingId, $TextDocument, $o_contract_accept, JSONEncode(o_accept_params), $o_contract_reject, JSONEncode(o_reject_params))\n }\n if $v_type_decision == 4 {\n var accept_params reject_params map\n if Size($s_contract_accept) > 0 {\n if Size($ContractAcceptParams) > 0 {\n accept_params = JSONToMap($ContractAcceptParams)\n }\n accept_params[\"VotingId\"] = votingId\n accept_params[\"TemplateId\"] = $TemplateId\n }\n if Size($s_contract_reject) > 0 {\n if Size($ContractRejectParams) > 0 {\n reject_params = JSONToMap($ContractRejectParams)\n }\n reject_params[\"VotingId\"] = votingId\n reject_params[\"TemplateId\"] = $TemplateId\n }\n @1VotingSubjectContract(\"VotingId,ContractAcceptName,ContractAcceptParams,ContractRejectName,ContractRejectParams,OptContractAcceptName,OptContractAcceptParams,OptContractRejectName,OptContractRejectParams\",\n votingId, $s_contract_accept, JSONEncode(accept_params), $s_contract_reject, JSONEncode(reject_params), $o_contract_accept, JSONEncode(o_accept_params), $o_contract_reject, JSONEncode(o_reject_params))\n }\n\n // setting the participants of the vote\n if $v_type_participants == 1 {\n // if the participants are \"all\", the invite has already occurred in \"@1VotingCreate\"\n }\n if $v_type_participants == 3 {\n @1VotingInvite(\"VotingId,VarId\", votingId, $s_voters)\n }\n }\n}", "Type": "contracts" }, { @@ -1104,21 +1110,21 @@ "Type": "contracts" }, { - "Name": "VotingRunNewValidator", + "Name": "VotingRunNewConsortiumMember", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract VotingRunNewValidator {\n data {\n ValidatorId int\n }\n\n func warn(name, detail string) {\n warning Sprintf(LangRes(\"@1x_invalid\", \"en\") + \" (%v)\", name, detail)\n }\n\n func checkApiAddress(addr string) {\n var name string\n name = LangRes(\"@1api_address\", \"en\")\n if Size(addr) == 0 {\n warn(name, \"size\")\n }\n if !(HasPrefix(addr, \"http://\") || HasPrefix(addr, \"https://\")) {\n warn(name, \"protocol\")\n }\n if Contains(addr, \" \") {\n warn(name, \"space\")\n }\n addr = Replace(addr, \"http://\", \"\")\n addr = Replace(addr, \"https://\", \"\")\n var parts array\n if Contains(addr, \":\") {\n parts = Split(addr, \":\")\n if Len(parts) > 2 {\n warn(name, \":\")\n }\n var port string\n port = parts[1]\n if port <= 0 {\n warn(name, \"port\")\n }\n addr = parts[0]\n }\n }\n\n func checkTcpAddress(addr string) {\n var name string\n name = LangRes(\"@1tcp_address\", \"en\")\n if Size(addr) == 0 {\n warn(name, \"size\")\n }\n if Contains(addr, \" \") {\n warn(name, \"space\")\n }\n var parts array\n if Contains(addr, \":\") {\n parts = Split(addr, \":\")\n if Len(parts) > 2 {\n warn(name, \":\")\n }\n var port string\n port = parts[1]\n if port <= 0 {\n warn(name, \"port\")\n }\n }\n }\n\n func checkPub(pub string) {\n if PubToID(pub) == 0 {\n warning LangRes(\"@1public_key_invalid\", \"en\")\n }\n }\n\n func checkKeyId(keyid int) {\n var existed map\n existed = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": keyid}).Row()\n if !existed {\n warning LangRes(\"@1key_not_found\", \"en\")\n }\n }\n\n func getNodesJSON() string {\n var nodes string\n nodes = SysParamString(\"full_nodes\")\n if Size(nodes) < 100 {\n nodes = \"[]\"\n }\n return nodes\n }\n\n func appendFirstNode(nodes array) array {\n var first string firstNode map\n first = AppParam($app_id, \"first_node\", 1)\n if !HasPrefix(first, \"{\") || Size(first) < 100 {\n warning LangRes(\"@1first_node_invalid\", \"en\")\n }\n firstNode = JSONDecode(first)\n checkTcpAddress(firstNode[\"tcp_address\"])\n checkApiAddress(firstNode[\"api_address\"])\n checkKeyId(Int(firstNode[\"key_id\"]))\n checkPub(firstNode[\"public_key\"])\n nodes = Append(nodes, firstNode)\n return nodes\n }\n\n conditions {\n $app_id = Int(DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Basic\"}).One(\"id\"))\n $templateId = Int(DBFind(\"@1app_params\").Where({\"app_id\": $app_id, \"name\": \"voting_template_validators\", \"ecosystem\": $ecosystem_id}).One(\"value\"))\n if $templateId == 0 {\n warning LangRes(\"@1template_id_not_found\", \"en\")\n }\n\n $validator = DBFind(\"@1validator_candidates\").Where({\"id\": $ValidatorId, \"deleted\": 0}).Row()\n if !$validator {\n warning LangRes(\"@1candidate_not_found\", \"en\")\n }\n\n $TcpAddress = $validator[\"tcp_address\"]\n $ApiAddress = $validator[\"api_address\"]\n $KeyId = $validator[\"candidate_key_id\"]\n $PubKey = $validator[\"pub_key\"]\n\n checkKeyId(Int($KeyId))\n checkPub($PubKey)\n checkApiAddress($ApiAddress)\n checkTcpAddress($TcpAddress)\n }\n\n action {\n var nodes array new_node map\n new_node[\"tcp_address\"] = $TcpAddress\n new_node[\"api_address\"] = $ApiAddress\n new_node[\"key_id\"] = Str($KeyId)\n new_node[\"public_key\"] = $PubKey\n nodes = JSONDecode(getNodesJSON())\n if Len(nodes) == 0 {\n nodes = appendFirstNode(nodes)\n }\n nodes = Append(nodes, new_node)\n\n @1DelegateRefresh()\n\n var pars map\n pars[\"Name\"] = \"full_nodes\"\n pars[\"Value\"] = JSONEncode(nodes)\n pars[\"ValidatorId\"] = Str($KeyId)\n pars[\"flag\"] = \"add\"\n\n @1VotingTemplateRun(\"TemplateId,Duration,ContractAcceptParams\", $templateId, 14, JSONEncode(pars))\n }\n}", + "Value": "contract VotingRunNewConsortiumMember {\n data {\n ConsortiumMemberId int\n }\n\n func warn(name, detail string) {\n warning Sprintf(LangRes(\"@1x_invalid\", \"en\") + \" (%v)\", name, detail)\n }\n\n func checkApiAddress(addr string) {\n var name string\n name = LangRes(\"@1api_address\", \"en\")\n if Size(addr) == 0 {\n warn(name, \"size\")\n }\n if !(HasPrefix(addr, \"http://\") || HasPrefix(addr, \"https://\")) {\n warn(name, \"protocol\")\n }\n if Contains(addr, \" \") {\n warn(name, \"space\")\n }\n addr = Replace(addr, \"http://\", \"\")\n addr = Replace(addr, \"https://\", \"\")\n var parts array\n if Contains(addr, \":\") {\n parts = Split(addr, \":\")\n if Len(parts) > 2 {\n warn(name, \":\")\n }\n var port string\n port = parts[1]\n if port <= 0 {\n warn(name, \"port\")\n }\n addr = parts[0]\n }\n }\n\n func checkTcpAddress(addr string) {\n var name string\n name = LangRes(\"@1tcp_address\", \"en\")\n if Size(addr) == 0 {\n warn(name, \"size\")\n }\n if Contains(addr, \" \") {\n warn(name, \"space\")\n }\n var parts array\n if Contains(addr, \":\") {\n parts = Split(addr, \":\")\n if Len(parts) > 2 {\n warn(name, \":\")\n }\n var port string\n port = parts[1]\n if port <= 0 {\n warn(name, \"port\")\n }\n }\n }\n\n func checkPub(pub string) {\n if PubToID(pub) == 0 {\n warning LangRes(\"@1public_key_invalid\", \"en\")\n }\n }\n\n func checkKeyId(key int) {\n var existed map\n existed = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": key}).Row()\n if !existed {\n warning LangRes(\"@1account_not_found\", \"en\")\n }\n }\n\n func getNodesJSON() string {\n var nodes string\n nodes = SysParamString(\"full_nodes\")\n if Size(nodes) < 100 {\n nodes = \"[]\"\n }\n return nodes\n }\n\n func appendFirstNode(nodes array) array {\n var first string firstNode map\n first = AppParam($app_id, \"first_node\", 1)\n if !HasPrefix(first, \"{\") || Size(first) < 100 {\n warning LangRes(\"@1first_node_invalid\", \"en\")\n }\n firstNode = JSONDecode(first)\n checkTcpAddress(firstNode[\"tcp_address\"])\n checkApiAddress(firstNode[\"api_address\"])\n checkKeyId(Int(firstNode[\"key_id\"]))\n checkPub(firstNode[\"public_key\"])\n nodes = Append(nodes, firstNode)\n return nodes\n }\n\n conditions {\n $app_id = Int(DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Basic\"}).One(\"id\"))\n $templateId = Int(DBFind(\"@1app_params\").Where({\"app_id\": $app_id, \"name\": \"voting_template_consortium_member\", \"ecosystem\": $ecosystem_id}).One(\"value\"))\n if $templateId == 0 {\n warning LangRes(\"@1template_id_not_found\", \"en\")\n }\n\n $ConsortiumMember = DBFind(\"@1consortium_member_requests\").Where({\"id\": $ConsortiumMemberId, \"deleted\": 0}).Row()\n if !$ConsortiumMember {\n warning LangRes(\"@1candidate_not_found\", \"en\")\n }\n\n $TcpAddress = $ConsortiumMember[\"tcp_address\"]\n $ApiAddress = $ConsortiumMember[\"api_address\"]\n $KeyId = AddressToId($ConsortiumMember[\"candidate_account\"])\n $PubKey = $ConsortiumMember[\"pub_key\"]\n\n checkKeyId(Int($KeyId))\n checkPub($PubKey)\n checkApiAddress($ApiAddress)\n checkTcpAddress($TcpAddress)\n }\n\n action {\n var nodes array new_node map\n new_node[\"tcp_address\"] = $TcpAddress\n new_node[\"api_address\"] = $ApiAddress\n new_node[\"key_id\"] = Str($KeyId)\n new_node[\"public_key\"] = $PubKey\n nodes = JSONDecode(getNodesJSON())\n if Len(nodes) == 0 {\n nodes = appendFirstNode(nodes)\n }\n nodes = Append(nodes, new_node)\n\n @1DelegateRefresh()\n\n var pars map\n pars[\"Name\"] = \"full_nodes\"\n pars[\"Value\"] = JSONEncode(nodes)\n pars[\"ConsortiumMemberId\"] = Str($KeyId)\n pars[\"flag\"] = \"add\"\n\n @1VotingTemplateRun(\"TemplateId,Duration,ContractAcceptParams\", $templateId, 14, JSONEncode(pars))\n }\n}", "Type": "contracts" }, { - "Name": "VotingRunRemoveValidator", + "Name": "VotingRunRemoveConsortiumMember", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract VotingRunRemoveValidator {\n data {\n Index int\n }\n\n conditions {\n $app_id = Int(DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Basic\"}).One(\"id\"))\n $templateId = Int(DBFind(\"@1app_params\").Where({\"app_id\": $app_id, \"name\": \"voting_template_validators\", \"ecosystem\": $ecosystem_id}).One(\"value\"))\n if $templateId == 0 {\n warning LangRes(\"@1template_id_not_found\", \"en\")\n }\n\n var nodesJson string\n nodesJson = SysParamString(\"full_nodes\")\n\n if Size(nodesJson) < 100 {\n warning LangRes(\"@1invalid_full_nodes\", \"en\")\n }\n\n $nodes = JSONDecode(nodesJson)\n if Len($nodes) <= 3 {\n warning LangRes(\"@1removing_node_impossible\", \"en\")\n }\n }\n\n action {\n var nodesNew array i int node map\n while i < Len($nodes){\n node = $nodes[i]\n if i != $Index {\n nodesNew = Append(nodesNew, node)\n } else {\n $KeyId = Str(node[\"key_id\"]) \n }\n i = i + 1\n }\n\n var pars map\n pars[\"Name\"] = \"full_nodes\"\n pars[\"Value\"] = JSONEncode(nodesNew)\n pars[\"ValidatorId\"] = Str($KeyId)\n pars[\"flag\"] = \"remove\"\n\n @1VotingTemplateRun(\"TemplateId,Duration,ContractAcceptParams\", $templateId, 14, JSONEncode(pars))\n }\n}", + "Value": "contract VotingRunRemoveConsortiumMember {\n data {\n Index int\n }\n\n conditions {\n $app_id = Int(DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Basic\"}).One(\"id\"))\n $templateId = Int(DBFind(\"@1app_params\").Where({\"app_id\": $app_id, \"name\": \"voting_template_consortium_member\", \"ecosystem\": $ecosystem_id}).One(\"value\"))\n if $templateId == 0 {\n warning LangRes(\"@1template_id_not_found\", \"en\")\n }\n\n var nodesJson string\n nodesJson = SysParamString(\"full_nodes\")\n\n if Size(nodesJson) < 100 {\n warning LangRes(\"@1invalid_full_nodes\", \"en\")\n }\n\n $nodes = JSONDecode(nodesJson)\n if Len($nodes) <= 3 {\n warning LangRes(\"@1removing_node_impossible\", \"en\")\n }\n }\n\n action {\n var nodesNew array i int node map\n while i < Len($nodes){\n node = $nodes[i]\n if i != $Index {\n nodesNew = Append(nodesNew, node)\n } else {\n $KeyId = Str(node[\"key_id\"]) \n }\n i = i + 1\n }\n\n var pars map\n pars[\"Name\"] = \"full_nodes\"\n pars[\"Value\"] = JSONEncode(nodesNew)\n pars[\"ConsortiumMemberId\"] = Str($KeyId)\n pars[\"flag\"] = \"remove\"\n\n @1VotingTemplateRun(\"TemplateId,Duration,ContractAcceptParams\", $templateId, 14, JSONEncode(pars))\n }\n}", "Type": "contracts" }, { "Name": "VotingRunTokenRefund", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract VotingRunTokenRefund {\n data {\n VictimAccount string\n SuspectAccount string\n Amount money\n Note string\n }\n\n conditions {\n $victimId = AddressToId($VictimAccount)\n $attackerId = AddressToId($SuspectAccount)\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": $victimId}).Row() {\n warning LangRes(\"@1victim_key_invalid\", \"en\")\n }\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": $attackerId}).Row() {\n warning LangRes(\"@1attacker_key_invalid\", \"en\")\n }\n\n if $Amount <= 0 {\n warning LangRes(\"@1amount_invalid\", \"en\")\n }\n if Size($Note) == 0 {\n warning LangRes(\"@1add_description\", \"en\")\n }\n\n $app_id = Int(DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Basic\"}).One(\"id\"))\n $templateId = Int(DBFind(\"@1app_params\").Where({\"app_id\": $app_id, \"name\": \"voting_template_tokenrefund\", \"ecosystem\": $ecosystem_id}).One(\"value\"))\n if $templateId == 0 {\n warning LangRes(\"@1template_id_not_found\", \"en\")\n }\n }\n\n action {\n TokensLockoutMember(\"KeyId,Value\", $victimId, 1)\n TokensLockoutMember(\"KeyId,Value\", $attackerId, 1)\n \n var pars m map\n m[\"victim_key_id\"] = $victimId\n m[\"attacker_key_id\"] = $attackerId\n m[\"amount\"] = $Amount\n m[\"note\"] = $Note\n m[\"validator_key_id\"] = $key_id\n m[\"blocked_at\"] = $block_time\n m[\"status\"] = 1\n m[\"result\"] = 0\n pars[\"RefundId\"] = DBInsert(\"tokens_refund\", m)\n\n @1VotingTemplateRun(\"TemplateId,Duration,ContractAcceptParams,ContractRejectParams\", $templateId, 14, JSONEncode(pars), JSONEncode(pars))\n }\n}", + "Value": "contract VotingRunTokenRefund {\n data {\n VictimAccount string\n SuspectAccount string\n Amount money\n Note string\n }\n\n conditions {\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": $VictimAccount, \"deleted\": 0}).Row() {\n warning LangRes(\"@1victim_wallet_invalid\", \"en\")\n }\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": $SuspectAccount, \"deleted\": 0}).Row() {\n warning LangRes(\"@1attacker_wallet_invalid\", \"en\")\n }\n\n if $Amount <= 0 {\n warning LangRes(\"@1amount_invalid\", \"en\")\n }\n if Size($Note) == 0 {\n warning LangRes(\"@1add_description\", \"en\")\n }\n\n $app_id = Int(DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Basic\"}).One(\"id\"))\n $templateId = Int(DBFind(\"@1app_params\").Where({\"app_id\": $app_id, \"name\": \"voting_template_tokenrefund\", \"ecosystem\": $ecosystem_id}).One(\"value\"))\n if $templateId == 0 {\n warning LangRes(\"@1template_id_not_found\", \"en\")\n }\n }\n\n action {\n TokensLockoutMember(\"MemberAccount,Value\", $VictimAccount, 1)\n TokensLockoutMember(\"MemberAccount,Value\", $SuspectAccount, 1)\n \n var pars m map\n m[\"victim_account\"] = $VictimAccount\n m[\"attacker_account\"] = $SuspectAccount\n m[\"amount\"] = $Amount\n m[\"note\"] = $Note\n m[\"consortium_member_account\"] = $account_id\n m[\"blocked_at\"] = $block_time\n m[\"status\"] = 1\n m[\"result\"] = 0\n pars[\"RefundId\"] = DBInsert(\"tokens_refund\", m)\n\n @1VotingTemplateRun(\"TemplateId,Duration,ContractAcceptParams,ContractRejectParams\", $templateId, 14, JSONEncode(pars), JSONEncode(pars))\n }\n}", "Type": "contracts" }, { @@ -1136,19 +1142,13 @@ { "Name": "VotingTemplatesInstall", "Conditions": "ContractConditions(\"@1AdminCondition\")", - "Value": "contract VotingTemplatesInstall {\n data {\n SetDefault string \"optional\"\n }\n\n func applyTemplate(m map, param string) {\n var templateId paramId int\n templateId = DBInsert(\"@1voting_templates\", m)\n\n if $SetDefault == \"yes\" {\n paramId = Int(DBFind(\"@1app_params\").Where({\"app_id\": $app_id, \"name\": param, \"ecosystem\": $ecosystem_id}).One(\"id\"))\n if paramId > 0 {\n @1EditAppParam(\"Id,Value\", paramId, templateId)\n }\n }\n }\n\n func getRoleId(name string) int {\n var rid int\n rid = Int(AppParam(Int($system_app_id), name, $ecosystem_id))\n if rid == 0 {\n warning Sprintf(LangRes(\"@role_not_set_application_parameter\", \"en\"), name)\n }\n return rid\n }\n\n func installSystem() {\n var template map\n\n // Sysparam\n template[\"voting->name\"] = \"Voting for Platform Parameter\"\n template[\"voting->type\"] = 2\n template[\"voting->volume\"] = 75\n template[\"voting->quorum\"] = 75\n template[\"voting->rating\"] = 0\n template[\"voting->count_type_voters\"] = 0\n template[\"voting->type_decision\"] = 4\n template[\"voting->type_participants\"] = 3\n template[\"subject->candidates\"] = 0\n template[\"subject->vacancies\"] = 0\n template[\"subject->voters\"] = $consensusRoleId\n template[\"subject->contract_accept\"] = \"@1UpdateSysParam\"\n template[\"subject->contract_reject\"] = \"\"\n template[\"optional->contract_accept\"] = \"\"\n template[\"optional->contract_reject\"] = \"\"\n template[\"optional->init_contract\"] = \"\"\n template[\"optional->contract_accept_params\"] = \"\"\n template[\"optional->contract_reject_params\"] = \"\"\n template[\"optional->init_contract_params\"] = \"\"\n template[\"ecosystem\"] = 1\n applyTemplate(template, \"voting_template_platformparams\")\n\n // Validator\n template[\"voting->name\"] = \"Voting for Validator\"\n template[\"voting->type\"] = 2\n template[\"voting->volume\"] = 75\n template[\"voting->quorum\"] = 75\n template[\"voting->rating\"] = 0\n template[\"voting->count_type_voters\"] = 0\n template[\"voting->type_decision\"] = 4\n template[\"voting->type_participants\"] = 3\n template[\"subject->candidates\"] = 0\n template[\"subject->vacancies\"] = 0\n template[\"subject->voters\"] = $consensusRoleId\n template[\"subject->contract_accept\"] = \"@1UpdateSysParam\"\n template[\"subject->contract_reject\"] = \"\"\n template[\"optional->contract_accept\"] = \"VotingValidatorAccept\"\n template[\"optional->contract_reject\"] = \"\"\n template[\"optional->init_contract\"] = \"\"\n template[\"optional->contract_accept_params\"] = \"\"\n template[\"optional->contract_reject_params\"] = \"\"\n template[\"optional->init_contract_params\"] = \"\"\n template[\"ecosystem\"] = 1\n applyTemplate(template, \"voting_template_validators\")\n\n // Valued ecosystem\n template[\"voting->name\"] = \"Voting for Valued Ecosystem\"\n template[\"voting->type\"] = 2\n template[\"voting->volume\"] = 70\n template[\"voting->quorum\"] = 51\n template[\"voting->rating\"] = 0\n template[\"voting->count_type_voters\"] = 0\n template[\"voting->type_decision\"] = 4\n template[\"voting->type_participants\"] = 3\n template[\"subject->candidates\"] = 0\n template[\"subject->vacancies\"] = 0\n template[\"subject->voters\"] = $consensusRoleId\n template[\"subject->contract_accept\"] = \"VotingVesAccept\"\n template[\"subject->contract_reject\"] = \"\"\n template[\"optional->contract_accept\"] = \"\"\n template[\"optional->contract_reject\"] = \"\"\n template[\"optional->init_contract\"] = \"\"\n template[\"optional->contract_accept_params\"] = \"\"\n template[\"optional->contract_reject_params\"] = \"\"\n template[\"optional->init_contract_params\"] = \"\"\n template[\"ecosystem\"] = 1\n applyTemplate(template, \"voting_template_ves\")\n\n // Token refund\n template[\"voting->name\"] = \"Voting for Token Refund\"\n template[\"voting->type\"] = 2\n template[\"voting->volume\"] = 70\n template[\"voting->quorum\"] = 51\n template[\"voting->rating\"] = 0\n template[\"voting->count_type_voters\"] = 0\n template[\"voting->type_decision\"] = 4\n template[\"voting->type_participants\"] = 3\n template[\"subject->candidates\"] = 0\n template[\"subject->vacancies\"] = 0\n template[\"subject->voters\"] = $consensusRoleId\n template[\"subject->contract_accept\"] = \"TokensRefundAccept\"\n template[\"subject->contract_reject\"] = \"TokensRefundReject\"\n template[\"optional->contract_accept\"] = \"\"\n template[\"optional->contract_reject\"] = \"\"\n template[\"optional->init_contract\"] = \"\"\n template[\"optional->contract_accept_params\"] = \"\"\n template[\"optional->contract_reject_params\"] = \"\"\n template[\"optional->init_contract_params\"] = \"\"\n template[\"ecosystem\"] = 1\n applyTemplate(template, \"voting_template_tokenrefund\")\n\n // Change parameter of the ecosystem\n template[\"voting->name\"] = \"Voting for Ecosystem Parameter\"\n template[\"voting->type\"] = 2\n template[\"voting->volume\"] = 70\n template[\"voting->quorum\"] = 75\n template[\"voting->rating\"] = 0\n template[\"voting->count_type_voters\"] = 0\n template[\"voting->type_decision\"] = 4\n template[\"voting->type_participants\"] = 3\n template[\"subject->candidates\"] = 0\n template[\"subject->vacancies\"] = 0\n template[\"subject->voters\"] = $consensusRoleId\n template[\"subject->contract_accept\"] = \"@1EditParameter\"\n template[\"subject->contract_reject\"] = \"\"\n template[\"optional->contract_accept\"] = \"\"\n template[\"optional->contract_reject\"] = \"\"\n template[\"optional->init_contract\"] = \"\"\n template[\"optional->contract_accept_params\"] = \"\"\n template[\"optional->contract_reject_params\"] = \"\"\n template[\"optional->init_contract_params\"] = \"\"\n template[\"ecosystem\"] = 1\n applyTemplate(template, \"voting_template_ecosysparams\")\n }\n\n func installCustom() {\n var template map\n\n // A decision by a simple majority of votes\n template[\"voting->name\"] = \"Voting for Decision (simple majority of votes)\"\n template[\"voting->type\"] = 1\n template[\"voting->volume\"] = 70\n template[\"voting->quorum\"] = 51\n template[\"voting->rating\"] = 0\n template[\"voting->count_type_voters\"] = 0\n template[\"voting->type_decision\"] = 3\n template[\"voting->type_participants\"] = 1\n template[\"subject->candidates\"] = 0\n template[\"subject->vacancies\"] = 0\n template[\"subject->voters\"] = 0\n template[\"subject->contract_accept\"] = \"\"\n template[\"subject->contract_reject\"] = \"\"\n template[\"optional->contract_accept\"] = \"\"\n template[\"optional->contract_reject\"] = \"\"\n template[\"optional->init_contract\"] = \"\"\n template[\"optional->contract_accept_params\"] = \"\"\n template[\"optional->contract_reject_params\"] = \"\"\n template[\"optional->init_contract_params\"] = \"\"\n template[\"ecosystem\"] = $ecosystem_id\n applyTemplate(template, \"voting_template_decision\")\n }\n\n conditions {\n $app_id = Int(DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Basic\"}).One(\"id\"))\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n $consensusRoleId = getRoleId(\"role_consensus\")\n $validatorRoleId = getRoleId(\"role_validator\")\n }\n\n action {\n var arr_templates array count_templates int\n arr_templates = DBFind(\"@1voting_templates\").Where({\"ecosystem\": $ecosystem_id})\n count_templates = Len(arr_templates)\n\n if count_templates == 0 {\n if $ecosystem_id == 1 {\n installSystem()\n }\n installCustom() \n }\n }\n}", + "Value": "contract VotingTemplatesInstall {\n data {\n SetDefault string \"optional\"\n }\n\n func applyTemplate(m map, param string) {\n var templateId paramId int\n templateId = DBInsert(\"@1voting_templates\", m)\n\n if $SetDefault == \"yes\" {\n paramId = Int(DBFind(\"@1app_params\").Where({\"app_id\": $app_id, \"name\": param, \"ecosystem\": $ecosystem_id}).One(\"id\"))\n if paramId > 0 {\n @1EditAppParam(\"Id,Value\", paramId, templateId)\n }\n }\n }\n\n func getRoleId(name string) int {\n var rid int\n rid = Int(AppParam(Int($system_app_id), name, $ecosystem_id))\n if rid == 0 {\n warning Sprintf(LangRes(\"@role_not_set_application_parameter\", \"en\"), name)\n }\n return rid\n }\n\n func installSystem() {\n var template map\n\n // Sysparam\n template[\"voting->name\"] = \"Voting for Platform Parameter\"\n template[\"voting->type\"] = 2\n template[\"voting->volume\"] = 75\n template[\"voting->quorum\"] = 75\n template[\"voting->rating\"] = 0\n template[\"voting->count_type_voters\"] = 0\n template[\"voting->type_decision\"] = 4\n template[\"voting->type_participants\"] = 3\n template[\"subject->candidates\"] = 0\n template[\"subject->vacancies\"] = 0\n template[\"subject->voters\"] = $consortiumMemberRoleId\n template[\"subject->contract_accept\"] = \"@1UpdateSysParam\"\n template[\"subject->contract_reject\"] = \"\"\n template[\"optional->contract_accept\"] = \"\"\n template[\"optional->contract_reject\"] = \"\"\n template[\"optional->init_contract\"] = \"\"\n template[\"optional->contract_accept_params\"] = \"\"\n template[\"optional->contract_reject_params\"] = \"\"\n template[\"optional->init_contract_params\"] = \"\"\n template[\"ecosystem\"] = 1\n applyTemplate(template, \"voting_template_platformparams\")\n\n // Consortium Member\n template[\"voting->name\"] = \"Voting for Consortium Member\"\n template[\"voting->type\"] = 2\n template[\"voting->volume\"] = 75\n template[\"voting->quorum\"] = 75\n template[\"voting->rating\"] = 0\n template[\"voting->count_type_voters\"] = 0\n template[\"voting->type_decision\"] = 4\n template[\"voting->type_participants\"] = 3\n template[\"subject->candidates\"] = 0\n template[\"subject->vacancies\"] = 0\n template[\"subject->voters\"] = $consortiumMemberRoleId\n template[\"subject->contract_accept\"] = \"@1UpdateSysParam\"\n template[\"subject->contract_reject\"] = \"\"\n template[\"optional->contract_accept\"] = \"VotingConsortiumMemberAccept\"\n template[\"optional->contract_reject\"] = \"\"\n template[\"optional->init_contract\"] = \"\"\n template[\"optional->contract_accept_params\"] = \"\"\n template[\"optional->contract_reject_params\"] = \"\"\n template[\"optional->init_contract_params\"] = \"\"\n template[\"ecosystem\"] = 1\n applyTemplate(template, \"voting_template_consortium_member\")\n\n // Valued ecosystem\n template[\"voting->name\"] = \"Voting for Valued Ecosystem\"\n template[\"voting->type\"] = 2\n template[\"voting->volume\"] = 70\n template[\"voting->quorum\"] = 51\n template[\"voting->rating\"] = 0\n template[\"voting->count_type_voters\"] = 0\n template[\"voting->type_decision\"] = 4\n template[\"voting->type_participants\"] = 3\n template[\"subject->candidates\"] = 0\n template[\"subject->vacancies\"] = 0\n template[\"subject->voters\"] = $consortiumMemberRoleId\n template[\"subject->contract_accept\"] = \"VotingVesAccept\"\n template[\"subject->contract_reject\"] = \"\"\n template[\"optional->contract_accept\"] = \"\"\n template[\"optional->contract_reject\"] = \"\"\n template[\"optional->init_contract\"] = \"\"\n template[\"optional->contract_accept_params\"] = \"\"\n template[\"optional->contract_reject_params\"] = \"\"\n template[\"optional->init_contract_params\"] = \"\"\n template[\"ecosystem\"] = 1\n applyTemplate(template, \"voting_template_ves\")\n\n // Token refund\n template[\"voting->name\"] = \"Voting for Token Refund\"\n template[\"voting->type\"] = 2\n template[\"voting->volume\"] = 70\n template[\"voting->quorum\"] = 51\n template[\"voting->rating\"] = 0\n template[\"voting->count_type_voters\"] = 0\n template[\"voting->type_decision\"] = 4\n template[\"voting->type_participants\"] = 3\n template[\"subject->candidates\"] = 0\n template[\"subject->vacancies\"] = 0\n template[\"subject->voters\"] = $consortiumMemberRoleId\n template[\"subject->contract_accept\"] = \"TokensRefundAccept\"\n template[\"subject->contract_reject\"] = \"TokensRefundReject\"\n template[\"optional->contract_accept\"] = \"\"\n template[\"optional->contract_reject\"] = \"\"\n template[\"optional->init_contract\"] = \"\"\n template[\"optional->contract_accept_params\"] = \"\"\n template[\"optional->contract_reject_params\"] = \"\"\n template[\"optional->init_contract_params\"] = \"\"\n template[\"ecosystem\"] = 1\n applyTemplate(template, \"voting_template_tokenrefund\")\n\n // Change parameter of the ecosystem\n template[\"voting->name\"] = \"Voting for Ecosystem Parameter\"\n template[\"voting->type\"] = 2\n template[\"voting->volume\"] = 70\n template[\"voting->quorum\"] = 75\n template[\"voting->rating\"] = 0\n template[\"voting->count_type_voters\"] = 0\n template[\"voting->type_decision\"] = 4\n template[\"voting->type_participants\"] = 3\n template[\"subject->candidates\"] = 0\n template[\"subject->vacancies\"] = 0\n template[\"subject->voters\"] = $consortiumMemberRoleId\n template[\"subject->contract_accept\"] = \"@1EditParameter\"\n template[\"subject->contract_reject\"] = \"\"\n template[\"optional->contract_accept\"] = \"\"\n template[\"optional->contract_reject\"] = \"\"\n template[\"optional->init_contract\"] = \"\"\n template[\"optional->contract_accept_params\"] = \"\"\n template[\"optional->contract_reject_params\"] = \"\"\n template[\"optional->init_contract_params\"] = \"\"\n template[\"ecosystem\"] = 1\n applyTemplate(template, \"voting_template_ecosysparams\")\n }\n\n func installCustom() {\n var template map\n\n // A decision by a simple majority of votes\n template[\"voting->name\"] = \"Voting for Decision (simple majority of votes)\"\n template[\"voting->type\"] = 1\n template[\"voting->volume\"] = 70\n template[\"voting->quorum\"] = 51\n template[\"voting->rating\"] = 0\n template[\"voting->count_type_voters\"] = 0\n template[\"voting->type_decision\"] = 3\n template[\"voting->type_participants\"] = 1\n template[\"subject->candidates\"] = 0\n template[\"subject->vacancies\"] = 0\n template[\"subject->voters\"] = 0\n template[\"subject->contract_accept\"] = \"\"\n template[\"subject->contract_reject\"] = \"\"\n template[\"optional->contract_accept\"] = \"\"\n template[\"optional->contract_reject\"] = \"\"\n template[\"optional->init_contract\"] = \"\"\n template[\"optional->contract_accept_params\"] = \"\"\n template[\"optional->contract_reject_params\"] = \"\"\n template[\"optional->init_contract_params\"] = \"\"\n template[\"ecosystem\"] = $ecosystem_id\n applyTemplate(template, \"voting_template_decision\")\n }\n\n conditions {\n $app_id = Int(DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Basic\"}).One(\"id\"))\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n $consortiumMemberRoleId = getRoleId(\"role_consortium_member\")\n }\n\n action {\n var arr_templates array count_templates int\n arr_templates = DBFind(\"@1voting_templates\").Where({\"ecosystem\": $ecosystem_id})\n count_templates = Len(arr_templates)\n\n if count_templates == 0 {\n if $ecosystem_id == 1 {\n installSystem()\n }\n installCustom() \n }\n }\n}", "Type": "contracts" }, { "Name": "VotingDecisionReject", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract VotingDecisionReject {\n data {\n VotingId int\n RoleId int\n }\n\n func closeNotification() {\n var role_id_search int\n role_id_search = Int(DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"recipient->role_id\": $RoleId, \"page_params->voting_id\": $VotingId, \"closed\": 0}).One(\"id\"))\n if role_id_search > 0 {\n @1NotificationsClose(\"NotificId\", role_id_search)\n } else {\n var id int\n id = Int(DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"recipient->member_id\": $key_id, \"page_params->voting_id\": $VotingId, \"closed\": 0}).One(\"id\"))\n if id > 0 {\n @1NotificationsClose(\"NotificId\", id)\n }\n }\n }\n\n conditions {\n $INVALID = 1\n $WAITING = 2\n $STARTED = 3\n $FINISHED = 4\n\n $voting = DBFind(\"@1votings\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId}).Columns(\"id,flags->decision,flags->notifics,voting->type_participants,voting->role_id,status,date_ended\").Row()\n if !$voting {\n warning LangRes(\"@1voting_not_found\", \"en\")\n }\n if $voting[\"voting.type_participants\"] == 3 {\n if $voting[\"voting.role_id\"] != $RoleId{\n warning LangRes(\"@1voting_role_incorrect\", \"en\")\n }\n }\n if $voting[\"status\"] == $FINISHED || $block_time > Int($voting[\"date_ended\"]) {\n warning LangRes(\"@1voting_expired_can_not_vote\", \"en\")\n }\n if $voting[\"status\"] != $STARTED {\n warning LangRes(\"@1voting_not_started\", \"en\")\n }\n $subject = DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId}).Columns(\"id,number_accept,results->rating_accepted,results->rating_rejected\").Row()\n if !$subject {\n warning LangRes(\"@1voting_subject_not_found\", \"en\")\n }\n\n if Int($voting[\"voting.type_participants\"]) != 5 {\n $participant = DBFind(\"@1votings_participants\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"member->member_id\": $key_id, \"decision\": 0}).Columns(\"id,rating\").Row()\n }\n if Int($voting[\"voting.type_participants\"]) == 5 {\n $participant = DBFind(\"@1votings_participants\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"member->member_id\": 0, \"member->role_id\": $RoleId, \"decision\": 0}).Columns(\"id,rating\").Row()\n }\n if !$participant {\n warning LangRes(\"@1voting_not_participant\", \"en\")\n }\n }\n\n action {\n if Int($voting[\"voting.type_participants\"]) == 5 {\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"member->member_id\": $key_id, \"role->id\": $RoleId, \"deleted\": 0}).One(\"id\") {\n warning LangRes(\"@1voting_not_participant\", \"en\")\n } else {\n var member map\n member[\"member_id\"] = $key_id\n member[\"member_name\"] = IdToAddress($key_id)\n member[\"role_id\"] = $RoleId\n var member_json string\n member_json = JSONEncode(member)\n DBUpdate(\"@1votings_participants\", Int($participant[\"id\"]), {\"member\":member_json})\n }\n }\n\n if $voting[\"flags.notifics\"] == 1 {\n closeNotification()\n }\n\n if $voting[\"flags.decision\"] != 1 {\n var m map\n m[\"decision_date\"] = $block_time\n m[\"decision\"] = -1\n DBUpdate(\"@1votings_participants\", Int($participant[\"id\"]), m)\n\n var p map\n var rating_accepted rating_rejected summ_rating int\n rating_accepted = Int($subject[\"results.rating_accepted\"])\n rating_rejected = Int($subject[\"results.rating_rejected\"]) + Int($participant[\"rating\"])\n summ_rating = rating_accepted + rating_rejected\n var percent_accepted percent_rejected int\n percent_accepted = (Float(rating_accepted)*Float(100))/Float(summ_rating)\n percent_rejected = (Float(rating_rejected)*Float(100))/Float(summ_rating)\n p[\"results->rating_accepted\"] = rating_accepted\n p[\"results->rating_rejected\"] = rating_rejected\n p[\"results->percent_accepted\"] = percent_accepted\n p[\"results->percent_rejected\"] = percent_rejected\n DBUpdate(\"@1votings_subject\", Int($subject[\"id\"]), p)\n\n @1VotingUpdate(\"VotingId\", $VotingId)\n }\n }\n}", - "Type": "contracts" - }, - { - "Name": "VotingValidatorAccept", - "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract VotingValidatorAccept {\n data {\n TemplateId string\n VotingId string\n }\n\n func getRoleId(name string, warn bool) int {\n var rid int\n rid = Int(AppParam(Int($system_app_id), name, $ecosystem_id))\n if rid == 0 && warn {\n warning Sprintf(LangRes(\"@role_not_set_application_parameter\", \"en\"), name)\n }\n return rid\n }\n\n conditions {\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n var prev string\n prev = $stack[0]\n if Len($stack) > 2 {\n prev = $stack[Len($stack) - 2]\n }\n if prev != \"@1VotingDecisionCheck\" {\n warning LangRes(\"@1contract_start_votingdecisioncheck_only\", \"en\")\n }\n\n var appId tId int\n appId = Int(DBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").One(\"id\"))\n tId = Int(AppParam(appId,\"voting_template_validators\", 1))\n if !DBFind(\"@1voting_templates\").Where({\"ecosystem\": $ecosystem_id, \"id\": tId}).One(\"id\") {\n warning LangRes(\"@1voting_template_not_found\", \"en\")\n }\n if $TemplateId != tId {\n warning LangRes(\"@1template_incorrect\", \"en\")\n }\n\n var oldRoleId roleId int roleName string\n oldRoleId = getRoleId(\"role_candidate_for_validators\", false)\n roleId = getRoleId(\"role_validator\", true)\n\n var validator_map map\n validator_map = DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId}).Columns(\"subject->contract_accept_params\").One(\"subject->contract_accept_params\")\n if !validator_map {\n warning LangRes(\"@1voting_subject_not_found\", \"en\")\n }\n validator_map = JSONDecode(validator_map)\n $validator_id = Int(validator_map[\"ValidatorId\"])\n $flag = validator_map[\"flag\"]\n\n $oldRoleRowId = Int(DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"deleted\": 0, \"role->id\": oldRoleId, \"member->member_id\": $validator_id}).One(\"id\"))\n $roleRowId = Int(DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"deleted\": 0, \"role->id\": roleId, \"member->member_id\": $validator_id}).One(\"id\"))\n\n $roleId = Int(DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": roleId, \"deleted\": 0}).One(\"id\"))\n if $roleId == 0 {\n warning LangRes(\"@1validator_role_not_found\", \"en\")\n }\n }\n\n action {\n if $flag == \"add\" {\n if $oldRoleRowId > 0 {\n @1RolesUnassign(\"RowId\", $oldRoleRowId)\n }\n @1RolesAssign(\"Rid,MemberId\", $roleId, Int($validator_id))\n }\n if $flag == \"remove\" {\n if $roleRowId > 0 { \n @1RolesUnassign(\"RowId\", $roleRowId)\n }\n }\n }\n}", + "Value": "contract VotingDecisionReject {\n data {\n VotingId int\n RoleId int\n }\n\n func closeNotification() {\n var role_id_search int\n role_id_search = Int(DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"recipient->role_id\": $RoleId, \"page_params->voting_id\": $VotingId, \"closed\": 0}).One(\"id\"))\n if role_id_search > 0 {\n @1NotificationsClose(\"NotificId\", role_id_search)\n } else {\n var id int\n id = Int(DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"recipient->account\": $account_id, \"page_params->voting_id\": $VotingId, \"closed\": 0}).One(\"id\"))\n if id > 0 {\n @1NotificationsClose(\"NotificId\", id)\n }\n }\n }\n\n conditions {\n $INVALID = 1\n $WAITING = 2\n $STARTED = 3\n $FINISHED = 4\n\n $voting = DBFind(\"@1votings\").Where({\"ecosystem\": $ecosystem_id, \"id\": $VotingId}).Columns(\"id,flags->decision,flags->notifics,voting->type_participants,voting->role_id,status,date_ended\").Row()\n if !$voting {\n warning LangRes(\"@1voting_not_found\", \"en\")\n }\n if $voting[\"voting.type_participants\"] == 3 {\n if $voting[\"voting.role_id\"] != $RoleId{\n warning LangRes(\"@1voting_role_incorrect\", \"en\")\n }\n }\n if $voting[\"status\"] == $FINISHED || $block_time > Int($voting[\"date_ended\"]) {\n warning LangRes(\"@1voting_expired_can_not_vote\", \"en\")\n }\n if $voting[\"status\"] != $STARTED {\n warning LangRes(\"@1voting_not_started\", \"en\")\n }\n $subject = DBFind(\"@1votings_subject\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId}).Columns(\"id,number_accept,results->rating_accepted,results->rating_rejected\").Row()\n if !$subject {\n warning LangRes(\"@1voting_subject_not_found\", \"en\")\n }\n\n if Int($voting[\"voting.type_participants\"]) != 5 {\n $participant = DBFind(\"@1votings_participants\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"member->account\": $account_id, \"decision\": 0}).Columns(\"id,rating\").Row()\n }\n if Int($voting[\"voting.type_participants\"]) == 5 {\n $participant = DBFind(\"@1votings_participants\").Where({\"ecosystem\": $ecosystem_id, \"voting_id\": $VotingId, \"member->account\": 0, \"member->role_id\": $RoleId, \"decision\": 0}).Columns(\"id,rating\").Row()\n }\n if !$participant {\n warning LangRes(\"@1voting_not_participant\", \"en\")\n }\n }\n\n action {\n if Int($voting[\"voting.type_participants\"]) == 5 {\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"member->account\": $account_id, \"role->id\": $RoleId, \"deleted\": 0}).One(\"id\") {\n warning LangRes(\"@1voting_not_participant\", \"en\")\n } else {\n var member map\n member[\"account\"] = $account_id\n member[\"member_name\"] = $account_id\n member[\"role_id\"] = $RoleId\n var member_json string\n member_json = JSONEncode(member)\n DBUpdate(\"@1votings_participants\", Int($participant[\"id\"]), {\"member\": member_json})\n }\n }\n\n if $voting[\"flags.notifics\"] == 1 {\n closeNotification()\n }\n\n if $voting[\"flags.decision\"] != 1 {\n var m map\n m[\"decision_date\"] = $block_time\n m[\"decision\"] = -1\n DBUpdate(\"@1votings_participants\", Int($participant[\"id\"]), m)\n\n var p map\n var rating_accepted rating_rejected summ_rating int\n rating_accepted = Int($subject[\"results.rating_accepted\"])\n rating_rejected = Int($subject[\"results.rating_rejected\"]) + Int($participant[\"rating\"])\n summ_rating = rating_accepted + rating_rejected\n var percent_accepted percent_rejected int\n percent_accepted = (Float(rating_accepted)*Float(100))/Float(summ_rating)\n percent_rejected = (Float(rating_rejected)*Float(100))/Float(summ_rating)\n p[\"results->rating_accepted\"] = rating_accepted\n p[\"results->rating_rejected\"] = rating_rejected\n p[\"results->percent_accepted\"] = percent_accepted\n p[\"results->percent_rejected\"] = percent_rejected\n DBUpdate(\"@1votings_subject\", Int($subject[\"id\"]), p)\n\n @1VotingUpdate(\"VotingId\", $VotingId)\n }\n }\n}", "Type": "contracts" }, { @@ -1160,13 +1160,13 @@ { "Name": "VotingWizardBuffer", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract VotingWizardBuffer {\n data {\n LoadAutosave string \"optional\"\n Name string \"optional\"\n Type int \"optional\"\n TypeParticipants int \"optional\"\n TypeDecision int \"optional\"\n Volume int \"optional\"\n Quorum int \"optional\"\n Rating string \"optional\"\n CountTypeVoters string \"optional\"\n Description string \"optional\"\n Interval string \"optional\"\n StartDate string \"optional\"\n StartTime string \"optional\"\n EndDate string \"optional\"\n EndTime string \"optional\"\n MemberParticipants string \"optional\"\n RoleParticipants string \"optional\"\n GroupParticipants string \"optional\"\n ExecuteContract string \"optional\"\n ContractAcceptName string \"optional\"\n ContractAcceptParams string \"optional\"\n ContractRejectName string \"optional\"\n ContractRejectParams string \"optional\"\n TextDocument string \"optional\"\n Candidates string \"optional\"\n Apply string \"optional\"\n RoleId string \"optional\"\n Vacancies string \"optional\"\n }\n\n action {\n if $LoadAutosave == \"no\" {\n DBUpdateExt(\"@1buffer_data\", {\"key\": \"voting_wizard_buffer\", \"member_id\": $key_id, \"ecosystem\": $ecosystem_id}, {\"value\": \"{}\"})\n }\n\n var buffer_map old_buffer old_value map\n\n old_buffer = DBFind(\"@1buffer_data\").Where({\"key\": \"voting_wizard_buffer\", \"member_id\": $key_id, \"ecosystem\": $ecosystem_id}).Row()\n if old_buffer {\n old_value = JSONDecode(old_buffer[\"value\"])\n }\n\n buffer_map[\"save_time\"] = $block_time\n\n if $Name {\n buffer_map[\"voting_name\"] = $Name\n } elif old_value[\"voting_name\"] {\n buffer_map[\"voting_name\"] = old_value[\"voting_name\"]\n }\n if $Type != 0 {\n buffer_map[\"voting_type\"] = $Type\n } elif old_value[\"voting_type\"] {\n buffer_map[\"voting_type\"] = old_value[\"voting_type\"]\n }\n if $TypeParticipants != 0 {\n buffer_map[\"type_participants\"] = $TypeParticipants\n } elif old_value[\"type_participants\"] {\n buffer_map[\"type_participants\"] = old_value[\"type_participants\"]\n }\n if $TypeDecision != 0 {\n buffer_map[\"type_decision\"] = $TypeDecision\n } elif old_value[\"type_decision\"] {\n buffer_map[\"type_decision\"] = old_value[\"type_decision\"]\n }\n if $Volume != 0 {\n buffer_map[\"volume\"] = $Volume\n } elif old_value[\"volume\"] {\n buffer_map[\"volume\"] = old_value[\"volume\"]\n }\n if $Quorum != 0 {\n buffer_map[\"quorum\"] = $Quorum\n } elif old_value[\"quorum\"] {\n buffer_map[\"quorum\"] = old_value[\"quorum\"]\n }\n if $Rating {\n buffer_map[\"rating\"] = $Rating\n } elif old_value[\"rating\"] {\n buffer_map[\"rating\"] = old_value[\"rating\"]\n }\n if $CountTypeVoters {\n buffer_map[\"count_type_voters\"] = $CountTypeVoters\n } elif old_value[\"count_type_voters\"] {\n buffer_map[\"count_type_voters\"] = old_value[\"count_type_voters\"]\n }\n if $Description {\n buffer_map[\"description\"] = $Description\n } elif old_value[\"description\"] {\n buffer_map[\"description\"] = old_value[\"description\"]\n }\n if $Interval {\n buffer_map[\"interval\"] = $Interval\n } elif old_value[\"interval\"] {\n buffer_map[\"interval\"] = old_value[\"interval\"]\n }\n if $StartDate {\n buffer_map[\"start_date\"] = $StartDate\n } elif old_value[\"start_date\"] {\n buffer_map[\"start_date\"] = old_value[\"start_date\"]\n }\n if $StartTime {\n buffer_map[\"start_time\"] = $StartTime\n } elif old_value[\"start_time\"] {\n buffer_map[\"start_time\"] = old_value[\"start_time\"]\n }\n if $EndDate {\n buffer_map[\"end_date\"] = $EndDate\n } elif old_value[\"end_date\"] {\n buffer_map[\"end_date\"] = old_value[\"end_date\"]\n }\n if $EndTime {\n buffer_map[\"end_time\"] = $EndTime\n } elif old_value[\"end_time\"] {\n buffer_map[\"end_time\"] = old_value[\"end_time\"]\n }\n if $MemberParticipants {\n buffer_map[\"member_participants\"] = $MemberParticipants\n } elif old_value[\"member_participants\"] {\n buffer_map[\"member_participants\"] = old_value[\"member_participants\"]\n }\n if $RoleParticipants {\n buffer_map[\"role_participants\"] = $RoleParticipants\n } elif old_value[\"role_participants\"] {\n buffer_map[\"role_participants\"] = old_value[\"role_participants\"]\n }\n if $GroupParticipants {\n buffer_map[\"group_participants\"] = $GroupParticipants\n } elif old_value[\"group_participants\"] {\n buffer_map[\"group_participants\"] = old_value[\"group_participants\"]\n }\n if $ExecuteContract {\n buffer_map [\"execute_contract\"] = $ExecuteContract\n } elif old_value[\"execute_contract\"] {\n buffer_map[\"execute_contract\"] = old_value[\"execute_contract\"]\n }\n if $ContractAcceptName {\n buffer_map [\"contract_accept_name\"] = $ContractAcceptName\n } elif old_value[\"contract_accept_name\"] {\n buffer_map[\"contract_accept_name\"] = old_value[\"contract_accept_name\"]\n }\n if $ContractAcceptParams {\n buffer_map[\"contract_accept_params\"] = $ContractAcceptParams\n } elif old_value[\"contract_accept_params\"] {\n buffer_map[\"contract_accept_params\"] = old_value[\"contract_accept_params\"]\n }\n if $ContractRejectName {\n buffer_map[\"contract_reject_name\"] = $ContractRejectName\n } elif old_value[\"contract_reject_name\"] {\n buffer_map[\"contract_reject_name\"] = old_value[\"contract_reject_name\"]\n }\n if $ContractRejectParams {\n buffer_map[\"contract_reject_params\"] = $ContractRejectParams\n } elif old_value[\"contract_reject_params\"] {\n buffer_map[\"contract_reject_params\"] = old_value[\"contract_reject_params\"]\n }\n if $TextDocument {\n buffer_map[\"text_document\"] = $TextDocument\n } elif old_value[\"text_document\"] {\n buffer_map[\"text_document\"] = old_value[\"text_document\"]\n }\n if $Candidates {\n buffer_map[\"candidates\"] = $Candidates\n } elif old_value[\"candidates\"] {\n buffer_map[\"candidates\"] = old_value[\"candidates\"]\n }\n if $Apply {\n buffer_map[\"apply\"] = $Apply\n } elif old_value[\"apply\"] {\n buffer_map[\"apply\"] = old_value[\"apply\"]\n }\n if $RoleId {\n buffer_map[\"role_id\"] = $RoleId\n } elif old_value[\"role_id\"] {\n buffer_map[\"role_id\"] = old_value[\"role_id\"]\n }\n if $Vacancies {\n buffer_map[\"vacancies\"] = $Vacancies\n } elif old_value[\"vacancies\"] {\n buffer_map[\"vacancies\"] = old_value[\"vacancies\"]\n }\n\n if old_buffer {\n DBUpdateExt(\"@1buffer_data\", {\"key\": \"voting_wizard_buffer\", \"member_id\": $key_id, \"ecosystem\": $ecosystem_id}, {\"value\": buffer_map})\n } else {\n DBInsert(\"@1buffer_data\", {\"key\": \"voting_wizard_buffer\", \"member_id\": $key_id, \"ecosystem\": $ecosystem_id, \"value\": buffer_map})\n }\n }\n}", + "Value": "contract VotingWizardBuffer {\n data {\n LoadAutosave string \"optional\"\n Name string \"optional\"\n Type int \"optional\"\n TypeParticipants int \"optional\"\n TypeDecision int \"optional\"\n Volume int \"optional\"\n Quorum int \"optional\"\n Rating string \"optional\"\n CountTypeVoters string \"optional\"\n Description string \"optional\"\n Interval string \"optional\"\n StartDate string \"optional\"\n StartTime string \"optional\"\n EndDate string \"optional\"\n EndTime string \"optional\"\n MemberParticipants string \"optional\"\n RoleParticipants string \"optional\"\n GroupParticipants string \"optional\"\n ExecuteContract string \"optional\"\n ContractAcceptName string \"optional\"\n ContractAcceptParams string \"optional\"\n ContractRejectName string \"optional\"\n ContractRejectParams string \"optional\"\n TextDocument string \"optional\"\n Candidates string \"optional\"\n Apply string \"optional\"\n RoleId string \"optional\"\n Vacancies string \"optional\"\n }\n\n action {\n if $LoadAutosave == \"no\" {\n DBUpdateExt(\"@1buffer_data\", {\"key\": \"voting_wizard_buffer\", \"account\": $account_id, \"ecosystem\": $ecosystem_id}, {\"value\": \"{}\"})\n }\n\n var buffer_map old_buffer old_value map\n\n old_buffer = DBFind(\"@1buffer_data\").Where({\"key\": \"voting_wizard_buffer\", \"account\": $account_id, \"ecosystem\": $ecosystem_id}).Row()\n if old_buffer {\n old_value = JSONDecode(old_buffer[\"value\"])\n }\n\n buffer_map[\"save_time\"] = $block_time\n\n if $Name {\n buffer_map[\"voting_name\"] = $Name\n } elif old_value[\"voting_name\"] {\n buffer_map[\"voting_name\"] = old_value[\"voting_name\"]\n }\n if $Type != 0 {\n buffer_map[\"voting_type\"] = $Type\n } elif old_value[\"voting_type\"] {\n buffer_map[\"voting_type\"] = old_value[\"voting_type\"]\n }\n if $TypeParticipants != 0 {\n buffer_map[\"type_participants\"] = $TypeParticipants\n } elif old_value[\"type_participants\"] {\n buffer_map[\"type_participants\"] = old_value[\"type_participants\"]\n }\n if $TypeDecision != 0 {\n buffer_map[\"type_decision\"] = $TypeDecision\n } elif old_value[\"type_decision\"] {\n buffer_map[\"type_decision\"] = old_value[\"type_decision\"]\n }\n if $Volume != 0 {\n buffer_map[\"volume\"] = $Volume\n } elif old_value[\"volume\"] {\n buffer_map[\"volume\"] = old_value[\"volume\"]\n }\n if $Quorum != 0 {\n buffer_map[\"quorum\"] = $Quorum\n } elif old_value[\"quorum\"] {\n buffer_map[\"quorum\"] = old_value[\"quorum\"]\n }\n if $Rating {\n buffer_map[\"rating\"] = $Rating\n } elif old_value[\"rating\"] {\n buffer_map[\"rating\"] = old_value[\"rating\"]\n }\n if $CountTypeVoters {\n buffer_map[\"count_type_voters\"] = $CountTypeVoters\n } elif old_value[\"count_type_voters\"] {\n buffer_map[\"count_type_voters\"] = old_value[\"count_type_voters\"]\n }\n if $Description {\n buffer_map[\"description\"] = $Description\n } elif old_value[\"description\"] {\n buffer_map[\"description\"] = old_value[\"description\"]\n }\n if $Interval {\n buffer_map[\"interval\"] = $Interval\n } elif old_value[\"interval\"] {\n buffer_map[\"interval\"] = old_value[\"interval\"]\n }\n if $StartDate {\n buffer_map[\"start_date\"] = $StartDate\n } elif old_value[\"start_date\"] {\n buffer_map[\"start_date\"] = old_value[\"start_date\"]\n }\n if $StartTime {\n buffer_map[\"start_time\"] = $StartTime\n } elif old_value[\"start_time\"] {\n buffer_map[\"start_time\"] = old_value[\"start_time\"]\n }\n if $EndDate {\n buffer_map[\"end_date\"] = $EndDate\n } elif old_value[\"end_date\"] {\n buffer_map[\"end_date\"] = old_value[\"end_date\"]\n }\n if $EndTime {\n buffer_map[\"end_time\"] = $EndTime\n } elif old_value[\"end_time\"] {\n buffer_map[\"end_time\"] = old_value[\"end_time\"]\n }\n if $MemberParticipants {\n buffer_map[\"member_participants\"] = $MemberParticipants\n } elif old_value[\"member_participants\"] {\n buffer_map[\"member_participants\"] = old_value[\"member_participants\"]\n }\n if $RoleParticipants {\n buffer_map[\"role_participants\"] = $RoleParticipants\n } elif old_value[\"role_participants\"] {\n buffer_map[\"role_participants\"] = old_value[\"role_participants\"]\n }\n if $GroupParticipants {\n buffer_map[\"group_participants\"] = $GroupParticipants\n } elif old_value[\"group_participants\"] {\n buffer_map[\"group_participants\"] = old_value[\"group_participants\"]\n }\n if $ExecuteContract {\n buffer_map [\"execute_contract\"] = $ExecuteContract\n } elif old_value[\"execute_contract\"] {\n buffer_map[\"execute_contract\"] = old_value[\"execute_contract\"]\n }\n if $ContractAcceptName {\n buffer_map [\"contract_accept_name\"] = $ContractAcceptName\n } elif old_value[\"contract_accept_name\"] {\n buffer_map[\"contract_accept_name\"] = old_value[\"contract_accept_name\"]\n }\n if $ContractAcceptParams {\n buffer_map[\"contract_accept_params\"] = $ContractAcceptParams\n } elif old_value[\"contract_accept_params\"] {\n buffer_map[\"contract_accept_params\"] = old_value[\"contract_accept_params\"]\n }\n if $ContractRejectName {\n buffer_map[\"contract_reject_name\"] = $ContractRejectName\n } elif old_value[\"contract_reject_name\"] {\n buffer_map[\"contract_reject_name\"] = old_value[\"contract_reject_name\"]\n }\n if $ContractRejectParams {\n buffer_map[\"contract_reject_params\"] = $ContractRejectParams\n } elif old_value[\"contract_reject_params\"] {\n buffer_map[\"contract_reject_params\"] = old_value[\"contract_reject_params\"]\n }\n if $TextDocument {\n buffer_map[\"text_document\"] = $TextDocument\n } elif old_value[\"text_document\"] {\n buffer_map[\"text_document\"] = old_value[\"text_document\"]\n }\n if $Candidates {\n buffer_map[\"candidates\"] = $Candidates\n } elif old_value[\"candidates\"] {\n buffer_map[\"candidates\"] = old_value[\"candidates\"]\n }\n if $Apply {\n buffer_map[\"apply\"] = $Apply\n } elif old_value[\"apply\"] {\n buffer_map[\"apply\"] = old_value[\"apply\"]\n }\n if $RoleId {\n buffer_map[\"role_id\"] = $RoleId\n } elif old_value[\"role_id\"] {\n buffer_map[\"role_id\"] = old_value[\"role_id\"]\n }\n if $Vacancies {\n buffer_map[\"vacancies\"] = $Vacancies\n } elif old_value[\"vacancies\"] {\n buffer_map[\"vacancies\"] = old_value[\"vacancies\"]\n }\n\n if old_buffer {\n DBUpdateExt(\"@1buffer_data\", {\"key\": \"voting_wizard_buffer\", \"account\": $account_id, \"ecosystem\": $ecosystem_id}, {\"value\": buffer_map})\n } else {\n DBInsert(\"@1buffer_data\", {\"key\": \"voting_wizard_buffer\", \"account\": $account_id, \"ecosystem\": $ecosystem_id, \"value\": buffer_map})\n }\n }\n}", "Type": "contracts" }, { "Name": "VotingWizardCreate", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract VotingWizardCreate {\n data {\n Name string\n Type int\n TypeParticipants int\n TypeDecision int\n Volume int \"optional\"\n Quorum int\n Rating string \"optional\"\n CountTypeVoters string \"optional\"\n Description string \"optional\"\n Interval string \"optional\"\n StartDate string \"optional\"\n StartTime string \"optional\"\n EndDate string \"optional\"\n EndTime string \"optional\"\n MemberParticipants string \"optional\"\n RoleParticipants string \"optional\"\n GroupParticipants string \"optional\"\n ExecuteContract string \"optional\"\n ContractAcceptName string \"optional\"\n ContractAcceptParams string \"optional\"\n ContractRejectName string \"optional\"\n ContractRejectParams string \"optional\"\n TextDocument string \"optional\"\n Candidates string \"optional\"\n Apply string \"optional\"\n RoleId string \"optional\"\n Vacancies string \"optional\"\n }\n\n func sendInvites(voting int, participants string, type string) {\n var participants_list array i current_participant int m map\n participants_list = Split(participants, \",\")\n i = 0\n while i < Len(participants_list) {\n current_participant = Int(participants_list[i])\n var participants_count int\n if type == \"role\" {\n participants_count = Len(DBFind(\"@1roles_participants\").Where({ecosystem: $ecosystem_id, \"role->id\": current_participant, deleted: 0}))\n } elif type == \"group\" {\n participants_count = Len(DBFind(\"@1groups_participants\").Where({ecosystem: $ecosystem_id, \"groups_info->id\": current_participant, deleted: 0}))\n }\n \n if type == \"member\" || participants_count != 0 {\n m[\"VotingId\"] = voting\n m[\"VarId\"] = current_participant\n CallContract(\"@1VotingInvite\", m)\n }\n i = i + 1\n }\n }\n\n action {\n var create_map subject_map invite_map m map voting_id i int\n\n create_map[\"Name\"] = $Name\n create_map[\"Type\"] = $Type\n create_map[\"TypeParticipants\"] = $TypeParticipants\n create_map[\"TypeDecision\"] = $TypeDecision\n create_map[\"Volume\"] = $Volume\n create_map[\"Quorum\"] = $Quorum\n create_map[\"Rating\"] = $Rating\n create_map[\"CountTypeVoters\"] = $CountTypeVoters\n create_map[\"Description\"] = $Description\n create_map[\"StartDate\"] = $StartDate\n create_map[\"StartTime\"] = $StartTime\n create_map[\"EndDate\"] = $EndDate\n create_map[\"EndTime\"] = $EndTime\n\n voting_id = CallContract(\"@1VotingCreate\", create_map)\n\n subject_map[\"VotingId\"] = voting_id\n\n if $TypeDecision == 4 {\n subject_map[\"ContractAcceptName\"] = $ContractAcceptName\n subject_map[\"ContractAcceptParams\"] = $ContractAcceptParams\n subject_map[\"ContractRejectName\"] = $ContractRejectName\n subject_map[\"ContractRejectParams\"] = $ContractRejectParams\n } elif $ExecuteContract == \"yes\" {\n subject_map[\"OptContractAcceptName\"] = $ContractAcceptName\n subject_map[\"OptContractAcceptParams\"] = $ContractAcceptParams\n subject_map[\"OptContractRejectName\"] = $ContractRejectName\n subject_map[\"OptContractRejectParams\"] = $ContractRejectParams\n }\n\n if $TypeDecision == 1 && $Apply == 1 {\n m[\"VotingId\"] = voting_id\n m[\"MemberId\"] = 0\n CallContract(\"@1VotingSubjectCandidates\", m)\n subject_map[\"RoleId\"] = Int($RoleId)\n subject_map[\"Vacancies\"] = Int($Vacancies)\n CallContract(\"@1VotingSubjectSettings\", subject_map)\n } elif $TypeDecision == 2 && Str($Candidates) != \"0\" {\n var candidates_list array\n candidates_list = Split($Candidates, \",\")\n i = 0\n while i < Len(candidates_list) {\n m[\"VotingId\"] = voting_id\n m[\"MemberId\"] = Int(candidates_list[i])\n CallContract(\"@1VotingSubjectCandidates\", m)\n i = i + 1\n }\n subject_map[\"RoleId\"] = Int($RoleId)\n subject_map[\"Vacancies\"] = Int($Vacancies)\n CallContract(\"@1VotingSubjectSettings\", subject_map)\n } elif $TypeDecision == 3 {\n subject_map[\"TextDocument\"] = $TextDocument\n CallContract(\"@1VotingSubjectDocument\", subject_map)\n } elif $TypeDecision == 4 {\n CallContract(\"@1VotingSubjectContract\", subject_map)\n }\n\n if Str($MemberParticipants) != \"0\" && $TypeParticipants != 1 {\n sendInvites(voting_id, $MemberParticipants, \"member\")\n } elif Str($RoleParticipants) != \"0\" {\n sendInvites(voting_id, $RoleParticipants, \"role\")\n } elif Str($GroupParticipants) != \"0\" {\n sendInvites(voting_id, $GroupParticipants, \"group\")\n }\n DBUpdateExt(\"@1buffer_data\", {\"key\": \"voting_wizard_buffer\", \"member_id\": $key_id, \"ecosystem\": $ecosystem_id}, {\"value\": \"{}\"})\n }\n}", + "Value": "contract VotingWizardCreate {\n data {\n Name string\n Type int\n TypeParticipants int\n TypeDecision int\n Volume int \"optional\"\n Quorum int\n Rating string \"optional\"\n CountTypeVoters string \"optional\"\n Description string \"optional\"\n Interval string \"optional\"\n StartDate string \"optional\"\n StartTime string \"optional\"\n EndDate string \"optional\"\n EndTime string \"optional\"\n MemberParticipants string \"optional\"\n RoleParticipants string \"optional\"\n GroupParticipants string \"optional\"\n ExecuteContract string \"optional\"\n ContractAcceptName string \"optional\"\n ContractAcceptParams string \"optional\"\n ContractRejectName string \"optional\"\n ContractRejectParams string \"optional\"\n TextDocument string \"optional\"\n Candidates string \"optional\"\n Apply string \"optional\"\n RoleId string \"optional\"\n Vacancies string \"optional\"\n }\n\n func sendInvites(voting int, participants string, type string) {\n var participants_list array i current_participant int m map\n participants_list = Split(participants, \",\")\n i = 0\n while i < Len(participants_list) {\n current_participant = Int(participants_list[i])\n var participants_count int\n if type == \"role\" {\n participants_count = Len(DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": current_participant, \"deleted\": 0}))\n } elif type == \"group\" {\n participants_count = Len(DBFind(\"@1groups_participants\").Where({\"ecosystem\": $ecosystem_id, \"groups_info->id\": current_participant, \"deleted\": 0}))\n }\n \n if type == \"member\" || participants_count != 0 {\n m[\"VotingId\"] = voting\n m[\"VarId\"] = current_participant\n CallContract(\"@1VotingInvite\", m)\n }\n i = i + 1\n }\n }\n\n action {\n var create_map subject_map invite_map m map voting_id i int\n\n create_map[\"Name\"] = $Name\n create_map[\"Type\"] = $Type\n create_map[\"TypeParticipants\"] = $TypeParticipants\n create_map[\"TypeDecision\"] = $TypeDecision\n create_map[\"Volume\"] = $Volume\n create_map[\"Quorum\"] = $Quorum\n create_map[\"Rating\"] = $Rating\n create_map[\"CountTypeVoters\"] = $CountTypeVoters\n create_map[\"Description\"] = $Description\n create_map[\"StartDate\"] = $StartDate\n create_map[\"StartTime\"] = $StartTime\n create_map[\"EndDate\"] = $EndDate\n create_map[\"EndTime\"] = $EndTime\n\n voting_id = CallContract(\"@1VotingCreate\", create_map)\n\n subject_map[\"VotingId\"] = voting_id\n\n if $TypeDecision == 4 {\n subject_map[\"ContractAcceptName\"] = $ContractAcceptName\n subject_map[\"ContractAcceptParams\"] = $ContractAcceptParams\n subject_map[\"ContractRejectName\"] = $ContractRejectName\n subject_map[\"ContractRejectParams\"] = $ContractRejectParams\n } elif $ExecuteContract == \"yes\" {\n subject_map[\"OptContractAcceptName\"] = $ContractAcceptName\n subject_map[\"OptContractAcceptParams\"] = $ContractAcceptParams\n subject_map[\"OptContractRejectName\"] = $ContractRejectName\n subject_map[\"OptContractRejectParams\"] = $ContractRejectParams\n }\n\n if $TypeDecision == 1 && $Apply == 1 {\n m[\"VotingId\"] = voting_id\n m[\"MemberAccount\"] = 0\n CallContract(\"@1VotingSubjectCandidates\", m)\n subject_map[\"RoleId\"] = Int($RoleId)\n subject_map[\"Vacancies\"] = Int($Vacancies)\n CallContract(\"@1VotingSubjectSettings\", subject_map)\n } elif $TypeDecision == 2 && Str($Candidates) != \"0\" {\n var candidates_list array\n candidates_list = Split($Candidates, \",\")\n i = 0\n while i < Len(candidates_list) {\n m[\"VotingId\"] = voting_id\n m[\"MemberAccount\"] = candidates_list[i]\n CallContract(\"@1VotingSubjectCandidates\", m)\n i = i + 1\n }\n subject_map[\"RoleId\"] = Int($RoleId)\n subject_map[\"Vacancies\"] = Int($Vacancies)\n CallContract(\"@1VotingSubjectSettings\", subject_map)\n } elif $TypeDecision == 3 {\n subject_map[\"TextDocument\"] = $TextDocument\n CallContract(\"@1VotingSubjectDocument\", subject_map)\n } elif $TypeDecision == 4 {\n CallContract(\"@1VotingSubjectContract\", subject_map)\n }\n\n if Str($MemberParticipants) != \"0\" && $TypeParticipants != 1 {\n sendInvites(voting_id, $MemberParticipants, \"member\")\n } elif Str($RoleParticipants) != \"0\" {\n sendInvites(voting_id, $RoleParticipants, \"role\")\n } elif Str($GroupParticipants) != \"0\" {\n sendInvites(voting_id, $GroupParticipants, \"group\")\n }\n DBUpdateExt(\"@1buffer_data\", {\"key\": \"voting_wizard_buffer\", \"account\": $account_id, \"ecosystem\": $ecosystem_id}, {\"value\": \"{}\"})\n }\n}", "Type": "contracts" } ] diff --git a/conditions.json b/conditions.json index 0456cb98d..95a427cc4 100644 --- a/conditions.json +++ b/conditions.json @@ -53,7 +53,7 @@ { "Name": "full_nodes", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract full_nodes {\n data {\n Value string\n }\n\n conditions {\n if Size($Value) == 0 {\n warning \"Value was not received\"\n }\n\n var full_nodes_arr array\n full_nodes_arr = JSONDecode($Value)\n\n var len_arr int\n len_arr = Len(full_nodes_arr)\n\n if len_arr == 0 {\n warning \"Wrong array structure\"\n }\n\n var i int\n while(i < len_arr){\n var node_map map\n node_map = full_nodes_arr[i]\n\n var public_key string\n var tcp_address string\n var api_address string\n var key_id string\n\n public_key = node_map[\"public_key\"]\n tcp_address = node_map[\"tcp_address\"]\n api_address = node_map[\"api_address\"]\n key_id = node_map[\"key_id\"]\n\n if Size(public_key) == 0 {\n warning \"Public key was not received\"\n }\n if Size(tcp_address) == 0 {\n warning \"TCP address was not received\"\n }\n if Size(api_address) == 0 {\n warning \"API address was not received\"\n }\n if Size(key_id) == 0 {\n warning \"Key ID was not received\"\n }\n\n i = i + 1\n }\n }\n}", + "Value": "contract full_nodes {\n data {\n Value string\n }\n\n conditions {\n if Size($Value) == 0 {\n warning \"Value was not received\"\n }\n\n var full_nodes_arr array\n full_nodes_arr = JSONDecode($Value)\n\n var len_arr int\n len_arr = Len(full_nodes_arr)\n\n if len_arr == 0 {\n warning \"Wrong array structure\"\n }\n\n var i int\n while(i < len_arr){\n var node_map map\n node_map = full_nodes_arr[i]\n\n var public_key string\n var tcp_address string\n var api_address string\n var key_id string\n\n public_key = node_map[\"public_key\"]\n tcp_address = node_map[\"tcp_address\"]\n api_address = node_map[\"api_address\"]\n key_id = node_map[\"key_id\"]\n\n if Size(public_key) == 0 {\n warning \"Public key was not received\"\n }\n if Size(tcp_address) == 0 {\n warning \"TCP address was not received\"\n }\n if Size(api_address) == 0 {\n warning \"API address was not received\"\n }\n if Size(key_id) == 0 {\n warning \"Account was not received\"\n }\n\n i = i + 1\n }\n }\n}", "Type": "contracts" }, { diff --git a/ecosystem_apps/crediting.json b/ecosystem_apps/crediting.json index 2a043dc92..634e1c0b5 100644 --- a/ecosystem_apps/crediting.json +++ b/ecosystem_apps/crediting.json @@ -116,7 +116,7 @@ }, { "Name": "crediting_settings", - "Trans": "{\"en\": \"Crediting settings\", \"ru\": \"Настройки Кридитования\"}", + "Trans": "{\"en\": \"Crediting settings\", \"ru\": \"Настройки Кредитования\"}", "Type": "languages" }, { @@ -156,19 +156,19 @@ }, { "Name": "crediting_offers", - "Columns": "[\n {\n \"name\":\"creditor\",\n \"conditions\":\"false\",\n \"type\":\"varchar\"\n },\n {\n \"name\":\"date_created\",\n \"conditions\":\"false\",\n \"type\":\"number\"\n },\n {\n \"name\":\"rate\",\n \"conditions\":\"false\",\n \"type\":\"number\"\n },\n {\n \"name\":\"request_id\",\n \"conditions\":\"false\",\n \"type\":\"number\"\n }\n]", + "Columns": "[\n {\n \"name\": \"creditor\",\n \"conditions\": \"false\",\n \"type\": \"varchar\"\n },\n {\n \"name\": \"date_created\",\n \"conditions\": \"false\",\n \"type\": \"number\"\n },\n {\n \"name\": \"rate\",\n \"conditions\": \"false\",\n \"type\": \"number\"\n },\n {\n \"name\": \"request_id\",\n \"conditions\": \"false\",\n \"type\": \"number\"\n }\n]", "Permissions": "{\"read\": \"true\", \"insert\": \"ContractAccess(\\\"CreditingBid\\\")\", \"update\": \"false\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", "Type": "tables" }, { "Name": "crediting_requests", - "Columns": "[\n {\n \"name\":\"amount\",\n \"conditions\": \"ContractAccess(\\\"CreditingAdd\\\")\",\n \"type\":\"money\"\n },\n {\n \"name\":\"borrower\",\n \"conditions\": \"false\",\n \"type\":\"varchar\"\n },\n {\n \"name\":\"creditor\",\n \"conditions\": \"ContractAccess(\\\"CreditingStatusUpdate\\\")\",\n \"type\":\"varchar\"\n },\n {\n \"name\":\"date_created\",\n \"conditions\":\"false\",\n \"type\":\"number\"\n },\n {\n \"name\":\"date_ended\",\n \"conditions\": \"ContractAccess(\\\"CreditingAdd\\\")\",\n \"type\":\"number\"\n },\n {\n \"name\":\"date_started\",\n \"conditions\": \"ContractAccess(\\\"CreditingAdd\\\")\",\n \"type\":\"number\"\n },\n {\n \"name\":\"deleted\",\n \"conditions\": \"ContractAccess(\\\"CreditingBlock\\\",\\\"CreditingDel\\\")\",\n \"type\":\"number\"\n },\n {\n \"name\":\"rate\",\n \"conditions\": \"ContractAccess(\\\"CreditingStatusUpdate\\\")\",\n \"type\":\"number\"\n },\n {\n \"name\":\"sign_borrower\",\n \"conditions\": \"ContractAccess(\\\"CreditingSignAccept\\\")\",\n \"type\":\"number\"\n },\n {\n \"name\":\"sign_creditor\",\n \"conditions\": \"ContractAccess(\\\"CreditingSignAccept\\\")\",\n \"type\":\"number\"\n },\n {\n \"name\":\"status\",\n \"conditions\": \"ContractAccess(\\\"CreditingStatusUpdate\\\", \\\"CreditingSignReject\\\", \\\"CreditingSignAccept\\\", \\\"CreditingBlock\\\", \\\"CreditingDel\\\")\",\n \"type\":\"number\"\n },\n {\n \"name\":\"term\",\n \"conditions\": \"ContractAccess(\\\"CreditingAdd\\\")\",\n \"type\":\"text\"\n },\n {\n \"name\":\"description\",\n \"conditions\": \"ContractAccess(\\\"CreditingAdd\\\")\",\n \"type\":\"text\"\n },\n {\n \"name\":\"offer_id\",\n \"conditions\": \"ContractAccess(\\\"CreditingStatusUpdate\\\")\",\n \"type\":\"number\"\n },\n {\n \"name\":\"offer_date\",\n \"conditions\": \"ContractAccess(\\\"CreditingStatusUpdate\\\")\",\n \"type\":\"number\"\n },\n {\n \"name\":\"pub_borrower\",\n \"conditions\": \"ContractAccess(\\\"CreditingSignAccept\\\")\",\n \"type\":\"text\"\n },\n {\n \"name\":\"pub_creditor\",\n \"conditions\": \"ContractAccess(\\\"CreditingSignAccept\\\")\",\n \"type\":\"text\"\n }\n]", + "Columns": "[\n {\n \"name\": \"amount\",\n \"conditions\": \"ContractAccess(\\\"CreditingAdd\\\")\",\n \"type\": \"money\"\n },\n {\n \"name\": \"borrower\",\n \"conditions\": \"false\",\n \"type\": \"varchar\"\n },\n {\n \"name\": \"creditor\",\n \"conditions\": \"ContractAccess(\\\"CreditingStatusUpdate\\\")\",\n \"type\": \"varchar\"\n },\n {\n \"name\": \"date_created\",\n \"conditions\": \"false\",\n \"type\": \"number\"\n },\n {\n \"name\": \"date_ended\",\n \"conditions\": \"ContractAccess(\\\"CreditingAdd\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"date_started\",\n \"conditions\": \"ContractAccess(\\\"CreditingAdd\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"deleted\",\n \"conditions\": \"ContractAccess(\\\"CreditingBlock\\\",\\\"CreditingDel\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"rate\",\n \"conditions\": \"ContractAccess(\\\"CreditingStatusUpdate\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"sign_borrower\",\n \"conditions\": \"ContractAccess(\\\"CreditingSignAccept\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"sign_creditor\",\n \"conditions\": \"ContractAccess(\\\"CreditingSignAccept\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"status\",\n \"conditions\": \"ContractAccess(\\\"CreditingStatusUpdate\\\", \\\"CreditingSignReject\\\", \\\"CreditingSignAccept\\\", \\\"CreditingBlock\\\", \\\"CreditingDel\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"term\",\n \"conditions\": \"ContractAccess(\\\"CreditingAdd\\\")\",\n \"type\": \"text\"\n },\n {\n \"name\": \"description\",\n \"conditions\": \"ContractAccess(\\\"CreditingAdd\\\")\",\n \"type\": \"text\"\n },\n {\n \"name\": \"offer_id\",\n \"conditions\": \"ContractAccess(\\\"CreditingStatusUpdate\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"offer_date\",\n \"conditions\": \"ContractAccess(\\\"CreditingStatusUpdate\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"pub_borrower\",\n \"conditions\": \"ContractAccess(\\\"CreditingSignAccept\\\")\",\n \"type\": \"text\"\n },\n {\n \"name\": \"pub_creditor\",\n \"conditions\": \"ContractAccess(\\\"CreditingSignAccept\\\")\",\n \"type\": \"text\"\n }\n]", "Permissions": "{\"read\": \"true\", \"insert\": \"ContractAccess(\\\"CreditingAdd\\\")\", \"update\": \"true\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", "Type": "tables" }, { "Name": "crediting_subs", - "Columns": "[\n {\n \"name\":\"creditor\",\n \"conditions\":\"false\",\n \"type\":\"varchar\"\n },\n {\n \"name\":\"deleted\",\n \"conditions\": \"ContractAccess(\\\"CreditingSubscribe\\\")\",\n \"type\":\"number\"\n },\n {\n \"name\":\"request_id\",\n \"conditions\":\"false\",\n \"type\":\"number\"\n }\n]", + "Columns": "[\n {\n \"name\": \"creditor\",\n \"conditions\": \"false\",\n \"type\": \"varchar\"\n },\n {\n \"name\": \"deleted\",\n \"conditions\": \"ContractAccess(\\\"CreditingSubscribe\\\")\",\n \"type\": \"number\"\n },\n {\n \"name\": \"request_id\",\n \"conditions\": \"false\",\n \"type\": \"number\"\n }\n]", "Permissions": "{\"read\": \"true\", \"insert\": \"ContractAccess(\\\"CreditingSubscribe\\\")\", \"update\": \"ContractAccess(\\\"CreditingSubscribe\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", "Type": "tables" }, @@ -205,7 +205,7 @@ { "Name": "crediting_add", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "DBFind(@1applications).Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Crediting\"}).Columns(\"name,id\").Vars(application)\nIf(#Id#>0){\n DBFind(crediting_requests).Where({\"id\": #Id#}).Vars(request)\n}\nForm(){\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(crediting_borrower)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n SetVar(borrower, Address(#key_id#))\n Input(Name: Borrower, Disabled: 1, Value: #borrower#)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1amount)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n If(#request_amount#){\n SetVar(request_amount, Money(#request_amount#))\n Input(Name: Amount, Type: number, Value: #request_amount#)\n }.Else{\n Input(Name: Amount, Type: number)\n }\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt text-right){\n Label(){\n LangRes(crediting_term)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: type_term, Source: src_term)\n If(#request_term#){\n RadioGroup(Name: Term, Source: src_term, NameColumn: name, ValueColumn: name, Value: #request_term#)\n }.Else{\n RadioGroup(Name: Term, Source: src_term, NameColumn: name, ValueColumn: name)\n }\n \n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1date_start)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n If(#request_date_started#){\n SetVar(st_d, DateTime(DateTime: #request_date_started#, Format: \"YYYY-MM-DD\"))\n SetVar(st_t, DateTime(DateTime: #request_date_started#, Format: \"HH:MI\"))\n Div(col-md-6){\n Input(Name: StartDate, Type: date, Value: #st_d#)\n }\n Div(col-md-6){\n Input(Name: StartTime, Type: time, Value: #st_t#)\n }\n }.Else{\n Div(col-md-6){\n Input(Name: StartDate, Type: date)\n }\n Div(col-md-6){\n Input(Name: StartTime, Type: time, Value: \"00:00\")\n }\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1date_end)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n If(#request_date_ended#){\n SetVar(ed_d, DateTime(DateTime: #request_date_ended#, Format: \"YYYY-MM-DD\"))\n SetVar(ed_t, DateTime(DateTime: #request_date_ended#, Format: \"HH:MI\"))\n Div(col-md-6){\n Input(Name: EndDate, Type: date, Value: #ed_d#)\n }\n Div(col-md-6){\n Input(Name: EndTime, Type: time, Value: #ed_t#)\n }\n }.Else{\n Div(col-md-6){\n Input(Name: EndDate, Type: date)\n }\n Div(col-md-6){\n Input(Name: EndTime, Type: time, Value: \"00:00\")\n }\n }\n }\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1description)\n }\n }\n Div(col-md-9 text-left){\n If(#request_description#){\n Input(Name: Description, Type: textarea, Value: #request_description#).Style(resize:vertical)\n }.Else{\n Input(Name: Description, Type: textarea).Style(resize:vertical)\n }\n }\n }\n }\n If(#Id#>0){\n Button(Body: LangRes(@1edit), Class: btn btn-primary pull-right mt, Page: crediting_list, Contract: CreditingAdd, Params: \"Id=#Id#\")\n }.Else{\n Button(Body: LangRes(@1add), Class: btn btn-primary pull-right mt, Page: crediting_list, Contract: CreditingAdd)\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: crediting_list)\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Crediting\"}).Columns(\"name,id\").Vars(application)\nIf(#Id#>0){\n DBFind(\"crediting_requests\").Where({\"id\": \"#Id#\"}).Vars(request)\n}\nForm(){\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(crediting_borrower)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n SetVar(borrower, #account_id#)\n Input(Name: Borrower, Disabled: 1, Value: #borrower#)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1amount)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n If(#request_amount#){\n SetVar(request_amount, Money(#request_amount#))\n Input(Name: Amount, Type: number, Value: #request_amount#)\n }.Else{\n Input(Name: Amount, Type: number)\n }\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt text-right){\n Label(){\n LangRes(crediting_term)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: type_term, Source: src_term)\n If(#request_term#){\n RadioGroup(Name: Term, Source: src_term, NameColumn: name, ValueColumn: name, Value: #request_term#)\n }.Else{\n RadioGroup(Name: Term, Source: src_term, NameColumn: name, ValueColumn: name)\n }\n \n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1date_start)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n If(#request_date_started#){\n SetVar(st_d, DateTime(DateTime: #request_date_started#, Format: \"YYYY-MM-DD\"))\n SetVar(st_t, DateTime(DateTime: #request_date_started#, Format: \"HH:MI\"))\n Div(col-md-6){\n Input(Name: StartDate, Type: date, Value: #st_d#)\n }\n Div(col-md-6){\n Input(Name: StartTime, Type: time, Value: #st_t#)\n }\n }.Else{\n Div(col-md-6){\n Input(Name: StartDate, Type: date)\n }\n Div(col-md-6){\n Input(Name: StartTime, Type: time, Value: \"00:00\")\n }\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1date_end)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n If(#request_date_ended#){\n SetVar(ed_d, DateTime(DateTime: #request_date_ended#, Format: \"YYYY-MM-DD\"))\n SetVar(ed_t, DateTime(DateTime: #request_date_ended#, Format: \"HH:MI\"))\n Div(col-md-6){\n Input(Name: EndDate, Type: date, Value: #ed_d#)\n }\n Div(col-md-6){\n Input(Name: EndTime, Type: time, Value: #ed_t#)\n }\n }.Else{\n Div(col-md-6){\n Input(Name: EndDate, Type: date)\n }\n Div(col-md-6){\n Input(Name: EndTime, Type: time, Value: \"00:00\")\n }\n }\n }\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1description)\n }\n }\n Div(col-md-9 text-left){\n If(#request_description#){\n Input(Name: Description, Type: textarea, Value: #request_description#).Style(resize:vertical)\n }.Else{\n Input(Name: Description, Type: textarea).Style(resize:vertical)\n }\n }\n }\n }\n If(#Id#>0){\n Button(Body: LangRes(@1edit), Class: btn btn-primary pull-right mt, Page: crediting_list, Contract: CreditingAdd, Params: \"Id=#Id#\")\n }.Else{\n Button(Body: LangRes(@1add), Class: btn btn-primary pull-right mt, Page: crediting_list, Contract: CreditingAdd)\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: crediting_list)\n}", "Menu": "default_menu", "Type": "pages" }, @@ -219,53 +219,53 @@ { "Name": "crediting_history", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "DBFind(crediting_offers, offers).Where({\"request_id\": #Id#}).Order({\"rate\": 1, \"date_created\": 1}).Custom(custom_creditor){\n SetVar(creditor_id, AddressToId(#creditor#))\n DBFind(@1members).Where({\"ecosystem\": #ecosystem_id#, \"id\": #creditor_id#}).Columns(\"member_info->information\").Vars(c)\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#c_id#\"){\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(){\n P(Class: h5 m0 text-bold, Body: #creditor#)\n P(Class: h6 m0, Body: #c_member_info_information#)\n }\n }.Style(display:flex; align-items:center;)\n }\n}.Custom(custom_date){\n Span(Class: h6 text-muted, Body: DateTime(DateTime: #date_created#, Format: \"DD.MM.YYYY HH:MI\"))\n}.Custom(custom_rate){\n Span(Class: pull-right, Body: $crediting_rate$ - Strong(#rate# %))\n}.Count(cnt)\n\nForm(){\n Div(list-group-item){\n Div(row){\n Div(col-lg-10 col-lg-offset-1){\n Table(offers, \"$crediting_creditor$=custom_creditor,$crediting_bid_date$=custom_date,=custom_rate\")\n }\n }\n }\n Div(text-center mt-lg){\n Button(Class: btn bg-gray-lighter ml-sm, Page: crediting_view, PageParams: \"Id=#Id#\"){\n Span(Class: ml-sm, Body: LangRes(@1back))\n }\n }\n}", + "Value": "DBFind(\"crediting_offers\", offers).Where({\"request_id\": \"#Id#\"}).Order({\"rate\": 1, \"date_created\": 1}).Custom(custom_creditor){\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#creditor#\"}).Columns(\"member_info->information\").Vars(c)\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#c_account#\"){\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(){\n P(Class: h5 m0 text-bold, Body: #creditor#)\n P(Class: h6 m0, Body: #c_member_info_information#)\n }\n }.Style(display:flex; align-items:center;)\n }\n}.Custom(custom_date){\n Span(Class: h6 text-muted, Body: DateTime(DateTime: #date_created#, Format: \"DD.MM.YYYY HH:MI\"))\n}.Custom(custom_rate){\n Span(Class: pull-right, Body: $crediting_rate$ - Strong(#rate# %))\n}.Count(cnt)\n\nForm(){\n Div(list-group-item){\n Div(row){\n Div(col-lg-10 col-lg-offset-1){\n Table(offers, \"$crediting_creditor$=custom_creditor,$crediting_bid_date$=custom_date,=custom_rate\")\n }\n }\n }\n Div(text-center mt-lg){\n Button(Class: btn bg-gray-lighter ml-sm, Page: crediting_view, PageParams: \"Id=#Id#\"){\n Span(Class: ml-sm, Body: LangRes(@1back))\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "crediting_list", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "SetVar(this_page, crediting_list).(this_table, crediting_requests)\nInclude(@1pager_header)\n\nSetTitle(\"$crediting$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$crediting_desc$\"))\n\nDBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Crediting\"}).Vars(application)\nSetVar(admin_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crediting_admin_role))\nSetVar(creditor_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crediting_creditor_role))\nSetVar(borrower_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crediting_borrower_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": #ecosystem_id#, \"$and\": [\"role->id\": {\"$in\": [#admin_role#]}, \"role->id\": #role_id#], \"member->member_id\": #key_id#, \"deleted\": 0}).Vars(admin_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": #ecosystem_id#, \"$and\": [\"role->id\": {\"$in\": [#creditor_role#]}, \"role->id\": #role_id#], \"member->member_id\": #key_id#, \"deleted\": 0}).Vars(creditor_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": #ecosystem_id#, \"$and\": [\"role->id\": {\"$in\": [#borrower_role#]}, \"role->id\": #role_id#], \"member->member_id\": #key_id#, \"deleted\": 0}).Vars(borrower_access)\n\nIf(#borrower_access_id# > 0){\n AddToolButton(Title: $@1add$, Page: crediting_add, Icon: icon-plus).Popup(60, $crediting_add$)\n}\n\nIf(#page_par#==0){\n SetVar(type_filter, {\"status\": 0})\n}.ElseIf(#page_par#==1){\n SetVar(type_filter, {\"status\": 1})\n}.ElseIf(#page_par#==2){\n SetVar(type_filter, {\"status\": 2})\n}.ElseIf(#page_par#==3){\n SetVar(type_filter, {\"status\": 3})\n}.ElseIf(#page_par#==4){\n SetVar(type_filter, {\"status\": 4})\n}\n\nIf(#creditor_access_id# > 0){\n SetVar(global_access, 1)\n SetVar(role_where, {\"deleted\": 0})\n}.ElseIf(#borrower_access_id# > 0){\n SetVar(global_access, 1)\n SetVar(role_where, {\"borrower\": Address(#key_id#)})\n}.ElseIf(#admin_access_id# > 0){\n SetVar(global_access, 1)\n}\n\nIf(#global_access# == 1){\n If(#search#){\n SetVar(where, {\"$and\": [#role_where#, #type_filter#, {\"borrower\": {\"$ilike\": \"#search#\"}}]})\n }.Else{\n SetVar(where, {\"$and\": [#role_where#, #type_filter#]})\n }\n\n Div(mr-lg text-right){\n If(#admin_access_id# > 0){\n Button(Body: Em(Class: fa fa-refresh) $@1update_statuses$, Class: btn bg-gray mr-lg, Page: #this_page#, Contract: CreditingStatusUpdate)\n }\n Button(Page: crediting_filter, Class: btn bg-gray-lighter mr-sm, PageParams: \"page_par=#page_par#,search=#search#,current_page=#current_page#\", Body: Em(Class: fa fa-filter) $@1filter$).Popup(Header: $@1filter$, Width: \"30\")\n If(#type_filter#){\n Button(Page: #this_page#, PageParams: \"page_par=NULL,search=#search#\", Class: btn bg-gray-lighter mr-sm, Body: Em(Class: fa fa-close))\n }\n }.Style(margin-top: -28px; z-index: 1001;)\n\n Div(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(crediting_borrower))\n Include(@1search)\n }\n\n DBFind(#this_table#, src).Where(#where#).Order({\"deleted\": 1, \"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(custom_id){\n If(#deleted# == 0){\n SetVar(Name: style_text, Value: \"text-normal\")\n SetVar(Name: style_link, Value: \"text-primary\")\n }.Else{\n SetVar(Name: style_text, Value: \"text-muted\")\n SetVar(Name: style_link, Value: \"text-muted\")\n }\n SetVar(borrower_id, AddressToId(#borrower#))\n Span(Class: #style_text#, Body: #id#)\n }.Custom(custom_borrower){\n DBFind(@1members).Where({\"ecosystem\": #ecosystem_id#, \"id\": #borrower_id#}).Columns(\"member_info->information\").Vars(member)\n LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#member_id#\"){\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(){\n P(Class: h5 m0 text-bold, Body: #borrower#)\n P(Class: h6 m0, Body: #member_member_info_information#)\n }\n }.Style(display:flex; align-items:center;)\n }\n }.Custom(custom_amount){\n Span(Class: #style_text#, Body: Money(#amount#))\n }.Custom(custom_term){\n Span(Class: #style_text#, Body: #term#)\n }.Custom(custom_date){\n P(Class: #style_text# h6 m0, Body: DateTime(DateTime: #date_started#, Format: \"DD.MM.YYYY HH:MI\"))\n P(Class: #style_text# h6 m0, Body: DateTime(DateTime: #date_ended#, Format: \"DD.MM.YYYY HH:MI\"))\n }.Custom(custom_created){\n P(Class: #style_text# h6 m0, Body: DateTime(DateTime: #date_created#, Format: \"DD.MM.YYYY HH:MI\"))\n }.Custom(custom_status){\n If(#status#==-2){\n Span(Class: text-muted, Body: LangRes(crediting_blocked))\n }.ElseIf(#status#==-1){\n Span(Class: text-muted, Body: LangRes(crediting_removed))\n }.ElseIf(#status#==0){\n Span(Class: text-warning, Body: LangRes(crediting_waiting))\n }.ElseIf(#status#==1){\n Span(Class: text-success, Body: LangRes(crediting_auction))\n }.ElseIf(#status#==2){\n Span(Class: text-primary, Body: LangRes(crediting_signing))\n }.ElseIf(#status#==3){\n Span(Class: text-danger, Body: LangRes(crediting_rejected))\n }.ElseIf(#status#==4){\n Span(Class: text-normal, Body: LangRes(crediting_finished))\n }\n }.Custom(custom_view){\n Div(button-group text-nowrap){\n Button(Class: btn bg-gray-lighter ml-sm buttons, PageParams: \"Id=#id#\", Page: crediting_view){\n Em(Class: #style_link# fa fa-1x fa-info)\n Span(Class: #style_link# ml-sm, Body: $@1view$)\n }\n }.Style(\n .buttons{border: 1px solid #dde6e9;}\n )\n }.Custom(actions){\n Div(text-right button-group text-nowrap){\n If(And(#deleted#==0,#status#==0,#borrower_id#==#key_id#)){\n Button(Class: btn bg-gray-lighter buttons, Contract: CreditingDel, Params: \"Id=#id#\", Page: #this_page#){\n Em(Class: text-danger fa fa-1x fa-trash)\n }.Alert(Text: \"$@1sure_want_delete$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n Button(Class: btn bg-gray-lighter ml-sm buttons, PageParams: \"Id=#id#\", Page: crediting_add){\n Em(Class: text-default fa fa-1x fa-edit)\n }.Popup(60, $crediting_edit$)\n }\n If(And(#deleted#==0,#admin_access_id#>0)){\n Button(Class: btn btn-danger ml-sm buttons, Contract: CreditingBlock, Params: \"Id=#id#\", Page: #this_page#){\n Em(Class: fa fa-1x fa-unlock-alt)\n }.Alert(Text: \"$@1sure_want_delete$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }.Style(\n .buttons{border: 1px solid #dde6e9;}\n )\n }.Count(count)\n\n Div(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1id$=custom_id,$@1view$=custom_view,$crediting_borrower$=custom_borrower,$amount$=custom_amount,$crediting_term$=custom_term,$@1date_start$ / $@1date_end$=custom_date,$@1created$=custom_created,$@1status$=custom_status,=actions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$crediting$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n }\n Div(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n }\n}.Else{\n Div(row ml-lg mr-lg){\n Div(md-12 alert h4 text-bold text-center){\n Span(Body: LangRes(crediting_attention))\n }\n }\n}", + "Value": "SetVar(this_page, crediting_list).(this_table, crediting_requests)\nInclude(@1pager_header)\n\nSetTitle(\"$crediting$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$crediting_desc$\"))\n\nDBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Crediting\"}).Vars(application)\nSetVar(admin_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crediting_admin_role))\nSetVar(creditor_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crediting_creditor_role))\nSetVar(borrower_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crediting_borrower_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#admin_role#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#creditor_role#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(creditor_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#borrower_role#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(borrower_access)\n\nIf(#borrower_access_id# > 0){\n AddToolButton(Title: $@1add$, Page: crediting_add, Icon: icon-plus).Popup(60, $crediting_add$)\n}\n\nIf(#page_par# == 0){\n SetVar(type_filter, `, {\"status\": 0}`)\n}.ElseIf(#page_par# == 1){\n SetVar(type_filter, `, {\"status\": 1}`)\n}.ElseIf(#page_par# == 2){\n SetVar(type_filter, `, {\"status\": 2}`)\n}.ElseIf(#page_par# == 3){\n SetVar(type_filter, `, {\"status\": 3}`)\n}.ElseIf(#page_par# == 4){\n SetVar(type_filter, `, {\"status\": 4}`)\n}\n\nIf(#creditor_access_id# > 0){\n SetVar(global_access, 1)\n SetVar(role_where, `, {\"deleted\": 0}`)\n}.ElseIf(#borrower_access_id# > 0){\n SetVar(global_access, 1)\n SetVar(role_where, `, {\"borrower\": \"#account_id#\"}`)\n}.ElseIf(#admin_access_id# > 0){\n SetVar(global_access, 1)\n}\n\nIf(#global_access# == 1){\n If(#search#){\n SetVar(where, {\"$and\": [{\"borrower\": {\"$ilike\": \"#search#\"}} #role_where# #type_filter#]})\n }.Else{\n SetVar(where, {\"$and\": [#role_where# #type_filter#]})\n }\n\n Div(mr-lg text-right){\n If(#admin_access_id# > 0){\n Button(Body: Em(Class: fa fa-refresh) $@1update_statuses$, Class: btn bg-gray mr-lg, Page: #this_page#, Contract: CreditingStatusUpdate)\n }\n Button(Page: crediting_filter, Class: btn bg-gray-lighter mr-sm, PageParams: \"page_par=#page_par#,search=#search#,current_page=#current_page#\", Body: Em(Class: fa fa-filter) $@1filter$).Popup(Header: $@1filter$, Width: \"30\")\n If(#type_filter#){\n Button(Page: #this_page#, PageParams: \"page_par=NULL,search=#search#\", Class: btn bg-gray-lighter mr-sm, Body: Em(Class: fa fa-close))\n }\n }.Style(margin-top: -28px; z-index: 1001;)\n\n Div(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(crediting_borrower))\n Include(@1search)\n }\n\n DBFind(#this_table#, src).Where(#where#).Order({\"deleted\": 1, \"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(custom_id){\n If(#deleted# == 0){\n SetVar(Name: style_text, Value: \"text-normal\")\n SetVar(Name: style_link, Value: \"text-primary\")\n }.Else{\n SetVar(Name: style_text, Value: \"text-muted\")\n SetVar(Name: style_link, Value: \"text-muted\")\n }\n Span(Class: #style_text#, Body: #id#)\n }.Custom(custom_borrower){\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#borrower#\"}).Columns(\"member_info->information\").Vars(member)\n LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#member_account#\"){\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(){\n P(Class: h5 m0 text-bold, Body: #borrower#)\n P(Class: h6 m0, Body: #member_member_info_information#)\n }\n }.Style(display:flex; align-items:center;)\n }\n }.Custom(custom_amount){\n Span(Class: #style_text#, Body: Money(#amount#))\n }.Custom(custom_term){\n Span(Class: #style_text#, Body: #term#)\n }.Custom(custom_date){\n P(Class: #style_text# h6 m0, Body: DateTime(DateTime: #date_started#, Format: \"DD.MM.YYYY HH:MI\"))\n P(Class: #style_text# h6 m0, Body: DateTime(DateTime: #date_ended#, Format: \"DD.MM.YYYY HH:MI\"))\n }.Custom(custom_created){\n P(Class: #style_text# h6 m0, Body: DateTime(DateTime: #date_created#, Format: \"DD.MM.YYYY HH:MI\"))\n }.Custom(custom_status){\n If(#status#==-2){\n Span(Class: text-muted, Body: LangRes(crediting_blocked))\n }.ElseIf(#status# == -1){\n Span(Class: text-muted, Body: LangRes(crediting_removed))\n }.ElseIf(#status# == 0){\n Span(Class: text-warning, Body: LangRes(crediting_waiting))\n }.ElseIf(#status# == 1){\n Span(Class: text-success, Body: LangRes(crediting_auction))\n }.ElseIf(#status# == 2){\n Span(Class: text-primary, Body: LangRes(crediting_signing))\n }.ElseIf(#status# == 3){\n Span(Class: text-danger, Body: LangRes(crediting_rejected))\n }.ElseIf(#status# == 4){\n Span(Class: text-normal, Body: LangRes(crediting_finished))\n }\n }.Custom(custom_view){\n Div(button-group text-nowrap){\n Button(Class: btn bg-gray-lighter ml-sm buttons, PageParams: \"Id=#id#\", Page: crediting_view){\n Em(Class: #style_link# fa fa-1x fa-info)\n Span(Class: #style_link# ml-sm, Body: $@1view$)\n }\n }.Style(\n .buttons{border: 1px solid #dde6e9;}\n )\n }.Custom(actions){\n Div(text-right button-group text-nowrap){\n If(And(#deleted# == 0, #status# == 0, #borrower# == #account_id#)){\n Button(Class: btn bg-gray-lighter buttons, Contract: CreditingDel, Params: \"Id=#id#\", Page: #this_page#){\n Em(Class: text-danger fa fa-1x fa-trash)\n }.Alert(Text: \"$@1sure_want_delete$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n Button(Class: btn bg-gray-lighter ml-sm buttons, PageParams: \"Id=#id#\", Page: crediting_add){\n Em(Class: text-default fa fa-1x fa-edit)\n }.Popup(60, $crediting_edit$)\n }\n If(And(#deleted#==0,#admin_access_id#>0)){\n Button(Class: btn btn-danger ml-sm buttons, Contract: CreditingBlock, Params: \"Id=#id#\", Page: #this_page#){\n Em(Class: fa fa-1x fa-unlock-alt)\n }.Alert(Text: \"$@1sure_want_delete$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }.Style(\n .buttons{border: 1px solid #dde6e9;}\n )\n }.Count(count)\n\n Div(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1id$=custom_id,$@1view$=custom_view,$crediting_borrower$=custom_borrower,$amount$=custom_amount,$crediting_term$=custom_term,$@1date_start$ / $@1date_end$=custom_date,$@1created$=custom_created,$@1status$=custom_status,=actions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$crediting$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n }\n Div(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n }\n}.Else{\n Div(row ml-lg mr-lg){\n Div(md-12 alert h4 text-bold text-center){\n Span(Body: LangRes(crediting_attention))\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "crediting_settings", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Crediting\"}).Vars(\"app\")\nDBFind(\"@1roles\", src_roles).Where({\"ecosystem\": #ecosystem_id#, \"deleted\": 0}).Columns(\"role_name,id\").Limit(100)\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-4 text-right mt-sm\").(col_right,\"col-sm-8 text-left\")\n\nSetVar(this_page, \"crediting_settings\").(role_admin,0).(role_borrower,0).(role_creditor,0).(commission_wallet,0)\nSetVar(role_admin, AppParam(App: #app_id#, Name: \"crediting_admin_role\"))\nSetVar(role_borrower, AppParam(App: #app_id#, Name: \"crediting_borrower_role\"))\nSetVar(role_creditor, AppParam(App: #app_id#, Name: \"crediting_creditor_role\"))\nSetVar(commission_wallet, AppParam(App: #app_id#, Name: \"crediting_commission_wallet\"))\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(@1crediting_settings)\n }\n Div(text-center text-muted){\n LangRes(@1crediting_settings_description)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n \"Admin\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleAdmin, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_admin#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_admin# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #role_admin#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n \"Borrower\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleBorrower, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_borrower#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_borrower# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #role_borrower#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n \"Creditor\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleCreditor, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_creditor#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_creditor# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #role_creditor#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n \"Commission wallet\"\n }\n }\n Div(#col_right#){\n Input(Name: CommissionWallet, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\", Value: #commission_wallet#)\n Div(m0 h6 text-muted){\n LangRes(@1current_value): #commission_wallet#\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1apply_settings$, Class: btn btn-primary, Page: #this_page#, Contract: CreditingSettings)\n }\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Crediting\"}).Vars(app)\nDBFind(\"@1roles\", src_roles).Where({\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0}).Columns(\"role_name,id\").Limit(100)\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-4 text-right mt-sm\").(col_right,\"col-sm-8 text-left\")\n\nSetVar(this_page, \"crediting_settings\").(role_admin,0).(role_borrower,0).(role_creditor,0).(commission_wallet,0)\nSetVar(role_admin, AppParam(App: #app_id#, Name: \"crediting_admin_role\"))\nSetVar(role_borrower, AppParam(App: #app_id#, Name: \"crediting_borrower_role\"))\nSetVar(role_creditor, AppParam(App: #app_id#, Name: \"crediting_creditor_role\"))\nSetVar(commission_wallet, AppParam(App: #app_id#, Name: \"crediting_commission_wallet\"))\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(@1crediting_settings)\n }\n Div(text-center text-muted){\n LangRes(@1crediting_settings_description)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n \"Admin\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleAdmin, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_admin#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_admin# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#role_admin#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n \"Borrower\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleBorrower, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_borrower#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_borrower# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#role_borrower#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n \"Creditor\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleCreditor, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_creditor#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_creditor# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#role_creditor#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n \"Commission wallet\"\n }\n }\n Div(#col_right#){\n Input(Name: CommissionWallet, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\", Value: #commission_wallet#)\n Div(m0 h6 text-muted){\n LangRes(@1current_value): #commission_wallet#\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1apply_settings$, Class: btn btn-primary, Page: #this_page#, Contract: CreditingSettings)\n }\n }\n }\n }\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "crediting_view", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "DBFind(@1applications).Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Crediting\"}).Columns(\"name,id\").Vars(application)\nSetVar(creditor_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crediting_creditor_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": #ecosystem_id#, \"$and\": [\"role->id\": {\"$in\": [#creditor_role#]}, \"role->id\": #role_id#], \"member->member_id\": #key_id#, \"deleted\": 0}).Vars(creditor_access)\n\nIf(#notific_id#>0){\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"id\": #notific_id#}).Columns(\"page_params->crediting_id,page_params->optional\").Vars(notific)\n SetVar(Id, #notific_page_params_crediting_id#)\n SetVar(notific_optional, #notific_page_params_optional#)\n}\n\nIf(#Id#>0){\n DBFind(crediting_requests).Where({\"id\": #Id#}).Vars(request)\n SetVar(borrower_id, AddressToId(#request_borrower#))\n SetVar(creditor_id, AddressToId(#request_creditor#))\n}\n\nDiv(content-wrapper){\n If(#request_id# > 0){\n Div(row){\n Div(col-lg-10 col-lg-offset-1){\n Form(panel panel-primary){\n Div(list-group-item text-center){\n P(Class: h3 text-bold m0, Body: $crediting$)\n Div(row){\n Div(col-md-12){\n Div(Class: t5 text-muted m0, Body: #request_description#)\n }\n }\n }\n Div(list-group-item text-center){\n P(Class: h5 text-center text-bold m0 mb mt-sm, Body: $@1information$)\n Div(row mb mt-lg t6){\n Div(col-md-6 mt-sm text-right){\n LangRes(crediting_borrower)\n }\n Div(col-md-6 text-left){\n DBFind(@1members).Where({\"ecosystem\": #ecosystem_id#, \"id\": #borrower_id#}).Columns(\"member_info->information\").Vars(borrower)\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#borrower_id#\"){\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(){\n P(Class: h5 m0 text-bold, Body: #request_borrower#)\n P(Class: h6 m0, Body: #borrower_member_info_information#)\n }\n }.Style(display:flex; align-items:center;)\n }\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes($@1r_rating$)\n }\n Div(col-md-6 text-left){\n SetVar(rating_amount, 0)\n DBFind(@1r_ratings, r).Where({\"ecosystem\": #ecosystem_id#, \"member\": #request_borrower#}).Vars(rating)\n Span(#rating_amount#)\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes($@1amount$)\n }\n Div(col-md-6 text-left){\n Span(Body: Money(#request_amount#))\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes($crediting_term$)\n }\n Div(col-md-6 text-left){\n Span(Body: #request_term#)\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1date_start)\n }\n Div(col-md-6 text-left){\n DateTime(DateTime: #request_date_started#, Format: \"DD.MM.YYYY HH:MI\")\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1date_end)\n }\n Div(col-md-6 text-left){\n DateTime(DateTime: #request_date_ended#, Format: \"DD.MM.YYYY HH:MI\")\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1created)\n }\n Div(col-md-6 text-left){\n DateTime(DateTime: #request_date_created#, Format: \"DD.MM.YYYY HH:MI\")\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1status)\n }\n Div(col-md-6 text-left){\n If(#request_status#==-2){\n Span(Class: text-muted, Body: LangRes(crediting_blocked))\n }.ElseIf(#request_status#==-1){\n Span(Class: text-muted, Body: LangRes(crediting_removed))\n }.ElseIf(#request_status#==0){\n Span(Class: text-warning, Body: LangRes(crediting_waiting))\n }.ElseIf(#request_status#==1){\n Span(Class: text-success, Body: LangRes(crediting_auction))\n }.ElseIf(#request_status#==2){\n Span(Class: text-primary, Body: LangRes(crediting_signing))\n }.ElseIf(#request_status#==3){\n Span(Class: text-danger, Body: LangRes(crediting_rejected))\n }.ElseIf(#request_status#==4){\n Span(Class: text-normal, Body: LangRes(crediting_finished))\n }\n }\n }\n }\n If(#request_status# == 1){\n DBFind(crediting_offers, offers).Where({\"request_id\": #Id#}).Order({\"rate\": 1, \"date_created\": 1}).Custom(custom_creditor){\n SetVar(creditor_id, AddressToId(#creditor#))\n DBFind(@1members).Where({\"ecosystem\": #ecosystem_id#, \"id\": #creditor_id#}).Columns(\"member_info->information\").Vars(c)\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#c_id#\"){\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(){\n P(Class: h5 m0 text-bold, Body: #creditor#)\n P(Class: h6 m0, Body: #c_member_info_information#)\n }\n }.Style(display:flex; align-items:center;)\n }\n }.Custom(custom_date){\n Span(Class: h6 text-muted, Body: DateTime(DateTime: #date_created#, Format: \"DD.MM.YYYY HH:MI\"))\n }.Custom(custom_rate){\n Span(Class: pull-right, Body: $crediting_rate$ - Strong(#rate# %))\n }.Count(cnt)\n\n If(Or(#creditor_access_id#>0,#cnt#>0)){\n Div(list-group-item){\n P(Class: h5 text-center text-bold m0 mb mt-sm, Body: $crediting_bid_list$)\n If(#creditor_access_id# > 0){\n Div(row mt-lg){\n Div(col-lg-8 col-lg-offset-2){\n Div(input-group){\n Div(input-group-addon){\n $crediting_rate$\n }\n Input(Name: Rate, Type: number)\n Div(input-group-btn){\n Button(Class: btn btn-primary mtl buttons, Page: crediting_view, PageParams: \"Id=#Id#\", Body: Em(Class: fa fa-search) $crediting_bid$, Contract: CreditingBid, Params: \"RequestId=#Id#\")\n }\n }\n }.Style(\n .buttons{border: 1px solid #dde6e9;}\n )\n }\n }\n Div(row mt){\n Div(col-lg-8 col-lg-offset-2){\n Table(offers, \"$crediting_creditor$=custom_creditor,$crediting_bid_date$=custom_date,=custom_rate\")\n }\n }\n }\n }\n }\n If(Or(#request_status#==2,#request_status#==4)){\n If(Or(And(#creditor_id#==#key_id#,#request_sign_borrower#>0,#request_sign_creditor#==0),And(#borrower_id#==#key_id#,#request_sign_borrower#==0,#request_sign_creditor#==0))){\n SetVar(hh, 210)\n }.Else{\n SetVar(hh, 160) \n }\n Div(list-group-item){\n P(Class: h5 text-center text-bold m0 mb mt-sm, Body: $crediting_offer$)\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes($crediting_rate$)\n }\n Div(col-md-6 text-left){\n Span(Body: #request_rate# % )\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(crediting_offer_date)\n }\n Div(col-md-6 text-left){\n DateTime(DateTime: #request_offer_date#, Format: \"DD.MM.YYYY HH:MI\")\n }\n }\n Div(row t6){\n Div(col-md-12 text-center){\n Button(Class: btn btn-link, Page: crediting_history, PageParams: \"Id=#Id#\"){\n Div(Class: h5 m0, Body: LangRes(crediting_bid_list))\n }.Popup(Header: $crediting_bid_list$, Width: 50)\n }\n }\n Div(row){\n Div(col-md-6){\n P(Class: h5 text-center text-bold m0 mb mt-sm, Body: $crediting_borrower$)\n Div(list-group-item text-center mb-lg ml-lg){\n Div(row mb mt-sm t6){\n Div(col-sm-8 col-sm-offset-4 text-left){\n DBFind(@1members).Where({\"ecosystem\": #ecosystem_id#, \"id\": #borrower_id#}).Columns(\"member_info->information\").Vars(borrower)\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#borrower_id#\"){\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(){\n P(Class: h5 m0 text-bold, Body: #request_borrower#)\n P(Class: h6 m0, Body: #borrower_member_info_information#)\n }\n }.Style(display:flex; align-items:center;)\n }\n \n }\n }\n Div(row t6 mt-lg){\n Div(col-md-12 text-center){\n Div(Class: text-bold, Body: LangRes(crediting_signature))\n If(#request_pub_borrower# != \"\"){\n Div(Class: preview, Body: #request_pub_borrower#)\n }.Else{\n Div(Class: preview, Body: LangRes(crediting_waiting))\n }\n }\n }\n Div(row t6 mt){\n Div(col-md-12 text-center){\n Div(Class: text-bold, Body: LangRes(@1signed_at))\n If(#request_sign_borrower# != 0){\n Div(Body: DateTime(DateTime: #request_sign_borrower#, Format: \"DD.MM.YYYY HH:MI\")) \n }.Else{\n Div(Class: preview, Body: LangRes(crediting_waiting))\n }\n }\n }\n If(#request_status#==2){\n If(And(#borrower_id#==#key_id#,#request_sign_borrower#==0,#request_sign_creditor#==0)){\n Div(row mt-lg){\n Div(col-sm-12){\n Button(Body: LangRes(@1reject), Class: btn btn-danger pull-left, Contract: CreditingSignReject, Params: \"Id=#Id#\", Page: crediting_view, PageParams: \"Id=#Id#\")\n Button(Body: LangRes(@1accept), Class: btn btn-success pull-right, Contract: CreditingSignAccept, Params: \"Id=#Id#\", Page: crediting_view, PageParams: \"Id=#Id#\")\n }\n }\n }\n }\n }.Style(\n height: #hh#px;\n )\n }\n Div(col-md-6){\n P(Class: h5 text-center text-bold m0 mb mt-sm, Body: $crediting_creditor$)\n Div(list-group-item text-center mb-lg ml-lg){\n Div(row mb mt-sm t6){\n Div(col-sm-8 col-sm-offset-4 text-left){\n DBFind(@1members).Where({\"ecosystem\": #ecosystem_id#, \"id\": #creditor_id#}).Columns(\"member_info->information\").Vars(creditor)\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#creditor_id#\"){\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(){\n P(Class: h5 m0 text-bold, Body: #request_creditor#)\n P(Class: h6 m0, Body: #creditor_member_info_information#)\n }\n }.Style(display:flex; align-items:center;)\n }\n }\n }\n Div(row t6 mt-lg){\n Div(col-md-12 text-center){\n Div(Class: text-bold, Body: LangRes(crediting_signature))\n If(#request_pub_creditor# != \"\"){\n Div(Class: preview, Body: #request_pub_creditor#)\n }.Else{\n Div(Class: preview, Body: LangRes(crediting_waiting))\n }\n }\n }\n Div(row t6 mt){\n Div(col-md-12 text-center){\n Div(Class: text-bold, Body: LangRes(@1signed_at))\n If(#request_sign_creditor# != 0){\n Div(Body: DateTime(DateTime: #request_sign_creditor#, Format: \"DD.MM.YYYY HH:MI\"))\n }.Else{\n Div(Class: preview, Body: LangRes(crediting_waiting))\n }\n }\n }\n If(#request_status#==2){\n If(And(#creditor_id#==#key_id#,#request_sign_borrower#>0,#request_sign_creditor#==0)){\n Div(row mt-lg){\n Div(col-sm-12){\n Button(Body: LangRes(@1reject), Class: btn btn-danger pull-left, Contract: CreditingSignReject, Params: \"Id=#Id#\", Page: crediting_view, PageParams: \"Id=#Id#\")\n Button(Body: LangRes(@1accept), Class: btn btn-success pull-right, Contract: CreditingSignAccept, Params: \"Id=#Id#\", Page: crediting_view, PageParams: \"Id=#Id#\")\n }\n }\n }\n }\n }.Style(\n height: #hh#px;\n )\n }\n }\n }\n }\n Div(list-group-item){\n Button(Class: btn bg-gray-lighter ml-sm buttons, Page: crediting_list){\n Span(Em(Class: fa fa-chevron-left fa-1x)\n Span(Class: ml-sm, Body: LangRes(@1back))\n }\n If(#notific_optional# == 1){\n Button(Class: btn bg-gray-lighter ml-sm buttons pull-right, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\", Page: crediting_view, PageParams: \"Id=#Id#\"){\n Span(Em(Class: fa fa-flag fa-1x)\n Span(Class: ml-sm, Body: LangRes(@1mark_read))\n }\n }\n If(#creditor_access_id# > 0){\n SetVar(current_address, Address(#key_id#))\n DBFind(\"crediting_subs\", fsdf).Where({\"request_id\": #Id#, \"creditor\": #current_address#, \"deleted\": 0}).Vars(sub)\n If(#sub_id#>0){\n Button(Class: btn bg-gray-lighter ml-sm buttons pull-right, Page: crediting_view, PageParams: \"Id=#Id#\", Contract: CreditingSubscribe, Params: \"Id=#Id#\"){\n Span(Em(Class: fa fa-close fa-1x)\n Span(Class: ml-sm, Body: LangRes(crediting_unsubscribe))\n }\n }.Else{\n Button(Class: btn bg-gray-lighter ml-sm buttons pull-right, Page: crediting_view, PageParams: \"Id=#Id#\", Contract: CreditingSubscribe, Params: \"Id=#Id#\"){\n Span(Em(Class: fa fa-check fa-1x)\n Span(Class: ml-sm, Body: LangRes(crediting_subscribe))\n }\n }\n } \n }\n }.Style(\n .buttons{border: 1px solid #dde6e9;}\n )\n }\n }\n }.Else{\n Div(col-md-12 alert alert-danger text-center){\n LangRes(@1attention)\n }\n }\n}.Style(\n .preview {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n .t3 {font-size:24px;}\n .t4 {font-size:18px;}\n .t5 {font-size:14px;}\n .t6 {font-size:12px;}\n .break {word-break: break-all;}\n)", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Crediting\"}).Columns(\"name,id\").Vars(application)\nSetVar(creditor_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crediting_creditor_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#creditor_role#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(creditor_access)\n\nIf(#notific_id#>0){\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#notific_id#\"}).Columns(\"page_params->crediting_id,page_params->optional\").Vars(notific)\n SetVar(Id, #notific_page_params_crediting_id#)\n SetVar(notific_optional, #notific_page_params_optional#)\n}\n\nIf(#Id#>0){\n DBFind(\"crediting_requests\").Where({\"id\": \"#Id#\"}).Vars(request)\n SetVar(borrower_account, #request_borrower#)\n SetVar(creditor_account, #request_creditor#)\n}\n\nDiv(content-wrapper){\n If(#request_id# > 0){\n Div(row){\n Div(col-lg-10 col-lg-offset-1){\n Form(panel panel-primary){\n Div(list-group-item text-center){\n P(Class: h3 text-bold m0, Body: $crediting$)\n Div(row){\n Div(col-md-12){\n Div(Class: t5 text-muted m0, Body: #request_description#)\n }\n }\n }\n Div(list-group-item text-center){\n P(Class: h5 text-center text-bold m0 mb mt-sm, Body: $@1information$)\n Div(row mb mt-lg t6){\n Div(col-md-6 mt-sm text-right){\n LangRes(crediting_borrower)\n }\n Div(col-md-6 text-left){\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#borrower_account#\"}).Columns(\"member_info->information\").Vars(borrower)\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#borrower_account#\"){\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right: 10px;)\n Span(){\n P(Class: h5 m0 text-bold, Body: #request_borrower#)\n P(Class: h6 m0, Body: #borrower_member_info_information#)\n }\n }.Style(display:flex; align-items:center;)\n }\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes($@1r_rating$)\n }\n Div(col-md-6 text-left){\n SetVar(rating_amount, 0)\n DBFind(\"@1r_ratings\", r).Where({\"ecosystem\": \"#ecosystem_id#\", \"member\": \"#request_borrower#\"}).Vars(rating)\n Span(#rating_amount#)\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes($@1amount$)\n }\n Div(col-md-6 text-left){\n Span(Body: Money(#request_amount#))\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes($crediting_term$)\n }\n Div(col-md-6 text-left){\n Span(Body: #request_term#)\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1date_start)\n }\n Div(col-md-6 text-left){\n DateTime(DateTime: #request_date_started#, Format: \"DD.MM.YYYY HH:MI\")\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1date_end)\n }\n Div(col-md-6 text-left){\n DateTime(DateTime: #request_date_ended#, Format: \"DD.MM.YYYY HH:MI\")\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1created)\n }\n Div(col-md-6 text-left){\n DateTime(DateTime: #request_date_created#, Format: \"DD.MM.YYYY HH:MI\")\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(@1status)\n }\n Div(col-md-6 text-left){\n If(#request_status#==-2){\n Span(Class: text-muted, Body: LangRes(crediting_blocked))\n }.ElseIf(#request_status#==-1){\n Span(Class: text-muted, Body: LangRes(crediting_removed))\n }.ElseIf(#request_status#==0){\n Span(Class: text-warning, Body: LangRes(crediting_waiting))\n }.ElseIf(#request_status#==1){\n Span(Class: text-success, Body: LangRes(crediting_auction))\n }.ElseIf(#request_status#==2){\n Span(Class: text-primary, Body: LangRes(crediting_signing))\n }.ElseIf(#request_status#==3){\n Span(Class: text-danger, Body: LangRes(crediting_rejected))\n }.ElseIf(#request_status#==4){\n Span(Class: text-normal, Body: LangRes(crediting_finished))\n }\n }\n }\n }\n If(#request_status# == 1){\n DBFind(\"crediting_offers\", offers).Where({\"request_id\": \"#Id#\"}).Order({\"rate\": 1, \"date_created\": 1}).Custom(custom_creditor){\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#creditor#\"}).Columns(\"member_info->information\").Vars(c)\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#c_account#\"){\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right: 10px;)\n Span(){\n P(Class: h5 m0 text-bold, Body: #creditor#)\n P(Class: h6 m0, Body: #c_member_info_information#)\n }\n }.Style(display:flex; align-items:center;)\n }\n }.Custom(custom_date){\n Span(Class: h6 text-muted, Body: DateTime(DateTime: #date_created#, Format: \"DD.MM.YYYY HH:MI\"))\n }.Custom(custom_rate){\n Span(Class: pull-right, Body: $crediting_rate$ - Strong(#rate# %))\n }.Count(cnt)\n\n If(Or(#creditor_access_id#>0,#cnt#>0)){\n Div(list-group-item){\n P(Class: h5 text-center text-bold m0 mb mt-sm, Body: $crediting_bid_list$)\n If(#creditor_access_id# > 0){\n Div(row mt-lg){\n Div(col-lg-8 col-lg-offset-2){\n Div(input-group){\n Div(input-group-addon){\n $crediting_rate$\n }\n Input(Name: Rate, Type: number)\n Div(input-group-btn){\n Button(Class: btn btn-primary mtl buttons, Page: crediting_view, PageParams: \"Id=#Id#\", Body: Em(Class: fa fa-search) $crediting_bid$, Contract: CreditingBid, Params: \"RequestId=#Id#\")\n }\n }\n }.Style(\n .buttons{border: 1px solid #dde6e9;}\n )\n }\n }\n Div(row mt){\n Div(col-lg-8 col-lg-offset-2){\n Table(offers, \"$crediting_creditor$=custom_creditor,$crediting_bid_date$=custom_date,=custom_rate\")\n }\n }\n }\n }\n }\n If(Or(#request_status#==2,#request_status#==4)){\n If(Or(And(#creditor_account#==#account_id#,#request_sign_borrower#>0,#request_sign_creditor#==0),And(#borrower_account#==#account_id#,#request_sign_borrower#==0,#request_sign_creditor#==0))){\n SetVar(hh, 210)\n }.Else{\n SetVar(hh, 160) \n }\n Div(list-group-item){\n P(Class: h5 text-center text-bold m0 mb mt-sm, Body: $crediting_offer$)\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes($crediting_rate$)\n }\n Div(col-md-6 text-left){\n Span(Body: #request_rate# % )\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n LangRes(crediting_offer_date)\n }\n Div(col-md-6 text-left){\n DateTime(DateTime: #request_offer_date#, Format: \"DD.MM.YYYY HH:MI\")\n }\n }\n Div(row t6){\n Div(col-md-12 text-center){\n Button(Class: btn btn-link, Page: crediting_history, PageParams: \"Id=#Id#\"){\n Div(Class: h5 m0, Body: LangRes(crediting_bid_list))\n }.Popup(Header: $crediting_bid_list$, Width: 50)\n }\n }\n Div(row){\n Div(col-md-6){\n P(Class: h5 text-center text-bold m0 mb mt-sm, Body: $crediting_borrower$)\n Div(list-group-item text-center mb-lg ml-lg){\n Div(row mb mt-sm t6){\n Div(col-sm-8 col-sm-offset-4 text-left){\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#borrower_account#\"}).Columns(\"member_info->information\").Vars(borrower)\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#borrower_account#\"){\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right: 10px;)\n Span(){\n P(Class: h5 m0 text-bold, Body: #request_borrower#)\n P(Class: h6 m0, Body: #borrower_member_info_information#)\n }\n }.Style(display:flex; align-items:center;)\n }\n \n }\n }\n Div(row t6 mt-lg){\n Div(col-md-12 text-center){\n Div(Class: text-bold, Body: LangRes(crediting_signature))\n If(#request_pub_borrower# != \"\"){\n Div(Class: preview, Body: #request_pub_borrower#)\n }.Else{\n Div(Class: preview, Body: LangRes(crediting_waiting))\n }\n }\n }\n Div(row t6 mt){\n Div(col-md-12 text-center){\n Div(Class: text-bold, Body: LangRes(@1signed_at))\n If(#request_sign_borrower# != 0){\n Div(Body: DateTime(DateTime: #request_sign_borrower#, Format: \"DD.MM.YYYY HH:MI\")) \n }.Else{\n Div(Class: preview, Body: LangRes(crediting_waiting))\n }\n }\n }\n If(#request_status#==2){\n If(And(#borrower_account#==#account_id#,#request_sign_borrower#==0,#request_sign_creditor#==0)){\n Div(row mt-lg){\n Div(col-sm-12){\n Button(Body: LangRes(@1reject), Class: btn btn-danger pull-left, Contract: CreditingSignReject, Params: \"Id=#Id#\", Page: crediting_view, PageParams: \"Id=#Id#\")\n Button(Body: LangRes(@1accept), Class: btn btn-success pull-right, Contract: CreditingSignAccept, Params: \"Id=#Id#\", Page: crediting_view, PageParams: \"Id=#Id#\")\n }\n }\n }\n }\n }.Style(\n height: #hh#px;\n )\n }\n Div(col-md-6){\n P(Class: h5 text-center text-bold m0 mb mt-sm, Body: $crediting_creditor$)\n Div(list-group-item text-center mb-lg ml-lg){\n Div(row mb mt-sm t6){\n Div(col-sm-8 col-sm-offset-4 text-left){\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#creditor_account#\"}).Columns(\"member_info->information\").Vars(creditor)\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#creditor_account#\"){\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right: 10px;)\n Span(){\n P(Class: h5 m0 text-bold, Body: #request_creditor#)\n P(Class: h6 m0, Body: #creditor_member_info_information#)\n }\n }.Style(display:flex; align-items:center;)\n }\n }\n }\n Div(row t6 mt-lg){\n Div(col-md-12 text-center){\n Div(Class: text-bold, Body: LangRes(crediting_signature))\n If(#request_pub_creditor# != \"\"){\n Div(Class: preview, Body: #request_pub_creditor#)\n }.Else{\n Div(Class: preview, Body: LangRes(crediting_waiting))\n }\n }\n }\n Div(row t6 mt){\n Div(col-md-12 text-center){\n Div(Class: text-bold, Body: LangRes(@1signed_at))\n If(#request_sign_creditor# != 0){\n Div(Body: DateTime(DateTime: #request_sign_creditor#, Format: \"DD.MM.YYYY HH:MI\"))\n }.Else{\n Div(Class: preview, Body: LangRes(crediting_waiting))\n }\n }\n }\n If(#request_status#==2){\n If(And(#creditor_account#==#account_id#,#request_sign_borrower#>0,#request_sign_creditor#==0)){\n Div(row mt-lg){\n Div(col-sm-12){\n Button(Body: LangRes(@1reject), Class: btn btn-danger pull-left, Contract: CreditingSignReject, Params: \"Id=#Id#\", Page: crediting_view, PageParams: \"Id=#Id#\")\n Button(Body: LangRes(@1accept), Class: btn btn-success pull-right, Contract: CreditingSignAccept, Params: \"Id=#Id#\", Page: crediting_view, PageParams: \"Id=#Id#\")\n }\n }\n }\n }\n }.Style(\n height: #hh#px;\n )\n }\n }\n }\n }\n Div(list-group-item){\n Button(Class: btn bg-gray-lighter ml-sm buttons, Page: crediting_list){\n Span(Em(Class: fa fa-chevron-left fa-1x)\n Span(Class: ml-sm, Body: LangRes(@1back))\n }\n If(#notific_optional# == 1){\n Button(Class: btn bg-gray-lighter ml-sm buttons pull-right, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\", Page: crediting_view, PageParams: \"Id=#Id#\"){\n Span(Em(Class: fa fa-flag fa-1x)\n Span(Class: ml-sm, Body: LangRes(@1mark_read))\n }\n }\n If(#creditor_access_id# > 0){\n DBFind(\"crediting_subs\").Where({\"request_id\": \"#Id#\", \"creditor\": \"#account_id#\", \"deleted\": 0}).Vars(sub)\n If(#sub_id#>0){\n Button(Class: btn bg-gray-lighter ml-sm buttons pull-right, Page: crediting_view, PageParams: \"Id=#Id#\", Contract: CreditingSubscribe, Params: \"Id=#Id#\"){\n Span(Em(Class: fa fa-close fa-1x)\n Span(Class: ml-sm, Body: LangRes(crediting_unsubscribe))\n }\n }.Else{\n Button(Class: btn bg-gray-lighter ml-sm buttons pull-right, Page: crediting_view, PageParams: \"Id=#Id#\", Contract: CreditingSubscribe, Params: \"Id=#Id#\"){\n Span(Em(Class: fa fa-check fa-1x)\n Span(Class: ml-sm, Body: LangRes(crediting_subscribe))\n }\n }\n } \n }\n }.Style(\n .buttons{border: 1px solid #dde6e9;}\n )\n }\n }\n }.Else{\n Div(col-md-12 alert alert-danger text-center){\n LangRes(@1attention)\n }\n }\n}.Style(\n .preview {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n .t3 {font-size:24px;}\n .t4 {font-size:18px;}\n .t5 {font-size:14px;}\n .t6 {font-size:12px;}\n .break {word-break: break-all;}\n)", "Menu": "default_menu", "Type": "pages" }, { "Name": "CreditingAdd", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "contract CreditingAdd {\n data {\n Id int \"optional\"\n Amount money\n Term string\n StartDate string\n StartTime string\n EndDate string\n EndTime string\n Description string \"optional\"\n }\n\n func trimZeroTime(s string) string {\n if Contains(s, \"T00:00:00Z\") {\n s = Replace(s, \"T00:00:00Z\", \"\")\n }\n return s\n }\n\n func dateAddTime(d, t string) string {\n var dt string\n if Size(t) == 5 {\n dt = Sprintf(\"%v %v:00\", trimZeroTime(d), t)\n }\n return dt\n }\n\n func fixDatetimes() {\n $date_started = UnixDateTime(dateAddTime($StartDate, $StartTime))\n $date_ended = UnixDateTime(dateAddTime($EndDate, $EndTime))\n\n if $date_started == 0 || $date_ended == 0 { // invalid datetimes\n var errs array\n if Size($StartDate) < 10 {\n errs = Append(errs, \"starting date\")\n }\n if Size($StartTime) < 5 {\n errs = Append(errs, \"starting time\")\n }\n if Size($EndDate) < 10 {\n errs = Append(errs, \"ending date\")\n }\n if Size($EndTime) < 5 {\n errs = Append(errs, \"ending time\")\n }\n warning Sprintf(LangRes(\"crediting_creation_error\", \"en\"), Join(errs, \", \"))\n }\n if $date_started < $block_time {\n warning LangRes(\"@1starting_date_invalid\", \"en\")\n }\n if $date_started >= $date_ended {\n warning LangRes(\"@1ending_date_invalid\", \"en\")\n }\n }\n\n conditions {\n // check_access\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Crediting\"}).One(\"id\")\n $check_access = AppParam(Int($app), \"crediting_borrower_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+$check_access+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n var request map borrower string status int\n request = DBFind(\"crediting_requests\").Where({\"id\": $Id}).Row()\n borrower = request[\"borrower\"]\n status = Int(request[\"status\"])\n\n //check status\n if status != 0 {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n //check borrower\n if Int($Id) > 0 {\n if AddressToId(borrower) != $key_id {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n\n //check amount\n if $Amount == 0 {\n warning LangRes(\"@1amount_zero\", \"en\")\n }\n if $Amount < 0 {\n warning LangRes(\"@1amount_less_zero\", \"en\")\n }\n\n //check date\n fixDatetimes()\n }\n\n action {\n var m map\n if Int($Id) == 0 {\n m[\"borrower\"] = IdToAddress($key_id)\n m[\"status\"] = 0\n m[\"deleted\"] = 0\n m[\"date_created\"] = $block_time \n }\n\n m[\"amount\"] = $Amount\n m[\"term\"] = $Term\n m[\"date_started\"] = $date_started\n m[\"date_ended\"] = $date_ended\n m[\"description\"] = $Description\n\n if Int($Id) == 0 {\n DBInsert(\"crediting_requests\", m)\n } else {\n DBUpdate(\"crediting_requests\", Int($Id), m)\n }\n }\n}", + "Value": "contract CreditingAdd {\n data {\n Id int \"optional\"\n Amount money\n Term string\n StartDate string\n StartTime string\n EndDate string\n EndTime string\n Description string \"optional\"\n }\n\n func trimZeroTime(s string) string {\n if Contains(s, \"T00:00:00Z\") {\n s = Replace(s, \"T00:00:00Z\", \"\")\n }\n return s\n }\n\n func dateAddTime(d, t string) string {\n var dt string\n if Size(t) == 5 {\n dt = Sprintf(\"%v %v:00\", trimZeroTime(d), t)\n }\n return dt\n }\n\n func fixDatetimes() {\n $date_started = UnixDateTime(dateAddTime($StartDate, $StartTime))\n $date_ended = UnixDateTime(dateAddTime($EndDate, $EndTime))\n\n if $date_started == 0 || $date_ended == 0 { // invalid datetimes\n var errs array\n if Size($StartDate) < 10 {\n errs = Append(errs, \"starting date\")\n }\n if Size($StartTime) < 5 {\n errs = Append(errs, \"starting time\")\n }\n if Size($EndDate) < 10 {\n errs = Append(errs, \"ending date\")\n }\n if Size($EndTime) < 5 {\n errs = Append(errs, \"ending time\")\n }\n warning Sprintf(LangRes(\"crediting_creation_error\", \"en\"), Join(errs, \", \"))\n }\n if $date_started < $block_time {\n warning LangRes(\"@1starting_date_invalid\", \"en\")\n }\n if $date_started >= $date_ended {\n warning LangRes(\"@1ending_date_invalid\", \"en\")\n }\n }\n\n conditions {\n // check_access\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Crediting\"}).One(\"id\")\n $check_access = AppParam(Int($app), \"crediting_borrower_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+$check_access+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n var request map borrower string status int\n request = DBFind(\"crediting_requests\").Where({\"id\": $Id}).Row()\n borrower = request[\"borrower\"]\n status = Int(request[\"status\"])\n\n //check status\n if status != 0 {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n //check borrower\n if Int($Id) > 0 {\n if borrower != $account_id {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n\n //check amount\n if $Amount == 0 {\n warning LangRes(\"@1amount_zero\", \"en\")\n }\n if $Amount < 0 {\n warning LangRes(\"@1amount_less_zero\", \"en\")\n }\n\n //check date\n fixDatetimes()\n }\n\n action {\n var m map\n if Int($Id) == 0 {\n m[\"borrower\"] = $account_id\n m[\"status\"] = 0\n m[\"deleted\"] = 0\n m[\"date_created\"] = $block_time \n }\n\n m[\"amount\"] = $Amount\n m[\"term\"] = $Term\n m[\"date_started\"] = $date_started\n m[\"date_ended\"] = $date_ended\n m[\"description\"] = $Description\n\n if Int($Id) == 0 {\n DBInsert(\"crediting_requests\", m)\n } else {\n DBUpdate(\"crediting_requests\", Int($Id), m)\n }\n }\n}", "Type": "contracts" }, { "Name": "CreditingBid", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "contract CreditingBid {\n data {\n RequestId int\n Rate int\n }\n\n func closeMyNotes() {\n var notes array i int\n notes = DBFind(\"@1notifications\").Where({\"closed\": 0, \"ecosystem\": $ecosystem_id, \"recipient->member_id\": $key_id, \"page_name\": \"crediting_view\", \"page_params->crediting_id\": $RequestId})\n while i < Len(notes){\n var note map\n note = notes[i]\n @1NotificationsClose(\"NotificId\", Int(note[\"id\"]))\n i = i + 1\n }\n }\n\n func sendNotesNewBid() {\n var i int subs_arr array\n $KeyId = IdToAddress($key_id)\n subs_arr = DBFind(\"crediting_subs\").Columns(\"creditor\").Limit(10000).Where({\"creditor\": {\"$neq\": $KeyId}, \"request_id\": $RequestId, \"deleted\": 0})\n while i < Len(subs_arr) {\n var sub_map memberId int\n sub_map = subs_arr[i]\n memberId = AddressToId(sub_map[\"creditor\"])\n\n var header body string params map \n header = \"New bid on auction №\" + Str($RequestId)\n body = \"Check auction for information\"\n params[\"crediting_id\"] = $RequestId\n params[\"optional\"] = 1\n @1NotificationsSend(\"MemberId,Sender,Icon,Header,Body,Page,Params\", memberId, 1, \"fa-fire\", header, body, \"crediting_view\", params)\n i = i + 1\n }\n }\n\n conditions {\n // check_access\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Crediting\"}).One(\"id\")\n $check_access = AppParam(Int($app), \"crediting_creditor_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+$check_access+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n var request map status int\n request = DBFind(\"crediting_requests\").Where({\"id\": $RequestId}).Row()\n status = Int(request[\"status\"])\n\n //check status\n if status != 1 {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n\n action {\n closeMyNotes()\n sendNotesNewBid()\n\n var m map\n m[\"creditor\"] = IdToAddress($key_id)\n m[\"date_created\"] = $block_time \n m[\"rate\"] = $Rate\n m[\"request_id\"] = $RequestId\n DBInsert(\"crediting_offers\", m)\n }\n}", + "Value": "contract CreditingBid {\n data {\n RequestId int\n Rate int\n }\n\n func closeMyNotes() {\n var notes array i int\n notes = DBFind(\"@1notifications\").Where({\"closed\": 0, \"ecosystem\": $ecosystem_id, \"recipient->account\": $account_id, \"page_name\": \"crediting_view\", \"page_params->crediting_id\": $RequestId})\n while i < Len(notes){\n var note map\n note = notes[i]\n @1NotificationsClose(\"NotificId\", Int(note[\"id\"]))\n i = i + 1\n }\n }\n\n func sendNotesNewBid() {\n var i int subs_arr array\n subs_arr = DBFind(\"crediting_subs\").Where({\"creditor\": {\"$neq\": $account_id}, \"request_id\": $RequestId, \"deleted\": 0}).Columns(\"creditor\").Limit(10000)\n while i < Len(subs_arr) {\n var sub_map int memberAccount string\n sub_map = subs_arr[i]\n memberAccount = sub_map[\"creditor\"]\n\n var header body string params map \n header = \"New bid on auction №\" + Str($RequestId)\n body = \"Check auction for information\"\n params[\"crediting_id\"] = $RequestId\n params[\"optional\"] = 1\n @1NotificationsSend(\"MemberAccount,Sender,Icon,Header,Body,Page,Params\", memberAccount, 1, \"fa-fire\", header, body, \"crediting_view\", params)\n i = i + 1\n }\n }\n\n conditions {\n // check_access\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Crediting\"}).One(\"id\")\n $check_access = AppParam(Int($app), \"crediting_creditor_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+$check_access+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n var request map status int\n request = DBFind(\"crediting_requests\").Where({\"id\": $RequestId}).Row()\n status = Int(request[\"status\"])\n\n //check status\n if status != 1 {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n\n action {\n closeMyNotes()\n sendNotesNewBid()\n\n var m map\n m[\"creditor\"] = $account_id\n m[\"date_created\"] = $block_time \n m[\"rate\"] = $Rate\n m[\"request_id\"] = $RequestId\n DBInsert(\"crediting_offers\", m)\n }\n}", "Type": "contracts" }, { "Name": "CreditingBlock", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "contract CreditingBlock {\n data {\n Id int\n }\n\n conditions {\n // check_access\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Crediting\"}).One(\"id\")\n $check_access = AppParam(Int($app), \"crediting_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+$check_access+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n\n action {\n var m map\n\t\tm[\"status\"] = -2\n\t\tm[\"deleted\"] = $block_time \n DBUpdate(\"crediting_requests\", Int($Id), m)\n }\n}", + "Value": "contract CreditingBlock {\n data {\n Id int\n }\n\n conditions {\n // check_access\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Crediting\"}).One(\"id\")\n $check_access = AppParam(Int($app), \"crediting_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+$check_access+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n\n action {\n var m map\n\t\tm[\"status\"] = -2\n\t\tm[\"deleted\"] = $block_time \n DBUpdate(\"crediting_requests\", Int($Id), m)\n }\n}", "Type": "contracts" }, { "Name": "CreditingDel", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "contract CreditingDel {\n data {\n Id int\n }\n\n conditions {\n var request map borrower string status int\n request = DBFind(\"crediting_requests\").Where({\"id\": $Id}).Row()\n borrower = request[\"borrower\"]\n status = Int(request[\"status\"])\n\n //check status\n if status != 0 {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n //check borrower\n if AddressToId(borrower) != $key_id {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n\n action {\n var m map\n\t\tm[\"status\"] = -1\n\t\tm[\"deleted\"] = $block_time \n DBUpdate(\"crediting_requests\", Int($Id), m)\n }\n}", + "Value": "contract CreditingDel {\n data {\n Id int\n }\n\n conditions {\n var request map borrower string status int\n request = DBFind(\"crediting_requests\").Where({\"id\": $Id}).Row()\n borrower = request[\"borrower\"]\n status = Int(request[\"status\"])\n\n //check status\n if status != 0 {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n //check borrower\n if borrower != $account_id {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n\n action {\n var m map\n\t\tm[\"status\"] = -1\n\t\tm[\"deleted\"] = $block_time \n DBUpdate(\"crediting_requests\", Int($Id), m)\n }\n}", "Type": "contracts" }, { @@ -283,25 +283,25 @@ { "Name": "CreditingSignAccept", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "contract CreditingSignAccept {\n data {\n Id int\n }\n\n func closeMyNotes() {\n var notes array i int\n notes = DBFind(\"@1notifications\").Where({\"closed\": 0, \"ecosystem\": $ecosystem_id, \"recipient->member_id\": $key_id, \"page_name\": \"crediting_view\", \"page_params->crediting_id\": $Id})\n while i < Len(notes){\n var note map\n note = notes[i]\n @1NotificationsClose(\"NotificId\", Int(note[\"id\"]))\n i = i + 1\n }\n }\n\n conditions {\n var request map status int\n request = DBFind(\"crediting_requests\").Where({\"id\": $Id}).Row()\n $borrower = request[\"borrower\"]\n $creditor = request[\"creditor\"]\n $rate = request[\"rate\"]\n $amount = request[\"amount\"]\n\n $sign_creditor = request[\"sign_creditor\"]\n $sign_borrower = request[\"sign_borrower\"]\n status = Int(request[\"status\"])\n\n //check status\n if status != 2 {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n //check borrower && creditor\n if AddressToId($borrower) != $key_id && AddressToId($creditor) != $key_id {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n $pub = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": $key_id}).One(\"pub\")\n $pub = PubToHex($pub) \n }\n\n action {\n closeMyNotes()\n\n var m map\n if AddressToId($borrower) == $key_id && $sign_borrower == 0 {\n m[\"sign_borrower\"] = $block_time\n m[\"pub_borrower\"] = $pub\n $sign_borrower = $block_time\n\n var memberId int\n var header body string params map\n memberId = AddressToId($creditor)\n header = \"Signature for auction №\" + Str($Id)\n body = \"Your signature is required!\"\n params[\"crediting_id\"] = $Id\n @1NotificationsSend(\"MemberId,Sender,Icon,Header,Body,Page,Params\", memberId, 1, \"fa-edit\", header, body, \"crediting_view\", params)\n } elif AddressToId($creditor) == $key_id && $sign_creditor == 0 {\n m[\"sign_creditor\"] = $block_time\n m[\"pub_creditor\"] = $pub\n $sign_creditor = $block_time\n }\n\n if $sign_borrower > 0 && $sign_creditor > 0 {\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Crediting\"}).One(\"id\")\n $commission_wallet = AppParam(Int($app), \"crediting_commission_wallet\", $ecosystem_id)\n\n if $commission_wallet != \"0\" {\n var commission money\n commission = Money($amount) * Money($rate) / Money(100) / Money(10)\n @1TokensSend(\"Recipient,Amount\", Str($commission_wallet), Money(commission))\n }\n\n @1TokensSend(\"Recipient,Amount\", Str($borrower), Money($amount))\n\t\t m[\"status\"] = 4\n }\n DBUpdate(\"crediting_requests\", Int($Id), m)\n }\n}", + "Value": "contract CreditingSignAccept {\n data {\n Id int\n }\n\n func closeMyNotes() {\n var notes array i int\n notes = DBFind(\"@1notifications\").Where({\"closed\": 0, \"ecosystem\": $ecosystem_id, \"recipient->account\": $account_id, \"page_name\": \"crediting_view\", \"page_params->crediting_id\": $Id})\n while i < Len(notes){\n var note map\n note = notes[i]\n @1NotificationsClose(\"NotificId\", Int(note[\"id\"]))\n i = i + 1\n }\n }\n\n conditions {\n var request map status int\n request = DBFind(\"crediting_requests\").Where({\"id\": $Id}).Row()\n $borrower = request[\"borrower\"]\n $creditor = request[\"creditor\"]\n $rate = request[\"rate\"]\n $amount = request[\"amount\"]\n\n $sign_creditor = request[\"sign_creditor\"]\n $sign_borrower = request[\"sign_borrower\"]\n status = Int(request[\"status\"])\n\n //check status\n if status != 2 {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n //check borrower && creditor\n if $borrower != $account_id && $creditor != $account_id {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n $pub = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": $account_id, \"deleted\": 0}).One(\"pub\")\n $pub = PubToHex($pub) \n }\n\n action {\n closeMyNotes()\n\n var m map\n if $borrower == $account_id && $sign_borrower == 0 {\n m[\"sign_borrower\"] = $block_time\n m[\"pub_borrower\"] = $pub\n $sign_borrower = $block_time\n\n var header body string params map\n header = \"Signature for auction №\" + Str($Id)\n body = \"Your signature is required!\"\n params[\"crediting_id\"] = $Id\n @1NotificationsSend(\"MemberAccount,Sender,Icon,Header,Body,Page,Params\", $creditor, 1, \"fa-edit\", header, body, \"crediting_view\", params)\n } elif $creditor == $account_id && $sign_creditor == 0 {\n m[\"sign_creditor\"] = $block_time\n m[\"pub_creditor\"] = $pub\n $sign_creditor = $block_time\n }\n\n if $sign_borrower > 0 && $sign_creditor > 0 {\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Crediting\"}).One(\"id\")\n $commission_wallet = AppParam(Int($app), \"crediting_commission_wallet\", $ecosystem_id)\n\n if $commission_wallet != \"0\" {\n var commission money\n commission = Money($amount) * Money($rate) / Money(100) / Money(10)\n @1TokensSend(\"Recipient,Amount\", Str($commission_wallet), Money(commission))\n }\n\n @1TokensSend(\"Recipient,Amount\", Str($borrower), Money($amount))\n\t\t m[\"status\"] = 4\n }\n DBUpdate(\"crediting_requests\", Int($Id), m)\n }\n}", "Type": "contracts" }, { "Name": "CreditingSignReject", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "contract CreditingSignReject {\n data {\n Id int\n }\n\n func closeMyNotes() {\n var notes array i int\n notes = DBFind(\"@1notifications\").Where({\"closed\": 0, \"ecosystem\": $ecosystem_id, \"recipient->member_id\": $key_id, \"page_name\": \"crediting_view\", \"page_params->crediting_id\": $Id})\n while i < Len(notes){\n var note map\n note = notes[i]\n @1NotificationsClose(\"NotificId\", Int(note[\"id\"]))\n i = i + 1\n }\n }\n\n conditions {\n var request map status int\n request = DBFind(\"crediting_requests\").Where({\"id\": $Id}).Row()\n $borrower = request[\"borrower\"]\n $creditor = request[\"creditor\"]\n status = Int(request[\"status\"])\n\n //check status\n if status != 2 {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n //check borrower && creditor\n if AddressToId($borrower) != $key_id && AddressToId($creditor) != $key_id {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n\n action {\n closeMyNotes()\n\n var m map\n\t\tm[\"status\"] = 3 \n DBUpdate(\"crediting_requests\", Int($Id), m)\n }\n}", + "Value": "contract CreditingSignReject {\n data {\n Id int\n }\n\n func closeMyNotes() {\n var notes array i int\n notes = DBFind(\"@1notifications\").Where({\"closed\": 0, \"ecosystem\": $ecosystem_id, \"recipient->account\": $account_id, \"page_name\": \"crediting_view\", \"page_params->crediting_id\": $Id})\n while i < Len(notes){\n var note map\n note = notes[i]\n @1NotificationsClose(\"NotificId\", Int(note[\"id\"]))\n i = i + 1\n }\n }\n\n conditions {\n var request map status int\n request = DBFind(\"crediting_requests\").Where({\"id\": $Id}).Row()\n $borrower = request[\"borrower\"]\n $creditor = request[\"creditor\"]\n status = Int(request[\"status\"])\n\n //check status\n if status != 2 {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n //check borrower && creditor\n if $borrower != $account_id && $creditor != $account_id {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n\n action {\n closeMyNotes()\n\n var m map\n\t\tm[\"status\"] = 3 \n DBUpdate(\"crediting_requests\", Int($Id), m)\n }\n}", "Type": "contracts" }, { "Name": "CreditingStatusUpdate", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "contract CreditingStatusUpdate {\n data {}\n\n func findWinner(request map) int {\n var request_id int offers map\n request_id = Int(request[\"id\"])\n offers = DBFind(\"crediting_offers\").Where({\"request_id\": request_id}).Order({\"rate\": 1, \"date_created\": 1}).Row()\n\n var creditor string rate offer_id offer_date int\n if offers {\n offer_id = offers[\"id\"]\n creditor = offers[\"creditor\"]\n rate = offers[\"rate\"]\n offer_date = offers[\"date_created\"]\n DBUpdate(\"crediting_requests\", request_id, {\"creditor\": creditor, \"rate\": rate, \"offer_id\": offer_id, \"offer_date\": offer_date})\n\n var memberId int\n var header body string params map \n memberId = AddressToId(request[\"borrower\"])\n header = \"Signature for auction №\" + Str(request_id)\n body = \"Your signature is required!\"\n params[\"crediting_id\"] = request_id\n @1NotificationsSend(\"MemberId,Sender,Icon,Header,Body,Page,Params\", memberId, 1, \"fa-edit\", header, body, \"crediting_view\", params)\n }\n return offer_id\n }\n\n func sendNotesAuctionStarted(request map) {\n var request_id i int subs_arr array\n request_id = Int(request[\"id\"])\n subs_arr = DBFind(\"crediting_subs\").Columns(\"creditor\").Limit(10000).Where({\"request_id\": request_id, \"deleted\": 0})\n while i < Len(subs_arr) {\n var sub_map memberId int\n sub_map = subs_arr[i]\n memberId = AddressToId(sub_map[\"creditor\"])\n\n var header body string params map \n header = \"Auction №\" + Str(request_id) + \" started\"\n body = \"You can bid now!\"\n params[\"crediting_id\"] = request_id\n params[\"optional\"] = 1\n @1NotificationsSend(\"MemberId,Sender,Icon,Header,Body,Page,Params\", memberId, 1, \"fa-check\", header, body, \"crediting_view\", params)\n i = i + 1\n }\n }\n\n func sendNotesAuctionFinished(request map) {\n var request_id i int subs_arr array\n request_id = Int(request[\"id\"])\n subs_arr = DBFind(\"crediting_subs\").Columns(\"creditor\").Limit(10000).Where({\"request_id\": request_id, \"deleted\": 0})\n while i < Len(subs_arr) {\n var sub_map memberId int\n sub_map = subs_arr[i]\n memberId = AddressToId(sub_map[\"creditor\"])\n\n var header body string params map \n header = \"Auction №\" + Str(request_id) + \" finished\"\n body = \"You can't bid anymore!\"\n params[\"crediting_id\"] = request_id\n params[\"optional\"] = 1\n @1NotificationsSend(\"MemberId,Sender,Icon,Header,Body,Page,Params\", memberId, 1, \"fa-close\", header, body, \"crediting_view\", params)\n i = i + 1\n }\n }\n\n func changeStatus(from, to map) {\n var requests array i int req map\n requests = DBFind(\"crediting_requests\").Where(from)\n\n while i < Len(requests) {\n req = requests[i]\n if to[\"status\"] == $SIGNING {\n sendNotesAuctionFinished(req)\n if findWinner(req) == 0 {\n to[\"status\"] = $REJECTED\n }\n }\n if to[\"status\"] == $AUCTION {\n sendNotesAuctionStarted(req)\n }\n DBUpdate(\"crediting_requests\", Int(req[\"id\"]), to)\n i = i + 1\n }\n }\n\n conditions {\n $BLOCKED = -2\n $REMOVED = -1\n $WAITING = 0\n $AUCTION = 1\n $SIGNING = 2\n $REJECTED = 3\n $FINISHED = 4\n\n // check_access\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Crediting\"}).One(\"id\")\n $check_access = AppParam(Int($app), \"crediting_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+$check_access+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n\n action {\n //setting status AUCTION\n changeStatus({\"status\": $WAITING, \"deleted\": 0, \"date_started\": {\"$lte\": $block_time}}, {\"status\": $AUCTION})\n\n //setting status SIGNING\n changeStatus({\"status\": $AUCTION, \"deleted\": 0, \"date_ended\": {\"$lte\": $block_time}}, {\"status\": $SIGNING})\n }\n}", + "Value": "contract CreditingStatusUpdate {\n data {}\n\n func findWinner(request map) int {\n var request_id int offers map\n request_id = Int(request[\"id\"])\n offers = DBFind(\"crediting_offers\").Where({\"request_id\": request_id}).Order({\"rate\": 1, \"date_created\": 1}).Row()\n\n var creditor string rate offer_id offer_date int\n if offers {\n offer_id = offers[\"id\"]\n creditor = offers[\"creditor\"]\n rate = offers[\"rate\"]\n offer_date = offers[\"date_created\"]\n DBUpdate(\"crediting_requests\", request_id, {\"creditor\": creditor, \"rate\": rate, \"offer_id\": offer_id, \"offer_date\": offer_date})\n\n var header body memberAccount string params map \n memberAccount = request[\"borrower\"]\n header = \"Signature for auction №\" + Str(request_id)\n body = \"Your signature is required!\"\n params[\"crediting_id\"] = request_id\n @1NotificationsSend(\"MemberAccount,Sender,Icon,Header,Body,Page,Params\", memberAccount, 1, \"fa-edit\", header, body, \"crediting_view\", params)\n }\n return offer_id\n }\n\n func sendNotesAuctionStarted(request map) {\n var request_id i int subs_arr array\n request_id = Int(request[\"id\"])\n subs_arr = DBFind(\"crediting_subs\").Where({\"request_id\": request_id, \"deleted\": 0}).Columns(\"creditor\").Limit(10000)\n while i < Len(subs_arr) {\n var sub_map int memberAccount string\n sub_map = subs_arr[i]\n memberAccount = sub_map[\"creditor\"]\n\n var header body string params map \n header = \"Auction №\" + Str(request_id) + \" started\"\n body = \"You can bid now!\"\n params[\"crediting_id\"] = request_id\n params[\"optional\"] = 1\n @1NotificationsSend(\"MemberAccount,Sender,Icon,Header,Body,Page,Params\", memberAccount, 1, \"fa-check\", header, body, \"crediting_view\", params)\n i = i + 1\n }\n }\n\n func sendNotesAuctionFinished(request map) {\n var request_id i int subs_arr array\n request_id = Int(request[\"id\"])\n subs_arr = DBFind(\"crediting_subs\").Where({\"request_id\": request_id, \"deleted\": 0}).Columns(\"creditor\").Limit(10000)\n while i < Len(subs_arr) {\n var sub_map int memberAccount string\n sub_map = subs_arr[i]\n memberAccount = sub_map[\"creditor\"]\n\n var header body string params map \n header = \"Auction №\" + Str(request_id) + \" finished\"\n body = \"You can't bid anymore!\"\n params[\"crediting_id\"] = request_id\n params[\"optional\"] = 1\n @1NotificationsSend(\"MemberAccount,Sender,Icon,Header,Body,Page,Params\", memberAccount, 1, \"fa-close\", header, body, \"crediting_view\", params)\n i = i + 1\n }\n }\n\n func changeStatus(from, to map) {\n var requests array i int req map\n requests = DBFind(\"crediting_requests\").Where(from)\n\n while i < Len(requests) {\n req = requests[i]\n if to[\"status\"] == $SIGNING {\n sendNotesAuctionFinished(req)\n if findWinner(req) == 0 {\n to[\"status\"] = $REJECTED\n }\n }\n if to[\"status\"] == $AUCTION {\n sendNotesAuctionStarted(req)\n }\n DBUpdate(\"crediting_requests\", Int(req[\"id\"]), to)\n i = i + 1\n }\n }\n\n conditions {\n $BLOCKED = -2\n $REMOVED = -1\n $WAITING = 0\n $AUCTION = 1\n $SIGNING = 2\n $REJECTED = 3\n $FINISHED = 4\n\n // check_access\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Crediting\"}).One(\"id\")\n $check_access = AppParam(Int($app), \"crediting_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+$check_access+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n\n action {\n //setting status AUCTION\n changeStatus({\"status\": $WAITING, \"deleted\": 0, \"date_started\": {\"$lte\": $block_time}}, {\"status\": $AUCTION})\n\n //setting status SIGNING\n changeStatus({\"status\": $AUCTION, \"deleted\": 0, \"date_ended\": {\"$lte\": $block_time}}, {\"status\": $SIGNING})\n }\n}", "Type": "contracts" }, { "Name": "CreditingSubscribe", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "contract CreditingSubscribe {\n data {\n Id int\n }\n\n conditions {\n $KeyId = IdToAddress($key_id)\n $request = DBFind(\"crediting_subs\").Where({\"request_id\": $Id, \"creditor\": $KeyId, \"deleted\": 0}).One(\"id\")\n }\n\n action {\n var m map\n if $request {\n m[\"deleted\"] = $block_time\n DBUpdate(\"crediting_subs\", Int($request), m)\n } else {\n m[\"request_id\"] = $Id\n m[\"creditor\"] = $KeyId\n DBInsert(\"crediting_subs\", m)\n }\n }\n}", + "Value": "contract CreditingSubscribe {\n data {\n Id int\n }\n\n conditions {\n $request = DBFind(\"crediting_subs\").Where({\"request_id\": $Id, \"creditor\": $account_id, \"deleted\": 0}).One(\"id\")\n }\n\n action {\n var m map\n if $request {\n m[\"deleted\"] = $block_time\n DBUpdate(\"crediting_subs\", Int($request), m)\n } else {\n m[\"request_id\"] = $Id\n m[\"creditor\"] = $account_id\n DBInsert(\"crediting_subs\", m)\n }\n }\n}", "Type": "contracts" } ] diff --git a/ecosystem_apps/crediting/contracts/CreditingAdd.sim b/ecosystem_apps/crediting/contracts/CreditingAdd.sim index e07cf84d4..a9c7240e0 100644 --- a/ecosystem_apps/crediting/contracts/CreditingAdd.sim +++ b/ecosystem_apps/crediting/contracts/CreditingAdd.sim @@ -59,7 +59,7 @@ contract CreditingAdd { $check_access = AppParam(Int($app), "crediting_borrower_role", $ecosystem_id) var rids array rids = JSONDecode("["+$check_access+"]") - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() { warning LangRes("@1access_denied", "en") } @@ -75,7 +75,7 @@ contract CreditingAdd { //check borrower if Int($Id) > 0 { - if AddressToId(borrower) != $key_id { + if borrower != $account_id { warning LangRes("@1access_denied", "en") } } @@ -95,7 +95,7 @@ contract CreditingAdd { action { var m map if Int($Id) == 0 { - m["borrower"] = IdToAddress($key_id) + m["borrower"] = $account_id m["status"] = 0 m["deleted"] = 0 m["date_created"] = $block_time diff --git a/ecosystem_apps/crediting/contracts/CreditingBid.sim b/ecosystem_apps/crediting/contracts/CreditingBid.sim index 84137f416..06688dee2 100644 --- a/ecosystem_apps/crediting/contracts/CreditingBid.sim +++ b/ecosystem_apps/crediting/contracts/CreditingBid.sim @@ -6,7 +6,7 @@ contract CreditingBid { func closeMyNotes() { var notes array i int - notes = DBFind("@1notifications").Where({"closed": 0, "ecosystem": $ecosystem_id, "recipient->member_id": $key_id, "page_name": "crediting_view", "page_params->crediting_id": $RequestId}) + notes = DBFind("@1notifications").Where({"closed": 0, "ecosystem": $ecosystem_id, "recipient->account": $account_id, "page_name": "crediting_view", "page_params->crediting_id": $RequestId}) while i < Len(notes){ var note map note = notes[i] @@ -17,19 +17,18 @@ contract CreditingBid { func sendNotesNewBid() { var i int subs_arr array - $KeyId = IdToAddress($key_id) - subs_arr = DBFind("crediting_subs").Columns("creditor").Limit(10000).Where({"creditor": {"$neq": $KeyId}, "request_id": $RequestId, "deleted": 0}) + subs_arr = DBFind("crediting_subs").Where({"creditor": {"$neq": $account_id}, "request_id": $RequestId, "deleted": 0}).Columns("creditor").Limit(10000) while i < Len(subs_arr) { - var sub_map memberId int + var sub_map int memberAccount string sub_map = subs_arr[i] - memberId = AddressToId(sub_map["creditor"]) + memberAccount = sub_map["creditor"] var header body string params map header = "New bid on auction №" + Str($RequestId) body = "Check auction for information" params["crediting_id"] = $RequestId params["optional"] = 1 - @1NotificationsSend("MemberId,Sender,Icon,Header,Body,Page,Params", memberId, 1, "fa-fire", header, body, "crediting_view", params) + @1NotificationsSend("MemberAccount,Sender,Icon,Header,Body,Page,Params", memberAccount, 1, "fa-fire", header, body, "crediting_view", params) i = i + 1 } } @@ -40,7 +39,7 @@ contract CreditingBid { $check_access = AppParam(Int($app), "crediting_creditor_role", $ecosystem_id) var rids array rids = JSONDecode("["+$check_access+"]") - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() { warning LangRes("@1access_denied", "en") } @@ -59,7 +58,7 @@ contract CreditingBid { sendNotesNewBid() var m map - m["creditor"] = IdToAddress($key_id) + m["creditor"] = $account_id m["date_created"] = $block_time m["rate"] = $Rate m["request_id"] = $RequestId diff --git a/ecosystem_apps/crediting/contracts/CreditingBlock.sim b/ecosystem_apps/crediting/contracts/CreditingBlock.sim index 6d8c1ae3e..a61241bf4 100644 --- a/ecosystem_apps/crediting/contracts/CreditingBlock.sim +++ b/ecosystem_apps/crediting/contracts/CreditingBlock.sim @@ -9,7 +9,7 @@ contract CreditingBlock { $check_access = AppParam(Int($app), "crediting_admin_role", $ecosystem_id) var rids array rids = JSONDecode("["+$check_access+"]") - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() { warning LangRes("@1access_denied", "en") } } diff --git a/ecosystem_apps/crediting/contracts/CreditingDel.sim b/ecosystem_apps/crediting/contracts/CreditingDel.sim index 232255fe7..8dd4f352c 100644 --- a/ecosystem_apps/crediting/contracts/CreditingDel.sim +++ b/ecosystem_apps/crediting/contracts/CreditingDel.sim @@ -15,7 +15,7 @@ contract CreditingDel { } //check borrower - if AddressToId(borrower) != $key_id { + if borrower != $account_id { warning LangRes("@1access_denied", "en") } } diff --git a/ecosystem_apps/crediting/contracts/CreditingSignAccept.sim b/ecosystem_apps/crediting/contracts/CreditingSignAccept.sim index 0dfe31897..e8c1d2195 100644 --- a/ecosystem_apps/crediting/contracts/CreditingSignAccept.sim +++ b/ecosystem_apps/crediting/contracts/CreditingSignAccept.sim @@ -5,7 +5,7 @@ contract CreditingSignAccept { func closeMyNotes() { var notes array i int - notes = DBFind("@1notifications").Where({"closed": 0, "ecosystem": $ecosystem_id, "recipient->member_id": $key_id, "page_name": "crediting_view", "page_params->crediting_id": $Id}) + notes = DBFind("@1notifications").Where({"closed": 0, "ecosystem": $ecosystem_id, "recipient->account": $account_id, "page_name": "crediting_view", "page_params->crediting_id": $Id}) while i < Len(notes){ var note map note = notes[i] @@ -32,11 +32,11 @@ contract CreditingSignAccept { } //check borrower && creditor - if AddressToId($borrower) != $key_id && AddressToId($creditor) != $key_id { + if $borrower != $account_id && $creditor != $account_id { warning LangRes("@1access_denied", "en") } - $pub = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": $key_id}).One("pub") + $pub = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": $account_id, "deleted": 0}).One("pub") $pub = PubToHex($pub) } @@ -44,19 +44,17 @@ contract CreditingSignAccept { closeMyNotes() var m map - if AddressToId($borrower) == $key_id && $sign_borrower == 0 { + if $borrower == $account_id && $sign_borrower == 0 { m["sign_borrower"] = $block_time m["pub_borrower"] = $pub $sign_borrower = $block_time - var memberId int var header body string params map - memberId = AddressToId($creditor) header = "Signature for auction №" + Str($Id) body = "Your signature is required!" params["crediting_id"] = $Id - @1NotificationsSend("MemberId,Sender,Icon,Header,Body,Page,Params", memberId, 1, "fa-edit", header, body, "crediting_view", params) - } elif AddressToId($creditor) == $key_id && $sign_creditor == 0 { + @1NotificationsSend("MemberAccount,Sender,Icon,Header,Body,Page,Params", $creditor, 1, "fa-edit", header, body, "crediting_view", params) + } elif $creditor == $account_id && $sign_creditor == 0 { m["sign_creditor"] = $block_time m["pub_creditor"] = $pub $sign_creditor = $block_time diff --git a/ecosystem_apps/crediting/contracts/CreditingSignReject.sim b/ecosystem_apps/crediting/contracts/CreditingSignReject.sim index eeeb9ceb0..443a4414f 100644 --- a/ecosystem_apps/crediting/contracts/CreditingSignReject.sim +++ b/ecosystem_apps/crediting/contracts/CreditingSignReject.sim @@ -5,7 +5,7 @@ contract CreditingSignReject { func closeMyNotes() { var notes array i int - notes = DBFind("@1notifications").Where({"closed": 0, "ecosystem": $ecosystem_id, "recipient->member_id": $key_id, "page_name": "crediting_view", "page_params->crediting_id": $Id}) + notes = DBFind("@1notifications").Where({"closed": 0, "ecosystem": $ecosystem_id, "recipient->account": $account_id, "page_name": "crediting_view", "page_params->crediting_id": $Id}) while i < Len(notes){ var note map note = notes[i] @@ -27,7 +27,7 @@ contract CreditingSignReject { } //check borrower && creditor - if AddressToId($borrower) != $key_id && AddressToId($creditor) != $key_id { + if $borrower != $account_id && $creditor != $account_id { warning LangRes("@1access_denied", "en") } } diff --git a/ecosystem_apps/crediting/contracts/CreditingStatusUpdate.sim b/ecosystem_apps/crediting/contracts/CreditingStatusUpdate.sim index 4e70a7417..95d41a7a4 100644 --- a/ecosystem_apps/crediting/contracts/CreditingStatusUpdate.sim +++ b/ecosystem_apps/crediting/contracts/CreditingStatusUpdate.sim @@ -14,13 +14,12 @@ contract CreditingStatusUpdate { offer_date = offers["date_created"] DBUpdate("crediting_requests", request_id, {"creditor": creditor, "rate": rate, "offer_id": offer_id, "offer_date": offer_date}) - var memberId int - var header body string params map - memberId = AddressToId(request["borrower"]) + var header body memberAccount string params map + memberAccount = request["borrower"] header = "Signature for auction №" + Str(request_id) body = "Your signature is required!" params["crediting_id"] = request_id - @1NotificationsSend("MemberId,Sender,Icon,Header,Body,Page,Params", memberId, 1, "fa-edit", header, body, "crediting_view", params) + @1NotificationsSend("MemberAccount,Sender,Icon,Header,Body,Page,Params", memberAccount, 1, "fa-edit", header, body, "crediting_view", params) } return offer_id } @@ -28,18 +27,18 @@ contract CreditingStatusUpdate { func sendNotesAuctionStarted(request map) { var request_id i int subs_arr array request_id = Int(request["id"]) - subs_arr = DBFind("crediting_subs").Columns("creditor").Limit(10000).Where({"request_id": request_id, "deleted": 0}) + subs_arr = DBFind("crediting_subs").Where({"request_id": request_id, "deleted": 0}).Columns("creditor").Limit(10000) while i < Len(subs_arr) { - var sub_map memberId int + var sub_map int memberAccount string sub_map = subs_arr[i] - memberId = AddressToId(sub_map["creditor"]) + memberAccount = sub_map["creditor"] var header body string params map header = "Auction №" + Str(request_id) + " started" body = "You can bid now!" params["crediting_id"] = request_id params["optional"] = 1 - @1NotificationsSend("MemberId,Sender,Icon,Header,Body,Page,Params", memberId, 1, "fa-check", header, body, "crediting_view", params) + @1NotificationsSend("MemberAccount,Sender,Icon,Header,Body,Page,Params", memberAccount, 1, "fa-check", header, body, "crediting_view", params) i = i + 1 } } @@ -47,18 +46,18 @@ contract CreditingStatusUpdate { func sendNotesAuctionFinished(request map) { var request_id i int subs_arr array request_id = Int(request["id"]) - subs_arr = DBFind("crediting_subs").Columns("creditor").Limit(10000).Where({"request_id": request_id, "deleted": 0}) + subs_arr = DBFind("crediting_subs").Where({"request_id": request_id, "deleted": 0}).Columns("creditor").Limit(10000) while i < Len(subs_arr) { - var sub_map memberId int + var sub_map int memberAccount string sub_map = subs_arr[i] - memberId = AddressToId(sub_map["creditor"]) + memberAccount = sub_map["creditor"] var header body string params map header = "Auction №" + Str(request_id) + " finished" body = "You can't bid anymore!" params["crediting_id"] = request_id params["optional"] = 1 - @1NotificationsSend("MemberId,Sender,Icon,Header,Body,Page,Params", memberId, 1, "fa-close", header, body, "crediting_view", params) + @1NotificationsSend("MemberAccount,Sender,Icon,Header,Body,Page,Params", memberAccount, 1, "fa-close", header, body, "crediting_view", params) i = i + 1 } } @@ -97,7 +96,7 @@ contract CreditingStatusUpdate { $check_access = AppParam(Int($app), "crediting_admin_role", $ecosystem_id) var rids array rids = JSONDecode("["+$check_access+"]") - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() { warning LangRes("@1access_denied", "en") } } diff --git a/ecosystem_apps/crediting/contracts/CreditingSubscribe.sim b/ecosystem_apps/crediting/contracts/CreditingSubscribe.sim index 79de1d0bb..56033dc4f 100644 --- a/ecosystem_apps/crediting/contracts/CreditingSubscribe.sim +++ b/ecosystem_apps/crediting/contracts/CreditingSubscribe.sim @@ -4,8 +4,7 @@ contract CreditingSubscribe { } conditions { - $KeyId = IdToAddress($key_id) - $request = DBFind("crediting_subs").Where({"request_id": $Id, "creditor": $KeyId, "deleted": 0}).One("id") + $request = DBFind("crediting_subs").Where({"request_id": $Id, "creditor": $account_id, "deleted": 0}).One("id") } action { @@ -15,7 +14,7 @@ contract CreditingSubscribe { DBUpdate("crediting_subs", Int($request), m) } else { m["request_id"] = $Id - m["creditor"] = $KeyId + m["creditor"] = $account_id DBInsert("crediting_subs", m) } } diff --git a/ecosystem_apps/crediting/languages/crediting_settings.json b/ecosystem_apps/crediting/languages/crediting_settings.json index 2a0697168..44a517c43 100644 --- a/ecosystem_apps/crediting/languages/crediting_settings.json +++ b/ecosystem_apps/crediting/languages/crediting_settings.json @@ -1 +1 @@ -{"en": "Crediting settings", "ru": "Настройки Кридитования"} \ No newline at end of file +{"en": "Crediting settings", "ru": "Настройки Кредитования"} \ No newline at end of file diff --git a/ecosystem_apps/crediting/pages/crediting_add.ptl b/ecosystem_apps/crediting/pages/crediting_add.ptl index 00708048e..d1d5e3b1a 100644 --- a/ecosystem_apps/crediting/pages/crediting_add.ptl +++ b/ecosystem_apps/crediting/pages/crediting_add.ptl @@ -1,6 +1,6 @@ -DBFind(@1applications).Where({"ecosystem": #ecosystem_id#, "name": "Crediting"}).Columns("name,id").Vars(application) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Crediting"}).Columns("name,id").Vars(application) If(#Id#>0){ - DBFind(crediting_requests).Where({"id": #Id#}).Vars(request) + DBFind("crediting_requests").Where({"id": "#Id#"}).Vars(request) } Form(){ Div(list-group-item){ @@ -12,7 +12,7 @@ Form(){ } } Div(col-md-9 text-left){ - SetVar(borrower, Address(#key_id#)) + SetVar(borrower, #account_id#) Input(Name: Borrower, Disabled: 1, Value: #borrower#) } } diff --git a/ecosystem_apps/crediting/pages/crediting_history.ptl b/ecosystem_apps/crediting/pages/crediting_history.ptl index 7b65fcd1f..10fd6ab86 100644 --- a/ecosystem_apps/crediting/pages/crediting_history.ptl +++ b/ecosystem_apps/crediting/pages/crediting_history.ptl @@ -1,7 +1,6 @@ -DBFind(crediting_offers, offers).Where({"request_id": #Id#}).Order({"rate": 1, "date_created": 1}).Custom(custom_creditor){ - SetVar(creditor_id, AddressToId(#creditor#)) - DBFind(@1members).Where({"ecosystem": #ecosystem_id#, "id": #creditor_id#}).Columns("member_info->information").Vars(c) - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#c_id#"){ +DBFind("crediting_offers", offers).Where({"request_id": "#Id#"}).Order({"rate": 1, "date_created": 1}).Custom(custom_creditor){ + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#creditor#"}).Columns("member_info->information").Vars(c) + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#c_account#"){ Div(){ Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;) Span(){ diff --git a/ecosystem_apps/crediting/pages/crediting_list.ptl b/ecosystem_apps/crediting/pages/crediting_list.ptl index 51735481d..37b5ee8ee 100644 --- a/ecosystem_apps/crediting/pages/crediting_list.ptl +++ b/ecosystem_apps/crediting/pages/crediting_list.ptl @@ -4,45 +4,45 @@ Include(@1pager_header) SetTitle("$crediting$") Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$crediting_desc$")) -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Crediting"}).Vars(application) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Crediting"}).Vars(application) SetVar(admin_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crediting_admin_role)) SetVar(creditor_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crediting_creditor_role)) SetVar(borrower_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crediting_borrower_role)) -DBFind("@1roles_participants").Where({"ecosystem": #ecosystem_id#, "$and": ["role->id": {"$in": [#admin_role#]}, "role->id": #role_id#], "member->member_id": #key_id#, "deleted": 0}).Vars(admin_access) -DBFind("@1roles_participants").Where({"ecosystem": #ecosystem_id#, "$and": ["role->id": {"$in": [#creditor_role#]}, "role->id": #role_id#], "member->member_id": #key_id#, "deleted": 0}).Vars(creditor_access) -DBFind("@1roles_participants").Where({"ecosystem": #ecosystem_id#, "$and": ["role->id": {"$in": [#borrower_role#]}, "role->id": #role_id#], "member->member_id": #key_id#, "deleted": 0}).Vars(borrower_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#admin_role#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#creditor_role#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(creditor_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#borrower_role#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(borrower_access) If(#borrower_access_id# > 0){ AddToolButton(Title: $@1add$, Page: crediting_add, Icon: icon-plus).Popup(60, $crediting_add$) } -If(#page_par#==0){ - SetVar(type_filter, {"status": 0}) -}.ElseIf(#page_par#==1){ - SetVar(type_filter, {"status": 1}) -}.ElseIf(#page_par#==2){ - SetVar(type_filter, {"status": 2}) -}.ElseIf(#page_par#==3){ - SetVar(type_filter, {"status": 3}) -}.ElseIf(#page_par#==4){ - SetVar(type_filter, {"status": 4}) +If(#page_par# == 0){ + SetVar(type_filter, `, {"status": 0}`) +}.ElseIf(#page_par# == 1){ + SetVar(type_filter, `, {"status": 1}`) +}.ElseIf(#page_par# == 2){ + SetVar(type_filter, `, {"status": 2}`) +}.ElseIf(#page_par# == 3){ + SetVar(type_filter, `, {"status": 3}`) +}.ElseIf(#page_par# == 4){ + SetVar(type_filter, `, {"status": 4}`) } If(#creditor_access_id# > 0){ SetVar(global_access, 1) - SetVar(role_where, {"deleted": 0}) + SetVar(role_where, `, {"deleted": 0}`) }.ElseIf(#borrower_access_id# > 0){ SetVar(global_access, 1) - SetVar(role_where, {"borrower": Address(#key_id#)}) + SetVar(role_where, `, {"borrower": "#account_id#"}`) }.ElseIf(#admin_access_id# > 0){ SetVar(global_access, 1) } If(#global_access# == 1){ If(#search#){ - SetVar(where, {"$and": [#role_where#, #type_filter#, {"borrower": {"$ilike": "#search#"}}]}) + SetVar(where, {"$and": [{"borrower": {"$ilike": "#search#"}} #role_where# #type_filter#]}) }.Else{ - SetVar(where, {"$and": [#role_where#, #type_filter#]}) + SetVar(where, {"$and": [#role_where# #type_filter#]}) } Div(mr-lg text-right){ @@ -68,11 +68,10 @@ If(#global_access# == 1){ SetVar(Name: style_text, Value: "text-muted") SetVar(Name: style_link, Value: "text-muted") } - SetVar(borrower_id, AddressToId(#borrower#)) Span(Class: #style_text#, Body: #id#) }.Custom(custom_borrower){ - DBFind(@1members).Where({"ecosystem": #ecosystem_id#, "id": #borrower_id#}).Columns("member_info->information").Vars(member) - LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#member_id#"){ + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#borrower#"}).Columns("member_info->information").Vars(member) + LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: "v_account=#member_account#"){ Div(){ Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;) Span(){ @@ -93,17 +92,17 @@ If(#global_access# == 1){ }.Custom(custom_status){ If(#status#==-2){ Span(Class: text-muted, Body: LangRes(crediting_blocked)) - }.ElseIf(#status#==-1){ + }.ElseIf(#status# == -1){ Span(Class: text-muted, Body: LangRes(crediting_removed)) - }.ElseIf(#status#==0){ + }.ElseIf(#status# == 0){ Span(Class: text-warning, Body: LangRes(crediting_waiting)) - }.ElseIf(#status#==1){ + }.ElseIf(#status# == 1){ Span(Class: text-success, Body: LangRes(crediting_auction)) - }.ElseIf(#status#==2){ + }.ElseIf(#status# == 2){ Span(Class: text-primary, Body: LangRes(crediting_signing)) - }.ElseIf(#status#==3){ + }.ElseIf(#status# == 3){ Span(Class: text-danger, Body: LangRes(crediting_rejected)) - }.ElseIf(#status#==4){ + }.ElseIf(#status# == 4){ Span(Class: text-normal, Body: LangRes(crediting_finished)) } }.Custom(custom_view){ @@ -117,7 +116,7 @@ If(#global_access# == 1){ ) }.Custom(actions){ Div(text-right button-group text-nowrap){ - If(And(#deleted#==0,#status#==0,#borrower_id#==#key_id#)){ + If(And(#deleted# == 0, #status# == 0, #borrower# == #account_id#)){ Button(Class: btn bg-gray-lighter buttons, Contract: CreditingDel, Params: "Id=#id#", Page: #this_page#){ Em(Class: text-danger fa fa-1x fa-trash) }.Alert(Text: "$@1sure_want_delete$", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question) diff --git a/ecosystem_apps/crediting/pages/crediting_settings.ptl b/ecosystem_apps/crediting/pages/crediting_settings.ptl index 3e5168259..3d3566e68 100644 --- a/ecosystem_apps/crediting/pages/crediting_settings.ptl +++ b/ecosystem_apps/crediting/pages/crediting_settings.ptl @@ -1,5 +1,5 @@ -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Crediting"}).Vars("app") -DBFind("@1roles", src_roles).Where({"ecosystem": #ecosystem_id#, "deleted": 0}).Columns("role_name,id").Limit(100) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Crediting"}).Vars(app) +DBFind("@1roles", src_roles).Where({"ecosystem": "#ecosystem_id#", "deleted": 0}).Columns("role_name,id").Limit(100) SetVar(row,"row mt-sm").(col_left,"col-sm-4 text-right mt-sm").(col_right,"col-sm-8 text-left") SetVar(this_page, "crediting_settings").(role_admin,0).(role_borrower,0).(role_creditor,0).(commission_wallet,0) @@ -30,7 +30,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#role_admin# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #role_admin#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#role_admin#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# @@ -48,7 +48,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#role_borrower# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #role_borrower#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#role_borrower#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# @@ -66,7 +66,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#role_creditor# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #role_creditor#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#role_creditor#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# diff --git a/ecosystem_apps/crediting/pages/crediting_view.ptl b/ecosystem_apps/crediting/pages/crediting_view.ptl index 77a58747b..5da5d1b8a 100644 --- a/ecosystem_apps/crediting/pages/crediting_view.ptl +++ b/ecosystem_apps/crediting/pages/crediting_view.ptl @@ -1,17 +1,17 @@ -DBFind(@1applications).Where({"ecosystem": #ecosystem_id#, "name": "Crediting"}).Columns("name,id").Vars(application) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Crediting"}).Columns("name,id").Vars(application) SetVar(creditor_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crediting_creditor_role)) -DBFind("@1roles_participants").Where({"ecosystem": #ecosystem_id#, "$and": ["role->id": {"$in": [#creditor_role#]}, "role->id": #role_id#], "member->member_id": #key_id#, "deleted": 0}).Vars(creditor_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#creditor_role#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(creditor_access) If(#notific_id#>0){ - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "id": #notific_id#}).Columns("page_params->crediting_id,page_params->optional").Vars(notific) + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "id": "#notific_id#"}).Columns("page_params->crediting_id,page_params->optional").Vars(notific) SetVar(Id, #notific_page_params_crediting_id#) SetVar(notific_optional, #notific_page_params_optional#) } If(#Id#>0){ - DBFind(crediting_requests).Where({"id": #Id#}).Vars(request) - SetVar(borrower_id, AddressToId(#request_borrower#)) - SetVar(creditor_id, AddressToId(#request_creditor#)) + DBFind("crediting_requests").Where({"id": "#Id#"}).Vars(request) + SetVar(borrower_account, #request_borrower#) + SetVar(creditor_account, #request_creditor#) } Div(content-wrapper){ @@ -34,10 +34,10 @@ Div(content-wrapper){ LangRes(crediting_borrower) } Div(col-md-6 text-left){ - DBFind(@1members).Where({"ecosystem": #ecosystem_id#, "id": #borrower_id#}).Columns("member_info->information").Vars(borrower) - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#borrower_id#"){ + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#borrower_account#"}).Columns("member_info->information").Vars(borrower) + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#borrower_account#"){ Div(){ - Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;) + Span(Em(Class: fa icon-user fa-2x)).Style(margin-right: 10px;) Span(){ P(Class: h5 m0 text-bold, Body: #request_borrower#) P(Class: h6 m0, Body: #borrower_member_info_information#) @@ -52,7 +52,7 @@ Div(content-wrapper){ } Div(col-md-6 text-left){ SetVar(rating_amount, 0) - DBFind(@1r_ratings, r).Where({"ecosystem": #ecosystem_id#, "member": #request_borrower#}).Vars(rating) + DBFind("@1r_ratings", r).Where({"ecosystem": "#ecosystem_id#", "member": "#request_borrower#"}).Vars(rating) Span(#rating_amount#) } } @@ -120,12 +120,11 @@ Div(content-wrapper){ } } If(#request_status# == 1){ - DBFind(crediting_offers, offers).Where({"request_id": #Id#}).Order({"rate": 1, "date_created": 1}).Custom(custom_creditor){ - SetVar(creditor_id, AddressToId(#creditor#)) - DBFind(@1members).Where({"ecosystem": #ecosystem_id#, "id": #creditor_id#}).Columns("member_info->information").Vars(c) - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#c_id#"){ + DBFind("crediting_offers", offers).Where({"request_id": "#Id#"}).Order({"rate": 1, "date_created": 1}).Custom(custom_creditor){ + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#creditor#"}).Columns("member_info->information").Vars(c) + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#c_account#"){ Div(){ - Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;) + Span(Em(Class: fa icon-user fa-2x)).Style(margin-right: 10px;) Span(){ P(Class: h5 m0 text-bold, Body: #creditor#) P(Class: h6 m0, Body: #c_member_info_information#) @@ -167,7 +166,7 @@ Div(content-wrapper){ } } If(Or(#request_status#==2,#request_status#==4)){ - If(Or(And(#creditor_id#==#key_id#,#request_sign_borrower#>0,#request_sign_creditor#==0),And(#borrower_id#==#key_id#,#request_sign_borrower#==0,#request_sign_creditor#==0))){ + If(Or(And(#creditor_account#==#account_id#,#request_sign_borrower#>0,#request_sign_creditor#==0),And(#borrower_account#==#account_id#,#request_sign_borrower#==0,#request_sign_creditor#==0))){ SetVar(hh, 210) }.Else{ SetVar(hh, 160) @@ -203,10 +202,10 @@ Div(content-wrapper){ Div(list-group-item text-center mb-lg ml-lg){ Div(row mb mt-sm t6){ Div(col-sm-8 col-sm-offset-4 text-left){ - DBFind(@1members).Where({"ecosystem": #ecosystem_id#, "id": #borrower_id#}).Columns("member_info->information").Vars(borrower) - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#borrower_id#"){ + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#borrower_account#"}).Columns("member_info->information").Vars(borrower) + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#borrower_account#"){ Div(){ - Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;) + Span(Em(Class: fa icon-user fa-2x)).Style(margin-right: 10px;) Span(){ P(Class: h5 m0 text-bold, Body: #request_borrower#) P(Class: h6 m0, Body: #borrower_member_info_information#) @@ -237,7 +236,7 @@ Div(content-wrapper){ } } If(#request_status#==2){ - If(And(#borrower_id#==#key_id#,#request_sign_borrower#==0,#request_sign_creditor#==0)){ + If(And(#borrower_account#==#account_id#,#request_sign_borrower#==0,#request_sign_creditor#==0)){ Div(row mt-lg){ Div(col-sm-12){ Button(Body: LangRes(@1reject), Class: btn btn-danger pull-left, Contract: CreditingSignReject, Params: "Id=#Id#", Page: crediting_view, PageParams: "Id=#Id#") @@ -255,10 +254,10 @@ Div(content-wrapper){ Div(list-group-item text-center mb-lg ml-lg){ Div(row mb mt-sm t6){ Div(col-sm-8 col-sm-offset-4 text-left){ - DBFind(@1members).Where({"ecosystem": #ecosystem_id#, "id": #creditor_id#}).Columns("member_info->information").Vars(creditor) - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#creditor_id#"){ + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#creditor_account#"}).Columns("member_info->information").Vars(creditor) + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#creditor_account#"){ Div(){ - Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;) + Span(Em(Class: fa icon-user fa-2x)).Style(margin-right: 10px;) Span(){ P(Class: h5 m0 text-bold, Body: #request_creditor#) P(Class: h6 m0, Body: #creditor_member_info_information#) @@ -288,7 +287,7 @@ Div(content-wrapper){ } } If(#request_status#==2){ - If(And(#creditor_id#==#key_id#,#request_sign_borrower#>0,#request_sign_creditor#==0)){ + If(And(#creditor_account#==#account_id#,#request_sign_borrower#>0,#request_sign_creditor#==0)){ Div(row mt-lg){ Div(col-sm-12){ Button(Body: LangRes(@1reject), Class: btn btn-danger pull-left, Contract: CreditingSignReject, Params: "Id=#Id#", Page: crediting_view, PageParams: "Id=#Id#") @@ -316,8 +315,7 @@ Div(content-wrapper){ } } If(#creditor_access_id# > 0){ - SetVar(current_address, Address(#key_id#)) - DBFind("crediting_subs", fsdf).Where({"request_id": #Id#, "creditor": #current_address#, "deleted": 0}).Vars(sub) + DBFind("crediting_subs").Where({"request_id": "#Id#", "creditor": "#account_id#", "deleted": 0}).Vars(sub) If(#sub_id#>0){ Button(Class: btn bg-gray-lighter ml-sm buttons pull-right, Page: crediting_view, PageParams: "Id=#Id#", Contract: CreditingSubscribe, Params: "Id=#Id#"){ Span(Em(Class: fa fa-close fa-1x) diff --git a/ecosystem_apps/crediting/tables/crediting_offers.json b/ecosystem_apps/crediting/tables/crediting_offers.json index b8ff6e6cb..b10229b21 100644 --- a/ecosystem_apps/crediting/tables/crediting_offers.json +++ b/ecosystem_apps/crediting/tables/crediting_offers.json @@ -1,22 +1,22 @@ [ { - "name":"creditor", - "conditions":"false", - "type":"varchar" + "name": "creditor", + "conditions": "false", + "type": "varchar" }, { - "name":"date_created", - "conditions":"false", - "type":"number" + "name": "date_created", + "conditions": "false", + "type": "number" }, { - "name":"rate", - "conditions":"false", - "type":"number" + "name": "rate", + "conditions": "false", + "type": "number" }, { - "name":"request_id", - "conditions":"false", - "type":"number" + "name": "request_id", + "conditions": "false", + "type": "number" } ] \ No newline at end of file diff --git a/ecosystem_apps/crediting/tables/crediting_requests.json b/ecosystem_apps/crediting/tables/crediting_requests.json index 67eb3b4a9..bc436421c 100644 --- a/ecosystem_apps/crediting/tables/crediting_requests.json +++ b/ecosystem_apps/crediting/tables/crediting_requests.json @@ -1,87 +1,87 @@ [ { - "name":"amount", + "name": "amount", "conditions": "ContractAccess(\"CreditingAdd\")", - "type":"money" + "type": "money" }, { - "name":"borrower", + "name": "borrower", "conditions": "false", - "type":"varchar" + "type": "varchar" }, { - "name":"creditor", + "name": "creditor", "conditions": "ContractAccess(\"CreditingStatusUpdate\")", - "type":"varchar" + "type": "varchar" }, { - "name":"date_created", - "conditions":"false", - "type":"number" + "name": "date_created", + "conditions": "false", + "type": "number" }, { - "name":"date_ended", + "name": "date_ended", "conditions": "ContractAccess(\"CreditingAdd\")", - "type":"number" + "type": "number" }, { - "name":"date_started", + "name": "date_started", "conditions": "ContractAccess(\"CreditingAdd\")", - "type":"number" + "type": "number" }, { - "name":"deleted", + "name": "deleted", "conditions": "ContractAccess(\"CreditingBlock\",\"CreditingDel\")", - "type":"number" + "type": "number" }, { - "name":"rate", + "name": "rate", "conditions": "ContractAccess(\"CreditingStatusUpdate\")", - "type":"number" + "type": "number" }, { - "name":"sign_borrower", + "name": "sign_borrower", "conditions": "ContractAccess(\"CreditingSignAccept\")", - "type":"number" + "type": "number" }, { - "name":"sign_creditor", + "name": "sign_creditor", "conditions": "ContractAccess(\"CreditingSignAccept\")", - "type":"number" + "type": "number" }, { - "name":"status", + "name": "status", "conditions": "ContractAccess(\"CreditingStatusUpdate\", \"CreditingSignReject\", \"CreditingSignAccept\", \"CreditingBlock\", \"CreditingDel\")", - "type":"number" + "type": "number" }, { - "name":"term", + "name": "term", "conditions": "ContractAccess(\"CreditingAdd\")", - "type":"text" + "type": "text" }, { - "name":"description", + "name": "description", "conditions": "ContractAccess(\"CreditingAdd\")", - "type":"text" + "type": "text" }, { - "name":"offer_id", + "name": "offer_id", "conditions": "ContractAccess(\"CreditingStatusUpdate\")", - "type":"number" + "type": "number" }, { - "name":"offer_date", + "name": "offer_date", "conditions": "ContractAccess(\"CreditingStatusUpdate\")", - "type":"number" + "type": "number" }, { - "name":"pub_borrower", + "name": "pub_borrower", "conditions": "ContractAccess(\"CreditingSignAccept\")", - "type":"text" + "type": "text" }, { - "name":"pub_creditor", + "name": "pub_creditor", "conditions": "ContractAccess(\"CreditingSignAccept\")", - "type":"text" + "type": "text" } ] \ No newline at end of file diff --git a/ecosystem_apps/crediting/tables/crediting_subs.json b/ecosystem_apps/crediting/tables/crediting_subs.json index 4aadc4c7c..a3e0fd16b 100644 --- a/ecosystem_apps/crediting/tables/crediting_subs.json +++ b/ecosystem_apps/crediting/tables/crediting_subs.json @@ -1,17 +1,17 @@ [ { - "name":"creditor", - "conditions":"false", - "type":"varchar" + "name": "creditor", + "conditions": "false", + "type": "varchar" }, { - "name":"deleted", + "name": "deleted", "conditions": "ContractAccess(\"CreditingSubscribe\")", - "type":"number" + "type": "number" }, { - "name":"request_id", - "conditions":"false", - "type":"number" + "name": "request_id", + "conditions": "false", + "type": "number" } ] \ No newline at end of file diff --git a/ecosystem_apps/crowdfunding.json b/ecosystem_apps/crowdfunding.json index 7e683821d..2690af9f9 100644 --- a/ecosystem_apps/crowdfunding.json +++ b/ecosystem_apps/crowdfunding.json @@ -111,13 +111,13 @@ }, { "Name": "investment_participants", - "Columns": "[\n {\n \"name\":\"amount\",\n \"conditions\":\"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\":\"money\"\n },\n {\n \"name\":\"ecosystem_id\",\n \"conditions\":\"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\":\"text\"\n },\n {\n \"name\":\"member_id\",\n \"conditions\":\"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\":\"number\"\n },\n {\n \"name\":\"investment_date\",\n \"conditions\":\"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\":\"number\"\n },\n {\n \"name\":\"startup_id\",\n \"conditions\":\"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\":\"text\"\n }\n]\n", + "Columns": "[\n {\n \"name\": \"amount\",\n \"conditions\": \"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"money\"\n },\n {\n \"name\": \"ecosystem_id\",\n \"conditions\": \"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"text\"\n },\n {\n \"name\": \"account\",\n \"conditions\": \"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"varchar\"\n },\n {\n \"name\": \"investment_date\",\n \"conditions\": \"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n },\n {\n \"name\": \"startup_id\",\n \"conditions\": \"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"text\"\n }\n]", "Permissions": "{\"read\": \"true\", \"insert\": \"ContractAccess(\\\"@1InvestStartup\\\")\", \"update\": \"false\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", "Type": "tables" }, { "Name": "startups", - "Columns": "[\n {\n \"name\":\"collected_amount\",\n \"conditions\":\"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1InvestStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\":\"money\"\n },\n {\n \"name\":\"collected_percent\",\n \"conditions\":\"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1InvestStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\":\"text\"\n },\n {\n \"name\":\"creator\",\n \"conditions\":\"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1CreateStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\":\"json\"\n },\n {\n \"name\":\"date_created\",\n \"conditions\":\"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1CreateStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\":\"number\"\n },\n {\n \"name\":\"date_ended\",\n \"conditions\":\"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1CreateStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\":\"number\"\n },\n {\n \"name\":\"date_started\",\n \"conditions\":\"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1CreateStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\":\"number\"\n },\n {\n \"name\":\"deleted\",\n \"conditions\":\"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1DelStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\":\"number\"\n },\n {\n \"name\":\"ecosystem\",\n \"conditions\":\"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1CreateStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\":\"number\"\n },\n {\n \"name\":\"informations\",\n \"conditions\":\"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1CreateStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\":\"json\"\n },\n {\n \"name\":\"min_investment\",\n \"conditions\":\"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1CreateStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\":\"money\"\n },\n {\n \"name\":\"required_amount\",\n \"conditions\":\"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1CreateStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\":\"money\"\n },\n {\n \"name\":\"share_capital\",\n \"conditions\":\"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1CreateStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\":\"number\"\n },\n {\n \"name\":\"status\",\n \"conditions\":\"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1StartupsStatusUpdate\\\\\\\",\\\\\\\"@1DelStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\":\"number\"\n }\n]", + "Columns": "[\n {\n \"name\": \"collected_amount\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1InvestStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"money\"\n },\n {\n \"name\": \"collected_percent\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1InvestStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"text\"\n },\n {\n \"name\": \"creator\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1CreateStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"json\"\n },\n {\n \"name\": \"date_created\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1CreateStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n },\n {\n \"name\": \"date_ended\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1CreateStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n },\n {\n \"name\": \"date_started\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1CreateStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n },\n {\n \"name\": \"deleted\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1DelStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n },\n {\n \"name\": \"ecosystem\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1CreateStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n },\n {\n \"name\": \"informations\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1CreateStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"json\"\n },\n {\n \"name\": \"min_investment\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1CreateStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"money\"\n },\n {\n \"name\": \"required_amount\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1CreateStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"money\"\n },\n {\n \"name\": \"share_capital\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1CreateStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n },\n {\n \"name\": \"status\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"@1StartupsStatusUpdate\\\\\\\",\\\\\\\"@1DelStartup\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n }\n]", "Permissions": "{\"read\": \"true\", \"insert\": \"ContractAccess(\\\"@1CreateStartup\\\")\", \"update\": \"ContractAccess(\\\"@1CreateStartup\\\",\\\"@1InvestStartup\\\",\\\"@1StartupsStatusUpdate\\\",\\\"@1DelStartup\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", "Type": "tables" }, @@ -142,42 +142,42 @@ { "Name": "create_startup", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "If(#stid# > 0){\n DBFind(\"@1startups\").WhereId(#stid#).Columns(\"id,informations,informations->name,informations->description,informations->link,date_started,date_ended,required_amount,min_investment,share_capital,ecosystem,deleted,creator,creator->member_address,creator->member_name,creator->member_id,status\").Vars(edit)\n}\nForm(){ \n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: $@1name$)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){ \n If(#edit_id# > 0){\n Input(Name: StartupName,Value: #edit_informations_name#)\n }.Else{\n Input(Name: StartupName)\n }\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: $@1description$)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){ \n If(#edit_id# > 0){\n Input(Name: Description, Value: #edit_informations_description#)\n }.Else{ \n Input(Name: Description)\n }\n }\n }.Style(padding-top:10px;)\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: $@1link$)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){ \n If(#edit_id# > 0){\n Input(Name: SiteLink, Value: #edit_informations_link#)\n }.Else{\n Input(Name: SiteLink)\n }\n }\n }.Style(padding-top:10px;)\n Div(Class: mt-sm){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1date_start)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n If(#stid# > 0){\n SetVar(st_d, DateTime(DateTime: #edit_date_started#, Format: \"YYYY-MM-DD\"))\n SetVar(st_t, DateTime(DateTime: #edit_date_started#, Format: \"HH:MI\"))\n }\n If(#stid# > 0){\n Div(col-md-6){\n Input(Name: StartDate, Type: date,Value: #st_d#)\n }\n Div(col-md-6){\n Input(Name: StartTime, Type: time,Value: #st_t#)\n }\n }.Else{\n Div(col-md-6){\n Input(Name: StartDate, Type: date)\n }\n Div(col-md-6){\n Input(Name: StartTime, Type: time, Value: \"00:00\")\n }\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1date_end)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n If(#stid# > 0){\n SetVar(et_d, DateTime(DateTime: #edit_date_ended#, Format: \"YYYY-MM-DD\"))\n SetVar(et_t, DateTime(DateTime: #edit_date_ended#, Format: \"HH:MI\"))\n }\n If(#stid# > 0){\n Div(col-md-6){\n Input(Name: EndDate, Type: date,Value: #et_d#)\n }\n Div(col-md-6){\n Input(Name: EndTime, Type: time, Value: #et_t#)\n }\n }.Else{\n Div(col-md-6){\n Input(Name: EndDate, Type: date)\n }\n Div(col-md-6){\n Input(Name: EndTime, Type: time, Value: \"00:00\")\n }\n }\n }\n }\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: $@1required_amount$)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){ \n If(#edit_id# > 0){\n SetVar(r_a,Money(#edit_required_amount#))\n Input(Name: RequiredAmount, Type: number, Value: #r_a#)\n }.Else{\n Input(Name: RequiredAmount, Type: number)\n }\n }\n }.Style(padding-top:10px;)\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: $@1min_investment$)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){ \n If(#edit_id# > 0){\n SetVar(m_a,Money(#edit_min_investment#))\n Input(Name: MinAmount, Type: number, Value: #m_a#)\n }.Else{\n Input(Name: MinAmount, Type: number)\n }\n }\n }.Style(padding-top:10px;)\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: $@1share_capital$)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){ \n If(#edit_id# > 0){\n Input(Name: ShareCapital, Type: number, Value: #edit_share_capital#)\n }.Else{\n Input(Name: ShareCapital, Type: number)\n }\n }\n }.Style(padding-top:10px;)\n }\n Div(row mt){\n Div(col-md-12 text-right){\n Button(Body: $@1back$, Class: btn btn-default, Page: #back_page#)\n If(#edit_id# > 0){\n Button(Body: $@1edit$, Class: btn btn-primary, Contract: CreateStartup, Params: \"StId=#stid#,Action=edit\", Page: #back_page#)\n }.Else{\n Button(Body: $@1create$, Class: btn btn-primary, Contract: CreateStartup, Page: #back_page#)\n }\n }\n }\n}\n ", + "Value": "If(#stid# > 0){\n DBFind(\"@1startups\").WhereId(#stid#).Columns(\"id,informations,informations->name,informations->description,informations->link,date_started,date_ended,required_amount,min_investment,share_capital,ecosystem,deleted,creator,creator->member_name,creator->account,status\").Vars(edit)\n}\nForm(){ \n Div(list-group-item){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: $@1name$)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){ \n If(#edit_id# > 0){\n Input(Name: StartupName,Value: #edit_informations_name#)\n }.Else{\n Input(Name: StartupName)\n }\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: $@1description$)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){ \n If(#edit_id# > 0){\n Input(Name: Description, Value: #edit_informations_description#)\n }.Else{ \n Input(Name: Description)\n }\n }\n }.Style(padding-top:10px;)\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: $@1link$)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){ \n If(#edit_id# > 0){\n Input(Name: SiteLink, Value: #edit_informations_link#)\n }.Else{\n Input(Name: SiteLink)\n }\n }\n }.Style(padding-top:10px;)\n Div(Class: mt-sm){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1date_start)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n If(#stid# > 0){\n SetVar(st_d, DateTime(DateTime: #edit_date_started#, Format: \"YYYY-MM-DD\"))\n SetVar(st_t, DateTime(DateTime: #edit_date_started#, Format: \"HH:MI\"))\n }\n If(#stid# > 0){\n Div(col-md-6){\n Input(Name: StartDate, Type: date,Value: #st_d#)\n }\n Div(col-md-6){\n Input(Name: StartTime, Type: time,Value: #st_t#)\n }\n }.Else{\n Div(col-md-6){\n Input(Name: StartDate, Type: date)\n }\n Div(col-md-6){\n Input(Name: StartTime, Type: time, Value: \"00:00\")\n }\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1date_end)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n If(#stid# > 0){\n SetVar(et_d, DateTime(DateTime: #edit_date_ended#, Format: \"YYYY-MM-DD\"))\n SetVar(et_t, DateTime(DateTime: #edit_date_ended#, Format: \"HH:MI\"))\n }\n If(#stid# > 0){\n Div(col-md-6){\n Input(Name: EndDate, Type: date,Value: #et_d#)\n }\n Div(col-md-6){\n Input(Name: EndTime, Type: time, Value: #et_t#)\n }\n }.Else{\n Div(col-md-6){\n Input(Name: EndDate, Type: date)\n }\n Div(col-md-6){\n Input(Name: EndTime, Type: time, Value: \"00:00\")\n }\n }\n }\n }\n }\n }\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: $@1required_amount$)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){ \n If(#edit_id# > 0){\n SetVar(r_a,Money(#edit_required_amount#))\n Input(Name: RequiredAmount, Type: number, Value: #r_a#)\n }.Else{\n Input(Name: RequiredAmount, Type: number)\n }\n }\n }.Style(padding-top:10px;)\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: $@1min_investment$)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){ \n If(#edit_id# > 0){\n SetVar(m_a,Money(#edit_min_investment#))\n Input(Name: MinAmount, Type: number, Value: #m_a#)\n }.Else{\n Input(Name: MinAmount, Type: number)\n }\n }\n }.Style(padding-top:10px;)\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n Span(Body: $@1share_capital$)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){ \n If(#edit_id# > 0){\n Input(Name: ShareCapital, Type: number, Value: #edit_share_capital#)\n }.Else{\n Input(Name: ShareCapital, Type: number)\n }\n }\n }.Style(padding-top:10px;)\n }\n Div(row mt){\n Div(col-md-12 text-right){\n Button(Body: $@1back$, Class: btn btn-default, Page: #back_page#)\n If(#edit_id# > 0){\n Button(Body: $@1edit$, Class: btn btn-primary, Contract: CreateStartup, Params: \"StId=#stid#,Action=edit\", Page: #back_page#)\n }.Else{\n Button(Body: $@1create$, Class: btn btn-primary, Contract: CreateStartup, Page: #back_page#)\n }\n }\n }\n}\n ", "Menu": "default_menu", "Type": "pages" }, { "Name": "crowdfunding_settings", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Crowdfunding\"}).Vars(\"app\")\nDBFind(\"@1roles\", src_roles).Where({\"ecosystem\": #ecosystem_id#, \"deleted\": 0}).Columns(\"role_name,id\").Limit(100)\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-4 text-right mt-sm\").(col_right,\"col-sm-8 text-left\")\n\nSetVar(this_page, \"crowdfunding_settings\").(role_admin,0).(role_startup,0).(role_investor,0)\nSetVar(role_admin, AppParam(App: #app_id#, Name: \"crowdfunding_admin_role\"))\nSetVar(role_startup, AppParam(App: #app_id#, Name: \"crowdfunding_startup_role\"))\nSetVar(role_investor, AppParam(App: #app_id#, Name: \"crowdfunding_investor_role\"))\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(@1crowdfunding_settings)\n }\n Div(text-center text-muted){\n LangRes(@1crowdfunding_settings_description)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n \"Admin\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleAdmin, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_admin#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_admin# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #role_admin#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n \"Startup\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleStartup, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_startup#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_startup# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #role_startup#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n \"Investor\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleInvestor, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_investor#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_investor# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #role_investor#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1apply_settings$, Class: btn btn-primary, Page: #this_page#, Contract: @1CrowdfundingSettings)\n }\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Crowdfunding\"}).Vars(app)\nDBFind(\"@1roles\", src_roles).Where({\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0}).Columns(\"role_name,id\").Limit(100)\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-4 text-right mt-sm\").(col_right,\"col-sm-8 text-left\")\n\nSetVar(this_page, \"crowdfunding_settings\").(role_admin,0).(role_startup,0).(role_investor,0)\nSetVar(role_admin, AppParam(App: #app_id#, Name: \"crowdfunding_admin_role\"))\nSetVar(role_startup, AppParam(App: #app_id#, Name: \"crowdfunding_startup_role\"))\nSetVar(role_investor, AppParam(App: #app_id#, Name: \"crowdfunding_investor_role\"))\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(@1crowdfunding_settings)\n }\n Div(text-center text-muted){\n LangRes(@1crowdfunding_settings_description)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n \"Admin\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleAdmin, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_admin#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_admin# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#role_admin#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n \"Startup\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleStartup, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_startup#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_startup# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#role_startup#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n \"Investor\"\n }\n }\n Div(#col_right#){\n Select(Name: RoleInvestor, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_investor#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_investor# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#role_investor#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1apply_settings$, Class: btn btn-primary, Page: #this_page#, Contract: @1CrowdfundingSettings)\n }\n }\n }\n }\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "startup_filter", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Crowdfunding\"}).Vars(application)\nSetVar(admin_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crowdfunding_admin_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": #ecosystem_id#, \"$and\": [\"role->id\": {\"$in\": [#admin_role#]}, \"role->id\": #role_id#], \"member->member_id\": #key_id#, \"deleted\": 0}).Vars(admin_access)\n\nIf(#admin_access_id# > 0){\n Data(type_status, \"value,name\"){\n -1,$@1deleted$\n 0,$@1waiting$\n 1,$@1started$\n 2,$@1finished$\n }\n}.Else{\n Data(type_status, \"value,name\"){\n 0,$@1waiting$\n 1,$@1started$\n 2,$@1finished$\n }\n}\nForm(text-center){\n Label(Class: m0){\n Span(Body: LangRes(startup_filter_desc))\n }\n Div(row text-left){\n Div(col-md-5){}\n Div(col-md-7){\n RadioGroup(Name: Filter, Source: type_status, NameColumn: name, ValueColumn: value)\n }\n }\n Button(Body: LangRes(@1filter), Class: btn btn-primary pull-right, Page: #back_page#, PageParams: \"page_par=Val(Filter),search=#search#\")\n Button(Body: LangRes(@1clear), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"page_par=NULL,search=#search#\")\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Crowdfunding\"}).Vars(application)\nSetVar(admin_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crowdfunding_admin_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#admin_role#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(#admin_access_id# > 0){\n Data(type_status, \"value,name\"){\n -1,$@1deleted$\n 0,$@1waiting$\n 1,$@1started$\n 2,$@1finished$\n }\n}.Else{\n Data(type_status, \"value,name\"){\n 0,$@1waiting$\n 1,$@1started$\n 2,$@1finished$\n }\n}\nForm(text-center){\n Label(Class: m0){\n Span(Body: LangRes(startup_filter_desc))\n }\n Div(row text-left){\n Div(col-md-5){}\n Div(col-md-7){\n RadioGroup(Name: Filter, Source: type_status, NameColumn: name, ValueColumn: value)\n }\n }\n Button(Body: LangRes(@1filter), Class: btn btn-primary pull-right, Page: #back_page#, PageParams: \"page_par=Val(Filter),search=#search#\")\n Button(Body: LangRes(@1clear), Class: btn btn-default pull-right, Page: #back_page#, PageParams: \"page_par=NULL,search=#search#\")\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "startup_list", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "SetVar(this_page, @1startup_list).(this_table, @1startups)\nInclude(@1pager_header)\n\nSetTitle(Startups list)\n\nDBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Crowdfunding\"}).Vars(application)\nSetVar(admin_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crowdfunding_admin_role))\nSetVar(startup_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crowdfunding_startup_role))\nSetVar(investor_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crowdfunding_investor_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": #ecosystem_id#, \"$and\": [\"role->id\": {\"$in\": [#admin_role#]}, \"role->id\": #role_id#], \"member->member_id\": #key_id#, \"deleted\": 0}).Vars(admin_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": #ecosystem_id#, \"$and\": [\"role->id\": {\"$in\": [#startup_role#]}, \"role->id\": #role_id#], \"member->member_id\": #key_id#, \"deleted\": 0}).Vars(startup_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": #ecosystem_id#, \"$and\": [\"role->id\": {\"$in\": [#investor_role#]}, \"role->id\": #role_id#], \"member->member_id\": #key_id#, \"deleted\": 0}).Vars(investor_access)\n\nIf(#page_par#==0){\n SetVar(type_filter, {\"status\": 0})\n}.ElseIf(#page_par#==1){\n SetVar(type_filter, {\"status\": 1})\n}.ElseIf(#page_par#==2){\n SetVar(type_filter, {\"status\": {\"$gte\": 2}})\n}.ElseIf(#page_par#==-1){\n SetVar(type_filter, {\"status\": -1})\n}\n\nIf(#startup_access_id# > 0){\n AddToolButton(Title: $@1create$, Page: create_startup, Icon: icon-plus, PageParams: \"back_page = #this_page#\").Popup(50, \"New startup\")\n}\nIf(Or(#startup_access_id# > 0,#admin_access_id# > 0, #investor_access_id# > 0)){\n SetVar(global_access,1)\n}\nIf(#global_access# == 1){\n Div(mr-lg text-right){\n If(#admin_access_id# > 0){\n Button(Body: Em(Class: fa fa-refresh) $@1update_statuses$, Class: btn bg-gray mr-lg, Page: #this_page#, Contract: @1StartupsStatusUpdate)\n }\n Button(Page: startup_filter, Class: btn bg-gray-lighter mr-sm, PageParams: \"page_par=#page_par#,search=#search#,back_page=#this_page#\", Body: Em(Class: fa fa-filter) $@1filter$).Popup(Header: $@1filter$, Width: \"30\")\n If(#type_filter#){\n Button(Page: #this_page#, PageParams: \"page_par=NULL,search=#search#\", Class: btn bg-gray-lighter mr-sm, Body: Em(Class: fa fa-close))\n }\n }\n Div(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1name)).(search, #search#)\n Include(@1search)\n }\n\n If(#search#){\n If(#startup_access_id# > 0){\n SetVar(where, {\"deleted\":0, #type_filter#, \"informations->name\": {\"$ilike\": \"#search#\"}})\n }.ElseIf(#investor_access_id# > 0){\n SetVar(where, {\"deleted\":0, #type_filter#, \"informations->name\": {\"$ilike\": \"#search#\"}})\n }.ElseIf(#admin_access_id# > 0){\n SetVar(where, {#type_filter#,\"informations->name\": {\"$ilike\": \"#search#\"}})\n }.Else{\n SetVar(where, {\"status\":10})\n }\n }.Else{\n If(#startup_access_id# > 0){\n SetVar(where, {#type_filter#, \"deleted\":0})\n }.ElseIf(#investor_access_id# > 0){\n SetVar(where, {#type_filter#, \"deleted\":0})\n }.ElseIf(#admin_access_id# > 0){\n SetVar(where, {#type_filter#})\n }.Else{\n SetVar(where, {\"status\":10})\n }\n }\n\n DBFind(#this_table#,Source: src_start).Columns(\"id,collected_amount,informations,informations->name,informations->description,informations->link,date_started,date_ended,required_amount,min_investment,share_capital,ecosystem,deleted,creator,creator->member_address,creator->member_name,creator->member_id,status,date_created,collected_percent\").Where(#where#).Offset(#pager_offset#).Limit(#pager_limit#).Custom(_name){\n Div(button-group text-nowrap){\n LinkPage(Class: text-primary h5 text-bold, Page: @1startup_view, PageParams: \"stid=#id#,back_page=#this_page#\"){\n Span(Class: text-primary ml-sm, Body: #informations.name#)\n }\n }\n }.Custom(_creator){ \n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#creator.member_id#\"){\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(){\n If(#creator.member_name# == \"\"){\n Span(Body: #creator.member_address#)\n }.Else{\n Span(Body: #creator.member_name#)\n }\n }\n }.Style(display:flex; align-items:center;) \n } \n }.Custom(_collected){\n If(#status# > 0){\n If(#collected_percent# > 0){\n Span(Class: h5 text-bold, Body: #collected_percent# %)\n }.Else{\n Span(Class: h5 text-bold, Body: 0 %) \n }\n }.Else{\n Span(Class: h5 text-bold, Body: 0 %)\n }\n }.Custom(_date){\n P(Class: h6 m0, Body: DateTime(DateTime: #date_started#, Format: HH:MI DD.MM.YYYY))\n P(Class: h6 m0, Body: DateTime(DateTime: #date_ended#, Format: HH:MI DD.MM.YYYY))\n }.Custom(req_amount){\n Span(Class: text-bold, Body: Money(#required_amount#) APLA)\n }.Custom(min_amount){\n Span(Body: Money(#min_investment#))\n }.Custom(_edit){\n Div(pull-right){\n If(And(#startup_access_id# > 0,#creator.member_id# == #key_id#)){\n If(#status# == 0){\n Button(Class: btn bg-gray-lighter mh-sm buttons, PageParams: \"stid=#id#,back_page=#this_page#\", Page: @1create_startup){\n Em(Class: text-default fa fa-1x fa-edit)\n }.Popup(50, $@1edit$)\n Button(Class: btn bg-gray-lighter mh-sm buttons, Contract: @1DelStartup, Params: \"StId=#id#\", Page: @1startup_list){\n Em(Class: text-danger fa fa-1x fa-trash)\n }.Alert(Text: \"$@1sure_want_delete$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }.ElseIf(#admin_access_id# > 0){\n If(And(#status# < 2,#status# != -1)){\n Button(Class: btn bg-gray-lighter buttons, Contract: @1DelStartup, Params: \"StId=#id#\", Page: @1startup_list){\n Em(Class: text-danger fa fa-1x fa-trash)\n }.Alert(Text: \"$@1sure_want_delete$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n }.Style(\n .buttons{border: 1px solid #dde6e9;}\n )\n }.Custom(_status){\n If(#status# == 0){\n Span(Class: text-warning, Body: $@1waiting$)\n }.ElseIf(#status# == 1){\n Span(Class: text-primary, Body: $@1started$)\n }.ElseIf(#status# == 2){\n Span(Class: text-success, Body: $@1finished$)\n }.ElseIf(#status# == 3){\n Span(Class: text-danger, Body: $@1finished$)\n }.ElseIf(#status# == -1){\n Span(Class: text-danger, Body: $@1deleted$)\n }\n }.Custom(_date_created){\n P(Class: h6 m0, Body: DateTime(DateTime: #date_created#, Format: HH:MI DD.MM.YYYY))\n }.Order({\"status\": \"-1\",\"date_started\": \"-1\"}).Count(check_comp)\n\n Div(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#check_comp# > 0){\n Table(Source: src_start, Columns: \"$@1name$=_name,$@1required_amount$=req_amount,$@1creator$=_creator,$@1date_start$ / $@1date_end$=_date,$@1date_created$=_date_created,$@1collected_funds$=_collected,$@1status$=_status,=_edit\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: $@1startups_not_found$)\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n }\n Div(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n }\n}.Else{\n Div(row ml-lg mr-lg){\n Div(md-12 alert h4 text-bold text-center){\n Span(Body: LangRes(startup_attention))\n }\n }\n}", + "Value": "SetVar(this_page, @1startup_list).(this_table, @1startups)\nInclude(@1pager_header)\n\nSetTitle(Startups list)\n\nDBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Crowdfunding\"}).Vars(application)\nSetVar(admin_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crowdfunding_admin_role))\nSetVar(startup_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crowdfunding_startup_role))\nSetVar(investor_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crowdfunding_investor_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#admin_role#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#startup_role#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(startup_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#investor_role#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(investor_access)\n\nIf(#page_par# == 0){\n SetVar(type_filter, `, \"status\": 0`)\n}.ElseIf(#page_par# == 1){\n SetVar(type_filter, `, \"status\": 1`)\n}.ElseIf(#page_par# == 2){\n SetVar(type_filter, `, \"status\": {\"$gte\": 2}`)\n}.ElseIf(#page_par# == -1){\n SetVar(type_filter, `, \"status\": \"-1\"`)\n}\n\nIf(#startup_access_id# > 0){\n AddToolButton(Title: $@1create$, Page: create_startup, Icon: icon-plus, PageParams: \"back_page = #this_page#\").Popup(50, \"New startup\")\n}\nIf(Or(#startup_access_id# > 0,#admin_access_id# > 0, #investor_access_id# > 0)){\n SetVar(global_access,1)\n}\nIf(#global_access# == 1){\n Div(mr-lg text-right){\n If(#admin_access_id# > 0){\n Button(Body: Em(Class: fa fa-refresh) $@1update_statuses$, Class: btn bg-gray mr-lg, Page: #this_page#, Contract: @1StartupsStatusUpdate)\n }\n Button(Page: startup_filter, Class: btn bg-gray-lighter mr-sm, PageParams: \"page_par=#page_par#,search=#search#,back_page=#this_page#\", Body: Em(Class: fa fa-filter) $@1filter$).Popup(Header: $@1filter$, Width: \"30\")\n If(#type_filter#){\n Button(Page: #this_page#, PageParams: \"page_par=NULL,search=#search#\", Class: btn bg-gray-lighter mr-sm, Body: Em(Class: fa fa-close))\n }\n }\n Div(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1name)).(search, #search#)\n Include(@1search)\n }\n\n If(#search#){\n If(#startup_access_id# > 0){\n SetVar(where, {\"deleted\": 0, \"informations->name\": {\"$ilike\": \"#search#\"} #type_filter#})\n }.ElseIf(#investor_access_id# > 0){\n SetVar(where, {\"deleted\": 0, \"informations->name\": {\"$ilike\": \"#search#\"} #type_filter#})\n }.ElseIf(#admin_access_id# > 0){\n SetVar(where, {\"informations->name\": {\"$ilike\": \"#search#\"} #type_filter#})\n }.Else{\n SetVar(where, {\"status\": 10})\n }\n }.Else{\n If(#startup_access_id# > 0){\n SetVar(where, {\"deleted\": 0 #type_filter#})\n }.ElseIf(#investor_access_id# > 0){\n SetVar(where, {\"deleted\": 0 #type_filter#})\n }.ElseIf(#admin_access_id# > 0){\n SetVar(where, {#type_filter#})\n }.Else{\n SetVar(where, {\"status\": 10})\n }\n }\n\n DBFind(#this_table#, src_start).Where(#where#).Columns(\"id,collected_amount,informations,informations->name,informations->description,informations->link,date_started,date_ended,required_amount,min_investment,share_capital,ecosystem,deleted,creator,creator->member_name,creator->account,status,date_created,collected_percent\").Offset(#pager_offset#).Limit(#pager_limit#).Custom(_name){\n Div(button-group text-nowrap){\n LinkPage(Class: text-primary h5 text-bold, Page: @1startup_view, PageParams: \"stid=#id#,back_page=#this_page#\"){\n Span(Class: text-primary ml-sm, Body: #informations.name#)\n }\n }\n }.Custom(_creator){ \n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#creator.account#\"){\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(){\n If(#creator.member_name#){\n Span(Body: #creator.member_name#)\n }.Else{\n Span(Body: #creator.account#)\n }\n }\n }.Style(display:flex; align-items:center;) \n } \n }.Custom(_collected){\n If(#status# > 0){\n If(#collected_percent# > 0){\n Span(Class: h5 text-bold, Body: #collected_percent# %)\n }.Else{\n Span(Class: h5 text-bold, Body: 0 %) \n }\n }.Else{\n Span(Class: h5 text-bold, Body: 0 %)\n }\n }.Custom(_date){\n P(Class: h6 m0, Body: DateTime(DateTime: #date_started#, Format: HH:MI DD.MM.YYYY))\n P(Class: h6 m0, Body: DateTime(DateTime: #date_ended#, Format: HH:MI DD.MM.YYYY))\n }.Custom(req_amount){\n Span(Class: text-bold, Body: Money(#required_amount#) APLA)\n }.Custom(min_amount){\n Span(Body: Money(#min_investment#))\n }.Custom(_edit){\n Div(pull-right){\n If(And(#startup_access_id# > 0, #creator.account# == #account_id#)){\n If(#status# == 0){\n Button(Class: btn bg-gray-lighter mh-sm buttons, PageParams: \"stid=#id#,back_page=#this_page#\", Page: @1create_startup){\n Em(Class: text-default fa fa-1x fa-edit)\n }.Popup(50, $@1edit$)\n Button(Class: btn bg-gray-lighter mh-sm buttons, Contract: @1DelStartup, Params: \"StId=#id#\", Page: @1startup_list){\n Em(Class: text-danger fa fa-1x fa-trash)\n }.Alert(Text: \"$@1sure_want_delete$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }.ElseIf(#admin_access_id# > 0){\n If(And(#status# < 2,#status# != -1)){\n Button(Class: btn bg-gray-lighter buttons, Contract: @1DelStartup, Params: \"StId=#id#\", Page: @1startup_list){\n Em(Class: text-danger fa fa-1x fa-trash)\n }.Alert(Text: \"$@1sure_want_delete$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n }.Style(\n .buttons{border: 1px solid #dde6e9;}\n )\n }.Custom(_status){\n If(#status# == 0){\n Span(Class: text-warning, Body: $@1waiting$)\n }.ElseIf(#status# == 1){\n Span(Class: text-primary, Body: $@1started$)\n }.ElseIf(#status# == 2){\n Span(Class: text-success, Body: $@1finished$)\n }.ElseIf(#status# == 3){\n Span(Class: text-danger, Body: $@1finished$)\n }.ElseIf(#status# == -1){\n Span(Class: text-danger, Body: $@1deleted$)\n }\n }.Custom(_date_created){\n P(Class: h6 m0, Body: DateTime(DateTime: #date_created#, Format: HH:MI DD.MM.YYYY))\n }.Order({\"status\": \"-1\", \"date_started\": \"-1\"}).Count(check_comp)\n\n Div(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#check_comp# > 0){\n Table(Source: src_start, Columns: \"$@1name$=_name,$@1required_amount$=req_amount,$@1creator$=_creator,$@1date_start$ / $@1date_end$=_date,$@1date_created$=_date_created,$@1collected_funds$=_collected,$@1status$=_status,=_edit\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: $@1startups_not_found$)\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n }\n Div(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n }\n}.Else{\n Div(row ml-lg mr-lg){\n Div(md-12 alert h4 text-bold text-center){\n Span(Body: LangRes(startup_attention))\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "startup_view", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "DBFind(\"@1startups\").WhereId(#stid#).Columns(\"id,collected_percent,date_created,collected_amount,informations,informations->name,informations->description,informations->link,date_started,date_ended,required_amount,min_investment,share_capital,ecosystem,deleted,creator,creator->member_address,creator->member_name,creator->member_id,status\").Vars(view)\nDBFind(\"@1roles\").Columns(\"id,role_name,deleted,ecosystem\").Where({\"role_name\":\"Investor\",\"deleted\":0,\"ecosystem\":#ecosystem_id#}).Vars(check_role_invest)\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-10 col-lg-offset-1){\n Form(panel panel-primary){\n Div(list-group-item text-center){\n P(Class: h3 text-bold m0, Body: #view_informations_name#)\n Div(row){\n Div(col-md-12){\n Div(Class: t5 text-muted m0, Body: #view_informations_description#)\n }\n }\n }\n Div(list-group-item text-center){\n P(Class: h5 text-center text-bold m0 mb mt-sm, Body: $@1information$)\n Div(row mb mt-lg t5){\n Div(col-md-6 mt-sm text-right){\n LangRes($@1creator$)\n }\n Div(col-md-6 text-left){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#view_creator_member_id#\"){\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n If(#view_creator_member_name# == \"\"){\n Span(Class: h5 m0, Body: #view_creator_member_address#)\n }.Else{\n Span(Class: h5 m0, Body: #view_creator_member_name#)\n }\n }.Style(display:flex; align-items:center;)\n } \n }\n }\n Div(row t6 mt-lg){\n Div(col-md-6 text-right){\n Span(Class: h6, Body: LangRes($@1link$))\n }\n Div(col-md-6 text-left){\n Span(Class: h6, Body: #view_informations_link#)\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n Span(Class: h6, Body: LangRes($@1share_capital$))\n }\n Div(col-md-6 text-left){\n Span(Class: h6, Body: #view_share_capital#)\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n Span(Class: h6, Body: LangRes($@1date_created$))\n }\n Div(col-md-6 text-left){\n Span(Class: h6, Body: DateTime(DateTime: #view_date_created#, Format: HH:MI DD.MM.YYYY))\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n Span(Class: h6, Body: LangRes($@1date_start$))\n }\n Div(col-md-6 text-left){\n Span(Class: h6, Body: DateTime(DateTime: #view_date_started#, Format: HH:MI DD.MM.YYYY))\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n Span(Class: h6, Body: LangRes($@1date_end$))\n }\n Div(col-md-6 text-left){\n Span(Class: h6, Body: DateTime(DateTime: #view_date_ended#, Format: HH:MI DD.MM.YYYY))\n }\n }\n Div(row mt-lg t5){\n Div(col-md-6 text-right){\n Span(Body: LangRes($@1collected_funds$))\n }\n Div(col-md-6 text-left){\n Span(Body: Money(#view_collected_amount#) APLA / Money(#view_required_amount#) APLA)\n }\n }\n Div(row t5){\n Div(col-md-6 text-right){\n Span(Body: LangRes($@1status$))\n }\n Div(col-md-6 text-left){\n If(#view_status# == 0){\n Span(Class: text-warning, Body: $@1waiting$)\n }.ElseIf(#view_status# == 1){\n Span(Class: text-primary, Body: $@1started$)\n }.ElseIf(#view_status# == 2){\n Span(Class: text-success, Body: $@1finished$)\n }.ElseIf(#view_status# == 3){\n Span(Class: text-danger, Body: $@1finished$)\n }.ElseIf(#view_status# == -1){\n Span(Class: text-danger, Body: $@1deleted$)\n }\n }\n }\n Div(row mb-sm t5){\n Div(col-md-6 text-right){\n Span(Body: LangRes($@1percent$))\n }\n Div(col-md-6 text-left){\n If(#view_collected_percent# >= 100) {\n Span(Class: text-success, Body: #view_collected_percent# %)\n }.Else{\n If(#view_collected_percent# == \" \"){\n Span(Class: text-danger, Body: 0%)\n }.Else{\n Span(Class: text-danger, Body: #view_collected_percent#%)\n }\n }\n }\n }\n }\n If(And(#check_role_invest_id# == #role_id#,#view_status# == 1)){\n Div(list-group-item){\n Div(row){\n Div(col-lg-8 col-lg-offset-2 text-center){\n Span(Class: h5 mr, Body: LangRes($@1min_investment$):)\n Span(Class: h5, Body: Money(#view_min_investment#) APLA)\n Div(input-group){\n Div(input-group-addon){\n $@1amount$\n }\n Input(Name: Invest, Type: number)\n Div(input-group-btn){\n Button(Class: btn btn-success mtl buttons, Page: @1startup_view, Body: $@1investment_amount$, Contract: InvestStartup, Params: \"StartupId=#stid#\", PageParams: \"stid=#stid#\")\n }\n }\n }.Style(\n .buttons{border: 1px solid #dde6e9;}\n )\n }.Style(padding-bottom:10px;)\n }\n }\n DBFind(\"@1investment_participants\",src_investment).Where({\"startup_id\": #stid#}).Custom(_investor){\n DBFind(@1members).Where({\"ecosystem\": #ecosystem_id#, \"id\": #member_id#}).Vars(c)\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#c_id#\"){\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(){\n If(#c_member_name# == \"\"){\n Address(#member_id#)\n }.Else{\n P(Class: h6 m0, Body: #c_member_name#)\n }\n }\n }.Style(display:flex; align-items:center;)\n }\n }.Custom(_date){\n Span(Class: h6 text-muted, Body: DateTime(DateTime: #investment_date#, Format: HH:MI DD.MM.YYYY))\n }.Custom(_amount){\n Span(Class: h5, Body: Money(#amount#) APLA)\n }.Count(count_investment)\n If(#count_investment# > 0){\n Div(list-group-item){\n P(Class: h5 text-center text-bold m0 mb mt-sm, Body: $@1investor_list$)\n Div(row mt){\n Div(col-lg-7 col-lg-offset-3){\n Table(Source: src_investment,Columns: \"$@1name$=_investor,$@1date_created$=_date,$@1amount$=_amount\")\n }\n }\n }\n }\n Div(list-group-item){\n Button(Class: btn bg-gray-lighter ml-sm buttons, Page: @1startup_list){\n Span(Em(Class: fa fa-chevron-left fa-1x)\n Span(Class: ml-sm, Body: LangRes($@1back$))\n }\n }\n }.Style(\n .buttons{border: 1px solid #dde6e9;}\n )\n }\n }\n}.Style(\n .preview {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n .t3 {font-size:24px;}\n .t4 {font-size:18px;}\n .t5 {font-size:14px;}\n .t6 {font-size:12px;}\n .break {word-break: break-all;}\n)", + "Value": "DBFind(\"@1startups\").WhereId(#stid#).Columns(\"id,collected_percent,date_created,collected_amount,informations,informations->name,informations->description,informations->link,date_started,date_ended,required_amount,min_investment,share_capital,ecosystem,deleted,creator,creator->member_name,creator->account,status\").Vars(view)\nDBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Crowdfunding\"}).Vars(application)\nSetVar(investor_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crowdfunding_investor_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#investor_role#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(investor_access)\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-10 col-lg-offset-1){\n Form(panel panel-primary){\n Div(list-group-item text-center){\n P(Class: h3 text-bold m0, Body: #view_informations_name#)\n Div(row){\n Div(col-md-12){\n Div(Class: t5 text-muted m0, Body: #view_informations_description#)\n }\n }\n }\n Div(list-group-item text-center){\n P(Class: h5 text-center text-bold m0 mb mt-sm, Body: $@1information$)\n Div(row mb mt-lg t5){\n Div(col-md-6 mt-sm text-right){\n LangRes($@1creator$)\n }\n Div(col-md-6 text-left){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#view_creator_account#\"){\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n If(#view_creator_member_name#){\n Span(Class: h5 m0, Body: #view_creator_member_name#)\n }.Else{\n Span(Class: h5 m0, Body: #view_creator_account#)\n }\n }.Style(display:flex; align-items:center;)\n } \n }\n }\n Div(row t6 mt-lg){\n Div(col-md-6 text-right){\n Span(Class: h6, Body: LangRes($@1link$))\n }\n Div(col-md-6 text-left){\n Span(Class: h6, Body: #view_informations_link#)\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n Span(Class: h6, Body: LangRes($@1share_capital$))\n }\n Div(col-md-6 text-left){\n Span(Class: h6, Body: #view_share_capital#)\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n Span(Class: h6, Body: LangRes($@1date_created$))\n }\n Div(col-md-6 text-left){\n Span(Class: h6, Body: DateTime(DateTime: #view_date_created#, Format: HH:MI DD.MM.YYYY))\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n Span(Class: h6, Body: LangRes($@1date_start$))\n }\n Div(col-md-6 text-left){\n Span(Class: h6, Body: DateTime(DateTime: #view_date_started#, Format: HH:MI DD.MM.YYYY))\n }\n }\n Div(row t6){\n Div(col-md-6 text-right){\n Span(Class: h6, Body: LangRes($@1date_end$))\n }\n Div(col-md-6 text-left){\n Span(Class: h6, Body: DateTime(DateTime: #view_date_ended#, Format: HH:MI DD.MM.YYYY))\n }\n }\n Div(row mt-lg t5){\n Div(col-md-6 text-right){\n Span(Body: LangRes($@1collected_funds$))\n }\n Div(col-md-6 text-left){\n Span(Body: Money(#view_collected_amount#) APLA / Money(#view_required_amount#) APLA)\n }\n }\n Div(row t5){\n Div(col-md-6 text-right){\n Span(Body: LangRes($@1status$))\n }\n Div(col-md-6 text-left){\n If(#view_status# == 0){\n Span(Class: text-warning, Body: $@1waiting$)\n }.ElseIf(#view_status# == 1){\n Span(Class: text-primary, Body: $@1started$)\n }.ElseIf(#view_status# == 2){\n Span(Class: text-success, Body: $@1finished$)\n }.ElseIf(#view_status# == 3){\n Span(Class: text-danger, Body: $@1finished$)\n }.ElseIf(#view_status# == -1){\n Span(Class: text-danger, Body: $@1deleted$)\n }\n }\n }\n Div(row mb-sm t5){\n Div(col-md-6 text-right){\n Span(Body: LangRes($@1percent$))\n }\n Div(col-md-6 text-left){\n If(#view_collected_percent# >= 100) {\n Span(Class: text-success, Body: #view_collected_percent# %)\n }.Else{\n If(#view_collected_percent# == \" \"){\n Span(Class: text-danger, Body: 0%)\n }.Else{\n Span(Class: text-danger, Body: #view_collected_percent#%)\n }\n }\n }\n }\n }\n If(And(#investor_access_id# > 0, #view_status# == 1)){\n Div(list-group-item){\n Div(row){\n Div(col-lg-8 col-lg-offset-2 text-center){\n Span(Class: h5 mr, Body: LangRes($@1min_investment$):)\n Span(Class: h5, Body: Money(#view_min_investment#) APLA)\n Div(input-group){\n Div(input-group-addon){\n $@1amount$\n }\n Input(Name: Invest, Type: number)\n Div(input-group-btn){\n Button(Class: btn btn-success mtl buttons, Page: @1startup_view, Body: $@1investment_amount$, Contract: InvestStartup, Params: \"StartupId=#stid#\", PageParams: \"stid=#stid#\")\n }\n }\n }.Style(\n .buttons{border: 1px solid #dde6e9;}\n )\n }.Style(padding-bottom:10px;)\n }\n }\n DBFind(\"@1investment_participants\", src_investment).Where({\"startup_id\": \"#stid#\"}).Custom(_investor){\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#account#\"}).Vars(c)\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#c_account#\"){\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right: 10px;)\n Span(){\n If(#c_member_name#){\n P(Class: h6 m0, Body: #c_member_name#)\n }.Else{\n #account#\n }\n }\n }.Style(display:flex; align-items:center;)\n }\n }.Custom(_date){\n Span(Class: h6 text-muted, Body: DateTime(DateTime: #investment_date#, Format: HH:MI DD.MM.YYYY))\n }.Custom(_amount){\n Span(Class: h5, Body: Money(#amount#) APLA)\n }.Count(count_investment)\n If(#count_investment# > 0){\n Div(list-group-item){\n P(Class: h5 text-center text-bold m0 mb mt-sm, Body: $@1investor_list$)\n Div(row mt){\n Div(col-lg-7 col-lg-offset-3){\n Table(Source: src_investment,Columns: \"$@1name$=_investor,$@1date_created$=_date,$@1amount$=_amount\")\n }\n }\n }\n }\n Div(list-group-item){\n Button(Class: btn bg-gray-lighter ml-sm buttons, Page: @1startup_list){\n Span(Em(Class: fa fa-chevron-left fa-1x)\n Span(Class: ml-sm, Body: LangRes($@1back$))\n }\n }\n }.Style(\n .buttons{border: 1px solid #dde6e9;}\n )\n }\n }\n}.Style(\n .preview {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n .t3 {font-size:24px;}\n .t4 {font-size:18px;}\n .t5 {font-size:14px;}\n .t6 {font-size:12px;}\n .break {word-break: break-all;}\n)", "Menu": "default_menu", "Type": "pages" }, { "Name": "CreateStartup", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "contract CreateStartup {\n data {\n StartupName string\n Description string\n SiteLink string\n StartDate string\n StartTime string\n EndDate string\n EndTime string\n RequiredAmount money\n MinAmount money\n ShareCapital int\n Action string \"optional\"\n StId int \"optional\"\n }\n\n func trimZeroTime(s string) string {\n if Contains(s, \"T00:00:00Z\") {\n s = Replace(s, \"T00:00:00Z\", \"\")\n }\n return s\n }\n\n func dateAddTime(d, t string) string {\n var dt string\n if Size(t) == 5 {\n dt = Sprintf(\"%v %v:00\", trimZeroTime(d), t)\n }\n return dt\n }\n\n func isCalledFromPage() bool {\n return $stack[0] == Sprintf(\"@%v%v\", $ecosystem_id, $this_contract)\n }\n\n func fixDatetimes() {\n $date_started = UnixDateTime(dateAddTime($StartDate, $StartTime))\n $date_ended = UnixDateTime(dateAddTime($EndDate, $EndTime))\n\n if $date_started == 0 || $date_ended == 0 { // invalid datetimes\n if isCalledFromPage() {\n var errs array\n if Size($StartDate) < 10 {\n errs = Append(errs, \"starting date\")\n }\n if Size($StartTime) < 5 {\n errs = Append(errs, \"starting time\")\n }\n if Size($EndDate) < 10 {\n errs = Append(errs, \"ending date\")\n }\n if Size($EndTime) < 5 {\n errs = Append(errs, \"ending time\")\n }\n warning Sprintf(LangRes(\"@1startup_creation_error_x_unspecified\", \"en\"), Join(errs, \", \"))\n } else {\n $date_started = $block_time\n $Interval = Int($Interval)\n if $Interval == 0 {\n $Interval = 3\n }\n $date_ended = $date_started + 3600 * 24 * $Interval\n }\n }\n if $date_started < $block_time {\n warning LangRes(\"@1starting_date_invalid\", \"en\")\n }\n if $date_started >= $date_ended {\n warning LangRes(\"@1ending_date_invalid\", \"en\")\n }\n }\n\n conditions {\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Crowdfunding\"}).One(\"id\")\n $check_access = AppParam(Int($app), \"crowdfunding_startup_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+$check_access+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n if !$StartupName {\n warning LangRes(\"@1empty_name\", \"en\")\n }\n if !$Description {\n warning LangRes(\"@1description_empty\", \"en\")\n }\n if !$SiteLink {\n warning LangRes(\"@1link_empty\", \"en\")\n }\n if Money($RequiredAmount) <= Money(0) {\n warning LangRes(\"@1required_amount_empty\", \"en\")\n }\n if Money($MinAmount) <= Money(0) {\n warning LangRes(\"@1minimum_amount_empty\", \"en\")\n }\n if !$ShareCapital {\n warning LangRes(\"@1share_capital_empty\", \"en\")\n }\n \n $startup = DBFind(\"@1startups\").WhereId($StId).Row()\n if $StartDate || $StartTime || $EndDate || $EndTime {\n fixDatetimes()\n }\n }\n\n action { \n var information creator m map\n information[\"name\"] = $StartupName\n information[\"description\"] = $Description\n information[\"link\"] = $SiteLink\n\n $member_name = DBFind(\"@1members\").WhereId($key_id).One(\"member_name\")\n creator[\"member_id\"] = $key_id\n if $member_name {\n creator[\"member_name\"] = $member_name\n } else {\n creator[\"member_name\"] = IdToAddress($key_id)\n }\n creator[\"member_address\"] = IdToAddress($key_id)\n\n m[\"informations\"] = information\n m[\"creator\"] = creator\n m[\"date_started\"] = $date_started\n m[\"date_ended\"] = $date_ended\n m[\"required_amount\"] = $RequiredAmount\n m[\"min_investment\"] = $MinAmount\n m[\"share_capital\"] = $ShareCapital\n m[\"ecosystem\"] = $ecosystem_id\n \n if $Action == \"edit\" {\n DBUpdate(\"@1startups\",$StId,m)\n } else {\n m[\"date_created\"] = $block_time\n DBInsert(\"@1startups\",m)\n }\n }\n}", + "Value": "contract CreateStartup {\n data {\n StartupName string\n Description string\n SiteLink string\n StartDate string\n StartTime string\n EndDate string\n EndTime string\n RequiredAmount money\n MinAmount money\n ShareCapital int\n Action string \"optional\"\n StId int \"optional\"\n }\n\n func trimZeroTime(s string) string {\n if Contains(s, \"T00:00:00Z\") {\n s = Replace(s, \"T00:00:00Z\", \"\")\n }\n return s\n }\n\n func dateAddTime(d, t string) string {\n var dt string\n if Size(t) == 5 {\n dt = Sprintf(\"%v %v:00\", trimZeroTime(d), t)\n }\n return dt\n }\n\n func isCalledFromPage() bool {\n return $stack[0] == Sprintf(\"@%v%v\", $ecosystem_id, $this_contract)\n }\n\n func fixDatetimes() {\n $date_started = UnixDateTime(dateAddTime($StartDate, $StartTime))\n $date_ended = UnixDateTime(dateAddTime($EndDate, $EndTime))\n\n if $date_started == 0 || $date_ended == 0 { // invalid datetimes\n if isCalledFromPage() {\n var errs array\n if Size($StartDate) < 10 {\n errs = Append(errs, \"starting date\")\n }\n if Size($StartTime) < 5 {\n errs = Append(errs, \"starting time\")\n }\n if Size($EndDate) < 10 {\n errs = Append(errs, \"ending date\")\n }\n if Size($EndTime) < 5 {\n errs = Append(errs, \"ending time\")\n }\n warning Sprintf(LangRes(\"@1startup_creation_error_x_unspecified\", \"en\"), Join(errs, \", \"))\n } else {\n $date_started = $block_time\n $Interval = Int($Interval)\n if $Interval == 0 {\n $Interval = 3\n }\n $date_ended = $date_started + 3600 * 24 * $Interval\n }\n }\n if $date_started < $block_time {\n warning LangRes(\"@1starting_date_invalid\", \"en\")\n }\n if $date_started >= $date_ended {\n warning LangRes(\"@1ending_date_invalid\", \"en\")\n }\n }\n\n conditions {\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Crowdfunding\"}).One(\"id\")\n $check_access = AppParam(Int($app), \"crowdfunding_startup_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+$check_access+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n if !$StartupName {\n warning LangRes(\"@1empty_name\", \"en\")\n }\n if !$Description {\n warning LangRes(\"@1description_empty\", \"en\")\n }\n if !$SiteLink {\n warning LangRes(\"@1link_empty\", \"en\")\n }\n if Money($RequiredAmount) <= Money(0) {\n warning LangRes(\"@1required_amount_empty\", \"en\")\n }\n if Money($MinAmount) <= Money(0) {\n warning LangRes(\"@1minimum_amount_empty\", \"en\")\n }\n if !$ShareCapital {\n warning LangRes(\"@1share_capital_empty\", \"en\")\n }\n \n $startup = DBFind(\"@1startups\").WhereId($StId).Row()\n if $StartDate || $StartTime || $EndDate || $EndTime {\n fixDatetimes()\n }\n }\n\n action { \n var information creator m map\n information[\"name\"] = $StartupName\n information[\"description\"] = $Description\n information[\"link\"] = $SiteLink\n\n $member_name = DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"account\": $account_id}).One(\"member_name\")\n creator[\"account\"] = $account_id\n if $member_name {\n creator[\"member_name\"] = $member_name\n } else {\n creator[\"member_name\"] = $account_id\n }\n\n m[\"informations\"] = information\n m[\"creator\"] = creator\n m[\"date_started\"] = $date_started\n m[\"date_ended\"] = $date_ended\n m[\"required_amount\"] = $RequiredAmount\n m[\"min_investment\"] = $MinAmount\n m[\"share_capital\"] = $ShareCapital\n m[\"ecosystem\"] = $ecosystem_id\n \n if $Action == \"edit\" {\n DBUpdate(\"@1startups\", $StId, m)\n } else {\n m[\"date_created\"] = $block_time\n DBInsert(\"@1startups\", m)\n }\n }\n}", "Type": "contracts" }, { @@ -189,19 +189,19 @@ { "Name": "InvestTransfer", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "contract InvestTransfer {\n data {\n RowId int\n Action string\n Summ money \"optional\"\n }\n\n conditions {}\n\n action {\n var s map\n if $Action == \"Invest\" {\n @1TokensIncDeposit(\"Amount\",$Summ)\n }\n if $Action == \"Finished\" {\n $check_startup = DBFind(\"@1startups\").WhereId($RowId).Columns(\"id,creator,creator->member_id,status\").Row()\n var participants array i int req d s map\n participants = DBFind(\"@1investment_participants\").Where({\"startup_id\":$RowId})\n if Int($check_startup[\"status\"]) == 2 {\n while i < Len(participants) { \n req = participants[i]\n @1TokensDecDeposit(\"MemberId,Amount\",Int(req[\"member_id\"]),Money(req[\"amount\"]))\n @1TokensTransfer(\"Amount,SenderId,RecipientId\",Money(req[\"amount\"]),Int(req[\"member_id\"]),Int($check_startup[\"creator.member_id\"]))\n i = i + 1\n }\n } else {\n while i < Len(participants) { \n req = participants[i]\n @1TokensDecDeposit(\"MemberId,Amount\",Int(req[\"member_id\"]),Money(req[\"amount\"]))\n i = i + 1\n }\n }\n }\n }\n}", + "Value": "contract InvestTransfer {\n data {\n RowId int\n Action string\n Summ money \"optional\"\n }\n\n conditions {}\n\n action {\n var s map\n if $Action == \"Invest\" {\n @1TokensIncDeposit(\"Amount\",$Summ)\n }\n if $Action == \"Finished\" {\n $check_startup = DBFind(\"@1startups\").WhereId($RowId).Columns(\"id,creator,creator->account,status\").Row()\n var participants array i int req d s map\n participants = DBFind(\"@1investment_participants\").Where({\"startup_id\": $RowId})\n if Int($check_startup[\"status\"]) == 2 {\n while i < Len(participants) { \n req = participants[i]\n @1TokensDecDeposit(\"MemberAccount,Amount\", req[\"account\"], Money(req[\"amount\"]))\n @1TokensTransfer(\"Amount,SenderAccount,RecipientAccount\", Money(req[\"amount\"]), req[\"account\"], $check_startup[\"creator.account\"])\n i = i + 1\n }\n } else {\n while i < Len(participants) { \n req = participants[i]\n @1TokensDecDeposit(\"MemberAccount,Amount\", req[\"account\"], Money(req[\"amount\"]))\n i = i + 1\n }\n }\n }\n }\n}", "Type": "contracts" }, { "Name": "DelStartup", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "contract DelStartup {\n data {\n StId int\n }\n\n conditions {\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Crowdfunding\"}).One(\"id\")\n $check_creator = DBFind(\"@1startups\").WhereId($StId).Columns(\"id,creator,creator->member_id\").Row()\n $check_access_admin = AppParam(Int($app), \"crowdfunding_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+$check_access_admin+\"]\")\n if Int($check_creator[\"creator.member_id\"]) != $key_id {\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n } \n }\n\n action {\n $startup = DBFind(\"@1startups\").WhereId($StId).Row()\n if $startup[\"status\"] == 1 && Money($startup[\"collected_amount\"]) > 0 {\n @1InvestTransfer(\"RowId,Action\", $StId, \"Finished\")\n }\n\n var m map\n m[\"deleted\"] = 1\n m[\"status\"] = -1\n DBUpdate(\"@1startups\", $StId, m)\n }\n}", + "Value": "contract DelStartup {\n data {\n StId int\n }\n\n conditions {\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Crowdfunding\"}).One(\"id\")\n $check_creator = DBFind(\"@1startups\").WhereId($StId).Columns(\"id,creator,creator->account\").Row()\n $check_access_admin = AppParam(Int($app), \"crowdfunding_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+$check_access_admin+\"]\")\n if $check_creator[\"creator.account\"] != $account_id {\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n } \n }\n\n action {\n $startup = DBFind(\"@1startups\").WhereId($StId).Row()\n if $startup[\"status\"] == 1 && Money($startup[\"collected_amount\"]) > 0 {\n @1InvestTransfer(\"RowId,Action\", $StId, \"Finished\")\n }\n\n var m map\n m[\"deleted\"] = 1\n m[\"status\"] = -1\n DBUpdate(\"@1startups\", $StId, m)\n }\n}", "Type": "contracts" }, { "Name": "InvestStartup", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "contract InvestStartup {\n data {\n StartupId int\n Invest money\n }\n\n conditions {\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Crowdfunding\"}).One(\"id\")\n $check_access = AppParam(Int($app), \"crowdfunding_investor_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+$check_access+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n $info_startup= DBFind(\"@1startups\").WhereId($StartupId).Row()\n if Money($info_startup[\"min_investment\"]) > Money($Invest) {\n warning LangRes(\"@1less_investment\", \"en\")\n }\n }\n\n action { \n var m t map\n m[\"member_id\"] = $key_id\n m[\"ecosystem_id\"] = $ecosystem_id\n m[\"startup_id\"] = $StartupId\n m[\"amount\"] = $Invest\n m[\"investment_date\"] = $block_time\n \n @1InvestTransfer(\"Action,RowId,Summ\",\"Invest\",$StartupId,$Invest)\n \n t[\"+collected_amount\"] = $Invest\n var percent invested summ int\n summ = Money($info_startup[\"required_amount\"]) / Money(1000000000000000000)\n invested = (Money($info_startup[\"collected_amount\"]) + Money($Invest)) / Money(1000000000000000000)\n percent = (Money(invested)*Money(100))/Money(summ)\n t[\"collected_percent\"] = percent\n\n DBInsert(\"@1investment_participants\",m)\n DBUpdate(\"@1startups\",$StartupId,t)\n }\n}", + "Value": "contract InvestStartup {\n data {\n StartupId int\n Invest money\n }\n\n conditions {\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Crowdfunding\"}).One(\"id\")\n $check_access = AppParam(Int($app), \"crowdfunding_investor_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+$check_access+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n $info_startup= DBFind(\"@1startups\").WhereId($StartupId).Row()\n if Money($info_startup[\"min_investment\"]) > Money($Invest) {\n warning LangRes(\"@1less_investment\", \"en\")\n }\n }\n\n action { \n var m t map\n m[\"account\"] = $account_id\n m[\"ecosystem_id\"] = $ecosystem_id\n m[\"startup_id\"] = $StartupId\n m[\"amount\"] = $Invest\n m[\"investment_date\"] = $block_time\n \n @1InvestTransfer(\"Action,RowId,Summ\", \"Invest\", $StartupId,$Invest)\n \n t[\"+collected_amount\"] = $Invest\n var percent invested summ int\n summ = Money($info_startup[\"required_amount\"]) / Money(1000000000000000000)\n invested = (Money($info_startup[\"collected_amount\"]) + Money($Invest)) / Money(1000000000000000000)\n percent = (Money(invested)*Money(100))/Money(summ)\n t[\"collected_percent\"] = percent\n\n DBInsert(\"@1investment_participants\", m)\n DBUpdate(\"@1startups\", $StartupId, t)\n }\n}", "Type": "contracts" }, { diff --git a/ecosystem_apps/crowdfunding/contracts/CreateStartup.sim b/ecosystem_apps/crowdfunding/contracts/CreateStartup.sim index 8a3013091..58be3428b 100644 --- a/ecosystem_apps/crowdfunding/contracts/CreateStartup.sim +++ b/ecosystem_apps/crowdfunding/contracts/CreateStartup.sim @@ -75,7 +75,7 @@ contract CreateStartup { $check_access = AppParam(Int($app), "crowdfunding_startup_role", $ecosystem_id) var rids array rids = JSONDecode("["+$check_access+"]") - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() { warning LangRes("@1access_denied", "en") } @@ -110,14 +110,13 @@ contract CreateStartup { information["description"] = $Description information["link"] = $SiteLink - $member_name = DBFind("@1members").WhereId($key_id).One("member_name") - creator["member_id"] = $key_id + $member_name = DBFind("@1members").Where({"ecosystem": $ecosystem_id, "account": $account_id}).One("member_name") + creator["account"] = $account_id if $member_name { creator["member_name"] = $member_name } else { - creator["member_name"] = IdToAddress($key_id) + creator["member_name"] = $account_id } - creator["member_address"] = IdToAddress($key_id) m["informations"] = information m["creator"] = creator @@ -129,10 +128,10 @@ contract CreateStartup { m["ecosystem"] = $ecosystem_id if $Action == "edit" { - DBUpdate("@1startups",$StId,m) + DBUpdate("@1startups", $StId, m) } else { m["date_created"] = $block_time - DBInsert("@1startups",m) + DBInsert("@1startups", m) } } } \ No newline at end of file diff --git a/ecosystem_apps/crowdfunding/contracts/DelStartup.sim b/ecosystem_apps/crowdfunding/contracts/DelStartup.sim index 6b5c9eaa3..3de98da76 100644 --- a/ecosystem_apps/crowdfunding/contracts/DelStartup.sim +++ b/ecosystem_apps/crowdfunding/contracts/DelStartup.sim @@ -5,12 +5,12 @@ contract DelStartup { conditions { $app = DBFind("@1applications").Where({"ecosystem": $ecosystem_id, "name": "Crowdfunding"}).One("id") - $check_creator = DBFind("@1startups").WhereId($StId).Columns("id,creator,creator->member_id").Row() + $check_creator = DBFind("@1startups").WhereId($StId).Columns("id,creator,creator->account").Row() $check_access_admin = AppParam(Int($app), "crowdfunding_admin_role", $ecosystem_id) var rids array rids = JSONDecode("["+$check_access_admin+"]") - if Int($check_creator["creator.member_id"]) != $key_id { - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() { + if $check_creator["creator.account"] != $account_id { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() { warning LangRes("@1access_denied", "en") } } diff --git a/ecosystem_apps/crowdfunding/contracts/InvestStartup.sim b/ecosystem_apps/crowdfunding/contracts/InvestStartup.sim index fd5e05ff7..be874b0dd 100644 --- a/ecosystem_apps/crowdfunding/contracts/InvestStartup.sim +++ b/ecosystem_apps/crowdfunding/contracts/InvestStartup.sim @@ -9,7 +9,7 @@ contract InvestStartup { $check_access = AppParam(Int($app), "crowdfunding_investor_role", $ecosystem_id) var rids array rids = JSONDecode("["+$check_access+"]") - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() { warning LangRes("@1access_denied", "en") } @@ -21,13 +21,13 @@ contract InvestStartup { action { var m t map - m["member_id"] = $key_id + m["account"] = $account_id m["ecosystem_id"] = $ecosystem_id m["startup_id"] = $StartupId m["amount"] = $Invest m["investment_date"] = $block_time - @1InvestTransfer("Action,RowId,Summ","Invest",$StartupId,$Invest) + @1InvestTransfer("Action,RowId,Summ", "Invest", $StartupId,$Invest) t["+collected_amount"] = $Invest var percent invested summ int @@ -36,7 +36,7 @@ contract InvestStartup { percent = (Money(invested)*Money(100))/Money(summ) t["collected_percent"] = percent - DBInsert("@1investment_participants",m) - DBUpdate("@1startups",$StartupId,t) + DBInsert("@1investment_participants", m) + DBUpdate("@1startups", $StartupId, t) } } \ No newline at end of file diff --git a/ecosystem_apps/crowdfunding/contracts/InvestTransfer.sim b/ecosystem_apps/crowdfunding/contracts/InvestTransfer.sim index 4d14fd36e..2d04a638e 100644 --- a/ecosystem_apps/crowdfunding/contracts/InvestTransfer.sim +++ b/ecosystem_apps/crowdfunding/contracts/InvestTransfer.sim @@ -13,20 +13,20 @@ contract InvestTransfer { @1TokensIncDeposit("Amount",$Summ) } if $Action == "Finished" { - $check_startup = DBFind("@1startups").WhereId($RowId).Columns("id,creator,creator->member_id,status").Row() + $check_startup = DBFind("@1startups").WhereId($RowId).Columns("id,creator,creator->account,status").Row() var participants array i int req d s map - participants = DBFind("@1investment_participants").Where({"startup_id":$RowId}) + participants = DBFind("@1investment_participants").Where({"startup_id": $RowId}) if Int($check_startup["status"]) == 2 { while i < Len(participants) { req = participants[i] - @1TokensDecDeposit("MemberId,Amount",Int(req["member_id"]),Money(req["amount"])) - @1TokensTransfer("Amount,SenderId,RecipientId",Money(req["amount"]),Int(req["member_id"]),Int($check_startup["creator.member_id"])) + @1TokensDecDeposit("MemberAccount,Amount", req["account"], Money(req["amount"])) + @1TokensTransfer("Amount,SenderAccount,RecipientAccount", Money(req["amount"]), req["account"], $check_startup["creator.account"]) i = i + 1 } } else { while i < Len(participants) { req = participants[i] - @1TokensDecDeposit("MemberId,Amount",Int(req["member_id"]),Money(req["amount"])) + @1TokensDecDeposit("MemberAccount,Amount", req["account"], Money(req["amount"])) i = i + 1 } } diff --git a/ecosystem_apps/crowdfunding/pages/create_startup.ptl b/ecosystem_apps/crowdfunding/pages/create_startup.ptl index f05b2b931..98fd267b9 100644 --- a/ecosystem_apps/crowdfunding/pages/create_startup.ptl +++ b/ecosystem_apps/crowdfunding/pages/create_startup.ptl @@ -1,5 +1,5 @@ If(#stid# > 0){ - DBFind("@1startups").WhereId(#stid#).Columns("id,informations,informations->name,informations->description,informations->link,date_started,date_ended,required_amount,min_investment,share_capital,ecosystem,deleted,creator,creator->member_address,creator->member_name,creator->member_id,status").Vars(edit) + DBFind("@1startups").WhereId(#stid#).Columns("id,informations,informations->name,informations->description,informations->link,date_started,date_ended,required_amount,min_investment,share_capital,ecosystem,deleted,creator,creator->member_name,creator->account,status").Vars(edit) } Form(){ Div(list-group-item){ diff --git a/ecosystem_apps/crowdfunding/pages/crowdfunding_settings.ptl b/ecosystem_apps/crowdfunding/pages/crowdfunding_settings.ptl index ffa552b19..ada0dca97 100644 --- a/ecosystem_apps/crowdfunding/pages/crowdfunding_settings.ptl +++ b/ecosystem_apps/crowdfunding/pages/crowdfunding_settings.ptl @@ -1,5 +1,5 @@ -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Crowdfunding"}).Vars("app") -DBFind("@1roles", src_roles).Where({"ecosystem": #ecosystem_id#, "deleted": 0}).Columns("role_name,id").Limit(100) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Crowdfunding"}).Vars(app) +DBFind("@1roles", src_roles).Where({"ecosystem": "#ecosystem_id#", "deleted": 0}).Columns("role_name,id").Limit(100) SetVar(row,"row mt-sm").(col_left,"col-sm-4 text-right mt-sm").(col_right,"col-sm-8 text-left") SetVar(this_page, "crowdfunding_settings").(role_admin,0).(role_startup,0).(role_investor,0) @@ -29,7 +29,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#role_admin# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #role_admin#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#role_admin#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# @@ -47,7 +47,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#role_startup# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #role_startup#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#role_startup#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# @@ -65,7 +65,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#role_investor# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #role_investor#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#role_investor#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# diff --git a/ecosystem_apps/crowdfunding/pages/startup_filter.ptl b/ecosystem_apps/crowdfunding/pages/startup_filter.ptl index 2b5866a1b..c4a03f0ac 100644 --- a/ecosystem_apps/crowdfunding/pages/startup_filter.ptl +++ b/ecosystem_apps/crowdfunding/pages/startup_filter.ptl @@ -1,6 +1,6 @@ -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Crowdfunding"}).Vars(application) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Crowdfunding"}).Vars(application) SetVar(admin_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crowdfunding_admin_role)) -DBFind("@1roles_participants").Where({"ecosystem": #ecosystem_id#, "$and": ["role->id": {"$in": [#admin_role#]}, "role->id": #role_id#], "member->member_id": #key_id#, "deleted": 0}).Vars(admin_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#admin_role#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) If(#admin_access_id# > 0){ Data(type_status, "value,name"){ diff --git a/ecosystem_apps/crowdfunding/pages/startup_list.ptl b/ecosystem_apps/crowdfunding/pages/startup_list.ptl index 04a957318..303dc796f 100644 --- a/ecosystem_apps/crowdfunding/pages/startup_list.ptl +++ b/ecosystem_apps/crowdfunding/pages/startup_list.ptl @@ -3,22 +3,22 @@ Include(@1pager_header) SetTitle(Startups list) -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Crowdfunding"}).Vars(application) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Crowdfunding"}).Vars(application) SetVar(admin_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crowdfunding_admin_role)) SetVar(startup_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crowdfunding_startup_role)) SetVar(investor_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crowdfunding_investor_role)) -DBFind("@1roles_participants").Where({"ecosystem": #ecosystem_id#, "$and": ["role->id": {"$in": [#admin_role#]}, "role->id": #role_id#], "member->member_id": #key_id#, "deleted": 0}).Vars(admin_access) -DBFind("@1roles_participants").Where({"ecosystem": #ecosystem_id#, "$and": ["role->id": {"$in": [#startup_role#]}, "role->id": #role_id#], "member->member_id": #key_id#, "deleted": 0}).Vars(startup_access) -DBFind("@1roles_participants").Where({"ecosystem": #ecosystem_id#, "$and": ["role->id": {"$in": [#investor_role#]}, "role->id": #role_id#], "member->member_id": #key_id#, "deleted": 0}).Vars(investor_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#admin_role#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#startup_role#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(startup_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#investor_role#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(investor_access) -If(#page_par#==0){ - SetVar(type_filter, {"status": 0}) -}.ElseIf(#page_par#==1){ - SetVar(type_filter, {"status": 1}) -}.ElseIf(#page_par#==2){ - SetVar(type_filter, {"status": {"$gte": 2}}) -}.ElseIf(#page_par#==-1){ - SetVar(type_filter, {"status": -1}) +If(#page_par# == 0){ + SetVar(type_filter, `, "status": 0`) +}.ElseIf(#page_par# == 1){ + SetVar(type_filter, `, "status": 1`) +}.ElseIf(#page_par# == 2){ + SetVar(type_filter, `, "status": {"$gte": 2}`) +}.ElseIf(#page_par# == -1){ + SetVar(type_filter, `, "status": "-1"`) } If(#startup_access_id# > 0){ @@ -44,41 +44,41 @@ If(#global_access# == 1){ If(#search#){ If(#startup_access_id# > 0){ - SetVar(where, {"deleted":0, #type_filter#, "informations->name": {"$ilike": "#search#"}}) + SetVar(where, {"deleted": 0, "informations->name": {"$ilike": "#search#"} #type_filter#}) }.ElseIf(#investor_access_id# > 0){ - SetVar(where, {"deleted":0, #type_filter#, "informations->name": {"$ilike": "#search#"}}) + SetVar(where, {"deleted": 0, "informations->name": {"$ilike": "#search#"} #type_filter#}) }.ElseIf(#admin_access_id# > 0){ - SetVar(where, {#type_filter#,"informations->name": {"$ilike": "#search#"}}) + SetVar(where, {"informations->name": {"$ilike": "#search#"} #type_filter#}) }.Else{ - SetVar(where, {"status":10}) + SetVar(where, {"status": 10}) } }.Else{ If(#startup_access_id# > 0){ - SetVar(where, {#type_filter#, "deleted":0}) + SetVar(where, {"deleted": 0 #type_filter#}) }.ElseIf(#investor_access_id# > 0){ - SetVar(where, {#type_filter#, "deleted":0}) + SetVar(where, {"deleted": 0 #type_filter#}) }.ElseIf(#admin_access_id# > 0){ SetVar(where, {#type_filter#}) }.Else{ - SetVar(where, {"status":10}) + SetVar(where, {"status": 10}) } } - DBFind(#this_table#,Source: src_start).Columns("id,collected_amount,informations,informations->name,informations->description,informations->link,date_started,date_ended,required_amount,min_investment,share_capital,ecosystem,deleted,creator,creator->member_address,creator->member_name,creator->member_id,status,date_created,collected_percent").Where(#where#).Offset(#pager_offset#).Limit(#pager_limit#).Custom(_name){ + DBFind(#this_table#, src_start).Where(#where#).Columns("id,collected_amount,informations,informations->name,informations->description,informations->link,date_started,date_ended,required_amount,min_investment,share_capital,ecosystem,deleted,creator,creator->member_name,creator->account,status,date_created,collected_percent").Offset(#pager_offset#).Limit(#pager_limit#).Custom(_name){ Div(button-group text-nowrap){ LinkPage(Class: text-primary h5 text-bold, Page: @1startup_view, PageParams: "stid=#id#,back_page=#this_page#"){ Span(Class: text-primary ml-sm, Body: #informations.name#) } } }.Custom(_creator){ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#creator.member_id#"){ + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#creator.account#"){ Div(){ Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;) Span(){ - If(#creator.member_name# == ""){ - Span(Body: #creator.member_address#) - }.Else{ + If(#creator.member_name#){ Span(Body: #creator.member_name#) + }.Else{ + Span(Body: #creator.account#) } } }.Style(display:flex; align-items:center;) @@ -102,7 +102,7 @@ If(#global_access# == 1){ Span(Body: Money(#min_investment#)) }.Custom(_edit){ Div(pull-right){ - If(And(#startup_access_id# > 0,#creator.member_id# == #key_id#)){ + If(And(#startup_access_id# > 0, #creator.account# == #account_id#)){ If(#status# == 0){ Button(Class: btn bg-gray-lighter mh-sm buttons, PageParams: "stid=#id#,back_page=#this_page#", Page: @1create_startup){ Em(Class: text-default fa fa-1x fa-edit) @@ -135,7 +135,7 @@ If(#global_access# == 1){ } }.Custom(_date_created){ P(Class: h6 m0, Body: DateTime(DateTime: #date_created#, Format: HH:MI DD.MM.YYYY)) - }.Order({"status": "-1","date_started": "-1"}).Count(check_comp) + }.Order({"status": "-1", "date_started": "-1"}).Count(check_comp) Div(fullscreen){ Div(table-responsive ml-lg mr-lg){ diff --git a/ecosystem_apps/crowdfunding/pages/startup_view.ptl b/ecosystem_apps/crowdfunding/pages/startup_view.ptl index 0a978b609..6eb3c665a 100644 --- a/ecosystem_apps/crowdfunding/pages/startup_view.ptl +++ b/ecosystem_apps/crowdfunding/pages/startup_view.ptl @@ -1,5 +1,7 @@ -DBFind("@1startups").WhereId(#stid#).Columns("id,collected_percent,date_created,collected_amount,informations,informations->name,informations->description,informations->link,date_started,date_ended,required_amount,min_investment,share_capital,ecosystem,deleted,creator,creator->member_address,creator->member_name,creator->member_id,status").Vars(view) -DBFind("@1roles").Columns("id,role_name,deleted,ecosystem").Where({"role_name":"Investor","deleted":0,"ecosystem":#ecosystem_id#}).Vars(check_role_invest) +DBFind("@1startups").WhereId(#stid#).Columns("id,collected_percent,date_created,collected_amount,informations,informations->name,informations->description,informations->link,date_started,date_ended,required_amount,min_investment,share_capital,ecosystem,deleted,creator,creator->member_name,creator->account,status").Vars(view) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Crowdfunding"}).Vars(application) +SetVar(investor_role, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: crowdfunding_investor_role)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#investor_role#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(investor_access) Div(content-wrapper){ Div(row){ @@ -20,13 +22,13 @@ Div(content-wrapper){ LangRes($@1creator$) } Div(col-md-6 text-left){ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#view_creator_member_id#"){ + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#view_creator_account#"){ Div(){ Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;) - If(#view_creator_member_name# == ""){ - Span(Class: h5 m0, Body: #view_creator_member_address#) - }.Else{ + If(#view_creator_member_name#){ Span(Class: h5 m0, Body: #view_creator_member_name#) + }.Else{ + Span(Class: h5 m0, Body: #view_creator_account#) } }.Style(display:flex; align-items:center;) } @@ -115,7 +117,7 @@ Div(content-wrapper){ } } } - If(And(#check_role_invest_id# == #role_id#,#view_status# == 1)){ + If(And(#investor_access_id# > 0, #view_status# == 1)){ Div(list-group-item){ Div(row){ Div(col-lg-8 col-lg-offset-2 text-center){ @@ -136,16 +138,16 @@ Div(content-wrapper){ }.Style(padding-bottom:10px;) } } - DBFind("@1investment_participants",src_investment).Where({"startup_id": #stid#}).Custom(_investor){ - DBFind(@1members).Where({"ecosystem": #ecosystem_id#, "id": #member_id#}).Vars(c) - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#c_id#"){ + DBFind("@1investment_participants", src_investment).Where({"startup_id": "#stid#"}).Custom(_investor){ + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#account#"}).Vars(c) + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#c_account#"){ Div(){ - Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;) + Span(Em(Class: fa icon-user fa-2x)).Style(margin-right: 10px;) Span(){ - If(#c_member_name# == ""){ - Address(#member_id#) - }.Else{ + If(#c_member_name#){ P(Class: h6 m0, Body: #c_member_name#) + }.Else{ + #account# } } }.Style(display:flex; align-items:center;) diff --git a/ecosystem_apps/crowdfunding/tables/investment_participants.json b/ecosystem_apps/crowdfunding/tables/investment_participants.json index 699e5c2d8..8d5da6799 100644 --- a/ecosystem_apps/crowdfunding/tables/investment_participants.json +++ b/ecosystem_apps/crowdfunding/tables/investment_participants.json @@ -1,27 +1,27 @@ [ { - "name":"amount", - "conditions":"{\"update\":\"false\",\"read\":\"true\"}", - "type":"money" + "name": "amount", + "conditions": "{\"update\":\"false\",\"read\":\"true\"}", + "type": "money" }, { - "name":"ecosystem_id", - "conditions":"{\"update\":\"false\",\"read\":\"true\"}", - "type":"text" + "name": "ecosystem_id", + "conditions": "{\"update\":\"false\",\"read\":\"true\"}", + "type": "text" }, { - "name":"member_id", - "conditions":"{\"update\":\"false\",\"read\":\"true\"}", - "type":"number" + "name": "account", + "conditions": "{\"update\":\"false\",\"read\":\"true\"}", + "type": "varchar" }, { - "name":"investment_date", - "conditions":"{\"update\":\"false\",\"read\":\"true\"}", - "type":"number" + "name": "investment_date", + "conditions": "{\"update\":\"false\",\"read\":\"true\"}", + "type": "number" }, { - "name":"startup_id", - "conditions":"{\"update\":\"false\",\"read\":\"true\"}", - "type":"text" + "name": "startup_id", + "conditions": "{\"update\":\"false\",\"read\":\"true\"}", + "type": "text" } -] +] \ No newline at end of file diff --git a/ecosystem_apps/crowdfunding/tables/startups.json b/ecosystem_apps/crowdfunding/tables/startups.json index 1e5415398..b0a176d56 100644 --- a/ecosystem_apps/crowdfunding/tables/startups.json +++ b/ecosystem_apps/crowdfunding/tables/startups.json @@ -1,67 +1,67 @@ [ { - "name":"collected_amount", - "conditions":"{\"update\":\"ContractAccess(\\\"@1InvestStartup\\\")\",\"read\":\"true\"}", - "type":"money" + "name": "collected_amount", + "conditions": "{\"update\":\"ContractAccess(\\\"@1InvestStartup\\\")\",\"read\":\"true\"}", + "type": "money" }, { - "name":"collected_percent", - "conditions":"{\"update\":\"ContractAccess(\\\"@1InvestStartup\\\")\",\"read\":\"true\"}", - "type":"text" + "name": "collected_percent", + "conditions": "{\"update\":\"ContractAccess(\\\"@1InvestStartup\\\")\",\"read\":\"true\"}", + "type": "text" }, { - "name":"creator", - "conditions":"{\"update\":\"ContractAccess(\\\"@1CreateStartup\\\")\",\"read\":\"true\"}", - "type":"json" + "name": "creator", + "conditions": "{\"update\":\"ContractAccess(\\\"@1CreateStartup\\\")\",\"read\":\"true\"}", + "type": "json" }, { - "name":"date_created", - "conditions":"{\"update\":\"ContractAccess(\\\"@1CreateStartup\\\")\",\"read\":\"true\"}", - "type":"number" + "name": "date_created", + "conditions": "{\"update\":\"ContractAccess(\\\"@1CreateStartup\\\")\",\"read\":\"true\"}", + "type": "number" }, { - "name":"date_ended", - "conditions":"{\"update\":\"ContractAccess(\\\"@1CreateStartup\\\")\",\"read\":\"true\"}", - "type":"number" + "name": "date_ended", + "conditions": "{\"update\":\"ContractAccess(\\\"@1CreateStartup\\\")\",\"read\":\"true\"}", + "type": "number" }, { - "name":"date_started", - "conditions":"{\"update\":\"ContractAccess(\\\"@1CreateStartup\\\")\",\"read\":\"true\"}", - "type":"number" + "name": "date_started", + "conditions": "{\"update\":\"ContractAccess(\\\"@1CreateStartup\\\")\",\"read\":\"true\"}", + "type": "number" }, { - "name":"deleted", - "conditions":"{\"update\":\"ContractAccess(\\\"@1DelStartup\\\")\",\"read\":\"true\"}", - "type":"number" + "name": "deleted", + "conditions": "{\"update\":\"ContractAccess(\\\"@1DelStartup\\\")\",\"read\":\"true\"}", + "type": "number" }, { - "name":"ecosystem", - "conditions":"{\"update\":\"ContractAccess(\\\"@1CreateStartup\\\")\",\"read\":\"true\"}", - "type":"number" + "name": "ecosystem", + "conditions": "{\"update\":\"ContractAccess(\\\"@1CreateStartup\\\")\",\"read\":\"true\"}", + "type": "number" }, { - "name":"informations", - "conditions":"{\"update\":\"ContractAccess(\\\"@1CreateStartup\\\")\",\"read\":\"true\"}", - "type":"json" + "name": "informations", + "conditions": "{\"update\":\"ContractAccess(\\\"@1CreateStartup\\\")\",\"read\":\"true\"}", + "type": "json" }, { - "name":"min_investment", - "conditions":"{\"update\":\"ContractAccess(\\\"@1CreateStartup\\\")\",\"read\":\"true\"}", - "type":"money" + "name": "min_investment", + "conditions": "{\"update\":\"ContractAccess(\\\"@1CreateStartup\\\")\",\"read\":\"true\"}", + "type": "money" }, { - "name":"required_amount", - "conditions":"{\"update\":\"ContractAccess(\\\"@1CreateStartup\\\")\",\"read\":\"true\"}", - "type":"money" + "name": "required_amount", + "conditions": "{\"update\":\"ContractAccess(\\\"@1CreateStartup\\\")\",\"read\":\"true\"}", + "type": "money" }, { - "name":"share_capital", - "conditions":"{\"update\":\"ContractAccess(\\\"@1CreateStartup\\\")\",\"read\":\"true\"}", - "type":"number" + "name": "share_capital", + "conditions": "{\"update\":\"ContractAccess(\\\"@1CreateStartup\\\")\",\"read\":\"true\"}", + "type": "number" }, { - "name":"status", - "conditions":"{\"update\":\"ContractAccess(\\\"@1StartupsStatusUpdate\\\",\\\"@1DelStartup\\\")\",\"read\":\"true\"}", - "type":"number" + "name": "status", + "conditions": "{\"update\":\"ContractAccess(\\\"@1StartupsStatusUpdate\\\",\\\"@1DelStartup\\\")\",\"read\":\"true\"}", + "type": "number" } ] \ No newline at end of file diff --git a/ecosystem_apps/land_registry.json b/ecosystem_apps/land_registry.json index e71ec4ce9..d2ef213d7 100644 --- a/ecosystem_apps/land_registry.json +++ b/ecosystem_apps/land_registry.json @@ -5,7 +5,7 @@ { "Name": "lr_check_rights", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Land registry\"}).Vars(\"app\")\nSetVar(admin, 0).(bank, 0).(depart2, 0).(depart3, 0)\n\nIf(#role_id# == AppParam(App: #app_id#, Name: \"lr_admin_role\")){\n SetVar(admin, 1)\n}\nIf(#role_id# == AppParam(App: #app_id#, Name: \"lr_bank_role\")){\n SetVar(bank, 1)\n}\nIf(#role_id# == AppParam(App: #app_id#, Name: \"lr_depart2_role\")){\n SetVar(depart2, 1)\n}\nIf(#role_id# == AppParam(App: #app_id#, Name: \"lr_depart3_role\")){\n SetVar(depart3, 1)\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Land registry\"}).Vars(app)\nSetVar(admin, 0).(bank, 0).(depart2, 0).(depart3, 0)\n\nIf(#role_id# == AppParam(App: #app_id#, Name: \"lr_admin_role\")){\n SetVar(admin, 1)\n}\nIf(#role_id# == AppParam(App: #app_id#, Name: \"lr_bank_role\")){\n SetVar(bank, 1)\n}\nIf(#role_id# == AppParam(App: #app_id#, Name: \"lr_depart2_role\")){\n SetVar(depart2, 1)\n}\nIf(#role_id# == AppParam(App: #app_id#, Name: \"lr_depart3_role\")){\n SetVar(depart3, 1)\n}", "Type": "blocks" }, { @@ -372,13 +372,13 @@ }, { "Name": "land_registry", - "Columns": "[\n {\n \"name\": \"buyer_id\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"LrPurchaseSteps\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n },\n {\n \"name\": \"date_created\",\n \"conditions\": \"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n },\n {\n \"name\": \"deleted\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"LrEdit\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n },\n {\n \"name\": \"government_price\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"LrDepartChecks\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"money\"\n },\n {\n \"name\": \"market_price\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"LrDepartChecks\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"money\"\n },\n {\n \"name\": \"modification_date\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"LrDepartChecks\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n },\n {\n \"name\": \"owner_id\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"LrPurchaseSteps\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n },\n {\n \"name\": \"price\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"LrEdit\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"money\"\n },\n {\n \"name\": \"registration_date\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"LrEdit\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n },\n {\n \"name\": \"specifications\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"LrEdit\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"json\"\n },\n {\n \"name\": \"status\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"LrDepartChecks\\\\\\\",\\\\\\\"LrPurchaseSteps\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"json\"\n },\n {\n \"name\": \"step\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"LrPurchaseSteps\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n }\n]", + "Columns": "[\n {\n \"name\": \"buyer_account\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"LrPurchaseSteps\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"varchar\"\n },\n {\n \"name\": \"date_created\",\n \"conditions\": \"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n },\n {\n \"name\": \"deleted\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"LrEdit\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n },\n {\n \"name\": \"government_price\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"LrDepartChecks\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"money\"\n },\n {\n \"name\": \"market_price\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"LrDepartChecks\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"money\"\n },\n {\n \"name\": \"modification_date\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"LrDepartChecks\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n },\n {\n \"name\": \"owner_account\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"LrPurchaseSteps\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"varchar\"\n },\n {\n \"name\": \"price\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"LrEdit\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"money\"\n },\n {\n \"name\": \"registration_date\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"LrEdit\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n },\n {\n \"name\": \"specifications\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"LrEdit\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"json\"\n },\n {\n \"name\": \"status\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"LrDepartChecks\\\\\\\",\\\\\\\"LrPurchaseSteps\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"json\"\n },\n {\n \"name\": \"step\",\n \"conditions\": \"{\\\"update\\\":\\\"ContractAccess(\\\\\\\"LrPurchaseSteps\\\\\\\")\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n }\n]", "Permissions": "{\"read\": \"true\", \"insert\": \"ContractAccess(\\\"LrAdd\\\")\", \"update\": \"ContractAccess(\\\"LrDepartChecks\\\",\\\"LrEdit\\\",\\\"LrPurchaseSteps\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", "Type": "tables" }, { "Name": "land_registry_history", - "Columns": "[\n {\n \"name\": \"attribute_name\",\n \"conditions\": \"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"varchar\"\n },\n {\n \"name\": \"date\",\n \"conditions\": \"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n },\n {\n \"name\": \"member_id\",\n \"conditions\": \"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n },\n {\n \"name\": \"new_value\",\n \"conditions\": \"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"text\"\n },\n {\n \"name\": \"object_id\",\n \"conditions\": \"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n },\n {\n \"name\": \"old_value\",\n \"conditions\": \"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"text\"\n }\n]", + "Columns": "[\n {\n \"name\": \"attribute_name\",\n \"conditions\": \"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"varchar\"\n },\n {\n \"name\": \"date\",\n \"conditions\": \"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n },\n {\n \"name\": \"account\",\n \"conditions\": \"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"varchar\"\n },\n {\n \"name\": \"new_value\",\n \"conditions\": \"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"text\"\n },\n {\n \"name\": \"object_id\",\n \"conditions\": \"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"number\"\n },\n {\n \"name\": \"old_value\",\n \"conditions\": \"{\\\"update\\\":\\\"false\\\",\\\"read\\\":\\\"true\\\"}\",\n \"type\": \"text\"\n }\n]", "Permissions": "{\"read\": \"true\", \"insert\": \"ContractAccess(\\\"LrEdit\\\")\", \"update\": \"false\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", "Type": "tables" }, @@ -445,48 +445,48 @@ { "Name": "lr_add", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Land registry\"}).Columns(\"name,id\").Vars(app)\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-3 text-right mt-sm\").(col_right,\"col-sm-9 text-left\")\nSetVar(custom_token_title, \"APLA\")\nIf(#ecosystem_id#>1){\n DBFind(\"@1ecosystems\").Where({\"id\": #ecosystem_id#}).Vars(\"custom\")\n}\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(lr_new_object)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n LangRes(lr_location)\n }\n }\n Div(#col_right#){\n InputMap(Name: Coords, Type: polygon, MapType: streets, Value: `{\"zoom\":18, \"center\":{\"lng\":40.777045,\"lat\":-73.963719}}`)\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(@1type)\n }\n }\n Div(#col_right#){\n AppParam(App: #app_id#, Name: lr_land_type, Source: lr_land_type)\n Select(Name: LandType, Source: lr_land_type, ValueColumn: id, NameColumn: name)\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_land_use)\n }\n }\n Div(#col_right#){\n AppParam(App: #app_id#, Name: lr_land_use, Source: src_land_use)\n Select(Name: LandUse, Source: src_land_use, ValueColumn: id, NameColumn: name)\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_buildings_class)\n }\n }\n Div(#col_right#){\n AppParam(App: #app_id#, Name: lr_buildings_class, Source: src_buildings_class)\n Select(Name: BuildingsUseClass, Source: src_buildings_class, ValueColumn: id, NameColumn: name)\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_land_authority)\n }\n }\n Div(#col_right#){\n AppParam(App: #app_id#, Name: lr_land_authority, Source: src_land_authority)\n Select(Name: LandAuthority, Source: src_land_authority, ValueColumn: id, NameColumn: name)\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_registration_date)\n }\n }\n Div(#col_right#){\n If(#edit_price#>0){\n SetVar(edit_price,Money(#edit_price#))\n }\n Input(Name: RegistrationDate, Type: date)\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_price) (#custom_token_title#)\n }\n }\n Div(#col_right#){\n If(#edit_price#>0){\n SetVar(edit_price,Money(#edit_price#))\n }\n Input(Name: Price)\n }\n }\n }\n Div(panel-footer text-right){\n Button(Page: #back_page#, PageParams: \"sales_list=#sales_list#\", Body: LangRes(@1back), Class: btn btn-default)\n Button(Contract: LrAdd, Page: #back_page#, PageParams: \"sales_list=0\", Body: $lr_object_create$, Class: btn btn-primary)\n }\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Land registry\"}).Columns(\"name,id\").Vars(app)\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-3 text-right mt-sm\").(col_right,\"col-sm-9 text-left\")\nSetVar(custom_token_title, \"APLA\")\nIf(#ecosystem_id#>1){\n DBFind(\"@1ecosystems\").Where({\"id\": \"#ecosystem_id#\"}).Vars(custom)\n}\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(lr_new_object)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n LangRes(lr_location)\n }\n }\n Div(#col_right#){\n InputMap(Name: Coords, Type: polygon, MapType: streets, Value: `{\"zoom\":18, \"center\":{\"lng\":40.777045,\"lat\":-73.963719}}`)\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(@1type)\n }\n }\n Div(#col_right#){\n AppParam(App: #app_id#, Name: lr_land_type, Source: lr_land_type)\n Select(Name: LandType, Source: lr_land_type, ValueColumn: id, NameColumn: name)\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_land_use)\n }\n }\n Div(#col_right#){\n AppParam(App: #app_id#, Name: lr_land_use, Source: src_land_use)\n Select(Name: LandUse, Source: src_land_use, ValueColumn: id, NameColumn: name)\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_buildings_class)\n }\n }\n Div(#col_right#){\n AppParam(App: #app_id#, Name: lr_buildings_class, Source: src_buildings_class)\n Select(Name: BuildingsUseClass, Source: src_buildings_class, ValueColumn: id, NameColumn: name)\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_land_authority)\n }\n }\n Div(#col_right#){\n AppParam(App: #app_id#, Name: lr_land_authority, Source: src_land_authority)\n Select(Name: LandAuthority, Source: src_land_authority, ValueColumn: id, NameColumn: name)\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_registration_date)\n }\n }\n Div(#col_right#){\n If(#edit_price#>0){\n SetVar(edit_price,Money(#edit_price#))\n }\n Input(Name: RegistrationDate, Type: date)\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_price) (#custom_token_title#)\n }\n }\n Div(#col_right#){\n If(#edit_price#>0){\n SetVar(edit_price,Money(#edit_price#))\n }\n Input(Name: Price)\n }\n }\n }\n Div(panel-footer text-right){\n Button(Page: #back_page#, PageParams: \"sales_list=#sales_list#\", Body: LangRes(@1back), Class: btn btn-default)\n Button(Contract: LrAdd, Page: #back_page#, PageParams: \"sales_list=0\", Body: $lr_object_create$, Class: btn btn-primary)\n }\n }\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "lr_edit", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "If(#object_id#>0){\n Include(lr_check_rights)\n DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Land registry\"}).Columns(\"name,id\").Vars(app)\n SetVar(row,\"row mt-sm\").(col_left,\"col-md-3 mt-sm text-right\").(col_right,\"col-md-9 text-left\")\n\n If(#edit_specifications_land_type#==\"\"){\n SetVar(edit_specifications_land_type,1)\n }\n If(#edit_specifications_land_use#==\"\"){\n SetVar(edit_specifications_land_use,1)\n }\n If(#edit_specifications_buildings_class#==\"\"){\n SetVar(edit_specifications_buildings_class,1)\n }\n If(#edit_specifications_land_authority#==\"\"){\n SetVar(edit_specifications_land_authority,1)\n }\n SetVar(custom_token_title, \"APLA\")\n If(#ecosystem_id#>1){\n DBFind(\"@1ecosystems\").Where({\"id\": #ecosystem_id#}).Vars(\"custom\")\n }\n\n DBFind(land_registry, src).WhereId(#object_id#).Columns(\"id,owner_id,specifications->map_coords,specifications->address,specifications->land_type,specifications->land_use,specifications->buildings_class,specifications->land_authority,registration_date,price\").Vars(edit)\n\n Form(){\n Div(){\n Map(MapType: streets, Hmap: 250, Value: #edit_specifications_map_coords#)\n }\n Div(row mt){\n Div(#col_left#){\n Label(){\n LangRes(lr_location)\n }\n }\n Div(#col_right#){\n Input(Value: #edit_specifications_address#, Disabled: true)\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(@1type)\n }\n }\n Div(#col_right#){\n If(#admin#==1){\n AppParam(App: #app_id#, Name: lr_land_type, Source: lr_land_type)\n Select(Name: LandType, Source: lr_land_type, ValueColumn: id, NameColumn: name, Value: #edit_specifications_land_type#)\n }.Else{\n SetVar(edit_specifications_land_type, AppParam(App: #app_id#, Name: lr_land_type, Index: #edit_specifications_land_type#))\n Input(Value: #edit_specifications_land_type#, Disabled: true)\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_land_use)\n }\n }\n Div(#col_right#){\n If(#admin#==1){\n AppParam(App: #app_id#, Name: lr_land_use, Source: src_land_use)\n Select(Name: LandUse, Source: src_land_use, ValueColumn: id, NameColumn: name, Value: #edit_specifications_land_use#)\n }.Else{\n SetVar(edit_specifications_land_use, AppParam(App: #app_id#, Name: lr_land_use, Index: #edit_specifications_land_use#))\n Input(Value: #edit_specifications_land_use#, Disabled: true)\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_buildings_class)\n }\n }\n Div(#col_right#){\n If(#admin#==1){\n AppParam(App: #app_id#, Name: lr_buildings_class, Source: src_buildings_class)\n Select(Name: BuildingsUseClass, Source: src_buildings_class, ValueColumn: id, NameColumn: name, Value: #edit_specifications_buildings_class#)\n }.Else{\n SetVar(edit_specifications_buildings_class, AppParam(App: #app_id#, Name: lr_buildings_class, Index: #edit_specifications_buildings_class#))\n Input(Value: #edit_specifications_buildings_class#, Disabled: true)\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_land_authority)\n }\n }\n Div(#col_right#){\n If(#admin#==1){\n AppParam(App: #app_id#, Name: lr_land_authority, Source: src_land_authority)\n Select(Name: LandAuthority, Source: src_land_authority, ValueColumn: id, NameColumn: name, Value: #edit_specifications_land_authority#)\n }.Else{\n SetVar(edit_specifications_land_authority, AppParam(App: #app_id#, Name: lr_land_authority, Index: #edit_specifications_land_authority#))\n Input(Value: #edit_specifications_land_authority#, Disabled: true)\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_registration_date)\n }\n }\n Div(#col_right#){\n If(#edit_registration_date#>0){\n SetVar(edit_registration_date, DateTime(#edit_registration_date#, \"YYYY-MM-DD\"))\n }\n If(#admin#==1){\n Input(Name: RegistrationDate, Type: date, Value: #edit_registration_date#)\n }.Else{\n Input(Value: #edit_registration_date#, Disabled: true)\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_price) (#custom_token_title#)\n }\n }\n Div(#col_right#){\n If(#edit_price#>0){\n SetVar(edit_price, Money(#edit_price#))\n }\n If(#edit_owner_id#==#key_id#){\n Input(Name: Price, Value: #edit_price#)\n }.Else{\n Input(Value: #edit_price#, Disabled: true)\n }\n }\n }\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right mt, Contract: LrEdit, Params: \"ObjectId=#edit_id#,RoleId=#role_id#\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\")\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#, PageParams: \"sales_list=#sales_list#\")\n }\n}.Else{\n Form(){\n Div(alert alert-danger text-center){\n LangRes(@1attention)\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: lr_list)\n }\n}", + "Value": "If(#object_id# > 0){\n Include(lr_check_rights)\n DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Land registry\"}).Columns(\"name,id\").Vars(app)\n SetVar(row,\"row mt-sm\").(col_left,\"col-md-3 mt-sm text-right\").(col_right,\"col-md-9 text-left\")\n\n If(#edit_specifications_land_type#==\"\"){\n SetVar(edit_specifications_land_type,1)\n }\n If(#edit_specifications_land_use#==\"\"){\n SetVar(edit_specifications_land_use,1)\n }\n If(#edit_specifications_buildings_class#==\"\"){\n SetVar(edit_specifications_buildings_class,1)\n }\n If(#edit_specifications_land_authority#==\"\"){\n SetVar(edit_specifications_land_authority,1)\n }\n SetVar(custom_token_title, \"APLA\")\n If(#ecosystem_id# > 1){\n DBFind(\"@1ecosystems\").Where({\"id\": \"#ecosystem_id#\"}).Vars(custom)\n }\n\n DBFind(\"land_registry\", src).WhereId(#object_id#).Columns(\"id,owner_account,specifications->map_coords,specifications->address,specifications->land_type,specifications->land_use,specifications->buildings_class,specifications->land_authority,registration_date,price\").Vars(edit)\n\n Form(){\n Div(){\n Map(MapType: streets, Hmap: 250, Value: #edit_specifications_map_coords#)\n }\n Div(row mt){\n Div(#col_left#){\n Label(){\n LangRes(lr_location)\n }\n }\n Div(#col_right#){\n Input(Value: #edit_specifications_address#, Disabled: true)\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(@1type)\n }\n }\n Div(#col_right#){\n If(#admin#==1){\n AppParam(App: #app_id#, Name: lr_land_type, Source: lr_land_type)\n Select(Name: LandType, Source: lr_land_type, ValueColumn: id, NameColumn: name, Value: #edit_specifications_land_type#)\n }.Else{\n SetVar(edit_specifications_land_type, AppParam(App: #app_id#, Name: lr_land_type, Index: #edit_specifications_land_type#))\n Input(Value: #edit_specifications_land_type#, Disabled: true)\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_land_use)\n }\n }\n Div(#col_right#){\n If(#admin#==1){\n AppParam(App: #app_id#, Name: lr_land_use, Source: src_land_use)\n Select(Name: LandUse, Source: src_land_use, ValueColumn: id, NameColumn: name, Value: #edit_specifications_land_use#)\n }.Else{\n SetVar(edit_specifications_land_use, AppParam(App: #app_id#, Name: lr_land_use, Index: #edit_specifications_land_use#))\n Input(Value: #edit_specifications_land_use#, Disabled: true)\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_buildings_class)\n }\n }\n Div(#col_right#){\n If(#admin#==1){\n AppParam(App: #app_id#, Name: lr_buildings_class, Source: src_buildings_class)\n Select(Name: BuildingsUseClass, Source: src_buildings_class, ValueColumn: id, NameColumn: name, Value: #edit_specifications_buildings_class#)\n }.Else{\n SetVar(edit_specifications_buildings_class, AppParam(App: #app_id#, Name: lr_buildings_class, Index: #edit_specifications_buildings_class#))\n Input(Value: #edit_specifications_buildings_class#, Disabled: true)\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_land_authority)\n }\n }\n Div(#col_right#){\n If(#admin#==1){\n AppParam(App: #app_id#, Name: lr_land_authority, Source: src_land_authority)\n Select(Name: LandAuthority, Source: src_land_authority, ValueColumn: id, NameColumn: name, Value: #edit_specifications_land_authority#)\n }.Else{\n SetVar(edit_specifications_land_authority, AppParam(App: #app_id#, Name: lr_land_authority, Index: #edit_specifications_land_authority#))\n Input(Value: #edit_specifications_land_authority#, Disabled: true)\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_registration_date)\n }\n }\n Div(#col_right#){\n If(#edit_registration_date#>0){\n SetVar(edit_registration_date, DateTime(#edit_registration_date#, \"YYYY-MM-DD\"))\n }\n If(#admin#==1){\n Input(Name: RegistrationDate, Type: date, Value: #edit_registration_date#)\n }.Else{\n Input(Value: #edit_registration_date#, Disabled: true)\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_price) (#custom_token_title#)\n }\n }\n Div(#col_right#){\n If(#edit_price#>0){\n SetVar(edit_price, Money(#edit_price#))\n }\n If(#edit_owner_account# == #account_id#){\n Input(Name: Price, Value: #edit_price#)\n }.Else{\n Input(Value: #edit_price#, Disabled: true)\n }\n }\n }\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right mt, Contract: LrEdit, Params: \"ObjectId=#edit_id#,RoleId=#role_id#\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\")\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#, PageParams: \"sales_list=#sales_list#\")\n }\n}.Else{\n Form(){\n Div(alert alert-danger text-center){\n LangRes(@1attention)\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: lr_list)\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "lr_list", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "SetVar(this_page, lr_list).(this_table, land_registry)\nInclude(@1pager_header)\nInclude(lr_check_rights)\n\nSetVar(custom_token_title, \"APLA\")\nIf(#ecosystem_id#>1){\n DBFind(\"@1ecosystems\").Where({\"id\": #ecosystem_id#}).Vars(\"custom\")\n}\n\nIf(And(#sales_list#==\"\",#admin#!=1,#bank#!=1,#depart2#!=1,#depart3#!=1)){\n SetVar(sales_list, 1)\n}\n\nIf(#sales_list#==1){\n SetVar(title, $lr_sales$)\n Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$lr_sales_desc$\"))\n SetVar(filters, {\"price\": {\"$gt\": 0}, \"government_price\": {\"$gt\": 0}, \"market_price\": {\"$gt\": 0}, \"status->legal_status\": 1, \"status->encumbrance_certificate\": 1, \"status->tax_receipt_and_bills\": 1, \"deleted\": 0})\n}.Else{\n SetVar(sales_list, 0)\n SetVar(title, $lr_land_registry$)\n Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$lr_list_desc$\"))\n\n If(And(#admin#!=1,#bank#!=1,#depart2#!=1,#depart3#!=1)){\n SetVar(filters, {\"$or\": [{\"owner_id\": #key_id#, \"deleted\": 0}, {\"price\": {\"$gt\": 0}, \"government_price\": {\"$gt\": 0}, \"market_price\": {\"$gt\": 0}, \"status->legal_status\": 1, \"status->encumbrance_certificate\": 1, \"status->tax_receipt_and_bills\": 1, \"deleted\": 0}]})\n }.Else{\n SetVar(filters, {\"deleted\": 0})\n }\n}\n\nIf(#admin# == 1){\n SetTitle(#title# ($lr_admin_role_name$))\n}.ElseIf(#bank# == 1){\n SetTitle(#title# ($lr_bank_role_name$))\n}.ElseIf(#depart2# == 1){\n SetTitle(#title# ($lr_depart2_role_name$))\n}.ElseIf(#depart3# == 1){\n SetTitle(#title# ($lr_depart3_role_name$))\n}.Else{\n SetTitle(#title#)\n}\n\nAddToolButton(Title: $@1add$, Page: lr_add, PageParams: \"back_page=#this_page#,sales_list=#sales_list#\", Icon: icon-plus)\n\nDiv(btn-group ml-lg){\n If(#sales_list#==0){\n Button(Body: Em(Class: fa fa-list) $lr_all_objects$, Page: #this_page#, PageParams: \"sales_list=0\", Class: btn bg-gray-lighter ml-sm)\n }.Else{\n Button(Body: Em(Class: fa fa-list) $lr_all_objects$, Page: #this_page#, PageParams: \"sales_list=0\", Class: btn bg-gray ml-sm)\n }\n If(#sales_list#==1){\n Button(Body: Em(Class: fa fa-credit-card) $@1sales$, Page: #this_page#, PageParams: \"sales_list=1\", Class: btn bg-gray-lighter ml-sm)\n }.Else{\n Button(Body: Em(Class: fa fa-credit-card) $@1sales$, Page: #this_page#, PageParams: \"sales_list=1\", Class: btn bg-gray ml-sm)\n }\n}\n\nIf(#search#){\n SetVar(where, {#filters#, \"specifications->address\": {\"$ilike\": \"#search#\"}})\n}.Else{\n SetVar(where, #filters#)\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(lr_location))\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": -1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"owner_id,buyer_id,specifications->address,specifications->land_use,specifications->buildings_class,specifications->area,price,status->legal_status,status->encumbrance_certificate,status->tax_receipt_and_bills,step\").Custom(location){\n If(#specifications.address#){\n SetVar(location_name, #specifications.address#)\n }.Else{\n SetVar(location_name, $lr_no_address_found$)\n }\n Button(Page: lr_view, PageParams: \"object_id=#id#,back_page=#this_page#,sales_list=#sales_list#\", Body: #location_name#, Class: btn-link).Popup(50, $lr_object_view$)\n}.Custom(owner_price){\n If(#price#){\n Money(#price#) #custom_token_title#\n }.Else{\n Em(Class: fa fa-question-circle text-muted)\n }\n}.Custom(owner){\n SetVar(m_id, 0)\n DBFind(\"@1members\").Where({\"id\": #owner_id#, \"ecosystem\": #ecosystem_id#}).Vars(m)\n If(Or(#m_id#>0,#m_id#<0)){\n SetVar(owner_image_id, #m_image_id#)\n SetVar(owner_member_name, #m_member_name#)\n }.Else{\n SetVar(owner_image_id, 0)\n SetVar(owner_member_name, Address(#owner_id#))\n }\n LinkPage(Page: @1profile_view, PageParams: \"v_key_id=#owner_id#\"){\n If(#owner_image_id#>0){\n Image(Src: Binary().ById(#owner_image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63;)\n Span(Class: ml-sm text-bold, Body: #owner_member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x))\n Span(Class: ml-sm text-bold, Body: #owner_member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n}.Custom(buyer){\n If(#owner_id#!=#buyer_id#){\n SetVar(n_id, 0)\n DBFind(\"@1members\").Where({\"id\": #buyer_id#, \"ecosystem\": #ecosystem_id#}).Vars(n)\n If(Or(#n_id#>0,#n_id#<0)){\n SetVar(buyer_image_id, #n_image_id#)\n SetVar(buyer_member_name, #n_member_name#)\n }.Else{\n SetVar(buyer_image_id, 0)\n SetVar(buyer_member_name, Address(#buyer_id#))\n }\n LinkPage(Page: @1profile_view, PageParams: \"v_key_id=#buyer_id#\"){\n If(#buyer_image_id#>0){\n Image(Src: Binary().ById(#buyer_image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63;)\n Span(Class: ml-sm text-bold, Body: #buyer_member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x))\n Span(Class: ml-sm text-bold, Body: #buyer_member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n }\n}.Custom(deal_status){\n If(#step#==-1){\n Em(Class: fa fa-fw fa-check-circle text-success) $lr_available_for_purchase$\n }.ElseIf(#step#==0){\n Em(Class: fa fa-fw fa-hourglass-1 text-primary) $lr_awaiting_owner_accept$\n }.ElseIf(#step#==1){\n Em(Class: fa fa-fw fa-hourglass-2 text-primary) $lr_awaiting_buyer_deposit$\n }.ElseIf(#step#==2){\n Em(Class: fa fa-fw fa-hourglass-3 text-primary) $lr_awaiting_bank_transfer$\n }\n}.Custom(legal_status){\n If(#status.legal_status#==1){\n Em(Class: fa fa-check-circle text-success)\n }.ElseIf(#status.legal_status#==2){\n Em(Class: fa fa-exclamation-circle text-danger)\n }.Else{\n Em(Class: fa fa-question-circle text-muted)\n }\n}.Custom(encumbrance_certificate){\n If(#status.encumbrance_certificate#==1){\n Em(Class: fa fa-check-circle text-success)\n }.ElseIf(#status.encumbrance_certificate#==2){\n Em(Class: fa fa-exclamation-circle text-danger)\n }.Else{\n Em(Class: fa fa-question-circle text-muted)\n }\n}.Custom(tax_receipt_and_bills){\n If(#status.tax_receipt_and_bills#==1){\n Em(Class: fa fa-check-circle text-success)\n }.ElseIf(#status.tax_receipt_and_bills#==2){\n Em(Class: fa fa-exclamation-circle text-danger)\n }.Else{\n Em(Class: fa fa-question-circle text-muted)\n }\n}.Custom(actions){\n If(And(Or(#owner_id#==#key_id#,#admin#==1),#step#<2)){\n Button(Page: #this_page#, PageParams: \"sales_list=#sales_list#\", Contract: LrEdit, Params: \"ObjectId=#id#,RoleId=#role_id#,DeleteObject=1\", Class: btn bg-gray-lighter pull-right ml-sm, Body: Em(Class: text-danger fa fa-trash)).Alert($lr_want_delete_object$, $@1confirm_button$, $@1cancel$)\n Button(Page: lr_edit, PageParams: \"object_id=#id#,back_page=#this_page#,sales_list=#sales_list#\", Class: btn bg-gray-lighter pull-right, Body: Em(Class: fa fa-edit)).Popup(50, $lr_object_edit$)\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n If(#sales_list#==1){\n Table(src, \"$lr_location$=location,$lr_price$=owner_price,$lr_owner$=owner,$lr_buyer$=buyer,$@1status$=deal_status,=actions\")\n }.Else{\n Table(src, \"$lr_location$=location,$lr_price$=owner_price,$lr_owner$=owner,$lr_legal_status$=legal_status,$lr_encumbrance_certificate$=encumbrance_certificate,$lr_taxes_and_bills$=tax_receipt_and_bills,=actions\")\n }\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$lr_no_objects_found$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, lr_list).(this_table, land_registry)\nInclude(@1pager_header)\nInclude(lr_check_rights)\n\nSetVar(custom_token_title, \"APLA\")\nIf(#ecosystem_id# > 1){\n DBFind(\"@1ecosystems\").Where({\"id\": \"#ecosystem_id#\"}).Vars(custom)\n}\n\nIf(And(#sales_list# == \"\", #admin# != 1, #bank# != 1, #depart2# != 1, #depart3# != 1)){\n SetVar(sales_list, 1)\n}\n\nIf(#sales_list# == 1){\n SetVar(title, $lr_sales$)\n Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$lr_sales_desc$\"))\n SetVar(filters, `\"price\": {\"$gt\": 0}, \"government_price\": {\"$gt\": 0}, \"market_price\": {\"$gt\": 0}, \"status->legal_status\": 1, \"status->encumbrance_certificate\": 1, \"status->tax_receipt_and_bills\": 1, \"deleted\": 0`)\n}.Else{\n SetVar(sales_list, 0)\n SetVar(title, $lr_land_registry$)\n Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$lr_list_desc$\"))\n\n If(And(#admin# != 1, #bank# != 1, #depart2# != 1, #depart3# != 1)){\n SetVar(filters, `\"$or\": [{\"owner_account\": \"#account_id#\", \"deleted\": 0}, {\"price\": {\"$gt\": 0}, \"government_price\": {\"$gt\": 0}, \"market_price\": {\"$gt\": 0}, \"status->legal_status\": 1, \"status->encumbrance_certificate\": 1, \"status->tax_receipt_and_bills\": 1, \"deleted\": 0}]`)\n }.Else{\n SetVar(filters, `\"deleted\": 0`)\n }\n}\n\nIf(#admin# == 1){\n SetTitle(#title# ($lr_admin_role_name$))\n}.ElseIf(#bank# == 1){\n SetTitle(#title# ($lr_bank_role_name$))\n}.ElseIf(#depart2# == 1){\n SetTitle(#title# ($lr_depart2_role_name$))\n}.ElseIf(#depart3# == 1){\n SetTitle(#title# ($lr_depart3_role_name$))\n}.Else{\n SetTitle(#title#)\n}\n\nAddToolButton(Title: $@1add$, Page: lr_add, PageParams: \"back_page=#this_page#,sales_list=#sales_list#\", Icon: icon-plus)\n\nDiv(btn-group ml-lg){\n If(#sales_list# == 0){\n Button(Body: Em(Class: fa fa-list) $lr_all_objects$, Page: #this_page#, PageParams: \"sales_list=0\", Class: btn bg-gray-lighter ml-sm)\n }.Else{\n Button(Body: Em(Class: fa fa-list) $lr_all_objects$, Page: #this_page#, PageParams: \"sales_list=0\", Class: btn bg-gray ml-sm)\n }\n If(#sales_list# == 1){\n Button(Body: Em(Class: fa fa-credit-card) $@1sales$, Page: #this_page#, PageParams: \"sales_list=1\", Class: btn bg-gray-lighter ml-sm)\n }.Else{\n Button(Body: Em(Class: fa fa-credit-card) $@1sales$, Page: #this_page#, PageParams: \"sales_list=1\", Class: btn bg-gray ml-sm)\n }\n}\n\nIf(#search#){\n SetVar(where, {#filters#, \"specifications->address\": {\"$ilike\": \"#search#\"}})\n}.Else{\n SetVar(where, {#filters#})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(lr_location))\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": \"-1\"}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"owner_account,buyer_account,specifications->address,specifications->land_use,specifications->buildings_class,specifications->area,price,status->legal_status,status->encumbrance_certificate,status->tax_receipt_and_bills,step\").Custom(location){\n If(#specifications.address#){\n SetVar(location_name, #specifications.address#)\n }.Else{\n SetVar(location_name, $lr_no_address_found$)\n }\n Button(Page: lr_view, PageParams: \"object_id=#id#,back_page=#this_page#,sales_list=#sales_list#\", Body: #location_name#, Class: btn-link).Popup(50, $lr_object_view$)\n}.Custom(owner_price){\n If(#price#){\n Money(#price#) #custom_token_title#\n }.Else{\n Em(Class: fa fa-question-circle text-muted)\n }\n}.Custom(owner){\n SetVar(m_account,)\n DBFind(\"@1members\").Where({\"account\": \"#owner_account#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(m)\n If(#m_account#){\n SetVar(owner_image_id, #m_image_id#)\n SetVar(owner_member_name, #m_member_name#)\n }.Else{\n SetVar(owner_image_id, 0)\n SetVar(owner_member_name, #owner_account#)\n }\n LinkPage(Page: @1profile_view, PageParams: \"v_account=#owner_account#\"){\n If(#owner_image_id#>0){\n Image(Src: Binary().ById(#owner_image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63;)\n Span(Class: ml-sm text-bold, Body: #owner_member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x))\n Span(Class: ml-sm text-bold, Body: #owner_member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n}.Custom(buyer){\n If(#owner_account# != #buyer_account#){\n SetVar(n_account,)\n DBFind(\"@1members\").Where({\"account\": \"#buyer_account#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(n)\n If(#n_account#){\n SetVar(buyer_image_id, #n_image_id#)\n SetVar(buyer_member_name, #n_member_name#)\n }.Else{\n SetVar(buyer_image_id, 0)\n SetVar(buyer_member_name, #buyer_account#)\n }\n LinkPage(Page: @1profile_view, PageParams: \"v_account=#buyer_account#\"){\n If(#buyer_image_id# > 0){\n Image(Src: Binary().ById(#buyer_image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63;)\n Span(Class: ml-sm text-bold, Body: #buyer_member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x))\n Span(Class: ml-sm text-bold, Body: #buyer_member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n }\n}.Custom(deal_status){\n If(#step#==-1){\n Em(Class: fa fa-fw fa-check-circle text-success) $lr_available_for_purchase$\n }.ElseIf(#step#==0){\n Em(Class: fa fa-fw fa-hourglass-1 text-primary) $lr_awaiting_owner_accept$\n }.ElseIf(#step#==1){\n Em(Class: fa fa-fw fa-hourglass-2 text-primary) $lr_awaiting_buyer_deposit$\n }.ElseIf(#step#==2){\n Em(Class: fa fa-fw fa-hourglass-3 text-primary) $lr_awaiting_bank_transfer$\n }\n}.Custom(legal_status){\n If(#status.legal_status#==1){\n Em(Class: fa fa-check-circle text-success)\n }.ElseIf(#status.legal_status#==2){\n Em(Class: fa fa-exclamation-circle text-danger)\n }.Else{\n Em(Class: fa fa-question-circle text-muted)\n }\n}.Custom(encumbrance_certificate){\n If(#status.encumbrance_certificate#==1){\n Em(Class: fa fa-check-circle text-success)\n }.ElseIf(#status.encumbrance_certificate#==2){\n Em(Class: fa fa-exclamation-circle text-danger)\n }.Else{\n Em(Class: fa fa-question-circle text-muted)\n }\n}.Custom(tax_receipt_and_bills){\n If(#status.tax_receipt_and_bills#==1){\n Em(Class: fa fa-check-circle text-success)\n }.ElseIf(#status.tax_receipt_and_bills#==2){\n Em(Class: fa fa-exclamation-circle text-danger)\n }.Else{\n Em(Class: fa fa-question-circle text-muted)\n }\n}.Custom(actions){\n If(And(Or(#owner_account# == #account_id#, #admin# == 1), #step# < 2)){\n Button(Page: #this_page#, PageParams: \"sales_list=#sales_list#\", Contract: LrEdit, Params: \"ObjectId=#id#,RoleId=#role_id#,DeleteObject=1\", Class: btn bg-gray-lighter pull-right ml-sm, Body: Em(Class: text-danger fa fa-trash)).Alert($lr_want_delete_object$, $@1confirm_button$, $@1cancel$)\n Button(Page: lr_edit, PageParams: \"object_id=#id#,back_page=#this_page#,sales_list=#sales_list#\", Class: btn bg-gray-lighter pull-right, Body: Em(Class: fa fa-edit)).Popup(50, $lr_object_edit$)\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n If(#sales_list#==1){\n Table(src, \"$lr_location$=location,$lr_price$=owner_price,$lr_owner$=owner,$lr_buyer$=buyer,$@1status$=deal_status,=actions\")\n }.Else{\n Table(src, \"$lr_location$=location,$lr_price$=owner_price,$lr_owner$=owner,$lr_legal_status$=legal_status,$lr_encumbrance_certificate$=encumbrance_certificate,$lr_taxes_and_bills$=tax_receipt_and_bills,=actions\")\n }\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$lr_no_objects_found$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "lr_settings", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Land registry\"}).Vars(\"app\")\n\nSetVar(this_page, \"lr_settings\").(admin_role,0).(bank_role,0).(depart2_role,0).(depart3_role,0)\nSetVar(admin_role, AppParam(App: #app_id#, Name: \"lr_admin_role\"))\nSetVar(bank_role, AppParam(App: #app_id#, Name: \"lr_bank_role\"))\nSetVar(depart2_role, AppParam(App: #app_id#, Name: \"lr_depart2_role\"))\nSetVar(depart3_role, AppParam(App: #app_id#, Name: \"lr_depart3_role\"))\n\nDBFind(\"@1roles\", src_roles).Where({\"ecosystem\": #ecosystem_id#, \"deleted\": 0}).Columns(\"role_name,id\").Limit(100)\n\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-4 text-right mt-sm\").(col_right,\"col-sm-8 text-left\")\n\nIf(#ecosystem_id#>1){\n DBFind(\"@1ecosystems\").Where({\"id\": #ecosystem_id#}).Vars(\"custom\")\n}.Else{\n SetVar(custom_token_title, \"APLA\")\n}\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n If(#custom_token_title# != \"\"){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(lr_settings)\n }\n Div(text-center text-muted){\n LangRes(lr_settings_description)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n LangRes(lr_admin_role_name)\n }\n }\n Div(#col_right#){\n Select(Name: RoleAdmin, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #admin_role#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#admin_role# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #admin_role#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_bank_role_name)\n }\n }\n Div(#col_right#){\n Select(Name: RoleBank, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #bank_role#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#bank_role# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #bank_role#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_depart2_role_name)\n }\n }\n Div(#col_right#){\n Select(Name: RoleDepart2, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #depart2_role#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#depart2_role# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #depart2_role#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_depart3_role_name)\n }\n }\n Div(#col_right#){\n Select(Name: RoleDepart3, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #depart3_role#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#depart3_role# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #depart3_role#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1apply_settings$, Class: btn btn-primary, Page: #this_page#, Contract: LrSettings)\n }\n }.Else{\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(lr_settings)\n }\n Div(text-center text-muted){\n LangRes(lr_tokens_needed)\n }\n }\n }\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Land registry\"}).Vars(app)\n\nSetVar(this_page, \"lr_settings\").(admin_role,0).(bank_role,0).(depart2_role,0).(depart3_role,0)\nSetVar(admin_role, AppParam(App: #app_id#, Name: \"lr_admin_role\"))\nSetVar(bank_role, AppParam(App: #app_id#, Name: \"lr_bank_role\"))\nSetVar(depart2_role, AppParam(App: #app_id#, Name: \"lr_depart2_role\"))\nSetVar(depart3_role, AppParam(App: #app_id#, Name: \"lr_depart3_role\"))\n\nDBFind(\"@1roles\", src_roles).Where({\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0}).Columns(\"role_name,id\").Limit(100)\n\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-4 text-right mt-sm\").(col_right,\"col-sm-8 text-left\")\n\nIf(#ecosystem_id#>1){\n DBFind(\"@1ecosystems\").Where({\"id\": \"#ecosystem_id#\"}).Vars(custom)\n}.Else{\n SetVar(custom_token_title, \"APLA\")\n}\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n If(#custom_token_title# != \"\"){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(lr_settings)\n }\n Div(text-center text-muted){\n LangRes(lr_settings_description)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n LangRes(lr_admin_role_name)\n }\n }\n Div(#col_right#){\n Select(Name: RoleAdmin, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #admin_role#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#admin_role# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#admin_role#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_bank_role_name)\n }\n }\n Div(#col_right#){\n Select(Name: RoleBank, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #bank_role#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#bank_role# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#bank_role#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_depart2_role_name)\n }\n }\n Div(#col_right#){\n Select(Name: RoleDepart2, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #depart2_role#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#depart2_role# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#depart2_role#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(lr_depart3_role_name)\n }\n }\n Div(#col_right#){\n Select(Name: RoleDepart3, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #depart3_role#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#depart3_role# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#depart3_role#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1apply_settings$, Class: btn btn-primary, Page: #this_page#, Contract: LrSettings)\n }\n }.Else{\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(lr_settings)\n }\n Div(text-center text-muted){\n LangRes(lr_tokens_needed)\n }\n }\n }\n }\n }\n }\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "lr_view", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "If(#notific_id#>0){\n DBFind(\"@1notifications\").Where({\"id\": #notific_id#, \"ecosystem\": #ecosystem_id#}).Columns(\"notification->body,recipient->member_id,page_params->object_id,page_params->info_message,page_params->info_status,closed\").Vars(notific)\n SetVar(object_id, #notific_page_params_object_id#)\n SetVar(back_page,@1notifications_list)\n}\n\nIf(#object_id#>0){\n Include(lr_check_rights)\n DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Land registry\"}).Columns(\"name,id\").Vars(app)\n AppParam(App: #app_id#, Name: lr_issues, Source: src_issues)\n SetVar(col_left,\"col-md-4 text-right\").(col_right,\"col-md-8 text-left\")\n DBFind(\"land_registry\", src).WhereId(#object_id#).Columns(\"id,owner_id,buyer_id,step,specifications->map_coords,specifications->address,specifications->area,specifications->land_type,specifications->land_use,specifications->buildings_class,specifications->land_authority,registration_date,date_created,modification_date,status->legal_status,status->encumbrance_certificate,status->tax_receipt_and_bills,price,market_price,government_price\").Vars(view)\n SetVar(custom_token_title, \"APLA\")\n If(#ecosystem_id#>1){\n DBFind(\"@1ecosystems\").Where({\"id\": #ecosystem_id#}).Vars(\"custom\")\n }\n\n If(#view_owner_id#==#key_id#){\n SetVar(owner,1)\n DBFind(\"@1notifications\").Where({\"page_params->object_id\": #view_id#, \"page_params->depart2_requests\": 2, \"ecosystem\": #ecosystem_id#}).Columns(\"id\").Vars(depart2)\n DBFind(\"@1notifications\").Where({\"page_params->object_id\": #view_id#, \"page_params->depart3_requests\": 2, \"ecosystem\": #ecosystem_id#}).Columns(\"id\").Vars(depart3)\n If(#depart2_id#>0){\n SetVar(depart2_requests,2)\n }.Else{\n SetVar(depart2_requests,1)\n }\n If(#depart3_id#>0){\n SetVar(depart3_requests,2)\n }.Else{\n SetVar(depart3_requests,1)\n }\n }\n If(#view_buyer_id#==#key_id#){\n SetVar(buyer,1)\n }\n If(And(#view_status_legal_status#==1,#view_status_encumbrance_certificate#==1,#view_status_tax_receipt_and_bills#==1,#view_government_price#>0,#view_market_price#>0)){\n SetVar(depart_checks,1)\n If(And(#depart_checks#==1,#view_step#==-1,#view_price#>0)){\n SetVar(available_for_sale,1)\n }\n }\n\n Form(){\n Div(){\n Map(MapType: streets, Hmap: 250, Value: #view_specifications_map_coords#)\n }\n Div(row mt){\n Div(#col_left# mt-sm){\n Label(){\n LangRes(lr_owner)\n }\n }\n Div(#col_right#){\n SetVar(m_id, 0)\n DBFind(\"@1members\").Where({\"id\": #view_owner_id#, \"ecosystem\": #ecosystem_id#}).Vars(m)\n If(Or(#m_id#>0,#m_id#<0)){\n SetVar(image_id, #m_image_id#)\n SetVar(member_name, #m_member_name#)\n }.Else{\n SetVar(image_id, 0)\n SetVar(member_name, Address(#view_owner_id#))\n }\n LinkPage(Page: @1profile_view, PageParams: \"v_key_id=#view_owner_id#\"){\n If(#image_id#>0){\n Image(Src: Binary().ById(#image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63;)\n Span(Class: ml-sm text-bold, Body: #member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x))\n Span(Class: ml-sm text-bold, Body: #member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n }\n }\n Div(row mt-sm){\n Div(#col_left#){\n Label(){\n LangRes(lr_location)\n }\n }\n Div(#col_right#){\n If(#view_specifications_address#){\n Span(#view_specifications_address#)\n }.Else{\n Span($lr_no_address_found$)\n }\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_area_size)\n }\n }\n Div(#col_right#){\n Span(#view_specifications_area#)\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(@1date_created)\n }\n }\n Div(#col_right#){\n If(#view_date_created#>0){\n SetVar(view_date_created, DateTime(#view_date_created#, \"YYYY-MM-DD\"))\n Span(#view_date_created#)\n }\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_registration_date)\n }\n }\n Div(#col_right#){\n If(#view_registration_date#>0){\n SetVar(view_registration_date, DateTime(#view_registration_date#, \"YYYY-MM-DD\"))\n Span(#view_registration_date#)\n }\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_modification_date)\n }\n }\n Div(#col_right#){\n If(#view_modification_date#>0){\n SetVar(view_modification_date, DateTime(#view_modification_date#, \"YYYY-MM-DD\"))\n Span(#view_modification_date#)\n }\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(@1type)\n }\n }\n Div(#col_right#){\n SetVar(view_specifications_land_type, AppParam(App: #app_id#, Name: lr_land_type, Index: #view_specifications_land_type#))\n Span(#view_specifications_land_type#)\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_land_use)\n }\n }\n Div(#col_right#){\n SetVar(view_specifications_land_use, AppParam(App: #app_id#, Name: lr_land_use, Index: #view_specifications_land_use#))\n Span(#view_specifications_land_use#)\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_buildings_class)\n }\n }\n Div(#col_right#){\n SetVar(view_specifications_buildings_class, AppParam(App: #app_id#, Name: lr_buildings_class, Index: #view_specifications_buildings_class#))\n Span(#view_specifications_buildings_class#)\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_land_authority)\n }\n }\n Div(#col_right#){\n SetVar(view_specifications_land_authority, AppParam(App: #app_id#, Name: lr_land_authority, Index: #view_specifications_land_authority#))\n Span(#view_specifications_land_authority#)\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_price)\n }\n }\n Div(#col_right#){\n If(#view_price#>0){\n SetVar(view_price, Money(#view_price#))\n Span(#view_price# #custom_token_title#)\n }.Else{\n Em(Class: fa fa-question-circle text-muted)\n }\n }\n }\n If(And(#depart3#==1,#depart_checks#!=1,#notific_recipient_member_id#==\"\")){\n Div(list-group-item){\n Div(row mt-sm){\n Div(#col_left# mt-sm){\n Label(){\n LangRes(lr_market_price)\n }\n }\n Div(#col_right#){\n If(#view_market_price#>0){\n SetVar(view_market_price, Money(#view_market_price#))\n Input(Name: MarketPrice, Value: #view_market_price#)\n }.Else{\n Input(Name: MarketPrice)\n }\n }\n }\n Div(row mt-sm){\n Div(#col_left# mt-sm){\n Label(){\n LangRes(lr_government_price)\n }\n }\n Div(#col_right#){\n If(#view_government_price#>0){\n SetVar(view_government_price, Money(#view_government_price#))\n Input(Name: GovernmentPrice, Value: #view_government_price#)\n }.Else{\n Input(Name: GovernmentPrice)\n }\n }\n }\n Div(row mt-sm){\n Div(#col_left#){\n Label(){\n LangRes(lr_taxes_and_bills)\n }\n }\n Div(#col_right#){\n Div(form-inline){\n If(#view_status_tax_receipt_and_bills#>0){\n RadioGroup(Name: TaxReceiptAndBills, Value: #view_status_tax_receipt_and_bills#, Source: src_issues, ValueColumn: id, NameColumn: name)\n }.Else{\n RadioGroup(Name: TaxReceiptAndBills, Value: 0, Source: src_issues, ValueColumn: id, NameColumn: name)\n }\n }\n }\n }\n }\n }.Else{\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_market_price)\n }\n }\n Div(#col_right#){\n If(#view_market_price#>0){\n SetVar(view_market_price, Money(#view_market_price#))\n Span(#view_market_price# #custom_token_title#)\n }.Else{\n Em(Class: fa fa-question-circle text-muted)\n If(And(#owner#==1,#depart3_requests#==1)){\n Button(Body: ($lr_additional_request$), Class: btn-link p0 ml-sm, Contract: LrDepartRequest, Params: \"ObjectId=#view_id#,DepartNumber=3\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\")\n }\n }\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_government_price)\n }\n }\n Div(#col_right#){\n If(#view_government_price#>0){\n SetVar(view_government_price, Money(#view_government_price#))\n Span(#view_government_price# #custom_token_title#)\n }.Else{\n Em(Class: fa fa-question-circle text-muted)\n If(And(#owner#==1,#depart3_requests#==1)){\n Button(Body: ($lr_additional_request$), Class: btn-link p0 ml-sm, Contract: LrDepartRequest, Params: \"ObjectId=#view_id#,DepartNumber=3\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\")\n }\n }\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_taxes_and_bills)\n }\n }\n Div(#col_right#){\n If(#view_status_tax_receipt_and_bills#==1){\n Em(Class: fa fa-check-circle text-success)\n }.ElseIf(#view_status_tax_receipt_and_bills#==2){\n Em(Class: fa fa-exclamation-circle text-danger)\n }.Else{\n Em(Class: fa fa-question-circle text-muted)\n If(And(#owner#==1,#depart3_requests#==1)){\n Button(Body: ($lr_additional_request$), Class: btn-link p0 ml-sm, Contract: LrDepartRequest, Params: \"ObjectId=#view_id#,DepartNumber=3\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\")\n }\n }\n }\n }\n }\n If(And(#depart2#==1,#depart_checks#!=1,#notific_recipient_member_id#==\"\")){\n Div(list-group-item){\n Div(row mt-sm){\n Div(#col_left#){\n Label(){\n LangRes(lr_legal_status)\n }\n }\n Div(#col_right#){\n Div(form-inline){\n If(#view_status_legal_status#>0){\n RadioGroup(Name: LegalStatus, Value: #view_status_legal_status#, Source: src_issues, ValueColumn: id, NameColumn: name)\n }.Else{\n RadioGroup(Name: LegalStatus, Value: 0, Source: src_issues, ValueColumn: id, NameColumn: name)\n }\n }\n }\n }\n Div(row mt-sm){\n Div(#col_left#){\n Label(){\n LangRes(lr_encumbrance_certificate)\n }\n }\n Div(#col_right#){\n Div(form-inline){\n If(#view_status_encumbrance_certificate#>0){\n RadioGroup(Name: EncumbranceCertificate, Value: #view_status_encumbrance_certificate#, Source: src_issues, ValueColumn: id, NameColumn: name)\n }.Else{\n RadioGroup(Name: EncumbranceCertificate, Value: 0, Source: src_issues, ValueColumn: id, NameColumn: name)\n }\n }\n }\n }\n }\n }.Else{\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_legal_status)\n }\n }\n Div(#col_right#){\n If(#view_status_legal_status#==1){\n Em(Class: fa fa-check-circle text-success)\n }.ElseIf(#view_status_legal_status#==2){\n Em(Class: fa fa-exclamation-circle text-danger)\n }.Else{\n Em(Class: fa fa-question-circle text-muted)\n If(And(#owner#==1,#depart2_requests#==1)){\n Button(Body: ($lr_additional_request$), Class: btn-link p0 ml-sm, Contract: LrDepartRequest, Params: \"ObjectId=#view_id#,DepartNumber=2\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\")\n }\n }\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_encumbrance_certificate)\n }\n }\n Div(#col_right#){\n If(#view_status_encumbrance_certificate#==1){\n Em(Class: fa fa-check-circle text-success)\n }.ElseIf(#view_status_encumbrance_certificate#==2){\n Em(Class: fa fa-exclamation-circle text-danger)\n }.Else{\n Em(Class: fa fa-question-circle text-muted)\n If(And(#owner#==1,#depart2_requests#==1)){\n Button(Body: ($lr_additional_request$), Class: btn-link p0 ml-sm, Contract: LrDepartRequest, Params: \"ObjectId=#view_id#,DepartNumber=2\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\")\n }\n }\n }\n }\n }\n Div(list-group-item){\n Div(row){\n If(And(#notific_closed#==1,And(Or(#depart2#==1,#depart3#==1),#depart_checks#!=1,#view_step#==-1,#notific_recipient_member_id#==\"\")!=1)){\n Div(col-md-8 col-md-offset-2 text-center){\n Div(Class: h4, Body: Em(Class: fa fa-fw fa-check-circle text-muted) $lr_decision_made$)\n }\n }.Else{\n Div(col-md-2 text-center){\n If(#view_step#>=0){\n SetVar(o_id, 0)\n DBFind(\"@1members\").Where({\"id\": #view_owner_id#, \"ecosystem\": #ecosystem_id#}).Vars(o)\n If(Or(#o_id#>0,#o_id#<0)){\n SetVar(owner_image_id, #o_image_id#)\n SetVar(owner_member_name, #o_member_name#)\n }.Else{\n SetVar(owner_image_id, 0)\n SetVar(owner_member_name, Address(#view_owner_id#))\n }\n LinkPage(Page: @1profile_view, PageParams: \"v_key_id=#view_owner_id#\"){\n If(#owner_image_id#>0){\n Image(Src: Binary().ById(#owner_image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63;)\n }.Else{\n Span(Em(Class: fa icon-user fa-2x))\n }\n Div(Class: short-name text-bold, Body: #owner_member_name#)\n }\n Div(Class: text-muted m0, Body: ($lr_owner$))\n }\n }\n Div(col-md-8 text-center){\n If(And(#notific_page_params_info_message#==1,And(Or(#depart2#==1,#depart3#==1),#depart_checks#!=1,#view_step#==-1,#notific_recipient_member_id#==\"\")!=1)){\n If(#notific_page_params_info_status#==\"success\"){\n Div(Class: h4, Body: Em(Class: fa fa-fw fa-check-circle text-success) #notific_notification_body#)\n }.Else{\n Div(Class: h4, Body: Em(Class: fa fa-fw fa-times text-danger) #notific_notification_body#)\n }\n If(#notific_closed#==0){\n Button(Body: LangRes(@1ok), Class: btn btn-primary mb, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\", Page: #back_page#)\n }\n }.ElseIf(And(#view_step#==-1,#available_for_sale#!=1)){\n Div(Class: h4, Body: Em(Class: fa fa-fw fa-hourglass-o text-primary) $lr_awaiting_depart_checks$)\n If(Or(#depart2#==1,#depart3#==1)){\n Button(Body: LangRes(lr_save_results), Class: btn btn-primary mb, Contract: LrDepartChecks, Params: \"ObjectId=#view_id#,RoleId=#role_id#\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\")\n }\n }.ElseIf(And(#view_step#==-1,#available_for_sale#==1)){\n Div(Class: h4, Body: Em(Class: fa fa-fw fa-check-circle text-success) $lr_available_for_purchase$)\n If(#owner#!=1){\n Button(Body: LangRes(lr_purchase), Class: btn btn-success mb, Contract: LrPurchaseSteps, Params: \"ObjectId=#view_id#,Step=#view_step#\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\").Alert($lr_want_initiate_purchase$, $@1confirm_button$, $@1cancel$)\n }\n }.ElseIf(#view_step#==0){\n Div(Class: h4, Body: Em(Class: fa fa-fw fa-hourglass-1 text-primary) $lr_awaiting_owner_accept$)\n If(#owner#==1){\n Button(Body: LangRes(@1reject), Class: btn btn-danger mb, Contract: LrPurchaseSteps, Params: \"ObjectId=#view_id#,Step=#view_step#,Decision=reject\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\").Alert($lr_want_reject_purchase$, $@1confirm_button$, $@1cancel$)\n Button(Body: LangRes(@1accept), Class: btn btn-success mb, Contract: LrPurchaseSteps, Params: \"ObjectId=#view_id#,Step=#view_step#,Decision=accept\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\").Alert($lr_want_accept_purchase$, $@1confirm_button$, $@1cancel$)\n }\n }.ElseIf(#view_step#==1){\n Div(Class: h4, Body: Em(Class: fa fa-fw fa-hourglass-2 text-primary) $lr_awaiting_buyer_deposit$)\n If(Or(#owner#==1,#buyer#==1)){\n Button(Body: LangRes(@1cancel), Class: btn btn-danger mb, Contract: LrPurchaseSteps, Params: \"ObjectId=#view_id#,Step=#view_step#,Decision=cancel\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\").Alert($lr_want_cancel_deal$, $@1confirm_button$, $@1cancel$)\n }\n If(#buyer#==1){\n SetVar(bank_role_id, AppParam(App: #app_id#, Name: lr_bank_role))\n DBFind(\"@1roles_participants\").Where({\"role->id\": #bank_role_id#, \"deleted\": 0, \"ecosystem\": #ecosystem_id#}).Columns(\"id,member->member_id\").Vars(bank)\n SetVar(bank_account,Address(#bank_member_member_id#))\n If(#bank_id#>0){\n Button(Body: LangRes(lr_deposit_money), Class: btn btn-success mb, Contract: LrPurchaseSteps, Params: \"ObjectId=#view_id#,Step=#view_step#,Decision=deposit\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\").CompositeContract(@1TokensSend, [{\"Amount\": #view_price#, \"Recipient\": \"#bank_account#\"}])\n }\n }\n }.ElseIf(#view_step#==2){\n Div(Class: h4, Body: Em(Class: fa fa-fw fa-hourglass-3 text-primary) $lr_awaiting_bank_transfer$)\n If(#bank#==1){\n Button(Body: LangRes(@1cancel), Class: btn btn-danger mb, Contract: LrPurchaseSteps, Params: \"ObjectId=#view_id#,RoleId=#role_id#,Step=#view_step#,Decision=cancel\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\").Alert($lr_want_cancel_deal$, $@1confirm_button$, $@1cancel$)\n Button(Body: LangRes(lr_finalize_deal), Class: btn btn-success mb, Contract: LrPurchaseSteps, Params: \"ObjectId=#view_id#,RoleId=#role_id#,Step=#view_step#,Decision=finalize\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\").CompositeContract(@1TokensSend, [{\"Amount\": #view_price#, \"Recipient\": \"#view_owner_id#\"}])\n }\n }\n }\n Div(col-md-2 text-center){\n If(#view_step#>=0){\n SetVar(b_id, 0)\n DBFind(\"@1members\").Where({\"id\": #view_buyer_id#, \"ecosystem\": #ecosystem_id#}).Vars(b)\n If(Or(#b_id#>0,#b_id#<0)){\n SetVar(buyer_image_id, #b_image_id#)\n SetVar(buyer_member_name, #b_member_name#)\n }.Else{\n SetVar(buyer_, 0)\n SetVar(buyer_member_name, Address(#view_buyer_id#))\n }\n LinkPage(Page: @1profile_view, PageParams: \"v_key_id=#view_buyer_id#\"){\n If(#buyer_image_id#>0){\n Image(Src: Binary().ById(#buyer_image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63;)\n }.Else{\n Span(Em(Class: fa icon-user fa-2x))\n }\n Div(Class: short-name text-bold, Body: #buyer_member_name#)\n }\n Div(Class: text-muted m0, Body: ($lr_owner$))\n }\n }\n }\n }\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#, PageParams: \"sales_list=#sales_list#\")\n }.Style(\n .short-name {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n )\n}.Else{\n Form(){\n Div(alert alert-danger text-center){\n LangRes(@1attention)\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: lr_list)\n }\n}", + "Value": "If(#notific_id# > 0){\n DBFind(\"@1notifications\").Where({\"id\": \"#notific_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Columns(\"notification->body,recipient->account,page_params->object_id,page_params->info_message,page_params->info_status,closed\").Vars(notific)\n SetVar(object_id, #notific_page_params_object_id#)\n SetVar(back_page,@1notifications_list)\n}\n\nIf(#object_id# > 0){\n Include(lr_check_rights)\n DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Land registry\"}).Columns(\"name,id\").Vars(app)\n AppParam(App: #app_id#, Name: lr_issues, Source: src_issues)\n SetVar(col_left,\"col-md-4 text-right\").(col_right,\"col-md-8 text-left\")\n DBFind(\"land_registry\", src).WhereId(#object_id#).Columns(\"id,owner_account,buyer_account,step,specifications->map_coords,specifications->address,specifications->area,specifications->land_type,specifications->land_use,specifications->buildings_class,specifications->land_authority,registration_date,date_created,modification_date,status->legal_status,status->encumbrance_certificate,status->tax_receipt_and_bills,price,market_price,government_price\").Vars(view)\n SetVar(custom_token_title, \"APLA\")\n If(#ecosystem_id# > 1){\n DBFind(\"@1ecosystems\").Where({\"id\": \"#ecosystem_id#\"}).Vars(custom)\n }\n\n If(#view_owner_account# == #account_id#){\n SetVar(owner, 1)\n DBFind(\"@1notifications\").Where({\"page_params->object_id\": \"#view_id#\", \"page_params->depart2_requests\": 2, \"ecosystem\": \"#ecosystem_id#\"}).Columns(\"id\").Vars(depart2)\n DBFind(\"@1notifications\").Where({\"page_params->object_id\": \"#view_id#\", \"page_params->depart3_requests\": 2, \"ecosystem\": \"#ecosystem_id#\"}).Columns(\"id\").Vars(depart3)\n If(#depart2_id# > 0){\n SetVar(depart2_requests, 2)\n }.Else{\n SetVar(depart2_requests, 1)\n }\n If(#depart3_id# > 0){\n SetVar(depart3_requests, 2)\n }.Else{\n SetVar(depart3_requests, 1)\n }\n }\n If(#view_buyer_account# == #account_id#){\n SetVar(buyer, 1)\n }\n If(And(#view_status_legal_status# == 1, #view_status_encumbrance_certificate# == 1, #view_status_tax_receipt_and_bills# == 1, #view_government_price# > 0, #view_market_price# > 0)){\n SetVar(depart_checks, 1)\n If(And(#depart_checks# == 1, #view_step# == -1, #view_price# > 0)){\n SetVar(available_for_sale, 1)\n }\n }\n\n Form(){\n Div(){\n Map(MapType: streets, Hmap: 250, Value: #view_specifications_map_coords#)\n }\n Div(row mt){\n Div(#col_left# mt-sm){\n Label(){\n LangRes(lr_owner)\n }\n }\n Div(#col_right#){\n SetVar(m_account,)\n DBFind(\"@1members\").Where({\"account\": \"#view_owner_account#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(m)\n If(#m_account#){\n SetVar(image_id, #m_image_id#)\n SetVar(member_name, #m_member_name#)\n }.Else{\n SetVar(image_id, 0)\n SetVar(member_name, #view_owner_account#)\n }\n LinkPage(Page: @1profile_view, PageParams: \"v_account=#view_owner_account#\"){\n If(#image_id# > 0){\n Image(Src: Binary().ById(#image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63;)\n Span(Class: ml-sm text-bold, Body: #member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x))\n Span(Class: ml-sm text-bold, Body: #member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n }\n }\n Div(row mt-sm){\n Div(#col_left#){\n Label(){\n LangRes(lr_location)\n }\n }\n Div(#col_right#){\n If(#view_specifications_address#){\n Span(#view_specifications_address#)\n }.Else{\n Span($lr_no_address_found$)\n }\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_area_size)\n }\n }\n Div(#col_right#){\n Span(#view_specifications_area#)\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(@1date_created)\n }\n }\n Div(#col_right#){\n If(#view_date_created#>0){\n SetVar(view_date_created, DateTime(#view_date_created#, \"YYYY-MM-DD\"))\n Span(#view_date_created#)\n }\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_registration_date)\n }\n }\n Div(#col_right#){\n If(#view_registration_date#>0){\n SetVar(view_registration_date, DateTime(#view_registration_date#, \"YYYY-MM-DD\"))\n Span(#view_registration_date#)\n }\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_modification_date)\n }\n }\n Div(#col_right#){\n If(#view_modification_date#>0){\n SetVar(view_modification_date, DateTime(#view_modification_date#, \"YYYY-MM-DD\"))\n Span(#view_modification_date#)\n }\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(@1type)\n }\n }\n Div(#col_right#){\n SetVar(view_specifications_land_type, AppParam(App: #app_id#, Name: lr_land_type, Index: #view_specifications_land_type#))\n Span(#view_specifications_land_type#)\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_land_use)\n }\n }\n Div(#col_right#){\n SetVar(view_specifications_land_use, AppParam(App: #app_id#, Name: lr_land_use, Index: #view_specifications_land_use#))\n Span(#view_specifications_land_use#)\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_buildings_class)\n }\n }\n Div(#col_right#){\n SetVar(view_specifications_buildings_class, AppParam(App: #app_id#, Name: lr_buildings_class, Index: #view_specifications_buildings_class#))\n Span(#view_specifications_buildings_class#)\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_land_authority)\n }\n }\n Div(#col_right#){\n SetVar(view_specifications_land_authority, AppParam(App: #app_id#, Name: lr_land_authority, Index: #view_specifications_land_authority#))\n Span(#view_specifications_land_authority#)\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_price)\n }\n }\n Div(#col_right#){\n If(#view_price#>0){\n SetVar(view_price, Money(#view_price#))\n Span(#view_price# #custom_token_title#)\n }.Else{\n Em(Class: fa fa-question-circle text-muted)\n }\n }\n }\n If(And(#depart3# == 1, #depart_checks# != 1, #notific_recipient_account# == \"\")){\n Div(list-group-item){\n Div(row mt-sm){\n Div(#col_left# mt-sm){\n Label(){\n LangRes(lr_market_price)\n }\n }\n Div(#col_right#){\n If(#view_market_price#>0){\n SetVar(view_market_price, Money(#view_market_price#))\n Input(Name: MarketPrice, Value: #view_market_price#)\n }.Else{\n Input(Name: MarketPrice)\n }\n }\n }\n Div(row mt-sm){\n Div(#col_left# mt-sm){\n Label(){\n LangRes(lr_government_price)\n }\n }\n Div(#col_right#){\n If(#view_government_price#>0){\n SetVar(view_government_price, Money(#view_government_price#))\n Input(Name: GovernmentPrice, Value: #view_government_price#)\n }.Else{\n Input(Name: GovernmentPrice)\n }\n }\n }\n Div(row mt-sm){\n Div(#col_left#){\n Label(){\n LangRes(lr_taxes_and_bills)\n }\n }\n Div(#col_right#){\n Div(form-inline){\n If(#view_status_tax_receipt_and_bills#>0){\n RadioGroup(Name: TaxReceiptAndBills, Value: #view_status_tax_receipt_and_bills#, Source: src_issues, ValueColumn: id, NameColumn: name)\n }.Else{\n RadioGroup(Name: TaxReceiptAndBills, Value: 0, Source: src_issues, ValueColumn: id, NameColumn: name)\n }\n }\n }\n }\n }\n }.Else{\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_market_price)\n }\n }\n Div(#col_right#){\n If(#view_market_price#>0){\n SetVar(view_market_price, Money(#view_market_price#))\n Span(#view_market_price# #custom_token_title#)\n }.Else{\n Em(Class: fa fa-question-circle text-muted)\n If(And(#owner#==1,#depart3_requests#==1)){\n Button(Body: ($lr_additional_request$), Class: btn-link p0 ml-sm, Contract: LrDepartRequest, Params: \"ObjectId=#view_id#,DepartNumber=3\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\")\n }\n }\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_government_price)\n }\n }\n Div(#col_right#){\n If(#view_government_price#>0){\n SetVar(view_government_price, Money(#view_government_price#))\n Span(#view_government_price# #custom_token_title#)\n }.Else{\n Em(Class: fa fa-question-circle text-muted)\n If(And(#owner#==1,#depart3_requests#==1)){\n Button(Body: ($lr_additional_request$), Class: btn-link p0 ml-sm, Contract: LrDepartRequest, Params: \"ObjectId=#view_id#,DepartNumber=3\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\")\n }\n }\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_taxes_and_bills)\n }\n }\n Div(#col_right#){\n If(#view_status_tax_receipt_and_bills#==1){\n Em(Class: fa fa-check-circle text-success)\n }.ElseIf(#view_status_tax_receipt_and_bills#==2){\n Em(Class: fa fa-exclamation-circle text-danger)\n }.Else{\n Em(Class: fa fa-question-circle text-muted)\n If(And(#owner#==1,#depart3_requests#==1)){\n Button(Body: ($lr_additional_request$), Class: btn-link p0 ml-sm, Contract: LrDepartRequest, Params: \"ObjectId=#view_id#,DepartNumber=3\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\")\n }\n }\n }\n }\n }\n If(And(#depart2#==1,#depart_checks#!=1,#notific_recipient_account#==\"\")){\n Div(list-group-item){\n Div(row mt-sm){\n Div(#col_left#){\n Label(){\n LangRes(lr_legal_status)\n }\n }\n Div(#col_right#){\n Div(form-inline){\n If(#view_status_legal_status#>0){\n RadioGroup(Name: LegalStatus, Value: #view_status_legal_status#, Source: src_issues, ValueColumn: id, NameColumn: name)\n }.Else{\n RadioGroup(Name: LegalStatus, Value: 0, Source: src_issues, ValueColumn: id, NameColumn: name)\n }\n }\n }\n }\n Div(row mt-sm){\n Div(#col_left#){\n Label(){\n LangRes(lr_encumbrance_certificate)\n }\n }\n Div(#col_right#){\n Div(form-inline){\n If(#view_status_encumbrance_certificate#>0){\n RadioGroup(Name: EncumbranceCertificate, Value: #view_status_encumbrance_certificate#, Source: src_issues, ValueColumn: id, NameColumn: name)\n }.Else{\n RadioGroup(Name: EncumbranceCertificate, Value: 0, Source: src_issues, ValueColumn: id, NameColumn: name)\n }\n }\n }\n }\n }\n }.Else{\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_legal_status)\n }\n }\n Div(#col_right#){\n If(#view_status_legal_status#==1){\n Em(Class: fa fa-check-circle text-success)\n }.ElseIf(#view_status_legal_status#==2){\n Em(Class: fa fa-exclamation-circle text-danger)\n }.Else{\n Em(Class: fa fa-question-circle text-muted)\n If(And(#owner#==1,#depart2_requests#==1)){\n Button(Body: ($lr_additional_request$), Class: btn-link p0 ml-sm, Contract: LrDepartRequest, Params: \"ObjectId=#view_id#,DepartNumber=2\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\")\n }\n }\n }\n }\n Div(row){\n Div(#col_left#){\n Label(){\n LangRes(lr_encumbrance_certificate)\n }\n }\n Div(#col_right#){\n If(#view_status_encumbrance_certificate#==1){\n Em(Class: fa fa-check-circle text-success)\n }.ElseIf(#view_status_encumbrance_certificate#==2){\n Em(Class: fa fa-exclamation-circle text-danger)\n }.Else{\n Em(Class: fa fa-question-circle text-muted)\n If(And(#owner#==1,#depart2_requests#==1)){\n Button(Body: ($lr_additional_request$), Class: btn-link p0 ml-sm, Contract: LrDepartRequest, Params: \"ObjectId=#view_id#,DepartNumber=2\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\")\n }\n }\n }\n }\n }\n Div(list-group-item){\n Div(row){\n If(And(#notific_closed#==1,And(Or(#depart2#==1,#depart3#==1),#depart_checks#!=1,#view_step#==-1,#notific_recipient_account#==\"\")!=1)){\n Div(col-md-8 col-md-offset-2 text-center){\n Div(Class: h4, Body: Em(Class: fa fa-fw fa-check-circle text-muted) $lr_decision_made$)\n }\n }.Else{\n Div(col-md-2 text-center){\n If(#view_step#>=0){\n SetVar(o_account,)\n DBFind(\"@1members\").Where({\"account\": \"#view_owner_account#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(o)\n If(#o_account#){\n SetVar(owner_image_id, #o_image_id#)\n SetVar(owner_member_name, #o_member_name#)\n }.Else{\n SetVar(owner_image_id, 0)\n SetVar(owner_member_name, #view_owner_account#)\n }\n LinkPage(Page: @1profile_view, PageParams: \"v_account=#view_owner_account#\"){\n If(#owner_image_id#>0){\n Image(Src: Binary().ById(#owner_image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63;)\n }.Else{\n Span(Em(Class: fa icon-user fa-2x))\n }\n Div(Class: short-name text-bold, Body: #owner_member_name#)\n }\n Div(Class: text-muted m0, Body: ($lr_owner$))\n }\n }\n Div(col-md-8 text-center){\n If(And(#notific_page_params_info_message#==1,And(Or(#depart2#==1,#depart3#==1),#depart_checks#!=1,#view_step#==-1,#notific_recipient_account#==\"\")!=1)){\n If(#notific_page_params_info_status#==\"success\"){\n Div(Class: h4, Body: Em(Class: fa fa-fw fa-check-circle text-success) #notific_notification_body#)\n }.Else{\n Div(Class: h4, Body: Em(Class: fa fa-fw fa-times text-danger) #notific_notification_body#)\n }\n If(#notific_closed#==0){\n Button(Body: LangRes(@1ok), Class: btn btn-primary mb, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\", Page: #back_page#)\n }\n }.ElseIf(And(#view_step#==-1,#available_for_sale#!=1)){\n Div(Class: h4, Body: Em(Class: fa fa-fw fa-hourglass-o text-primary) $lr_awaiting_depart_checks$)\n If(Or(#depart2#==1,#depart3#==1)){\n Button(Body: LangRes(lr_save_results), Class: btn btn-primary mb, Contract: LrDepartChecks, Params: \"ObjectId=#view_id#,RoleId=#role_id#\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\")\n }\n }.ElseIf(And(#view_step#==-1,#available_for_sale#==1)){\n Div(Class: h4, Body: Em(Class: fa fa-fw fa-check-circle text-success) $lr_available_for_purchase$)\n If(#owner#!=1){\n Button(Body: LangRes(lr_purchase), Class: btn btn-success mb, Contract: LrPurchaseSteps, Params: \"ObjectId=#view_id#,Step=#view_step#\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\").Alert($lr_want_initiate_purchase$, $@1confirm_button$, $@1cancel$)\n }\n }.ElseIf(#view_step#==0){\n Div(Class: h4, Body: Em(Class: fa fa-fw fa-hourglass-1 text-primary) $lr_awaiting_owner_accept$)\n If(#owner#==1){\n Button(Body: LangRes(@1reject), Class: btn btn-danger mb, Contract: LrPurchaseSteps, Params: \"ObjectId=#view_id#,Step=#view_step#,Decision=reject\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\").Alert($lr_want_reject_purchase$, $@1confirm_button$, $@1cancel$)\n Button(Body: LangRes(@1accept), Class: btn btn-success mb, Contract: LrPurchaseSteps, Params: \"ObjectId=#view_id#,Step=#view_step#,Decision=accept\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\").Alert($lr_want_accept_purchase$, $@1confirm_button$, $@1cancel$)\n }\n }.ElseIf(#view_step#==1){\n Div(Class: h4, Body: Em(Class: fa fa-fw fa-hourglass-2 text-primary) $lr_awaiting_buyer_deposit$)\n If(Or(#owner#==1,#buyer#==1)){\n Button(Body: LangRes(@1cancel), Class: btn btn-danger mb, Contract: LrPurchaseSteps, Params: \"ObjectId=#view_id#,Step=#view_step#,Decision=cancel\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\").Alert($lr_want_cancel_deal$, $@1confirm_button$, $@1cancel$)\n }\n If(#buyer#==1){\n SetVar(bank_role_id, AppParam(App: #app_id#, Name: lr_bank_role))\n DBFind(\"@1roles_participants\").Where({\"role->id\": \"#bank_role_id#\", \"deleted\": 0, \"ecosystem\": \"#ecosystem_id#\"}).Columns(\"id,member->account\").Vars(bank)\n SetVar(bank_account, #bank_member_account#)\n If(#bank_id#>0){\n Button(Body: LangRes(lr_deposit_money), Class: btn btn-success mb, Contract: LrPurchaseSteps, Params: \"ObjectId=#view_id#,Step=#view_step#,Decision=deposit\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\").CompositeContract(@1TokensSend, [{\"Amount\": #view_price#, \"Recipient\": \"#bank_account#\"}])\n }\n }\n }.ElseIf(#view_step#==2){\n Div(Class: h4, Body: Em(Class: fa fa-fw fa-hourglass-3 text-primary) $lr_awaiting_bank_transfer$)\n If(#bank#==1){\n Button(Body: LangRes(@1cancel), Class: btn btn-danger mb, Contract: LrPurchaseSteps, Params: \"ObjectId=#view_id#,RoleId=#role_id#,Step=#view_step#,Decision=cancel\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\").Alert($lr_want_cancel_deal$, $@1confirm_button$, $@1cancel$)\n Button(Body: LangRes(lr_finalize_deal), Class: btn btn-success mb, Contract: LrPurchaseSteps, Params: \"ObjectId=#view_id#,RoleId=#role_id#,Step=#view_step#,Decision=finalize\", Page: #back_page#, PageParams: \"sales_list=#sales_list#\").CompositeContract(@1TokensSend, [{\"Amount\": #view_price#, \"Recipient\": \"#view_owner_account#\"}])\n }\n }\n }\n Div(col-md-2 text-center){\n If(#view_step#>=0){\n SetVar(b_account,)\n DBFind(\"@1members\").Where({\"account\": \"#view_buyer_account#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(b)\n If(#b_account#){\n SetVar(buyer_image_id, #b_image_id#)\n SetVar(buyer_member_name, #b_member_name#)\n }.Else{\n SetVar(buyer_, 0)\n SetVar(buyer_member_name, #view_buyer_account#)\n }\n LinkPage(Page: @1profile_view, PageParams: \"v_account=#view_buyer_account#\"){\n If(#buyer_image_id#>0){\n Image(Src: Binary().ById(#buyer_image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63;)\n }.Else{\n Span(Em(Class: fa icon-user fa-2x))\n }\n Div(Class: short-name text-bold, Body: #buyer_member_name#)\n }\n Div(Class: text-muted m0, Body: ($lr_buyer$))\n }\n }\n }\n }\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#, PageParams: \"sales_list=#sales_list#\")\n }.Style(\n .short-name {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n )\n}.Else{\n Form(){\n Div(alert alert-danger text-center){\n LangRes(@1attention)\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: lr_list)\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "LrAdd", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "contract LrAdd {\n data {\n Coords string\n LandUse int\n LandType int\n LandAuthority int\n BuildingsUseClass int\n RegistrationDate string\n Price money\n }\n\n conditions {\n $app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Land registry\"}).One(\"id\")\n if $app_id > 0 {\n if AppParam(Int($app_id), \"lr_depart2_role\", $ecosystem_id) == 0 || AppParam(Int($app_id), \"lr_depart3_role\", $ecosystem_id) == 0 || AppParam(Int($app_id), \"lr_bank_role\", $ecosystem_id) == 0 || AppParam(Int($app_id), \"lr_admin_role\", $ecosystem_id) == 0 {\n info LangRes(\"lr_all_roles_needed\", \"en\")\n }\n } else {\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n }\n\n action {\n var coords map coordsAddress, area string unixRegDate int\n coords = JSONToMap($Coords)\n coordsAddress = coords[\"address\"]\n area = Sprintf(\"%.0f\", coords[\"area\"])\n unixRegDate = UnixDateTime(Sprintf(\"%s %s\", $RegistrationDate, \"00:00:00\"))\n\n var m specifications map objectId int\n specifications[\"address\"] = coordsAddress\n specifications[\"area\"] = area\n specifications[\"buildings_class\"] = $BuildingsUseClass\n specifications[\"map_coords\"] = $Coords\n specifications[\"land_use\"] = $LandUse\n specifications[\"land_type\"] = $LandType\n specifications[\"land_authority\"] = $LandAuthority\n\n m[\"owner_id\"] = $key_id\n m[\"deleted\"] = 0\n m[\"date_created\"] = $block_time\n m[\"registration_date\"] = unixRegDate\n m[\"modification_date\"] = $block_time\n m[\"price\"] = $Price\n m[\"specifications\"] = specifications\n m[\"buyer_id\"] = $key_id\n m[\"step\"] = \"-1\"\n\n objectId = DBInsert(\"land_registry\", m)\n\n // notifications to all departments\n var depart_map depart2_params depart3_params map\n depart2_params[\"object_id\"] = objectId\n depart2_params[\"depart2_requests\"] = 1\n\n depart_map[\"Sender\"] = 1\n depart_map[\"Rid\"] = Int(AppParam(Int($app_id), \"lr_depart2_role\", $ecosystem_id))\n depart_map[\"Page\"] = \"lr_view\"\n depart_map[\"Header\"] = LangRes(\"lr_new_object\", \"en\")\n depart_map[\"Body\"] = LangRes(\"lr_need_processing\", \"en\")\n depart_map[\"Icon\"] = \"fa fa-bell-o\"\n depart_map[\"Closure\"] = 1\n depart_map[\"Popup\"] = \"true\"\n depart_map[\"Params\"] = depart2_params\n\n CallContract(\"@1NotificationsSend\", depart_map)\n\n depart3_params[\"object_id\"] = objectId\n depart3_params[\"depart3_requests\"] = 1\n\n depart_map[\"Rid\"] = Int(AppParam(Int($app_id), \"lr_depart3_role\", $ecosystem_id))\n depart_map[\"Params\"] = depart3_params\n\n CallContract(\"@1NotificationsSend\", depart_map)\n }\n}", + "Value": "contract LrAdd {\n data {\n Coords string\n LandUse int\n LandType int\n LandAuthority int\n BuildingsUseClass int\n RegistrationDate string\n Price money\n }\n\n conditions {\n $app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Land registry\"}).One(\"id\")\n if $app_id > 0 {\n if AppParam(Int($app_id), \"lr_depart2_role\", $ecosystem_id) == 0 || AppParam(Int($app_id), \"lr_depart3_role\", $ecosystem_id) == 0 || AppParam(Int($app_id), \"lr_bank_role\", $ecosystem_id) == 0 || AppParam(Int($app_id), \"lr_admin_role\", $ecosystem_id) == 0 {\n info LangRes(\"lr_all_roles_needed\", \"en\")\n }\n } else {\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n }\n\n action {\n var coords map coordsAddress, area string unixRegDate int\n coords = JSONToMap($Coords)\n coordsAddress = coords[\"address\"]\n area = Sprintf(\"%.0f\", coords[\"area\"])\n unixRegDate = UnixDateTime(Sprintf(\"%s %s\", $RegistrationDate, \"00:00:00\"))\n\n var m specifications map objectId int\n specifications[\"address\"] = coordsAddress\n specifications[\"area\"] = area\n specifications[\"buildings_class\"] = $BuildingsUseClass\n specifications[\"map_coords\"] = $Coords\n specifications[\"land_use\"] = $LandUse\n specifications[\"land_type\"] = $LandType\n specifications[\"land_authority\"] = $LandAuthority\n\n m[\"owner_account\"] = $account_id\n m[\"deleted\"] = 0\n m[\"date_created\"] = $block_time\n m[\"registration_date\"] = unixRegDate\n m[\"modification_date\"] = $block_time\n m[\"price\"] = $Price\n m[\"specifications\"] = specifications\n m[\"buyer_account\"] = $account_id\n m[\"step\"] = \"-1\"\n\n objectId = DBInsert(\"land_registry\", m)\n\n // notifications to all departments\n var depart_map depart2_params depart3_params map\n depart2_params[\"object_id\"] = objectId\n depart2_params[\"depart2_requests\"] = 1\n\n depart_map[\"Sender\"] = 1\n depart_map[\"Rid\"] = Int(AppParam(Int($app_id), \"lr_depart2_role\", $ecosystem_id))\n depart_map[\"Page\"] = \"lr_view\"\n depart_map[\"Header\"] = LangRes(\"lr_new_object\", \"en\")\n depart_map[\"Body\"] = LangRes(\"lr_need_processing\", \"en\")\n depart_map[\"Icon\"] = \"fa fa-bell-o\"\n depart_map[\"Closure\"] = 1\n depart_map[\"Popup\"] = \"true\"\n depart_map[\"Params\"] = depart2_params\n\n CallContract(\"@1NotificationsSend\", depart_map)\n\n depart3_params[\"object_id\"] = objectId\n depart3_params[\"depart3_requests\"] = 1\n\n depart_map[\"Rid\"] = Int(AppParam(Int($app_id), \"lr_depart3_role\", $ecosystem_id))\n depart_map[\"Params\"] = depart3_params\n\n CallContract(\"@1NotificationsSend\", depart_map)\n }\n}", "Type": "contracts" }, { "Name": "LrDepartChecks", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "contract LrDepartChecks {\n data {\n ObjectId int\n LegalStatus int \"optional\"\n EncumbranceCertificate int \"optional\"\n TaxReceiptAndBills int \"optional\"\n GovernmentPrice money \"optional\"\n MarketPrice money \"optional\"\n RoleId int\n }\n\n conditions {\n $app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Land registry\"}).One(\"id\")\n $depart2_role = Int(AppParam(Int($app_id), \"lr_depart2_role\", $ecosystem_id))\n $depart3_role = Int(AppParam(Int($app_id), \"lr_depart3_role\", $ecosystem_id))\n\n if $app_id > 0 {\n if $depart2_role == 0 || $depart3_role == 0 || AppParam(Int($app_id), \"lr_admin_role\", $ecosystem_id) == 0 || AppParam(Int($app_id), \"lr_bank_role\", $ecosystem_id) == 0 {\n info LangRes(\"lr_all_roles_needed\", \"en\")\n }\n } else {\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n }\n\n action {\n var object status m map\n\n if $RoleId == $depart2_role {\n object = DBFind(\"land_registry\").WhereId($ObjectId).Row()\n if object[\"status\"] {\n var depart3_status map\n depart3_status = JSONDecode(object[\"status\"])\n if depart3_status[\"tax_receipt_and_bills\"] {\n status[\"tax_receipt_and_bills\"] = depart3_status[\"tax_receipt_and_bills\"]\n }\n }\n status[\"legal_status\"] = $LegalStatus\n status[\"encumbrance_certificate\"] = $EncumbranceCertificate\n m[\"modification_date\"] = $block_time\n m[\"status\"] = status\n DBUpdate(\"land_registry\", $ObjectId, m)\n\n // closing all opened role notifications\n var opened map i int\n opened = DBFind(\"@1notifications\").Where({\"recipient->role_id\": $depart2_role, \"page_params->object_id\": $ObjectId, \"closed\": 0, \"ecosystem\": $ecosystem_id})\n\n while i < Len(opened) {\n var current map current_id int\n current = opened[i]\n current_id = Int(current[\"id\"])\n @1NotificationsProcess(\"NotificId\", current_id)\n @1NotificationsClose(\"NotificId\", current_id)\n i = i + 1\n }\n }\n if $RoleId == $depart3_role {\n object = DBFind(\"land_registry\").WhereId($ObjectId).Row()\n if object[\"status\"] {\n var depart2_status map\n depart2_status = JSONDecode(object[\"status\"])\n if depart2_status[\"legal_status\"] {\n status[\"legal_status\"] = depart2_status[\"legal_status\"]\n }\n if depart2_status[\"encumbrance_certificate\"] {\n status[\"encumbrance_certificate\"] = depart2_status[\"encumbrance_certificate\"]\n }\n }\n\n status[\"tax_receipt_and_bills\"] = $TaxReceiptAndBills\n m[\"government_price\"] = $GovernmentPrice\n m[\"market_price\"] = $MarketPrice\n m[\"modification_date\"] = $block_time\n m[\"status\"] = status\n DBUpdate(\"land_registry\", $ObjectId, m)\n\n // closing all opened role notifications\n var opened map i int\n opened = DBFind(\"@1notifications\").Where({\"recipient->role_id\": $depart3_role, \"page_params->object_id\": $ObjectId, \"closed\": 0, \"ecosystem\": $ecosystem_id})\n\n while i < Len(opened) {\n var current map current_id int\n current = opened[i]\n current_id = Int(current[\"id\"])\n @1NotificationsProcess(\"NotificId\", current_id)\n @1NotificationsClose(\"NotificId\", current_id)\n i = i + 1\n }\n }\n\n // checking if the object is ready for sale\n object = DBFind(\"land_registry\").WhereId($ObjectId).Row()\n if Money(object[\"price\"]) > 0 && Money(object[\"market_price\"]) > 0 && Money(object[\"government_price\"]) > 0 && object[\"deleted\"] != 1 {\n var status_map map\n status_map = JSONDecode(object[\"status\"])\n if status_map[\"legal_status\"] == 1 && status_map[\"encumbrance_certificate\"] == 1 && status_map[\"tax_receipt_and_bills\"] == 1 {\n // notification to the object owner\n var n params map\n n[\"Sender\"] = 1\n n[\"Page\"] = \"lr_view\"\n n[\"Icon\"] = \"fa fa-bell-o\"\n n[\"Popup\"] = \"true\"\n n[\"MemberId\"] = object[\"owner_id\"]\n n[\"Header\"] = LangRes(\"lr_object_status\", \"en\")\n n[\"Body\"] = LangRes(\"lr_checks_successfull\", \"en\")\n params[\"object_id\"] = $ObjectId\n params[\"info_message\"] = 1\n params[\"info_status\"] = \"success\"\n n[\"Params\"] = params\n CallContract(\"@1NotificationsSend\", n)\n }\n }\n }\n}", + "Value": "contract LrDepartChecks {\n data {\n ObjectId int\n LegalStatus int \"optional\"\n EncumbranceCertificate int \"optional\"\n TaxReceiptAndBills int \"optional\"\n GovernmentPrice money \"optional\"\n MarketPrice money \"optional\"\n RoleId int\n }\n\n conditions {\n $app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Land registry\"}).One(\"id\")\n $depart2_role = Int(AppParam(Int($app_id), \"lr_depart2_role\", $ecosystem_id))\n $depart3_role = Int(AppParam(Int($app_id), \"lr_depart3_role\", $ecosystem_id))\n\n if $app_id > 0 {\n if $depart2_role == 0 || $depart3_role == 0 || AppParam(Int($app_id), \"lr_admin_role\", $ecosystem_id) == 0 || AppParam(Int($app_id), \"lr_bank_role\", $ecosystem_id) == 0 {\n info LangRes(\"lr_all_roles_needed\", \"en\")\n }\n } else {\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n }\n\n action {\n var object status m map\n\n if $RoleId == $depart2_role {\n object = DBFind(\"land_registry\").WhereId($ObjectId).Row()\n if object[\"status\"] {\n var depart3_status map\n depart3_status = JSONDecode(object[\"status\"])\n if depart3_status[\"tax_receipt_and_bills\"] {\n status[\"tax_receipt_and_bills\"] = depart3_status[\"tax_receipt_and_bills\"]\n }\n }\n status[\"legal_status\"] = $LegalStatus\n status[\"encumbrance_certificate\"] = $EncumbranceCertificate\n m[\"modification_date\"] = $block_time\n m[\"status\"] = status\n DBUpdate(\"land_registry\", $ObjectId, m)\n\n // closing all opened role notifications\n var opened map i int\n opened = DBFind(\"@1notifications\").Where({\"recipient->role_id\": $depart2_role, \"page_params->object_id\": $ObjectId, \"closed\": 0, \"ecosystem\": $ecosystem_id})\n\n while i < Len(opened) {\n var current map current_id int\n current = opened[i]\n current_id = Int(current[\"id\"])\n @1NotificationsProcess(\"NotificId\", current_id)\n @1NotificationsClose(\"NotificId\", current_id)\n i = i + 1\n }\n }\n if $RoleId == $depart3_role {\n object = DBFind(\"land_registry\").WhereId($ObjectId).Row()\n if object[\"status\"] {\n var depart2_status map\n depart2_status = JSONDecode(object[\"status\"])\n if depart2_status[\"legal_status\"] {\n status[\"legal_status\"] = depart2_status[\"legal_status\"]\n }\n if depart2_status[\"encumbrance_certificate\"] {\n status[\"encumbrance_certificate\"] = depart2_status[\"encumbrance_certificate\"]\n }\n }\n\n status[\"tax_receipt_and_bills\"] = $TaxReceiptAndBills\n m[\"government_price\"] = $GovernmentPrice\n m[\"market_price\"] = $MarketPrice\n m[\"modification_date\"] = $block_time\n m[\"status\"] = status\n DBUpdate(\"land_registry\", $ObjectId, m)\n\n // closing all opened role notifications\n var opened map i int\n opened = DBFind(\"@1notifications\").Where({\"recipient->role_id\": $depart3_role, \"page_params->object_id\": $ObjectId, \"closed\": 0, \"ecosystem\": $ecosystem_id})\n\n while i < Len(opened) {\n var current map current_id int\n current = opened[i]\n current_id = Int(current[\"id\"])\n @1NotificationsProcess(\"NotificId\", current_id)\n @1NotificationsClose(\"NotificId\", current_id)\n i = i + 1\n }\n }\n\n // checking if the object is ready for sale\n object = DBFind(\"land_registry\").WhereId($ObjectId).Row()\n if Money(object[\"price\"]) > 0 && Money(object[\"market_price\"]) > 0 && Money(object[\"government_price\"]) > 0 && object[\"deleted\"] != 1 {\n var status_map map\n status_map = JSONDecode(object[\"status\"])\n if status_map[\"legal_status\"] == 1 && status_map[\"encumbrance_certificate\"] == 1 && status_map[\"tax_receipt_and_bills\"] == 1 {\n // notification to the object owner\n var n params map\n n[\"Sender\"] = 1\n n[\"Page\"] = \"lr_view\"\n n[\"Icon\"] = \"fa fa-bell-o\"\n n[\"Popup\"] = \"true\"\n n[\"MemberAccount\"] = object[\"owner_account\"]\n n[\"Header\"] = LangRes(\"lr_object_status\", \"en\")\n n[\"Body\"] = LangRes(\"lr_checks_successfull\", \"en\")\n params[\"object_id\"] = $ObjectId\n params[\"info_message\"] = 1\n params[\"info_status\"] = \"success\"\n n[\"Params\"] = params\n CallContract(\"@1NotificationsSend\", n)\n }\n }\n }\n}", "Type": "contracts" }, { @@ -498,13 +498,13 @@ { "Name": "LrEdit", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "contract LrEdit {\n data {\n ObjectId int\n LandUse int \"optional\"\n LandType int \"optional\"\n LandAuthority int \"optional\"\n BuildingsUseClass int \"optional\"\n RegistrationDate string \"optional\"\n Price money \"optional\"\n DeleteObject int \"optional\"\n RoleId int\n }\n\n func log(property, value string) {\n var history map\n if property == \"land_use\" || property == \"land_type\" || property == \"land_authority\" || property == \"buildings_class\" {\n if Int(value) != Int($old_specifications[property]) {\n history[\"old_value\"] = Int($old_specifications[property])\n history[\"object_id\"] = $ObjectId\n history[\"attribute_name\"] = property\n history[\"new_value\"] = value\n history[\"member_id\"] = $key_id\n history[\"date\"] = $block_time\n DBInsert(\"land_registry_history\", history)\n }\n } elif value != $object[property] {\n history[\"old_value\"] = Str($object[property])\n history[\"object_id\"] = $ObjectId\n history[\"attribute_name\"] = property\n history[\"new_value\"] = value\n history[\"member_id\"] = $key_id\n history[\"date\"] = $block_time\n DBInsert(\"land_registry_history\", history)\n }\n }\n\n conditions {\n $app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Land registry\"}).One(\"id\")\n $object = DBFind(\"land_registry\").WhereId($ObjectId).Row()\n $admin_role = Int(AppParam(Int($app_id), \"lr_admin_role\", $ecosystem_id))\n\n if $app_id > 0 {\n if $admin_role == 0 || AppParam(Int($app_id), \"lr_bank_role\", $ecosystem_id) == 0 || AppParam(Int($app_id), \"lr_depart2_role\", $ecosystem_id) == 0 || AppParam(Int($app_id), \"lr_depart3_role\", $ecosystem_id) == 0 {\n info LangRes(\"lr_all_roles_needed\", \"en\")\n }\n } else {\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n }\n\n action {\n if $DeleteObject != 1 {\n if $RoleId == $admin_role {\n var specifications m map unixRegDate int\n unixRegDate = UnixDateTime(Sprintf(\"%s %s\", $RegistrationDate, \"00:00:00\"))\n $old_specifications = JSONDecode($object[\"specifications\"])\n\n specifications[\"address\"] = $old_specifications[\"address\"]\n specifications[\"area\"] = $old_specifications[\"area\"]\n specifications[\"map_coords\"] = $old_specifications[\"map_coords\"]\n specifications[\"land_use\"] = $LandUse\n specifications[\"land_type\"] = $LandType\n specifications[\"land_authority\"] = $LandAuthority\n specifications[\"buildings_class\"] = $BuildingsUseClass\n\n m[\"registration_date\"] = unixRegDate\n m[\"specifications\"] = specifications\n DBUpdate(\"land_registry\", $ObjectId, m)\n\n log(\"land_use\", Str($LandUse))\n log(\"land_type\", Str($LandType))\n log(\"land_authority\", Str($LandAuthority))\n log(\"buildings_class\", Str($BuildingsUseClass))\n log(\"registration_date\", Str(unixRegDate))\n }\n if $object[\"owner_id\"] == $key_id {\n DBUpdate(\"land_registry\", $ObjectId, {\"price\": $Price})\n log(\"price\", Str($Price))\n }\n } else {\n if $object[\"owner_id\"] == $key_id || $RoleId == $admin_role {\n DBUpdate(\"land_registry\", $ObjectId, {\"deleted\": 1})\n log(\"deleted\", Str($DeleteObject))\n }\n }\n }\n}", + "Value": "contract LrEdit {\n data {\n ObjectId int\n LandUse int \"optional\"\n LandType int \"optional\"\n LandAuthority int \"optional\"\n BuildingsUseClass int \"optional\"\n RegistrationDate string \"optional\"\n Price money \"optional\"\n DeleteObject int \"optional\"\n RoleId int\n }\n\n func log(property, value string) {\n var history map\n if property == \"land_use\" || property == \"land_type\" || property == \"land_authority\" || property == \"buildings_class\" {\n if Int(value) != Int($old_specifications[property]) {\n history[\"old_value\"] = Int($old_specifications[property])\n history[\"object_id\"] = $ObjectId\n history[\"attribute_name\"] = property\n history[\"new_value\"] = value\n history[\"account\"] = $account_id\n history[\"date\"] = $block_time\n DBInsert(\"land_registry_history\", history)\n }\n } elif value != $object[property] {\n history[\"old_value\"] = Str($object[property])\n history[\"object_id\"] = $ObjectId\n history[\"attribute_name\"] = property\n history[\"new_value\"] = value\n history[\"account\"] = $account_id\n history[\"date\"] = $block_time\n DBInsert(\"land_registry_history\", history)\n }\n }\n\n conditions {\n $app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Land registry\"}).One(\"id\")\n $object = DBFind(\"land_registry\").WhereId($ObjectId).Row()\n $admin_role = Int(AppParam(Int($app_id), \"lr_admin_role\", $ecosystem_id))\n\n if $app_id > 0 {\n if $admin_role == 0 || AppParam(Int($app_id), \"lr_bank_role\", $ecosystem_id) == 0 || AppParam(Int($app_id), \"lr_depart2_role\", $ecosystem_id) == 0 || AppParam(Int($app_id), \"lr_depart3_role\", $ecosystem_id) == 0 {\n info LangRes(\"lr_all_roles_needed\", \"en\")\n }\n } else {\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n }\n\n action {\n if $DeleteObject != 1 {\n if $RoleId == $admin_role {\n var specifications m map unixRegDate int\n unixRegDate = UnixDateTime(Sprintf(\"%s %s\", $RegistrationDate, \"00:00:00\"))\n $old_specifications = JSONDecode($object[\"specifications\"])\n\n specifications[\"address\"] = $old_specifications[\"address\"]\n specifications[\"area\"] = $old_specifications[\"area\"]\n specifications[\"map_coords\"] = $old_specifications[\"map_coords\"]\n specifications[\"land_use\"] = $LandUse\n specifications[\"land_type\"] = $LandType\n specifications[\"land_authority\"] = $LandAuthority\n specifications[\"buildings_class\"] = $BuildingsUseClass\n\n m[\"registration_date\"] = unixRegDate\n m[\"specifications\"] = specifications\n DBUpdate(\"land_registry\", $ObjectId, m)\n\n log(\"land_use\", Str($LandUse))\n log(\"land_type\", Str($LandType))\n log(\"land_authority\", Str($LandAuthority))\n log(\"buildings_class\", Str($BuildingsUseClass))\n log(\"registration_date\", Str(unixRegDate))\n }\n if $object[\"owner_account\"] == $account_id {\n DBUpdate(\"land_registry\", $ObjectId, {\"price\": $Price})\n log(\"price\", Str($Price))\n }\n } else {\n if $object[\"owner_account\"] == $account_id || $RoleId == $admin_role {\n DBUpdate(\"land_registry\", $ObjectId, {\"deleted\": 1})\n log(\"deleted\", Str($DeleteObject))\n }\n }\n }\n}", "Type": "contracts" }, { "Name": "LrPurchaseSteps", "Conditions": "ContractConditions(\"AdminCondition\")", - "Value": "contract LrPurchaseSteps {\n data {\n ObjectId int\n Step int\n Decision string \"optional\"\n RoleId int \"optional\"\n }\n\n conditions {\n $app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Land registry\"}).One(\"id\")\n $object = DBFind(\"land_registry\").WhereId($ObjectId).Row()\n $bank_role = Int(AppParam(Int($app_id), \"lr_bank_role\", $ecosystem_id))\n\n var bank_id int\n bank_id = DBFind(\"@1roles_participants\").Where({\"role->id\": $bank_role, \"deleted\": 0, \"ecosystem\": $ecosystem_id}).One(\"member->member_id\")\n if !bank_id {\n warning LangRes(\"lr_bank_account_not_found\", \"en\")\n }\n }\n\n action {\n var owner buyer int\n owner = $object[\"owner_id\"]\n buyer = $object[\"buyer_id\"]\n\n var m params map\n m[\"Sender\"] = 1\n m[\"Header\"] = LangRes(\"lr_deal_status\", \"en\")\n m[\"Body\"] = LangRes(\"lr_need_processing\", \"en\")\n m[\"Page\"] = \"lr_view\"\n m[\"Icon\"] = \"fa fa-bell-o\"\n m[\"Popup\"] = \"true\"\n params[\"object_id\"] = $ObjectId\n\n if $Step == -1 {\n DBUpdate(\"land_registry\", $ObjectId, {\"buyer_id\": $key_id, \"step\": 0})\n\n // notification to the object owner\n m[\"MemberId\"] = owner\n m[\"Header\"] = LangRes(\"lr_new_offer\", \"en\")\n m[\"Params\"] = params\n CallContract(\"@1NotificationsSend\", m)\n\n } elif $Step == 0 && $key_id == Int(owner) {\n if $Decision == \"accept\" {\n DBUpdate(\"land_registry\", $ObjectId, {\"step\": 1})\n m[\"Body\"] = LangRes(\"lr_purchase_accepted\", \"en\")\n } elif $Decision == \"reject\" {\n DBUpdate(\"land_registry\", $ObjectId, {\"buyer_id\": owner, \"step\": \"-1\"})\n m[\"Body\"] = LangRes(\"lr_purchase_rejected\", \"en\")\n params[\"info_message\"] = 1\n params[\"info_status\"] = \"fail\"\n }\n\n // notification to the object buyer\n m[\"MemberId\"] = buyer\n m[\"Params\"] = params\n CallContract(\"@1NotificationsSend\", m)\n\n } elif $Step == 1 && $key_id == Int(buyer) {\n if $Decision == \"deposit\" {\n DBUpdate(\"land_registry\", $ObjectId, {\"step\": 2})\n\n // notification to the land bank\n m[\"Rid\"] = Int(AppParam(Int($app_id), \"lr_bank_role\", $ecosystem_id))\n m[\"Header\"] = LangRes(\"lr_new_object\", \"en\")\n m[\"Closure\"] = 1\n m[\"Params\"] = params\n CallContract(\"@1NotificationsSend\", m)\n\n // notification to the object owner\n var n map\n n[\"Sender\"] = 1\n n[\"Page\"] = \"lr_view\"\n n[\"Icon\"] = \"fa fa-bell-o\"\n n[\"Popup\"] = \"true\"\n n[\"MemberId\"] = owner\n n[\"Header\"] = LangRes(\"lr_deal_status\", \"en\")\n n[\"Body\"] = LangRes(\"lr_buyer_made_deposit\", \"en\")\n params[\"info_message\"] = 1\n params[\"info_status\"] = \"success\"\n n[\"Params\"] = params\n CallContract(\"@1NotificationsSend\", n)\n\n } elif $Decision == \"cancel\" {\n DBUpdate(\"land_registry\", $ObjectId, {\"buyer_id\": owner, \"step\": \"-1\"})\n\n if $key_id == Int(owner) {\n // notification to the object buyer\n m[\"MemberId\"] = buyer\n m[\"Body\"] = LangRes(\"lr_owner_cancelled_purchase\", \"en\")\n } else {\n // notification to the object owner\n m[\"MemberId\"] = owner\n m[\"Body\"] = LangRes(\"lr_buyer_cancelled_purchase\", \"en\")\n }\n\n params[\"info_message\"] = 1\n params[\"info_status\"] = \"fail\"\n m[\"Params\"] = params\n CallContract(\"@1NotificationsSend\", m)\n }\n\n } elif $Step == 2 && $RoleId == $bank_role {\n var n status_map map\n status_map[\"legal_status\"] = 0\n status_map[\"encumbrance_certificate\"] = 0\n status_map[\"tax_receipt_and_bills\"] = 0\n\n if $Decision == \"finalize\" {\n DBUpdate(\"land_registry\", $ObjectId, {\"owner_id\": buyer, \"buyer_id\": buyer, \"step\": \"-1\", \"status\": status_map})\n params[\"info_message\"] = 1\n params[\"info_status\"] = \"success\"\n m[\"Body\"] = LangRes(\"lr_deal_successful\", \"en\")\n n[\"Body\"] = LangRes(\"lr_deal_successful\", \"en\")\n } elif $Decision == \"cancel\" {\n DBUpdate(\"land_registry\", $ObjectId, {\"owner_id\": owner, \"buyer_id\": owner, \"step\": \"-1\", \"status\": status_map})\n params[\"info_message\"] = 1\n params[\"info_status\"] = \"fail\"\n m[\"Body\"] = LangRes(\"lr_deal_cancelled_by_bank\", \"en\")\n n[\"Body\"] = LangRes(\"lr_deal_cancelled_by_bank\", \"en\")\n }\n\n // notification to the old object owner\n m[\"MemberId\"] = owner\n m[\"Params\"] = params\n CallContract(\"@1NotificationsSend\", m)\n\n // notification to the new object owner\n n[\"Sender\"] = 1\n n[\"Page\"] = \"lr_view\"\n n[\"Icon\"] = \"fa fa-bell-o\"\n n[\"Popup\"] = \"true\"\n n[\"MemberId\"] = buyer\n n[\"Header\"] = LangRes(\"lr_deal_status\", \"en\")\n n[\"Params\"] = params\n CallContract(\"@1NotificationsSend\", n)\n }\n\n // closing all opened notifications\n var opened map i int\n if $Step == 2 && $RoleId == $bank_role {\n opened = DBFind(\"@1notifications\").Where({\"recipient->role_id\": $bank_role, \"page_params->object_id\": $ObjectId, \"closed\": 0, \"ecosystem\": $ecosystem_id})\n } else {\n opened = DBFind(\"@1notifications\").Where({\"recipient->member_id\": $key_id, \"page_params->object_id\": $ObjectId, \"closed\": 0, \"ecosystem\": $ecosystem_id})\n }\n\n while i < Len(opened) {\n var current map current_id int\n current = opened[i]\n current_id = Int(current[\"id\"])\n if $Step == 2 && $RoleId == $bank_role {\n @1NotificationsProcess(\"NotificId\", current_id)\n }\n @1NotificationsClose(\"NotificId\", current_id)\n i = i + 1\n }\n }\n}", + "Value": "contract LrPurchaseSteps {\n data {\n ObjectId int\n Step int\n Decision string \"optional\"\n RoleId int \"optional\"\n }\n\n conditions {\n $app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Land registry\"}).One(\"id\")\n $object = DBFind(\"land_registry\").WhereId($ObjectId).Row()\n $bank_role = Int(AppParam(Int($app_id), \"lr_bank_role\", $ecosystem_id))\n\n var bank_id int\n bank_id = DBFind(\"@1roles_participants\").Where({\"role->id\": $bank_role, \"deleted\": 0, \"ecosystem\": $ecosystem_id}).One(\"member->account\")\n if !bank_id {\n warning LangRes(\"lr_bank_account_not_found\", \"en\")\n }\n }\n\n action {\n var owner buyer int\n owner = $object[\"owner_account\"]\n buyer = $object[\"buyer_account\"]\n\n var m params map\n m[\"Sender\"] = 1\n m[\"Header\"] = LangRes(\"lr_deal_status\", \"en\")\n m[\"Body\"] = LangRes(\"lr_need_processing\", \"en\")\n m[\"Page\"] = \"lr_view\"\n m[\"Icon\"] = \"fa fa-bell-o\"\n m[\"Popup\"] = \"true\"\n params[\"object_id\"] = $ObjectId\n\n if $Step == -1 {\n DBUpdate(\"land_registry\", $ObjectId, {\"buyer_account\": $account_id, \"step\": 0})\n\n // notification to the object owner\n m[\"MemberAccount\"] = owner\n m[\"Header\"] = LangRes(\"lr_new_offer\", \"en\")\n m[\"Params\"] = params\n CallContract(\"@1NotificationsSend\", m)\n\n } elif $Step == 0 && $account_id == owner {\n if $Decision == \"accept\" {\n DBUpdate(\"land_registry\", $ObjectId, {\"step\": 1})\n m[\"Body\"] = LangRes(\"lr_purchase_accepted\", \"en\")\n } elif $Decision == \"reject\" {\n DBUpdate(\"land_registry\", $ObjectId, {\"buyer_account\": owner, \"step\": \"-1\"})\n m[\"Body\"] = LangRes(\"lr_purchase_rejected\", \"en\")\n params[\"info_message\"] = 1\n params[\"info_status\"] = \"fail\"\n }\n\n // notification to the object buyer\n m[\"MemberAccount\"] = buyer\n m[\"Params\"] = params\n CallContract(\"@1NotificationsSend\", m)\n\n } elif $Step == 1 && $account_id == buyer {\n if $Decision == \"deposit\" {\n DBUpdate(\"land_registry\", $ObjectId, {\"step\": 2})\n\n // notification to the land bank\n m[\"Rid\"] = Int(AppParam(Int($app_id), \"lr_bank_role\", $ecosystem_id))\n m[\"Header\"] = LangRes(\"lr_new_object\", \"en\")\n m[\"Closure\"] = 1\n m[\"Params\"] = params\n CallContract(\"@1NotificationsSend\", m)\n\n // notification to the object owner\n var n map\n n[\"Sender\"] = 1\n n[\"Page\"] = \"lr_view\"\n n[\"Icon\"] = \"fa fa-bell-o\"\n n[\"Popup\"] = \"true\"\n n[\"MemberAccount\"] = owner\n n[\"Header\"] = LangRes(\"lr_deal_status\", \"en\")\n n[\"Body\"] = LangRes(\"lr_buyer_made_deposit\", \"en\")\n params[\"info_message\"] = 1\n params[\"info_status\"] = \"success\"\n n[\"Params\"] = params\n CallContract(\"@1NotificationsSend\", n)\n\n } elif $Decision == \"cancel\" {\n DBUpdate(\"land_registry\", $ObjectId, {\"buyer_account\": owner, \"step\": \"-1\"})\n\n if $account_id == owner {\n // notification to the object buyer\n m[\"MemberAccount\"] = buyer\n m[\"Body\"] = LangRes(\"lr_owner_cancelled_purchase\", \"en\")\n } else {\n // notification to the object owner\n m[\"MemberAccount\"] = owner\n m[\"Body\"] = LangRes(\"lr_buyer_cancelled_purchase\", \"en\")\n }\n\n params[\"info_message\"] = 1\n params[\"info_status\"] = \"fail\"\n m[\"Params\"] = params\n CallContract(\"@1NotificationsSend\", m)\n }\n\n } elif $Step == 2 && $RoleId == $bank_role {\n var n status_map map\n status_map[\"legal_status\"] = 0\n status_map[\"encumbrance_certificate\"] = 0\n status_map[\"tax_receipt_and_bills\"] = 0\n\n if $Decision == \"finalize\" {\n DBUpdate(\"land_registry\", $ObjectId, {\"owner_account\": buyer, \"buyer_account\": buyer, \"step\": \"-1\", \"status\": status_map})\n params[\"info_message\"] = 1\n params[\"info_status\"] = \"success\"\n m[\"Body\"] = LangRes(\"lr_deal_successful\", \"en\")\n n[\"Body\"] = LangRes(\"lr_deal_successful\", \"en\")\n } elif $Decision == \"cancel\" {\n DBUpdate(\"land_registry\", $ObjectId, {\"owner_account\": owner, \"buyer_account\": owner, \"step\": \"-1\", \"status\": status_map})\n params[\"info_message\"] = 1\n params[\"info_status\"] = \"fail\"\n m[\"Body\"] = LangRes(\"lr_deal_cancelled_by_bank\", \"en\")\n n[\"Body\"] = LangRes(\"lr_deal_cancelled_by_bank\", \"en\")\n }\n\n // notification to the old object owner\n m[\"MemberAccount\"] = owner\n m[\"Params\"] = params\n CallContract(\"@1NotificationsSend\", m)\n\n // notification to the new object owner\n n[\"Sender\"] = 1\n n[\"Page\"] = \"lr_view\"\n n[\"Icon\"] = \"fa fa-bell-o\"\n n[\"Popup\"] = \"true\"\n n[\"MemberAccount\"] = buyer\n n[\"Header\"] = LangRes(\"lr_deal_status\", \"en\")\n n[\"Params\"] = params\n CallContract(\"@1NotificationsSend\", n)\n }\n\n // closing all opened notifications\n var opened map i int\n if $Step == 2 && $RoleId == $bank_role {\n opened = DBFind(\"@1notifications\").Where({\"recipient->role_id\": $bank_role, \"page_params->object_id\": $ObjectId, \"closed\": 0, \"ecosystem\": $ecosystem_id})\n } else {\n opened = DBFind(\"@1notifications\").Where({\"recipient->account\": $account_id, \"page_params->object_id\": $ObjectId, \"closed\": 0, \"ecosystem\": $ecosystem_id})\n }\n\n while i < Len(opened) {\n var current map current_id int\n current = opened[i]\n current_id = Int(current[\"id\"])\n if $Step == 2 && $RoleId == $bank_role {\n @1NotificationsProcess(\"NotificId\", current_id)\n }\n @1NotificationsClose(\"NotificId\", current_id)\n i = i + 1\n }\n }\n}", "Type": "contracts" }, { diff --git a/ecosystem_apps/land_registry/blocks/lr_check_rights.ptl b/ecosystem_apps/land_registry/blocks/lr_check_rights.ptl index 5ff90d2fa..c83ad95c0 100644 --- a/ecosystem_apps/land_registry/blocks/lr_check_rights.ptl +++ b/ecosystem_apps/land_registry/blocks/lr_check_rights.ptl @@ -1,4 +1,4 @@ -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Land registry"}).Vars("app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Land registry"}).Vars(app) SetVar(admin, 0).(bank, 0).(depart2, 0).(depart3, 0) If(#role_id# == AppParam(App: #app_id#, Name: "lr_admin_role")){ diff --git a/ecosystem_apps/land_registry/contracts/LrAdd.sim b/ecosystem_apps/land_registry/contracts/LrAdd.sim index 08800dc87..c71abb57d 100644 --- a/ecosystem_apps/land_registry/contracts/LrAdd.sim +++ b/ecosystem_apps/land_registry/contracts/LrAdd.sim @@ -36,14 +36,14 @@ contract LrAdd { specifications["land_type"] = $LandType specifications["land_authority"] = $LandAuthority - m["owner_id"] = $key_id + m["owner_account"] = $account_id m["deleted"] = 0 m["date_created"] = $block_time m["registration_date"] = unixRegDate m["modification_date"] = $block_time m["price"] = $Price m["specifications"] = specifications - m["buyer_id"] = $key_id + m["buyer_account"] = $account_id m["step"] = "-1" objectId = DBInsert("land_registry", m) diff --git a/ecosystem_apps/land_registry/contracts/LrDepartChecks.sim b/ecosystem_apps/land_registry/contracts/LrDepartChecks.sim index 4503a0043..bda8c3594 100644 --- a/ecosystem_apps/land_registry/contracts/LrDepartChecks.sim +++ b/ecosystem_apps/land_registry/contracts/LrDepartChecks.sim @@ -100,7 +100,7 @@ contract LrDepartChecks { n["Page"] = "lr_view" n["Icon"] = "fa fa-bell-o" n["Popup"] = "true" - n["MemberId"] = object["owner_id"] + n["MemberAccount"] = object["owner_account"] n["Header"] = LangRes("lr_object_status", "en") n["Body"] = LangRes("lr_checks_successfull", "en") params["object_id"] = $ObjectId diff --git a/ecosystem_apps/land_registry/contracts/LrEdit.sim b/ecosystem_apps/land_registry/contracts/LrEdit.sim index 26396253e..d4790296a 100644 --- a/ecosystem_apps/land_registry/contracts/LrEdit.sim +++ b/ecosystem_apps/land_registry/contracts/LrEdit.sim @@ -19,7 +19,7 @@ contract LrEdit { history["object_id"] = $ObjectId history["attribute_name"] = property history["new_value"] = value - history["member_id"] = $key_id + history["account"] = $account_id history["date"] = $block_time DBInsert("land_registry_history", history) } @@ -28,7 +28,7 @@ contract LrEdit { history["object_id"] = $ObjectId history["attribute_name"] = property history["new_value"] = value - history["member_id"] = $key_id + history["account"] = $account_id history["date"] = $block_time DBInsert("land_registry_history", history) } @@ -73,12 +73,12 @@ contract LrEdit { log("buildings_class", Str($BuildingsUseClass)) log("registration_date", Str(unixRegDate)) } - if $object["owner_id"] == $key_id { + if $object["owner_account"] == $account_id { DBUpdate("land_registry", $ObjectId, {"price": $Price}) log("price", Str($Price)) } } else { - if $object["owner_id"] == $key_id || $RoleId == $admin_role { + if $object["owner_account"] == $account_id || $RoleId == $admin_role { DBUpdate("land_registry", $ObjectId, {"deleted": 1}) log("deleted", Str($DeleteObject)) } diff --git a/ecosystem_apps/land_registry/contracts/LrPurchaseSteps.sim b/ecosystem_apps/land_registry/contracts/LrPurchaseSteps.sim index 873035df4..73bc63921 100644 --- a/ecosystem_apps/land_registry/contracts/LrPurchaseSteps.sim +++ b/ecosystem_apps/land_registry/contracts/LrPurchaseSteps.sim @@ -12,7 +12,7 @@ contract LrPurchaseSteps { $bank_role = Int(AppParam(Int($app_id), "lr_bank_role", $ecosystem_id)) var bank_id int - bank_id = DBFind("@1roles_participants").Where({"role->id": $bank_role, "deleted": 0, "ecosystem": $ecosystem_id}).One("member->member_id") + bank_id = DBFind("@1roles_participants").Where({"role->id": $bank_role, "deleted": 0, "ecosystem": $ecosystem_id}).One("member->account") if !bank_id { warning LangRes("lr_bank_account_not_found", "en") } @@ -20,8 +20,8 @@ contract LrPurchaseSteps { action { var owner buyer int - owner = $object["owner_id"] - buyer = $object["buyer_id"] + owner = $object["owner_account"] + buyer = $object["buyer_account"] var m params map m["Sender"] = 1 @@ -33,31 +33,31 @@ contract LrPurchaseSteps { params["object_id"] = $ObjectId if $Step == -1 { - DBUpdate("land_registry", $ObjectId, {"buyer_id": $key_id, "step": 0}) + DBUpdate("land_registry", $ObjectId, {"buyer_account": $account_id, "step": 0}) // notification to the object owner - m["MemberId"] = owner + m["MemberAccount"] = owner m["Header"] = LangRes("lr_new_offer", "en") m["Params"] = params CallContract("@1NotificationsSend", m) - } elif $Step == 0 && $key_id == Int(owner) { + } elif $Step == 0 && $account_id == owner { if $Decision == "accept" { DBUpdate("land_registry", $ObjectId, {"step": 1}) m["Body"] = LangRes("lr_purchase_accepted", "en") } elif $Decision == "reject" { - DBUpdate("land_registry", $ObjectId, {"buyer_id": owner, "step": "-1"}) + DBUpdate("land_registry", $ObjectId, {"buyer_account": owner, "step": "-1"}) m["Body"] = LangRes("lr_purchase_rejected", "en") params["info_message"] = 1 params["info_status"] = "fail" } // notification to the object buyer - m["MemberId"] = buyer + m["MemberAccount"] = buyer m["Params"] = params CallContract("@1NotificationsSend", m) - } elif $Step == 1 && $key_id == Int(buyer) { + } elif $Step == 1 && $account_id == buyer { if $Decision == "deposit" { DBUpdate("land_registry", $ObjectId, {"step": 2}) @@ -74,7 +74,7 @@ contract LrPurchaseSteps { n["Page"] = "lr_view" n["Icon"] = "fa fa-bell-o" n["Popup"] = "true" - n["MemberId"] = owner + n["MemberAccount"] = owner n["Header"] = LangRes("lr_deal_status", "en") n["Body"] = LangRes("lr_buyer_made_deposit", "en") params["info_message"] = 1 @@ -83,15 +83,15 @@ contract LrPurchaseSteps { CallContract("@1NotificationsSend", n) } elif $Decision == "cancel" { - DBUpdate("land_registry", $ObjectId, {"buyer_id": owner, "step": "-1"}) + DBUpdate("land_registry", $ObjectId, {"buyer_account": owner, "step": "-1"}) - if $key_id == Int(owner) { + if $account_id == owner { // notification to the object buyer - m["MemberId"] = buyer + m["MemberAccount"] = buyer m["Body"] = LangRes("lr_owner_cancelled_purchase", "en") } else { // notification to the object owner - m["MemberId"] = owner + m["MemberAccount"] = owner m["Body"] = LangRes("lr_buyer_cancelled_purchase", "en") } @@ -108,13 +108,13 @@ contract LrPurchaseSteps { status_map["tax_receipt_and_bills"] = 0 if $Decision == "finalize" { - DBUpdate("land_registry", $ObjectId, {"owner_id": buyer, "buyer_id": buyer, "step": "-1", "status": status_map}) + DBUpdate("land_registry", $ObjectId, {"owner_account": buyer, "buyer_account": buyer, "step": "-1", "status": status_map}) params["info_message"] = 1 params["info_status"] = "success" m["Body"] = LangRes("lr_deal_successful", "en") n["Body"] = LangRes("lr_deal_successful", "en") } elif $Decision == "cancel" { - DBUpdate("land_registry", $ObjectId, {"owner_id": owner, "buyer_id": owner, "step": "-1", "status": status_map}) + DBUpdate("land_registry", $ObjectId, {"owner_account": owner, "buyer_account": owner, "step": "-1", "status": status_map}) params["info_message"] = 1 params["info_status"] = "fail" m["Body"] = LangRes("lr_deal_cancelled_by_bank", "en") @@ -122,7 +122,7 @@ contract LrPurchaseSteps { } // notification to the old object owner - m["MemberId"] = owner + m["MemberAccount"] = owner m["Params"] = params CallContract("@1NotificationsSend", m) @@ -131,7 +131,7 @@ contract LrPurchaseSteps { n["Page"] = "lr_view" n["Icon"] = "fa fa-bell-o" n["Popup"] = "true" - n["MemberId"] = buyer + n["MemberAccount"] = buyer n["Header"] = LangRes("lr_deal_status", "en") n["Params"] = params CallContract("@1NotificationsSend", n) @@ -142,7 +142,7 @@ contract LrPurchaseSteps { if $Step == 2 && $RoleId == $bank_role { opened = DBFind("@1notifications").Where({"recipient->role_id": $bank_role, "page_params->object_id": $ObjectId, "closed": 0, "ecosystem": $ecosystem_id}) } else { - opened = DBFind("@1notifications").Where({"recipient->member_id": $key_id, "page_params->object_id": $ObjectId, "closed": 0, "ecosystem": $ecosystem_id}) + opened = DBFind("@1notifications").Where({"recipient->account": $account_id, "page_params->object_id": $ObjectId, "closed": 0, "ecosystem": $ecosystem_id}) } while i < Len(opened) { diff --git a/ecosystem_apps/land_registry/pages/lr_add.ptl b/ecosystem_apps/land_registry/pages/lr_add.ptl index 620b9bdb7..fc679f0a0 100644 --- a/ecosystem_apps/land_registry/pages/lr_add.ptl +++ b/ecosystem_apps/land_registry/pages/lr_add.ptl @@ -1,8 +1,8 @@ -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Land registry"}).Columns("name,id").Vars(app) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Land registry"}).Columns("name,id").Vars(app) SetVar(row,"row mt-sm").(col_left,"col-sm-3 text-right mt-sm").(col_right,"col-sm-9 text-left") SetVar(custom_token_title, "APLA") If(#ecosystem_id#>1){ - DBFind("@1ecosystems").Where({"id": #ecosystem_id#}).Vars("custom") + DBFind("@1ecosystems").Where({"id": "#ecosystem_id#"}).Vars(custom) } Div(content-wrapper){ diff --git a/ecosystem_apps/land_registry/pages/lr_edit.ptl b/ecosystem_apps/land_registry/pages/lr_edit.ptl index c329a4b05..6ca4a1a36 100644 --- a/ecosystem_apps/land_registry/pages/lr_edit.ptl +++ b/ecosystem_apps/land_registry/pages/lr_edit.ptl @@ -1,6 +1,6 @@ -If(#object_id#>0){ +If(#object_id# > 0){ Include(lr_check_rights) - DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Land registry"}).Columns("name,id").Vars(app) + DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Land registry"}).Columns("name,id").Vars(app) SetVar(row,"row mt-sm").(col_left,"col-md-3 mt-sm text-right").(col_right,"col-md-9 text-left") If(#edit_specifications_land_type#==""){ @@ -16,11 +16,11 @@ If(#object_id#>0){ SetVar(edit_specifications_land_authority,1) } SetVar(custom_token_title, "APLA") - If(#ecosystem_id#>1){ - DBFind("@1ecosystems").Where({"id": #ecosystem_id#}).Vars("custom") + If(#ecosystem_id# > 1){ + DBFind("@1ecosystems").Where({"id": "#ecosystem_id#"}).Vars(custom) } - DBFind(land_registry, src).WhereId(#object_id#).Columns("id,owner_id,specifications->map_coords,specifications->address,specifications->land_type,specifications->land_use,specifications->buildings_class,specifications->land_authority,registration_date,price").Vars(edit) + DBFind("land_registry", src).WhereId(#object_id#).Columns("id,owner_account,specifications->map_coords,specifications->address,specifications->land_type,specifications->land_use,specifications->buildings_class,specifications->land_authority,registration_date,price").Vars(edit) Form(){ Div(){ @@ -127,7 +127,7 @@ If(#object_id#>0){ If(#edit_price#>0){ SetVar(edit_price, Money(#edit_price#)) } - If(#edit_owner_id#==#key_id#){ + If(#edit_owner_account# == #account_id#){ Input(Name: Price, Value: #edit_price#) }.Else{ Input(Value: #edit_price#, Disabled: true) diff --git a/ecosystem_apps/land_registry/pages/lr_list.ptl b/ecosystem_apps/land_registry/pages/lr_list.ptl index e9b083f0d..d333a611b 100644 --- a/ecosystem_apps/land_registry/pages/lr_list.ptl +++ b/ecosystem_apps/land_registry/pages/lr_list.ptl @@ -3,27 +3,27 @@ Include(@1pager_header) Include(lr_check_rights) SetVar(custom_token_title, "APLA") -If(#ecosystem_id#>1){ - DBFind("@1ecosystems").Where({"id": #ecosystem_id#}).Vars("custom") +If(#ecosystem_id# > 1){ + DBFind("@1ecosystems").Where({"id": "#ecosystem_id#"}).Vars(custom) } -If(And(#sales_list#=="",#admin#!=1,#bank#!=1,#depart2#!=1,#depart3#!=1)){ +If(And(#sales_list# == "", #admin# != 1, #bank# != 1, #depart2# != 1, #depart3# != 1)){ SetVar(sales_list, 1) } -If(#sales_list#==1){ +If(#sales_list# == 1){ SetVar(title, $lr_sales$) Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$lr_sales_desc$")) - SetVar(filters, {"price": {"$gt": 0}, "government_price": {"$gt": 0}, "market_price": {"$gt": 0}, "status->legal_status": 1, "status->encumbrance_certificate": 1, "status->tax_receipt_and_bills": 1, "deleted": 0}) + SetVar(filters, `"price": {"$gt": 0}, "government_price": {"$gt": 0}, "market_price": {"$gt": 0}, "status->legal_status": 1, "status->encumbrance_certificate": 1, "status->tax_receipt_and_bills": 1, "deleted": 0`) }.Else{ SetVar(sales_list, 0) SetVar(title, $lr_land_registry$) Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$lr_list_desc$")) - If(And(#admin#!=1,#bank#!=1,#depart2#!=1,#depart3#!=1)){ - SetVar(filters, {"$or": [{"owner_id": #key_id#, "deleted": 0}, {"price": {"$gt": 0}, "government_price": {"$gt": 0}, "market_price": {"$gt": 0}, "status->legal_status": 1, "status->encumbrance_certificate": 1, "status->tax_receipt_and_bills": 1, "deleted": 0}]}) + If(And(#admin# != 1, #bank# != 1, #depart2# != 1, #depart3# != 1)){ + SetVar(filters, `"$or": [{"owner_account": "#account_id#", "deleted": 0}, {"price": {"$gt": 0}, "government_price": {"$gt": 0}, "market_price": {"$gt": 0}, "status->legal_status": 1, "status->encumbrance_certificate": 1, "status->tax_receipt_and_bills": 1, "deleted": 0}]`) }.Else{ - SetVar(filters, {"deleted": 0}) + SetVar(filters, `"deleted": 0`) } } @@ -42,12 +42,12 @@ If(#admin# == 1){ AddToolButton(Title: $@1add$, Page: lr_add, PageParams: "back_page=#this_page#,sales_list=#sales_list#", Icon: icon-plus) Div(btn-group ml-lg){ - If(#sales_list#==0){ + If(#sales_list# == 0){ Button(Body: Em(Class: fa fa-list) $lr_all_objects$, Page: #this_page#, PageParams: "sales_list=0", Class: btn bg-gray-lighter ml-sm) }.Else{ Button(Body: Em(Class: fa fa-list) $lr_all_objects$, Page: #this_page#, PageParams: "sales_list=0", Class: btn bg-gray ml-sm) } - If(#sales_list#==1){ + If(#sales_list# == 1){ Button(Body: Em(Class: fa fa-credit-card) $@1sales$, Page: #this_page#, PageParams: "sales_list=1", Class: btn bg-gray-lighter ml-sm) }.Else{ Button(Body: Em(Class: fa fa-credit-card) $@1sales$, Page: #this_page#, PageParams: "sales_list=1", Class: btn bg-gray ml-sm) @@ -57,7 +57,7 @@ Div(btn-group ml-lg){ If(#search#){ SetVar(where, {#filters#, "specifications->address": {"$ilike": "#search#"}}) }.Else{ - SetVar(where, #filters#) + SetVar(where, {#filters#}) } Div(list-group-item ml-lg mr-lg pt-lg){ @@ -65,7 +65,7 @@ Div(list-group-item ml-lg mr-lg pt-lg){ Include(@1search) } -DBFind(#this_table#, src).Where(#where#).Order({"id": -1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("owner_id,buyer_id,specifications->address,specifications->land_use,specifications->buildings_class,specifications->area,price,status->legal_status,status->encumbrance_certificate,status->tax_receipt_and_bills,step").Custom(location){ +DBFind(#this_table#, src).Where(#where#).Order({"id": "-1"}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("owner_account,buyer_account,specifications->address,specifications->land_use,specifications->buildings_class,specifications->area,price,status->legal_status,status->encumbrance_certificate,status->tax_receipt_and_bills,step").Custom(location){ If(#specifications.address#){ SetVar(location_name, #specifications.address#) }.Else{ @@ -79,16 +79,16 @@ DBFind(#this_table#, src).Where(#where#).Order({"id": -1}).Limit(#pager_limit#). Em(Class: fa fa-question-circle text-muted) } }.Custom(owner){ - SetVar(m_id, 0) - DBFind("@1members").Where({"id": #owner_id#, "ecosystem": #ecosystem_id#}).Vars(m) - If(Or(#m_id#>0,#m_id#<0)){ + SetVar(m_account,) + DBFind("@1members").Where({"account": "#owner_account#", "ecosystem": "#ecosystem_id#"}).Vars(m) + If(#m_account#){ SetVar(owner_image_id, #m_image_id#) SetVar(owner_member_name, #m_member_name#) }.Else{ SetVar(owner_image_id, 0) - SetVar(owner_member_name, Address(#owner_id#)) + SetVar(owner_member_name, #owner_account#) } - LinkPage(Page: @1profile_view, PageParams: "v_key_id=#owner_id#"){ + LinkPage(Page: @1profile_view, PageParams: "v_account=#owner_account#"){ If(#owner_image_id#>0){ Image(Src: Binary().ById(#owner_image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63;) Span(Class: ml-sm text-bold, Body: #owner_member_name#) @@ -100,18 +100,18 @@ DBFind(#this_table#, src).Where(#where#).Order({"id": -1}).Limit(#pager_limit#). } } }.Custom(buyer){ - If(#owner_id#!=#buyer_id#){ - SetVar(n_id, 0) - DBFind("@1members").Where({"id": #buyer_id#, "ecosystem": #ecosystem_id#}).Vars(n) - If(Or(#n_id#>0,#n_id#<0)){ + If(#owner_account# != #buyer_account#){ + SetVar(n_account,) + DBFind("@1members").Where({"account": "#buyer_account#", "ecosystem": "#ecosystem_id#"}).Vars(n) + If(#n_account#){ SetVar(buyer_image_id, #n_image_id#) SetVar(buyer_member_name, #n_member_name#) }.Else{ SetVar(buyer_image_id, 0) - SetVar(buyer_member_name, Address(#buyer_id#)) + SetVar(buyer_member_name, #buyer_account#) } - LinkPage(Page: @1profile_view, PageParams: "v_key_id=#buyer_id#"){ - If(#buyer_image_id#>0){ + LinkPage(Page: @1profile_view, PageParams: "v_account=#buyer_account#"){ + If(#buyer_image_id# > 0){ Image(Src: Binary().ById(#buyer_image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63;) Span(Class: ml-sm text-bold, Body: #buyer_member_name#) }.Else{ @@ -157,7 +157,7 @@ DBFind(#this_table#, src).Where(#where#).Order({"id": -1}).Limit(#pager_limit#). Em(Class: fa fa-question-circle text-muted) } }.Custom(actions){ - If(And(Or(#owner_id#==#key_id#,#admin#==1),#step#<2)){ + If(And(Or(#owner_account# == #account_id#, #admin# == 1), #step# < 2)){ Button(Page: #this_page#, PageParams: "sales_list=#sales_list#", Contract: LrEdit, Params: "ObjectId=#id#,RoleId=#role_id#,DeleteObject=1", Class: btn bg-gray-lighter pull-right ml-sm, Body: Em(Class: text-danger fa fa-trash)).Alert($lr_want_delete_object$, $@1confirm_button$, $@1cancel$) Button(Page: lr_edit, PageParams: "object_id=#id#,back_page=#this_page#,sales_list=#sales_list#", Class: btn bg-gray-lighter pull-right, Body: Em(Class: fa fa-edit)).Popup(50, $lr_object_edit$) } diff --git a/ecosystem_apps/land_registry/pages/lr_settings.ptl b/ecosystem_apps/land_registry/pages/lr_settings.ptl index 5527e688b..fa4c8a6d6 100644 --- a/ecosystem_apps/land_registry/pages/lr_settings.ptl +++ b/ecosystem_apps/land_registry/pages/lr_settings.ptl @@ -1,4 +1,4 @@ -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Land registry"}).Vars("app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Land registry"}).Vars(app) SetVar(this_page, "lr_settings").(admin_role,0).(bank_role,0).(depart2_role,0).(depart3_role,0) SetVar(admin_role, AppParam(App: #app_id#, Name: "lr_admin_role")) @@ -6,12 +6,12 @@ SetVar(bank_role, AppParam(App: #app_id#, Name: "lr_bank_role")) SetVar(depart2_role, AppParam(App: #app_id#, Name: "lr_depart2_role")) SetVar(depart3_role, AppParam(App: #app_id#, Name: "lr_depart3_role")) -DBFind("@1roles", src_roles).Where({"ecosystem": #ecosystem_id#, "deleted": 0}).Columns("role_name,id").Limit(100) +DBFind("@1roles", src_roles).Where({"ecosystem": "#ecosystem_id#", "deleted": 0}).Columns("role_name,id").Limit(100) SetVar(row,"row mt-sm").(col_left,"col-sm-4 text-right mt-sm").(col_right,"col-sm-8 text-left") If(#ecosystem_id#>1){ - DBFind("@1ecosystems").Where({"id": #ecosystem_id#}).Vars("custom") + DBFind("@1ecosystems").Where({"id": "#ecosystem_id#"}).Vars(custom) }.Else{ SetVar(custom_token_title, "APLA") } @@ -39,7 +39,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#admin_role# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #admin_role#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#admin_role#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# @@ -57,7 +57,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#bank_role# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #bank_role#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#bank_role#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# @@ -75,7 +75,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#depart2_role# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #depart2_role#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#depart2_role#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# @@ -93,7 +93,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#depart3_role# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #depart3_role#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#depart3_role#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# diff --git a/ecosystem_apps/land_registry/pages/lr_view.ptl b/ecosystem_apps/land_registry/pages/lr_view.ptl index 254ed5131..6c00d50bd 100644 --- a/ecosystem_apps/land_registry/pages/lr_view.ptl +++ b/ecosystem_apps/land_registry/pages/lr_view.ptl @@ -1,42 +1,42 @@ -If(#notific_id#>0){ - DBFind("@1notifications").Where({"id": #notific_id#, "ecosystem": #ecosystem_id#}).Columns("notification->body,recipient->member_id,page_params->object_id,page_params->info_message,page_params->info_status,closed").Vars(notific) +If(#notific_id# > 0){ + DBFind("@1notifications").Where({"id": "#notific_id#", "ecosystem": "#ecosystem_id#"}).Columns("notification->body,recipient->account,page_params->object_id,page_params->info_message,page_params->info_status,closed").Vars(notific) SetVar(object_id, #notific_page_params_object_id#) SetVar(back_page,@1notifications_list) } -If(#object_id#>0){ +If(#object_id# > 0){ Include(lr_check_rights) - DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Land registry"}).Columns("name,id").Vars(app) + DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Land registry"}).Columns("name,id").Vars(app) AppParam(App: #app_id#, Name: lr_issues, Source: src_issues) SetVar(col_left,"col-md-4 text-right").(col_right,"col-md-8 text-left") - DBFind("land_registry", src).WhereId(#object_id#).Columns("id,owner_id,buyer_id,step,specifications->map_coords,specifications->address,specifications->area,specifications->land_type,specifications->land_use,specifications->buildings_class,specifications->land_authority,registration_date,date_created,modification_date,status->legal_status,status->encumbrance_certificate,status->tax_receipt_and_bills,price,market_price,government_price").Vars(view) + DBFind("land_registry", src).WhereId(#object_id#).Columns("id,owner_account,buyer_account,step,specifications->map_coords,specifications->address,specifications->area,specifications->land_type,specifications->land_use,specifications->buildings_class,specifications->land_authority,registration_date,date_created,modification_date,status->legal_status,status->encumbrance_certificate,status->tax_receipt_and_bills,price,market_price,government_price").Vars(view) SetVar(custom_token_title, "APLA") - If(#ecosystem_id#>1){ - DBFind("@1ecosystems").Where({"id": #ecosystem_id#}).Vars("custom") + If(#ecosystem_id# > 1){ + DBFind("@1ecosystems").Where({"id": "#ecosystem_id#"}).Vars(custom) } - If(#view_owner_id#==#key_id#){ - SetVar(owner,1) - DBFind("@1notifications").Where({"page_params->object_id": #view_id#, "page_params->depart2_requests": 2, "ecosystem": #ecosystem_id#}).Columns("id").Vars(depart2) - DBFind("@1notifications").Where({"page_params->object_id": #view_id#, "page_params->depart3_requests": 2, "ecosystem": #ecosystem_id#}).Columns("id").Vars(depart3) - If(#depart2_id#>0){ - SetVar(depart2_requests,2) + If(#view_owner_account# == #account_id#){ + SetVar(owner, 1) + DBFind("@1notifications").Where({"page_params->object_id": "#view_id#", "page_params->depart2_requests": 2, "ecosystem": "#ecosystem_id#"}).Columns("id").Vars(depart2) + DBFind("@1notifications").Where({"page_params->object_id": "#view_id#", "page_params->depart3_requests": 2, "ecosystem": "#ecosystem_id#"}).Columns("id").Vars(depart3) + If(#depart2_id# > 0){ + SetVar(depart2_requests, 2) }.Else{ - SetVar(depart2_requests,1) + SetVar(depart2_requests, 1) } - If(#depart3_id#>0){ - SetVar(depart3_requests,2) + If(#depart3_id# > 0){ + SetVar(depart3_requests, 2) }.Else{ - SetVar(depart3_requests,1) + SetVar(depart3_requests, 1) } } - If(#view_buyer_id#==#key_id#){ - SetVar(buyer,1) + If(#view_buyer_account# == #account_id#){ + SetVar(buyer, 1) } - If(And(#view_status_legal_status#==1,#view_status_encumbrance_certificate#==1,#view_status_tax_receipt_and_bills#==1,#view_government_price#>0,#view_market_price#>0)){ - SetVar(depart_checks,1) - If(And(#depart_checks#==1,#view_step#==-1,#view_price#>0)){ - SetVar(available_for_sale,1) + If(And(#view_status_legal_status# == 1, #view_status_encumbrance_certificate# == 1, #view_status_tax_receipt_and_bills# == 1, #view_government_price# > 0, #view_market_price# > 0)){ + SetVar(depart_checks, 1) + If(And(#depart_checks# == 1, #view_step# == -1, #view_price# > 0)){ + SetVar(available_for_sale, 1) } } @@ -51,17 +51,17 @@ If(#object_id#>0){ } } Div(#col_right#){ - SetVar(m_id, 0) - DBFind("@1members").Where({"id": #view_owner_id#, "ecosystem": #ecosystem_id#}).Vars(m) - If(Or(#m_id#>0,#m_id#<0)){ + SetVar(m_account,) + DBFind("@1members").Where({"account": "#view_owner_account#", "ecosystem": "#ecosystem_id#"}).Vars(m) + If(#m_account#){ SetVar(image_id, #m_image_id#) SetVar(member_name, #m_member_name#) }.Else{ SetVar(image_id, 0) - SetVar(member_name, Address(#view_owner_id#)) + SetVar(member_name, #view_owner_account#) } - LinkPage(Page: @1profile_view, PageParams: "v_key_id=#view_owner_id#"){ - If(#image_id#>0){ + LinkPage(Page: @1profile_view, PageParams: "v_account=#view_owner_account#"){ + If(#image_id# > 0){ Image(Src: Binary().ById(#image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63;) Span(Class: ml-sm text-bold, Body: #member_name#) }.Else{ @@ -195,7 +195,7 @@ If(#object_id#>0){ } } } - If(And(#depart3#==1,#depart_checks#!=1,#notific_recipient_member_id#=="")){ + If(And(#depart3# == 1, #depart_checks# != 1, #notific_recipient_account# == "")){ Div(list-group-item){ Div(row mt-sm){ Div(#col_left# mt-sm){ @@ -301,7 +301,7 @@ If(#object_id#>0){ } } } - If(And(#depart2#==1,#depart_checks#!=1,#notific_recipient_member_id#=="")){ + If(And(#depart2#==1,#depart_checks#!=1,#notific_recipient_account#=="")){ Div(list-group-item){ Div(row mt-sm){ Div(#col_left#){ @@ -378,23 +378,23 @@ If(#object_id#>0){ } Div(list-group-item){ Div(row){ - If(And(#notific_closed#==1,And(Or(#depart2#==1,#depart3#==1),#depart_checks#!=1,#view_step#==-1,#notific_recipient_member_id#=="")!=1)){ + If(And(#notific_closed#==1,And(Or(#depart2#==1,#depart3#==1),#depart_checks#!=1,#view_step#==-1,#notific_recipient_account#=="")!=1)){ Div(col-md-8 col-md-offset-2 text-center){ Div(Class: h4, Body: Em(Class: fa fa-fw fa-check-circle text-muted) $lr_decision_made$) } }.Else{ Div(col-md-2 text-center){ If(#view_step#>=0){ - SetVar(o_id, 0) - DBFind("@1members").Where({"id": #view_owner_id#, "ecosystem": #ecosystem_id#}).Vars(o) - If(Or(#o_id#>0,#o_id#<0)){ + SetVar(o_account,) + DBFind("@1members").Where({"account": "#view_owner_account#", "ecosystem": "#ecosystem_id#"}).Vars(o) + If(#o_account#){ SetVar(owner_image_id, #o_image_id#) SetVar(owner_member_name, #o_member_name#) }.Else{ SetVar(owner_image_id, 0) - SetVar(owner_member_name, Address(#view_owner_id#)) + SetVar(owner_member_name, #view_owner_account#) } - LinkPage(Page: @1profile_view, PageParams: "v_key_id=#view_owner_id#"){ + LinkPage(Page: @1profile_view, PageParams: "v_account=#view_owner_account#"){ If(#owner_image_id#>0){ Image(Src: Binary().ById(#owner_image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63;) }.Else{ @@ -406,7 +406,7 @@ If(#object_id#>0){ } } Div(col-md-8 text-center){ - If(And(#notific_page_params_info_message#==1,And(Or(#depart2#==1,#depart3#==1),#depart_checks#!=1,#view_step#==-1,#notific_recipient_member_id#=="")!=1)){ + If(And(#notific_page_params_info_message#==1,And(Or(#depart2#==1,#depart3#==1),#depart_checks#!=1,#view_step#==-1,#notific_recipient_account#=="")!=1)){ If(#notific_page_params_info_status#=="success"){ Div(Class: h4, Body: Em(Class: fa fa-fw fa-check-circle text-success) #notific_notification_body#) }.Else{ @@ -438,8 +438,8 @@ If(#object_id#>0){ } If(#buyer#==1){ SetVar(bank_role_id, AppParam(App: #app_id#, Name: lr_bank_role)) - DBFind("@1roles_participants").Where({"role->id": #bank_role_id#, "deleted": 0, "ecosystem": #ecosystem_id#}).Columns("id,member->member_id").Vars(bank) - SetVar(bank_account,Address(#bank_member_member_id#)) + DBFind("@1roles_participants").Where({"role->id": "#bank_role_id#", "deleted": 0, "ecosystem": "#ecosystem_id#"}).Columns("id,member->account").Vars(bank) + SetVar(bank_account, #bank_member_account#) If(#bank_id#>0){ Button(Body: LangRes(lr_deposit_money), Class: btn btn-success mb, Contract: LrPurchaseSteps, Params: "ObjectId=#view_id#,Step=#view_step#,Decision=deposit", Page: #back_page#, PageParams: "sales_list=#sales_list#").CompositeContract(@1TokensSend, [{"Amount": #view_price#, "Recipient": "#bank_account#"}]) } @@ -448,22 +448,22 @@ If(#object_id#>0){ Div(Class: h4, Body: Em(Class: fa fa-fw fa-hourglass-3 text-primary) $lr_awaiting_bank_transfer$) If(#bank#==1){ Button(Body: LangRes(@1cancel), Class: btn btn-danger mb, Contract: LrPurchaseSteps, Params: "ObjectId=#view_id#,RoleId=#role_id#,Step=#view_step#,Decision=cancel", Page: #back_page#, PageParams: "sales_list=#sales_list#").Alert($lr_want_cancel_deal$, $@1confirm_button$, $@1cancel$) - Button(Body: LangRes(lr_finalize_deal), Class: btn btn-success mb, Contract: LrPurchaseSteps, Params: "ObjectId=#view_id#,RoleId=#role_id#,Step=#view_step#,Decision=finalize", Page: #back_page#, PageParams: "sales_list=#sales_list#").CompositeContract(@1TokensSend, [{"Amount": #view_price#, "Recipient": "#view_owner_id#"}]) + Button(Body: LangRes(lr_finalize_deal), Class: btn btn-success mb, Contract: LrPurchaseSteps, Params: "ObjectId=#view_id#,RoleId=#role_id#,Step=#view_step#,Decision=finalize", Page: #back_page#, PageParams: "sales_list=#sales_list#").CompositeContract(@1TokensSend, [{"Amount": #view_price#, "Recipient": "#view_owner_account#"}]) } } } Div(col-md-2 text-center){ If(#view_step#>=0){ - SetVar(b_id, 0) - DBFind("@1members").Where({"id": #view_buyer_id#, "ecosystem": #ecosystem_id#}).Vars(b) - If(Or(#b_id#>0,#b_id#<0)){ + SetVar(b_account,) + DBFind("@1members").Where({"account": "#view_buyer_account#", "ecosystem": "#ecosystem_id#"}).Vars(b) + If(#b_account#){ SetVar(buyer_image_id, #b_image_id#) SetVar(buyer_member_name, #b_member_name#) }.Else{ SetVar(buyer_, 0) - SetVar(buyer_member_name, Address(#view_buyer_id#)) + SetVar(buyer_member_name, #view_buyer_account#) } - LinkPage(Page: @1profile_view, PageParams: "v_key_id=#view_buyer_id#"){ + LinkPage(Page: @1profile_view, PageParams: "v_account=#view_buyer_account#"){ If(#buyer_image_id#>0){ Image(Src: Binary().ById(#buyer_image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63;) }.Else{ @@ -471,7 +471,7 @@ If(#object_id#>0){ } Div(Class: short-name text-bold, Body: #buyer_member_name#) } - Div(Class: text-muted m0, Body: ($lr_owner$)) + Div(Class: text-muted m0, Body: ($lr_buyer$)) } } } diff --git a/ecosystem_apps/land_registry/tables/land_registry.json b/ecosystem_apps/land_registry/tables/land_registry.json index 1ff480db1..6e85217b4 100644 --- a/ecosystem_apps/land_registry/tables/land_registry.json +++ b/ecosystem_apps/land_registry/tables/land_registry.json @@ -1,8 +1,8 @@ [ { - "name": "buyer_id", + "name": "buyer_account", "conditions": "{\"update\":\"ContractAccess(\\\"LrPurchaseSteps\\\")\",\"read\":\"true\"}", - "type": "number" + "type": "varchar" }, { "name": "date_created", @@ -30,9 +30,9 @@ "type": "number" }, { - "name": "owner_id", + "name": "owner_account", "conditions": "{\"update\":\"ContractAccess(\\\"LrPurchaseSteps\\\")\",\"read\":\"true\"}", - "type": "number" + "type": "varchar" }, { "name": "price", diff --git a/ecosystem_apps/land_registry/tables/land_registry_history.json b/ecosystem_apps/land_registry/tables/land_registry_history.json index 95eab7107..463f06e35 100644 --- a/ecosystem_apps/land_registry/tables/land_registry_history.json +++ b/ecosystem_apps/land_registry/tables/land_registry_history.json @@ -10,9 +10,9 @@ "type": "number" }, { - "name": "member_id", + "name": "account", "conditions": "{\"update\":\"false\",\"read\":\"true\"}", - "type": "number" + "type": "varchar" }, { "name": "new_value", diff --git a/ecosystem_apps/token_sale.json b/ecosystem_apps/token_sale.json index 7e10623e6..41fffb1d8 100644 --- a/ecosystem_apps/token_sale.json +++ b/ecosystem_apps/token_sale.json @@ -17,19 +17,19 @@ { "Name": "default_menu", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "If(#ecosystem_id# == 1){\n SetVar(is_allowed, 0).(k_id, 0).(unreaded_wallet_id,0).(exist_wallet_id,0)\n DBFind(@1keys).Where({\"id\": #key_id#, \"ecosystem\": 1}).Vars(k)\n DBFind(@1ts_wallets).Where({\"key_id_buyer\": #key_id#}).Vars(exist_wallet)\n DBFind(@1ts_wallets).Where({\"key_id_buyer\": #key_id#, \"rejected_at\": 0, \"signed_at\": 0}).Vars(unreaded_wallet)\n If(#k_id# != 0){\n If(#exist_wallet_id# > 0){\n If(#unreaded_wallet_id# == 0){\n SetVar(is_allowed, 1)\n }\n }.Else{\n SetVar(is_allowed, 1)\n }\n }\n If(#is_allowed# == 1){\n DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Token sale\"}).Vars(\"app\")\n SetVar(snapswap_role_id,0).(admin_role_id,0).(manager_role_id,0).(seller_role_id,0)\n SetVar(snapswap_role_id, AppParam(App: #app_id#, Name: \"ts_role_snapswap\"))\n SetVar(admin_role_id, AppParam(App: #app_id#, Name: \"ts_role_sale_admin\"))\n SetVar(manager_role_id, AppParam(App: #app_id#, Name: \"ts_role_sale_manager\"))\n SetVar(seller_role_id, AppParam(App: #app_id#, Name: \"ts_role_sale_seller\"))\n\n Span(\"Set here the menu of the first ecosystem\")\n If(And(#role_id# > 0, Or(#role_id# == #admin_role_id#, #role_id# == #manager_role_id#, #role_id# == #seller_role_id#, #role_id# == #snapswap_role_id#))){\n MenuItem(Title: \"$@1ts_free_wallets$\", Page: @1ts_free_wallets, Icon: \"icon-credit-card\")\n }\n If(And(#role_id# > 0, Or(#role_id# == #admin_role_id#, #role_id# == #manager_role_id#, #role_id# == #seller_role_id#, #role_id# == #snapswap_role_id#))){\n MenuItem(Title: \"$@1ts_wallets$\", Page: @1ts_wallets, Icon: \"icon-credit-card\")\n }\n If(And(#role_id# > 0, Or(#role_id# == #admin_role_id#, #role_id# == #manager_role_id#, #role_id# == #seller_role_id#, #role_id# == #snapswap_role_id#))){\n MenuItem(Title: \"$@1ts_sales$\", Page: @1ts_sales, Icon: \"icon-credit-card\")\n }\n }\n}", + "Value": "If(#ecosystem_id# == 1){\n SetVar(is_allowed, 0).(k_id, 0).(unreaded_wallet_id,0).(exist_wallet_id,0)\n DBFind(\"@1keys\").Where({\"account\": \"#account_id#\", \"deleted\": 0, \"ecosystem\": 1}).Vars(k)\n DBFind(\"@1ts_wallets\").Where({\"buyer_account\": \"#account_id#\"}).Vars(exist_wallet)\n DBFind(\"@1ts_wallets\").Where({\"buyer_account\": \"#account_id#\", \"rejected_at\": 0, \"signed_at\": 0}).Vars(unreaded_wallet)\n If(#k_id# != 0){\n If(#exist_wallet_id# > 0){\n If(#unreaded_wallet_id# == 0){\n SetVar(is_allowed, 1)\n }\n }.Else{\n SetVar(is_allowed, 1)\n }\n }\n If(#is_allowed# == 1){\n DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Token sale\"}).Vars(app)\n SetVar(snapswap_role_id,0).(admin_role_id,0).(manager_role_id,0).(seller_role_id,0)\n SetVar(snapswap_role_id, AppParam(App: #app_id#, Name: \"ts_role_snapswap\"))\n SetVar(admin_role_id, AppParam(App: #app_id#, Name: \"ts_role_sale_admin\"))\n SetVar(manager_role_id, AppParam(App: #app_id#, Name: \"ts_role_sale_manager\"))\n SetVar(seller_role_id, AppParam(App: #app_id#, Name: \"ts_role_sale_seller\"))\n\n Span(\"Set here the menu of the first ecosystem\")\n If(And(#role_id# > 0, Or(#role_id# == #admin_role_id#, #role_id# == #manager_role_id#, #role_id# == #seller_role_id#, #role_id# == #snapswap_role_id#))){\n MenuItem(Title: \"$@1ts_free_wallets$\", Page: @1ts_free_wallets, Icon: \"icon-credit-card\")\n }\n If(And(#role_id# > 0, Or(#role_id# == #admin_role_id#, #role_id# == #manager_role_id#, #role_id# == #seller_role_id#, #role_id# == #snapswap_role_id#))){\n MenuItem(Title: \"$@1ts_wallets$\", Page: @1ts_wallets, Icon: \"icon-credit-card\")\n }\n If(And(#role_id# > 0, Or(#role_id# == #admin_role_id#, #role_id# == #manager_role_id#, #role_id# == #seller_role_id#, #role_id# == #snapswap_role_id#))){\n MenuItem(Title: \"$@1ts_sales$\", Page: @1ts_sales, Icon: \"icon-credit-card\")\n }\n }\n}", "Type": "menu" }, { "Name": "ts_sales", - "Columns": "[\n {\n \"conditions\": \"false\",\n \"name\": \"buyer_transferred_at\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsTransferReject\\\")\",\n \"name\": \"seller_reject_comment\",\n \"type\": \"text\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"amount\",\n \"type\": \"varchar\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"currency_type\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsTransferReject\\\")\",\n \"name\": \"manager_rejected_at\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsTransferSeller\\\")\",\n \"name\": \"seller_transferred_at\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"amount_apl\",\n \"type\": \"money\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsTransferReject\\\",\\\"@1TsTransferSeller\\\")\",\n \"name\": \"key_id_seller\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsTransferReject\\\")\",\n \"name\": \"seller_rejected_at\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"key_id_sale_apl_admin\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsTransferReject\\\")\",\n \"name\": \"manager_reject_comment\",\n \"type\": \"text\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsTransferReject\\\",\\\"@1TsTransferManager\\\")\",\n \"name\": \"key_id_sale_apl_manager\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"created_at\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"key_id_buyer\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsTransferReject\\\",\\\"@1TsTransferManager\\\",\\\"@1TsTransferAdmin\\\",\\\"@1TsTransferSeller\\\")\",\n \"name\": \"status\",\n \"type\": \"number\"\n }\n]", + "Columns": "[\n {\n \"conditions\": \"false\",\n \"name\": \"buyer_transferred_at\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsTransferReject\\\")\",\n \"name\": \"seller_reject_comment\",\n \"type\": \"text\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"amount\",\n \"type\": \"varchar\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"currency_type\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsTransferReject\\\")\",\n \"name\": \"manager_rejected_at\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsTransferSeller\\\")\",\n \"name\": \"seller_transferred_at\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"amount_apl\",\n \"type\": \"money\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsTransferReject\\\",\\\"@1TsTransferSeller\\\")\",\n \"name\": \"seller_account\",\n \"type\": \"varchar\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsTransferReject\\\")\",\n \"name\": \"seller_rejected_at\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"sale_apl_admin\",\n \"type\": \"varchar\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsTransferReject\\\")\",\n \"name\": \"manager_reject_comment\",\n \"type\": \"text\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsTransferReject\\\",\\\"@1TsTransferManager\\\")\",\n \"name\": \"sale_apl_manager\",\n \"type\": \"varchar\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"created_at\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"buyer_account\",\n \"type\": \"varchar\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsTransferReject\\\",\\\"@1TsTransferManager\\\",\\\"@1TsTransferAdmin\\\",\\\"@1TsTransferSeller\\\")\",\n \"name\": \"status\",\n \"type\": \"number\"\n }\n]", "Permissions": "{\"insert\": \"ContractAccess(\\\"@1TsTransferAdmin\\\")\", \"update\": \"ContractAccess(\\\"@1TsTransferReject\\\",\\\"@1TsTransferSeller\\\",\\\"@1TsTransferManager\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", "Type": "tables" }, { "Name": "ts_wallets", - "Columns": "[\n {\n \"conditions\":\"ContractAccess(\\\"@1TsBuyerAction\\\",\\\"@1TsConsensusAction\\\")\",\n \"name\":\"rejected_at\",\n \"type\":\"number\"\n },\n {\n \"conditions\":\"ContractAccess(\\\"@1TsKeyApprove\\\")\",\n \"name\":\"key_id_buyer\",\n \"type\":\"number\"\n },\n {\n \"conditions\":\"ContractAccess(\\\"@1TsConsensusAction\\\")\",\n \"name\":\"key_id_signer\",\n \"type\":\"number\"\n },\n {\n \"conditions\":\"false\",\n \"name\":\"btc\",\n \"type\":\"money\"\n },\n {\n \"conditions\":\"false\",\n \"name\":\"eth\",\n \"type\":\"money\"\n },\n {\n \"conditions\":\"ContractAccess(\\\"@1TsBuyerAction\\\")\",\n \"name\":\"signed_at\",\n \"type\":\"number\"\n },\n {\n \"conditions\":\"ContractAccess(\\\"@1TsKeyApprove\\\")\",\n \"name\":\"created_at\",\n \"type\":\"number\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"wallet_eth\",\n \"type\": \"text\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"wallet_btc\",\n \"type\": \"text\"\n },\n {\n \"conditions\":\"ContractAccess(\\\"@1TsFreeWalletDelete\\\")\",\n \"name\":\"deleted\",\n \"type\":\"number\"\n },\n {\n \"conditions\":\"ContractAccess(\\\"@1TsKeyApprove\\\")\",\n \"name\": \"pub_buyer\",\n \"type\": \"text\"\n },\n {\n \"conditions\":\"ContractAccess(\\\"@1TsKeyApprove\\\")\",\n \"name\": \"pub_short_buyer\",\n \"type\": \"text\"\n }\n]", - "Permissions": "{\"insert\": \"ContractAccess(\\\"@1TsFreeWalletAdd\\\")\", \"update\": \"ContractAccess(\\\"@1TsBuyerAction\\\",\\\"@1TsConsensusAction\\\",\\\"@1TsKeyApprove\\\",\\\"@1TsFreeWalletDelete\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", + "Columns": "[\n {\n \"conditions\": \"ContractAccess(\\\"@1TsBuyerAction\\\",\\\"@1TsConsortiumMemberAction\\\")\",\n \"name\": \"rejected_at\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsKeyApprove\\\")\",\n \"name\": \"buyer_account\",\n \"type\": \"varchar\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsConsortiumMemberAction\\\")\",\n \"name\": \"signer_account\",\n \"type\": \"varchar\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"btc\",\n \"type\": \"money\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"eth\",\n \"type\": \"money\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsBuyerAction\\\")\",\n \"name\": \"signed_at\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsKeyApprove\\\")\",\n \"name\": \"created_at\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"wallet_eth\",\n \"type\": \"text\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"wallet_btc\",\n \"type\": \"text\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsFreeWalletDelete\\\")\",\n \"name\": \"deleted\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsKeyApprove\\\")\",\n \"name\": \"pub_buyer\",\n \"type\": \"text\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1TsKeyApprove\\\")\",\n \"name\": \"pub_short_buyer\",\n \"type\": \"text\"\n }\n]", + "Permissions": "{\"insert\": \"ContractAccess(\\\"@1TsFreeWalletAdd\\\")\", \"update\": \"ContractAccess(\\\"@1TsBuyerAction\\\",\\\"@1TsConsortiumMemberAction\\\",\\\"@1TsKeyApprove\\\",\\\"@1TsFreeWalletDelete\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", "Type": "tables" }, { @@ -77,21 +77,21 @@ { "Name": "default_page", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1ts_wallets).Where({\"key_id_buyer\": #key_id#, \"rejected_at\": 0, \"signed_at\": 0}).Vars(unconfirmed_wallet)\nIf(#unconfirmed_wallet_id#>0){\n Include(@1ts_contract_investors)\n}.Else{\n Include(@1profile)\n}", + "Value": "DBFind(\"@1ts_wallets\").Where({\"buyer_account\": \"#account_id#\", \"rejected_at\": 0, \"signed_at\": 0}).Vars(unconfirmed_wallet)\nIf(#unconfirmed_wallet_id# > 0){\n Include(@1ts_contract_investors)\n}.Else{\n Include(@1profile)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "ts_buyer_congratulation", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1ts_wallets).Where({\"key_id_buyer\": #key_id#}).Vars(w)\nIf(#w_id# > 0){\n Div(list-group-item mt-lg mb-lg ml-lg mr-lg){\n Div(Class: h3 text-bold text-center pb-xl, Body: Purchase Order)\n Div(Class: h4 pb-lg, Body: In response to your invitation to submit a purchase order as of 1s tof November 2018, we would like to submit the below purchase order to buy APLA Tokens: )\n Div(){\n Div(row){\n Div(col-md-12){\n Div(table tablez){\n Div(table__row){\n Div(table__cell table__cell_10){APLA Wallet Number}\n Div(table__cell table__cell_10){Address(#key_id#)}\n }\n Div(table__row){\n Div(table__cell table__cell_10){Number of APLA Tokens to buy}\n Div(table__cell table__cell_10){}\n }\n Div(table__row){\n Div(table__cell table__cell_10 tborder){Payment means}\n Div(table__cell table__cell_10 tborder){\n Div(Class: text-normal, Body: BTC: #w_wallet_btc#)\n Div(Class: text-normal, Body: ETH: #w_wallet_eth#)\n }\n }\n }\n }\n }\n }.Style(\n .row-flex {\n display: flex;\n flex-flow: row wrap;\n }\n .table {\n display: table;\n border: solid 1px #000000;\n }\n .tablez {\n border: solid 1px #000000;\n }\n .table .table__head {\n display: table-header-group;\n background: blue;\n color: #fff;\n }\n .table .table__head .table__cell {\n font-size: 15px;\n color: #000000;\n background: #B7B7B7;\n }\n .table > div:not(.table__body) {\n display: table-row-group;\n }\n .table .table__body:last-child .table__row:last-child .table__cell {\n border-bottom: none;\n }\n .table .table__row {\n display: table-row;\n flex-direction: row;\n flex-wrap: no-wrap;\n }\n .table .table__row:nth-child(2n) {\n display: table-row;\n flex-direction: row;\n flex-wrap: no-wrap;\n border-left: solid 1px red;\n }\n .table .table__row .table__cell {\n border-bottom: solid 1px #000000;\n }\n .table .table__cell {\n display: table-cell;\n padding: 8px 10px;\n font-size: 14px;\n color: #000000;\n border-right: solid 1px #000000;\n }\n .tborder {\n border-bottom: 0!important;\n }\n .table .table__cell:last-child {\n border-right: none;\n }\n .table .table__cell.table__cell_collapse {\n width: 1px;\n }\n .table .table__cell.table__cell_10 {\n width: 10%;\n }\n .table .table__cell.table__cell_20 {\n width: 20%;\n }\n .table .table__cell.table__cell_25 {\n width: 25%;\n }\n .table .table__cell.table__cell_30 {\n width: 30%;\n }\n .table .table__cell.table__cell_40 {\n width: 40%;\n }\n .table .table__cell.table__cell_50 {\n width: 50%;\n }\n .table .table__cell.table__cell_60 {\n width: 60%;\n }\n .table .table__cell.table__cell_70 {\n width: 70%;\n }\n .table .table__cell.table__cell_80 {\n width: 80%;\n }\n .table .table__cell.table__cell_18 {\n width: 18%;\n }\n .table .table__cell.table__cell_90 {\n width: 90%;\n }\n .table .table__cell.table__cell_stretch {\n width: 100%;\n }\n )\n Div(Class: h4, Body: We hereby acknowledge the receipt of and agree with the Standard Terms & Conditions of Sale. )\n Div(){\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"id\": #notific_id#}).Columns(\"closed\").Vars(note)\n If(#note_closed# == 0){\n Button(Body: $@1mark_read$, Class: btn btn-primary pull-right, Page: default_page, Contract: NotificationsClose, Params: \"NotificId=#notific_id#\")\n }\n }\n }\n}.Else{\n Div(list-group-item text-center h4 ml mr mt-lg){\n $@1wallet$ $@1not_found$\n }\n}", + "Value": "DBFind(\"@1ts_wallets\").Where({\"buyer_account\": \"#account_id#\"}).Vars(w)\nIf(#w_id# > 0){\n Div(list-group-item mt-lg mb-lg ml-lg mr-lg){\n Div(Class: h3 text-bold text-center pb-xl, Body: Purchase Order)\n Div(Class: h4 pb-lg, Body: In response to your invitation to submit a purchase order as of 1s tof November 2018, we would like to submit the below purchase order to buy APLA Tokens: )\n Div(){\n Div(row){\n Div(col-md-12){\n Div(table tablez){\n Div(table__row){\n Div(table__cell table__cell_10){APLA Wallet Number}\n Div(table__cell table__cell_10){#account_id#}\n }\n Div(table__row){\n Div(table__cell table__cell_10){Number of APLA Tokens to buy}\n Div(table__cell table__cell_10){}\n }\n Div(table__row){\n Div(table__cell table__cell_10 tborder){Payment means}\n Div(table__cell table__cell_10 tborder){\n Div(Class: text-normal, Body: BTC: #w_wallet_btc#)\n Div(Class: text-normal, Body: ETH: #w_wallet_eth#)\n }\n }\n }\n }\n }\n }.Style(\n .row-flex {\n display: flex;\n flex-flow: row wrap;\n }\n .table {\n display: table;\n border: solid 1px #000000;\n }\n .tablez {\n border: solid 1px #000000;\n }\n .table .table__head {\n display: table-header-group;\n background: blue;\n color: #fff;\n }\n .table .table__head .table__cell {\n font-size: 15px;\n color: #000000;\n background: #B7B7B7;\n }\n .table > div:not(.table__body) {\n display: table-row-group;\n }\n .table .table__body:last-child .table__row:last-child .table__cell {\n border-bottom: none;\n }\n .table .table__row {\n display: table-row;\n flex-direction: row;\n flex-wrap: no-wrap;\n }\n .table .table__row:nth-child(2n) {\n display: table-row;\n flex-direction: row;\n flex-wrap: no-wrap;\n border-left: solid 1px red;\n }\n .table .table__row .table__cell {\n border-bottom: solid 1px #000000;\n }\n .table .table__cell {\n display: table-cell;\n padding: 8px 10px;\n font-size: 14px;\n color: #000000;\n border-right: solid 1px #000000;\n }\n .tborder {\n border-bottom: 0!important;\n }\n .table .table__cell:last-child {\n border-right: none;\n }\n .table .table__cell.table__cell_collapse {\n width: 1px;\n }\n .table .table__cell.table__cell_10 {\n width: 10%;\n }\n .table .table__cell.table__cell_20 {\n width: 20%;\n }\n .table .table__cell.table__cell_25 {\n width: 25%;\n }\n .table .table__cell.table__cell_30 {\n width: 30%;\n }\n .table .table__cell.table__cell_40 {\n width: 40%;\n }\n .table .table__cell.table__cell_50 {\n width: 50%;\n }\n .table .table__cell.table__cell_60 {\n width: 60%;\n }\n .table .table__cell.table__cell_70 {\n width: 70%;\n }\n .table .table__cell.table__cell_80 {\n width: 80%;\n }\n .table .table__cell.table__cell_18 {\n width: 18%;\n }\n .table .table__cell.table__cell_90 {\n width: 90%;\n }\n .table .table__cell.table__cell_stretch {\n width: 100%;\n }\n )\n Div(Class: h4, Body: We hereby acknowledge the receipt of and agree with the Standard Terms & Conditions of Sale. )\n Div(){\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#notific_id#\"}).Columns(\"closed\").Vars(note)\n If(#note_closed# == 0){\n Button(Body: $@1mark_read$, Class: btn btn-primary pull-right, Page: default_page, Contract: NotificationsClose, Params: \"NotificId=#notific_id#\")\n }\n }\n }\n}.Else{\n Div(list-group-item text-center h4 ml mr mt-lg){\n $@1wallet$ $@1not_found$\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "ts_buyer_contract", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1ts_wallets).Where({\"key_id_buyer\": #key_id#, \"key_id_signer\": 0, \"rejected_at\": 0}).Vars(unconfirmed_wallet)\nIf(#unconfirmed_wallet_id#>0){\n Div(list-group-item mt-lg mb-lg ml-lg mr-lg){\n Div(Class: h3 text-bold m0 text-center, Body: APLA Tokens)\n Div(Class: h3 text-bold m0 text-center, Body: Standard Terms and Conditions of Sale)\n\n Div(Class: h4 mt-xl text-bold, Body: 1. Introduction)\n Div(Class: h4, Body: The present standard terms and conditions of sale (T&Cs) govern the relationship between the Seller and Buyer in connection with the sale and purchase of the APLA Tokens as per the EGAAS S.A. letter to the Apla Users as of 1st of November 2018.).Style(padding-right: 60px!important;)\n Div(Class: h4 mt-xl text-bold, Body: Glossary of Terms)\n\n Div(){\n Div(Class: h4, Body: Strong(Body: 1.1) Unless the context requires otherwise, the following terms of this Article 1 shall be used in this Agreement:)\n Div(Class: h4, Body: Strong(Body: APLA Wallet) means a software application for storing, holding and transferring APLA Tokens;)\n Div(Class: h4, Body: Strong(Body: APLA Tokens) means a digital representation of value generated by the source code of the Apla platform ecosystem that is used by Apla users to pay a license fee for the execution of smart contracts, creation of tables, and adding new columns and rows to them in all Apla ecosystems;)\n Div(Class: h4, Body: Strong(Body: Apla Contractual Documentation) means the Terms & Conditions and Apla policies, as amended from time to time, that can be downloaded from Span(Class: text-primary, Body: www.apla.io) website; )\n Div(Class: h4, Body: Strong(Body: Apla platform) means a software program for executing smart laws and smart contracts based on the distributed ledger technology, the source code of which is stored at GitHub.com/AplaProject. The program operates on the basis of peer to peer (P2P) architecture that is a system of peer client-side programs installed on users' computers and participating in data exchange via peer to peer (P2P) computer network; )\n Div(Class: h4, Body: Strong(Body: Apla Software) means the Apla platform software the source code of which is published at GitHub.com/AplaProject; )\n Div(Class: h4, Body: Strong(Body: Buyer) means a legal entity or individual that has signed the Commercial Terms with the Seller; )\n Div(Class: h4, Body: Strong(Body: Commercial Terms) means the price, payment, delivery and other terms of sale of APLA Tokens indicated in the Seller’s letter to the potential Buyers as of 1st of November 2018;)\n Div(Class: h4, Body: Strong(Body: Laws) means the civil law in general, any constitution, legislation, decree, order, instruction, rule, regulation, ordinance, code, directive, by-law, judgment, international treaty or any other legislative or quasi-legislative measure related, in each case, to the respective jurisdiction that may be applicable to any transaction closed or to the circumstances existing as of the respective date and, in each case (if any liability is stipulated by or may arise in accordance with them) including any former provision (that may be statutorily amended or re-enacted from time to time) that was directly or indirectly replaced by such provision;)\n Div(Class: h4, Body: Strong(Body: Luxembourg) means the Grand Duchy of Luxembourg;)\n Div(Class: h4, Body: Strong(Body: Parties) means both the Seller and Buyer;)\n Div(Class: h4, Body: Strong(Body: Party) means either the Seller or Buyer as the context suggests; )\n Div(Class: h4, Body: Strong(Body: Public Authority) means any supranational, national, municipal, local or foreign public authority or organisation, or any department, commission, administration, bureau, agency, court or instrumentality, subdivision or any other authority thereof, or any quasi-public or private authority having any regulatory, tax, financial regulation and any other public or quasi-public authority)\n Div(Class: h4, Body: Strong(Body: Purchase Order) means an order to purchase APLA Tokens submitted by the Buyer to the Seller in accordance with the Commercial Terms; )\n Div(Class: h4, Body: Strong(Body: Seller) means Strong(Body: EGAAS S.A.,) a legal entity incorporated under the laws of the Grand Duchy of Luxembourg, registered at RCS Luxembourg under the number B216 352 and having its registered office at L-1273 Luxembourg, 20, rue de Bitbourg; )\n Div(Class: h4, Body: Strong(Body: SnapSwap) means SnapSwap International S.A., a legal entity incorporated under the laws of the Grand Duchy of Luxembourg, having its registered office at 59, Boulevard Royal L-2449 Luxembourg and authorised as an electronic money institution by the Ministry of Finance. )\n Div(Class: h4, Body: Strong(Body: 1.2 In the context of this Agreement:) )\n Div(){\n Div(Class: h4, Body: Strong(Body: 1.2.1) A reference to this Agreement shall be interpreted as a reference to this document, including all amendments, supplements, appendices, novations or transfer of rights made from time to time;)\n Div(Class: h4, Body: Strong(Body: 1.2.2) A reference to the article, clause, sub-clause or appendix, unless such reference is followed by the name of a particular document, shall be deemed the reference to an article, clause, section or appendix to this Agreement;)\n Div(Class: h4, Body: Strong(Body: 1.2.3) A reference to the terms defined in this Agreement includes the singular and plural of those terms and denotes the masculine, feminine or neuter gender, as the context requires;)\n Div(Class: h4, Body: Strong(Body: 1.2.4) It is understood that the words “including” and “includes” are followed by the expression “without limitation”, and such expressions shall be without prejudice to the generality of the foregoing;)\n Div(Class: h4, Body: Strong(Body: 1.2.5) Headings are for the convenience only and shall not affect the interpretation of this Agreement; and)\n Div(Class: h4, Body: Strong(Body: 1.2.6) All terms that are written in capital letters and not defined in clause 1.1 shall have the meaning ascribed to those terms in the text of this Agreement or appendices hereto.)\n }.Style(padding-left: 50px!important;)\n\n Div(Class: h4, Body: Strong(Body: 2 Subject matter) )\n Div(Class: h4, Body: Strong(Body: 2.1) Subject to the terms and conditions set forth herein, Seller shall sell and Buyer shall buy the number of APLA Tokens indicated in Purchase Order of Buyer to the extent such an order has been accepted by Seller. Seller shall be deemed accepted Purchase Order of Buyer by sending an invoice for making the payment of the purchase price to Buyer in response to the submitted Purchase Order.)\n Div(Class: h4, Body: Strong(Body: 2.2) No U.S. Buyers. APLA Tokens during the initial sale are not being offered to U.S. persons. U.S. persons are strictly prohibited and restricted from purchasing APLA Tokens and Seller is not soliciting purchases by U.S. persons in any way. )\n Div(Class: h4, Body: Strong(Body: 2.3) APLA Tokens are not intended to be offered for investment purposes. The pure purpose of the legitimate use of APLA Tokens is to pay for license fees in connection with the execution of transactions on Apla Platform. )\n Div(Class: h4, Body: Strong(Body: 2.4) Buyer acknowledges and agrees that Buyer is not purchasing APLA Tokens for purposes of investment, speculation, as some type of arbitrage strategy, for immediate resale or other financial purposes. )\n\n Div(Class: h4, Body: Strong(Body: 3 Transfer of APLA Tokens) )\n Div(Class: h4, Body: Strong(Body: 3.1) Buyer shall open APLA Wallet in accordance with the rules set forth in the Apla Contractual Documentation and following the KYC (know-your-customer procedure) with SnapSwap. Buyer shall inform Seller about the public key of the opened APLA Wallet in Purchase Order.)\n Div(Class: h4, Body: Strong(Body: 3.2) Seller shall transfer the number of APLA Tokens, indicated in Purchase Order accepted by Seller, to the APLA Wallet of Buyer within 2 business days following the receipt of the purchase price from the Buyer. )\n\n\n Div(Class: h4, Body: Strong(Body: 4 Representations and warranties of the Parties))\n Div(Class: h4, Body: Strong(Body: 4.1) Seller gives no guarantee and/or warrantee as regards the market value of APLA Tokens throughout the term of this T&C and thereafter. )\n Div(Class: h4, Body: Strong(Body: 4.2) Buyer is made aware of the potential high volatility of APLA Tokens on the market and other risks pretraining to crypto-currencies as further defined in the warning of the CSSF published on Span(Class: text-primary, Body: http://www.cssf.lu/fileadmin/files/Protection_consommateurs/Avertissements/W_virtual_currencies_140318_eng.pdf))\n Div(Class: h4, Body: Strong(Body: 4.3) Hereby Buyer gives to Seller the following true, correct and irrevocable representations and warranties that shall be true at the date of submitting Purchase Order to Seller: )\n Div(){\n Div(){\n Div(Class: h4, Body: Strong(Class: wrap, Body: 4.3.1) Span(Class: underline, Body: Legal Status of Buyer.) Buyer is not undergoing any liquidation and/or bankruptcy procedure.)\n Div(Class: h4, Body: Strong(Class: wrap, Body: 4.3.2) Span(Class: underline, Body: Powers and Authorities of Buyer.) Buyer has right, power and authority to enter into, execute and deliver these T&Cs, any other documents contemplated hereby and the transaction contemplated hereby and to perform its obligations hereunder and all corporate actions necessary for this has been undertaken by Buyer. The T&Cs are valid and legally binding for Buyer and can be lawfully enforced in accordance with their terms. The signatory of Buyer that has executed the T&Cs was duly granted with the relevant powers.)\n Div(Class: h4, Body: Strong(Class: wrap, Body: 4.3.3) Span(Class: underline, Body: No Conflict.) The execution of the T&Cs and the fulfilment of obligations by Buyer will not constitute any conflict with (i) the provisions of Buyer’s constituent documents and any other documents regulating Buyer’s status and activities, (ii) any laws, rules or regulations, arbitral awards, court rulings, official orders, resolutions, instructions etc. applicable to Buyer. Buyer obtained all applicable governmental, statutory, regulatory or other consents, licences, authorisations, waivers and exemptions required to enter into these T&Cs and any other documents contemplated hereby and to perform its obligations hereunder.)\n Div(Class: h4, Body: Strong(Class: wrap, Body: 4.3.4) Span(Class: underline, Body: Finance.) Buyer has and will have its own cash and/or fully available credit lines to fulfil its obligations hereunder.)\n }.Style(padding-left: 50px!important;)\n Div(Class: h4, Body: Strong(Body: 4.4) Hereby Seller gives to Buyer the following true, correct and irrevocable warranties and representations that shall be valid at the date of accepting Purchase Order:)\n Div(){\n Div(Class: h4, Body: Strong(Class: wrap, Body: 4.4.1) Span(Class: underline, Body: Legal Status of Seller.) Seller is a corporation duly established and acting on a legal basis in accordance with the legislation of Luxembourg. Seller is not undergoing any liquidation and/or bankruptcy procedure. )\n Div(Class: h4, Body: Strong(Class: wrap, Body: 4.4.2) Span(Class: underline, Body: Powers and Authorities of Seller.) Seller has right, power and authority to enter into, execute and deliver these T&Cs, any other documents contemplated hereby and the transaction contemplated hereby and to perform its obligations hereunderand all corporate actions necessary for this has been undertaken by Seller. The T&Cs are valid and legally binding for Seller and can be lawfully enforced in accordance with its terms. The signatory of Seller that has executed the T&Cs was duly granted with the relevant powers.)\n Div(Class: h4, Body: Strong(Class: wrap, Body: 4.4.3) Span(Class: underline, Body: No Conflict.) The execution of the T& and the fulfilment of obligations by Seller will not constitute any conflict with (i) the provisions of Seller’s constituent documents and any other documents regulating the Seller’s status and activities, (ii) any laws, rules or regulations, arbitral awards, court rulings, official orders, resolutions, instructions etc. applicable to Seller. Seller obtained all applicable governmental, statutory, regulatory or other consents, licences, authorisations, waivers and exemptions required to enter into these T&Cs and any other documents contemplated hereby and to perform its obligations hereunder.)\n Div(Class: h4, Body: Strong(Class: wrap, Body: 4.4.4) Span(Class: underline, Body: Title to APLA Tokens.) As of the date of accepting Purchase Order, Seller will have legal and unrestricted title to the APLA Tokens being the subject matter of these T&Cs, free from any pledge, lien, any other encumbrances and defects. )\n }.Style(padding-left: 50px!important;)\n }.Style(\n .underline {\n text-decoration: underline;\n }\n .wrap {\n padding-right: 8px!important;\n }\n )\n Div(Class: h4, Body: Strong(Body: 4.5) Unless otherwise specifically provided in these T&Cs, in the event that at any time it appears that any of the warranties and representations was not true and correct in any material respect when made, then the Party to whom these warranties and representations were given shall give prompt written notice of any such breach to the other Party and give this default Party the opportunity to eliminate (at the defaulting Party’s own cost and expense) any such breach and the Party to whom these warranties and representations were given shall be required (at the defaulting Party’s own cost and expense) to provide such assistance to the default Party with remedying any such breach as the defaulting party may reasonably request.)\n Div(Class: h4, Body: Strong(Body: 5 Liability))\n Div(Class: h4, Body: Strong(Body: 5.1 ) The Seller’s liability under these T&Cs may not exceed the amount of the purchase price received by Seller from Buyer for APLA Tokens.)\n Div(Class: h4, Body: Strong(Body: 5.2) Seller shall in no case be liable for indirect or consequential damages incurred by Buyer. )\n Div(Class: h4, Body: Strong(Body: 5.3) None of the Parties shall be liable for a failure to properly perform their duties under these T&Cs if this non-performance or poor performance is resulted from force majeure events. Force majeure event means any event and/or circumstance, which is beyond the reasonable control of, and is not attributable to, the affected party resulting in the affected party being prevented from performing or being delayed in the performance of any of its obligations under the T&Cs. Force majeure event may include, but not limited to, an act of a Public Authority or court of any state, interruption or unavailability of power supplies and telecommunication networks in addition to the acts of God. )\n Div(Class: h4, Body: Strong(Body: 6 Entry into Force))\n Div(Class: h4, Body: Strong(Body: 6.1) These T&Cs shall come into force on the date when Seller has accepted Purchase Order of Buyer. )\n Div(Class: h4, Body: Strong(Body: 7 Termination of agreement))\n Div(Class: h4, Body: The agreement between the Parties shall be deemed terminated on the following grounds: )\n Div(Class: h4, Body: Strong(Body: 7.1) Buyer has not transferred the purchase price to Seller for APLA Tokens indicated in Purchase Order accepted by Seller within 5 business days from the acceptance date. )\n Div(Class: h4, Body: Strong(Body: 8 Severability))\n Div(Class: h4, Body: If any part of this agreement is recognized invalid, unlawful, or unenforceable, the other part will continue to be valid and enforceable to the fullest extent permitted by applicable Law. The invalid, unlawful, or unenforceable part shall be construed and further negotiated by the parties concerned in a manner compliant with applicable Law and consistent with original intentions of the Parties. )\n Div(Class: h4, Body: Strong(Body: 9 Notices))\n Div(Class: h4, Body: All notices under this Agreement shall be sent by registered mail or private courier to the following addresses:)\n Div(Class: h4, Body: If to Seller: L-1273 Luxembourg, 20, rue de Bitbourg)\n Div(Class: h4, Body: If to the Buyer: address of APLA Wallet of Buyer)\n Div(Class: h4, Body: or to such other addresses as shall be indicated by the Parties hereto. All notices shall be deemed to have been received [7 (seven) calendar] days after posting by registered mail or upon confirmation of receipt if sent by private courier.)\n Div(Class: h4, Body: Strong(Body: 10 Dispute Resolution))\n Div(Class: h4, Body: All disputes arising out of or in connection with these T&Cs shall be referred to the Arbitration Centre at the Chamber of Commerce and Industry of Luxembourg for final resolution under the Rules of Arbitration established by such Centre by one arbitrator appointed in accordance with those Rules.)\n Div(Class: h4, Body: The law applicable to the relations of the Parties under these T&Cs shall be the Law of Luxembourg.)\n }.Style(padding-left: 50px!important;)\n\n Div(mt-xl mb-lg){\n Button(Body: $@1reject$, Class: btn btn-danger, Page: default_page, Contract: TsBuyerAction, Params: \"Action=reject\")\n Button(Body: $@1accept$, Class: btn btn-primary pull-right, Page: default_page, Contract: TsBuyerAction, Params: \"Action=accept\")\n }\n\n }.Style(\n padding-left: 60px!important;\n padding-right: 60px!important;\n )\n}", + "Value": "DBFind(\"@1ts_wallets\").Where({\"buyer_account\": \"#account_id#\", \"signer_account\": 0, \"rejected_at\": 0}).Vars(unconfirmed_wallet)\nIf(#unconfirmed_wallet_id# > 0){\n Div(list-group-item mt-lg mb-lg ml-lg mr-lg){\n Div(Class: h3 text-bold m0 text-center, Body: APLA Tokens)\n Div(Class: h3 text-bold m0 text-center, Body: Standard Terms and Conditions of Sale)\n\n Div(Class: h4 mt-xl text-bold, Body: 1. Introduction)\n Div(Class: h4, Body: The present standard terms and conditions of sale (T&Cs) govern the relationship between the Seller and Buyer in connection with the sale and purchase of the APLA Tokens as per the EGAAS S.A. letter to the Apla Users as of 1st of November 2018.).Style(padding-right: 60px!important;)\n Div(Class: h4 mt-xl text-bold, Body: Glossary of Terms)\n\n Div(){\n Div(Class: h4, Body: Strong(Body: 1.1) Unless the context requires otherwise, the following terms of this Article 1 shall be used in this Agreement:)\n Div(Class: h4, Body: Strong(Body: APLA Wallet) means a software application for storing, holding and transferring APLA Tokens;)\n Div(Class: h4, Body: Strong(Body: APLA Tokens) means a digital representation of value generated by the source code of the Apla platform ecosystem that is used by Apla users to pay a license fee for the execution of smart contracts, creation of tables, and adding new columns and rows to them in all Apla ecosystems;)\n Div(Class: h4, Body: Strong(Body: Apla Contractual Documentation) means the Terms & Conditions and Apla policies, as amended from time to time, that can be downloaded from Span(Class: text-primary, Body: www.apla.io) website; )\n Div(Class: h4, Body: Strong(Body: Apla platform) means a software program for executing smart laws and smart contracts based on the distributed ledger technology, the source code of which is stored at GitHub.com/AplaProject. The program operates on the basis of peer to peer (P2P) architecture that is a system of peer client-side programs installed on users' computers and participating in data exchange via peer to peer (P2P) computer network; )\n Div(Class: h4, Body: Strong(Body: Apla Software) means the Apla platform software the source code of which is published at GitHub.com/AplaProject; )\n Div(Class: h4, Body: Strong(Body: Buyer) means a legal entity or individual that has signed the Commercial Terms with the Seller; )\n Div(Class: h4, Body: Strong(Body: Commercial Terms) means the price, payment, delivery and other terms of sale of APLA Tokens indicated in the Seller’s letter to the potential Buyers as of 1st of November 2018;)\n Div(Class: h4, Body: Strong(Body: Laws) means the civil law in general, any constitution, legislation, decree, order, instruction, rule, regulation, ordinance, code, directive, by-law, judgment, international treaty or any other legislative or quasi-legislative measure related, in each case, to the respective jurisdiction that may be applicable to any transaction closed or to the circumstances existing as of the respective date and, in each case (if any liability is stipulated by or may arise in accordance with them) including any former provision (that may be statutorily amended or re-enacted from time to time) that was directly or indirectly replaced by such provision;)\n Div(Class: h4, Body: Strong(Body: Luxembourg) means the Grand Duchy of Luxembourg;)\n Div(Class: h4, Body: Strong(Body: Parties) means both the Seller and Buyer;)\n Div(Class: h4, Body: Strong(Body: Party) means either the Seller or Buyer as the context suggests; )\n Div(Class: h4, Body: Strong(Body: Public Authority) means any supranational, national, municipal, local or foreign public authority or organisation, or any department, commission, administration, bureau, agency, court or instrumentality, subdivision or any other authority thereof, or any quasi-public or private authority having any regulatory, tax, financial regulation and any other public or quasi-public authority)\n Div(Class: h4, Body: Strong(Body: Purchase Order) means an order to purchase APLA Tokens submitted by the Buyer to the Seller in accordance with the Commercial Terms; )\n Div(Class: h4, Body: Strong(Body: Seller) means Strong(Body: EGAAS S.A.,) a legal entity incorporated under the laws of the Grand Duchy of Luxembourg, registered at RCS Luxembourg under the number B216 352 and having its registered office at L-1273 Luxembourg, 20, rue de Bitbourg; )\n Div(Class: h4, Body: Strong(Body: SnapSwap) means SnapSwap International S.A., a legal entity incorporated under the laws of the Grand Duchy of Luxembourg, having its registered office at 59, Boulevard Royal L-2449 Luxembourg and authorised as an electronic money institution by the Ministry of Finance. )\n Div(Class: h4, Body: Strong(Body: 1.2 In the context of this Agreement:) )\n Div(){\n Div(Class: h4, Body: Strong(Body: 1.2.1) A reference to this Agreement shall be interpreted as a reference to this document, including all amendments, supplements, appendices, novations or transfer of rights made from time to time;)\n Div(Class: h4, Body: Strong(Body: 1.2.2) A reference to the article, clause, sub-clause or appendix, unless such reference is followed by the name of a particular document, shall be deemed the reference to an article, clause, section or appendix to this Agreement;)\n Div(Class: h4, Body: Strong(Body: 1.2.3) A reference to the terms defined in this Agreement includes the singular and plural of those terms and denotes the masculine, feminine or neuter gender, as the context requires;)\n Div(Class: h4, Body: Strong(Body: 1.2.4) It is understood that the words “including” and “includes” are followed by the expression “without limitation”, and such expressions shall be without prejudice to the generality of the foregoing;)\n Div(Class: h4, Body: Strong(Body: 1.2.5) Headings are for the convenience only and shall not affect the interpretation of this Agreement; and)\n Div(Class: h4, Body: Strong(Body: 1.2.6) All terms that are written in capital letters and not defined in clause 1.1 shall have the meaning ascribed to those terms in the text of this Agreement or appendices hereto.)\n }.Style(padding-left: 50px!important;)\n\n Div(Class: h4, Body: Strong(Body: 2 Subject matter) )\n Div(Class: h4, Body: Strong(Body: 2.1) Subject to the terms and conditions set forth herein, Seller shall sell and Buyer shall buy the number of APLA Tokens indicated in Purchase Order of Buyer to the extent such an order has been accepted by Seller. Seller shall be deemed accepted Purchase Order of Buyer by sending an invoice for making the payment of the purchase price to Buyer in response to the submitted Purchase Order.)\n Div(Class: h4, Body: Strong(Body: 2.2) No U.S. Buyers. APLA Tokens during the initial sale are not being offered to U.S. persons. U.S. persons are strictly prohibited and restricted from purchasing APLA Tokens and Seller is not soliciting purchases by U.S. persons in any way. )\n Div(Class: h4, Body: Strong(Body: 2.3) APLA Tokens are not intended to be offered for investment purposes. The pure purpose of the legitimate use of APLA Tokens is to pay for license fees in connection with the execution of transactions on Apla Platform. )\n Div(Class: h4, Body: Strong(Body: 2.4) Buyer acknowledges and agrees that Buyer is not purchasing APLA Tokens for purposes of investment, speculation, as some type of arbitrage strategy, for immediate resale or other financial purposes. )\n\n Div(Class: h4, Body: Strong(Body: 3 Transfer of APLA Tokens) )\n Div(Class: h4, Body: Strong(Body: 3.1) Buyer shall open APLA Wallet in accordance with the rules set forth in the Apla Contractual Documentation and following the KYC (know-your-customer procedure) with SnapSwap. Buyer shall inform Seller about the public key of the opened APLA Wallet in Purchase Order.)\n Div(Class: h4, Body: Strong(Body: 3.2) Seller shall transfer the number of APLA Tokens, indicated in Purchase Order accepted by Seller, to the APLA Wallet of Buyer within 2 business days following the receipt of the purchase price from the Buyer. )\n\n\n Div(Class: h4, Body: Strong(Body: 4 Representations and warranties of the Parties))\n Div(Class: h4, Body: Strong(Body: 4.1) Seller gives no guarantee and/or warrantee as regards the market value of APLA Tokens throughout the term of this T&C and thereafter. )\n Div(Class: h4, Body: Strong(Body: 4.2) Buyer is made aware of the potential high volatility of APLA Tokens on the market and other risks pretraining to crypto-currencies as further defined in the warning of the CSSF published on Span(Class: text-primary, Body: http://www.cssf.lu/fileadmin/files/Protection_consommateurs/Avertissements/W_virtual_currencies_140318_eng.pdf))\n Div(Class: h4, Body: Strong(Body: 4.3) Hereby Buyer gives to Seller the following true, correct and irrevocable representations and warranties that shall be true at the date of submitting Purchase Order to Seller: )\n Div(){\n Div(){\n Div(Class: h4, Body: Strong(Class: wrap, Body: 4.3.1) Span(Class: underline, Body: Legal Status of Buyer.) Buyer is not undergoing any liquidation and/or bankruptcy procedure.)\n Div(Class: h4, Body: Strong(Class: wrap, Body: 4.3.2) Span(Class: underline, Body: Powers and Authorities of Buyer.) Buyer has right, power and authority to enter into, execute and deliver these T&Cs, any other documents contemplated hereby and the transaction contemplated hereby and to perform its obligations hereunder and all corporate actions necessary for this has been undertaken by Buyer. The T&Cs are valid and legally binding for Buyer and can be lawfully enforced in accordance with their terms. The signatory of Buyer that has executed the T&Cs was duly granted with the relevant powers.)\n Div(Class: h4, Body: Strong(Class: wrap, Body: 4.3.3) Span(Class: underline, Body: No Conflict.) The execution of the T&Cs and the fulfilment of obligations by Buyer will not constitute any conflict with (i) the provisions of Buyer’s constituent documents and any other documents regulating Buyer’s status and activities, (ii) any laws, rules or regulations, arbitral awards, court rulings, official orders, resolutions, instructions etc. applicable to Buyer. Buyer obtained all applicable governmental, statutory, regulatory or other consents, licences, authorisations, waivers and exemptions required to enter into these T&Cs and any other documents contemplated hereby and to perform its obligations hereunder.)\n Div(Class: h4, Body: Strong(Class: wrap, Body: 4.3.4) Span(Class: underline, Body: Finance.) Buyer has and will have its own cash and/or fully available credit lines to fulfil its obligations hereunder.)\n }.Style(padding-left: 50px!important;)\n Div(Class: h4, Body: Strong(Body: 4.4) Hereby Seller gives to Buyer the following true, correct and irrevocable warranties and representations that shall be valid at the date of accepting Purchase Order:)\n Div(){\n Div(Class: h4, Body: Strong(Class: wrap, Body: 4.4.1) Span(Class: underline, Body: Legal Status of Seller.) Seller is a corporation duly established and acting on a legal basis in accordance with the legislation of Luxembourg. Seller is not undergoing any liquidation and/or bankruptcy procedure. )\n Div(Class: h4, Body: Strong(Class: wrap, Body: 4.4.2) Span(Class: underline, Body: Powers and Authorities of Seller.) Seller has right, power and authority to enter into, execute and deliver these T&Cs, any other documents contemplated hereby and the transaction contemplated hereby and to perform its obligations hereunderand all corporate actions necessary for this has been undertaken by Seller. The T&Cs are valid and legally binding for Seller and can be lawfully enforced in accordance with its terms. The signatory of Seller that has executed the T&Cs was duly granted with the relevant powers.)\n Div(Class: h4, Body: Strong(Class: wrap, Body: 4.4.3) Span(Class: underline, Body: No Conflict.) The execution of the T& and the fulfilment of obligations by Seller will not constitute any conflict with (i) the provisions of Seller’s constituent documents and any other documents regulating the Seller’s status and activities, (ii) any laws, rules or regulations, arbitral awards, court rulings, official orders, resolutions, instructions etc. applicable to Seller. Seller obtained all applicable governmental, statutory, regulatory or other consents, licences, authorisations, waivers and exemptions required to enter into these T&Cs and any other documents contemplated hereby and to perform its obligations hereunder.)\n Div(Class: h4, Body: Strong(Class: wrap, Body: 4.4.4) Span(Class: underline, Body: Title to APLA Tokens.) As of the date of accepting Purchase Order, Seller will have legal and unrestricted title to the APLA Tokens being the subject matter of these T&Cs, free from any pledge, lien, any other encumbrances and defects. )\n }.Style(padding-left: 50px!important;)\n }.Style(\n .underline {\n text-decoration: underline;\n }\n .wrap {\n padding-right: 8px!important;\n }\n )\n Div(Class: h4, Body: Strong(Body: 4.5) Unless otherwise specifically provided in these T&Cs, in the event that at any time it appears that any of the warranties and representations was not true and correct in any material respect when made, then the Party to whom these warranties and representations were given shall give prompt written notice of any such breach to the other Party and give this default Party the opportunity to eliminate (at the defaulting Party’s own cost and expense) any such breach and the Party to whom these warranties and representations were given shall be required (at the defaulting Party’s own cost and expense) to provide such assistance to the default Party with remedying any such breach as the defaulting party may reasonably request.)\n Div(Class: h4, Body: Strong(Body: 5 Liability))\n Div(Class: h4, Body: Strong(Body: 5.1 ) The Seller’s liability under these T&Cs may not exceed the amount of the purchase price received by Seller from Buyer for APLA Tokens.)\n Div(Class: h4, Body: Strong(Body: 5.2) Seller shall in no case be liable for indirect or consequential damages incurred by Buyer. )\n Div(Class: h4, Body: Strong(Body: 5.3) None of the Parties shall be liable for a failure to properly perform their duties under these T&Cs if this non-performance or poor performance is resulted from force majeure events. Force majeure event means any event and/or circumstance, which is beyond the reasonable control of, and is not attributable to, the affected party resulting in the affected party being prevented from performing or being delayed in the performance of any of its obligations under the T&Cs. Force majeure event may include, but not limited to, an act of a Public Authority or court of any state, interruption or unavailability of power supplies and telecommunication networks in addition to the acts of God. )\n Div(Class: h4, Body: Strong(Body: 6 Entry into Force))\n Div(Class: h4, Body: Strong(Body: 6.1) These T&Cs shall come into force on the date when Seller has accepted Purchase Order of Buyer. )\n Div(Class: h4, Body: Strong(Body: 7 Termination of agreement))\n Div(Class: h4, Body: The agreement between the Parties shall be deemed terminated on the following grounds: )\n Div(Class: h4, Body: Strong(Body: 7.1) Buyer has not transferred the purchase price to Seller for APLA Tokens indicated in Purchase Order accepted by Seller within 5 business days from the acceptance date. )\n Div(Class: h4, Body: Strong(Body: 8 Severability))\n Div(Class: h4, Body: If any part of this agreement is recognized invalid, unlawful, or unenforceable, the other part will continue to be valid and enforceable to the fullest extent permitted by applicable Law. The invalid, unlawful, or unenforceable part shall be construed and further negotiated by the parties concerned in a manner compliant with applicable Law and consistent with original intentions of the Parties. )\n Div(Class: h4, Body: Strong(Body: 9 Notices))\n Div(Class: h4, Body: All notices under this Agreement shall be sent by registered mail or private courier to the following addresses:)\n Div(Class: h4, Body: If to Seller: L-1273 Luxembourg, 20, rue de Bitbourg)\n Div(Class: h4, Body: If to the Buyer: address of APLA Wallet of Buyer)\n Div(Class: h4, Body: or to such other addresses as shall be indicated by the Parties hereto. All notices shall be deemed to have been received [7 (seven) calendar] days after posting by registered mail or upon confirmation of receipt if sent by private courier.)\n Div(Class: h4, Body: Strong(Body: 10 Dispute Resolution))\n Div(Class: h4, Body: All disputes arising out of or in connection with these T&Cs shall be referred to the Arbitration Centre at the Chamber of Commerce and Industry of Luxembourg for final resolution under the Rules of Arbitration established by such Centre by one arbitrator appointed in accordance with those Rules.)\n Div(Class: h4, Body: The law applicable to the relations of the Parties under these T&Cs shall be the Law of Luxembourg.)\n }.Style(padding-left: 50px!important;)\n\n Div(mt-xl mb-lg){\n Button(Body: $@1reject$, Class: btn btn-danger, Page: default_page, Contract: TsBuyerAction, Params: \"Action=reject\")\n Button(Body: $@1accept$, Class: btn btn-primary pull-right, Page: default_page, Contract: TsBuyerAction, Params: \"Action=accept\")\n }\n\n }.Style(\n padding-left: 60px!important;\n padding-right: 60px!important;\n )\n}", "Menu": "default_menu", "Type": "pages" }, @@ -103,9 +103,9 @@ "Type": "pages" }, { - "Name": "ts_consensus_contract", + "Name": "ts_consortium_member_contract", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(isStartProcessing, 0)\nIf(#notific_id# > 0){\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"id\": #notific_id#}).Columns(\"page_params->wallet_id,date_start_processing,notification->type,processing_info->member_id,closed\").Vars(note)\n If(#note_date_start_processing# > 0){\n SetVar(isStartProcessing, 1)\n }\n}\n\nSetVar(this_page, ts_consensus_contract)\nDiv(content-wrapper){\n Form(){\n DBFind(@1ts_wallets).Where({\"id\": #note_page_params_wallet_id#, \"rejected_at\": 0}).Vars(wallet)\n If(#wallet_id# > 0){\n Div(list-group-item){\n Div(text-center text-bold h4 m0){\n LangRes(@1key_id_investor)\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-sm-3 text-right text-bold){\n $@1key_id_investor$\n }\n Div(col-sm-9 text-left){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#wallet_key_id_buyer#\"){\n Address(#wallet_key_id_buyer#)\n }\n }\n }\n Div(row){\n Div(col-sm-3 text-right text-bold){\n $@1signed_at$\n }\n Div(col-sm-9 text-left){\n DateTime(#wallet_signed_at#, \"YYYY-MM-DD HH:MI:SS\")\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 text-right text-bold){\n $@1pub_key$\n }\n Div(col-sm-9 text-left){\n Span(Class: h6, Body: #wallet_pub_buyer#)\n }\n }\n Div(row){\n Div(col-sm-3 text-right text-bold){\n $@1ts_wallet_btc$\n }\n Div(col-sm-9 text-left){\n Span(Class: h6, Body: #wallet_wallet_btc#)\n }\n }\n Div(row){\n Div(col-sm-3 text-right text-bold){\n $@1ts_wallet_eth$\n }\n Div(col-sm-9 text-left){\n Span(Class: h6, Body: #wallet_wallet_eth#)\n }\n }\n }\n If(#note_closed# == 0){\n Div(list-group-item){\n If(And(#note_processing_info_member_id# == #key_id#, #isStartProcessing# == 1)){\n Button(Body: $@1reject$, Class: btn btn-default, Page: #this_page#, PageParams: \"notific_id=#notific_id#\", Contract: TsConsensusAction, Params: \"Action=reject,WalletId=#note_page_params_wallet_id#,NotificId=#notific_id#\")\n Button(Body: $@1accept$, Class: btn btn-primary pull-right, Page: #this_page#, PageParams: \"notific_id=#notific_id#\", Contract: TsConsensusAction, Params: \"Action=accept,WalletId=#note_page_params_wallet_id#,NotificId=#notific_id#\")\n }.ElseIf(#isStartProcessing# == 1){\n Div(text-muted text-center){\n $@1notice_processing_started_another_member$\n }\n }.ElseIf(#isStartProcessing# == 0){\n Div(text-right){\n Button(Body: $@1processing$, Class: btn btn-primary, Page: #this_page#, PageParams: \"notific_id=#notific_id#\", Contract: @1NotificationsProcess, Params: \"NotificId=#notific_id#\")\n }\n }\n }\n }\n }.Else{\n Div(list-group-item text-center h4){\n $@1wallet$ $@1not_found$\n }\n }\n }\n}", + "Value": "SetVar(isStartProcessing, 0)\nIf(#notific_id# > 0){\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#notific_id#\"}).Columns(\"page_params->wallet_id,date_start_processing,notification->type,processing_info->account,closed\").Vars(note)\n If(#note_date_start_processing# > 0){\n SetVar(isStartProcessing, 1)\n }\n}\n\nSetVar(this_page, ts_consortium_member_contract)\nDiv(content-wrapper){\n Form(){\n DBFind(\"@1ts_wallets\").Where({\"id\": \"#note_page_params_wallet_id#\", \"rejected_at\": 0}).Vars(wallet)\n If(#wallet_id# > 0){\n Div(list-group-item){\n Div(text-center text-bold h4 m0){\n LangRes(@1investor)\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-sm-3 text-right text-bold){\n $@1investor$\n }\n Div(col-sm-9 text-left){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#wallet_buyer_account#\"){\n #wallet_buyer_account#\n }\n }\n }\n Div(row){\n Div(col-sm-3 text-right text-bold){\n $@1signed_at$\n }\n Div(col-sm-9 text-left){\n DateTime(#wallet_signed_at#, \"YYYY-MM-DD HH:MI:SS\")\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 text-right text-bold){\n $@1pub_key$\n }\n Div(col-sm-9 text-left){\n Span(Class: h6, Body: #wallet_pub_buyer#)\n }\n }\n Div(row){\n Div(col-sm-3 text-right text-bold){\n $@1ts_wallet_btc$\n }\n Div(col-sm-9 text-left){\n Span(Class: h6, Body: #wallet_wallet_btc#)\n }\n }\n Div(row){\n Div(col-sm-3 text-right text-bold){\n $@1ts_wallet_eth$\n }\n Div(col-sm-9 text-left){\n Span(Class: h6, Body: #wallet_wallet_eth#)\n }\n }\n }\n If(#note_closed# == 0){\n Div(list-group-item){\n If(And(#note_processing_info_account# == #account_id#, #isStartProcessing# == 1)){\n Button(Body: $@1reject$, Class: btn btn-default, Page: #this_page#, PageParams: \"notific_id=#notific_id#\", Contract: TsConsortiumMemberAction, Params: \"Action=reject,WalletId=#note_page_params_wallet_id#,NotificId=#notific_id#\")\n Button(Body: $@1accept$, Class: btn btn-primary pull-right, Page: #this_page#, PageParams: \"notific_id=#notific_id#\", Contract: TsConsortiumMemberAction, Params: \"Action=accept,WalletId=#note_page_params_wallet_id#,NotificId=#notific_id#\")\n }.ElseIf(#isStartProcessing# == 1){\n Div(text-muted text-center){\n $@1notice_processing_started_another_member$\n }\n }.ElseIf(#isStartProcessing# == 0){\n Div(text-right){\n Button(Body: $@1processing$, Class: btn btn-primary, Page: #this_page#, PageParams: \"notific_id=#notific_id#\", Contract: @1NotificationsProcess, Params: \"NotificId=#notific_id#\")\n }\n }\n }\n }\n }.Else{\n Div(list-group-item text-center h4){\n $@1wallet$ $@1not_found$\n }\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, @@ -119,7 +119,7 @@ { "Name": "ts_free_wallets", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1ts_free_wallets).(this_table, @1ts_wallets)\nInclude(@1pager_header)\n\nSetTitle(\"$@1ts_free_wallets$\")\nDBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Token sale\"}).Vars(\"app\")\nSetVar(admin_role_id, AppParam(App: #app_id#, Name: \"ts_role_sale_admin\"))\nIf(And(#admin_role_id# > 0, #role_id# == #admin_role_id#)){\n AddToolButton(Title:$@1ts_free_wallet_add$, Page: @1ts_free_wallet_add, Icon: icon-wallet).Popup(Header: $@1ts_free_wallet_add$, Width: \"50\")\n}\n\nIf(#search#){\n SetVar(where, {\"$and\": [{\"deleted\":0}, {\"key_id_buyer\":0}, {\"$or\":[{\"wallet_btc\": {\"$ilike\": \"#search#\"}}, {\"wallet_eth\": {\"$ilike\": \"#search#\"}}]}]})\n}.Else{\n SetVar(where, {\"$and\": [{\"deleted\":0}, {\"key_id_buyer\":0}]})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1wallet))\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": -1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_btc){\n Span(#wallet_btc#)\n}.Custom(_eth){\n Span(#wallet_eth#)\n}.Custom(action){\n Div(pull-right){\n If(#deleted# == 0){\n Button(Body: Em(Class: fa fa-trash), Class: btn btn-default, Contract: @1TsFreeWalletDelete, Params: \"WalletId=#id#\", Page: @1ts_free_wallets).Alert(Text: \"$@1sure_want_delete$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1id$=id,$@1ts_wallet_btc$=_btc,$@1ts_wallet_eth$=_eth,=action\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1ts_free_wallets$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, @1ts_free_wallets).(this_table, @1ts_wallets)\nInclude(@1pager_header)\n\nSetTitle(\"$@1ts_free_wallets$\")\nDBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Token sale\"}).Vars(app)\nSetVar(admin_role_id, AppParam(App: #app_id#, Name: \"ts_role_sale_admin\"))\nIf(And(#admin_role_id# > 0, #role_id# == #admin_role_id#)){\n AddToolButton(Title:$@1ts_free_wallet_add$, Page: @1ts_free_wallet_add, Icon: icon-wallet).Popup(Header: $@1ts_free_wallet_add$, Width: \"50\")\n}\n\nIf(#search#){\n SetVar(where, {\"$and\": [{\"deleted\": 0}, {\"buyer_account\": 0}, {\"$or\": [{\"wallet_btc\": {\"$ilike\": \"#search#\"}}, {\"wallet_eth\": {\"$ilike\": \"#search#\"}}]}]})\n}.Else{\n SetVar(where, {\"$and\": [{\"deleted\": 0}, {\"buyer_account\": 0}]})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1wallet))\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": \"-1\"}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_btc){\n Span(#wallet_btc#)\n}.Custom(_eth){\n Span(#wallet_eth#)\n}.Custom(action){\n Div(pull-right){\n If(#deleted# == 0){\n Button(Body: Em(Class: fa fa-trash), Class: btn btn-default, Contract: @1TsFreeWalletDelete, Params: \"WalletId=#id#\", Page: @1ts_free_wallets).Alert(Text: \"$@1sure_want_delete$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1id$=id,$@1ts_wallet_btc$=_btc,$@1ts_wallet_eth$=_eth,=action\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1ts_free_wallets$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", "Menu": "default_menu", "Type": "pages" }, @@ -133,21 +133,21 @@ { "Name": "ts_notification", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "If(#notific_id# > 0){\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"id\": #notific_id#}).Columns(\"notification->type,notification->header,notification->body,id,processing_info->member_id,closed\").Vars(note)\n}\n\nDiv(content-wrapper){\n Div(row mt-sm){\n Div(col-lg-10 col-lg-offset-1){\n Form(panel panel-primary){\n DBFind(@1ts_wallets).Where({\"key_id_signer\": {\"$neq\":0}, \"rejected_at\": 0}).Vars(wallet)\n If(#note_id# > 0){\n Div(panel-body text-center){\n Div(h4 text-bold m0){\n #note_notification_header#\n }\n Div(m0){\n #note_notification_body#\n }\n }\n If(#note_closed# == 0){\n Div(panel-footer text-right){\n If(Or(#note_notification_type# == 1, #note_processing_info_member_id# == #key_id#)){\n Button(Body: $@1mark_read$, Class: btn btn-primary, Page: @1default_page, Contract: NotificationsClose, Params: \"NotificId=#notific_id#\")\n }.ElseIf(#note_notification_type# == 2){\n Button(Body: $@1processing$, Class: btn btn-primary, Page: @1ts_notification, PageParams: \"notific_id=#notific_id#\", Contract: NotificationsProcess, Params: \"NotificId=#notific_id#\")\n }\n }\n }\n }\n }\n }\n }\n}", + "Value": "If(#notific_id# > 0){\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#notific_id#\"}).Columns(\"notification->type,notification->header,notification->body,id,processing_info->account,closed\").Vars(note)\n}\n\nDiv(content-wrapper){\n Div(row mt-sm){\n Div(col-lg-10 col-lg-offset-1){\n Form(panel panel-primary){\n DBFind(\"@1ts_wallets\").Where({\"signer_account\": {\"$neq\":0}, \"rejected_at\": 0}).Vars(wallet)\n If(#note_id# > 0){\n Div(panel-body text-center){\n Div(h4 text-bold m0){\n #note_notification_header#\n }\n Div(m0){\n #note_notification_body#\n }\n }\n If(#note_closed# == 0){\n Div(panel-footer text-right){\n If(Or(#note_notification_type# == 1, #note_processing_info_account# == #account_id#)){\n Button(Body: $@1mark_read$, Class: btn btn-primary, Page: @1default_page, Contract: NotificationsClose, Params: \"NotificId=#notific_id#\")\n }.ElseIf(#note_notification_type# == 2){\n Button(Body: $@1processing$, Class: btn btn-primary, Page: @1ts_notification, PageParams: \"notific_id=#notific_id#\", Contract: NotificationsProcess, Params: \"NotificId=#notific_id#\")\n }\n }\n }\n }\n }\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "ts_sales", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1ts_sales).(this_table, @1ts_sales)\nInclude(@1pager_header)\n\nDBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Token sale\"}).Vars(\"app\")\nSetVar(admin_role_id, AppParam(App: #app_id#, Name: \"ts_role_sale_admin\"))\nSetVar(manager_role_id, AppParam(App: #app_id#, Name: \"ts_role_sale_manager\"))\nSetVar(seller_role_id, AppParam(App: #app_id#, Name: \"ts_role_sale_seller\"))\nSetVar(STATUS_MANAGER,1).(STATUS_SELLER,2)\n\nSetTitle(\"$@1ts_sales$\")\nIf(And(#admin_role_id# > 0, #role_id# == #admin_role_id#)){\n AddToolButton(Title:$@1ts_add_transfer$, Page: @1ts_transfer_admin, Icon: icon-wallet).Popup(Header: $@1ts_add_transfer$, Width: \"50\")\n}\n\nIf(#search#){\n SetVar(where, {\"id\": \"#search#\"})\n}.Else{\n SetVar(where, {\"id\": {\"$gt\": 0}})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1key_id))\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": -1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_id){\n Span(#id#)\n SetVar(w_wallet_btc,).(w_wallet_eth,).(w_pub_short_buyer,)\n DBFind(@1ts_wallets).Where({\"key_id_buyer\": #key_id_buyer#}).Vars(w)\n}.Custom(_btat){\n Span(Class: text-muted, Body: DateTime(#buyer_transferred_at#, Format: YYYY-MM-DD HH:MI:SS))\n}.Custom(_cat){\n Span(Class: text-muted, Body: DateTime(#created_at#, Format: YYYY-MM-DD HH:MI:SS))\n}.Custom(_amount){\n Div(text-right){\n Span(Class: text-bold, Body: Money(#amount_apl#)).Style(margin-right:5px;)\n Span(Class: text-bold, Body: APLA)\n }\n}.Custom(_info){\n Button(Class: btn-xs btn-link, Page: @1ts_transfer_view, PageParams: \"Id=#id#\"){\n Span(Class: text-bold h5, Body: LangRes(@1information))\n }.Popup(Header: $@1information$, Width: 35)\n}.Custom(_status){\n SetVar(status_class, AppParam(App:#app_id#, Name:ts_statuses_classes, Index:#status#, Ecosystem: #ecosystem_id#))\n Div(#status_class#){\n AppParam(App:#app_id#, Name:ts_statuses, Index:#status#, Ecosystem: #ecosystem_id#)\n }\n}.Custom(_action){\n If(And(#status# == #STATUS_MANAGER#, #manager_role_id# > 0, #role_id# == #manager_role_id#)){\n Button(Class: fa fa-play btn btn-primary, Page: @1ts_transfer_manager, PageParams: \"SaleId=#id#\")\n }\n If(And(#status# == #STATUS_SELLER#, #seller_role_id# > 0, #role_id# == #seller_role_id#)){\n Button(Class: fa fa-play btn btn-primary, Page: @1ts_transfer_seller, PageParams: \"SaleId=#id#\")\n }\n}.Custom(_buyer){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#key_id_buyer#\"){\n Address(#key_id_buyer#)\n }\n Div(){\n Span(Class: h6 text-muted, Body: PUB:)\n Span(Class: h6 text-muted ml-sm, Body: #w_pub_short_buyer#)\n }\n}.Custom(_wlts){\n Div(){\n Span(Class: h6 text-muted, Body: BTC:)\n Span(Class: h6 ml-sm, Body: #w_wallet_btc#)\n }\n Div(){\n Span(Class: h6 text-muted, Body: ETH:)\n Span(Class: h6 ml-sm, Body: #w_wallet_eth#)\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1id$=_id,$@1key_id_investor$=_buyer,$@1wallets$=_wlts,$@1information$=_info,$@1investor_funds_transfer_date$=_btat,$@1created_at$=_cat,$@1status$=_status,=_action,=_amount\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1sales$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, @1ts_sales).(this_table, @1ts_sales)\nInclude(@1pager_header)\n\nDBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Token sale\"}).Vars(app)\nSetVar(admin_role_id, AppParam(App: #app_id#, Name: \"ts_role_sale_admin\"))\nSetVar(manager_role_id, AppParam(App: #app_id#, Name: \"ts_role_sale_manager\"))\nSetVar(seller_role_id, AppParam(App: #app_id#, Name: \"ts_role_sale_seller\"))\nSetVar(STATUS_MANAGER,1).(STATUS_SELLER,2)\n\nSetTitle(\"$@1ts_sales$\")\nIf(And(#admin_role_id# > 0, #role_id# == #admin_role_id#)){\n AddToolButton(Title:$@1ts_add_transfer$, Page: @1ts_transfer_admin, Icon: icon-wallet).Popup(Header: $@1ts_add_transfer$, Width: \"50\")\n}\n\nIf(#search#){\n SetVar(where, {\"buyer_account\": {\"$ilike\": \"#search#\"}})\n}.Else{\n SetVar(where, {\"id\": {\"$gt\": 0}})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1wallet))\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": \"-1\"}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_id){\n Span(#id#)\n SetVar(w_wallet_btc,).(w_wallet_eth,).(w_pub_short_buyer,)\n DBFind(\"@1ts_wallets\").Where({\"buyer_account\": \"#buyer_account#\"}).Vars(w)\n}.Custom(_btat){\n Span(Class: text-muted, Body: DateTime(#buyer_transferred_at#, Format: YYYY-MM-DD HH:MI:SS))\n}.Custom(_cat){\n Span(Class: text-muted, Body: DateTime(#created_at#, Format: YYYY-MM-DD HH:MI:SS))\n}.Custom(_amount){\n Div(text-right){\n Span(Class: text-bold, Body: Money(#amount_apl#)).Style(margin-right:5px;)\n Span(Class: text-bold, Body: APLA)\n }\n}.Custom(_info){\n Button(Class: btn-xs btn-link, Page: @1ts_transfer_view, PageParams: \"Id=#id#\"){\n Span(Class: text-bold h5, Body: LangRes(@1information))\n }.Popup(Header: $@1information$, Width: 35)\n}.Custom(_status){\n SetVar(status_class, AppParam(App:#app_id#, Name:ts_statuses_classes, Index:#status#, Ecosystem: #ecosystem_id#))\n Div(#status_class#){\n AppParam(App:#app_id#, Name:ts_statuses, Index:#status#, Ecosystem: #ecosystem_id#)\n }\n}.Custom(_action){\n If(And(#status# == #STATUS_MANAGER#, #manager_role_id# > 0, #role_id# == #manager_role_id#)){\n Button(Class: fa fa-play btn btn-primary, Page: @1ts_transfer_manager, PageParams: \"SaleId=#id#\")\n }\n If(And(#status# == #STATUS_SELLER#, #seller_role_id# > 0, #role_id# == #seller_role_id#)){\n Button(Class: fa fa-play btn btn-primary, Page: @1ts_transfer_seller, PageParams: \"SaleId=#id#\")\n }\n}.Custom(_buyer){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#buyer_account#\"){\n #buyer_account#\n }\n Div(){\n Span(Class: h6 text-muted, Body: PUB:)\n Span(Class: h6 text-muted ml-sm, Body: #w_pub_short_buyer#)\n }\n}.Custom(_wlts){\n Div(){\n Span(Class: h6 text-muted, Body: BTC:)\n Span(Class: h6 ml-sm, Body: #w_wallet_btc#)\n }\n Div(){\n Span(Class: h6 text-muted, Body: ETH:)\n Span(Class: h6 ml-sm, Body: #w_wallet_eth#)\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1id$=_id,$@1investor$=_buyer,$@1wallets$=_wlts,$@1information$=_info,$@1investor_funds_transfer_date$=_btat,$@1created_at$=_cat,$@1status$=_status,=_action,=_amount\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1sales$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "ts_settings", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Token sale\"}).Vars(\"app\")\n\nSetVar(this_page, \"ts_settings\").(role_admin,0).(role_manager,0).(role_seller,0).(role_snapswap,0)\nSetVar(role_admin, AppParam(App: #app_id#, Name: \"ts_role_sale_admin\"))\nSetVar(role_manager, AppParam(App: #app_id#, Name: \"ts_role_sale_manager\"))\nSetVar(role_seller, AppParam(App: #app_id#, Name: \"ts_role_sale_seller\"))\nSetVar(role_snapswap, AppParam(App: #app_id#, Name: \"ts_role_snapswap\"))\n\nDBFind(\"@1roles\", src_roles).Where({\"ecosystem\": #ecosystem_id#, \"deleted\": 0}).Columns(\"role_name,id\").Limit(100)\n\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-4 text-right mt-sm\").(col_right,\"col-sm-8 text-left\")\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(@1ts_settings)\n }\n Div(text-center text-muted){\n LangRes(@1ts_settings_description)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n LangRes(@1role_sale_admin)\n }\n }\n Div(#col_right#){\n Select(Name: RoleAdmin, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_admin#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_admin# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #role_admin#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(@1role_sale_manager)\n }\n }\n Div(#col_right#){\n Select(Name: RoleManager, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_manager#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_manager# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #role_manager#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(@1role_sale_seller)\n }\n }\n Div(#col_right#){\n Select(Name: RoleSeller, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_seller#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_seller# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #role_seller#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(@1role_snapswap)\n }\n }\n Div(#col_right#){\n Select(Name: RoleSnapswap, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_snapswap#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_snapswap# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #role_snapswap#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1apply_settings$, Class: btn btn-primary, Page: #this_page#, Contract: TsSettings)\n }\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Token sale\"}).Vars(app)\n\nSetVar(this_page, \"ts_settings\").(role_admin,0).(role_manager,0).(role_seller,0).(role_snapswap,0)\nSetVar(role_admin, AppParam(App: #app_id#, Name: \"ts_role_sale_admin\"))\nSetVar(role_manager, AppParam(App: #app_id#, Name: \"ts_role_sale_manager\"))\nSetVar(role_seller, AppParam(App: #app_id#, Name: \"ts_role_sale_seller\"))\nSetVar(role_snapswap, AppParam(App: #app_id#, Name: \"ts_role_snapswap\"))\n\nDBFind(\"@1roles\", src_roles).Where({\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0}).Columns(\"role_name,id\").Limit(100)\n\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-4 text-right mt-sm\").(col_right,\"col-sm-8 text-left\")\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(@1ts_settings)\n }\n Div(text-center text-muted){\n LangRes(@1ts_settings_description)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n LangRes(@1role_sale_admin)\n }\n }\n Div(#col_right#){\n Select(Name: RoleAdmin, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_admin#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_admin# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#role_admin#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(@1role_sale_manager)\n }\n }\n Div(#col_right#){\n Select(Name: RoleManager, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_manager#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_manager# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#role_manager#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(@1role_sale_seller)\n }\n }\n Div(#col_right#){\n Select(Name: RoleSeller, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_seller#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_seller# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#role_seller#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(@1role_snapswap)\n }\n }\n Div(#col_right#){\n Select(Name: RoleSnapswap, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_snapswap#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#role_snapswap# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#role_snapswap#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1apply_settings$, Class: btn btn-primary, Page: #this_page#, Contract: TsSettings)\n }\n }\n }\n }\n}", "Menu": "admin_menu", "Type": "pages" }, @@ -161,54 +161,54 @@ { "Name": "ts_transfer_manager", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Token sale\"}).Vars(\"app\")\n\nSetVar(this_page, \"ts_transfer_manager\")\nSetVar(role_param, \"ts_role_sale_manager\")\nSetVar(needed_role_id, AppParam(App: #app_id#, Name: #role_param#))\n\nSetVar(isStartProcessing, 0)\nIf(#notific_id# > 0){\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"id\": #notific_id#}).Columns(\"page_params->sale_id,date_start_processing,notification->type,processing_info->member_id,closed\").Vars(note)\n If(#note_date_start_processing# > 0){\n SetVar(isStartProcessing, 1)\n }\n}.ElseIf(#SaleId# != \"\"){\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"page_params->sale_id\": #SaleId#, \"closed\": 0}).Columns(\"page_params->sale_id,date_start_processing,notification->type,processing_info->member_id,id\").Vars(note)\n SetVar(notific_id, #note_id#)\n If(#note_date_start_processing# > 0){\n SetVar(isStartProcessing, 1)\n }\n}\nSetVar(sale_id,0)\nIf(#note_page_params_sale_id# > 0){\n DBFind(@1ts_sales).Where({\"id\": #note_page_params_sale_id#}).Vars(sale)\n DBFind(@1ts_wallets).Where({\"key_id_buyer\": #sale_key_id_buyer#}).Vars(wallet)\n}\n\nDiv(content-wrapper){\n Form(){\n If(And(#needed_role_id# > 0, #role_id# == #needed_role_id#, #sale_id# > 0)){\n Div(list-group-item){\n Div(text-center text-bold h4 m0){\n LangRes(@1ts_transfer_manager)\n }\n }\n Div(list-group-item){\n Div(row mt-sm){\n Div(col-sm-3 text-right text-bold){\n $@1key_id_investor$\n }\n Div(col-sm-9 text-left){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#sale_key_id_buyer#\"){\n Address(#sale_key_id_buyer#)\n }\n }\n }\n Div(row){\n Div(col-sm-3 text-right text-bold){\n $@1tokens$\n }\n Div(col-sm-9 text-left){\n Money(#sale_amount_apl#) APLA\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 text-right text-bold){\n $@1pub_key$\n }\n Div(col-sm-9 text-left){\n Span(Class: h6, Body: #wallet_pub_buyer#)\n }\n }\n Div(row){\n Div(col-sm-3 text-right text-bold){\n $@1ts_wallet_btc$\n }\n Div(col-sm-9 text-left){\n Span(Class: h6, Body: #wallet_wallet_btc#)\n }\n }\n Div(row){\n Div(col-sm-3 text-right text-bold){\n $@1ts_wallet_eth$\n }\n Div(col-sm-9 text-left){\n Span(Class: h6, Body: #wallet_wallet_eth#)\n }\n }\n Div(row mt-sm text-muted ){\n Div(col-sm-3 text-right text-bold){\n $@1investor_funds_transfer_date$\n }\n Div(col-sm-9 text-left){\n DateTime(#sale_buyer_transferred_at#, Format: YYYY-MM-DD HH:MI:SS)\n }\n }\n Div(row text-muted){\n Div(col-sm-3 text-right text-bold){\n $@1created_at$\n }\n Div(col-sm-9 text-left){\n DateTime(#sale_created_at#, Format: YYYY-MM-DD HH:MI:SS)\n }\n }\n Div(row text-muted){\n Div(col-sm-3 text-right text-bold){\n $@1created_by$\n }\n Div(col-sm-9 text-left){\n Address(#sale_key_id_sale_apl_admin#)\n }\n }\n }\n If(#sale_status# == 1){\n Div(list-group-item){\n If(And(#note_processing_info_member_id# == #key_id#, #isStartProcessing# == 1)){\n Button(Body: $@1reject$, Class: btn btn-default, Page: ts_transfer_reject, PageParams: \"RoleParam=#role_param#,notific_id=#notific_id#,back_page=#this_page#\").Popup(50,\"Rejected comment\")\n Button(Body: $@1accept$, Class: btn btn-primary pull-right, Page: ts_sales, Contract: TsTransferManager, Params: \"SaleId=#sale_id#,NotificId=#notific_id#\")\n }.ElseIf(#isStartProcessing# == 1){\n Div(text-muted text-center){\n process begin another manager\n }\n }.ElseIf(#isStartProcessing# == 0){\n Div(text-right){\n Button(Body: $@1processing$, Class: btn btn-primary, Page: #this_page#, PageParams: \"notific_id=#notific_id#\", Contract: @1NotificationsProcess, Params: \"NotificId=#notific_id#\")\n }\n }\n }\n }\n }.Else{\n Div(list-group-item text-center h4){\n If(#needed_role_id# > 0){\n If(#needed_role_id# != #role_id#){\n DBFind(@1parameters).Where({\"ecosystem\": #ecosystem_id#, \"name\": #role_param#}).Vars(param)\n Div(h4){\n This page only for role from parameter LinkPage(Page: @1params_edit, PageParams: \"id=#param_id#,back_page=#this_page#\", Body: #role_param#)\n }\n }\n }.Else{\n Div(h4){\n #role_param# not setted\n }\n Div(h4){\n LinkPage(Body:$@1ts_settings$, Page:ts_settings)\n }\n }\n\n If(#note_id_page_params_sale_id# > 0){\n If(#sale_id# > 0){}.Else{\n Sale not found\n }\n }.Else{\n Notification not found\n }\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Token sale\"}).Vars(app)\n\nSetVar(this_page, \"ts_transfer_manager\")\nSetVar(role_param, \"ts_role_sale_manager\")\nSetVar(needed_role_id, AppParam(App: #app_id#, Name: #role_param#))\n\nSetVar(isStartProcessing, 0)\nIf(#notific_id# > 0){\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#notific_id#\"}).Columns(\"page_params->sale_id,date_start_processing,notification->type,processing_info->account,closed\").Vars(note)\n If(#note_date_start_processing# > 0){\n SetVar(isStartProcessing, 1)\n }\n}.ElseIf(#SaleId# != \"\"){\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"page_params->sale_id\": \"#SaleId#\", \"closed\": 0}).Columns(\"page_params->sale_id,date_start_processing,notification->type,processing_info->account,id\").Vars(note)\n SetVar(notific_id, #note_id#)\n If(#note_date_start_processing# > 0){\n SetVar(isStartProcessing, 1)\n }\n}\nSetVar(sale_id, 0)\nIf(#note_page_params_sale_id# > 0){\n DBFind(\"@1ts_sales\").Where({\"id\": \"#note_page_params_sale_id#\"}).Vars(sale)\n DBFind(\"@1ts_wallets\").Where({\"buyer_account\": \"#sale_buyer_account#\"}).Vars(wallet)\n}\n\nDiv(content-wrapper){\n Form(){\n If(And(#needed_role_id# > 0, #role_id# == #needed_role_id#, #sale_id# > 0)){\n Div(list-group-item){\n Div(text-center text-bold h4 m0){\n LangRes(@1ts_transfer_manager)\n }\n }\n Div(list-group-item){\n Div(row mt-sm){\n Div(col-sm-3 text-right text-bold){\n $@1investor$\n }\n Div(col-sm-9 text-left){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#sale_buyer_account#\"){\n #sale_buyer_account#\n }\n }\n }\n Div(row){\n Div(col-sm-3 text-right text-bold){\n $@1tokens$\n }\n Div(col-sm-9 text-left){\n Money(#sale_amount_apl#) APLA\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 text-right text-bold){\n $@1pub_key$\n }\n Div(col-sm-9 text-left){\n Span(Class: h6, Body: #wallet_pub_buyer#)\n }\n }\n Div(row){\n Div(col-sm-3 text-right text-bold){\n $@1ts_wallet_btc$\n }\n Div(col-sm-9 text-left){\n Span(Class: h6, Body: #wallet_wallet_btc#)\n }\n }\n Div(row){\n Div(col-sm-3 text-right text-bold){\n $@1ts_wallet_eth$\n }\n Div(col-sm-9 text-left){\n Span(Class: h6, Body: #wallet_wallet_eth#)\n }\n }\n Div(row mt-sm text-muted ){\n Div(col-sm-3 text-right text-bold){\n $@1investor_funds_transfer_date$\n }\n Div(col-sm-9 text-left){\n DateTime(#sale_buyer_transferred_at#, Format: YYYY-MM-DD HH:MI:SS)\n }\n }\n Div(row text-muted){\n Div(col-sm-3 text-right text-bold){\n $@1created_at$\n }\n Div(col-sm-9 text-left){\n DateTime(#sale_created_at#, Format: YYYY-MM-DD HH:MI:SS)\n }\n }\n Div(row text-muted){\n Div(col-sm-3 text-right text-bold){\n $@1created_by$\n }\n Div(col-sm-9 text-left){\n #sale_sale_apl_admin#\n }\n }\n }\n If(#sale_status# == 1){\n Div(list-group-item){\n If(And(#note_processing_info_account# == #account_id#, #isStartProcessing# == 1)){\n Button(Body: $@1reject$, Class: btn btn-default, Page: ts_transfer_reject, PageParams: \"RoleParam=#role_param#,notific_id=#notific_id#,back_page=#this_page#\").Popup(50,\"Rejected comment\")\n Button(Body: $@1accept$, Class: btn btn-primary pull-right, Page: ts_sales, Contract: TsTransferManager, Params: \"SaleId=#sale_id#,NotificId=#notific_id#\")\n }.ElseIf(#isStartProcessing# == 1){\n Div(text-muted text-center){\n process begin another manager\n }\n }.ElseIf(#isStartProcessing# == 0){\n Div(text-right){\n Button(Body: $@1processing$, Class: btn btn-primary, Page: #this_page#, PageParams: \"notific_id=#notific_id#\", Contract: @1NotificationsProcess, Params: \"NotificId=#notific_id#\")\n }\n }\n }\n }\n }.Else{\n Div(list-group-item text-center h4){\n If(#needed_role_id# > 0){\n If(#needed_role_id# != #role_id#){\n DBFind(\"@1parameters\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"#role_param#\"}).Vars(param)\n Div(h4){\n This page only for role from parameter LinkPage(Page: @1params_edit, PageParams: \"id=#param_id#,back_page=#this_page#\", Body: #role_param#)\n }\n }\n }.Else{\n Div(h4){\n #role_param# not setted\n }\n Div(h4){\n LinkPage(Body:$@1ts_settings$, Page:ts_settings)\n }\n }\n\n If(#note_id_page_params_sale_id# > 0){\n If(#sale_id# > 0){}.Else{\n Sale not found\n }\n }.Else{\n Notification not found\n }\n }\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "ts_transfer_reject", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Token sale\"}).Vars(\"app\")\nSetVar(needed_role_id, 0)\nIf(#RoleParam# != \"\"){\n SetVar(needed_role_id, AppParam(App: #app_id#, Name: #RoleParam#))\n}\nIf(#notific_id# != \"\"){\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"id\": #notific_id#}).Columns(\"page_params->sale_id\").Vars(note)\n}\nSetVar(sale_id, 0)\nIf(#note_page_params_sale_id# > 0){\n DBFind(@1ts_sales).Where({\"id\": #note_page_params_sale_id#}).Vars(sale)\n}\n\nForm(){\n If(And(#needed_role_id# > 0, #role_id# == #needed_role_id#, #sale_id# > 0)){\n Div(mb){\n Input(Name:Comment, Type:textarea)\n }\n Div(){\n Button(Body: $@1back$, Class: btn btn-default, Page: #back_page#, PageParams: \"notific_id=#notific_id#\")\n Button(Body: $@1send$, Class: btn btn-primary pull-right, Page: default_page, Contract: TsTransferReject, Params: \"RoleParam=#RoleParam#,NotificId=#notific_id#\")\n }\n }.Else{\n Div(text-center text-muted){\n If(And(#needed_role_id# > 0, #role_id# != #needed_role_id#)){\n Div(){\n for added comment you must be logined as role id #needed_role_id#\n }\n }\n If(#sale_id#==0){\n Div(){\n sale not found\n }\n }\n }\n Div(){\n Button(Body: $@1back$, Class: btn btn-default, Page: #back_page#, PageParams: \"notific_id=#notific_id#\")\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Token sale\"}).Vars(app)\nSetVar(needed_role_id, 0)\nIf(#RoleParam# != \"\"){\n SetVar(needed_role_id, AppParam(App: #app_id#, Name: #RoleParam#))\n}\nIf(#notific_id# != \"\"){\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#notific_id#\"}).Columns(\"page_params->sale_id\").Vars(note)\n}\nSetVar(sale_id, 0)\nIf(#note_page_params_sale_id# > 0){\n DBFind(\"@1ts_sales\").Where({\"id\": \"#note_page_params_sale_id#\"}).Vars(sale)\n}\n\nForm(){\n If(And(#needed_role_id# > 0, #role_id# == #needed_role_id#, #sale_id# > 0)){\n Div(mb){\n Input(Name:Comment, Type:textarea)\n }\n Div(){\n Button(Body: $@1back$, Class: btn btn-default, Page: #back_page#, PageParams: \"notific_id=#notific_id#\")\n Button(Body: $@1send$, Class: btn btn-primary pull-right, Page: default_page, Contract: TsTransferReject, Params: \"RoleParam=#RoleParam#,NotificId=#notific_id#\")\n }\n }.Else{\n Div(text-center text-muted){\n If(And(#needed_role_id# > 0, #role_id# != #needed_role_id#)){\n Div(){\n for added comment you must be logined as role id #needed_role_id#\n }\n }\n If(#sale_id#==0){\n Div(){\n sale not found\n }\n }\n }\n Div(){\n Button(Body: $@1back$, Class: btn btn-default, Page: #back_page#, PageParams: \"notific_id=#notific_id#\")\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "ts_transfer_seller", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Token sale\"}).Vars(\"app\")\n\nSetVar(this_page, \"ts_transfer_seller\")\nSetVar(role_param, \"ts_role_sale_seller\")\nSetVar(needed_role_id, AppParam(App: #app_id#, Name: #role_param#))\n\nAppParam(App:#app_id#, Name:ts_currency_type, Ecosystem: #ecosystem_id#, Source:currency_type)\nSetVar(isStartProcessing, 0)\nIf(#notific_id# > 0){\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"id\": #notific_id#}).Columns(\"page_params->sale_id,date_start_processing,notification->type,processing_info->member_id,closed\").Vars(note)\n If(#note_date_start_processing# > 0){\n SetVar(isStartProcessing, 1)\n }\n}.ElseIf(#SaleId#!=\"\"){\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"page_params->sale_id\": #SaleId#, \"closed\": 0}).Columns(\"page_params->sale_id,date_start_processing,notification->type,processing_info->member_id,closed\").Vars(note)\n SetVar(notific_id,#note_id#)\n If(#note_date_start_processing# > 0){\n SetVar(isStartProcessing, 1)\n }\n}\nSetVar(sale_id,0)\nIf(#note_page_params_sale_id# > 0){\n DBFind(@1ts_sales).Where({\"id\": #note_page_params_sale_id#}).Vars(sale)\n DBFind(@1ts_wallets).Where({\"key_id_buyer\": #sale_key_id_buyer#}).Vars(wallet)\n}\n\nDiv(content-wrapper){\n Form(){\n If(And(#needed_role_id# > 0, #role_id# == #needed_role_id#, #sale_id# > 0)){\n Div(list-group-item){\n Div(text-center text-bold h4 m0){\n LangRes(@1ts_transfer_seller)\n }\n }\n Div(list-group-item){\n Div(row mt-sm){\n Div(col-sm-3 text-right text-bold){\n $@1key_id_investor$\n }\n Div(col-sm-9 text-left){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#sale_key_id_buyer#\"){\n Address(#sale_key_id_buyer#)\n }\n }\n }\n Div(row){\n Div(col-sm-3 text-right text-bold){\n $@1tokens$\n }\n Div(col-sm-9 text-left){\n Money(#sale_amount_apl#) APLA\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 text-right text-bold){\n $@1pub_key$\n }\n Div(col-sm-9 text-left){\n Span(Class: h6, Body: #wallet_pub_buyer#)\n }\n }\n Div(row){\n Div(col-sm-3 text-right text-bold){\n $@1ts_wallet_btc$\n }\n Div(col-sm-9 text-left){\n Span(Class: h6, Body: #wallet_wallet_btc#)\n }\n }\n Div(row){\n Div(col-sm-3 text-right text-bold){\n $@1ts_wallet_eth$\n }\n Div(col-sm-9 text-left){\n Span(Class: h6, Body: #wallet_wallet_eth#)\n }\n }\n Div(row mt-sm text-muted){\n Div(col-sm-3 text-right text-bold){\n $@1investor_funds_transfer_date$\n }\n Div(col-sm-9 text-left){\n DateTime(#sale_buyer_transferred_at#, Format: YYYY-MM-DD HH:MI:SS)\n }\n }\n Div(row text-muted){\n Div(col-sm-3 text-right text-bold){\n $@1created_at$\n }\n Div(col-sm-9 text-left){\n DateTime(#sale_created_at#, Format: YYYY-MM-DD HH:MI:SS)\n }\n }\n Div(row text-muted){\n Div(col-sm-3 text-right text-bold){\n $@1created_by$\n }\n Div(col-sm-9 text-left){\n Address(#sale_key_id_sale_apl_admin#)\n }\n }\n Div(row text-muted){\n Div(col-sm-3 text-right text-bold){\n $@1checked_by$\n }\n Div(col-sm-9 text-left){\n Address(#sale_key_id_sale_apl_manager#)\n }\n }\n }\n If(#sale_status# == 2){\n Div(list-group-item){\n If(And(#note_processing_info_member_id# == #key_id#, #isStartProcessing# == 1)){\n Button(Body: $@1reject$, Class: btn btn-default, Page: ts_transfer_reject, PageParams: \"RoleParam=#role_param#,notific_id=#notific_id#,back_page=#this_page#\").Popup(50,\"Rejected comment\")\n Button(Body: $@1accept$, Class: btn btn-primary pull-right, Page: ts_sales, Contract: TsTransferSeller, Params: \"SaleId=#sale_id#,NotificId=#notific_id#\")\n }.ElseIf(#isStartProcessing# == 1){\n Div(text-muted text-center){\n process begin another seller\n }\n }.ElseIf(#isStartProcessing# == 0){\n Div(text-right){\n Button(Body: $@1processing$, Class: btn btn-primary, Page: #this_page#, PageParams: \"notific_id=#notific_id#\", Contract: @1NotificationsProcess, Params: \"NotificId=#notific_id#\")\n }\n }\n }\n }\n }.Else{\n Div(panel-body){\n If(#needed_role_id# > 0){\n If(#needed_role_id# != #role_id#){\n DBFind(@1parameters).Where({\"ecosystem\": #ecosystem_id#, \"name\": #role_param#}).Vars(param)\n Div(h4){\n This page only for role from parameter LinkPage(Page: @1params_edit, PageParams: \"id=#param_id#,back_page=#this_page#\", Body:#role_param#)\n }\n }\n }.Else{\n Div(h4){\n #role_param# not setted\n }\n Div(h4){\n LinkPage(Body:$@1ts_settings$, Page:ts_settings)\n }\n }\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Token sale\"}).Vars(app)\n\nSetVar(this_page, \"ts_transfer_seller\")\nSetVar(role_param, \"ts_role_sale_seller\")\nSetVar(needed_role_id, AppParam(App: #app_id#, Name: #role_param#))\n\nAppParam(App:#app_id#, Name:ts_currency_type, Ecosystem: #ecosystem_id#, Source:currency_type)\nSetVar(isStartProcessing, 0)\nIf(#notific_id# > 0){\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#notific_id#\"}).Columns(\"page_params->sale_id,date_start_processing,notification->type,processing_info->account,closed\").Vars(note)\n If(#note_date_start_processing# > 0){\n SetVar(isStartProcessing, 1)\n }\n}.ElseIf(#SaleId# != \"\"){\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"page_params->sale_id\": \"#SaleId#\", \"closed\": 0}).Columns(\"page_params->sale_id,date_start_processing,notification->type,processing_info->account,closed\").Vars(note)\n SetVar(notific_id,#note_id#)\n If(#note_date_start_processing# > 0){\n SetVar(isStartProcessing, 1)\n }\n}\nSetVar(sale_id,0)\nIf(#note_page_params_sale_id# > 0){\n DBFind(\"@1ts_sales\").Where({\"id\": \"#note_page_params_sale_id#\"}).Vars(sale)\n DBFind(\"@1ts_wallets\").Where({\"buyer_account\": \"#sale_buyer_account#\"}).Vars(wallet)\n}\n\nDiv(content-wrapper){\n Form(){\n If(And(#needed_role_id# > 0, #role_id# == #needed_role_id#, #sale_id# > 0)){\n Div(list-group-item){\n Div(text-center text-bold h4 m0){\n LangRes(@1ts_transfer_seller)\n }\n }\n Div(list-group-item){\n Div(row mt-sm){\n Div(col-sm-3 text-right text-bold){\n $@1investor$\n }\n Div(col-sm-9 text-left){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#sale_buyer_account#\"){\n #sale_buyer_account#\n }\n }\n }\n Div(row){\n Div(col-sm-3 text-right text-bold){\n $@1tokens$\n }\n Div(col-sm-9 text-left){\n Money(#sale_amount_apl#) APLA\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 text-right text-bold){\n $@1pub_key$\n }\n Div(col-sm-9 text-left){\n Span(Class: h6, Body: #wallet_pub_buyer#)\n }\n }\n Div(row){\n Div(col-sm-3 text-right text-bold){\n $@1ts_wallet_btc$\n }\n Div(col-sm-9 text-left){\n Span(Class: h6, Body: #wallet_wallet_btc#)\n }\n }\n Div(row){\n Div(col-sm-3 text-right text-bold){\n $@1ts_wallet_eth$\n }\n Div(col-sm-9 text-left){\n Span(Class: h6, Body: #wallet_wallet_eth#)\n }\n }\n Div(row mt-sm text-muted){\n Div(col-sm-3 text-right text-bold){\n $@1investor_funds_transfer_date$\n }\n Div(col-sm-9 text-left){\n DateTime(#sale_buyer_transferred_at#, Format: YYYY-MM-DD HH:MI:SS)\n }\n }\n Div(row text-muted){\n Div(col-sm-3 text-right text-bold){\n $@1created_at$\n }\n Div(col-sm-9 text-left){\n DateTime(#sale_created_at#, Format: YYYY-MM-DD HH:MI:SS)\n }\n }\n Div(row text-muted){\n Div(col-sm-3 text-right text-bold){\n $@1created_by$\n }\n Div(col-sm-9 text-left){\n #sale_sale_apl_admin#\n }\n }\n Div(row text-muted){\n Div(col-sm-3 text-right text-bold){\n $@1checked_by$\n }\n Div(col-sm-9 text-left){\n #sale_sale_apl_manager#\n }\n }\n }\n If(#sale_status# == 2){\n Div(list-group-item){\n If(And(#note_processing_info_account# == #account_id#, #isStartProcessing# == 1)){\n Button(Body: $@1reject$, Class: btn btn-default, Page: ts_transfer_reject, PageParams: \"RoleParam=#role_param#,notific_id=#notific_id#,back_page=#this_page#\").Popup(50,\"Rejected comment\")\n Button(Body: $@1accept$, Class: btn btn-primary pull-right, Page: ts_sales, Contract: TsTransferSeller, Params: \"SaleId=#sale_id#,NotificId=#notific_id#\")\n }.ElseIf(#isStartProcessing# == 1){\n Div(text-muted text-center){\n process begin another seller\n }\n }.ElseIf(#isStartProcessing# == 0){\n Div(text-right){\n Button(Body: $@1processing$, Class: btn btn-primary, Page: #this_page#, PageParams: \"notific_id=#notific_id#\", Contract: @1NotificationsProcess, Params: \"NotificId=#notific_id#\")\n }\n }\n }\n }\n }.Else{\n Div(panel-body){\n If(#needed_role_id# > 0){\n If(#needed_role_id# != #role_id#){\n DBFind(\"@1parameters\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"#role_param#\"}).Vars(param)\n Div(h4){\n This page only for role from parameter LinkPage(Page: @1params_edit, PageParams: \"id=#param_id#,back_page=#this_page#\", Body:#role_param#)\n }\n }\n }.Else{\n Div(h4){\n #role_param# not setted\n }\n Div(h4){\n LinkPage(Body:$@1ts_settings$, Page:ts_settings)\n }\n }\n }\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "ts_transfer_view", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(row,\"row mt-sm\").(col_left,\"col-sm-6 text-right text-bold\").(col-right,\"col-sm-6 text-left\")\nIf(#back_page# == \"\"){\n SetVar(back_page, @1ts_sales)\n}\nIf(#Id#){\n DBFind(@1ts_sales).Where({\"id\": #Id#}).Vars(sale)\n}\n\nIf(#sale_id# > 0){\n Div(#row#){\n Div(#col_left#){\n $@1key_id_investor$\n }\n Div(#col_right#){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#sale_key_id_buyer#\"){\n Address(#sale_key_id_buyer#)\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n $@1tokens$\n }\n Div(#col_right#){\n Money(#sale_amount_apl#) APLA\n }\n }\n Div(#row#){\n Div(#col_left#){\n $@1key_id_sale_apl_admin$\n }\n Div(#col_right#){\n Address(#sale_key_id_sale_apl_admin#) (#sale_key_id_sale_apl_admin#)\n }\n }\n If(#sale_key_id_sale_apl_manager# != 0){\n Div(#row#){\n Div(#col_left#){\n $@1key_id_sale_apl_manager$\n }\n Div(#col_right#){\n Address(#sale_key_id_sale_apl_manager#) (#sale_key_id_sale_apl_manager#)\n }\n }\n If(#sale_manager_rejected_at# > 0){\n Div(#row#){\n Div(#col_left#){\n $@1manager_rejected_at$\n }\n Div(#col_right#){\n DateTime(#sale_manager_rejected_at#, Format: YYYY-MM-DD HH:MI:SS)\n }\n }\n\n Div(#row#){\n Div(#col_left#){\n $@1manager_reject_comment$\n }\n Div(#col_right#){\n #sale_manager_reject_comment#\n }\n }\n }\n }\n If(#sale_key_id_seller# != 0){\n Div(#row#){\n Div(#col_left#){\n $@1key_id_seller$\n }\n Div(#col_right#){\n Address(#sale_key_id_seller#) (#sale_key_id_seller#)\n }\n }\n If(#sale_seller_rejected_at# > 0){\n Div(#row#){\n Div(#col_left#){\n $@1seller_rejected_at$\n }\n Div(#col_right#){\n DateTime(#sale_seller_rejected_at#, Format: YYYY-MM-DD HH:MI:SS)\n }\n }\n\n Div(#row#){\n Div(#col_left#){\n $@1seller_reject_comment$\n }\n Div(#col_right#){\n #sale_seller_reject_comment#\n }\n }\n }.Else{\n Div(#row#){\n Div(#col_left#){\n $@1seller_transferred_at$\n }\n Div(#col_right#){\n DateTime(#sale_seller_transferred_at#, Format: YYYY-MM-DD HH:MI:SS)\n }\n }\n }\n }\n\n}\nDiv(row mt){\n Div(col-md-12){\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: #back_page#)\n }\n}", + "Value": "SetVar(row,\"row mt-sm\").(col_left,\"col-sm-6 text-right text-bold\").(col-right,\"col-sm-6 text-left\")\nIf(#back_page# == \"\"){\n SetVar(back_page, @1ts_sales)\n}\nIf(#Id#){\n DBFind(\"@1ts_sales\").Where({\"id\": \"#Id#\"}).Vars(sale)\n}\n\nIf(#sale_id# > 0){\n Div(#row#){\n Div(#col_left#){\n $@1investor$\n }\n Div(#col_right#){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#sale_buyer_account#\"){\n #sale_buyer_account#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n $@1tokens$\n }\n Div(#col_right#){\n Money(#sale_amount_apl#) APLA\n }\n }\n Div(#row#){\n Div(#col_left#){\n $@1sale_apl_admin$\n }\n Div(#col_right#){\n #sale_sale_apl_admin#\n }\n }\n If(#sale_sale_apl_manager# != 0){\n Div(#row#){\n Div(#col_left#){\n $@1sale_apl_manager$\n }\n Div(#col_right#){\n #sale_sale_apl_manager#\n }\n }\n If(#sale_manager_rejected_at# > 0){\n Div(#row#){\n Div(#col_left#){\n $@1manager_rejected_at$\n }\n Div(#col_right#){\n DateTime(#sale_manager_rejected_at#, Format: YYYY-MM-DD HH:MI:SS)\n }\n }\n\n Div(#row#){\n Div(#col_left#){\n $@1manager_reject_comment$\n }\n Div(#col_right#){\n #sale_manager_reject_comment#\n }\n }\n }\n }\n If(#sale_seller_account# != 0){\n Div(#row#){\n Div(#col_left#){\n $@1token_seller$\n }\n Div(#col_right#){\n #sale_seller_account#\n }\n }\n If(#sale_seller_rejected_at# > 0){\n Div(#row#){\n Div(#col_left#){\n $@1seller_rejected_at$\n }\n Div(#col_right#){\n DateTime(#sale_seller_rejected_at#, Format: YYYY-MM-DD HH:MI:SS)\n }\n }\n\n Div(#row#){\n Div(#col_left#){\n $@1seller_reject_comment$\n }\n Div(#col_right#){\n #sale_seller_reject_comment#\n }\n }\n }.Else{\n Div(#row#){\n Div(#col_left#){\n $@1seller_transferred_at$\n }\n Div(#col_right#){\n DateTime(#sale_seller_transferred_at#, Format: YYYY-MM-DD HH:MI:SS)\n }\n }\n }\n }\n\n}\nDiv(row mt){\n Div(col-md-12){\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: #back_page#)\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "ts_wallets", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1ts_wallets).(this_table, @1ts_wallets)\nInclude(@1pager_header)\n\nSetTitle(\"$@1ts_wallets$\")\nDBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Token sale\"}).Vars(\"app\")\nSetVar(snapswap_role_id, AppParam(App: #app_id#, Name: \"ts_role_snapswap\"))\nIf(And(#snapswap_role_id# > 0, #role_id# == #snapswap_role_id#)){\n AddToolButton(Title:$@1ts_add_public_key$, Page: @1ts_key_approve, Icon: icon-wallet).Popup(Header: $@1ts_add_public_key$, Width: \"50\")\n}\n\nIf(#search#){\n SetVar(where, {\"$and\": [{\"key_id_buyer\": {\"$neq\": 0}}, {\"$or\":[{\"pub_buyer\": {\"$ilike\": \"#search#\"}}, {\"wallet_btc\": {\"$ilike\": \"#search#\"}}, {\"wallet_eth\": {\"$ilike\": \"#search#\"}}]}]})\n}.Else{\n SetVar(where, {\"key_id_buyer\": {\"$neq\": 0}})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1pub_key) \\ LangRes(@1wallet))\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": -1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_rat){\n If(#rejected_at#>0){\n DateTime(#rejected_at#, Format: YYYY-MM-DD HH:MI:SS)\n }.Else{\n Span(Class: text-muted, Body: --)\n }\n}.Custom(_sat){\n If(#signed_at#>0){\n DateTime(#signed_at#, Format: YYYY-MM-DD HH:MI:SS)\n }\n}.Custom(_cat){\n If(#created_at#>0){\n Span(Class:text-muted, Body:DateTime(#created_at#, Format: YYYY-MM-DD HH:MI:SS))\n }\n}.Custom(_buyer){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#key_id_buyer#\"){\n Address(#key_id_buyer#)\n }\n Div(){\n Span(Class: h6 text-muted, Body: PUB:)\n Span(Class: h6 text-muted ml-sm, Body: #pub_short_buyer#)\n }\n}.Custom(_signer){\n If(#key_id_signer#!=0){\n Span(Class:text-success, Body: Address(#key_id_signer#))\n }\n}.Custom(_wlts){\n Div(){\n Span(Class: h6 text-muted, Body: BTC:)\n Span(Class: h6 ml-sm, Body: #wallet_btc#)\n }\n Div(){\n Span(Class: h6 text-muted, Body: ETH:)\n Span(Class: h6 ml-sm, Body: #wallet_eth#)\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1id$=id,$@1key_id_investor$=_buyer,$@1wallets$=_wlts,$@1created_at$=_cat,$@1signed_at$=_sat,$@1rejected_at$=_rat,$@1key_id_consensus$=_signer\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1wallets$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, @1ts_wallets).(this_table, @1ts_wallets)\nInclude(@1pager_header)\n\nSetTitle(\"$@1ts_wallets$\")\nDBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Token sale\"}).Vars(app)\nSetVar(snapswap_role_id, AppParam(App: #app_id#, Name: \"ts_role_snapswap\"))\nIf(And(#snapswap_role_id# > 0, #role_id# == #snapswap_role_id#)){\n AddToolButton(Title:$@1ts_add_public_key$, Page: @1ts_key_approve, Icon: icon-wallet).Popup(Header: $@1ts_add_public_key$, Width: \"50\")\n}\n\nIf(#search#){\n SetVar(where, {\"$and\": [{\"buyer_account\": {\"$neq\": 0}}, {\"$or\":[{\"pub_buyer\": {\"$ilike\": \"#search#\"}}, {\"wallet_btc\": {\"$ilike\": \"#search#\"}}, {\"wallet_eth\": {\"$ilike\": \"#search#\"}}]}]})\n}.Else{\n SetVar(where, {\"buyer_account\": {\"$neq\": 0}})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1pub_key) \\ LangRes(@1wallet))\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": \"-1\"}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_rat){\n If(#rejected_at#>0){\n DateTime(#rejected_at#, Format: YYYY-MM-DD HH:MI:SS)\n }.Else{\n Span(Class: text-muted, Body: --)\n }\n}.Custom(_sat){\n If(#signed_at#>0){\n DateTime(#signed_at#, Format: YYYY-MM-DD HH:MI:SS)\n }\n}.Custom(_cat){\n If(#created_at#>0){\n Span(Class:text-muted, Body:DateTime(#created_at#, Format: YYYY-MM-DD HH:MI:SS))\n }\n}.Custom(_buyer){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#buyer_account#\"){\n #buyer_account#\n }\n Div(){\n Span(Class: h6 text-muted, Body: PUB:)\n Span(Class: h6 text-muted ml-sm, Body: #pub_short_buyer#)\n }\n}.Custom(_signer){\n If(#signer_account# != 0){\n Span(Class:text-success, Body: #signer_account#)\n }\n}.Custom(_wlts){\n Div(){\n Span(Class: h6 text-muted, Body: BTC:)\n Span(Class: h6 ml-sm, Body: #wallet_btc#)\n }\n Div(){\n Span(Class: h6 text-muted, Body: ETH:)\n Span(Class: h6 ml-sm, Body: #wallet_eth#)\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1id$=id,$@1investor$=_buyer,$@1wallets$=_wlts,$@1created_at$=_cat,$@1signed_at$=_sat,$@1rejected_at$=_rat,$@1signer_consensus$=_signer\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1wallets$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "TsBuyerAction", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract TsBuyerAction {\n data {\n Action string\n }\n\n conditions {\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n var basicAppId int\n basicAppId = Int(DBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).One(\"id\"))\n if basicAppId == 0 {\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n $roleConsensus = Int(AppParam(Int($system_app_id), \"role_consensus\", $ecosystem_id))\n if $roleConsensus == 0 {\n warning Sprintf(LangRes(\"@1role_not_set_application_parameter\", \"en\"), \"role_consensus\")\n }\n $wallet = DBFind(\"ts_wallets\").Where({\"key_id_buyer\": $key_id, \"rejected_at\": 0}).Row()\n if !$wallet {\n warning \"Buyer wallet not found\"\n }\n }\n\n action {\n if $Action == \"accept\" {\n DBUpdate(\"ts_wallets\", Int($wallet[\"id\"]), {signed_at:$time})\n // role Apla Consensus notification\n var params map title string\n title = Sprintf(\"Buyer %v signed contract\", IdToAddress($key_id))\n params[\"wallet_id\"] = $wallet[\"id\"]\n @1NotificationsSend(\"Rid,Sender,Header,Page,Params,Closure\", $roleConsensus, 1, title, \"ts_consensus_contract\", params, 1)\n\n } elif $Action == \"reject\" {\n DBUpdate(\"ts_wallets\", Int($wallet[\"id\"]), {rejected_at:$time})\n }\n\n var notes array i int note map\n notes = DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"recipient->member_id\": $key_id, \"page_name\": \"@1ts_buyer_contract\", \"closed\": 0}).Columns(\"id\")\n while i < Len(notes) {\n note = notes[i]\n @1NotificationsClose(\"NotificId\",Int(note[\"id\"]))\n i = i + 1\n }\n }\n}\n", + "Value": "contract TsBuyerAction {\n data {\n Action string\n }\n\n conditions {\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n var basicAppId int\n basicAppId = Int(DBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).One(\"id\"))\n if basicAppId == 0 {\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n $roleConsortiumMember = Int(AppParam(Int($system_app_id), \"role_consortium_member\", $ecosystem_id))\n if $roleConsortiumMember == 0 {\n warning Sprintf(LangRes(\"@1role_not_set_application_parameter\", \"en\"), \"role_consortium_member\")\n }\n $wallet = DBFind(\"ts_wallets\").Where({\"buyer_account\": $account_id, \"rejected_at\": 0}).Row()\n if !$wallet {\n warning \"Buyer wallet not found\"\n }\n }\n\n action {\n if $Action == \"accept\" {\n DBUpdate(\"ts_wallets\", Int($wallet[\"id\"]), {\"signed_at\": $time})\n var params map title string\n title = Sprintf(\"Buyer %v signed contract\", $account_id)\n params[\"wallet_id\"] = $wallet[\"id\"]\n @1NotificationsSend(\"Rid,Sender,Header,Page,Params,Closure\", $roleConsortiumMember, 1, title, \"ts_consortium_member_contract\", params, 1)\n\n } elif $Action == \"reject\" {\n DBUpdate(\"ts_wallets\", Int($wallet[\"id\"]), {\"rejected_at\": $time})\n }\n\n var notes array i int note map\n notes = DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"recipient->account\": $account_id, \"page_name\": \"@1ts_buyer_contract\", \"closed\": 0}).Columns(\"id\")\n while i < Len(notes) {\n note = notes[i]\n @1NotificationsClose(\"NotificId\",Int(note[\"id\"]))\n i = i + 1\n }\n }\n}\n", "Type": "contracts" }, { - "Name": "TsConsensusAction", + "Name": "TsConsortiumMemberAction", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract TsConsensusAction {\n data {\n Action string\n WalletId int\n NotificId int\n }\n\n conditions{\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n var basicAppId int\n basicAppId = Int(DBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).One(\"id\"))\n if basicAppId == 0{\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n $roleConsensus = Int(AppParam(Int($system_app_id), \"role_consensus\", $ecosystem_id))\n if $roleConsensus == 0 {\n warning Sprintf(LangRes(\"@1role_not_set_application_parameter\", \"en\"), \"role_consensus\")\n }\n if !RoleAccess($roleConsensus) {\n warning \"this action allowed only for role id #\" + $roleConsensus\n }\n $wallet = DBFind(\"ts_wallets\").Where({\"id\": $WalletId, \"rejected_at\": 0}).Row()\n if !$wallet {\n warning \"Buyer wallet not found\"\n }\n if Int($wallet[\"signed_at\"]) == 0 {\n warning \"Buyer wallet not signed\"\n }\n if $wallet[\"key_id_signer\"] > 0 {\n if $wallet[\"key_id_signer\"] != $key_id{\n warning \"This wallet was signed by asbl early\"\n }\n }\n }\n\n action {\n if $Action == \"accept\" {\n DBUpdate(\"ts_wallets\", Int($wallet[\"id\"]), {\"key_id_signer\": $key_id})\n // buyer notification\n var params map\n params[\"wallet_id\"] = $wallet[\"id\"]\n @1NotificationsSend(\"MemberId,Sender,Header,Page,Params,Closure\", Int($wallet[\"key_id_buyer\"]), 1, \"Your wallet approved\", \"ts_buyer_congratulation\", params, 1)\n\n } elif $Action == \"reject\" {\n DBUpdate(\"ts_wallets\", Int($wallet[\"id\"]), {rejected_at:$time})\n }\n @1NotificationsClose(\"NotificId\", $NotificId)\n }\n}\n", + "Value": "contract TsConsortiumMemberAction {\n data {\n Action string\n WalletId int\n NotificId int\n }\n\n conditions{\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n var basicAppId int\n basicAppId = Int(DBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).One(\"id\"))\n if basicAppId == 0{\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n $roleConsortiumMember = Int(AppParam(Int($system_app_id), \"role_consortium_member\", $ecosystem_id))\n if $roleConsortiumMember == 0 {\n warning Sprintf(LangRes(\"@1role_not_set_application_parameter\", \"en\"), \"role_consortium_member\")\n }\n if !RoleAccess($roleConsortiumMember) {\n warning \"this action allowed only for role id #\" + $roleConsortiumMember\n }\n $wallet = DBFind(\"ts_wallets\").Where({\"id\": $WalletId, \"rejected_at\": 0}).Row()\n if !$wallet {\n warning \"Buyer wallet not found\"\n }\n if Int($wallet[\"signed_at\"]) == 0 {\n warning \"Buyer wallet not signed\"\n }\n if $wallet[\"signer_account\"] != 0 {\n if $wallet[\"signer_account\"] != $account_id {\n warning \"This wallet was signed earlier\"\n }\n }\n }\n\n action {\n if $Action == \"accept\" {\n DBUpdate(\"ts_wallets\", Int($wallet[\"id\"]), {\"signer_account\": $account_id})\n // buyer notification\n var params map\n params[\"wallet_id\"] = $wallet[\"id\"]\n @1NotificationsSend(\"MemberAccount,Sender,Header,Page,Params,Closure\", $wallet[\"buyer_account\"], 1, \"Your wallet approved\", \"ts_buyer_congratulation\", params, 1)\n\n } elif $Action == \"reject\" {\n DBUpdate(\"ts_wallets\", Int($wallet[\"id\"]), {\"rejected_at\": $time})\n }\n @1NotificationsClose(\"NotificId\", $NotificId)\n }\n}", "Type": "contracts" }, { "Name": "TsFreeWalletAdd", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract TsFreeWalletAdd {\n data {\n WalletBtc string\n WalletEth string\n }\n\n conditions {\n $app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Token sale\"}).One(\"id\")\n var adminRoleId int adminRoleName string\n adminRoleId = Int(AppParam(Int($app_id), \"ts_role_sale_admin\", $ecosystem_id))\n adminRoleName = DBFind(\"@1roles\").Where({\"id\": adminRoleId}).One(\"role_name\")\n\n if adminRoleId == 0 {\n warning Sprintf(LangRes(\"@1role_not_set_application_parameter\", \"en\"), \"ts_role_sale_admin\")\n }\n\n if !RoleAccess(adminRoleId) {\n warning Sprintf(LangRes(\"x_role_only_action\", \"en\"), adminRoleName)\n }\n\n if DBFind(\"ts_wallets\").Where({\"wallet_btc\": $WalletBtc}).One(\"id\") {\n warning Sprintf(LangRes(\"wallet_btc_exists\", \"en\"), $WalletBtc)\n }\n\n if DBFind(\"ts_wallets\").Where({\"wallet_eth\": $WalletEth}).One(\"id\") {\n warning Sprintf(LangRes(\"wallet_eth_exists\", \"en\"), $WalletEth)\n }\n }\n\n action {\n DBInsert(\"ts_wallets\", {\"wallet_btc\": $WalletBtc, \"wallet_eth\": $WalletEth})\n }\n}", + "Value": "contract TsFreeWalletAdd {\n data {\n WalletBtc string\n WalletEth string\n }\n\n conditions {\n $app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Token sale\"}).One(\"id\")\n var adminRoleId int adminRoleName string\n adminRoleId = Int(AppParam(Int($app_id), \"ts_role_sale_admin\", $ecosystem_id))\n adminRoleName = DBFind(\"@1roles\").Where({\"id\": adminRoleId}).One(\"role_name\")\n\n if adminRoleId == 0 {\n warning Sprintf(LangRes(\"@1role_not_set_application_parameter\", \"en\"), \"ts_role_sale_admin\")\n }\n\n if !RoleAccess(adminRoleId) {\n warning Sprintf(LangRes(\"x_role_only_action\", \"en\"), adminRoleName)\n }\n\n if DBFind(\"ts_wallets\").Where({\"wallet_btc\": $WalletBtc}).One(\"id\") {\n warning Sprintf(LangRes(\"wallet_btc_exists\", \"en\"), $WalletBtc)\n }\n\n if DBFind(\"ts_wallets\").Where({\"wallet_eth\": $WalletEth}).One(\"id\") {\n warning Sprintf(LangRes(\"wallet_eth_exists\", \"en\"), $WalletEth)\n }\n }\n\n action {\n DBInsert(\"ts_wallets\", {\"wallet_btc\": $WalletBtc, \"wallet_eth\": $WalletEth, \"buyer_account\": 0, \"signer_account\": 0})\n }\n}", "Type": "contracts" }, { @@ -220,7 +220,7 @@ { "Name": "TsKeyApprove", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract TsKeyApprove {\n data {\n PublicKey string\n KeyType string\n CurrentRoleId int\n }\n\n func getFreeWallet() int {\n var count_wallets int wallet_map map wallet_arr array\n wallet_arr = DBFind(\"ts_wallets\").Where({\"key_id_buyer\": 0, \"deleted\": 0}).Order({\"id\": 1})\n\n count_wallets = Len(wallet_arr)\n if count_wallets == 0 {\n warning LangRes(\"@1ts_free_wallet_not_found\", \"en\")\n }\n\n if count_wallets == 1 {\n var managerRoleId int\n managerRoleId = Int(AppParam(Int($app_id), \"ts_role_sale_manager\", $ecosystem_id))\n if managerRoleId > 0 {\n var params map title page body string\n title = LangRes(\"@1ts_free_wallets_ended\", \"en\")\n body = LangRes(\"@1ts_free_wallets_need\", \"en\")\n page = \"@1ts_notification\"\n @1NotificationsSend(\"Rid,Sender,Header,Body,Page,Params,Closure,CurrentRid\", managerRoleId, 2, title, body, page, params, 1, $CurrentRoleId)\n }\n }\n\n wallet_map = wallet_arr[0]\n return Int(wallet_map[\"id\"])\n }\n\n conditions {\n $app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Token sale\"}).One(\"id\")\n if $PublicKey == \"\" {\n warning LangRes(\"@1public_key_empty\", \"en\")\n }\n\n $PublicKey = Replace($PublicKey, \" \", \"\")\n if Size($PublicKey) < 128 {\n warning LangRes(\"@1key_too_short\", \"en\")\n }\n if Size($PublicKey) > 130 {\n warning LangRes(\"@1key_too_long\", \"en\")\n }\n\n $userKey = PubToID($PublicKey)\n if $userKey == 0 {\n warning LangRes(\"@1public_key_invalid\", \"en\")\n }\n\n if DBFind(\"ts_wallets\").Where({\"key_id_buyer\": $userKey}).One(\"id\") {\n warning LangRes(\"@1investor_added_already\", \"en\")\n }\n\n if DBFind(\"@1keys\").Where({\"id\": $userKey, \"ecosystem\": 1}).One(\"id\") {\n warning LangRes(\"@1key_added_already\", \"en\")\n }\n\n var snapSwapRoleId int snapSwapRoleName string\n snapSwapRoleId = Int(AppParam(Int($app_id), \"ts_role_snapswap\", $ecosystem_id))\n snapSwapRoleName = DBFind(\"@1roles\").Where({\"id\": snapSwapRoleId}).One(\"role_name\")\n\n if snapSwapRoleId == 0 {\n warning Sprintf(LangRes(\"@1role_not_set_application_parameter\", \"en\"), \"ts_role_snapswap\")\n }\n\n if !RoleAccess(snapSwapRoleId) {\n warning Sprintf(LangRes(\"x_role_only_action\", \"en\"), snapSwapRoleName)\n }\n }\n\n action {\n var pub_bytes bytes\n pub_bytes = HexToPub($PublicKey)\n DBInsert(\"@1keys\", {\"id\": $userKey, \"pub\": pub_bytes, \"ecosystem\": 1})\n var start_balance money\n start_balance = Money(1000000000000000)\n @1TokensSend(\"Recipient,Amount\", IdToAddress($userKey), start_balance)\n\n if $KeyType == \"investor\" {\n $wallet_id = getFreeWallet()\n $pub_short_buyer = Substr($PublicKey, 0, 12) + \"...\" + Substr($PublicKey, Size($PublicKey) - 12, 12)\n DBUpdate(\"ts_wallets\", $wallet_id, {\"key_id_buyer\": $userKey, \"created_at\": $block_time, \"pub_buyer\": $PublicKey, \"pub_short_buyer\": $pub_short_buyer})\n\n // new user notification\n var params map title page body string\n title = LangRes(\"@1ts_hello_user_description\", \"en\")\n body = LangRes(\"@1ts_read_contract\", \"en\")\n page = \"@1ts_buyer_contract\"\n @1NotificationsSend(\"MemberId,Sender,Header,Body,Page,Params,Closure,CurrentRid\", $userKey, 2, title, body, page, params, 1, $CurrentRoleId)\n }\n }\n}", + "Value": "contract TsKeyApprove {\n data {\n PublicKey string\n KeyType string\n CurrentRoleId int\n }\n\n func getFreeWallet() int {\n var count_wallets int wallet_map map wallet_arr array\n wallet_arr = DBFind(\"ts_wallets\").Where({\"buyer_account\": 0, \"deleted\": 0}).Order({\"id\": 1})\n\n count_wallets = Len(wallet_arr)\n if count_wallets == 0 {\n warning LangRes(\"@1ts_free_wallet_not_found\", \"en\")\n }\n\n if count_wallets == 1 {\n var managerRoleId int\n managerRoleId = Int(AppParam(Int($app_id), \"ts_role_sale_manager\", $ecosystem_id))\n if managerRoleId > 0 {\n var params map title page body string\n title = LangRes(\"@1ts_free_wallets_ended\", \"en\")\n body = LangRes(\"@1ts_free_wallets_need\", \"en\")\n page = \"@1ts_notification\"\n @1NotificationsSend(\"Rid,Sender,Header,Body,Page,Params,Closure,CurrentRid\", managerRoleId, 2, title, body, page, params, 1, $CurrentRoleId)\n }\n }\n\n wallet_map = wallet_arr[0]\n return Int(wallet_map[\"id\"])\n }\n\n conditions {\n $app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Token sale\"}).One(\"id\")\n if $PublicKey == \"\" {\n warning LangRes(\"@1public_key_empty\", \"en\")\n }\n\n $PublicKey = Replace($PublicKey, \" \", \"\")\n if Size($PublicKey) < 128 {\n warning LangRes(\"@1key_too_short\", \"en\")\n }\n if Size($PublicKey) > 130 {\n warning LangRes(\"@1key_too_long\", \"en\")\n }\n\n $userKey = PubToID($PublicKey)\n $userAccount = IdToAddress($userKey)\n if $userKey == 0 {\n warning LangRes(\"@1public_key_invalid\", \"en\")\n }\n\n if DBFind(\"ts_wallets\").Where({\"buyer_account\": $userAccount}).One(\"id\") {\n warning LangRes(\"@1investor_added_already\", \"en\")\n }\n\n if DBFind(\"@1keys\").Where({\"account\": $userAccount, \"deleted\": 0, \"ecosystem\": 1}).One(\"id\") {\n warning LangRes(\"@1key_added_already\", \"en\")\n }\n\n var snapSwapRoleId int snapSwapRoleName string\n snapSwapRoleId = Int(AppParam(Int($app_id), \"ts_role_snapswap\", $ecosystem_id))\n snapSwapRoleName = DBFind(\"@1roles\").Where({\"id\": snapSwapRoleId}).One(\"role_name\")\n\n if snapSwapRoleId == 0 {\n warning Sprintf(LangRes(\"@1role_not_set_application_parameter\", \"en\"), \"ts_role_snapswap\")\n }\n\n if !RoleAccess(snapSwapRoleId) {\n warning Sprintf(LangRes(\"x_role_only_action\", \"en\"), snapSwapRoleName)\n }\n }\n\n action {\n var pub_bytes bytes\n pub_bytes = HexToPub($PublicKey)\n DBInsert(\"@1keys\", {\"id\": $userKey, \"account\": $userAccount, \"deleted\": 0, \"pub\": pub_bytes, \"ecosystem\": 1})\n var start_balance money\n start_balance = Money(1000000000000000)\n @1TokensSend(\"Recipient,Amount\", $userAccount, start_balance)\n\n if $KeyType == \"investor\" {\n $wallet_id = getFreeWallet()\n $pub_short_buyer = Substr($PublicKey, 0, 12) + \"...\" + Substr($PublicKey, Size($PublicKey) - 12, 12)\n DBUpdate(\"ts_wallets\", $wallet_id, {\"buyer_account\": $userAccount, \"created_at\": $block_time, \"pub_buyer\": $PublicKey, \"pub_short_buyer\": $pub_short_buyer})\n\n // new user notification\n var params map title page body string\n title = LangRes(\"@1ts_hello_user_description\", \"en\")\n body = LangRes(\"@1ts_read_contract\", \"en\")\n page = \"@1ts_buyer_contract\"\n @1NotificationsSend(\"MemberAccount,Sender,Header,Body,Page,Params,Closure,CurrentRid\", $userAccount, 2, title, body, page, params, 1, $CurrentRoleId)\n }\n }\n}", "Type": "contracts" }, { @@ -232,25 +232,25 @@ { "Name": "TsTransferAdmin", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract TsTransferAdmin {\n data {\n WalletStr string\n CurrencyType int\n AmountApl money\n TransferredDate string\n TransferredTime string\n }\n\n func getRoleId(name string) int {\n var rid int\n rid = Int(AppParam(Int($app_id), name, $ecosystem_id))\n if rid == 0 {\n warning Sprintf(LangRes(\"@1role_not_set_application_parameter\", \"en\"), name)\n }\n return rid\n }\n\n func dateAddTime(d, t string) string {\n var dt string\n if Contains(d, \"T00:00:00Z\") {\n d = Replace(d, \"T00:00:00Z\", \"\")\n }\n if Size(t) == 5 {\n dt = Sprintf(\"%v %v:00\", d, t)\n }\n return dt\n }\n\n conditions {\n $WAITING_MANAGER = 1\n $WAITING_SELLER = 2\n $FINISHED = 3\n $REJECTED = 4\n if $AmountApl <= 0 {\n warning \"Invalid amount of APLA\"\n }\n\n $transferredAt = UnixDateTime(dateAddTime($TransferredDate, $TransferredTime))\n if $transferredAt == 0 {\n warning \"Invalid transfer datetime\"\n }\n\n $app_id = Int(DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Token sale\"}).One(\"id\"))\n if $app_id == 0 {\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n\n $currentRole = getRoleId(\"ts_role_sale_admin\")\n if !RoleAccess($currentRole) {\n warning \"This action is allowed only for the role id #\" + $currentRole\n }\n\n if $CurrencyType <= 0 || $CurrencyType > 3 {\n warning \"Invalid Currency Type\"\n }\n\n if $CurrencyType == 1 {\n $wallet = DBFind(\"ts_wallets\").Where({\"wallet_btc\": $WalletStr}).Row()\n }\n if $CurrencyType == 2 {\n $wallet = DBFind(\"ts_wallets\").Where({\"wallet_eth\": $WalletStr}).Row()\n }\n if $CurrencyType == 3 {\n if $WalletStr == \"\" {\n warning LangRes(\"@1public_key_empty\", \"en\")\n }\n\n $WalletStr = Replace($WalletStr, \" \", \"\")\n if Size($WalletStr) < 128 {\n warning LangRes(\"@1key_too_short\", \"en\")\n }\n if Size($WalletStr) > 130 {\n warning LangRes(\"@1key_too_long\", \"en\")\n }\n var key_id_buyer int\n key_id_buyer = PubToID($WalletStr)\n if key_id_buyer == 0 {\n warning LangRes(\"@1public_key_invalid\", \"en\")\n }\n\n $wallet = DBFind(\"ts_wallets\").Where({\"key_id_buyer\": key_id_buyer}).Row()\n }\n\n if !$wallet {\n warning \"Buyer wallet is not found\"\n }\n }\n\n action {\n var sale map saleId int\n sale[\"key_id_buyer\"] = $wallet[\"key_id_buyer\"]\n sale[\"currency_type\"] = $CurrencyType\n sale[\"amount_apl\"] = $AmountApl\n sale[\"key_id_sale_apl_admin\"] = $key_id\n sale[\"created_at\"] = $time\n sale[\"buyer_transferred_at\"] = $transferredAt\n sale[\"status\"] = $WAITING_MANAGER\n\n saleId = DBInsert(\"ts_sales\", sale)\n\n // role Apla sales manager notification\n var params map title page string\n title = Sprintf(\"Check sale id %v\", saleId)\n page = \"ts_transfer_manager\"\n params[\"sale_id\"] = saleId\n $roleAplManager = getRoleId(\"ts_role_sale_manager\")\n @1NotificationsSend(\"Rid,Sender,Header,Page,Params,Closure,CurrentRid\", $roleAplManager, 2, title, page, params, 1, $currentRole)\n }\n}", + "Value": "contract TsTransferAdmin {\n data {\n WalletStr string\n CurrencyType int\n AmountApl money\n TransferredDate string\n TransferredTime string\n }\n\n func getRoleId(name string) int {\n var rid int\n rid = Int(AppParam(Int($app_id), name, $ecosystem_id))\n if rid == 0 {\n warning Sprintf(LangRes(\"@1role_not_set_application_parameter\", \"en\"), name)\n }\n return rid\n }\n\n func dateAddTime(d, t string) string {\n var dt string\n if Contains(d, \"T00:00:00Z\") {\n d = Replace(d, \"T00:00:00Z\", \"\")\n }\n if Size(t) == 5 {\n dt = Sprintf(\"%v %v:00\", d, t)\n }\n return dt\n }\n\n conditions {\n $WAITING_MANAGER = 1\n $WAITING_SELLER = 2\n $FINISHED = 3\n $REJECTED = 4\n if $AmountApl <= 0 {\n warning \"Invalid amount of APLA\"\n }\n\n $transferredAt = UnixDateTime(dateAddTime($TransferredDate, $TransferredTime))\n if $transferredAt == 0 {\n warning \"Invalid transfer datetime\"\n }\n\n $app_id = Int(DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Token sale\"}).One(\"id\"))\n if $app_id == 0 {\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n\n $currentRole = getRoleId(\"ts_role_sale_admin\")\n if !RoleAccess($currentRole) {\n warning \"This action is allowed only for the role id #\" + $currentRole\n }\n\n if $CurrencyType <= 0 || $CurrencyType > 3 {\n warning \"Invalid Currency Type\"\n }\n\n if $CurrencyType == 1 {\n $wallet = DBFind(\"ts_wallets\").Where({\"wallet_btc\": $WalletStr}).Row()\n }\n if $CurrencyType == 2 {\n $wallet = DBFind(\"ts_wallets\").Where({\"wallet_eth\": $WalletStr}).Row()\n }\n if $CurrencyType == 3 {\n if $WalletStr == \"\" {\n warning LangRes(\"@1public_key_empty\", \"en\")\n }\n\n $WalletStr = Replace($WalletStr, \" \", \"\")\n if Size($WalletStr) < 128 {\n warning LangRes(\"@1key_too_short\", \"en\")\n }\n if Size($WalletStr) > 130 {\n warning LangRes(\"@1key_too_long\", \"en\")\n }\n\n var buyer_key int buyer_account string\n buyer_key = PubToID($WalletStr)\n\n if buyer_key == 0 {\n warning LangRes(\"@1public_key_invalid\", \"en\")\n }\n\n buyer_account = IdToAddress(buyer_key)\n $wallet = DBFind(\"ts_wallets\").Where({\"buyer_account\": buyer_account}).Row()\n }\n\n if !$wallet {\n warning \"Buyer wallet is not found\"\n }\n }\n\n action {\n var sale map saleId int\n sale[\"buyer_account\"] = $wallet[\"buyer_account\"]\n sale[\"currency_type\"] = $CurrencyType\n sale[\"amount_apl\"] = $AmountApl\n sale[\"sale_apl_admin\"] = $account_id\n sale[\"created_at\"] = $time\n sale[\"buyer_transferred_at\"] = $transferredAt\n sale[\"status\"] = $WAITING_MANAGER\n\n saleId = DBInsert(\"ts_sales\", sale)\n\n // role Apla sales manager notification\n var params map title page string\n title = Sprintf(\"Check sale id %v\", saleId)\n page = \"ts_transfer_manager\"\n params[\"sale_id\"] = saleId\n $roleAplManager = getRoleId(\"ts_role_sale_manager\")\n @1NotificationsSend(\"Rid,Sender,Header,Page,Params,Closure,CurrentRid\", $roleAplManager, 2, title, page, params, 1, $currentRole)\n }\n}", "Type": "contracts" }, { "Name": "TsTransferManager", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract TsTransferManager {\n data {\n SaleId int\n NotificId int\n }\n\n func getRoleId(name string) int {\n var rid int\n rid = Int(AppParam(Int($app_id), name, $ecosystem_id))\n if rid == 0 {\n warning Sprintf(LangRes(\"@1role_not_set_application_parameter\", \"en\"), name)\n }\n return rid\n }\n\n conditions {\n $WAITING_MANAGER = 1\n $WAITING_SELLER = 2\n $FINISHED = 3\n $REJECTED = 4\n $app_id = Int(DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Token sale\"}).One(\"id\"))\n if $app_id == 0 {\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n $roleAplSeller = getRoleId(\"ts_role_sale_seller\")\n $currentRole = getRoleId(\"ts_role_sale_manager\")\n if !RoleAccess($currentRole) {\n warning \"this action allowed only for role id #\" + $currentRole\n }\n\n $sale = DBFind(\"ts_sales\").Where({\"id\": $SaleId}).Row()\n if !$sale {\n warning \"Sale is not found\"\n }\n }\n\n action {\n @1NotificationsClose(\"NotificId\", $NotificId)\n DBUpdate(\"ts_sales\", Int($sale[\"id\"]), {\"key_id_sale_apl_manager\": $key_id, \"status\": $WAITING_SELLER})\n\n // role Apla seller notification\n var params map title page string\n title = Sprintf(\"Transfer sale id %v\", $sale[\"id\"])\n params[\"sale_id\"] = $sale[\"id\"]\n page = \"ts_transfer_seller\"\n @1NotificationsSend(\"Rid,Sender,Header,Page,Params,Closure,CurrentRid\", $roleAplSeller, 2, title, page, params, 1, $currentRole)\n\n }\n}", + "Value": "contract TsTransferManager {\n data {\n SaleId int\n NotificId int\n }\n\n func getRoleId(name string) int {\n var rid int\n rid = Int(AppParam(Int($app_id), name, $ecosystem_id))\n if rid == 0 {\n warning Sprintf(LangRes(\"@1role_not_set_application_parameter\", \"en\"), name)\n }\n return rid\n }\n\n conditions {\n $WAITING_MANAGER = 1\n $WAITING_SELLER = 2\n $FINISHED = 3\n $REJECTED = 4\n $app_id = Int(DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Token sale\"}).One(\"id\"))\n if $app_id == 0 {\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n $roleAplSeller = getRoleId(\"ts_role_sale_seller\")\n $currentRole = getRoleId(\"ts_role_sale_manager\")\n if !RoleAccess($currentRole) {\n warning \"this action allowed only for role id #\" + $currentRole\n }\n\n $sale = DBFind(\"ts_sales\").Where({\"id\": $SaleId}).Row()\n if !$sale {\n warning \"Sale is not found\"\n }\n }\n\n action {\n @1NotificationsClose(\"NotificId\", $NotificId)\n DBUpdate(\"ts_sales\", Int($sale[\"id\"]), {\"sale_apl_manager\": $account_id, \"status\": $WAITING_SELLER})\n\n // role Apla seller notification\n var params map title page string\n title = Sprintf(\"Transfer sale id %v\", $sale[\"id\"])\n params[\"sale_id\"] = $sale[\"id\"]\n page = \"ts_transfer_seller\"\n @1NotificationsSend(\"Rid,Sender,Header,Page,Params,Closure,CurrentRid\", $roleAplSeller, 2, title, page, params, 1, $currentRole)\n\n }\n}", "Type": "contracts" }, { "Name": "TsTransferReject", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract TsTransferReject {\n data {\n Comment string\n RoleParam string\n NotificId int\n }\n\n func getRoleId(name string) int {\n var rid int\n rid = Int(AppParam(Int($app_id), name, $ecosystem_id))\n if rid == 0 {\n warning Sprintf(LangRes(\"@1role_not_set_application_parameter\", \"en\"), name)\n }\n return rid\n }\n\n conditions {\n $WAITING_MANAGER = 1\n $WAITING_SELLER = 2\n $FINISHED = 3\n $REJECTED = 4\n\n if !($RoleParam == \"ts_role_sale_manager\" || $RoleParam == \"ts_role_sale_seller\") {\n warning \"Invalid role parameter\"\n }\n $app_id = Int(DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Token sale\"}).One(\"id\"))\n var role noteSaleId int note map\n role = getRoleId($RoleParam)\n if !RoleAccess(role) {\n warning \"This action is allowed only for the role id #\" + role\n }\n note = DBFind(\"@1notifications\").Where({\"id\": $NotificId}).Columns(\"page_params->sale_id,date_start_processing,notification->type\").Row()\n if !note {\n warning \"Notification is not found\"\n }\n $needProcessing = 0\n if note[\"date_start_processing\"] == 0 {\n $needProcessing = 1\n }\n noteSaleId = Int(note[\"page_params.sale_id\"])\n $sale = DBFind(\"ts_sales\").Where({\"id\": noteSaleId}).Row()\n if !$sale {\n warning \"Sale is not found\"\n }\n $saleId = Int($sale[\"id\"])\n }\n\n action {\n if $needProcessing == 1 {\n @1NotificationsProcess(\"NotificId\", $NotificId)\n }\n @1NotificationsClose(\"NotificId\", $NotificId)\n var sale params map title body string prevKeyId int\n title = Sprintf(\"Sale %v rejected\", $saleId)\n body = $Comment\n params[\"sale_id\"] = $saleId\n sale[\"status\"] = $REJECTED\n if $RoleParam == \"ts_role_sale_manager\" {\n sale[\"key_id_sale_apl_manager\"] = $key_id\n sale[\"manager_reject_comment\"] = $Comment\n sale[\"manager_rejected_at\"] = $time\n prevKeyId = Int($sale[\"key_id_sale_apl_admin\"])\n\n } elif $RoleParam == \"ts_role_sale_seller\" {\n sale[\"key_id_seller\"] = $key_id\n sale[\"seller_reject_comment\"] = $Comment\n sale[\"seller_rejected_at\"] = $time\n prevKeyId = Int($sale[\"key_id_sale_apl_manager\"])\n }\n\n DBUpdate(\"ts_sales\", $saleId, sale)\n @1NotificationsSend(\"MemberId,Sender,Header,Body,Page,Params,Closure\", prevKeyId, 1, title, body, \"ts_notification\", params, 1)\n\n }\n}", + "Value": "contract TsTransferReject {\n data {\n Comment string\n RoleParam string\n NotificId int\n }\n\n func getRoleId(name string) int {\n var rid int\n rid = Int(AppParam(Int($app_id), name, $ecosystem_id))\n if rid == 0 {\n warning Sprintf(LangRes(\"@1role_not_set_application_parameter\", \"en\"), name)\n }\n return rid\n }\n\n conditions {\n $WAITING_MANAGER = 1\n $WAITING_SELLER = 2\n $FINISHED = 3\n $REJECTED = 4\n\n if !($RoleParam == \"ts_role_sale_manager\" || $RoleParam == \"ts_role_sale_seller\") {\n warning \"Invalid role parameter\"\n }\n $app_id = Int(DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Token sale\"}).One(\"id\"))\n var role noteSaleId int note map\n role = getRoleId($RoleParam)\n if !RoleAccess(role) {\n warning \"This action is allowed only for the role id #\" + role\n }\n note = DBFind(\"@1notifications\").Where({\"id\": $NotificId}).Columns(\"page_params->sale_id,date_start_processing,notification->type\").Row()\n if !note {\n warning \"Notification is not found\"\n }\n $needProcessing = 0\n if note[\"date_start_processing\"] == 0 {\n $needProcessing = 1\n }\n noteSaleId = Int(note[\"page_params.sale_id\"])\n $sale = DBFind(\"ts_sales\").Where({\"id\": noteSaleId}).Row()\n if !$sale {\n warning \"Sale is not found\"\n }\n $saleId = Int($sale[\"id\"])\n }\n\n action {\n if $needProcessing == 1 {\n @1NotificationsProcess(\"NotificId\", $NotificId)\n }\n @1NotificationsClose(\"NotificId\", $NotificId)\n var sale params map title body string prevAccount string\n title = Sprintf(\"Sale %v rejected\", $saleId)\n body = $Comment\n params[\"sale_id\"] = $saleId\n sale[\"status\"] = $REJECTED\n if $RoleParam == \"ts_role_sale_manager\" {\n sale[\"sale_apl_manager\"] = $account_id\n sale[\"manager_reject_comment\"] = $Comment\n sale[\"manager_rejected_at\"] = $time\n prevAccount = $sale[\"sale_apl_admin\"]\n\n } elif $RoleParam == \"ts_role_sale_seller\" {\n sale[\"seller_account\"] = $account_id\n sale[\"seller_reject_comment\"] = $Comment\n sale[\"seller_rejected_at\"] = $time\n prevAccount = $sale[\"sale_apl_manager\"]\n }\n\n DBUpdate(\"ts_sales\", $saleId, sale)\n @1NotificationsSend(\"MemberAccount,Sender,Header,Body,Page,Params,Closure\", prevAccount, 1, title, body, \"ts_notification\", params, 1)\n\n }\n}", "Type": "contracts" }, { "Name": "TsTransferSeller", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract TsTransferSeller {\n data {\n SaleId int\n NotificId int\n }\n\n func getRoleId(name string) int{\n var rid int\n rid = Int(AppParam(Int($app_id), name, $ecosystem_id))\n if rid == 0 {\n warning Sprintf(LangRes(\"@1role_not_set_application_parameter\", \"en\"), name)\n }\n return rid\n }\n\n conditions{\n $WAITING_MANAGER = 1\n $WAITING_SELLER = 2\n $FINISHED = 3\n $REJECTED = 4\n $app_id = Int(DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Token sale\"}).One(\"id\"))\n if $app_id == 0 {\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n $currentRole = getRoleId(\"ts_role_sale_seller\")\n if !RoleAccess($currentRole) {\n warning \"this action allowed only for role id #\" + $currentRole\n }\n\n $sale = DBFind(\"ts_sales\").Where({\"id\": $SaleId}).Row()\n if !$sale{\n warning \"sale not found\"\n }\n }\n\n action {\n @1NotificationsClose(\"NotificId\", $NotificId)\n var s transfer map\n s[\"key_id_seller\"] = $key_id\n s[\"seller_transferred_at\"] = $time\n s[\"status\"] = $FINISHED\n DBUpdate(\"ts_sales\", Int($sale[\"id\"]), s)\n\n @1TokensSend(\"Recipient,Amount\", $sale[\"key_id_buyer\"], Money($sale[\"amount_apl\"]))\n }\n}", + "Value": "contract TsTransferSeller {\n data {\n SaleId int\n NotificId int\n }\n\n func getRoleId(name string) int{\n var rid int\n rid = Int(AppParam(Int($app_id), name, $ecosystem_id))\n if rid == 0 {\n warning Sprintf(LangRes(\"@1role_not_set_application_parameter\", \"en\"), name)\n }\n return rid\n }\n\n conditions{\n $WAITING_MANAGER = 1\n $WAITING_SELLER = 2\n $FINISHED = 3\n $REJECTED = 4\n $app_id = Int(DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Token sale\"}).One(\"id\"))\n if $app_id == 0 {\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n $currentRole = getRoleId(\"ts_role_sale_seller\")\n if !RoleAccess($currentRole) {\n warning \"this action allowed only for role id #\" + $currentRole\n }\n\n $sale = DBFind(\"ts_sales\").Where({\"id\": $SaleId}).Row()\n if !$sale{\n warning \"sale not found\"\n }\n }\n\n action {\n @1NotificationsClose(\"NotificId\", $NotificId)\n var s transfer map\n s[\"seller_account\"] = $account_id\n s[\"seller_transferred_at\"] = $time\n s[\"status\"] = $FINISHED\n DBUpdate(\"ts_sales\", Int($sale[\"id\"]), s)\n\n @1TokensSend(\"Recipient,Amount\", $sale[\"buyer_account\"], Money($sale[\"amount_apl\"]))\n }\n}", "Type": "contracts" } ] diff --git a/ecosystem_apps/token_sale/config.json b/ecosystem_apps/token_sale/config.json index 2919395be..f6563718a 100644 --- a/ecosystem_apps/token_sale/config.json +++ b/ecosystem_apps/token_sale/config.json @@ -13,7 +13,7 @@ "Conditions": "ContractConditions(\"@1DeveloperCondition\")" }, { - "Name": "TsConsensusAction", + "Name": "TsConsortiumMemberAction", "Conditions": "ContractConditions(\"@1DeveloperCondition\")" }, { @@ -81,7 +81,7 @@ "Menu": "default_menu" }, { - "Name": "ts_consensus_contract", + "Name": "ts_consortium_member_contract", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", "Menu": "default_menu" }, @@ -153,7 +153,7 @@ }, { "Name": "ts_wallets", - "Permissions": "{\"insert\": \"ContractAccess(\\\"@1TsFreeWalletAdd\\\")\", \"update\": \"ContractAccess(\\\"@1TsBuyerAction\\\",\\\"@1TsConsensusAction\\\",\\\"@1TsKeyApprove\\\",\\\"@1TsFreeWalletDelete\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}" + "Permissions": "{\"insert\": \"ContractAccess(\\\"@1TsFreeWalletAdd\\\")\", \"update\": \"ContractAccess(\\\"@1TsBuyerAction\\\",\\\"@1TsConsortiumMemberAction\\\",\\\"@1TsKeyApprove\\\",\\\"@1TsFreeWalletDelete\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}" } ], "parameters": [ diff --git a/ecosystem_apps/token_sale/contracts/TsBuyerAction.sim b/ecosystem_apps/token_sale/contracts/TsBuyerAction.sim index 5fdd39b0d..c63c6ec2c 100644 --- a/ecosystem_apps/token_sale/contracts/TsBuyerAction.sim +++ b/ecosystem_apps/token_sale/contracts/TsBuyerAction.sim @@ -10,11 +10,11 @@ contract TsBuyerAction { if basicAppId == 0 { warning LangRes("@1app_not_found", "en") } - $roleConsensus = Int(AppParam(Int($system_app_id), "role_consensus", $ecosystem_id)) - if $roleConsensus == 0 { - warning Sprintf(LangRes("@1role_not_set_application_parameter", "en"), "role_consensus") + $roleConsortiumMember = Int(AppParam(Int($system_app_id), "role_consortium_member", $ecosystem_id)) + if $roleConsortiumMember == 0 { + warning Sprintf(LangRes("@1role_not_set_application_parameter", "en"), "role_consortium_member") } - $wallet = DBFind("ts_wallets").Where({"key_id_buyer": $key_id, "rejected_at": 0}).Row() + $wallet = DBFind("ts_wallets").Where({"buyer_account": $account_id, "rejected_at": 0}).Row() if !$wallet { warning "Buyer wallet not found" } @@ -22,19 +22,18 @@ contract TsBuyerAction { action { if $Action == "accept" { - DBUpdate("ts_wallets", Int($wallet["id"]), {signed_at:$time}) - // role Apla Consensus notification + DBUpdate("ts_wallets", Int($wallet["id"]), {"signed_at": $time}) var params map title string - title = Sprintf("Buyer %v signed contract", IdToAddress($key_id)) + title = Sprintf("Buyer %v signed contract", $account_id) params["wallet_id"] = $wallet["id"] - @1NotificationsSend("Rid,Sender,Header,Page,Params,Closure", $roleConsensus, 1, title, "ts_consensus_contract", params, 1) + @1NotificationsSend("Rid,Sender,Header,Page,Params,Closure", $roleConsortiumMember, 1, title, "ts_consortium_member_contract", params, 1) } elif $Action == "reject" { - DBUpdate("ts_wallets", Int($wallet["id"]), {rejected_at:$time}) + DBUpdate("ts_wallets", Int($wallet["id"]), {"rejected_at": $time}) } var notes array i int note map - notes = DBFind("@1notifications").Where({"ecosystem": $ecosystem_id, "recipient->member_id": $key_id, "page_name": "@1ts_buyer_contract", "closed": 0}).Columns("id") + notes = DBFind("@1notifications").Where({"ecosystem": $ecosystem_id, "recipient->account": $account_id, "page_name": "@1ts_buyer_contract", "closed": 0}).Columns("id") while i < Len(notes) { note = notes[i] @1NotificationsClose("NotificId",Int(note["id"])) diff --git a/ecosystem_apps/token_sale/contracts/TsConsensusAction.sim b/ecosystem_apps/token_sale/contracts/TsConsortiumMemberAction.sim similarity index 58% rename from ecosystem_apps/token_sale/contracts/TsConsensusAction.sim rename to ecosystem_apps/token_sale/contracts/TsConsortiumMemberAction.sim index d933c88a3..7a4221f59 100644 --- a/ecosystem_apps/token_sale/contracts/TsConsensusAction.sim +++ b/ecosystem_apps/token_sale/contracts/TsConsortiumMemberAction.sim @@ -1,4 +1,4 @@ -contract TsConsensusAction { +contract TsConsortiumMemberAction { data { Action string WalletId int @@ -12,12 +12,12 @@ contract TsConsensusAction { if basicAppId == 0{ warning LangRes("@1app_not_found", "en") } - $roleConsensus = Int(AppParam(Int($system_app_id), "role_consensus", $ecosystem_id)) - if $roleConsensus == 0 { - warning Sprintf(LangRes("@1role_not_set_application_parameter", "en"), "role_consensus") + $roleConsortiumMember = Int(AppParam(Int($system_app_id), "role_consortium_member", $ecosystem_id)) + if $roleConsortiumMember == 0 { + warning Sprintf(LangRes("@1role_not_set_application_parameter", "en"), "role_consortium_member") } - if !RoleAccess($roleConsensus) { - warning "this action allowed only for role id #" + $roleConsensus + if !RoleAccess($roleConsortiumMember) { + warning "this action allowed only for role id #" + $roleConsortiumMember } $wallet = DBFind("ts_wallets").Where({"id": $WalletId, "rejected_at": 0}).Row() if !$wallet { @@ -26,24 +26,24 @@ contract TsConsensusAction { if Int($wallet["signed_at"]) == 0 { warning "Buyer wallet not signed" } - if $wallet["key_id_signer"] > 0 { - if $wallet["key_id_signer"] != $key_id{ - warning "This wallet was signed by asbl early" + if $wallet["signer_account"] != 0 { + if $wallet["signer_account"] != $account_id { + warning "This wallet was signed earlier" } } } action { if $Action == "accept" { - DBUpdate("ts_wallets", Int($wallet["id"]), {"key_id_signer": $key_id}) + DBUpdate("ts_wallets", Int($wallet["id"]), {"signer_account": $account_id}) // buyer notification var params map params["wallet_id"] = $wallet["id"] - @1NotificationsSend("MemberId,Sender,Header,Page,Params,Closure", Int($wallet["key_id_buyer"]), 1, "Your wallet approved", "ts_buyer_congratulation", params, 1) + @1NotificationsSend("MemberAccount,Sender,Header,Page,Params,Closure", $wallet["buyer_account"], 1, "Your wallet approved", "ts_buyer_congratulation", params, 1) } elif $Action == "reject" { - DBUpdate("ts_wallets", Int($wallet["id"]), {rejected_at:$time}) + DBUpdate("ts_wallets", Int($wallet["id"]), {"rejected_at": $time}) } @1NotificationsClose("NotificId", $NotificId) } -} +} \ No newline at end of file diff --git a/ecosystem_apps/token_sale/contracts/TsFreeWalletAdd.sim b/ecosystem_apps/token_sale/contracts/TsFreeWalletAdd.sim index 152471c41..5328a3648 100644 --- a/ecosystem_apps/token_sale/contracts/TsFreeWalletAdd.sim +++ b/ecosystem_apps/token_sale/contracts/TsFreeWalletAdd.sim @@ -28,6 +28,6 @@ contract TsFreeWalletAdd { } action { - DBInsert("ts_wallets", {"wallet_btc": $WalletBtc, "wallet_eth": $WalletEth}) + DBInsert("ts_wallets", {"wallet_btc": $WalletBtc, "wallet_eth": $WalletEth, "buyer_account": 0, "signer_account": 0}) } } \ No newline at end of file diff --git a/ecosystem_apps/token_sale/contracts/TsKeyApprove.sim b/ecosystem_apps/token_sale/contracts/TsKeyApprove.sim index 822931617..5ecf1f0c6 100644 --- a/ecosystem_apps/token_sale/contracts/TsKeyApprove.sim +++ b/ecosystem_apps/token_sale/contracts/TsKeyApprove.sim @@ -7,7 +7,7 @@ contract TsKeyApprove { func getFreeWallet() int { var count_wallets int wallet_map map wallet_arr array - wallet_arr = DBFind("ts_wallets").Where({"key_id_buyer": 0, "deleted": 0}).Order({"id": 1}) + wallet_arr = DBFind("ts_wallets").Where({"buyer_account": 0, "deleted": 0}).Order({"id": 1}) count_wallets = Len(wallet_arr) if count_wallets == 0 { @@ -45,15 +45,16 @@ contract TsKeyApprove { } $userKey = PubToID($PublicKey) + $userAccount = IdToAddress($userKey) if $userKey == 0 { warning LangRes("@1public_key_invalid", "en") } - if DBFind("ts_wallets").Where({"key_id_buyer": $userKey}).One("id") { + if DBFind("ts_wallets").Where({"buyer_account": $userAccount}).One("id") { warning LangRes("@1investor_added_already", "en") } - if DBFind("@1keys").Where({"id": $userKey, "ecosystem": 1}).One("id") { + if DBFind("@1keys").Where({"account": $userAccount, "deleted": 0, "ecosystem": 1}).One("id") { warning LangRes("@1key_added_already", "en") } @@ -73,22 +74,22 @@ contract TsKeyApprove { action { var pub_bytes bytes pub_bytes = HexToPub($PublicKey) - DBInsert("@1keys", {"id": $userKey, "pub": pub_bytes, "ecosystem": 1}) + DBInsert("@1keys", {"id": $userKey, "account": $userAccount, "deleted": 0, "pub": pub_bytes, "ecosystem": 1}) var start_balance money start_balance = Money(1000000000000000) - @1TokensSend("Recipient,Amount", IdToAddress($userKey), start_balance) + @1TokensSend("Recipient,Amount", $userAccount, start_balance) if $KeyType == "investor" { $wallet_id = getFreeWallet() $pub_short_buyer = Substr($PublicKey, 0, 12) + "..." + Substr($PublicKey, Size($PublicKey) - 12, 12) - DBUpdate("ts_wallets", $wallet_id, {"key_id_buyer": $userKey, "created_at": $block_time, "pub_buyer": $PublicKey, "pub_short_buyer": $pub_short_buyer}) + DBUpdate("ts_wallets", $wallet_id, {"buyer_account": $userAccount, "created_at": $block_time, "pub_buyer": $PublicKey, "pub_short_buyer": $pub_short_buyer}) // new user notification var params map title page body string title = LangRes("@1ts_hello_user_description", "en") body = LangRes("@1ts_read_contract", "en") page = "@1ts_buyer_contract" - @1NotificationsSend("MemberId,Sender,Header,Body,Page,Params,Closure,CurrentRid", $userKey, 2, title, body, page, params, 1, $CurrentRoleId) + @1NotificationsSend("MemberAccount,Sender,Header,Body,Page,Params,Closure,CurrentRid", $userAccount, 2, title, body, page, params, 1, $CurrentRoleId) } } } \ No newline at end of file diff --git a/ecosystem_apps/token_sale/contracts/TsTransferAdmin.sim b/ecosystem_apps/token_sale/contracts/TsTransferAdmin.sim index 2a730b96c..2a3348b10 100644 --- a/ecosystem_apps/token_sale/contracts/TsTransferAdmin.sim +++ b/ecosystem_apps/token_sale/contracts/TsTransferAdmin.sim @@ -73,13 +73,16 @@ contract TsTransferAdmin { if Size($WalletStr) > 130 { warning LangRes("@1key_too_long", "en") } - var key_id_buyer int - key_id_buyer = PubToID($WalletStr) - if key_id_buyer == 0 { + + var buyer_key int buyer_account string + buyer_key = PubToID($WalletStr) + + if buyer_key == 0 { warning LangRes("@1public_key_invalid", "en") } - $wallet = DBFind("ts_wallets").Where({"key_id_buyer": key_id_buyer}).Row() + buyer_account = IdToAddress(buyer_key) + $wallet = DBFind("ts_wallets").Where({"buyer_account": buyer_account}).Row() } if !$wallet { @@ -89,10 +92,10 @@ contract TsTransferAdmin { action { var sale map saleId int - sale["key_id_buyer"] = $wallet["key_id_buyer"] + sale["buyer_account"] = $wallet["buyer_account"] sale["currency_type"] = $CurrencyType sale["amount_apl"] = $AmountApl - sale["key_id_sale_apl_admin"] = $key_id + sale["sale_apl_admin"] = $account_id sale["created_at"] = $time sale["buyer_transferred_at"] = $transferredAt sale["status"] = $WAITING_MANAGER diff --git a/ecosystem_apps/token_sale/contracts/TsTransferManager.sim b/ecosystem_apps/token_sale/contracts/TsTransferManager.sim index a9d841795..597f969fb 100644 --- a/ecosystem_apps/token_sale/contracts/TsTransferManager.sim +++ b/ecosystem_apps/token_sale/contracts/TsTransferManager.sim @@ -36,7 +36,7 @@ contract TsTransferManager { action { @1NotificationsClose("NotificId", $NotificId) - DBUpdate("ts_sales", Int($sale["id"]), {"key_id_sale_apl_manager": $key_id, "status": $WAITING_SELLER}) + DBUpdate("ts_sales", Int($sale["id"]), {"sale_apl_manager": $account_id, "status": $WAITING_SELLER}) // role Apla seller notification var params map title page string diff --git a/ecosystem_apps/token_sale/contracts/TsTransferReject.sim b/ecosystem_apps/token_sale/contracts/TsTransferReject.sim index 3a7b6231f..bbc080bad 100644 --- a/ecosystem_apps/token_sale/contracts/TsTransferReject.sim +++ b/ecosystem_apps/token_sale/contracts/TsTransferReject.sim @@ -50,26 +50,26 @@ contract TsTransferReject { @1NotificationsProcess("NotificId", $NotificId) } @1NotificationsClose("NotificId", $NotificId) - var sale params map title body string prevKeyId int + var sale params map title body string prevAccount string title = Sprintf("Sale %v rejected", $saleId) body = $Comment params["sale_id"] = $saleId sale["status"] = $REJECTED if $RoleParam == "ts_role_sale_manager" { - sale["key_id_sale_apl_manager"] = $key_id + sale["sale_apl_manager"] = $account_id sale["manager_reject_comment"] = $Comment sale["manager_rejected_at"] = $time - prevKeyId = Int($sale["key_id_sale_apl_admin"]) + prevAccount = $sale["sale_apl_admin"] } elif $RoleParam == "ts_role_sale_seller" { - sale["key_id_seller"] = $key_id + sale["seller_account"] = $account_id sale["seller_reject_comment"] = $Comment sale["seller_rejected_at"] = $time - prevKeyId = Int($sale["key_id_sale_apl_manager"]) + prevAccount = $sale["sale_apl_manager"] } DBUpdate("ts_sales", $saleId, sale) - @1NotificationsSend("MemberId,Sender,Header,Body,Page,Params,Closure", prevKeyId, 1, title, body, "ts_notification", params, 1) + @1NotificationsSend("MemberAccount,Sender,Header,Body,Page,Params,Closure", prevAccount, 1, title, body, "ts_notification", params, 1) } } \ No newline at end of file diff --git a/ecosystem_apps/token_sale/contracts/TsTransferSeller.sim b/ecosystem_apps/token_sale/contracts/TsTransferSeller.sim index 90a02955d..d181ba3ab 100644 --- a/ecosystem_apps/token_sale/contracts/TsTransferSeller.sim +++ b/ecosystem_apps/token_sale/contracts/TsTransferSeller.sim @@ -36,11 +36,11 @@ contract TsTransferSeller { action { @1NotificationsClose("NotificId", $NotificId) var s transfer map - s["key_id_seller"] = $key_id + s["seller_account"] = $account_id s["seller_transferred_at"] = $time s["status"] = $FINISHED DBUpdate("ts_sales", Int($sale["id"]), s) - @1TokensSend("Recipient,Amount", $sale["key_id_buyer"], Money($sale["amount_apl"])) + @1TokensSend("Recipient,Amount", $sale["buyer_account"], Money($sale["amount_apl"])) } } \ No newline at end of file diff --git a/ecosystem_apps/token_sale/menus/default_menu.ptl b/ecosystem_apps/token_sale/menus/default_menu.ptl index f4114647f..cff91117b 100644 --- a/ecosystem_apps/token_sale/menus/default_menu.ptl +++ b/ecosystem_apps/token_sale/menus/default_menu.ptl @@ -1,8 +1,8 @@ If(#ecosystem_id# == 1){ SetVar(is_allowed, 0).(k_id, 0).(unreaded_wallet_id,0).(exist_wallet_id,0) - DBFind(@1keys).Where({"id": #key_id#, "ecosystem": 1}).Vars(k) - DBFind(@1ts_wallets).Where({"key_id_buyer": #key_id#}).Vars(exist_wallet) - DBFind(@1ts_wallets).Where({"key_id_buyer": #key_id#, "rejected_at": 0, "signed_at": 0}).Vars(unreaded_wallet) + DBFind("@1keys").Where({"account": "#account_id#", "deleted": 0, "ecosystem": 1}).Vars(k) + DBFind("@1ts_wallets").Where({"buyer_account": "#account_id#"}).Vars(exist_wallet) + DBFind("@1ts_wallets").Where({"buyer_account": "#account_id#", "rejected_at": 0, "signed_at": 0}).Vars(unreaded_wallet) If(#k_id# != 0){ If(#exist_wallet_id# > 0){ If(#unreaded_wallet_id# == 0){ @@ -13,7 +13,7 @@ If(#ecosystem_id# == 1){ } } If(#is_allowed# == 1){ - DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Token sale"}).Vars("app") + DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Token sale"}).Vars(app) SetVar(snapswap_role_id,0).(admin_role_id,0).(manager_role_id,0).(seller_role_id,0) SetVar(snapswap_role_id, AppParam(App: #app_id#, Name: "ts_role_snapswap")) SetVar(admin_role_id, AppParam(App: #app_id#, Name: "ts_role_sale_admin")) diff --git a/ecosystem_apps/token_sale/pages/default_page.ptl b/ecosystem_apps/token_sale/pages/default_page.ptl index f6a81a14b..653a813e8 100644 --- a/ecosystem_apps/token_sale/pages/default_page.ptl +++ b/ecosystem_apps/token_sale/pages/default_page.ptl @@ -1,5 +1,5 @@ -DBFind(@1ts_wallets).Where({"key_id_buyer": #key_id#, "rejected_at": 0, "signed_at": 0}).Vars(unconfirmed_wallet) -If(#unconfirmed_wallet_id#>0){ +DBFind("@1ts_wallets").Where({"buyer_account": "#account_id#", "rejected_at": 0, "signed_at": 0}).Vars(unconfirmed_wallet) +If(#unconfirmed_wallet_id# > 0){ Include(@1ts_contract_investors) }.Else{ Include(@1profile) diff --git a/ecosystem_apps/token_sale/pages/ts_buyer_congratulation.ptl b/ecosystem_apps/token_sale/pages/ts_buyer_congratulation.ptl index d0cd432e4..0c5f32810 100644 --- a/ecosystem_apps/token_sale/pages/ts_buyer_congratulation.ptl +++ b/ecosystem_apps/token_sale/pages/ts_buyer_congratulation.ptl @@ -1,4 +1,4 @@ -DBFind(@1ts_wallets).Where({"key_id_buyer": #key_id#}).Vars(w) +DBFind("@1ts_wallets").Where({"buyer_account": "#account_id#"}).Vars(w) If(#w_id# > 0){ Div(list-group-item mt-lg mb-lg ml-lg mr-lg){ Div(Class: h3 text-bold text-center pb-xl, Body: Purchase Order) @@ -9,7 +9,7 @@ If(#w_id# > 0){ Div(table tablez){ Div(table__row){ Div(table__cell table__cell_10){APLA Wallet Number} - Div(table__cell table__cell_10){Address(#key_id#)} + Div(table__cell table__cell_10){#account_id#} } Div(table__row){ Div(table__cell table__cell_10){Number of APLA Tokens to buy} @@ -122,7 +122,7 @@ If(#w_id# > 0){ ) Div(Class: h4, Body: We hereby acknowledge the receipt of and agree with the Standard Terms & Conditions of Sale. ) Div(){ - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "id": #notific_id#}).Columns("closed").Vars(note) + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "id": "#notific_id#"}).Columns("closed").Vars(note) If(#note_closed# == 0){ Button(Body: $@1mark_read$, Class: btn btn-primary pull-right, Page: default_page, Contract: NotificationsClose, Params: "NotificId=#notific_id#") } diff --git a/ecosystem_apps/token_sale/pages/ts_buyer_contract.ptl b/ecosystem_apps/token_sale/pages/ts_buyer_contract.ptl index 292dfa36f..09f84e705 100644 --- a/ecosystem_apps/token_sale/pages/ts_buyer_contract.ptl +++ b/ecosystem_apps/token_sale/pages/ts_buyer_contract.ptl @@ -1,5 +1,5 @@ -DBFind(@1ts_wallets).Where({"key_id_buyer": #key_id#, "key_id_signer": 0, "rejected_at": 0}).Vars(unconfirmed_wallet) -If(#unconfirmed_wallet_id#>0){ +DBFind("@1ts_wallets").Where({"buyer_account": "#account_id#", "signer_account": 0, "rejected_at": 0}).Vars(unconfirmed_wallet) +If(#unconfirmed_wallet_id# > 0){ Div(list-group-item mt-lg mb-lg ml-lg mr-lg){ Div(Class: h3 text-bold m0 text-center, Body: APLA Tokens) Div(Class: h3 text-bold m0 text-center, Body: Standard Terms and Conditions of Sale) diff --git a/ecosystem_apps/token_sale/pages/ts_consensus_contract.ptl b/ecosystem_apps/token_sale/pages/ts_consortium_member_contract.ptl similarity index 75% rename from ecosystem_apps/token_sale/pages/ts_consensus_contract.ptl rename to ecosystem_apps/token_sale/pages/ts_consortium_member_contract.ptl index a9abb5d05..0189d31af 100644 --- a/ecosystem_apps/token_sale/pages/ts_consensus_contract.ptl +++ b/ecosystem_apps/token_sale/pages/ts_consortium_member_contract.ptl @@ -1,29 +1,29 @@ SetVar(isStartProcessing, 0) If(#notific_id# > 0){ - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "id": #notific_id#}).Columns("page_params->wallet_id,date_start_processing,notification->type,processing_info->member_id,closed").Vars(note) + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "id": "#notific_id#"}).Columns("page_params->wallet_id,date_start_processing,notification->type,processing_info->account,closed").Vars(note) If(#note_date_start_processing# > 0){ SetVar(isStartProcessing, 1) } } -SetVar(this_page, ts_consensus_contract) +SetVar(this_page, ts_consortium_member_contract) Div(content-wrapper){ Form(){ - DBFind(@1ts_wallets).Where({"id": #note_page_params_wallet_id#, "rejected_at": 0}).Vars(wallet) + DBFind("@1ts_wallets").Where({"id": "#note_page_params_wallet_id#", "rejected_at": 0}).Vars(wallet) If(#wallet_id# > 0){ Div(list-group-item){ Div(text-center text-bold h4 m0){ - LangRes(@1key_id_investor) + LangRes(@1investor) } } Div(list-group-item){ Div(row){ Div(col-sm-3 text-right text-bold){ - $@1key_id_investor$ + $@1investor$ } Div(col-sm-9 text-left){ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#wallet_key_id_buyer#"){ - Address(#wallet_key_id_buyer#) + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#wallet_buyer_account#"){ + #wallet_buyer_account# } } } @@ -62,9 +62,9 @@ Div(content-wrapper){ } If(#note_closed# == 0){ Div(list-group-item){ - If(And(#note_processing_info_member_id# == #key_id#, #isStartProcessing# == 1)){ - Button(Body: $@1reject$, Class: btn btn-default, Page: #this_page#, PageParams: "notific_id=#notific_id#", Contract: TsConsensusAction, Params: "Action=reject,WalletId=#note_page_params_wallet_id#,NotificId=#notific_id#") - Button(Body: $@1accept$, Class: btn btn-primary pull-right, Page: #this_page#, PageParams: "notific_id=#notific_id#", Contract: TsConsensusAction, Params: "Action=accept,WalletId=#note_page_params_wallet_id#,NotificId=#notific_id#") + If(And(#note_processing_info_account# == #account_id#, #isStartProcessing# == 1)){ + Button(Body: $@1reject$, Class: btn btn-default, Page: #this_page#, PageParams: "notific_id=#notific_id#", Contract: TsConsortiumMemberAction, Params: "Action=reject,WalletId=#note_page_params_wallet_id#,NotificId=#notific_id#") + Button(Body: $@1accept$, Class: btn btn-primary pull-right, Page: #this_page#, PageParams: "notific_id=#notific_id#", Contract: TsConsortiumMemberAction, Params: "Action=accept,WalletId=#note_page_params_wallet_id#,NotificId=#notific_id#") }.ElseIf(#isStartProcessing# == 1){ Div(text-muted text-center){ $@1notice_processing_started_another_member$ diff --git a/ecosystem_apps/token_sale/pages/ts_free_wallets.ptl b/ecosystem_apps/token_sale/pages/ts_free_wallets.ptl index ed9a0bee3..10f752b9d 100644 --- a/ecosystem_apps/token_sale/pages/ts_free_wallets.ptl +++ b/ecosystem_apps/token_sale/pages/ts_free_wallets.ptl @@ -2,16 +2,16 @@ SetVar(this_page, @1ts_free_wallets).(this_table, @1ts_wallets) Include(@1pager_header) SetTitle("$@1ts_free_wallets$") -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Token sale"}).Vars("app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Token sale"}).Vars(app) SetVar(admin_role_id, AppParam(App: #app_id#, Name: "ts_role_sale_admin")) If(And(#admin_role_id# > 0, #role_id# == #admin_role_id#)){ AddToolButton(Title:$@1ts_free_wallet_add$, Page: @1ts_free_wallet_add, Icon: icon-wallet).Popup(Header: $@1ts_free_wallet_add$, Width: "50") } If(#search#){ - SetVar(where, {"$and": [{"deleted":0}, {"key_id_buyer":0}, {"$or":[{"wallet_btc": {"$ilike": "#search#"}}, {"wallet_eth": {"$ilike": "#search#"}}]}]}) + SetVar(where, {"$and": [{"deleted": 0}, {"buyer_account": 0}, {"$or": [{"wallet_btc": {"$ilike": "#search#"}}, {"wallet_eth": {"$ilike": "#search#"}}]}]}) }.Else{ - SetVar(where, {"$and": [{"deleted":0}, {"key_id_buyer":0}]}) + SetVar(where, {"$and": [{"deleted": 0}, {"buyer_account": 0}]}) } Div(list-group-item ml-lg mr-lg pt-lg){ @@ -19,7 +19,7 @@ Div(list-group-item ml-lg mr-lg pt-lg){ Include(@1search) } -DBFind(#this_table#, src).Where(#where#).Order({"id": -1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_btc){ +DBFind(#this_table#, src).Where(#where#).Order({"id": "-1"}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_btc){ Span(#wallet_btc#) }.Custom(_eth){ Span(#wallet_eth#) diff --git a/ecosystem_apps/token_sale/pages/ts_notification.ptl b/ecosystem_apps/token_sale/pages/ts_notification.ptl index 0c44a3077..d6f10e9be 100644 --- a/ecosystem_apps/token_sale/pages/ts_notification.ptl +++ b/ecosystem_apps/token_sale/pages/ts_notification.ptl @@ -1,12 +1,12 @@ If(#notific_id# > 0){ - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "id": #notific_id#}).Columns("notification->type,notification->header,notification->body,id,processing_info->member_id,closed").Vars(note) + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "id": "#notific_id#"}).Columns("notification->type,notification->header,notification->body,id,processing_info->account,closed").Vars(note) } Div(content-wrapper){ Div(row mt-sm){ Div(col-lg-10 col-lg-offset-1){ Form(panel panel-primary){ - DBFind(@1ts_wallets).Where({"key_id_signer": {"$neq":0}, "rejected_at": 0}).Vars(wallet) + DBFind("@1ts_wallets").Where({"signer_account": {"$neq":0}, "rejected_at": 0}).Vars(wallet) If(#note_id# > 0){ Div(panel-body text-center){ Div(h4 text-bold m0){ @@ -18,7 +18,7 @@ Div(content-wrapper){ } If(#note_closed# == 0){ Div(panel-footer text-right){ - If(Or(#note_notification_type# == 1, #note_processing_info_member_id# == #key_id#)){ + If(Or(#note_notification_type# == 1, #note_processing_info_account# == #account_id#)){ Button(Body: $@1mark_read$, Class: btn btn-primary, Page: @1default_page, Contract: NotificationsClose, Params: "NotificId=#notific_id#") }.ElseIf(#note_notification_type# == 2){ Button(Body: $@1processing$, Class: btn btn-primary, Page: @1ts_notification, PageParams: "notific_id=#notific_id#", Contract: NotificationsProcess, Params: "NotificId=#notific_id#") diff --git a/ecosystem_apps/token_sale/pages/ts_sales.ptl b/ecosystem_apps/token_sale/pages/ts_sales.ptl index 56798a2f8..74547f50c 100644 --- a/ecosystem_apps/token_sale/pages/ts_sales.ptl +++ b/ecosystem_apps/token_sale/pages/ts_sales.ptl @@ -1,7 +1,7 @@ SetVar(this_page, @1ts_sales).(this_table, @1ts_sales) Include(@1pager_header) -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Token sale"}).Vars("app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Token sale"}).Vars(app) SetVar(admin_role_id, AppParam(App: #app_id#, Name: "ts_role_sale_admin")) SetVar(manager_role_id, AppParam(App: #app_id#, Name: "ts_role_sale_manager")) SetVar(seller_role_id, AppParam(App: #app_id#, Name: "ts_role_sale_seller")) @@ -13,20 +13,20 @@ If(And(#admin_role_id# > 0, #role_id# == #admin_role_id#)){ } If(#search#){ - SetVar(where, {"id": "#search#"}) + SetVar(where, {"buyer_account": {"$ilike": "#search#"}}) }.Else{ SetVar(where, {"id": {"$gt": 0}}) } Div(list-group-item ml-lg mr-lg pt-lg){ - SetVar(search_name, LangRes(@1key_id)) + SetVar(search_name, LangRes(@1wallet)) Include(@1search) } -DBFind(#this_table#, src).Where(#where#).Order({"id": -1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_id){ +DBFind(#this_table#, src).Where(#where#).Order({"id": "-1"}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_id){ Span(#id#) SetVar(w_wallet_btc,).(w_wallet_eth,).(w_pub_short_buyer,) - DBFind(@1ts_wallets).Where({"key_id_buyer": #key_id_buyer#}).Vars(w) + DBFind("@1ts_wallets").Where({"buyer_account": "#buyer_account#"}).Vars(w) }.Custom(_btat){ Span(Class: text-muted, Body: DateTime(#buyer_transferred_at#, Format: YYYY-MM-DD HH:MI:SS)) }.Custom(_cat){ @@ -53,8 +53,8 @@ DBFind(#this_table#, src).Where(#where#).Order({"id": -1}).Limit(#pager_limit#). Button(Class: fa fa-play btn btn-primary, Page: @1ts_transfer_seller, PageParams: "SaleId=#id#") } }.Custom(_buyer){ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#key_id_buyer#"){ - Address(#key_id_buyer#) + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#buyer_account#"){ + #buyer_account# } Div(){ Span(Class: h6 text-muted, Body: PUB:) @@ -75,7 +75,7 @@ Div(fullscreen){ Div(table-responsive ml-lg mr-lg){ Div(list-group-item){ If(#count# > 0){ - Table(src, "$@1id$=_id,$@1key_id_investor$=_buyer,$@1wallets$=_wlts,$@1information$=_info,$@1investor_funds_transfer_date$=_btat,$@1created_at$=_cat,$@1status$=_status,=_action,=_amount") + Table(src, "$@1id$=_id,$@1investor$=_buyer,$@1wallets$=_wlts,$@1information$=_info,$@1investor_funds_transfer_date$=_btat,$@1created_at$=_cat,$@1status$=_status,=_action,=_amount") }.Else{ Div(Class: text-center h4 text-muted, Body: "$@1sales$ $@1not_founded$") } diff --git a/ecosystem_apps/token_sale/pages/ts_settings.ptl b/ecosystem_apps/token_sale/pages/ts_settings.ptl index dae7a6dd3..059b056f2 100644 --- a/ecosystem_apps/token_sale/pages/ts_settings.ptl +++ b/ecosystem_apps/token_sale/pages/ts_settings.ptl @@ -1,4 +1,4 @@ -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Token sale"}).Vars("app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Token sale"}).Vars(app) SetVar(this_page, "ts_settings").(role_admin,0).(role_manager,0).(role_seller,0).(role_snapswap,0) SetVar(role_admin, AppParam(App: #app_id#, Name: "ts_role_sale_admin")) @@ -6,7 +6,7 @@ SetVar(role_manager, AppParam(App: #app_id#, Name: "ts_role_sale_manager")) SetVar(role_seller, AppParam(App: #app_id#, Name: "ts_role_sale_seller")) SetVar(role_snapswap, AppParam(App: #app_id#, Name: "ts_role_snapswap")) -DBFind("@1roles", src_roles).Where({"ecosystem": #ecosystem_id#, "deleted": 0}).Columns("role_name,id").Limit(100) +DBFind("@1roles", src_roles).Where({"ecosystem": "#ecosystem_id#", "deleted": 0}).Columns("role_name,id").Limit(100) SetVar(row,"row mt-sm").(col_left,"col-sm-4 text-right mt-sm").(col_right,"col-sm-8 text-left") @@ -32,7 +32,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#role_admin# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #role_admin#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#role_admin#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# @@ -50,7 +50,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#role_manager# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #role_manager#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#role_manager#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# @@ -68,7 +68,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#role_seller# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #role_seller#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#role_seller#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# @@ -86,7 +86,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#role_snapswap# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #role_snapswap#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#role_snapswap#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# diff --git a/ecosystem_apps/token_sale/pages/ts_transfer_manager.ptl b/ecosystem_apps/token_sale/pages/ts_transfer_manager.ptl index e1014715e..f6874e666 100644 --- a/ecosystem_apps/token_sale/pages/ts_transfer_manager.ptl +++ b/ecosystem_apps/token_sale/pages/ts_transfer_manager.ptl @@ -1,4 +1,4 @@ -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Token sale"}).Vars("app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Token sale"}).Vars(app) SetVar(this_page, "ts_transfer_manager") SetVar(role_param, "ts_role_sale_manager") @@ -6,21 +6,21 @@ SetVar(needed_role_id, AppParam(App: #app_id#, Name: #role_param#)) SetVar(isStartProcessing, 0) If(#notific_id# > 0){ - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "id": #notific_id#}).Columns("page_params->sale_id,date_start_processing,notification->type,processing_info->member_id,closed").Vars(note) + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "id": "#notific_id#"}).Columns("page_params->sale_id,date_start_processing,notification->type,processing_info->account,closed").Vars(note) If(#note_date_start_processing# > 0){ SetVar(isStartProcessing, 1) } }.ElseIf(#SaleId# != ""){ - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "page_params->sale_id": #SaleId#, "closed": 0}).Columns("page_params->sale_id,date_start_processing,notification->type,processing_info->member_id,id").Vars(note) + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "page_params->sale_id": "#SaleId#", "closed": 0}).Columns("page_params->sale_id,date_start_processing,notification->type,processing_info->account,id").Vars(note) SetVar(notific_id, #note_id#) If(#note_date_start_processing# > 0){ SetVar(isStartProcessing, 1) } } -SetVar(sale_id,0) +SetVar(sale_id, 0) If(#note_page_params_sale_id# > 0){ - DBFind(@1ts_sales).Where({"id": #note_page_params_sale_id#}).Vars(sale) - DBFind(@1ts_wallets).Where({"key_id_buyer": #sale_key_id_buyer#}).Vars(wallet) + DBFind("@1ts_sales").Where({"id": "#note_page_params_sale_id#"}).Vars(sale) + DBFind("@1ts_wallets").Where({"buyer_account": "#sale_buyer_account#"}).Vars(wallet) } Div(content-wrapper){ @@ -34,11 +34,11 @@ Div(content-wrapper){ Div(list-group-item){ Div(row mt-sm){ Div(col-sm-3 text-right text-bold){ - $@1key_id_investor$ + $@1investor$ } Div(col-sm-9 text-left){ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#sale_key_id_buyer#"){ - Address(#sale_key_id_buyer#) + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#sale_buyer_account#"){ + #sale_buyer_account# } } } @@ -95,13 +95,13 @@ Div(content-wrapper){ $@1created_by$ } Div(col-sm-9 text-left){ - Address(#sale_key_id_sale_apl_admin#) + #sale_sale_apl_admin# } } } If(#sale_status# == 1){ Div(list-group-item){ - If(And(#note_processing_info_member_id# == #key_id#, #isStartProcessing# == 1)){ + If(And(#note_processing_info_account# == #account_id#, #isStartProcessing# == 1)){ Button(Body: $@1reject$, Class: btn btn-default, Page: ts_transfer_reject, PageParams: "RoleParam=#role_param#,notific_id=#notific_id#,back_page=#this_page#").Popup(50,"Rejected comment") Button(Body: $@1accept$, Class: btn btn-primary pull-right, Page: ts_sales, Contract: TsTransferManager, Params: "SaleId=#sale_id#,NotificId=#notific_id#") }.ElseIf(#isStartProcessing# == 1){ @@ -119,7 +119,7 @@ Div(content-wrapper){ Div(list-group-item text-center h4){ If(#needed_role_id# > 0){ If(#needed_role_id# != #role_id#){ - DBFind(@1parameters).Where({"ecosystem": #ecosystem_id#, "name": #role_param#}).Vars(param) + DBFind("@1parameters").Where({"ecosystem": "#ecosystem_id#", "name": "#role_param#"}).Vars(param) Div(h4){ This page only for role from parameter LinkPage(Page: @1params_edit, PageParams: "id=#param_id#,back_page=#this_page#", Body: #role_param#) } diff --git a/ecosystem_apps/token_sale/pages/ts_transfer_reject.ptl b/ecosystem_apps/token_sale/pages/ts_transfer_reject.ptl index 779ad6780..2781ba2ea 100644 --- a/ecosystem_apps/token_sale/pages/ts_transfer_reject.ptl +++ b/ecosystem_apps/token_sale/pages/ts_transfer_reject.ptl @@ -1,14 +1,14 @@ -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Token sale"}).Vars("app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Token sale"}).Vars(app) SetVar(needed_role_id, 0) If(#RoleParam# != ""){ SetVar(needed_role_id, AppParam(App: #app_id#, Name: #RoleParam#)) } If(#notific_id# != ""){ - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "id": #notific_id#}).Columns("page_params->sale_id").Vars(note) + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "id": "#notific_id#"}).Columns("page_params->sale_id").Vars(note) } SetVar(sale_id, 0) If(#note_page_params_sale_id# > 0){ - DBFind(@1ts_sales).Where({"id": #note_page_params_sale_id#}).Vars(sale) + DBFind("@1ts_sales").Where({"id": "#note_page_params_sale_id#"}).Vars(sale) } Form(){ diff --git a/ecosystem_apps/token_sale/pages/ts_transfer_seller.ptl b/ecosystem_apps/token_sale/pages/ts_transfer_seller.ptl index 34010be7e..af29334eb 100644 --- a/ecosystem_apps/token_sale/pages/ts_transfer_seller.ptl +++ b/ecosystem_apps/token_sale/pages/ts_transfer_seller.ptl @@ -1,4 +1,4 @@ -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Token sale"}).Vars("app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Token sale"}).Vars(app) SetVar(this_page, "ts_transfer_seller") SetVar(role_param, "ts_role_sale_seller") @@ -7,12 +7,12 @@ SetVar(needed_role_id, AppParam(App: #app_id#, Name: #role_param#)) AppParam(App:#app_id#, Name:ts_currency_type, Ecosystem: #ecosystem_id#, Source:currency_type) SetVar(isStartProcessing, 0) If(#notific_id# > 0){ - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "id": #notific_id#}).Columns("page_params->sale_id,date_start_processing,notification->type,processing_info->member_id,closed").Vars(note) + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "id": "#notific_id#"}).Columns("page_params->sale_id,date_start_processing,notification->type,processing_info->account,closed").Vars(note) If(#note_date_start_processing# > 0){ SetVar(isStartProcessing, 1) } -}.ElseIf(#SaleId#!=""){ - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "page_params->sale_id": #SaleId#, "closed": 0}).Columns("page_params->sale_id,date_start_processing,notification->type,processing_info->member_id,closed").Vars(note) +}.ElseIf(#SaleId# != ""){ + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "page_params->sale_id": "#SaleId#", "closed": 0}).Columns("page_params->sale_id,date_start_processing,notification->type,processing_info->account,closed").Vars(note) SetVar(notific_id,#note_id#) If(#note_date_start_processing# > 0){ SetVar(isStartProcessing, 1) @@ -20,8 +20,8 @@ If(#notific_id# > 0){ } SetVar(sale_id,0) If(#note_page_params_sale_id# > 0){ - DBFind(@1ts_sales).Where({"id": #note_page_params_sale_id#}).Vars(sale) - DBFind(@1ts_wallets).Where({"key_id_buyer": #sale_key_id_buyer#}).Vars(wallet) + DBFind("@1ts_sales").Where({"id": "#note_page_params_sale_id#"}).Vars(sale) + DBFind("@1ts_wallets").Where({"buyer_account": "#sale_buyer_account#"}).Vars(wallet) } Div(content-wrapper){ @@ -35,11 +35,11 @@ Div(content-wrapper){ Div(list-group-item){ Div(row mt-sm){ Div(col-sm-3 text-right text-bold){ - $@1key_id_investor$ + $@1investor$ } Div(col-sm-9 text-left){ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#sale_key_id_buyer#"){ - Address(#sale_key_id_buyer#) + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#sale_buyer_account#"){ + #sale_buyer_account# } } } @@ -96,7 +96,7 @@ Div(content-wrapper){ $@1created_by$ } Div(col-sm-9 text-left){ - Address(#sale_key_id_sale_apl_admin#) + #sale_sale_apl_admin# } } Div(row text-muted){ @@ -104,13 +104,13 @@ Div(content-wrapper){ $@1checked_by$ } Div(col-sm-9 text-left){ - Address(#sale_key_id_sale_apl_manager#) + #sale_sale_apl_manager# } } } If(#sale_status# == 2){ Div(list-group-item){ - If(And(#note_processing_info_member_id# == #key_id#, #isStartProcessing# == 1)){ + If(And(#note_processing_info_account# == #account_id#, #isStartProcessing# == 1)){ Button(Body: $@1reject$, Class: btn btn-default, Page: ts_transfer_reject, PageParams: "RoleParam=#role_param#,notific_id=#notific_id#,back_page=#this_page#").Popup(50,"Rejected comment") Button(Body: $@1accept$, Class: btn btn-primary pull-right, Page: ts_sales, Contract: TsTransferSeller, Params: "SaleId=#sale_id#,NotificId=#notific_id#") }.ElseIf(#isStartProcessing# == 1){ @@ -128,7 +128,7 @@ Div(content-wrapper){ Div(panel-body){ If(#needed_role_id# > 0){ If(#needed_role_id# != #role_id#){ - DBFind(@1parameters).Where({"ecosystem": #ecosystem_id#, "name": #role_param#}).Vars(param) + DBFind("@1parameters").Where({"ecosystem": "#ecosystem_id#", "name": "#role_param#"}).Vars(param) Div(h4){ This page only for role from parameter LinkPage(Page: @1params_edit, PageParams: "id=#param_id#,back_page=#this_page#", Body:#role_param#) } diff --git a/ecosystem_apps/token_sale/pages/ts_transfer_view.ptl b/ecosystem_apps/token_sale/pages/ts_transfer_view.ptl index b80af76ef..3d56d7053 100644 --- a/ecosystem_apps/token_sale/pages/ts_transfer_view.ptl +++ b/ecosystem_apps/token_sale/pages/ts_transfer_view.ptl @@ -3,17 +3,17 @@ If(#back_page# == ""){ SetVar(back_page, @1ts_sales) } If(#Id#){ - DBFind(@1ts_sales).Where({"id": #Id#}).Vars(sale) + DBFind("@1ts_sales").Where({"id": "#Id#"}).Vars(sale) } If(#sale_id# > 0){ Div(#row#){ Div(#col_left#){ - $@1key_id_investor$ + $@1investor$ } Div(#col_right#){ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#sale_key_id_buyer#"){ - Address(#sale_key_id_buyer#) + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#sale_buyer_account#"){ + #sale_buyer_account# } } } @@ -27,19 +27,19 @@ If(#sale_id# > 0){ } Div(#row#){ Div(#col_left#){ - $@1key_id_sale_apl_admin$ + $@1sale_apl_admin$ } Div(#col_right#){ - Address(#sale_key_id_sale_apl_admin#) (#sale_key_id_sale_apl_admin#) + #sale_sale_apl_admin# } } - If(#sale_key_id_sale_apl_manager# != 0){ + If(#sale_sale_apl_manager# != 0){ Div(#row#){ Div(#col_left#){ - $@1key_id_sale_apl_manager$ + $@1sale_apl_manager$ } Div(#col_right#){ - Address(#sale_key_id_sale_apl_manager#) (#sale_key_id_sale_apl_manager#) + #sale_sale_apl_manager# } } If(#sale_manager_rejected_at# > 0){ @@ -62,13 +62,13 @@ If(#sale_id# > 0){ } } } - If(#sale_key_id_seller# != 0){ + If(#sale_seller_account# != 0){ Div(#row#){ Div(#col_left#){ - $@1key_id_seller$ + $@1token_seller$ } Div(#col_right#){ - Address(#sale_key_id_seller#) (#sale_key_id_seller#) + #sale_seller_account# } } If(#sale_seller_rejected_at# > 0){ diff --git a/ecosystem_apps/token_sale/pages/ts_wallets.ptl b/ecosystem_apps/token_sale/pages/ts_wallets.ptl index 9763b3237..e39feeea6 100644 --- a/ecosystem_apps/token_sale/pages/ts_wallets.ptl +++ b/ecosystem_apps/token_sale/pages/ts_wallets.ptl @@ -2,16 +2,16 @@ SetVar(this_page, @1ts_wallets).(this_table, @1ts_wallets) Include(@1pager_header) SetTitle("$@1ts_wallets$") -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Token sale"}).Vars("app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Token sale"}).Vars(app) SetVar(snapswap_role_id, AppParam(App: #app_id#, Name: "ts_role_snapswap")) If(And(#snapswap_role_id# > 0, #role_id# == #snapswap_role_id#)){ AddToolButton(Title:$@1ts_add_public_key$, Page: @1ts_key_approve, Icon: icon-wallet).Popup(Header: $@1ts_add_public_key$, Width: "50") } If(#search#){ - SetVar(where, {"$and": [{"key_id_buyer": {"$neq": 0}}, {"$or":[{"pub_buyer": {"$ilike": "#search#"}}, {"wallet_btc": {"$ilike": "#search#"}}, {"wallet_eth": {"$ilike": "#search#"}}]}]}) + SetVar(where, {"$and": [{"buyer_account": {"$neq": 0}}, {"$or":[{"pub_buyer": {"$ilike": "#search#"}}, {"wallet_btc": {"$ilike": "#search#"}}, {"wallet_eth": {"$ilike": "#search#"}}]}]}) }.Else{ - SetVar(where, {"key_id_buyer": {"$neq": 0}}) + SetVar(where, {"buyer_account": {"$neq": 0}}) } Div(list-group-item ml-lg mr-lg pt-lg){ @@ -19,7 +19,7 @@ Div(list-group-item ml-lg mr-lg pt-lg){ Include(@1search) } -DBFind(#this_table#, src).Where(#where#).Order({"id": -1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_rat){ +DBFind(#this_table#, src).Where(#where#).Order({"id": "-1"}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_rat){ If(#rejected_at#>0){ DateTime(#rejected_at#, Format: YYYY-MM-DD HH:MI:SS) }.Else{ @@ -34,16 +34,16 @@ DBFind(#this_table#, src).Where(#where#).Order({"id": -1}).Limit(#pager_limit#). Span(Class:text-muted, Body:DateTime(#created_at#, Format: YYYY-MM-DD HH:MI:SS)) } }.Custom(_buyer){ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#key_id_buyer#"){ - Address(#key_id_buyer#) + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#buyer_account#"){ + #buyer_account# } Div(){ Span(Class: h6 text-muted, Body: PUB:) Span(Class: h6 text-muted ml-sm, Body: #pub_short_buyer#) } }.Custom(_signer){ - If(#key_id_signer#!=0){ - Span(Class:text-success, Body: Address(#key_id_signer#)) + If(#signer_account# != 0){ + Span(Class:text-success, Body: #signer_account#) } }.Custom(_wlts){ Div(){ @@ -60,7 +60,7 @@ Div(fullscreen){ Div(table-responsive ml-lg mr-lg){ Div(list-group-item){ If(#count# > 0){ - Table(src, "$@1id$=id,$@1key_id_investor$=_buyer,$@1wallets$=_wlts,$@1created_at$=_cat,$@1signed_at$=_sat,$@1rejected_at$=_rat,$@1key_id_consensus$=_signer") + Table(src, "$@1id$=id,$@1investor$=_buyer,$@1wallets$=_wlts,$@1created_at$=_cat,$@1signed_at$=_sat,$@1rejected_at$=_rat,$@1signer_consensus$=_signer") }.Else{ Div(Class: text-center h4 text-muted, Body: "$@1wallets$ $@1not_founded$") } diff --git a/ecosystem_apps/token_sale/struct.dot b/ecosystem_apps/token_sale/struct.dot index 09fcbc05b..848902cb4 100644 --- a/ecosystem_apps/token_sale/struct.dot +++ b/ecosystem_apps/token_sale/struct.dot @@ -23,11 +23,11 @@ size="30"; "ts_buyer_contract\npage" [color=green, fontcolor=green, group=pages, shape=record]; "ts_commercial_terms\npage" -> "default_page\npage" [ color=green ] "ts_commercial_terms\npage" [color=green, fontcolor=green, group=pages, shape=record]; -"ts_consensus_contract\npage" -> "TsConsensusAction\ncontract" [ color=red ] -"ts_consensus_contract\npage" -> "@1NotificationsProcess\ncontract" [ color=red ] -"1notifications\ntable" -> "ts_consensus_contract\npage" -"1ts_wallets\ntable" -> "ts_consensus_contract\npage" -"ts_consensus_contract\npage" [color=green, fontcolor=green, group=pages, shape=record]; +"ts_consortium_member_contract\npage" -> "TsConsortiumMemberAction\ncontract" [ color=red ] +"ts_consortium_member_contract\npage" -> "@1NotificationsProcess\ncontract" [ color=red ] +"1notifications\ntable" -> "ts_consortium_member_contract\npage" +"1ts_wallets\ntable" -> "ts_consortium_member_contract\npage" +"ts_consortium_member_contract\npage" [color=green, fontcolor=green, group=pages, shape=record]; "ts_free_wallet_add\npage" -> "@1TsFreeWalletAdd\ncontract" [ color=red ] "ts_free_wallet_add\npage" [color=green, fontcolor=green, group=pages, shape=record]; "ts_free_wallets\npage" -> "@1TsFreeWalletDelete\ncontract" [ color=red ] @@ -100,9 +100,9 @@ size="30"; "1applications\ntable" -> "TsBuyerAction\ncontract" "1notifications\ntable" -> "TsBuyerAction\ncontract" "TsBuyerAction\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; -"TsConsensusAction\ncontract" -> "ts_wallets\ntable" [ color="" ] -"1applications\ntable" -> "TsConsensusAction\ncontract" -"TsConsensusAction\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; +"TsConsortiumMemberAction\ncontract" -> "ts_wallets\ntable" [ color="" ] +"1applications\ntable" -> "TsConsortiumMemberAction\ncontract" +"TsConsortiumMemberAction\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; "TsFreeWalletAdd\ncontract" -> "ts_wallets\ntable" [ color="" ] "1applications\ntable" -> "TsFreeWalletAdd\ncontract" "1roles\ntable" -> "TsFreeWalletAdd\ncontract" diff --git a/ecosystem_apps/token_sale/tables/ts_sales.json b/ecosystem_apps/token_sale/tables/ts_sales.json index 157970c6c..ae4c27bb1 100644 --- a/ecosystem_apps/token_sale/tables/ts_sales.json +++ b/ecosystem_apps/token_sale/tables/ts_sales.json @@ -36,8 +36,8 @@ }, { "conditions": "ContractAccess(\"@1TsTransferReject\",\"@1TsTransferSeller\")", - "name": "key_id_seller", - "type": "number" + "name": "seller_account", + "type": "varchar" }, { "conditions": "ContractAccess(\"@1TsTransferReject\")", @@ -46,8 +46,8 @@ }, { "conditions": "false", - "name": "key_id_sale_apl_admin", - "type": "number" + "name": "sale_apl_admin", + "type": "varchar" }, { "conditions": "ContractAccess(\"@1TsTransferReject\")", @@ -56,8 +56,8 @@ }, { "conditions": "ContractAccess(\"@1TsTransferReject\",\"@1TsTransferManager\")", - "name": "key_id_sale_apl_manager", - "type": "number" + "name": "sale_apl_manager", + "type": "varchar" }, { "conditions": "false", @@ -66,8 +66,8 @@ }, { "conditions": "false", - "name": "key_id_buyer", - "type": "number" + "name": "buyer_account", + "type": "varchar" }, { "conditions": "ContractAccess(\"@1TsTransferReject\",\"@1TsTransferManager\",\"@1TsTransferAdmin\",\"@1TsTransferSeller\")", diff --git a/ecosystem_apps/token_sale/tables/ts_wallets.json b/ecosystem_apps/token_sale/tables/ts_wallets.json index e8832da8d..5778831ec 100644 --- a/ecosystem_apps/token_sale/tables/ts_wallets.json +++ b/ecosystem_apps/token_sale/tables/ts_wallets.json @@ -1,38 +1,38 @@ [ { - "conditions":"ContractAccess(\"@1TsBuyerAction\",\"@1TsConsensusAction\")", - "name":"rejected_at", - "type":"number" + "conditions": "ContractAccess(\"@1TsBuyerAction\",\"@1TsConsortiumMemberAction\")", + "name": "rejected_at", + "type": "number" }, { - "conditions":"ContractAccess(\"@1TsKeyApprove\")", - "name":"key_id_buyer", - "type":"number" + "conditions": "ContractAccess(\"@1TsKeyApprove\")", + "name": "buyer_account", + "type": "varchar" }, { - "conditions":"ContractAccess(\"@1TsConsensusAction\")", - "name":"key_id_signer", - "type":"number" + "conditions": "ContractAccess(\"@1TsConsortiumMemberAction\")", + "name": "signer_account", + "type": "varchar" }, { - "conditions":"false", - "name":"btc", - "type":"money" + "conditions": "false", + "name": "btc", + "type": "money" }, { - "conditions":"false", - "name":"eth", - "type":"money" + "conditions": "false", + "name": "eth", + "type": "money" }, { - "conditions":"ContractAccess(\"@1TsBuyerAction\")", - "name":"signed_at", - "type":"number" + "conditions": "ContractAccess(\"@1TsBuyerAction\")", + "name": "signed_at", + "type": "number" }, { - "conditions":"ContractAccess(\"@1TsKeyApprove\")", - "name":"created_at", - "type":"number" + "conditions": "ContractAccess(\"@1TsKeyApprove\")", + "name": "created_at", + "type": "number" }, { "conditions": "false", @@ -45,17 +45,17 @@ "type": "text" }, { - "conditions":"ContractAccess(\"@1TsFreeWalletDelete\")", - "name":"deleted", - "type":"number" + "conditions": "ContractAccess(\"@1TsFreeWalletDelete\")", + "name": "deleted", + "type": "number" }, { - "conditions":"ContractAccess(\"@1TsKeyApprove\")", + "conditions": "ContractAccess(\"@1TsKeyApprove\")", "name": "pub_buyer", "type": "text" }, { - "conditions":"ContractAccess(\"@1TsKeyApprove\")", + "conditions": "ContractAccess(\"@1TsKeyApprove\")", "name": "pub_short_buyer", "type": "text" } diff --git a/lang_res.json b/lang_res.json index 0bab33e8d..d3ade8990 100644 --- a/lang_res.json +++ b/lang_res.json @@ -37,6 +37,11 @@ "Trans": "{\"en\": \"Account\", \"ru\": \"Счёт\"}", "Type": "languages" }, + { + "Name": "account_not_found", + "Trans": "{\"en\": \"The account is not found\", \"ru\": \"Указанный аккаунт не найден\"}", + "Type": "languages" + }, { "Name": "accounts", "Trans": "{\"en\": \"Accounts\", \"ru\": \"Счета\"}", @@ -358,8 +363,8 @@ "Type": "languages" }, { - "Name": "attacker_key_invalid", - "Trans": "{\"en\": \"The specified attacker key is not valid\", \"ru\": \"Ключ злоумышленника задан неверно\"}", + "Name": "attacker_wallet_invalid", + "Trans": "{\"en\": \"The specified attacker wallet is not valid\", \"ru\": \"Кошелёк злоумышленника задан неверно\"}", "Type": "languages" }, { @@ -367,11 +372,6 @@ "Trans": "{\"en\": \"ATTENTION! This page has not received the required parameters and is unavailable\", \"ru\": \"ВНИМАНИЕ! Эта страница не получила необходимых параметров и недоступна для просмотра\"}", "Type": "languages" }, - { - "Name": "attention_not_validator", - "Trans": "{\"en\": \"You are not a member of the Validator role\", \"ru\": \"Вы не принадлежите к роли Validator\"}", - "Type": "languages" - }, { "Name": "attorney", "Trans": "{\"en\": \"Attorney\", \"ru\": \"Доверенное лицо\"}", @@ -458,13 +458,13 @@ "Type": "languages" }, { - "Name": "block_history", - "Trans": "{\"en\": \"Block history\", \"ru\": \"История блока\"}", + "Name": "block_account", + "Trans": "{\"en\": \"Block\", \"ru\": \"Заблокировать\"}", "Type": "languages" }, { - "Name": "block_key", - "Trans": "{\"en\": \"Block\", \"ru\": \"Заблокировать\"}", + "Name": "block_history", + "Trans": "{\"en\": \"Block history\", \"ru\": \"История блока\"}", "Type": "languages" }, { @@ -537,16 +537,6 @@ "Trans": "{\"en\": \"This candidate was already added\", \"ru\": \"Этот кандидат был добавлен ранее\"}", "Type": "languages" }, - { - "Name": "candidate_already_validator", - "Trans": "{\"en\": \"This candidate is already a member of the Validator role\", \"ru\": \"Кандидат уже является членом роли Validator\"}", - "Type": "languages" - }, - { - "Name": "candidate_key_not_found", - "Trans": "{\"en\": \"The candidate key ID is not found\", \"ru\": \"Идентификатор ключа кандидата не найден\"}", - "Type": "languages" - }, { "Name": "candidate_manual", "Trans": "{\"en\": \"Candidate (manual registration)\", \"ru\": \"Кандидат (регистрация вручную)\"}", @@ -812,6 +802,51 @@ "Trans": "{\"en\": \"Congratulations\", \"ru\": \"Поздравление\"}", "Type": "languages" }, + { + "Name": "consortium_member", + "Trans": "{\"en\": \"Consortium Member\", \"ru\": \"Член роли Consortium Member\"}", + "Type": "languages" + }, + { + "Name": "consortium_member_candidates", + "Trans": "{\"en\": \"Consortium Member Candidates\", \"ru\": \"Кандидаты на роль Consortium Member\"}", + "Type": "languages" + }, + { + "Name": "consortium_member_candidates_list_desc", + "Trans": "{\"en\": \"This page is used to create and manage requests for the Consortium Member role\", \"ru\": \"Эта страница используется для создания и управления запросами кандидатов на роль Consortium Member\"}", + "Type": "languages" + }, + { + "Name": "consortium_member_removing_desc", + "Trans": "{\"en\": \"You are Consortium Member. You can remove the entry about your node and resign from the Consortium Member role at any time\", \"ru\": \"Вы являетесь членом роли Consortium Member. В любой момент вы можете удалить запись о своем узле и уйти с роли Consortium Member\"}", + "Type": "languages" + }, + { + "Name": "consortium_member_request_form", + "Trans": "{\"en\": \"Consortium Member candidate request form\", \"ru\": \"Форма запроса кандидата на роль Consortium Member\"}", + "Type": "languages" + }, + { + "Name": "consortium_member_resign", + "Trans": "{\"en\": \"Consortium Member resignation\", \"ru\": \"Отставка члена роли Consortium Member\"}", + "Type": "languages" + }, + { + "Name": "consortium_member_role_not_found", + "Trans": "{\"en\": \"Consortium Member role is not found\", \"ru\": \"Роль Consortium Member не найдена\"}", + "Type": "languages" + }, + { + "Name": "consortium_members", + "Trans": "{\"en\": \"Consortium Members\", \"ru\": \"Члены роли Consortium Member\"}", + "Type": "languages" + }, + { + "Name": "consortium_members_only", + "Trans": "{\"en\": \"You are not a member of the Consortium Member role. You cannot execute this\", \"ru\": \"Вашему аккаунту не присвоена роль Consortium Member. Вы не можете запустить это\"}", + "Type": "languages" + }, { "Name": "contract", "Trans": "{\"en\": \"Contract\", \"ru\": \"Контракт\"}", @@ -872,6 +907,11 @@ "Trans": "{\"en\": \"This contract can be executed only from the first ecosystem\", \"ru\": \"Этот контракт может быть запущен только из первой экосистемы\"}", "Type": "languages" }, + { + "Name": "contract_hash_list_outside", + "Trans": "{\"en\": \"Contracts Hash List\", \"ru\": \"Список хэшей контрактов\"}\n", + "Type": "languages" + }, { "Name": "contract_history", "Trans": "{\"en\": \"Contract history\", \"ru\": \"История контракта\"}", @@ -1487,6 +1527,11 @@ "Trans": "{\"en\": \"File\", \"ru\": \"Файл\"}", "Type": "languages" }, + { + "Name": "file_not_selected", + "Trans": "{\"en\": \"File not selected\", \"ru\": \"Файл не выбран\"}", + "Type": "languages" + }, { "Name": "filled", "Trans": "{\"en\": \"Filled\", \"ru\": \"Заполнено\"}", @@ -1632,6 +1677,11 @@ "Trans": "{\"en\": \"Нardware description\", \"ru\": \"Описание оборудования\"}", "Type": "languages" }, + { + "Name": "hash_list_outside", + "Trans": "{\"en\": \"Hash list\", \"ru\": \"Список хэшей\"}\n", + "Type": "languages" + }, { "Name": "header", "Trans": "{\"en\": \"Header\", \"ru\": \"Заголовок\"}", @@ -1817,6 +1867,11 @@ "Trans": "{\"en\": \"Investment amount\", \"ru\": \"Сумма инвестиций\"}", "Type": "languages" }, + { + "Name": "investor", + "Trans": "{\"en\": \"Investor\", \"ru\": \"Инвестор\"}", + "Type": "languages" + }, { "Name": "investor_added_already", "Trans": "{\"en\": \"This investor was already added\", \"ru\": \"Этот инвестор уже добавлен\"}", @@ -1869,7 +1924,7 @@ }, { "Name": "join_the_group", - "Trans": "{\"en\": \"Join the group\", \"ru\": \"Присоеденится к группе\"}", + "Trans": "{\"en\": \"Join the group\", \"ru\": \"Присоединиться к группе\"}", "Type": "languages" }, { @@ -1877,51 +1932,6 @@ "Trans": "{\"en\": \"This key was already added\", \"ru\": \"Этот ключ уже добавлен\"}", "Type": "languages" }, - { - "Name": "key_already_exists", - "Trans": "{\"en\":\"This key already exists\",\"ru\":\"Данный ключ уже существует\"}", - "Type": "languages" - }, - { - "Name": "key_id", - "Trans": "{\"en\": \"ID\", \"ru\": \"Идентификатор\"}", - "Type": "languages" - }, - { - "Name": "key_id_consensus", - "Trans": "{\"en\": \"Signer consensus\", \"ru\": \"Подпись консенсуса\"}", - "Type": "languages" - }, - { - "Name": "key_id_investor", - "Trans": "{\"en\": \"Investor\", \"ru\": \"Инвестор\"}", - "Type": "languages" - }, - { - "Name": "key_id_or_wallet", - "Trans": "{\"en\": \"Key ID or wallet\", \"ru\": \"Идентификатор ключа или адрес кошелька\"}", - "Type": "languages" - }, - { - "Name": "key_id_sale_apl_admin", - "Trans": "{\"en\": \"Token sale admin\", \"ru\": \"Администратор продажи токенов\"}", - "Type": "languages" - }, - { - "Name": "key_id_sale_apl_manager", - "Trans": "{\"en\": \"Token sale manager\", \"ru\": \"Менеджер продажи токенов\"}", - "Type": "languages" - }, - { - "Name": "key_id_seller", - "Trans": "{\"en\": \"Token seller\", \"ru\": \"Продавец токенов\"}", - "Type": "languages" - }, - { - "Name": "key_not_found", - "Trans": "{\"en\": \"The key ID is not found\", \"ru\": \"Идентификатор ключа не найден\"}", - "Type": "languages" - }, { "Name": "key_too_long", "Trans": "{\"en\":\"The key is too long\",\"ru\":\"Длина ключа превышает необходимую\"}", @@ -2257,6 +2267,11 @@ "Trans": "{\"en\": \"Middle name\", \"ru\": \"Отчество\"}", "Type": "languages" }, + { + "Name": "network_list_outside", + "Trans": "{\"en\": \"Network list\", \"ru\": \"Список сетей\"}\n", + "Type": "languages" + }, { "Name": "new_app", "Trans": "{\"en\": \"New application\", \"ru\": \"Новое приложение\"}", @@ -2347,9 +2362,14 @@ "Trans": "{\"en\": \"No expiration\", \"ru\": \"Без истечения\"}", "Type": "languages" }, + { + "Name": "node_founder_account", + "Trans": "{\"en\": \"Node founder account\", \"ru\": \"Адрес кошелька основателя узла\"}", + "Type": "languages" + }, { "Name": "node_founder_key_id", - "Trans": "{\"en\": \"Key ID of the node founder\", \"ru\": \"Идентификатор ключа основателя узла\"}", + "Trans": "{\"en\": \"Node founder Key ID\", \"ru\": \"Идентификатор ключа основателя узла\"}", "Type": "languages" }, { @@ -2382,11 +2402,6 @@ "Trans": "{\"en\": \"Not started\", \"ru\": \"Не начата\"}", "Type": "languages" }, - { - "Name": "not_validator_can_not_run", - "Trans": "{\"en\": \"You are not a member of the Validator role. You cannot execute this\", \"ru\": \"Вашему аккаунту не присвоена роль Validator. Вы не можете запустить это\"}", - "Type": "languages" - }, { "Name": "not_voted", "Trans": "{\"en\": \"Not voted\", \"ru\": \"Нет решения\"}", @@ -3097,6 +3112,11 @@ "Trans": "{\"en\": \"You do not have a permission to change the %v role\", \"ru\": \"У вас нет прав доступа на изменение роли %v\"}", "Type": "languages" }, + { + "Name": "role_change_no_view_permission", + "Trans": "{\"en\": \"You do not have permission to view the page\", \"ru\": \"У вас нет прав на просмотр страницы\"}\n", + "Type": "languages" + }, { "Name": "role_created_deleted", "Trans": "{\"en\": \"Created / Deleted\", \"ru\": \"Создана / Удалена\"}", @@ -3252,6 +3272,16 @@ "Trans": "{\"en\": \"The row ID for the value (Example: 14)\", \"ru\": \"Идентификатор строки, в которую будет записано значение (Пример: 14)\"}", "Type": "languages" }, + { + "Name": "sale_apl_admin", + "Trans": "{\"en\": \"Token sale admin\", \"ru\": \"Администратор продажи токенов\"}", + "Type": "languages" + }, + { + "Name": "sale_apl_manager", + "Trans": "{\"en\": \"Token sale manager\", \"ru\": \"Менеджер продажи токенов\"}", + "Type": "languages" + }, { "Name": "sales", "Trans": "{\"en\": \"Sales\", \"ru\": \"Продажи\"}", @@ -3462,6 +3492,11 @@ "Trans": "{\"en\": \"Signed at\", \"ru\": \"Подписано в\"}", "Type": "languages" }, + { + "Name": "signer_consensus", + "Trans": "{\"en\": \"Signer consensus\", \"ru\": \"Подпись консенсуса\"}", + "Type": "languages" + }, { "Name": "single", "Trans": "{\"en\": \"Single\", \"ru\": \"Однократное\"}", @@ -3572,21 +3607,6 @@ "Trans": "{\"en\": \"The suspect address is not valid\", \"ru\": \"Адрес подозреваемого задан неверно\"}", "Type": "languages" }, - { - "Name": "sysparams_candidate_validators_form", - "Trans": "{\"en\": \"Validator role candidate request form\", \"ru\": \"Форма запроса кандидата в валидаторы\"}", - "Type": "languages" - }, - { - "Name": "sysparams_candidates", - "Trans": "{\"en\": \"Candidates for the Validator role\", \"ru\": \"Кандидаты на роль Validator\"}", - "Type": "languages" - }, - { - "Name": "sysparams_candidates_list_desc", - "Trans": "{\"en\": \"This page is used to create and manage requests for the Validator role\", \"ru\": \"Эта страница используется для создания и управления запросами кандидатов на роль Validator\"}", - "Type": "languages" - }, { "Name": "sysparams_list", "Trans": "{\"en\": \"System parameters list\", \"ru\": \"Список системных параметров\"}", @@ -3597,11 +3617,6 @@ "Trans": "{\"en\": \"This page is used to configure the parameters of this ecosystem\", \"ru\": \"Эта страница используется для конфигурации параметров данной экосистемы\"}", "Type": "languages" }, - { - "Name": "sysparams_validator_resign", - "Trans": "{\"en\": \"Validator's resignation\", \"ru\": \"Отставка валидатора\"}", - "Type": "languages" - }, { "Name": "system_param", "Trans": "{\"en\": \"System parameter\", \"ru\": \"Системный параметр\"}", @@ -3847,6 +3862,11 @@ "Trans": "{\"en\": \"Title\", \"ru\": \"Название\"}", "Type": "languages" }, + { + "Name": "token_seller", + "Trans": "{\"en\": \"Token seller\", \"ru\": \"Продавец токенов\"}", + "Type": "languages" + }, { "Name": "tokenrefund_result0", "Trans": "{\"en\": \"Discussion and voting\", \"ru\": \"Oбсуждение и голосование\"}", @@ -4113,7 +4133,7 @@ "Type": "languages" }, { - "Name": "unblock_key", + "Name": "unblock_account", "Trans": "{\"en\": \"Unblock\", \"ru\": \"Разблокировать\"}", "Type": "languages" }, @@ -4212,26 +4232,6 @@ "Trans": "{\"en\": \"must be between 40 and 44 characters\", \"ru\": \"должно быть от 40 до 44 символов\"}", "Type": "languages" }, - { - "Name": "validator_removing", - "Trans": "{\"en\": \"Validator removal\", \"ru\": \"Удаление валидатора\"}", - "Type": "languages" - }, - { - "Name": "validator_removing_desc", - "Trans": "{\"en\": \"You are a Validator. You can remove the entry about your node and resign from the Validator role at any time\", \"ru\": \"Вы являетесь Валидатором. В любой момент вы можете удалить запись о своем узле и уйти с роли Валидатор\"}", - "Type": "languages" - }, - { - "Name": "validator_role_not_found", - "Trans": "{\"en\": \"The Validator role is not found\", \"ru\": \"Роль Validator не найдена\"}", - "Type": "languages" - }, - { - "Name": "validators", - "Trans": "{\"en\": \"Validators\", \"ru\": \"Валидаторы\"}", - "Type": "languages" - }, { "Name": "value", "Trans": "{\"en\": \"Value\", \"ru\": \"Значение\"}", @@ -4303,8 +4303,8 @@ "Type": "languages" }, { - "Name": "victim_key_invalid", - "Trans": "{\"en\": \"The victim key is not valid\", \"ru\": \"Ключ пострадавшего задан неверно\"}", + "Name": "victim_wallet_invalid", + "Trans": "{\"en\": \"The victim wallet is not valid\", \"ru\": \"Кошелёк пострадавшего задан неверно\"}", "Type": "languages" }, { @@ -4393,13 +4393,13 @@ "Type": "languages" }, { - "Name": "voting_all_keys_added", - "Trans": "{\"en\": \"All members were added\", \"ru\": \"Все члены были добавлены\"}", + "Name": "voting_all_members", + "Trans": "{\"en\": \"All members were added automatically\", \"ru\": \"Все члены были добавлены автоматически\"}", "Type": "languages" }, { - "Name": "voting_all_members", - "Trans": "{\"en\": \"All members were added automatically\", \"ru\": \"Все члены были добавлены автоматически\"}", + "Name": "voting_all_members_added", + "Trans": "{\"en\": \"All members were added\", \"ru\": \"Все члены были добавлены\"}", "Type": "languages" }, { @@ -4797,6 +4797,11 @@ "Trans": "{\"en\": \"Wallet Address\", \"ru\": \"Адрес кошелька\"}", "Type": "languages" }, + { + "Name": "wallet_already_exists", + "Trans": "{\"en\":\"This wallet already exists\",\"ru\":\"Данный кошелёк уже существует\"}", + "Type": "languages" + }, { "Name": "wallet_btc_exists", "Trans": "{\"en\":\"%s BTC wallet already exists\", \"ru\":\"%s BTC кошелек уже существует\"}", @@ -4848,8 +4853,8 @@ "Type": "languages" }, { - "Name": "want_block_key", - "Trans": "{\"en\": \"Do you want to block this key?\", \"ru\": \"Вы хотите блокировать этот ключ?\"}", + "Name": "want_block_account", + "Trans": "{\"en\": \"Do you want to block this account?\", \"ru\": \"Вы хотите блокировать этот аккаунт?\"}", "Type": "languages" }, { @@ -4888,13 +4893,13 @@ "Type": "languages" }, { - "Name": "want_delete_company", - "Trans": "{\"en\": \"Do you really want to delete the company? All company roles will also be deleted\", \"ru\": \"Вы уверены, что хотите удалить компанию? Все роли компании также будут удалены\"}", + "Name": "want_delete_account", + "Trans": "{\"en\": \"Do you want to delete this account?\", \"ru\": \"Вы хотите удалить этот аккаунт?\"}", "Type": "languages" }, { - "Name": "want_delete_key", - "Trans": "{\"en\": \"Do you want to delete this key?\", \"ru\": \"Вы хотите удалить этот ключ?\"}", + "Name": "want_delete_company", + "Trans": "{\"en\": \"Do you really want to delete the company? All company roles will also be deleted\", \"ru\": \"Вы уверены, что хотите удалить компанию? Все роли компании также будут удалены\"}", "Type": "languages" }, { @@ -4959,7 +4964,7 @@ }, { "Name": "want_resign", - "Trans": "{\"en\": \"Do you really want to resign from the Validator role?\", \"ru\": \"Вы уверены, что хотите уйти с роли Validator?\"}", + "Trans": "{\"en\": \"Do you really want to resign from the Consortium Member role?\", \"ru\": \"Вы уверены, что хотите уйти с роли Consortium Member?\"}", "Type": "languages" }, { @@ -4993,8 +4998,8 @@ "Type": "languages" }, { - "Name": "want_unblock_key", - "Trans": "{\"en\": \"Do you want to unblock this key?\", \"ru\": \"Вы хотите разблокировать этот ключ?\"}", + "Name": "want_unblock_account", + "Trans": "{\"en\": \"Do you want to unblock this account?\", \"ru\": \"Вы хотите разблокировать этот аккаунт?\"}", "Type": "languages" }, { diff --git a/platform_apps/ecosystems_catalog.json b/platform_apps/ecosystems_catalog.json index 7d23520f6..e2dd06e76 100644 --- a/platform_apps/ecosystems_catalog.json +++ b/platform_apps/ecosystems_catalog.json @@ -35,7 +35,7 @@ { "Name": "ec_filter", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1applications).Where({\"ecosystem\": 1, \"name\": \"Ecosystems catalog\"}).Columns(\"name,id\").Vars(application)\nAppParam(Ecosystem: 1, App: #application_id#, Name: ec_type, Source: src_type)\nAppParam(Ecosystem: 1, App: #application_id#, Name: ec_payment, Source: src_payment)\n\nForm(){\n Div(row){\n Div(col-sm-6){\n Div(pull-right){\n Label(Class: m0){\n Span(Body: LangRes(@1catalog_ecosystems_type))\n }\n RadioGroup(Name: Type, Source: src_type, NameColumn: name, ValueColumn: id, Value: #page_par#)\n }\n }\n Div(col-sm-6){\n Label(Class: m0){\n Span(Body: LangRes(@1catalog_ecosystems_payment))\n }\n RadioGroup(Name: Payment, Source: src_payment, NameColumn: name, ValueColumn: id, Value: #sort#)\n }\n }\n Button(Body: LangRes(@1filter), Class: btn btn-primary pull-right, Page: @1ec_list, PageParams: \"sort=Val(Payment),page_par=Val(Type),search=#search#\")\n Button(Body: LangRes(@1clear), Class: btn btn-default pull-right, Page: @1ec_list, PageParams: \"sort=0,page_par=0,search=#search#\")\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Ecosystems catalog\"}).Columns(\"name,id\").Vars(application)\nAppParam(Ecosystem: 1, App: #application_id#, Name: ec_type, Source: src_type)\nAppParam(Ecosystem: 1, App: #application_id#, Name: ec_payment, Source: src_payment)\n\nForm(){\n Div(row){\n Div(col-sm-6){\n Div(pull-right){\n Label(Class: m0){\n Span(Body: LangRes(@1catalog_ecosystems_type))\n }\n RadioGroup(Name: Type, Source: src_type, NameColumn: name, ValueColumn: id, Value: #page_par#)\n }\n }\n Div(col-sm-6){\n Label(Class: m0){\n Span(Body: LangRes(@1catalog_ecosystems_payment))\n }\n RadioGroup(Name: Payment, Source: src_payment, NameColumn: name, ValueColumn: id, Value: #sort#)\n }\n }\n Button(Body: LangRes(@1filter), Class: btn btn-primary pull-right, Page: @1ec_list, PageParams: \"sort=Val(Payment),page_par=Val(Type),search=#search#\")\n Button(Body: LangRes(@1clear), Class: btn btn-default pull-right, Page: @1ec_list, PageParams: \"sort=0,page_par=0,search=#search#\")\n}", "Menu": "default_menu", "Type": "pages" }, @@ -49,14 +49,14 @@ { "Name": "ec_list", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1ec_list).(this_table, @1ecosystems)\nInclude(@1pager_header)\n\nSetTitle(\"$@1catalog_ecosystems$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1catalog_ecosystems_desc$\"))\nIf(#EcosystemId# == \"\"){\n SetVar(EcosystemId, #ecosystem_id#)\n}\nAddToolButton(Title: $@1catalog_ecosystems_manage_button$, Page: @1select_ecosystem, Icon: \"icon-settings\", PageParams: \"back_page=@1ec_manage,go_home=1,back_header=$@1catalog_ecosystems_editing$,EcosystemId=#EcosystemId#,Type=ONLY_MY\").Popup(Header: $@1ecosystem_select$, Width: \"40\")\nAddToolButton(Title: $@1create$, Page: @1ec_new, Icon: icon-plus).Popup(Header: $@1create$, Width: \"30\")\n\nIf(#sort#){\n If(#sort#==1){\n SetVar(payment_filter, {\"info->payment\":1})\n }.ElseIf(#sort#==2){\n SetVar(payment_filter, {\"info->payment\":2})\n }\n}.Else{\n SetVar(sort, \"0\")\n}\n\nIf(#page_par#){\n If(#page_par#==1){\n SetVar(type_filter, {\"info->type\":1})\n }.ElseIf(#page_par#==2){\n SetVar(type_filter, {\"info->type\":2})\n }.ElseIf(#page_par#==3){\n SetVar(type_filter, {\"info->type\":3})\n }\n}.Else{\n SetVar(page_par, \"0\")\n}\n\nIf(#search#){\n SetVar(where, {\"$and\": [{\"info->visibility\": 2}, #payment_filter#, #type_filter#, {\"name\": {\"$ilike\": \"#search#\"}}]})\n}.Else{\n SetVar(where, {\"$and\": [{\"info->visibility\": 2}, #payment_filter#, #type_filter#]})\n}\n\nDiv(mr-lg text-right){\n Button(Page: @1ec_filter, Class: btn bg-gray-lighter mr-sm, PageParams: \"sort=#sort#,page_par=#page_par#,search=#search#,current_page=#current_page#\", Body: Em(Class: fa fa-filter) $@1filter$).Popup(Header: $@1filter$, Width: \"30\")\n If(Or(#page_par#>0,#sort#>0)){\n Button(Page: #this_page#, PageParams: \"sort=0,page_par=0,search=#search#\", Class: btn bg-gray-lighter mr-sm, Body: Em(Class: fa fa-close))\n }\n}.Style(margin-top: -28px; z-index: 1001;)\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1ecosystem))\n Include(@1search)\n}\n\nDBFind(@1applications).Where({\"ecosystem\": 1, \"name\": \"Ecosystems catalog\"}).Columns(\"name,id\").Vars(application)\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,name,info->type,info->payment,info->logo\").Custom(name_link){\n\n Button(Class: btn-xs btn-link, Page: @1ec_preview, PageParams: \"view_page_id=#id#,sort=#sort#,page_par=#page_par#,search=#search#,current_page=#current_page#\"){\n Div(){\n Div(text-right){\n If(#info.logo#>0){\n Image(Src: Binary().ById(#info.logo#)).Style(height: 30px; max-width: 45px;)\n }.Else{\n Span(Class: fa icon-layers fa-2x text-default)\n }\n }.Style(width: 45px;)\n Span(Class: ml h5, Body: #name#)\n }.Style(display:flex; align-items:center;)\n }.Popup(Header: $@1catalog_ecosystems_preview$, Width: \"40\")\n}.Custom(type){\n If(#info.type#==1){\n Em(Class: fa fa-lg fa-users fa-fw mr-sm)\n }.ElseIf(#info.type#==2){\n Em(Class: fa fa-lg fa-handshake-o fa-fw mr-sm)\n }.ElseIf(#info.type#==3){\n Em(Class: fa fa-lg fa-bank fa-fw mr-sm)\n }\n AppParam(Ecosystem: 1, App: #application_id#, Name: ec_type, Index: #info.type#)\n}.Custom(payment){\n If(#info.payment#==1){\n Em(Class: fa fa-lg fa-gift fa-fw)\n }.ElseIf(#info.payment#==2){\n Em(Class: fa fa-lg fa-usd fa-fw)\n }\n AppParam(Ecosystem: 1, App: #application_id#, Name: ec_payment, Index: #info.payment#)\n}.Custom(actions){\n SetVar(ecosystem_member_id,)\n DBFind(@1notifications).Where({\"ecosystem\": #id#, \"sender->member_id\": #key_id#, \"page_params->ecosystem_id\": #id#, closed: 0}).Count(notific_count)\n DBFind(@1keys).Where({\"ecosystem\": #id#, \"id\": #key_id#}).Vars(ecosystem_member)\n DBFind(@1parameters).Where({\"$and\": [{\"ecosystem\": #id#}, {\"$or\": [{\"$and\": [{\"name\": \"founder_account\"},{\"value\": #key_id#}]},{\"$and\": [{\"name\": \"delegate_account\"},{\"value\": #key_id#}]}]}]}).Count(access)\n Div(text-right button-group text-nowrap){\n If(#access#){\n Button(Class: icon-settings btn bg-gray-lighter mh-sm, Page: @1ec_manage, PageParams: \"edit_page_id=#id#,sort=#sort#,page_par=#page_par#,search=#search#,current_page=#current_page#\").Popup(Header: $@1catalog_ecosystems_editing$, Width: \"50\")\n }.ElseIf(And(#notific_count#==0,#ecosystem_member_id#==\"\")){\n Button(Class: btn btn-link, Body: $@1send_request$, Contract: @1MembershipRequest, Page: #this_page#, Params: \"EcosystemId=#id#\")\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1id$=id,$@1ecosystem$=name_link,$@1catalog_ecosystems_type$=type,$@1catalog_ecosystems_payment$=payment,=actions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1ecosystems$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, @1ec_list).(this_table, @1ecosystems)\nInclude(@1pager_header)\n\nSetTitle(\"$@1catalog_ecosystems$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1catalog_ecosystems_desc$\"))\nIf(#EcosystemId# == \"\"){\n SetVar(EcosystemId, #ecosystem_id#)\n}\nAddToolButton(Title: $@1catalog_ecosystems_manage_button$, Page: @1select_ecosystem, Icon: \"icon-settings\", PageParams: \"back_page=@1ec_manage,go_home=1,back_header=$@1catalog_ecosystems_editing$,EcosystemId=#EcosystemId#,Type=ONLY_MY\").Popup(Header: $@1ecosystem_select$, Width: \"40\")\nAddToolButton(Title: $@1create$, Page: @1ec_new, Icon: icon-plus).Popup(Header: $@1create$, Width: \"30\")\n\nIf(#sort#){\n If(#sort# == 1){\n SetVar(payment_filter, `, {\"info->payment\": 1}`)\n }.ElseIf(#sort# == 2){\n SetVar(payment_filter, `, {\"info->payment\": 2}`)\n }\n}.Else{\n SetVar(sort, \"0\")\n}\n\nIf(#page_par#){\n If(#page_par# == 1){\n SetVar(type_filter, `, {\"info->type\": 1}`)\n }.ElseIf(#page_par# == 2){\n SetVar(type_filter, `, {\"info->type\": 2}`)\n }.ElseIf(#page_par# == 3){\n SetVar(type_filter, `, {\"info->type\": 3}`)\n }\n}.Else{\n SetVar(page_par, \"0\")\n}\n\nIf(#search#){\n SetVar(where, {\"$and\": [{\"info->visibility\": 2} #payment_filter# #type_filter#, {\"name\": {\"$ilike\": \"#search#\"}}]})\n}.Else{\n SetVar(where, {\"$and\": [{\"info->visibility\": 2} #payment_filter# #type_filter#]})\n}\n\nDiv(mr-lg text-right){\n Button(Page: @1ec_filter, Class: btn bg-gray-lighter mr-sm, PageParams: \"sort=#sort#,page_par=#page_par#,search=#search#,current_page=#current_page#\", Body: Em(Class: fa fa-filter) $@1filter$).Popup(Header: $@1filter$, Width: \"30\")\n If(Or(#page_par# > 0, #sort# > 0)){\n Button(Page: #this_page#, PageParams: \"sort=0,page_par=0,search=#search#\", Class: btn bg-gray-lighter mr-sm, Body: Em(Class: fa fa-close))\n }\n}.Style(margin-top: -28px; z-index: 1001;)\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1ecosystem))\n Include(@1search)\n}\n\nDBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Ecosystems catalog\"}).Columns(\"name,id\").Vars(application)\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,name,info->type,info->payment,info->logo\").Custom(name_link){\n\n Button(Class: btn-xs btn-link, Page: @1ec_preview, PageParams: \"view_page_id=#id#,sort=#sort#,page_par=#page_par#,search=#search#,current_page=#current_page#\"){\n Div(){\n Div(text-right){\n If(#info.logo# > 0){\n Image(Src: Binary().ById(#info.logo#)).Style(height: 30px; max-width: 45px;)\n }.Else{\n Span(Class: fa icon-layers fa-2x text-default)\n }\n }.Style(width: 45px;)\n Span(Class: ml h5, Body: #name#)\n }.Style(display:flex; align-items:center;)\n }.Popup(Header: $@1catalog_ecosystems_preview$, Width: \"40\")\n}.Custom(type){\n If(#info.type# == 1){\n Em(Class: fa fa-lg fa-users fa-fw mr-sm)\n }.ElseIf(#info.type# == 2){\n Em(Class: fa fa-lg fa-handshake-o fa-fw mr-sm)\n }.ElseIf(#info.type# == 3){\n Em(Class: fa fa-lg fa-bank fa-fw mr-sm)\n }\n AppParam(Ecosystem: 1, App: #application_id#, Name: ec_type, Index: #info.type#)\n}.Custom(payment){\n If(#info.payment# == 1){\n Em(Class: fa fa-lg fa-gift fa-fw)\n }.ElseIf(#info.payment# == 2){\n Em(Class: fa fa-lg fa-usd fa-fw)\n }\n AppParam(Ecosystem: 1, App: #application_id#, Name: ec_payment, Index: #info.payment#)\n}.Custom(actions){\n SetVar(ecosystem_member_account,)\n SetVar(account_key, AddressToId(#account_id#))\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#id#\", \"sender->account\": \"#account_id#\", \"page_params->ecosystem_id\": \"#id#\", \"closed\": 0}).Count(notific_count)\n DBFind(\"@1keys\").Where({\"ecosystem\": \"#id#\", \"account\": \"#account_id#\", \"deleted\": 0}).Vars(ecosystem_member)\n DBFind(\"@1parameters\").Where({\"ecosystem\": \"#id#\", \"$or\": [{\"$and\": [{\"name\": \"founder_account\"}, {\"value\": \"#account_key#\"}]}, {\"$and\": [{\"name\": \"delegate_account\"}, {\"value\": \"#account_key#\"}]}]}).Count(access)\n Div(text-right button-group text-nowrap){\n If(#access#){\n Button(Class: icon-settings btn bg-gray-lighter mh-sm, Page: @1ec_manage, PageParams: \"edit_page_id=#id#,sort=#sort#,page_par=#page_par#,search=#search#,current_page=#current_page#\").Popup(Header: $@1catalog_ecosystems_editing$, Width: \"50\")\n }.ElseIf(And(#notific_count# == 0, #ecosystem_member_account# == \"\")){\n Button(Class: btn btn-link, Body: $@1send_request$, Contract: @1MembershipRequest, Page: #this_page#, Params: \"EcosystemId=#id#\")\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1id$=id,$@1ecosystem$=name_link,$@1catalog_ecosystems_type$=type,$@1catalog_ecosystems_payment$=payment,=actions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1ecosystems$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "ec_manage", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1applications).Where({\"ecosystem\": 1, \"name\": \"Ecosystems catalog\"}).Columns(\"name,id\").Vars(application)\nIf(#EcosystemId# == \"\"){\n SetVar(EcosystemId, 1)\n}\nDBFind(@1buffer_data).Columns(\"value->id,value->visibility,value->type,value->payment,value->description,value->logo,value->switch,value->conditions,value->hardware,value->email,value->phone,value->vde_page,value->vde_form,value->web_page,value->web_form\").Where({\"ecosystem\": #ecosystem_id#, \"key\": \"ecosystem_catalog_manage_form\", \"member_id\": #key_id#}).Vars(buffer)\nIf(And(#buffered#==1,#buffer_value_id#>1)){\n SetVar(edit_page_id,#buffer_value_id#)\n}\nIf(#edit_page_id#){\n DBFind(@1ecosystems).Where({\"id\": #edit_page_id#}).Columns(\"id,name,info->visibility,info->type,info->payment,info->logo,info->description,info->conditions,info->email,info->phone,info->hardware,info->vde_page,info->vde_form,info->web_page,info->web_form\").Vars(edit)\n}.Else{\n DBFind(@1ecosystems).Where({\"id\": #EcosystemId#}).Columns(\"id,name,info->visibility,info->type,info->payment,info->logo,info->description,info->conditions,info->email,info->phone,info->hardware,info->vde_page,info->vde_form,info->web_page,info->web_form\").Vars(edit)\n}\nIf(#buffered#==1){\n SetVar(edit_info_visibility,#buffer_value_visibility#)\n SetVar(edit_info_type,#buffer_value_type#)\n SetVar(edit_info_payment,#buffer_value_payment#)\n SetVar(edit_info_description,#buffer_value_description#)\n}\nIf(#uploaded#==1){\n DBFind(@1buffer_data).Columns(\"value->binary_id\").Where({\"ecosystem\": #ecosystem_id#, \"key\": \"ecosystem_logo\", \"member_id\": #key_id#}).Vars(logo)\n SetVar(edit_info_logo,#logo_value_binary_id#)\n}.ElseIf(#buffered#==1){\n SetVar(edit_info_logo,#buffer_value_logo#)\n}\nIf(And(#buffered#==1,#buffer_value_switch#==\"true\")){\n SetVar(edit_info_conditions,#buffer_value_conditions#)\n SetVar(edit_info_hardware,#buffer_value_hardware#)\n SetVar(edit_info_email,#buffer_value_email#)\n SetVar(edit_info_phone,#buffer_value_phone#)\n SetVar(edit_info_vde_page,#buffer_value_vde_page#)\n SetVar(edit_info_vde_form,#buffer_value_vde_form#)\n SetVar(edit_info_web_page,#buffer_value_web_page#)\n SetVar(edit_info_web_form,#buffer_value_web_form#)\n}\nAppParam(Ecosystem: 1, App: #application_id#, Name: ec_visibility, Source: src_visibility)\nAppParam(Ecosystem: 1, App: #application_id#, Name: ec_type, Source: src_type)\nAppParam(Ecosystem: 1, App: #application_id#, Name: ec_payment, Source: src_payment)\n\nForm(){\n Div(row){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1ecosystem)\n }\n Span(Class: text-danger, Body:*)\n }\n Div(col-sm-8){\n Input(Name: Id, Type: hidden, Value: #edit_id#)\n If(#edit_page_id#){\n Input(Name: Name, Value: #edit_name#, Disabled: true)\n }.Else{\n Div(input-group){\n If(#edit_id#==1){\n Input(Name: Name, Value: $@1ecosystem_select$, Disabled: true)\n }.Else{\n Input(Name: Name, Value: #edit_name#, Disabled: true)\n }\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_ecosystem, PageParams:\"back_page=@1ec_manage,back_header=$@1catalog_ecosystems_editing$,EcosystemId=#edit_id#,Type=ONLY_MY\").Popup(Header: $@1ecosystem$, Width: \"40\")\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n )\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1catalog_ecosystems_visibility)\n }\n Span(Class: text-danger, Body:*)\n }\n Div(col-sm-8){\n If(#edit_info_visibility#){\n Select(Name: Visibility, Source: src_visibility, NameColumn: name, ValueColumn: id, Value: #edit_info_visibility#)\n }.Else{\n Select(Name: Visibility, Source: src_visibility, NameColumn: name, ValueColumn: id, Value: 2)\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1catalog_ecosystems_type)\n }\n Span(Class: text-danger, Body:*)\n }\n Div(col-sm-8){\n If(#edit_info_type#){\n Select(Name: Type, Source: src_type, NameColumn: name, ValueColumn: id, Value: #edit_info_type#)\n }.Else{\n Select(Name: Type, Source: src_type, NameColumn: name, ValueColumn: id)\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1catalog_ecosystems_payment)\n }\n Span(Class: text-danger, Body:*)\n }\n Div(col-sm-8){\n If(#edit_info_payment#){\n Select(Name: Payment, Source: src_payment, NameColumn: name, ValueColumn: id, Value: #edit_info_payment#)\n }.Else{\n Select(Name: Payment, Source: src_payment, NameColumn: name, ValueColumn: id)\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1catalog_ecosystems_description)\n }\n }\n Div(col-sm-8){\n If(#edit_info_description#){\n Input(Name: Description, Type: textarea, Class: rv, Value: #edit_info_description#)\n }.Else{\n Input(Name: Description, Type: textarea, Class: rv)\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 text-right){\n Span(Class: text-bold vc){\n LangRes(@1catalog_ecosystems_logo)\n }\n }\n Div(ml-lg pull-left){\n If(#edit_id#!=1){\n If(#edit_info_logo#>0){\n Input(Name: Logo, Type: hidden, Value: #edit_info_logo#)\n Image(Src: Binary().ById(#edit_info_logo#)).Style(height: 36px;)\n }.Else{\n Input(Name: Logo, Type: hidden, Value: 0)\n Span(Class: fa icon-layers fa-2x vc)\n }\n }.Else{\n Span(Class: fa icon-layers fa-2x vc)\n }\n }\n Div(ml pull-left){\n If(#edit_id#!=1){\n SetVar(ParamNames, \"id;visibility;type;payment;description;logo;switch;conditions;hardware;email;phone;vde_page;vde_form;web_page;web_form\")\n Button(Class: btn btn-default btn-upload, Page: @1upload_page, PageParams: \"back_page=@1ec_manage,back_page_popup=50,back_page_popup_header=$@1catalog_ecosystems_editing$,application_id=#application_id#,buffer_key=ecosystem_logo\", Contract: @1FormStateSave, Params: \"AppId=#application_id#,FormName=ecosystem_catalog_manage_form,ParamNames=#ParamNames#,Param1=Val(Id),Param2=Val(Visibility),Param3=Val(Type),Param4=Val(Payment),Param5=Val(Description),Param6=Val(Logo),Param7=Val(Switch),Param8=Val(Conditions),Param9=Val(Hardware),Param10=Val(Email),Param11=Val(Phone),Param12=Val(VdePage),Param13=Val(VdeForm),Param14=Val(WebPage),Param15=Val(WebForm)\"){\n Span(Class: h6, Body: $@1button_upload$)\n }.Popup(Header: $@1catalog_ecosystems_logo$, Width: 30)\n }\n }\n Div(mr pull-right){\n If(And(#buffered#==1,#buffer_value_switch#==\"true\")){\n Div(input-group){\n Span(Class: mr vc text-muted, Body: $@1additional_info_edit$)\n Div(input-group-btn){\n Input(Name: Switch, Type: \"checkbox\", Value: \"true\", Class: m0)\n }\n }\n }.Else{\n Div(input-group){\n Span(Class: mr vc text-muted, Body: $@1additional_info_edit$)\n Div(input-group-btn){\n Input(Name: Switch, Type: \"checkbox\", Value: \"false\", Class: m0)\n }\n }\n }\n }\n }.Style(\n .vc {line-height: 36px;}\n .btn-upload {\n padding: 1px 6px;\n margin-top: 7px;\n border-radius: 3px;\n }\n )\n Div(){\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1catalog_ecosystems_conditions)\n }\n }\n Div(col-sm-8){\n If(#edit_info_conditions#){\n Input(Name: Conditions, Type: textarea, Class: rv, Value: #edit_info_conditions#)\n }.Else{\n Input(Name: Conditions, Type: textarea, Class: rv)\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1catalog_ecosystems_hardware)\n }\n }\n Div(col-sm-8){\n If(#edit_info_hardware#){\n Input(Name: Hardware, Type: textarea, Class: rv, Value: #edit_info_hardware#)\n }.Else{\n Input(Name: Hardware, Type: textarea, Class: rv)\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1catalog_ecosystems_email)\n }\n }\n Div(col-sm-8){\n If(#edit_info_email#){\n Input(Name: Email, Value: #edit_info_email#)\n }.Else{\n Input(Name: Email)\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1catalog_ecosystems_phone)\n }\n }\n Div(col-sm-8){\n If(#edit_info_phone#){\n Input(Name: Phone, Value: #edit_info_phone#)\n }.Else{\n Input(Name: Phone)\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1vde_page_address)\n }\n }\n Div(col-sm-8){\n If(#edit_info_vde_page#){\n Input(Name: VdePage, Value: #edit_info_vde_page#)\n }.Else{\n Input(Name: VdePage)\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1vde_form_address)\n }\n }\n Div(col-sm-8){\n If(#edit_info_vde_form#){\n Input(Name: VdeForm, Value: #edit_info_vde_form#)\n }.Else{\n Input(Name: VdeForm)\n }\n Div(Class: m0 h6 text-muted, Body: $@1vde_form_desc$)\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1web_page_address)\n }\n }\n Div(col-sm-8){\n If(#edit_info_web_page#){\n Input(Name: WebPage, Value: #edit_info_web_page#)\n }.Else{\n Input(Name: WebPage)\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1web_form_address)\n }\n }\n Div(col-sm-8){\n If(#edit_info_web_form#){\n Input(Name: WebForm, Value: #edit_info_web_form#)\n }.Else{\n Input(Name: WebForm)\n }\n Div(Class: m0 h6 text-muted, Body: $@1web_form_desc$)\n }\n }\n }.Show(\"Switch=true\")\n\n If(#edit_id#==1){\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right mt-lg disabled)\n }.Else{\n Div(){\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right mt-lg, Contract: @1EcManageInfo, Page: @1ec_list, PageParams: \"sort=#sort#,page_par=#page_par#,search=#search#,current_page=#current_page#\")\n }.Show(\"Switch=true\")\n Div(){\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right mt-lg, Contract: @1EcManageInfo, Params:\"Conditions=#edit_info_conditions#,Email=#edit_info_email#,Phone=#edit_info_phone#,Hardware=#edit_info_hardware#,VdePage=#edit_info_vde_page#,VdeForm=#edit_info_vde_form#,WebPage=#edit_info_web_page#,WebForm=#edit_info_web_form#\", Page: @1ec_list, PageParams: \"sort=#sort#,page_par=#page_par#,search=#search#,current_page=#current_page#\")\n }.Show(\"Switch=false\")\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt-lg, Page: @1ec_list, PageParams: \"sort=#sort#,page_par=#page_par#,search=#search#,current_page=#current_page#\")\n}.Style(\n .rv {resize: vertical;}\n)", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Ecosystems catalog\"}).Columns(\"name,id\").Vars(application)\nIf(#EcosystemId# == \"\"){\n SetVar(EcosystemId, 1)\n}\nDBFind(\"@1buffer_data\").Where({\"ecosystem\": \"#ecosystem_id#\", \"key\": \"ecosystem_catalog_manage_form\", \"account\": \"#account_id#\"}).Columns(\"value->id,value->visibility,value->type,value->payment,value->description,value->logo,value->switch,value->conditions,value->hardware,value->email,value->phone,value->vde_page,value->vde_form,value->web_page,value->web_form\").Vars(buffer)\nIf(And(#buffered# == 1, #buffer_value_id# > 1)){\n SetVar(edit_page_id, #buffer_value_id#)\n}\nIf(#edit_page_id#){\n DBFind(\"@1ecosystems\").Where({\"id\": \"#edit_page_id#\"}).Columns(\"id,name,info->visibility,info->type,info->payment,info->logo,info->description,info->conditions,info->email,info->phone,info->hardware,info->vde_page,info->vde_form,info->web_page,info->web_form\").Vars(edit)\n}.Else{\n DBFind(\"@1ecosystems\").Where({\"id\": \"#EcosystemId#\"}).Columns(\"id,name,info->visibility,info->type,info->payment,info->logo,info->description,info->conditions,info->email,info->phone,info->hardware,info->vde_page,info->vde_form,info->web_page,info->web_form\").Vars(edit)\n}\nIf(#buffered# == 1){\n SetVar(edit_info_visibility, #buffer_value_visibility#)\n SetVar(edit_info_type, #buffer_value_type#)\n SetVar(edit_info_payment, #buffer_value_payment#)\n SetVar(edit_info_description, #buffer_value_description#)\n}\nIf(#uploaded# == 1){\n DBFind(\"@1buffer_data\").Where({\"ecosystem\": \"#ecosystem_id#\", \"key\": \"ecosystem_logo\", \"account\": \"#account_id#\"}).Columns(\"value->binary_id\").Vars(logo)\n SetVar(edit_info_logo, #logo_value_binary_id#)\n}.ElseIf(#buffered# == 1){\n SetVar(edit_info_logo, #buffer_value_logo#)\n}\nIf(And(#buffered# == 1, #buffer_value_switch# == \"true\")){\n SetVar(edit_info_conditions, #buffer_value_conditions#)\n SetVar(edit_info_hardware, #buffer_value_hardware#)\n SetVar(edit_info_email, #buffer_value_email#)\n SetVar(edit_info_phone, #buffer_value_phone#)\n SetVar(edit_info_vde_page, #buffer_value_vde_page#)\n SetVar(edit_info_vde_form, #buffer_value_vde_form#)\n SetVar(edit_info_web_page, #buffer_value_web_page#)\n SetVar(edit_info_web_form, #buffer_value_web_form#)\n}\nAppParam(Ecosystem: 1, App: #application_id#, Name: ec_visibility, Source: src_visibility)\nAppParam(Ecosystem: 1, App: #application_id#, Name: ec_type, Source: src_type)\nAppParam(Ecosystem: 1, App: #application_id#, Name: ec_payment, Source: src_payment)\n\nForm(){\n Div(row){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1ecosystem)\n }\n Span(Class: text-danger, Body:*)\n }\n Div(col-sm-8){\n Input(Name: Id, Type: hidden, Value: #edit_id#)\n If(#edit_page_id#){\n Input(Name: Name, Value: #edit_name#, Disabled: true)\n }.Else{\n Div(input-group){\n If(#edit_id# == 1){\n Input(Name: Name, Value: $@1ecosystem_select$, Disabled: true)\n }.Else{\n Input(Name: Name, Value: #edit_name#, Disabled: true)\n }\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_ecosystem, PageParams:\"back_page=@1ec_manage,back_header=$@1catalog_ecosystems_editing$,EcosystemId=#edit_id#,Type=ONLY_MY\").Popup(Header: $@1ecosystem$, Width: \"40\")\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n )\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1catalog_ecosystems_visibility)\n }\n Span(Class: text-danger, Body:*)\n }\n Div(col-sm-8){\n If(#edit_info_visibility#){\n Select(Name: Visibility, Source: src_visibility, NameColumn: name, ValueColumn: id, Value: #edit_info_visibility#)\n }.Else{\n Select(Name: Visibility, Source: src_visibility, NameColumn: name, ValueColumn: id, Value: 2)\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1catalog_ecosystems_type)\n }\n Span(Class: text-danger, Body:*)\n }\n Div(col-sm-8){\n If(#edit_info_type#){\n Select(Name: Type, Source: src_type, NameColumn: name, ValueColumn: id, Value: #edit_info_type#)\n }.Else{\n Select(Name: Type, Source: src_type, NameColumn: name, ValueColumn: id)\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1catalog_ecosystems_payment)\n }\n Span(Class: text-danger, Body:*)\n }\n Div(col-sm-8){\n If(#edit_info_payment#){\n Select(Name: Payment, Source: src_payment, NameColumn: name, ValueColumn: id, Value: #edit_info_payment#)\n }.Else{\n Select(Name: Payment, Source: src_payment, NameColumn: name, ValueColumn: id)\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1catalog_ecosystems_description)\n }\n }\n Div(col-sm-8){\n If(#edit_info_description#){\n Input(Name: Description, Type: textarea, Class: rv, Value: #edit_info_description#)\n }.Else{\n Input(Name: Description, Type: textarea, Class: rv)\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 text-right){\n Span(Class: text-bold vc){\n LangRes(@1catalog_ecosystems_logo)\n }\n }\n Div(ml-lg pull-left){\n If(#edit_id# != 1){\n If(#edit_info_logo# > 0){\n Input(Name: Logo, Type: hidden, Value: #edit_info_logo#)\n Image(Src: Binary().ById(#edit_info_logo#)).Style(height: 36px;)\n }.Else{\n Input(Name: Logo, Type: hidden, Value: 0)\n Span(Class: fa icon-layers fa-2x vc)\n }\n }.Else{\n Span(Class: fa icon-layers fa-2x vc)\n }\n }\n Div(ml pull-left){\n If(#edit_id# != 1){\n SetVar(ParamNames, \"id;visibility;type;payment;description;logo;switch;conditions;hardware;email;phone;vde_page;vde_form;web_page;web_form\")\n Button(Class: btn btn-default btn-upload, Page: @1upload_page, PageParams: \"back_page=@1ec_manage,back_page_popup=50,back_page_popup_header=$@1catalog_ecosystems_editing$,application_id=#application_id#,buffer_key=ecosystem_logo\", Contract: @1FormStateSave, Params: \"AppId=#application_id#,FormName=ecosystem_catalog_manage_form,ParamNames=#ParamNames#,Param1=Val(Id),Param2=Val(Visibility),Param3=Val(Type),Param4=Val(Payment),Param5=Val(Description),Param6=Val(Logo),Param7=Val(Switch),Param8=Val(Conditions),Param9=Val(Hardware),Param10=Val(Email),Param11=Val(Phone),Param12=Val(VdePage),Param13=Val(VdeForm),Param14=Val(WebPage),Param15=Val(WebForm)\"){\n Span(Class: h6, Body: $@1button_upload$)\n }.Popup(Header: $@1catalog_ecosystems_logo$, Width: 30)\n }\n }\n Div(mr pull-right){\n If(And(#buffered# == 1, #buffer_value_switch# == \"true\")){\n Div(input-group){\n Span(Class: mr vc text-muted, Body: $@1additional_info_edit$)\n Div(input-group-btn){\n Input(Name: Switch, Type: \"checkbox\", Value: \"true\", Class: m0)\n }\n }\n }.Else{\n Div(input-group){\n Span(Class: mr vc text-muted, Body: $@1additional_info_edit$)\n Div(input-group-btn){\n Input(Name: Switch, Type: \"checkbox\", Value: \"false\", Class: m0)\n }\n }\n }\n }\n }.Style(\n .vc {line-height: 36px;}\n .btn-upload {\n padding: 1px 6px;\n margin-top: 7px;\n border-radius: 3px;\n }\n )\n Div(){\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1catalog_ecosystems_conditions)\n }\n }\n Div(col-sm-8){\n If(#edit_info_conditions#){\n Input(Name: Conditions, Type: textarea, Class: rv, Value: #edit_info_conditions#)\n }.Else{\n Input(Name: Conditions, Type: textarea, Class: rv)\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1catalog_ecosystems_hardware)\n }\n }\n Div(col-sm-8){\n If(#edit_info_hardware#){\n Input(Name: Hardware, Type: textarea, Class: rv, Value: #edit_info_hardware#)\n }.Else{\n Input(Name: Hardware, Type: textarea, Class: rv)\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1catalog_ecosystems_email)\n }\n }\n Div(col-sm-8){\n If(#edit_info_email#){\n Input(Name: Email, Value: #edit_info_email#)\n }.Else{\n Input(Name: Email)\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1catalog_ecosystems_phone)\n }\n }\n Div(col-sm-8){\n If(#edit_info_phone#){\n Input(Name: Phone, Value: #edit_info_phone#)\n }.Else{\n Input(Name: Phone)\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1vde_page_address)\n }\n }\n Div(col-sm-8){\n If(#edit_info_vde_page#){\n Input(Name: VdePage, Value: #edit_info_vde_page#)\n }.Else{\n Input(Name: VdePage)\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1vde_form_address)\n }\n }\n Div(col-sm-8){\n If(#edit_info_vde_form#){\n Input(Name: VdeForm, Value: #edit_info_vde_form#)\n }.Else{\n Input(Name: VdeForm)\n }\n Div(Class: m0 h6 text-muted, Body: $@1vde_form_desc$)\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1web_page_address)\n }\n }\n Div(col-sm-8){\n If(#edit_info_web_page#){\n Input(Name: WebPage, Value: #edit_info_web_page#)\n }.Else{\n Input(Name: WebPage)\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(){\n LangRes(@1web_form_address)\n }\n }\n Div(col-sm-8){\n If(#edit_info_web_form#){\n Input(Name: WebForm, Value: #edit_info_web_form#)\n }.Else{\n Input(Name: WebForm)\n }\n Div(Class: m0 h6 text-muted, Body: $@1web_form_desc$)\n }\n }\n }.Show(\"Switch=true\")\n\n If(#edit_id# == 1){\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right mt-lg disabled)\n }.Else{\n Div(){\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right mt-lg, Contract: @1EcManageInfo, Page: @1ec_list, PageParams: \"sort=#sort#,page_par=#page_par#,search=#search#,current_page=#current_page#\")\n }.Show(\"Switch=true\")\n Div(){\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right mt-lg, Contract: @1EcManageInfo, Params:\"Conditions=#edit_info_conditions#,Email=#edit_info_email#,Phone=#edit_info_phone#,Hardware=#edit_info_hardware#,VdePage=#edit_info_vde_page#,VdeForm=#edit_info_vde_form#,WebPage=#edit_info_web_page#,WebForm=#edit_info_web_form#\", Page: @1ec_list, PageParams: \"sort=#sort#,page_par=#page_par#,search=#search#,current_page=#current_page#\")\n }.Show(\"Switch=false\")\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt-lg, Page: @1ec_list, PageParams: \"sort=#sort#,page_par=#page_par#,search=#search#,current_page=#current_page#\")\n}.Style(\n .rv {resize: vertical;}\n)", "Menu": "default_menu", "Type": "pages" }, @@ -70,14 +70,14 @@ { "Name": "ec_preview", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1applications).Where({\"ecosystem\": 1, \"name\": \"Ecosystems catalog\"}).Columns(\"name,id\").Vars(application)\nDBFind(@1ecosystems).Where({\"id\": #view_page_id#}).Columns(\"id,name,info->type,info->payment,info->logo,info->description,info->conditions,info->email,info->phone,info->hardware,info->vde_page,info->vde_form,info->web_page,info->web_form\").Vars(preview)\nForm(){\n If(#view_page_id#>0){\n Div(row){\n Div(col-sm-4){\n Div(text-center){\n If(#preview_info_logo#>0){\n Image(Src: Binary().ById(#preview_info_logo#)).Style(height: 70px;)\n }.Else{\n Span(Class: fa icon-layers fa-5x text-default)\n }\n Div(Class: text-bold h4 mt0 mb-sm, Body: #preview_name#)\n }\n }\n Div(col-sm-8 m0){\n Span(Class: text-bold, Body: LangRes(@1catalog_ecosystems_description))\n If(#preview_info_description#!=\"\"){\n Div(Body: #preview_info_description#)\n }.Else{\n Div(Body: $@1catalog_ecosystems_description_empty$)\n }\n Div(mt-sm mb-sm){\n If(#preview_info_type#!=\"\"){\n Button(Class: wallet-btn new-btn mr-sm pr-sm mb-sm){\n Div(Class: button-content){\n If(#preview_info_type#==1){\n Em(Class: fa fa-users mr-sm)\n }.ElseIf(#preview_info_type#==2){\n Em(Class: fa fa-handshake-o mr-sm)\n }.ElseIf(#preview_info_type#==3){\n Em(Class: fa fa-bank mr-sm)\n }\n }\n AppParam(Ecosystem: 1, App: #application_id#, Name: ec_type, Index: #preview_info_type#)\n }\n }\n If(#preview_info_payment#!=\"\"){\n Button(Class: wallet-btn new-btn mr-sm pr-sm){\n Div(Class: button-content){\n If(#preview_info_payment#==1){\n Em(Class: fa fa-gift mr-sm)\n }.ElseIf(#preview_info_payment#==2){\n Em(Class: fa fa-usd mr-sm)\n }\n }\n AppParam(Ecosystem: 1, App: #application_id#, Name: ec_payment, Index: #preview_info_payment#)\n }\n }\n }\n }.Style(\n .label-dark {\n color:#515253;\n font-size: 12px;\n font-weight: normal;\n }\n )\n }\n If(Or(#preview_info_conditions#!=\"\",#preview_info_hardware#!=\"\")){\n Div(list-group-item mt-sm){\n If(#preview_info_conditions#!=\"\"){\n Div(row mt-sm){\n Div(col-sm-4 text-right){\n Label(){\n LangRes(@1catalog_ecosystems_conditions)\n }\n }\n Div(col-sm-8){\n Span(Body: #preview_info_conditions#)\n }\n }\n }\n If(#preview_info_hardware#!=\"\"){\n Div(row mt-sm){\n Div(col-sm-4 text-right){\n Label(){\n LangRes(@1catalog_ecosystems_hardware)\n }\n }\n Div(col-sm-8){\n Span(Body: #preview_info_hardware#)\n }\n }\n }\n }\n }\n If(Or(#preview_info_email#!=\"\",#preview_info_phone#!=\"\")){\n Div(list-group-item mt-sm){\n If(#preview_info_email#!=\"\"){\n Div(row mt-sm){\n Div(col-sm-4 text-right){\n Label(){\n LangRes(@1catalog_ecosystems_email)\n }\n }\n Div(col-sm-8){\n Span(Body: #preview_info_email#)\n }\n }\n }\n If(#preview_info_phone#!=\"\"){\n Div(row mt-sm){\n Div(col-sm-4 text-right){\n Label(){\n LangRes(@1catalog_ecosystems_phone)\n }\n }\n Div(col-sm-8){\n Span(Body: #preview_info_phone#)\n }\n }\n }\n }\n }\n If(Or(#preview_info_vde_page#!=\"\",#preview_info_vde_form#!=\"\",#preview_info_web_page#!=\"\",#preview_info_web_form#!=\"\")){\n Div(list-group-item mt-sm){\n If(#preview_info_vde_page#!=\"\"){\n Div(row mt-sm){\n Div(col-sm-4 text-right){\n Label(){\n LangRes(@1vde_page_address)\n }\n }\n Div(col-sm-8){\n Span(Body: #preview_info_vde_page#)\n }\n }\n }\n If(#preview_info_vde_form#!=\"\"){\n Div(row mt-sm){\n Div(col-sm-4 text-right){\n Label(){\n LangRes(@1vde_form_address)\n }\n }\n Div(col-sm-8){\n Span(Body: #preview_info_vde_form#)\n }\n }\n }\n If(#preview_info_web_page#!=\"\"){\n Div(row mt-sm){\n Div(col-sm-4 text-right){\n Label(){\n LangRes(@1web_page_address)\n }\n }\n Div(col-sm-8){\n Span(Body: #preview_info_web_page#)\n }\n }\n }\n If(#preview_info_web_form#!=\"\"){\n Div(row mt-sm){\n Div(col-sm-4 text-right){\n Label(){\n LangRes(@1web_form_address)\n }\n }\n Div(col-sm-8){\n Span(Body: #preview_info_web_form#)\n }\n }\n }\n }\n }\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1ec_list, PageParams: \"sort=#sort#,page_par=#page_par#,search=#search#,current_page=#current_page#\")\n}.Style(\n .type-btn {\n margin-left: 5px;\n margin-bottom: 5px;\n }\n .new-btn {\n background: transparent;\n border: solid 1px #4c7dbd;\n border-radius: 2px;\n outline: none;\n font-size: 14px;\n color: #4c7dbd;\n height: 25px;\n line-height: 23px;\n padding: 0;\n vertical-align: top;\n }\n .new-btn:hover {\n background: #e9e9e9;\n }\n .new-btn .button-content {\n padding: 0 6px;\n float: left;\n height: 100%;\n }\n)", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Ecosystems catalog\"}).Columns(\"name,id\").Vars(application)\nDBFind(\"@1ecosystems\").Where({\"id\": \"#view_page_id#\"}).Columns(\"id,name,info->type,info->payment,info->logo,info->description,info->conditions,info->email,info->phone,info->hardware,info->vde_page,info->vde_form,info->web_page,info->web_form\").Vars(preview)\nForm(){\n If(#view_page_id# > 0){\n Div(row){\n Div(col-sm-4){\n Div(text-center){\n If(#preview_info_logo# > 0){\n Image(Src: Binary().ById(#preview_info_logo#)).Style(height: 70px;)\n }.Else{\n Span(Class: fa icon-layers fa-5x text-default)\n }\n Div(Class: text-bold h4 mt0 mb-sm, Body: #preview_name#)\n }\n }\n Div(col-sm-8 m0){\n Span(Class: text-bold, Body: LangRes(@1catalog_ecosystems_description))\n If(#preview_info_description#){\n Div(Body: #preview_info_description#)\n }.Else{\n Div(Body: $@1catalog_ecosystems_description_empty$)\n }\n Div(mt-sm mb-sm){\n If(#preview_info_type#){\n Button(Class: wallet-btn new-btn mr-sm pr-sm mb-sm){\n Div(Class: button-content){\n If(#preview_info_type# == 1){\n Em(Class: fa fa-users mr-sm)\n }.ElseIf(#preview_info_type# == 2){\n Em(Class: fa fa-handshake-o mr-sm)\n }.ElseIf(#preview_info_type# == 3){\n Em(Class: fa fa-bank mr-sm)\n }\n }\n AppParam(Ecosystem: 1, App: #application_id#, Name: ec_type, Index: #preview_info_type#)\n }\n }\n If(#preview_info_payment#){\n Button(Class: wallet-btn new-btn mr-sm pr-sm){\n Div(Class: button-content){\n If(#preview_info_payment# == 1){\n Em(Class: fa fa-gift mr-sm)\n }.ElseIf(#preview_info_payment# == 2){\n Em(Class: fa fa-usd mr-sm)\n }\n }\n AppParam(Ecosystem: 1, App: #application_id#, Name: ec_payment, Index: #preview_info_payment#)\n }\n }\n }\n }.Style(\n .label-dark {\n color:#515253;\n font-size: 12px;\n font-weight: normal;\n }\n )\n }\n If(Or(#preview_info_conditions# != \"\", #preview_info_hardware# != \"\")){\n Div(list-group-item mt-sm){\n If(#preview_info_conditions#){\n Div(row mt-sm){\n Div(col-sm-4 text-right){\n Label(){\n LangRes(@1catalog_ecosystems_conditions)\n }\n }\n Div(col-sm-8){\n Span(Body: #preview_info_conditions#)\n }\n }\n }\n If(#preview_info_hardware#){\n Div(row mt-sm){\n Div(col-sm-4 text-right){\n Label(){\n LangRes(@1catalog_ecosystems_hardware)\n }\n }\n Div(col-sm-8){\n Span(Body: #preview_info_hardware#)\n }\n }\n }\n }\n }\n If(Or(#preview_info_email# != \"\", #preview_info_phone# != \"\")){\n Div(list-group-item mt-sm){\n If(#preview_info_email#){\n Div(row mt-sm){\n Div(col-sm-4 text-right){\n Label(){\n LangRes(@1catalog_ecosystems_email)\n }\n }\n Div(col-sm-8){\n Span(Body: #preview_info_email#)\n }\n }\n }\n If(#preview_info_phone#){\n Div(row mt-sm){\n Div(col-sm-4 text-right){\n Label(){\n LangRes(@1catalog_ecosystems_phone)\n }\n }\n Div(col-sm-8){\n Span(Body: #preview_info_phone#)\n }\n }\n }\n }\n }\n If(Or(#preview_info_vde_page# != \"\", #preview_info_vde_form# != \"\", #preview_info_web_page# != \"\", #preview_info_web_form# != \"\")){\n Div(list-group-item mt-sm){\n If(#preview_info_vde_page#){\n Div(row mt-sm){\n Div(col-sm-4 text-right){\n Label(){\n LangRes(@1vde_page_address)\n }\n }\n Div(col-sm-8){\n Span(Body: #preview_info_vde_page#)\n }\n }\n }\n If(#preview_info_vde_form#){\n Div(row mt-sm){\n Div(col-sm-4 text-right){\n Label(){\n LangRes(@1vde_form_address)\n }\n }\n Div(col-sm-8){\n Span(Body: #preview_info_vde_form#)\n }\n }\n }\n If(#preview_info_web_page#){\n Div(row mt-sm){\n Div(col-sm-4 text-right){\n Label(){\n LangRes(@1web_page_address)\n }\n }\n Div(col-sm-8){\n Span(Body: #preview_info_web_page#)\n }\n }\n }\n If(#preview_info_web_form#){\n Div(row mt-sm){\n Div(col-sm-4 text-right){\n Label(){\n LangRes(@1web_form_address)\n }\n }\n Div(col-sm-8){\n Span(Body: #preview_info_web_form#)\n }\n }\n }\n }\n }\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1ec_list, PageParams: \"sort=#sort#,page_par=#page_par#,search=#search#,current_page=#current_page#\")\n}.Style(\n .type-btn {\n margin-left: 5px;\n margin-bottom: 5px;\n }\n .new-btn {\n background: transparent;\n border: solid 1px #4c7dbd;\n border-radius: 2px;\n outline: none;\n font-size: 14px;\n color: #4c7dbd;\n height: 25px;\n line-height: 23px;\n padding: 0;\n vertical-align: top;\n }\n .new-btn:hover {\n background: #e9e9e9;\n }\n .new-btn .button-content {\n padding: 0 6px;\n float: left;\n height: 100%;\n }\n)", "Menu": "default_menu", "Type": "pages" }, { "Name": "EcManageInfo", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract EcManageInfo {\n data {\n Id int\n Visibility int\n Type int\n Payment int\n Logo int \"optional\"\n Description string \"optional\"\n Conditions string \"optional\"\n Email string \"optional\"\n Phone string \"optional\"\n Hardware string \"optional\"\n VdePage string \"optional\"\n VdeForm string \"optional\"\n WebPage string \"optional\"\n WebForm string \"optional\"\n }\n\n conditions {\n var access map\n access = DBFind(\"@1parameters\").Where({\"$and\": [{\"ecosystem\": $Id}, {\"$or\": [{\"$and\": [{\"name\": \"founder_account\"},{\"value\": $key_id}]},{\"$and\": [{\"name\": \"delegate_account\"},{\"value\": $key_id}]}]}]}).Row()\n if !access {\n warning LangRes(\"@1ecosystem_cannot_manage_info\", \"en\")\n }\n }\n\n action {\n var ecosystem_info map\n ecosystem_info[\"visibility\"] = $Visibility\n ecosystem_info[\"type\"] = $Type\n ecosystem_info[\"payment\"] = $Payment\n ecosystem_info[\"logo\"] = $Logo\n ecosystem_info[\"description\"] = $Description\n ecosystem_info[\"conditions\"] = $Conditions\n ecosystem_info[\"email\"] = $Email\n ecosystem_info[\"phone\"] = $Phone\n ecosystem_info[\"hardware\"] = $Hardware\n ecosystem_info[\"vde_page\"] = $VdePage\n ecosystem_info[\"vde_form\"] = $VdeForm\n ecosystem_info[\"web_page\"] = $WebPage\n ecosystem_info[\"web_form\"] = $WebForm\n DBUpdate(\"@1ecosystems\", $Id, {\"info\": ecosystem_info})\n }\n}", + "Value": "contract EcManageInfo {\n data {\n Id int\n Visibility int\n Type int\n Payment int\n Logo int \"optional\"\n Description string \"optional\"\n Conditions string \"optional\"\n Email string \"optional\"\n Phone string \"optional\"\n Hardware string \"optional\"\n VdePage string \"optional\"\n VdeForm string \"optional\"\n WebPage string \"optional\"\n WebForm string \"optional\"\n }\n\n conditions {\n var access map account_key int\n account_key = AddressToId($account_id)\n access = DBFind(\"@1parameters\").Where({\"ecosystem\": $Id, \"$or\": [{\"$and\": [{\"name\": \"founder_account\"}, {\"value\": account_key}]}, {\"$and\": [{\"name\": \"delegate_account\"}, {\"value\": account_key}]}]}).Row()\n if !access {\n warning LangRes(\"@1ecosystem_cannot_manage_info\", \"en\")\n }\n }\n\n action {\n var ecosystem_info map\n ecosystem_info[\"visibility\"] = $Visibility\n ecosystem_info[\"type\"] = $Type\n ecosystem_info[\"payment\"] = $Payment\n ecosystem_info[\"logo\"] = $Logo\n ecosystem_info[\"description\"] = $Description\n ecosystem_info[\"conditions\"] = $Conditions\n ecosystem_info[\"email\"] = $Email\n ecosystem_info[\"phone\"] = $Phone\n ecosystem_info[\"hardware\"] = $Hardware\n ecosystem_info[\"vde_page\"] = $VdePage\n ecosystem_info[\"vde_form\"] = $VdeForm\n ecosystem_info[\"web_page\"] = $WebPage\n ecosystem_info[\"web_form\"] = $WebForm\n DBUpdate(\"@1ecosystems\", $Id, {\"info\": ecosystem_info})\n }\n}", "Type": "contracts" } ] diff --git a/platform_apps/ecosystems_catalog/contracts/EcManageInfo.sim b/platform_apps/ecosystems_catalog/contracts/EcManageInfo.sim index b74029302..ed7c03125 100644 --- a/platform_apps/ecosystems_catalog/contracts/EcManageInfo.sim +++ b/platform_apps/ecosystems_catalog/contracts/EcManageInfo.sim @@ -17,8 +17,9 @@ contract EcManageInfo { } conditions { - var access map - access = DBFind("@1parameters").Where({"$and": [{"ecosystem": $Id}, {"$or": [{"$and": [{"name": "founder_account"},{"value": $key_id}]},{"$and": [{"name": "delegate_account"},{"value": $key_id}]}]}]}).Row() + var access map account_key int + account_key = AddressToId($account_id) + access = DBFind("@1parameters").Where({"ecosystem": $Id, "$or": [{"$and": [{"name": "founder_account"}, {"value": account_key}]}, {"$and": [{"name": "delegate_account"}, {"value": account_key}]}]}).Row() if !access { warning LangRes("@1ecosystem_cannot_manage_info", "en") } diff --git a/platform_apps/ecosystems_catalog/pages/ec_filter.ptl b/platform_apps/ecosystems_catalog/pages/ec_filter.ptl index 6ebeb5ba7..2f88de215 100644 --- a/platform_apps/ecosystems_catalog/pages/ec_filter.ptl +++ b/platform_apps/ecosystems_catalog/pages/ec_filter.ptl @@ -1,4 +1,4 @@ -DBFind(@1applications).Where({"ecosystem": 1, "name": "Ecosystems catalog"}).Columns("name,id").Vars(application) +DBFind("@1applications").Where({"ecosystem": 1, "name": "Ecosystems catalog"}).Columns("name,id").Vars(application) AppParam(Ecosystem: 1, App: #application_id#, Name: ec_type, Source: src_type) AppParam(Ecosystem: 1, App: #application_id#, Name: ec_payment, Source: src_payment) diff --git a/platform_apps/ecosystems_catalog/pages/ec_list.ptl b/platform_apps/ecosystems_catalog/pages/ec_list.ptl index c9717d0c0..82cebcc31 100644 --- a/platform_apps/ecosystems_catalog/pages/ec_list.ptl +++ b/platform_apps/ecosystems_catalog/pages/ec_list.ptl @@ -10,36 +10,36 @@ AddToolButton(Title: $@1catalog_ecosystems_manage_button$, Page: @1select_ecosys AddToolButton(Title: $@1create$, Page: @1ec_new, Icon: icon-plus).Popup(Header: $@1create$, Width: "30") If(#sort#){ - If(#sort#==1){ - SetVar(payment_filter, {"info->payment":1}) - }.ElseIf(#sort#==2){ - SetVar(payment_filter, {"info->payment":2}) + If(#sort# == 1){ + SetVar(payment_filter, `, {"info->payment": 1}`) + }.ElseIf(#sort# == 2){ + SetVar(payment_filter, `, {"info->payment": 2}`) } }.Else{ SetVar(sort, "0") } If(#page_par#){ - If(#page_par#==1){ - SetVar(type_filter, {"info->type":1}) - }.ElseIf(#page_par#==2){ - SetVar(type_filter, {"info->type":2}) - }.ElseIf(#page_par#==3){ - SetVar(type_filter, {"info->type":3}) + If(#page_par# == 1){ + SetVar(type_filter, `, {"info->type": 1}`) + }.ElseIf(#page_par# == 2){ + SetVar(type_filter, `, {"info->type": 2}`) + }.ElseIf(#page_par# == 3){ + SetVar(type_filter, `, {"info->type": 3}`) } }.Else{ SetVar(page_par, "0") } If(#search#){ - SetVar(where, {"$and": [{"info->visibility": 2}, #payment_filter#, #type_filter#, {"name": {"$ilike": "#search#"}}]}) + SetVar(where, {"$and": [{"info->visibility": 2} #payment_filter# #type_filter#, {"name": {"$ilike": "#search#"}}]}) }.Else{ - SetVar(where, {"$and": [{"info->visibility": 2}, #payment_filter#, #type_filter#]}) + SetVar(where, {"$and": [{"info->visibility": 2} #payment_filter# #type_filter#]}) } Div(mr-lg text-right){ Button(Page: @1ec_filter, Class: btn bg-gray-lighter mr-sm, PageParams: "sort=#sort#,page_par=#page_par#,search=#search#,current_page=#current_page#", Body: Em(Class: fa fa-filter) $@1filter$).Popup(Header: $@1filter$, Width: "30") - If(Or(#page_par#>0,#sort#>0)){ + If(Or(#page_par# > 0, #sort# > 0)){ Button(Page: #this_page#, PageParams: "sort=0,page_par=0,search=#search#", Class: btn bg-gray-lighter mr-sm, Body: Em(Class: fa fa-close)) } }.Style(margin-top: -28px; z-index: 1001;) @@ -49,14 +49,14 @@ Div(list-group-item ml-lg mr-lg pt-lg){ Include(@1search) } -DBFind(@1applications).Where({"ecosystem": 1, "name": "Ecosystems catalog"}).Columns("name,id").Vars(application) +DBFind("@1applications").Where({"ecosystem": 1, "name": "Ecosystems catalog"}).Columns("name,id").Vars(application) DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("id,name,info->type,info->payment,info->logo").Custom(name_link){ Button(Class: btn-xs btn-link, Page: @1ec_preview, PageParams: "view_page_id=#id#,sort=#sort#,page_par=#page_par#,search=#search#,current_page=#current_page#"){ Div(){ Div(text-right){ - If(#info.logo#>0){ + If(#info.logo# > 0){ Image(Src: Binary().ById(#info.logo#)).Style(height: 30px; max-width: 45px;) }.Else{ Span(Class: fa icon-layers fa-2x text-default) @@ -66,30 +66,31 @@ DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).O }.Style(display:flex; align-items:center;) }.Popup(Header: $@1catalog_ecosystems_preview$, Width: "40") }.Custom(type){ - If(#info.type#==1){ + If(#info.type# == 1){ Em(Class: fa fa-lg fa-users fa-fw mr-sm) - }.ElseIf(#info.type#==2){ + }.ElseIf(#info.type# == 2){ Em(Class: fa fa-lg fa-handshake-o fa-fw mr-sm) - }.ElseIf(#info.type#==3){ + }.ElseIf(#info.type# == 3){ Em(Class: fa fa-lg fa-bank fa-fw mr-sm) } AppParam(Ecosystem: 1, App: #application_id#, Name: ec_type, Index: #info.type#) }.Custom(payment){ - If(#info.payment#==1){ + If(#info.payment# == 1){ Em(Class: fa fa-lg fa-gift fa-fw) - }.ElseIf(#info.payment#==2){ + }.ElseIf(#info.payment# == 2){ Em(Class: fa fa-lg fa-usd fa-fw) } AppParam(Ecosystem: 1, App: #application_id#, Name: ec_payment, Index: #info.payment#) }.Custom(actions){ - SetVar(ecosystem_member_id,) - DBFind(@1notifications).Where({"ecosystem": #id#, "sender->member_id": #key_id#, "page_params->ecosystem_id": #id#, closed: 0}).Count(notific_count) - DBFind(@1keys).Where({"ecosystem": #id#, "id": #key_id#}).Vars(ecosystem_member) - DBFind(@1parameters).Where({"$and": [{"ecosystem": #id#}, {"$or": [{"$and": [{"name": "founder_account"},{"value": #key_id#}]},{"$and": [{"name": "delegate_account"},{"value": #key_id#}]}]}]}).Count(access) + SetVar(ecosystem_member_account,) + SetVar(account_key, AddressToId(#account_id#)) + DBFind("@1notifications").Where({"ecosystem": "#id#", "sender->account": "#account_id#", "page_params->ecosystem_id": "#id#", "closed": 0}).Count(notific_count) + DBFind("@1keys").Where({"ecosystem": "#id#", "account": "#account_id#", "deleted": 0}).Vars(ecosystem_member) + DBFind("@1parameters").Where({"ecosystem": "#id#", "$or": [{"$and": [{"name": "founder_account"}, {"value": "#account_key#"}]}, {"$and": [{"name": "delegate_account"}, {"value": "#account_key#"}]}]}).Count(access) Div(text-right button-group text-nowrap){ If(#access#){ Button(Class: icon-settings btn bg-gray-lighter mh-sm, Page: @1ec_manage, PageParams: "edit_page_id=#id#,sort=#sort#,page_par=#page_par#,search=#search#,current_page=#current_page#").Popup(Header: $@1catalog_ecosystems_editing$, Width: "50") - }.ElseIf(And(#notific_count#==0,#ecosystem_member_id#=="")){ + }.ElseIf(And(#notific_count# == 0, #ecosystem_member_account# == "")){ Button(Class: btn btn-link, Body: $@1send_request$, Contract: @1MembershipRequest, Page: #this_page#, Params: "EcosystemId=#id#") } } diff --git a/platform_apps/ecosystems_catalog/pages/ec_manage.ptl b/platform_apps/ecosystems_catalog/pages/ec_manage.ptl index 5895d0a7c..f500f9e15 100644 --- a/platform_apps/ecosystems_catalog/pages/ec_manage.ptl +++ b/platform_apps/ecosystems_catalog/pages/ec_manage.ptl @@ -1,37 +1,37 @@ -DBFind(@1applications).Where({"ecosystem": 1, "name": "Ecosystems catalog"}).Columns("name,id").Vars(application) +DBFind("@1applications").Where({"ecosystem": 1, "name": "Ecosystems catalog"}).Columns("name,id").Vars(application) If(#EcosystemId# == ""){ SetVar(EcosystemId, 1) } -DBFind(@1buffer_data).Columns("value->id,value->visibility,value->type,value->payment,value->description,value->logo,value->switch,value->conditions,value->hardware,value->email,value->phone,value->vde_page,value->vde_form,value->web_page,value->web_form").Where({"ecosystem": #ecosystem_id#, "key": "ecosystem_catalog_manage_form", "member_id": #key_id#}).Vars(buffer) -If(And(#buffered#==1,#buffer_value_id#>1)){ - SetVar(edit_page_id,#buffer_value_id#) +DBFind("@1buffer_data").Where({"ecosystem": "#ecosystem_id#", "key": "ecosystem_catalog_manage_form", "account": "#account_id#"}).Columns("value->id,value->visibility,value->type,value->payment,value->description,value->logo,value->switch,value->conditions,value->hardware,value->email,value->phone,value->vde_page,value->vde_form,value->web_page,value->web_form").Vars(buffer) +If(And(#buffered# == 1, #buffer_value_id# > 1)){ + SetVar(edit_page_id, #buffer_value_id#) } If(#edit_page_id#){ - DBFind(@1ecosystems).Where({"id": #edit_page_id#}).Columns("id,name,info->visibility,info->type,info->payment,info->logo,info->description,info->conditions,info->email,info->phone,info->hardware,info->vde_page,info->vde_form,info->web_page,info->web_form").Vars(edit) + DBFind("@1ecosystems").Where({"id": "#edit_page_id#"}).Columns("id,name,info->visibility,info->type,info->payment,info->logo,info->description,info->conditions,info->email,info->phone,info->hardware,info->vde_page,info->vde_form,info->web_page,info->web_form").Vars(edit) }.Else{ - DBFind(@1ecosystems).Where({"id": #EcosystemId#}).Columns("id,name,info->visibility,info->type,info->payment,info->logo,info->description,info->conditions,info->email,info->phone,info->hardware,info->vde_page,info->vde_form,info->web_page,info->web_form").Vars(edit) + DBFind("@1ecosystems").Where({"id": "#EcosystemId#"}).Columns("id,name,info->visibility,info->type,info->payment,info->logo,info->description,info->conditions,info->email,info->phone,info->hardware,info->vde_page,info->vde_form,info->web_page,info->web_form").Vars(edit) } -If(#buffered#==1){ - SetVar(edit_info_visibility,#buffer_value_visibility#) - SetVar(edit_info_type,#buffer_value_type#) - SetVar(edit_info_payment,#buffer_value_payment#) - SetVar(edit_info_description,#buffer_value_description#) +If(#buffered# == 1){ + SetVar(edit_info_visibility, #buffer_value_visibility#) + SetVar(edit_info_type, #buffer_value_type#) + SetVar(edit_info_payment, #buffer_value_payment#) + SetVar(edit_info_description, #buffer_value_description#) } -If(#uploaded#==1){ - DBFind(@1buffer_data).Columns("value->binary_id").Where({"ecosystem": #ecosystem_id#, "key": "ecosystem_logo", "member_id": #key_id#}).Vars(logo) - SetVar(edit_info_logo,#logo_value_binary_id#) -}.ElseIf(#buffered#==1){ - SetVar(edit_info_logo,#buffer_value_logo#) +If(#uploaded# == 1){ + DBFind("@1buffer_data").Where({"ecosystem": "#ecosystem_id#", "key": "ecosystem_logo", "account": "#account_id#"}).Columns("value->binary_id").Vars(logo) + SetVar(edit_info_logo, #logo_value_binary_id#) +}.ElseIf(#buffered# == 1){ + SetVar(edit_info_logo, #buffer_value_logo#) } -If(And(#buffered#==1,#buffer_value_switch#=="true")){ - SetVar(edit_info_conditions,#buffer_value_conditions#) - SetVar(edit_info_hardware,#buffer_value_hardware#) - SetVar(edit_info_email,#buffer_value_email#) - SetVar(edit_info_phone,#buffer_value_phone#) - SetVar(edit_info_vde_page,#buffer_value_vde_page#) - SetVar(edit_info_vde_form,#buffer_value_vde_form#) - SetVar(edit_info_web_page,#buffer_value_web_page#) - SetVar(edit_info_web_form,#buffer_value_web_form#) +If(And(#buffered# == 1, #buffer_value_switch# == "true")){ + SetVar(edit_info_conditions, #buffer_value_conditions#) + SetVar(edit_info_hardware, #buffer_value_hardware#) + SetVar(edit_info_email, #buffer_value_email#) + SetVar(edit_info_phone, #buffer_value_phone#) + SetVar(edit_info_vde_page, #buffer_value_vde_page#) + SetVar(edit_info_vde_form, #buffer_value_vde_form#) + SetVar(edit_info_web_page, #buffer_value_web_page#) + SetVar(edit_info_web_form, #buffer_value_web_form#) } AppParam(Ecosystem: 1, App: #application_id#, Name: ec_visibility, Source: src_visibility) AppParam(Ecosystem: 1, App: #application_id#, Name: ec_type, Source: src_type) @@ -51,7 +51,7 @@ Form(){ Input(Name: Name, Value: #edit_name#, Disabled: true) }.Else{ Div(input-group){ - If(#edit_id#==1){ + If(#edit_id# == 1){ Input(Name: Name, Value: $@1ecosystem_select$, Disabled: true) }.Else{ Input(Name: Name, Value: #edit_name#, Disabled: true) @@ -134,8 +134,8 @@ Form(){ } } Div(ml-lg pull-left){ - If(#edit_id#!=1){ - If(#edit_info_logo#>0){ + If(#edit_id# != 1){ + If(#edit_info_logo# > 0){ Input(Name: Logo, Type: hidden, Value: #edit_info_logo#) Image(Src: Binary().ById(#edit_info_logo#)).Style(height: 36px;) }.Else{ @@ -147,7 +147,7 @@ Form(){ } } Div(ml pull-left){ - If(#edit_id#!=1){ + If(#edit_id# != 1){ SetVar(ParamNames, "id;visibility;type;payment;description;logo;switch;conditions;hardware;email;phone;vde_page;vde_form;web_page;web_form") Button(Class: btn btn-default btn-upload, Page: @1upload_page, PageParams: "back_page=@1ec_manage,back_page_popup=50,back_page_popup_header=$@1catalog_ecosystems_editing$,application_id=#application_id#,buffer_key=ecosystem_logo", Contract: @1FormStateSave, Params: "AppId=#application_id#,FormName=ecosystem_catalog_manage_form,ParamNames=#ParamNames#,Param1=Val(Id),Param2=Val(Visibility),Param3=Val(Type),Param4=Val(Payment),Param5=Val(Description),Param6=Val(Logo),Param7=Val(Switch),Param8=Val(Conditions),Param9=Val(Hardware),Param10=Val(Email),Param11=Val(Phone),Param12=Val(VdePage),Param13=Val(VdeForm),Param14=Val(WebPage),Param15=Val(WebForm)"){ Span(Class: h6, Body: $@1button_upload$) @@ -155,7 +155,7 @@ Form(){ } } Div(mr pull-right){ - If(And(#buffered#==1,#buffer_value_switch#=="true")){ + If(And(#buffered# == 1, #buffer_value_switch# == "true")){ Div(input-group){ Span(Class: mr vc text-muted, Body: $@1additional_info_edit$) Div(input-group-btn){ @@ -187,7 +187,7 @@ Form(){ } } Div(col-sm-8){ - If(#edit_info_conditions#){ + If(#edit_info_conditions#){ Input(Name: Conditions, Type: textarea, Class: rv, Value: #edit_info_conditions#) }.Else{ Input(Name: Conditions, Type: textarea, Class: rv) @@ -296,7 +296,7 @@ Form(){ } }.Show("Switch=true") - If(#edit_id#==1){ + If(#edit_id# == 1){ Button(Body: LangRes(@1save), Class: btn btn-primary pull-right mt-lg disabled) }.Else{ Div(){ diff --git a/platform_apps/ecosystems_catalog/pages/ec_preview.ptl b/platform_apps/ecosystems_catalog/pages/ec_preview.ptl index 27dcda2c9..78a5db3fe 100644 --- a/platform_apps/ecosystems_catalog/pages/ec_preview.ptl +++ b/platform_apps/ecosystems_catalog/pages/ec_preview.ptl @@ -1,11 +1,11 @@ -DBFind(@1applications).Where({"ecosystem": 1, "name": "Ecosystems catalog"}).Columns("name,id").Vars(application) -DBFind(@1ecosystems).Where({"id": #view_page_id#}).Columns("id,name,info->type,info->payment,info->logo,info->description,info->conditions,info->email,info->phone,info->hardware,info->vde_page,info->vde_form,info->web_page,info->web_form").Vars(preview) +DBFind("@1applications").Where({"ecosystem": 1, "name": "Ecosystems catalog"}).Columns("name,id").Vars(application) +DBFind("@1ecosystems").Where({"id": "#view_page_id#"}).Columns("id,name,info->type,info->payment,info->logo,info->description,info->conditions,info->email,info->phone,info->hardware,info->vde_page,info->vde_form,info->web_page,info->web_form").Vars(preview) Form(){ - If(#view_page_id#>0){ + If(#view_page_id# > 0){ Div(row){ Div(col-sm-4){ Div(text-center){ - If(#preview_info_logo#>0){ + If(#preview_info_logo# > 0){ Image(Src: Binary().ById(#preview_info_logo#)).Style(height: 70px;) }.Else{ Span(Class: fa icon-layers fa-5x text-default) @@ -15,32 +15,32 @@ Form(){ } Div(col-sm-8 m0){ Span(Class: text-bold, Body: LangRes(@1catalog_ecosystems_description)) - If(#preview_info_description#!=""){ + If(#preview_info_description#){ Div(Body: #preview_info_description#) }.Else{ Div(Body: $@1catalog_ecosystems_description_empty$) } Div(mt-sm mb-sm){ - If(#preview_info_type#!=""){ + If(#preview_info_type#){ Button(Class: wallet-btn new-btn mr-sm pr-sm mb-sm){ Div(Class: button-content){ - If(#preview_info_type#==1){ + If(#preview_info_type# == 1){ Em(Class: fa fa-users mr-sm) - }.ElseIf(#preview_info_type#==2){ + }.ElseIf(#preview_info_type# == 2){ Em(Class: fa fa-handshake-o mr-sm) - }.ElseIf(#preview_info_type#==3){ + }.ElseIf(#preview_info_type# == 3){ Em(Class: fa fa-bank mr-sm) } } AppParam(Ecosystem: 1, App: #application_id#, Name: ec_type, Index: #preview_info_type#) } } - If(#preview_info_payment#!=""){ + If(#preview_info_payment#){ Button(Class: wallet-btn new-btn mr-sm pr-sm){ Div(Class: button-content){ - If(#preview_info_payment#==1){ + If(#preview_info_payment# == 1){ Em(Class: fa fa-gift mr-sm) - }.ElseIf(#preview_info_payment#==2){ + }.ElseIf(#preview_info_payment# == 2){ Em(Class: fa fa-usd mr-sm) } } @@ -56,9 +56,9 @@ Form(){ } ) } - If(Or(#preview_info_conditions#!="",#preview_info_hardware#!="")){ + If(Or(#preview_info_conditions# != "", #preview_info_hardware# != "")){ Div(list-group-item mt-sm){ - If(#preview_info_conditions#!=""){ + If(#preview_info_conditions#){ Div(row mt-sm){ Div(col-sm-4 text-right){ Label(){ @@ -70,7 +70,7 @@ Form(){ } } } - If(#preview_info_hardware#!=""){ + If(#preview_info_hardware#){ Div(row mt-sm){ Div(col-sm-4 text-right){ Label(){ @@ -84,9 +84,9 @@ Form(){ } } } - If(Or(#preview_info_email#!="",#preview_info_phone#!="")){ + If(Or(#preview_info_email# != "", #preview_info_phone# != "")){ Div(list-group-item mt-sm){ - If(#preview_info_email#!=""){ + If(#preview_info_email#){ Div(row mt-sm){ Div(col-sm-4 text-right){ Label(){ @@ -98,7 +98,7 @@ Form(){ } } } - If(#preview_info_phone#!=""){ + If(#preview_info_phone#){ Div(row mt-sm){ Div(col-sm-4 text-right){ Label(){ @@ -112,9 +112,9 @@ Form(){ } } } - If(Or(#preview_info_vde_page#!="",#preview_info_vde_form#!="",#preview_info_web_page#!="",#preview_info_web_form#!="")){ + If(Or(#preview_info_vde_page# != "", #preview_info_vde_form# != "", #preview_info_web_page# != "", #preview_info_web_form# != "")){ Div(list-group-item mt-sm){ - If(#preview_info_vde_page#!=""){ + If(#preview_info_vde_page#){ Div(row mt-sm){ Div(col-sm-4 text-right){ Label(){ @@ -126,7 +126,7 @@ Form(){ } } } - If(#preview_info_vde_form#!=""){ + If(#preview_info_vde_form#){ Div(row mt-sm){ Div(col-sm-4 text-right){ Label(){ @@ -138,7 +138,7 @@ Form(){ } } } - If(#preview_info_web_page#!=""){ + If(#preview_info_web_page#){ Div(row mt-sm){ Div(col-sm-4 text-right){ Label(){ @@ -150,7 +150,7 @@ Form(){ } } } - If(#preview_info_web_form#!=""){ + If(#preview_info_web_form#){ Div(row mt-sm){ Div(col-sm-4 text-right){ Label(){ diff --git a/platform_apps/errands.json b/platform_apps/errands.json index 64eeca061..1b5cbf6a8 100644 --- a/platform_apps/errands.json +++ b/platform_apps/errands.json @@ -35,47 +35,47 @@ { "Name": "errand_create", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page,\"@1errand_create\")\n\nIf(#EcosystemId# == #ecosystem_id#){\n SetVar(errand_type,1)\n}\nIf(#errand_type#==\"\"){\n SetVar(errand_type,0)\n}\nIf(#MemberId# == \"\"){\n SetVar(MemberId, 0)\n}\n\nForm(){\n Div(row mb-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n $@1errand_performer$\n Span(*,text-danger)\n }\n }\n Div(col-md-9 mt-sm text-left){\n If(#errand_type#==0){\n Button(Body: $@1role$, Class: btn-xs btn-primary mr-sm disabled)\n Button(Body: $@1member$, Page: #this_page#, PageParams: \"errand_type=1,type=#type#\", Class: btn-xs btn-default).Popup(50, \"$@1new_errand$\")\n\n }.ElseIf(#errand_type#==1){\n Button(Body: $@1role$, Page: #this_page#, PageParams: \"errand_type=0,type=#type#\", Class: btn-xs btn-default mr-sm).Popup(50, \"$@1new_errand$\")\n Button(Body: $@1member$, Class: btn-xs btn-primary disabled)\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n If(#errand_type#==0){\n $@1choose_role_errand$\n }.ElseIf(#errand_type#==1){\n $@1recipient$\n }\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n If(#errand_type#==0){\n DBFind(@1roles, src_roles).Where({\"ecosystem\": #ecosystem_id#, \"deleted\": 0}).Columns(\"id,role_name\")\n Select(Name: RecRoleId, Source: src_roles, NameColumn: role_name, ValueColumn: id)\n }.ElseIf(#errand_type#==1){\n Input(Name: MemberId, Type:hidden, Value: #MemberId#)\n Div(input-group){\n If(#MemberId# != 0){\n SetVar(AddressMemberId, Address(#MemberId#))\n Input(Name: m_name, Disabled: 1, Value: #AddressMemberId#)\n }.Else{\n Input(Name: m_name, Disabled: 1, Value: \"xxxx-xxxx-xxxx-xxxx-xxxx\")\n }\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:\"back_page=#this_page#,back_header=$@1send$,EcosystemId=#ecosystem_id#\").Popup(Header: $@1member$, Width: \"50\")\n }.Style(\n .buttons{border: 1px solid #dde6e9;}\n )\n }\n }\n }\n }\n If(And(#MemberId# != 0, #errand_type# == 1)){\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n $@1name$\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: ErrandName, Value: $@1new_errand$)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n $@1date_end$\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-6){\n Input(Name: EndDate, Type: date)\n }\n Div(col-md-6){\n Input(Name: EndTime, Type: time, Value: \"00:00\")\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt text-right){\n Label(){\n $@1body_text$\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: ErrandText, Type: textarea)\n }\n }\n }.ElseIf(#errand_type#==0){\n If(#role_type_errand# != 2){\n SetVar(role_type_errand,1)\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n $@1type_role_errand$\n Span(*,text-danger)\n }\n }\n Div(col-md-9 mt-sm text-left){\n If(And(#errand_type#==0,#role_type_errand# == 1)){\n Button(Body: $@1one_role_representative$, Class: btn-xs btn-primary mr-sm disabled)\n Button(Body: $@1all_roles_member$, Page: #this_page#, PageParams: \"errand_type=0,role_type_errand=2\", Class: btn-xs btn-default).Popup(50, \"$@1new_errand$\")\n }.ElseIf(And(#errand_type#==0,#role_type_errand# == 2)){\n Button(Body: $@1one_role_representative$, Page: #this_page#, PageParams: \"errand_type=0,role_type_errand=1\", Class: btn-xs btn-default mr-sm).Popup(50, \"$@1new_errand$\")\n Button(Body: $@1all_roles_member$, Class: btn-xs btn-primary disabled)\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n $@1name$\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: ErrandName, Value: $@1new_errand$)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n $@1date_end$\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-6){\n Input(Name: EndDate, Type: date)\n }\n Div(col-md-6){\n Input(Name: EndTime, Type: time, Value: \"00:00\")\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt text-right){\n Label(){\n $@1body_text$\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: ErrandText, Type: textarea)\n }\n }\n }\n Div(row mt){\n Div(col-md-12){\n Input(Name: SendRoleId, Class: hidden, Value: #role_id#)\n Button(Body: $@1send$, Class: btn btn-primary pull-right, PageParams:\"type=#type#\", Page: @1errand_list, Contract: @1ErrandCreate, Params: \"ErrandType=#errand_type#,RoleTypeErrand=#role_type_errand#\")\n Button(Body: $@1back$, Class: btn btn-default pull-right, PageParams:\"type=#type#\", Page: @1errand_list)\n }\n }\n}", + "Value": "SetVar(this_page, \"@1errand_create\")\n\nIf(#EcosystemId# == #ecosystem_id#){\n SetVar(errand_type,1)\n}\nIf(#errand_type#==\"\"){\n SetVar(errand_type,0)\n}\n\nForm(){\n Div(row mb-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n $@1errand_performer$\n Span(*,text-danger)\n }\n }\n Div(col-md-9 mt-sm text-left){\n If(#errand_type#==0){\n Button(Body: $@1role$, Class: btn-xs btn-primary mr-sm disabled)\n Button(Body: $@1member$, Page: #this_page#, PageParams: \"errand_type=1,type=#type#\", Class: btn-xs btn-default).Popup(50, \"$@1new_errand$\")\n\n }.ElseIf(#errand_type#==1){\n Button(Body: $@1role$, Page: #this_page#, PageParams: \"errand_type=0,type=#type#\", Class: btn-xs btn-default mr-sm).Popup(50, \"$@1new_errand$\")\n Button(Body: $@1member$, Class: btn-xs btn-primary disabled)\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n If(#errand_type#==0){\n $@1choose_role_errand$\n }.ElseIf(#errand_type#==1){\n $@1recipient$\n }\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n If(#errand_type#==0){\n DBFind(\"@1roles\", src_roles).Where({\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0}).Columns(\"id,role_name\")\n Select(Name: RecRoleId, Source: src_roles, NameColumn: role_name, ValueColumn: id)\n }.ElseIf(#errand_type#==1){\n Input(Name: MemberAccount, Type: hidden, Value: #MemberAccount#)\n Div(input-group){\n If(#MemberAccount#){\n Input(Name: m_name, Disabled: 1, Value: #MemberAccount#)\n }.Else{\n Input(Name: m_name, Disabled: 1, Value: \"xxxx-xxxx-xxxx-xxxx-xxxx\")\n }\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:\"back_page=#this_page#,back_header=$@1send$,EcosystemId=#ecosystem_id#\").Popup(Header: $@1member$, Width: \"50\")\n }.Style(\n .buttons{border: 1px solid #dde6e9;}\n )\n }\n }\n }\n }\n If(And(#MemberAccount# != \"\", #errand_type# == 1)){\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n $@1name$\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: ErrandName, Value: $@1new_errand$)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n $@1date_end$\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-6){\n Input(Name: EndDate, Type: date)\n }\n Div(col-md-6){\n Input(Name: EndTime, Type: time, Value: \"00:00\")\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt text-right){\n Label(){\n $@1body_text$\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: ErrandText, Type: textarea)\n }\n }\n }.ElseIf(#errand_type#==0){\n If(#role_type_errand# != 2){\n SetVar(role_type_errand,1)\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n $@1type_role_errand$\n Span(*,text-danger)\n }\n }\n Div(col-md-9 mt-sm text-left){\n If(And(#errand_type#==0,#role_type_errand# == 1)){\n Button(Body: $@1one_role_representative$, Class: btn-xs btn-primary mr-sm disabled)\n Button(Body: $@1all_roles_member$, Page: #this_page#, PageParams: \"errand_type=0,role_type_errand=2\", Class: btn-xs btn-default).Popup(50, \"$@1new_errand$\")\n }.ElseIf(And(#errand_type#==0,#role_type_errand# == 2)){\n Button(Body: $@1one_role_representative$, Page: #this_page#, PageParams: \"errand_type=0,role_type_errand=1\", Class: btn-xs btn-default mr-sm).Popup(50, \"$@1new_errand$\")\n Button(Body: $@1all_roles_member$, Class: btn-xs btn-primary disabled)\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n $@1name$\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: ErrandName, Value: $@1new_errand$)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n $@1date_end$\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-6){\n Input(Name: EndDate, Type: date)\n }\n Div(col-md-6){\n Input(Name: EndTime, Type: time, Value: \"00:00\")\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt text-right){\n Label(){\n $@1body_text$\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: ErrandText, Type: textarea)\n }\n }\n }\n Div(row mt){\n Div(col-md-12){\n Input(Name: SendRoleId, Class: hidden, Value: #role_id#)\n Button(Body: $@1send$, Class: btn btn-primary pull-right, PageParams:\"type=#type#\", Page: @1errand_list, Contract: @1ErrandCreate, Params: \"ErrandType=#errand_type#,RoleTypeErrand=#role_type_errand#\")\n Button(Body: $@1back$, Class: btn btn-default pull-right, PageParams:\"type=#type#\", Page: @1errand_list)\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "errand_list", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1errand_list).(this_table, @1notifications)\nInclude(@1pager_header)\n\nIf(#page_par#!=\"\"){\n SetVar(Name: type, Value: #page_par#)\n}\nIf(And(#type#!=0,#type#!=1)){\n SetVar(Name: type, Value: 0)\n}\n\nSetTitle($@1errands$)\nDBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Errands\"}).Vars(application)\nSetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: errands_admin_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": #ecosystem_id#, \"role->id\": {\"$in\": [#admin_roles#]}, \"member->member_id\": #key_id#, \"deleted\": 0}).Vars(admin_access)\nSetVar(errands_access, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: errands_access))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": #ecosystem_id#, \"$and\": [\"role->id\": {\"$in\": [#errands_access#]}, \"role->id\": #role_id#], \"member->member_id\": #key_id#, \"deleted\": 0}).Vars(create_access)\nIf(#create_access_id# > 0){\n AddToolButton(Title: $@1new_errand$, Page: @1errand_create, PageParams:\"type=#type#\", Icon: icon-plus).Popup(50, \"$@1new_errand$\")\n}\n\nDiv(btn-group){\n Div(btn-group ml-lg){\n If(#type#==0){\n Button(Body: Em(Class: fa fa-user) $@1individual_errands$, Page: @1errand_list, PageParams: \"type=0\", Class: btn bg-gray-lighter ml-sm)\n }.Else{\n Button(Body: Em(Class: fa fa-user) $@1individual_errands$, Page: @1errand_list, PageParams: \"type=0\", Class: btn bg-gray ml-sm)\n }\n If(#type#==1){\n Button(Body: Em(Class: fa fa-users) $@1roles_errands$, Page: @1errand_list, PageParams: \"type=1\", Class: btn bg-gray-lighter ml-sm)\n }.Else{\n Button(Body: Em(Class: fa fa-users) $@1roles_errands$, Page: @1errand_list, PageParams: \"type=1\", Class: btn bg-gray ml-sm)\n }\n If(#admin_access_id#>0){\n Button(Body: Em(Class: fa fa-refresh) $@1update_statuses$, Class: btn btn-default ml-lg, Page: @1errand_list, PageParams: \"type=#type#\", Contract: @1ErrandStatusUpdate)\n }\n }\n Div(btn-group mr-lg pull-right){\n If(#search#){\n Button(Class: btn bg-gray-lighter, Page: @1errand_list, PageParams: \"Status=0,search=#search#,type=#type#\"){Span(Body: Em(Class: fa fa-hourglass-half), Class: text-primary)}\n Button(Class: btn bg-gray-lighter, Page: @1errand_list, PageParams: \"Status=1,search=#search#,type=#type#\"){Span(Body: Em(Class: fa fa-hourglass-end), Class: text-success)}\n Button(Class: btn bg-gray-lighter, Page: @1errand_list, PageParams: \"Status=-1,search=#search#,type=#type#\"){Span(Body: Em(Class: fa fa-times), Class: text-danger)}\n }.Else{\n Button(Class: btn bg-gray-lighter, Page: @1errand_list, PageParams: \"Status=0,type=#type#\"){Span(Body: Em(Class: fa fa-hourglass-half), Class: text-primary)}\n Button(Class: btn bg-gray-lighter, Page: @1errand_list, PageParams: \"Status=1,type=#type#\"){Span(Body: Em(Class: fa fa-hourglass-end), Class: text-success)}\n Button(Class: btn bg-gray-lighter, Page: @1errand_list, PageParams: \"Status=-1,type=#type#\"){Span(Body: Em(Class: fa fa-times), Class: text-danger)}\n }\n }\n If(Or(#search#!=\"\",#Status#==-1,#Status#==0,#Status#==1)){\n Span(Button(Class: btn btn-link pull-right, Page: @1errand_list,PageParams: \"type=#type#\", Body: $@1clear_filters$)).Style(padding-left:10px)\n }\n}\n\nIf(#type#==1){\n SetVar(where_recipient, {\"recipient->role_id\": {\"$neq\": 0}})\n}.Else{\n SetVar(where_recipient, {\"recipient->member_id\": {\"$neq\": 0}})\n}\n\nIf(Or(#Status#==-1,#Status#==0,#Status#==1)){\n SetVar(where_status, {\"page_params->status\": #Status#})\n}\n\nIf(#search#){\n SetVar(where_search, {\"page_params->name\": {\"$ilike\": \"#search#\"}})\n}\n\nSetVar(where, {\"$and\": [{\"ecosystem\": #ecosystem_id#}, {\"page_params->type\": \"task\"}, #where_recipient#, #where_status#, #where_search#]})\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1name)).(page_par, #type#)\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": -1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,ecosystem,page_params->status,page_params->name,recipient->role_name,recipient->role_id,recipient->member_name,recipient->member_id,recipient->image_id,sender->image_id,sender->role_name,sender->role_id,date_created,page_params->date_end\").Custom(_status){\n If(#page_params.status# == 0){\n Span(Body:Em(Class:fa fa-hourglass-half) $@1in_progress$,Class: text-primary h5)\n }.ElseIf(#page_params.status# == -1){\n Span(Body:Em(Class:fa fa-times) $@1expired$,Class: text-danger h5)\n }.ElseIf(#page_params.status# == 1){\n Span(Body:Em(Class:fa fa-hourglass-end) $@1done$,Class: text-success h5)\n }\n}.Custom(_role){\n If(#recipient.role_id# > 0){\n LinkPage(Class: text-primary h5 text-bold, Page: @1roles_view, PageParams: \"v_role_id=#recipient.role_id#\"){\n Div(){\n Span(Class: icon-people fa-2x mr-sm).(#recipient.role_name#)\n }.Style(display:flex; align-items:center;)\n }\n }.ElseIf(#recipient.member_id# != 0){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#recipient.member_id#\"){\n If(#recipient.image_id#>0){\n Image(Src: Binary().ById(#recipient.image_id#), Class: img-circle).Style(height: 30px;width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(#recipient.member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(#recipient.member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n }\n}.Custom(_name){\n LinkPage(#page_params.name#, Class: text-primary h5 text-bold,Page: @1errand_view,PageParams: \"errand_id=#id#,type=#type#\")\n}.Custom(custom_arrow){\n Em(Class: fa fa-long-arrow-right fa-1x)\n}.Custom(_sender){\n LinkPage(Class: text-primary h5 text-bold, Page: @1roles_view, PageParams: \"v_role_id=#sender.role_id#\"){\n If(#sender.image_id#>0){\n Image(Src: Binary().ById(#sender.image_id#), Class: mr-sm).Style(width: 30px; border: 1px solid #5A5D63;)\n #sender.role_name#\n }.Else{\n Div(){\n Span(Class: icon-people fa-2x mr-sm).(#sender.role_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n}.Custom(_date_start){\n Div(Class:h5){DateTime(DateTime: #date_created#, Format: \"YYYY.MM.DD HH:MI:SS\")}\n}.Custom(_date_end){\n Div(Class:h5){Span(#page_params.date_end#)}\n}.Custom(_del){\n If(#admin_access_id#>0){\n Button(Body: Em(Class: text-danger fa fa-trash), Class: btn btn-default pull-right, Contract: @1ErrandDelete, Page: @1errand_list, Params: \"ErrandId=#id#\", PageParams: \"type=#type#\")\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1name$=_name,$@1sender$=_sender,=custom_arrow,$@1recipient$=_role,$@1date_start$=_date_start,$@1date_end$=_date_end,$@1status$=_status,=_del\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1errands$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, @1errand_list).(this_table, @1notifications)\nInclude(@1pager_header)\n\nIf(#page_par#!=\"\"){\n SetVar(Name: type, Value: #page_par#)\n}\nIf(And(#type#!=0,#type#!=1)){\n SetVar(Name: type, Value: 0)\n}\n\nSetTitle($@1errands$)\nDBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Errands\"}).Vars(application)\nSetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: errands_admin_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"role->id\": {\"$in\": [#admin_roles#]}, \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\nSetVar(errands_access, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: errands_access))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#errands_access#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(create_access)\nIf(#create_access_id# > 0){\n AddToolButton(Title: $@1new_errand$, Page: @1errand_create, PageParams: \"type=#type#\", Icon: icon-plus).Popup(50, \"$@1new_errand$\")\n}\n\nDiv(btn-group){\n Div(btn-group ml-lg){\n If(#type#==0){\n Button(Body: Em(Class: fa fa-user) $@1individual_errands$, Page: @1errand_list, PageParams: \"type=0\", Class: btn bg-gray-lighter ml-sm)\n }.Else{\n Button(Body: Em(Class: fa fa-user) $@1individual_errands$, Page: @1errand_list, PageParams: \"type=0\", Class: btn bg-gray ml-sm)\n }\n If(#type#==1){\n Button(Body: Em(Class: fa fa-users) $@1roles_errands$, Page: @1errand_list, PageParams: \"type=1\", Class: btn bg-gray-lighter ml-sm)\n }.Else{\n Button(Body: Em(Class: fa fa-users) $@1roles_errands$, Page: @1errand_list, PageParams: \"type=1\", Class: btn bg-gray ml-sm)\n }\n If(#admin_access_id#>0){\n Button(Body: Em(Class: fa fa-refresh) $@1update_statuses$, Class: btn btn-default ml-lg, Page: @1errand_list, PageParams: \"type=#type#\", Contract: @1ErrandStatusUpdate)\n }\n }\n Div(btn-group mr-lg pull-right){\n If(#search#){\n Button(Class: btn bg-gray-lighter, Page: @1errand_list, PageParams: \"Status=0,search=#search#,type=#type#\"){Span(Body: Em(Class: fa fa-hourglass-half), Class: text-primary)}\n Button(Class: btn bg-gray-lighter, Page: @1errand_list, PageParams: \"Status=1,search=#search#,type=#type#\"){Span(Body: Em(Class: fa fa-hourglass-end), Class: text-success)}\n Button(Class: btn bg-gray-lighter, Page: @1errand_list, PageParams: \"Status=-1,search=#search#,type=#type#\"){Span(Body: Em(Class: fa fa-times), Class: text-danger)}\n }.Else{\n Button(Class: btn bg-gray-lighter, Page: @1errand_list, PageParams: \"Status=0,type=#type#\"){Span(Body: Em(Class: fa fa-hourglass-half), Class: text-primary)}\n Button(Class: btn bg-gray-lighter, Page: @1errand_list, PageParams: \"Status=1,type=#type#\"){Span(Body: Em(Class: fa fa-hourglass-end), Class: text-success)}\n Button(Class: btn bg-gray-lighter, Page: @1errand_list, PageParams: \"Status=-1,type=#type#\"){Span(Body: Em(Class: fa fa-times), Class: text-danger)}\n }\n }\n If(Or(#search# != \"\", #Status# == -1, #Status# == 0, #Status# == 1)){\n Span(Button(Class: btn btn-link pull-right, Page: @1errand_list,PageParams: \"type=#type#\", Body: $@1clear_filters$)).Style(padding-left:10px)\n }\n}\n\nIf(#type# == 1){\n SetVar(where_recipient, `, {\"recipient->role_id\": {\"$neq\": 0}}`)\n}.Else{\n SetVar(where_recipient, `, {\"recipient->account\": {\"$neq\": 0}}`)\n}\n\nIf(Or(#Status# == -1, #Status# == 0, #Status# == 1)){\n SetVar(where_status, `, {\"page_params->status\": #Status#}`)\n}\n\nIf(#search#){\n SetVar(where_search, `, {\"page_params->name\": {\"$ilike\": \"#search#\"}}`)\n}\n\nSetVar(where, {\"$and\": [{\"ecosystem\": \"#ecosystem_id#\"}, {\"page_params->type\": \"task\"} #where_recipient# #where_status# #where_search#]})\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1name)).(page_par, #type#)\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": \"-1\"}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,ecosystem,page_params->status,page_params->name,recipient->role_name,recipient->role_id,recipient->member_name,recipient->account,recipient->image_id,sender->image_id,sender->role_name,sender->role_id,date_created,page_params->date_end\").Custom(_status){\n If(#page_params.status# == 0){\n Span(Body:Em(Class:fa fa-hourglass-half) $@1in_progress$,Class: text-primary h5)\n }.ElseIf(#page_params.status# == -1){\n Span(Body:Em(Class:fa fa-times) $@1expired$,Class: text-danger h5)\n }.ElseIf(#page_params.status# == 1){\n Span(Body:Em(Class:fa fa-hourglass-end) $@1done$,Class: text-success h5)\n }\n}.Custom(_role){\n If(#recipient.role_id# > 0){\n LinkPage(Class: text-primary h5 text-bold, Page: @1roles_view, PageParams: \"v_role_id=#recipient.role_id#\"){\n Div(){\n Span(Class: icon-people fa-2x mr-sm).(#recipient.role_name#)\n }.Style(display:flex; align-items:center;)\n }\n }.ElseIf(#recipient.account#){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#recipient.account#\"){\n If(#recipient.image_id#>0){\n Image(Src: Binary().ById(#recipient.image_id#), Class: img-circle).Style(height: 30px;width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(#recipient.member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(#recipient.member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n }\n}.Custom(_name){\n LinkPage(#page_params.name#, Class: text-primary h5 text-bold,Page: @1errand_view,PageParams: \"errand_id=#id#,type=#type#\")\n}.Custom(custom_arrow){\n Em(Class: fa fa-long-arrow-right fa-1x)\n}.Custom(_sender){\n LinkPage(Class: text-primary h5 text-bold, Page: @1roles_view, PageParams: \"v_role_id=#sender.role_id#\"){\n If(#sender.image_id#>0){\n Image(Src: Binary().ById(#sender.image_id#), Class: mr-sm).Style(width: 30px; border: 1px solid #5A5D63;)\n #sender.role_name#\n }.Else{\n Div(){\n Span(Class: icon-people fa-2x mr-sm).(#sender.role_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n}.Custom(_date_start){\n Div(Class:h5){DateTime(DateTime: #date_created#, Format: \"YYYY.MM.DD HH:MI:SS\")}\n}.Custom(_date_end){\n Div(Class:h5){Span(#page_params.date_end#)}\n}.Custom(_del){\n If(#admin_access_id#>0){\n Button(Body: Em(Class: text-danger fa fa-trash), Class: btn btn-default pull-right, Contract: @1ErrandDelete, Page: @1errand_list, Params: \"ErrandId=#id#\", PageParams: \"type=#type#\")\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1name$=_name,$@1sender$=_sender,=custom_arrow,$@1recipient$=_role,$@1date_start$=_date_start,$@1date_end$=_date_end,$@1status$=_status,=_del\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1errands$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "errand_settings", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Errands\"}).Vars(\"app\")\n\nSetVar(this_page, \"@1errand_settings\").(errands_access,0).(errands_admin_role,0)\nSetVar(errands_access, AppParam(App: #app_id#, Name: \"errands_access\"))\nSetVar(errands_admin_role, AppParam(App: #app_id#, Name: \"errands_admin_role\"))\n\nDBFind(\"@1roles\", src_roles).Where({\"ecosystem\": #ecosystem_id#, \"deleted\": 0}).Columns(\"role_name,id\").Limit(100)\n\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-4 text-right mt-sm\").(col_right,\"col-sm-8 text-left\")\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(@1errands_settings)\n }\n Div(text-center text-muted){\n LangRes(@1errands_settings_description)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n LangRes(@1errands_access_role)\n }\n }\n Div(#col_right#){\n Select(Name: RoleAccess, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #errands_access#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#errands_access# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #errands_access#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(@1errands_admin_role)\n }\n }\n Div(#col_right#){\n Select(Name: RoleAdmin, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #errands_admin_role#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#errands_admin_role# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #errands_admin_role#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1apply_settings$, Class: btn btn-primary, Page: #this_page#, Contract: @1ErrandSettings)\n }\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Errands\"}).Vars(app)\n\nSetVar(this_page, \"@1errand_settings\").(errands_access,0).(errands_admin_role,0)\nSetVar(errands_access, AppParam(App: #app_id#, Name: \"errands_access\"))\nSetVar(errands_admin_role, AppParam(App: #app_id#, Name: \"errands_admin_role\"))\n\nDBFind(\"@1roles\", src_roles).Where({\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0}).Columns(\"role_name,id\").Limit(100)\n\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-4 text-right mt-sm\").(col_right,\"col-sm-8 text-left\")\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(@1errands_settings)\n }\n Div(text-center text-muted){\n LangRes(@1errands_settings_description)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n LangRes(@1errands_access_role)\n }\n }\n Div(#col_right#){\n Select(Name: RoleAccess, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #errands_access#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#errands_access# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#errands_access#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n Div(#row#){\n Div(#col_left#){\n Label(){\n LangRes(@1errands_admin_role)\n }\n }\n Div(#col_right#){\n Select(Name: RoleAdmin, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #errands_admin_role#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#errands_admin_role# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#errands_admin_role#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1apply_settings$, Class: btn btn-primary, Page: #this_page#, Contract: @1ErrandSettings)\n }\n }\n }\n }\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "errand_view", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Div(content-wrapper){\n If(#notific_id#>0){\n DBFind(@1notifications).WhereId(#notific_id#).Columns(\"id,page_params->decision_errand_id,page_params->type,processing_info,closed\").Vars(check_decisions)\n If(And(#check_decisions_page_params_type# == task_decision,#check_decisions_page_params_decision_errand_id# != \"\")){\n SetVar(errand_id,#check_decisions_page_params_decision_errand_id#)\n }.Else{\n SetVar(errand_id,#notific_id#)\n }\n }.ElseIf(#errand_id#>0){\n SetVar(errand_id,#errand_id#)\n }\n\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"id\": #errand_id#}).Columns(\"id,page_params->name,sender->role_id,sender->role_name,sender->image_id,recipient->role_id,recipient->role_name,recipient->image_id,recipient->member_id,recipient->member_name,page_params->status,page_params->date_end,date_created,page_params->text,page_params->answer,processing_info,processing_info->member_id,processing_info->member_name,processing_info->image_id,closed\").Vars(prefix)\n\n Form(row){\n Div(col-md-6 col-md-offset-3){\n Div(list-group-item text-center){\n Span(Class: text-bold h4, Body: #prefix_page_params_name#)\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-5 mt-sm text-right){\n Button(Class: btn-link text-primary h5 text-bold, Page: @1roles_view, PageParams: \"v_role_id=#prefix_sender_role_id#\"){\n If(#prefix_sender_image_id#>0){\n Image(Src: Binary().ById(#sender.image_id#), Class: mr-sm).Style(width: 30px; border: 1px solid #5A5D63;)\n #prefix_sender_role_name#\n }.Else{\n Div(){\n Span(Class: icon-people fa-2x mr-sm).(#prefix_sender_role_name#).Style(word-break: break-all;)\n }.Style(display:flex; align-items:center;)\n }\n }\n }\n Div(col-md-2 mt-sm text-center){\n Em(Class: fa fa-long-arrow-right text-muted fa-2x)\n }.Style(padding-top:12px;)\n Div(col-md-5 mt-sm text-left){\n If(#prefix_recipient_role_id# > 0){\n Button(Class: btn-link text-primary h5 text-bold, Page: @1roles_view, PageParams: \"v_role_id=#prefix_recipient_role_id#\"){\n If(#prefix_recipient_image_id#>0){\n Image(Src: Binary().ById(#sender.image_id#), Class: mr-sm).Style(width: 30px; border: 1px solid #5A5D63;)\n Span(#prefix_recipient_role_name#).Style(word-break: break-all;)\n }.Else{\n Div(){\n Span(Class: icon-people fa-2x mr-sm).(#prefix_recipient_role_name#).Style(word-break: break-all;)\n }.Style(display:flex; align-items:center;)\n }\n }\n }.ElseIf(#prefix_recipient_member_id# != 0){\n Button(Class: btn-link text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#prefix_recipient_member_id#\"){\n If(#prefix_recipient_image_id#>0){\n Image(Src: Binary().ById(#prefix_recipient_image_id#), Class: img-circle).Style(height: 30px;width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(#prefix_recipient_member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(#prefix_recipient_member_name#).Style(word-break: break-all;)\n }.Style(display:flex; align-items:center;)\n }\n }\n }\n }\n }\n Div(row){\n Div(col-md-5 mt-sm text-right){\n Span(Class: h5, Body: $@1status$)\n }\n Div(col-md-2 text-center)\n Div(col-md-5 mt-sm text-left){\n If(#prefix_page_params_status# == 0){\n Span(Body:Em(Class:fa fa-hourglass-half) $@1in_progress$, Class: text-primary h5)\n }.ElseIf(#prefix_page_params_status# == -1){\n Span(Body:Em(Class:fa fa-times) $@1expired$, Class: text-danger h5)\n }.ElseIf(#prefix_page_params_status# == 1){\n Span(Body:Em(Class:fa fa-hourglass-end) $@1done$, Class: text-success h5)\n }\n }\n }\n Div(row){\n Div(col-md-5 mt-sm text-right){\n Span(Class: h5, Body: $@1date_start$)\n }\n Div(col-md-2 mt-sm text-center)\n Div(col-md-5 mt-sm text-left){\n Span(Class: h5){DateTime(DateTime: #prefix_date_created#, Format: \"YYYY.MM.DD HH:MI:SS\")}\n }\n }\n Div(row){\n Div(col-md-5 mt-sm text-right){\n Span(Class: h5, Body: $@1date_end$)\n }\n Div(col-md-2 mt-sm text-center)\n Div(col-md-5 mt-sm text-left){\n Span(#prefix_page_params_date_end#,Class: h5)\n }\n }\n If(And(#prefix_processing_info# != \"\",#prefix_recipient_role_id# > 0)){\n Div(row){\n Div(col-md-5 mt-sm text-right){\n Span(Class: h5, Body: $@1performer_from_role$)\n }\n Div(col-md-2 mt-sm text-center)\n Div(col-md-5 mt-sm text-left){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#prefix_processing_info_member_id#\"){\n Span(#prefix_processing_info_member_name#)\n }\n }\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-12){\n Span(Class: h5 text-bold, Body: $@1errand_text$)\n Div(list-group-item){\n Span(Class: h5, Body: #prefix_page_params_text#)\n }\n }\n }\n If(Or(#prefix_recipient_member_id# == #key_id#,#prefix_processing_info_member_id# == #key_id#)){\n Div(row){\n Div(col-md-12){\n Span(Class: h5 text-bold, Body: $@1answer$)\n If(#prefix_page_params_status# == 0){\n Input(Name: AnswerRecipient, Type: textarea)\n }.Else{\n Div(list-group-item){\n Span(Class: h5, Body: #prefix_page_params_answer#)\n }\n }\n }\n }.Style(padding-top:15px;)\n }.Else{\n If(#prefix_page_params_answer# != \"\"){\n Div(row){\n Div(col-md-12){\n Span(Class: h5, Body: $@1answer$)\n Div(list-group-item){\n Span(Class: h5, Body: #prefix_page_params_answer#)\n }\n }\n }.Style(padding-top:15px;)\n }\n }\n }\n Div(list-group-item text-right){\n If(Or(#prefix_recipient_role_id# == #role_id#, #prefix_recipient_member_id# == #key_id#)){\n If(#prefix_page_params_status# == 0){\n If(Or(#prefix_recipient_member_id# == #key_id#, #prefix_processing_info_member_id# == #key_id#)){\n Button($@1denial$, Class: btn btn-danger pull-left, Page: @1errand_list, PageParams: \"type=#type#\", Contract: @1ErrandDecision, Params: \"ErrandId=#errand_id#,ErrandDecision=-1\")\n Button($@1done$, Class: btn btn-success, Page: @1errand_list, PageParams: \"type=#type#\", Contract: @1ErrandDecision, Params: \"ErrandId=#errand_id#,ErrandDecision=1\")\n }.ElseIf(And(#prefix_recipient_role_id# > 0, #prefix_processing_info# == \"\")){\n If(#notific_id# > 0){\n Button($@1back$, Class: btn btn-default, Page: @1notifications_list)\n }.Else{\n Button($@1back$, Class: btn btn-default, Page: @1errand_list, PageParams: \"type=#type#\")\n }\n Button($@1start_process$, Class: btn btn-primary, Page: @1errand_view, PageParams: \"notific_id=#errand_id#\", Contract: @1NotificationsProcess, Params: \"NotificId=#errand_id#\")\n }\n }.ElseIf(#errand_id# > 0){\n If(#notific_id# > 0){\n DBFind(@1notifications).Where({\"ecosystem\": #ecosystem_id#, \"id\": #notific_id#}).Vars(cl)\n }\n If(#cl_closed# == 0){\n If(#cl_processing_info# == \"\"){\n Button($@1start_process$,Class: btn btn-primary, Page: @1errand_view, PageParams: \"notific_id=#notific_id#\", Contract: @1NotificationsProcess, Params: \"NotificId=#notific_id#\")\n }.Else{\n Button($@1close$, Class: btn btn-default, Page: @1notifications_list, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\")\n }\n }.Else{\n Button($@1back$, Class: btn btn-default, Page: @1errand_list, PageParams: \"type=#type#\")\n }\n }\n }.Else{\n If(#check_decisions_closed# == 0){\n If(#check_decisions_processing_info# == \"\"){\n Button($@1start_process$, Class: btn btn-primary, Page: @1errand_view, PageParams: \"notific_id=#notific_id#\", Contract: @1NotificationsProcess, Params: \"NotificId=#notific_id#\")\n }.Else{\n Button($@1close$, Class: btn btn-default, Page: @1notifications_list, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\")\n }\n }.Else{\n If(#notific_id# > 0){\n Button($@1back$, Class: btn btn-default, Page: @1notifications_list, PageParams: \"type=#type#\")\n }.Else{\n Button($@1back$, Class: btn btn-default, Page: @1errand_list, PageParams: \"type=#type#\")\n }\n }\n }\n }\n }\n }\n}\n", + "Value": "Div(content-wrapper){\n If(#notific_id#>0){\n DBFind(\"@1notifications\").WhereId(#notific_id#).Columns(\"id,page_params->decision_errand_id,page_params->type,processing_info,closed\").Vars(check_decisions)\n If(And(#check_decisions_page_params_type# == task_decision,#check_decisions_page_params_decision_errand_id# != \"\")){\n SetVar(errand_id,#check_decisions_page_params_decision_errand_id#)\n }.Else{\n SetVar(errand_id,#notific_id#)\n }\n }.ElseIf(#errand_id#>0){\n SetVar(errand_id,#errand_id#)\n }\n\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#errand_id#\"}).Columns(\"id,page_params->name,sender->role_id,sender->role_name,sender->image_id,recipient->role_id,recipient->role_name,recipient->image_id,recipient->account,recipient->member_name,page_params->status,page_params->date_end,date_created,page_params->text,page_params->answer,processing_info,processing_info->account,processing_info->member_name,processing_info->image_id,closed\").Vars(prefix)\n\n Form(row){\n Div(col-md-6 col-md-offset-3){\n Div(list-group-item text-center){\n Span(Class: text-bold h4, Body: #prefix_page_params_name#)\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-5 mt-sm text-right){\n Button(Class: btn-link text-primary h5 text-bold, Page: @1roles_view, PageParams: \"v_role_id=#prefix_sender_role_id#\"){\n If(#prefix_sender_image_id#>0){\n Image(Src: Binary().ById(#sender.image_id#), Class: mr-sm).Style(width: 30px; border: 1px solid #5A5D63;)\n #prefix_sender_role_name#\n }.Else{\n Div(){\n Span(Class: icon-people fa-2x mr-sm).(#prefix_sender_role_name#).Style(word-break: break-all;)\n }.Style(display:flex; align-items:center;)\n }\n }\n }\n Div(col-md-2 mt-sm text-center){\n Em(Class: fa fa-long-arrow-right text-muted fa-2x)\n }.Style(padding-top:12px;)\n Div(col-md-5 mt-sm text-left){\n If(#prefix_recipient_role_id# > 0){\n Button(Class: btn-link text-primary h5 text-bold, Page: @1roles_view, PageParams: \"v_role_id=#prefix_recipient_role_id#\"){\n If(#prefix_recipient_image_id#>0){\n Image(Src: Binary().ById(#sender.image_id#), Class: mr-sm).Style(width: 30px; border: 1px solid #5A5D63;)\n Span(#prefix_recipient_role_name#).Style(word-break: break-all;)\n }.Else{\n Div(){\n Span(Class: icon-people fa-2x mr-sm).(#prefix_recipient_role_name#).Style(word-break: break-all;)\n }.Style(display:flex; align-items:center;)\n }\n }\n }.ElseIf(#prefix_recipient_account# != 0){\n Button(Class: btn-link text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#prefix_recipient_account#\"){\n If(#prefix_recipient_image_id#>0){\n Image(Src: Binary().ById(#prefix_recipient_image_id#), Class: img-circle).Style(height: 30px;width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(#prefix_recipient_member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(#prefix_recipient_member_name#).Style(word-break: break-all;)\n }.Style(display:flex; align-items:center;)\n }\n }\n }\n }\n }\n Div(row){\n Div(col-md-5 mt-sm text-right){\n Span(Class: h5, Body: $@1status$)\n }\n Div(col-md-2 text-center)\n Div(col-md-5 mt-sm text-left){\n If(#prefix_page_params_status# == 0){\n Span(Body:Em(Class:fa fa-hourglass-half) $@1in_progress$, Class: text-primary h5)\n }.ElseIf(#prefix_page_params_status# == -1){\n Span(Body:Em(Class:fa fa-times) $@1expired$, Class: text-danger h5)\n }.ElseIf(#prefix_page_params_status# == 1){\n Span(Body:Em(Class:fa fa-hourglass-end) $@1done$, Class: text-success h5)\n }\n }\n }\n Div(row){\n Div(col-md-5 mt-sm text-right){\n Span(Class: h5, Body: $@1date_start$)\n }\n Div(col-md-2 mt-sm text-center)\n Div(col-md-5 mt-sm text-left){\n Span(Class: h5){DateTime(DateTime: #prefix_date_created#, Format: \"YYYY.MM.DD HH:MI:SS\")}\n }\n }\n Div(row){\n Div(col-md-5 mt-sm text-right){\n Span(Class: h5, Body: $@1date_end$)\n }\n Div(col-md-2 mt-sm text-center)\n Div(col-md-5 mt-sm text-left){\n Span(#prefix_page_params_date_end#,Class: h5)\n }\n }\n If(And(#prefix_processing_info# != \"\",#prefix_recipient_role_id# > 0)){\n Div(row){\n Div(col-md-5 mt-sm text-right){\n Span(Class: h5, Body: $@1performer_from_role$)\n }\n Div(col-md-2 mt-sm text-center)\n Div(col-md-5 mt-sm text-left){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#prefix_processing_info_account#\"){\n Span(#prefix_processing_info_member_name#)\n }\n }\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-12){\n Span(Class: h5 text-bold, Body: $@1errand_text$)\n Div(list-group-item){\n Span(Class: h5, Body: #prefix_page_params_text#)\n }\n }\n }\n If(Or(#prefix_recipient_account# == #account_id#, #prefix_processing_info_account# == #account_id#)){\n Div(row){\n Div(col-md-12){\n Span(Class: h5 text-bold, Body: $@1answer$)\n If(#prefix_page_params_status# == 0){\n Input(Name: AnswerRecipient, Type: textarea)\n }.Else{\n Div(list-group-item){\n Span(Class: h5, Body: #prefix_page_params_answer#)\n }\n }\n }\n }.Style(padding-top:15px;)\n }.Else{\n If(#prefix_page_params_answer# != \"\"){\n Div(row){\n Div(col-md-12){\n Span(Class: h5, Body: $@1answer$)\n Div(list-group-item){\n Span(Class: h5, Body: #prefix_page_params_answer#)\n }\n }\n }.Style(padding-top:15px;)\n }\n }\n }\n Div(list-group-item text-right){\n If(Or(#prefix_recipient_role_id# == #role_id#, #prefix_recipient_account# == #account_id#)){\n If(#prefix_page_params_status# == 0){\n If(Or(#prefix_recipient_account# == #account_id#, #prefix_processing_info_account# == #account_id#)){\n Button($@1denial$, Class: btn btn-danger pull-left, Page: @1errand_list, PageParams: \"type=#type#\", Contract: @1ErrandDecision, Params: \"ErrandId=#errand_id#,ErrandDecision=-1\")\n Button($@1done$, Class: btn btn-success, Page: @1errand_list, PageParams: \"type=#type#\", Contract: @1ErrandDecision, Params: \"ErrandId=#errand_id#,ErrandDecision=1\")\n }.ElseIf(And(#prefix_recipient_role_id# > 0, #prefix_processing_info# == \"\")){\n If(#notific_id# > 0){\n Button($@1back$, Class: btn btn-default, Page: @1notifications_list)\n }.Else{\n Button($@1back$, Class: btn btn-default, Page: @1errand_list, PageParams: \"type=#type#\")\n }\n Button($@1start_process$, Class: btn btn-primary, Page: @1errand_view, PageParams: \"notific_id=#errand_id#\", Contract: @1NotificationsProcess, Params: \"NotificId=#errand_id#\")\n }\n }.ElseIf(#errand_id# > 0){\n If(#notific_id# > 0){\n DBFind(\"@1notifications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#notific_id#\"}).Vars(cl)\n }\n If(#cl_closed# == 0){\n If(#cl_processing_info# == \"\"){\n Button($@1start_process$,Class: btn btn-primary, Page: @1errand_view, PageParams: \"notific_id=#notific_id#\", Contract: @1NotificationsProcess, Params: \"NotificId=#notific_id#\")\n }.Else{\n Button($@1close$, Class: btn btn-default, Page: @1notifications_list, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\")\n }\n }.Else{\n Button($@1back$, Class: btn btn-default, Page: @1errand_list, PageParams: \"type=#type#\")\n }\n }\n }.Else{\n If(#check_decisions_closed# == 0){\n If(#check_decisions_processing_info# == \"\"){\n Button($@1start_process$, Class: btn btn-primary, Page: @1errand_view, PageParams: \"notific_id=#notific_id#\", Contract: @1NotificationsProcess, Params: \"NotificId=#notific_id#\")\n }.Else{\n Button($@1close$, Class: btn btn-default, Page: @1notifications_list, Contract: @1NotificationsClose, Params: \"NotificId=#notific_id#\")\n }\n }.Else{\n If(#notific_id# > 0){\n Button($@1back$, Class: btn btn-default, Page: @1notifications_list, PageParams: \"type=#type#\")\n }.Else{\n Button($@1back$, Class: btn btn-default, Page: @1errand_list, PageParams: \"type=#type#\")\n }\n }\n }\n }\n }\n }\n}\n", "Menu": "default_menu", "Type": "pages" }, { "Name": "ErrandCreate", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract ErrandCreate {\n data {\n ErrandType int\n RecRoleId int \"optional\"\n SendRoleId int\n MemberId string \"optional\"\n ErrandName string\n ErrandText string\n RoleTypeErrand int \"optional\"\n EndDate string\n EndTime string \"optional\"\n }\n\n func isCalledFromPage() bool {\n return $stack[0] == Sprintf(\"@%v%v\", $ecosystem_id, $this_contract)\n }\n\n func trimZeroTime(s string) string {\n if Contains(s, \"T00:00:00Z\") {\n s = s Replace(s, \"T00:00:00Z\", \"\")\n }\n return s\n }\n\n func dateAddTime(d, t string) string {\n var dt string\n if Size(t) == 5 {\n dt = Sprintf(\"%v %v:00\", trimZeroTime(d), t)\n }\n return dt\n }\n\n func fixDatetimes() {\n $date_ended = dateAddTime($EndDate, $EndTime)\n\n if UnixDateTime($date_ended) == 0 { // invalid datetimes\n if isCalledFromPage() {\n if Size($EndDate) < 10 {\n warning LangRes(\"@1ending_date_invalid\", \"en\")\n }\n if Size($EndTime) < 5 {\n warning LangRes(\"@1invalid_time_end\", \"en\")\n }\n }\n }\n if UnixDateTime($date_ended) < $block_time{\n warning LangRes(\"@1starting_date_invalid\", \"en\")\n }\n }\n\n conditions {\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Errands\"}).One(\"id\")\n $check_access = AppParam(Int($app), \"errands_access\", $ecosystem_id)\n if $check_access {\n var rids array\n rids = JSONDecode(\"[\"+$check_access+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n } else {\n var admin_ids string\n admin_ids = AppParam(Int($app), \"errands_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+admin_ids+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n if $ErrandType == 0 {\n $valid_role = DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": $RecRoleId, \"deleted\": 0}).One(\"id\")\n if $valid_role == 0 {\n info LangRes(\"@1role_not_found\", \"en\")\n }\n }\n if $ErrandType == 1 {\n if $MemberId == \"\" {\n info LangRes(\"@1empty_wallet\", \"en\")\n }\n $MemberId = AddressToId($MemberId)\n $check_member = DBFind(\"@1members\").Where({\"id\": $MemberId, \"ecosystem\": $ecosystem_id}).One(\"id\")\n if (Int($check_member) == 0){\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": $MemberId}).Columns(\"id\").Row() {\n warning LangRes(\"@1member_not_found\", \"en\")\n }\n }\n if $EndDate == \"\" {\n info LangRes(\"@1ending_date_invalid\", \"en\")\n }\n if $EndTime == \"\" {\n info LangRes(\"@1invalid_time_end\", \"en\")\n }\n if $ErrandName == \"\" {\n info LangRes(\"@1empty_name\", \"en\")\n }\n if $ErrandText == \"\" {\n info LangRes(\"@1empty_text\", \"en\")\n }\n }\n fixDatetimes()\n }\n\n action {\n var info_errand map\n\n info_errand[\"name\"] = $ErrandName\n info_errand[\"text\"] = $ErrandText\n info_errand[\"date_end\"] = $date_ended\n info_errand[\"status\"] = 0\n info_errand[\"type\"] = \"task\"\n if $ErrandType == 0 {\n if $RoleTypeErrand == 2 {\n info_errand[\"recipient_type\"] = 1\n } else{\n info_errand[\"recipient_type\"] = 0\n }\n }\n if $ErrandType == 1 {\n info_errand[\"recipient_type\"] = 1\n }\n\n if $ErrandType == 0 {\n if $RoleTypeErrand == 2 {\n var errands array i lenErrands member_r_id int v map\n errands = DBFind(\"@1roles_participants\").Columns(\"id,role->id,member->member_id,ecosystem,deleted\").Where({\"role->id\": $RecRoleId, \"deleted\": 0, \"ecosystem\": $ecosystem_id})\n lenErrands = Len(errands)\n if lenErrands == 0 {\n info LangRes(\"@1recipient_role_no_members\", \"en\")\n }\n while i < lenErrands{\n v = errands[i]\n member_r_id = Int(v[\"member.member_id\"])\n @1NotificationsSend(\"CurrentRid,MemberId,Sender,Icon,Header,Body,Page,Params,Rid,Closure,EcosystemId\",$SendRoleId,member_r_id, 2, \"icon icon-envelope-open\", LangRes(\"@1new_errand\", \"en\"), LangRes(\"@1details_view\", \"en\"), \"@1errand_view\", info_errand, 0, 0,$ecosystem_id)\n i = i + 1\n }\n } else { \n @1NotificationsSend(\"CurrentRid,Rid,Sender,Icon,Header,Body,Page,Params,Closure,EcosystemId\",$SendRoleId,$RecRoleId, 2, \"icon icon-envelope-open\", LangRes(\"@1new_errand\", \"en\"), LangRes(\"@1details_view\", \"en\"), \"@1errand_view\",info_errand,1,$ecosystem_id)\n }\n }\n if $ErrandType == 1 {\n @1NotificationsSend(\"CurrentRid,MemberId,Sender,Icon,Header,Body,Page,Params,Rid,Closure,EcosystemId\",$SendRoleId,Int($MemberId), 2, \"icon icon-envelope-open\", LangRes(\"@1new_errand\", \"en\"), LangRes(\"@1details_view\", \"en\"), \"@1errand_view\", info_errand, 0, 0,$ecosystem_id)\n }\n }\n}", + "Value": "contract ErrandCreate {\n data {\n ErrandType int\n RecRoleId int \"optional\"\n SendRoleId int\n MemberAccount string \"optional\"\n ErrandName string\n ErrandText string\n RoleTypeErrand int \"optional\"\n EndDate string\n EndTime string \"optional\"\n }\n\n func isCalledFromPage() bool {\n return $stack[0] == Sprintf(\"@%v%v\", $ecosystem_id, $this_contract)\n }\n\n func trimZeroTime(s string) string {\n if Contains(s, \"T00:00:00Z\") {\n s = s Replace(s, \"T00:00:00Z\", \"\")\n }\n return s\n }\n\n func dateAddTime(d, t string) string {\n var dt string\n if Size(t) == 5 {\n dt = Sprintf(\"%v %v:00\", trimZeroTime(d), t)\n }\n return dt\n }\n\n func fixDatetimes() {\n $date_ended = dateAddTime($EndDate, $EndTime)\n\n if UnixDateTime($date_ended) == 0 { // invalid datetimes\n if isCalledFromPage() {\n if Size($EndDate) < 10 {\n warning LangRes(\"@1ending_date_invalid\", \"en\")\n }\n if Size($EndTime) < 5 {\n warning LangRes(\"@1invalid_time_end\", \"en\")\n }\n }\n }\n if UnixDateTime($date_ended) < $block_time{\n warning LangRes(\"@1starting_date_invalid\", \"en\")\n }\n }\n\n conditions {\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Errands\"}).One(\"id\")\n $check_access = AppParam(Int($app), \"errands_access\", $ecosystem_id)\n if $check_access {\n var rids array\n rids = JSONDecode(\"[\"+$check_access+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n } else {\n var admin_ids string\n admin_ids = AppParam(Int($app), \"errands_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+admin_ids+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n if $ErrandType == 0 {\n $valid_role = DBFind(\"@1roles\").Where({\"ecosystem\": $ecosystem_id, \"id\": $RecRoleId, \"deleted\": 0}).One(\"id\")\n if $valid_role == 0 {\n info LangRes(\"@1role_not_found\", \"en\")\n }\n }\n if $ErrandType == 1 {\n if $MemberAccount == \"\" {\n info LangRes(\"@1empty_wallet\", \"en\")\n }\n $check_member = DBFind(\"@1members\").Where({\"account\": $MemberAccount, \"ecosystem\": $ecosystem_id}).One(\"id\")\n if (Int($check_member) == 0){\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": $MemberAccount, \"deleted\": 0}).Row() {\n warning LangRes(\"@1member_not_found\", \"en\")\n }\n }\n if $EndDate == \"\" {\n info LangRes(\"@1ending_date_invalid\", \"en\")\n }\n if $EndTime == \"\" {\n info LangRes(\"@1invalid_time_end\", \"en\")\n }\n if $ErrandName == \"\" {\n info LangRes(\"@1empty_name\", \"en\")\n }\n if $ErrandText == \"\" {\n info LangRes(\"@1empty_text\", \"en\")\n }\n }\n fixDatetimes()\n }\n\n action {\n var info_errand map\n\n info_errand[\"name\"] = $ErrandName\n info_errand[\"text\"] = $ErrandText\n info_errand[\"date_end\"] = $date_ended\n info_errand[\"status\"] = 0\n info_errand[\"type\"] = \"task\"\n if $ErrandType == 0 {\n if $RoleTypeErrand == 2 {\n info_errand[\"recipient_type\"] = 1\n } else{\n info_errand[\"recipient_type\"] = 0\n }\n }\n if $ErrandType == 1 {\n info_errand[\"recipient_type\"] = 1\n }\n\n if $ErrandType == 0 {\n if $RoleTypeErrand == 2 {\n var errands array i lenErrands int v map\n errands = DBFind(\"@1roles_participants\").Where({\"role->id\": $RecRoleId, \"deleted\": 0, \"ecosystem\": $ecosystem_id}).Columns(\"id,role->id,member->account,ecosystem,deleted\")\n lenErrands = Len(errands)\n if lenErrands == 0 {\n info LangRes(\"@1recipient_role_no_members\", \"en\")\n }\n while i < lenErrands{\n v = errands[i]\n @1NotificationsSend(\"CurrentRid,MemberAccount,Sender,Icon,Header,Body,Page,Params,Rid,Closure,EcosystemId\", $SendRoleId, v[\"member.account\"], 2, \"icon icon-envelope-open\", LangRes(\"@1new_errand\", \"en\"), LangRes(\"@1details_view\", \"en\"), \"@1errand_view\", info_errand, 0, 0, $ecosystem_id)\n i = i + 1\n }\n } else { \n @1NotificationsSend(\"CurrentRid,Rid,Sender,Icon,Header,Body,Page,Params,Closure,EcosystemId\", $SendRoleId, $RecRoleId, 2, \"icon icon-envelope-open\", LangRes(\"@1new_errand\", \"en\"), LangRes(\"@1details_view\", \"en\"), \"@1errand_view\", info_errand, 1, $ecosystem_id)\n }\n }\n if $ErrandType == 1 {\n @1NotificationsSend(\"CurrentRid,MemberAccount,Sender,Icon,Header,Body,Page,Params,Rid,Closure,EcosystemId\", $SendRoleId, $MemberAccount, 2, \"icon icon-envelope-open\", LangRes(\"@1new_errand\", \"en\"), LangRes(\"@1details_view\", \"en\"), \"@1errand_view\", info_errand, 0, 0, $ecosystem_id)\n }\n }\n}", "Type": "contracts" }, { "Name": "ErrandDecision", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract ErrandDecision {\n data {\n ErrandDecision int\n ErrandId int\n AnswerRecipient string\n }\n\n conditions {\n if $AnswerRecipient == \"\" {\n info LangRes(\"@1empty_answer\", \"en\")\n }\n $errand_map = DBFind(\"@1notifications\").Where({\"id\": $ErrandId}).Columns(\"id,processing_info,processing_info->member_id,page_params,page_params->name,page_params->text,page_params->type,page_params->date_end,closed,recipient->role_id,recipient->member_id,page_params->recipient_type,sender->role_id\").Row()\n if Int($errand_map[\"page_params.recipient_type\"]) == 0 { //role errand\n if !RoleAccess(Int($errand_map[\"recipient.role_id\"])) {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n if $errand_map[\"processing_info\"] == \"\" {\n info LangRes(\"@1start_process_errand\", \"en\")\n }\n if Int($errand_map[\"processing_info.member_id\"]) != $key_id {\n info LangRes(\"@1another_start_process_errand\", \"en\")\n }\n } else { //member errand\n if Int($errand_map[\"recipient.member_id\"]) != $key_id {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n if $errand_map[\"closed\"] != 0 {\n info LangRes(\"@1already_start_process_errand\", \"en\")\n }\n }\n\n action {\n var answer_map map\n answer_map[\"name\"] = $errand_map[\"page_params.name\"]\n answer_map[\"text\"] = $errand_map[\"page_params.text\"]\n answer_map[\"type\"] = $errand_map[\"page_params.type\"]\n answer_map[\"date_end\"] = $errand_map[\"page_params.date_end\"]\n answer_map[\"answer\"] = $AnswerRecipient\n\n if $ErrandDecision == 1 {\n answer_map[\"status\"] = 1\n } else {\n answer_map[\"status\"] = -1\n }\n var page_params_edit map\n page_params_edit[\"page_params\"] = answer_map\n\n @1NotificationsUpdateParams(\"Params,NotificId\",page_params_edit,$ErrandId)\n\n if Int($errand_map[\"page_params.recipient_type\"]) == 0 {\n var info_errand map\n info_errand[\"decision_errand_id\"] = $ErrandId\n info_errand[\"type\"] = \"task_decision\"\n @1NotificationsSend(\"CurrentRid,Rid,Sender,Icon,Header,Body,Page,Params,Closure,EcosystemId\",\n Int($errand_map[\"recipient.role_id\"]), Int($errand_map[\"sender.role_id\"]), 2, \"icon icon-envelope-open\", \"Decision by errand\", LangRes(\"@1details_view\", \"en\"), \"@1errand_view\", info_errand, 1, $ecosystem_id)\n } else {\n var info_errand map\n info_errand[\"decision_errand_id\"] = $ErrandId\n info_errand[\"type\"] = \"task_decision\"\n @1NotificationsSend(\"Rid,Sender,Icon,Header,Body,Page,Params,Closure,EcosystemId\",\n Int($errand_map[\"sender.role_id\"]), 1, \"icon icon-envelope-open\", \"Decision by errand\", LangRes(\"@1details_view\", \"en\"), \"@1errand_view\", info_errand, 1, $ecosystem_id)\n }\n @1NotificationsClose(\"NotificId\", $ErrandId)\n }\n}", + "Value": "contract ErrandDecision {\n data {\n ErrandDecision int\n ErrandId int\n AnswerRecipient string\n }\n\n conditions {\n if $AnswerRecipient == \"\" {\n info LangRes(\"@1empty_answer\", \"en\")\n }\n $errand_map = DBFind(\"@1notifications\").Where({\"id\": $ErrandId}).Columns(\"id,processing_info,processing_info->account,page_params,page_params->name,page_params->text,page_params->type,page_params->date_end,closed,recipient->role_id,recipient->account,page_params->recipient_type,sender->role_id\").Row()\n if Int($errand_map[\"page_params.recipient_type\"]) == 0 { //role errand\n if !RoleAccess(Int($errand_map[\"recipient.role_id\"])) {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n if $errand_map[\"processing_info\"] == \"\" {\n info LangRes(\"@1start_process_errand\", \"en\")\n }\n if $errand_map[\"processing_info.account\"] != $account_id {\n info LangRes(\"@1another_start_process_errand\", \"en\")\n }\n } else { //member errand\n if $errand_map[\"recipient.account\"] != $account_id {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n if $errand_map[\"closed\"] != 0 {\n info LangRes(\"@1already_start_process_errand\", \"en\")\n }\n }\n\n action {\n var answer_map map\n answer_map[\"name\"] = $errand_map[\"page_params.name\"]\n answer_map[\"text\"] = $errand_map[\"page_params.text\"]\n answer_map[\"type\"] = $errand_map[\"page_params.type\"]\n answer_map[\"date_end\"] = $errand_map[\"page_params.date_end\"]\n answer_map[\"answer\"] = $AnswerRecipient\n\n if $ErrandDecision == 1 {\n answer_map[\"status\"] = 1\n } else {\n answer_map[\"status\"] = -1\n }\n var page_params_edit map\n page_params_edit[\"page_params\"] = answer_map\n\n @1NotificationsUpdateParams(\"Params,NotificId\",page_params_edit,$ErrandId)\n\n if Int($errand_map[\"page_params.recipient_type\"]) == 0 {\n var info_errand map\n info_errand[\"decision_errand_id\"] = $ErrandId\n info_errand[\"type\"] = \"task_decision\"\n @1NotificationsSend(\"CurrentRid,Rid,Sender,Icon,Header,Body,Page,Params,Closure,EcosystemId\",\n Int($errand_map[\"recipient.role_id\"]), Int($errand_map[\"sender.role_id\"]), 2, \"icon icon-envelope-open\", \"Decision by errand\", LangRes(\"@1details_view\", \"en\"), \"@1errand_view\", info_errand, 1, $ecosystem_id)\n } else {\n var info_errand map\n info_errand[\"decision_errand_id\"] = $ErrandId\n info_errand[\"type\"] = \"task_decision\"\n @1NotificationsSend(\"Rid,Sender,Icon,Header,Body,Page,Params,Closure,EcosystemId\",\n Int($errand_map[\"sender.role_id\"]), 1, \"icon icon-envelope-open\", \"Decision by errand\", LangRes(\"@1details_view\", \"en\"), \"@1errand_view\", info_errand, 1, $ecosystem_id)\n }\n @1NotificationsClose(\"NotificId\", $ErrandId)\n }\n}", "Type": "contracts" }, { "Name": "ErrandDelete", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract ErrandDelete {\n data {\n ErrandId int\n }\n\n conditions {\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Errands\"}).One(\"id\")\n var admin_ids string\n admin_ids = AppParam(Int($app), \"errands_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+admin_ids+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n\n action {\n var page_params_edit map\n page_params_edit[\"page_params->type\"] = \"deleted\"\n \n @1NotificationsUpdateParams(\"Params,NotificId\", page_params_edit, $ErrandId)\n @1NotificationsClose(\"NotificId\", $ErrandId)\n }\n}", + "Value": "contract ErrandDelete {\n data {\n ErrandId int\n }\n\n conditions {\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Errands\"}).One(\"id\")\n var admin_ids string\n admin_ids = AppParam(Int($app), \"errands_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+admin_ids+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n\n action {\n var page_params_edit map\n page_params_edit[\"page_params->type\"] = \"deleted\"\n \n @1NotificationsUpdateParams(\"Params,NotificId\", page_params_edit, $ErrandId)\n @1NotificationsClose(\"NotificId\", $ErrandId)\n }\n}", "Type": "contracts" }, { @@ -87,7 +87,7 @@ { "Name": "ErrandStatusUpdate", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract ErrandStatusUpdate {\n\n conditions {\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Errands\"}).One(\"id\")\n var admin_ids string\n admin_ids = AppParam(Int($app), \"errands_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+admin_ids+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n\n action {\n var bt string\n bt = BlockTime()\n\n var errands array i lenErrands int v page_params_edit map\n errands = DBFind(\"@1notifications\").Columns(\"id,page_params->date_end,page_params->type,page_params->status\").Where({\"page_params->type\": \"task\", \"page_params->date_end\": {\"$lte\": bt}, \"page_params->status\": 0})\n lenErrands = Len(errands)\n page_params_edit[\"page_params->status\"] = -1\n while i < lenErrands {\n v = errands[i]\n @1NotificationsUpdateParams(\"Params,NotificId\", page_params_edit, Int(v[\"id\"]))\n i = i + 1\n }\n }\n}", + "Value": "contract ErrandStatusUpdate {\n\n conditions {\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Errands\"}).One(\"id\")\n var admin_ids string\n admin_ids = AppParam(Int($app), \"errands_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+admin_ids+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n }\n\n action {\n var bt string\n bt = BlockTime()\n\n var errands array i lenErrands int v page_params_edit map\n errands = DBFind(\"@1notifications\").Where({\"page_params->type\": \"task\", \"page_params->date_end\": {\"$lte\": bt}, \"page_params->status\": 0}).Columns(\"id,page_params->date_end,page_params->type,page_params->status\")\n lenErrands = Len(errands)\n page_params_edit[\"page_params->status\"] = -1\n while i < lenErrands {\n v = errands[i]\n @1NotificationsUpdateParams(\"Params,NotificId\", page_params_edit, Int(v[\"id\"]))\n i = i + 1\n }\n }\n}", "Type": "contracts" } ] diff --git a/platform_apps/errands/contracts/ErrandCreate.sim b/platform_apps/errands/contracts/ErrandCreate.sim index 5918351df..f6c79a041 100644 --- a/platform_apps/errands/contracts/ErrandCreate.sim +++ b/platform_apps/errands/contracts/ErrandCreate.sim @@ -3,7 +3,7 @@ contract ErrandCreate { ErrandType int RecRoleId int "optional" SendRoleId int - MemberId string "optional" + MemberAccount string "optional" ErrandName string ErrandText string RoleTypeErrand int "optional" @@ -54,7 +54,7 @@ contract ErrandCreate { if $check_access { var rids array rids = JSONDecode("["+$check_access+"]") - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() { warning LangRes("@1access_denied", "en") } } else { @@ -62,7 +62,7 @@ contract ErrandCreate { admin_ids = AppParam(Int($app), "errands_admin_role", $ecosystem_id) var rids array rids = JSONDecode("["+admin_ids+"]") - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() { warning LangRes("@1access_denied", "en") } } @@ -73,13 +73,12 @@ contract ErrandCreate { } } if $ErrandType == 1 { - if $MemberId == "" { + if $MemberAccount == "" { info LangRes("@1empty_wallet", "en") } - $MemberId = AddressToId($MemberId) - $check_member = DBFind("@1members").Where({"id": $MemberId, "ecosystem": $ecosystem_id}).One("id") + $check_member = DBFind("@1members").Where({"account": $MemberAccount, "ecosystem": $ecosystem_id}).One("id") if (Int($check_member) == 0){ - if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": $MemberId}).Columns("id").Row() { + if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": $MemberAccount, "deleted": 0}).Row() { warning LangRes("@1member_not_found", "en") } } @@ -120,24 +119,23 @@ contract ErrandCreate { if $ErrandType == 0 { if $RoleTypeErrand == 2 { - var errands array i lenErrands member_r_id int v map - errands = DBFind("@1roles_participants").Columns("id,role->id,member->member_id,ecosystem,deleted").Where({"role->id": $RecRoleId, "deleted": 0, "ecosystem": $ecosystem_id}) + var errands array i lenErrands int v map + errands = DBFind("@1roles_participants").Where({"role->id": $RecRoleId, "deleted": 0, "ecosystem": $ecosystem_id}).Columns("id,role->id,member->account,ecosystem,deleted") lenErrands = Len(errands) if lenErrands == 0 { info LangRes("@1recipient_role_no_members", "en") } while i < lenErrands{ v = errands[i] - member_r_id = Int(v["member.member_id"]) - @1NotificationsSend("CurrentRid,MemberId,Sender,Icon,Header,Body,Page,Params,Rid,Closure,EcosystemId",$SendRoleId,member_r_id, 2, "icon icon-envelope-open", LangRes("@1new_errand", "en"), LangRes("@1details_view", "en"), "@1errand_view", info_errand, 0, 0,$ecosystem_id) + @1NotificationsSend("CurrentRid,MemberAccount,Sender,Icon,Header,Body,Page,Params,Rid,Closure,EcosystemId", $SendRoleId, v["member.account"], 2, "icon icon-envelope-open", LangRes("@1new_errand", "en"), LangRes("@1details_view", "en"), "@1errand_view", info_errand, 0, 0, $ecosystem_id) i = i + 1 } } else { - @1NotificationsSend("CurrentRid,Rid,Sender,Icon,Header,Body,Page,Params,Closure,EcosystemId",$SendRoleId,$RecRoleId, 2, "icon icon-envelope-open", LangRes("@1new_errand", "en"), LangRes("@1details_view", "en"), "@1errand_view",info_errand,1,$ecosystem_id) + @1NotificationsSend("CurrentRid,Rid,Sender,Icon,Header,Body,Page,Params,Closure,EcosystemId", $SendRoleId, $RecRoleId, 2, "icon icon-envelope-open", LangRes("@1new_errand", "en"), LangRes("@1details_view", "en"), "@1errand_view", info_errand, 1, $ecosystem_id) } } if $ErrandType == 1 { - @1NotificationsSend("CurrentRid,MemberId,Sender,Icon,Header,Body,Page,Params,Rid,Closure,EcosystemId",$SendRoleId,Int($MemberId), 2, "icon icon-envelope-open", LangRes("@1new_errand", "en"), LangRes("@1details_view", "en"), "@1errand_view", info_errand, 0, 0,$ecosystem_id) + @1NotificationsSend("CurrentRid,MemberAccount,Sender,Icon,Header,Body,Page,Params,Rid,Closure,EcosystemId", $SendRoleId, $MemberAccount, 2, "icon icon-envelope-open", LangRes("@1new_errand", "en"), LangRes("@1details_view", "en"), "@1errand_view", info_errand, 0, 0, $ecosystem_id) } } } \ No newline at end of file diff --git a/platform_apps/errands/contracts/ErrandDecision.sim b/platform_apps/errands/contracts/ErrandDecision.sim index 898c1fcab..ee93e1e49 100644 --- a/platform_apps/errands/contracts/ErrandDecision.sim +++ b/platform_apps/errands/contracts/ErrandDecision.sim @@ -9,7 +9,7 @@ contract ErrandDecision { if $AnswerRecipient == "" { info LangRes("@1empty_answer", "en") } - $errand_map = DBFind("@1notifications").Where({"id": $ErrandId}).Columns("id,processing_info,processing_info->member_id,page_params,page_params->name,page_params->text,page_params->type,page_params->date_end,closed,recipient->role_id,recipient->member_id,page_params->recipient_type,sender->role_id").Row() + $errand_map = DBFind("@1notifications").Where({"id": $ErrandId}).Columns("id,processing_info,processing_info->account,page_params,page_params->name,page_params->text,page_params->type,page_params->date_end,closed,recipient->role_id,recipient->account,page_params->recipient_type,sender->role_id").Row() if Int($errand_map["page_params.recipient_type"]) == 0 { //role errand if !RoleAccess(Int($errand_map["recipient.role_id"])) { warning LangRes("@1access_denied", "en") @@ -17,11 +17,11 @@ contract ErrandDecision { if $errand_map["processing_info"] == "" { info LangRes("@1start_process_errand", "en") } - if Int($errand_map["processing_info.member_id"]) != $key_id { + if $errand_map["processing_info.account"] != $account_id { info LangRes("@1another_start_process_errand", "en") } } else { //member errand - if Int($errand_map["recipient.member_id"]) != $key_id { + if $errand_map["recipient.account"] != $account_id { warning LangRes("@1access_denied", "en") } } diff --git a/platform_apps/errands/contracts/ErrandDelete.sim b/platform_apps/errands/contracts/ErrandDelete.sim index 7c6eef25b..2b655d285 100644 --- a/platform_apps/errands/contracts/ErrandDelete.sim +++ b/platform_apps/errands/contracts/ErrandDelete.sim @@ -9,7 +9,7 @@ contract ErrandDelete { admin_ids = AppParam(Int($app), "errands_admin_role", $ecosystem_id) var rids array rids = JSONDecode("["+admin_ids+"]") - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() { warning LangRes("@1access_denied", "en") } } diff --git a/platform_apps/errands/contracts/ErrandStatusUpdate.sim b/platform_apps/errands/contracts/ErrandStatusUpdate.sim index 26415170c..15c0df3f6 100644 --- a/platform_apps/errands/contracts/ErrandStatusUpdate.sim +++ b/platform_apps/errands/contracts/ErrandStatusUpdate.sim @@ -6,7 +6,7 @@ contract ErrandStatusUpdate { admin_ids = AppParam(Int($app), "errands_admin_role", $ecosystem_id) var rids array rids = JSONDecode("["+admin_ids+"]") - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() { warning LangRes("@1access_denied", "en") } } @@ -16,7 +16,7 @@ contract ErrandStatusUpdate { bt = BlockTime() var errands array i lenErrands int v page_params_edit map - errands = DBFind("@1notifications").Columns("id,page_params->date_end,page_params->type,page_params->status").Where({"page_params->type": "task", "page_params->date_end": {"$lte": bt}, "page_params->status": 0}) + errands = DBFind("@1notifications").Where({"page_params->type": "task", "page_params->date_end": {"$lte": bt}, "page_params->status": 0}).Columns("id,page_params->date_end,page_params->type,page_params->status") lenErrands = Len(errands) page_params_edit["page_params->status"] = -1 while i < lenErrands { diff --git a/platform_apps/errands/pages/errand_create.ptl b/platform_apps/errands/pages/errand_create.ptl index 42ecc6d9f..dca2ed12d 100644 --- a/platform_apps/errands/pages/errand_create.ptl +++ b/platform_apps/errands/pages/errand_create.ptl @@ -1,4 +1,4 @@ -SetVar(this_page,"@1errand_create") +SetVar(this_page, "@1errand_create") If(#EcosystemId# == #ecosystem_id#){ SetVar(errand_type,1) @@ -6,9 +6,6 @@ If(#EcosystemId# == #ecosystem_id#){ If(#errand_type#==""){ SetVar(errand_type,0) } -If(#MemberId# == ""){ - SetVar(MemberId, 0) -} Form(){ Div(row mb-sm){ @@ -42,14 +39,13 @@ Form(){ } Div(col-md-9 text-left){ If(#errand_type#==0){ - DBFind(@1roles, src_roles).Where({"ecosystem": #ecosystem_id#, "deleted": 0}).Columns("id,role_name") + DBFind("@1roles", src_roles).Where({"ecosystem": "#ecosystem_id#", "deleted": 0}).Columns("id,role_name") Select(Name: RecRoleId, Source: src_roles, NameColumn: role_name, ValueColumn: id) }.ElseIf(#errand_type#==1){ - Input(Name: MemberId, Type:hidden, Value: #MemberId#) + Input(Name: MemberAccount, Type: hidden, Value: #MemberAccount#) Div(input-group){ - If(#MemberId# != 0){ - SetVar(AddressMemberId, Address(#MemberId#)) - Input(Name: m_name, Disabled: 1, Value: #AddressMemberId#) + If(#MemberAccount#){ + Input(Name: m_name, Disabled: 1, Value: #MemberAccount#) }.Else{ Input(Name: m_name, Disabled: 1, Value: "xxxx-xxxx-xxxx-xxxx-xxxx") } @@ -62,7 +58,7 @@ Form(){ } } } - If(And(#MemberId# != 0, #errand_type# == 1)){ + If(And(#MemberAccount# != "", #errand_type# == 1)){ Div(row mt-sm){ Div(col-md-3 mt-sm text-right){ Label(){ diff --git a/platform_apps/errands/pages/errand_list.ptl b/platform_apps/errands/pages/errand_list.ptl index 671fdf5ed..94caba989 100644 --- a/platform_apps/errands/pages/errand_list.ptl +++ b/platform_apps/errands/pages/errand_list.ptl @@ -9,13 +9,13 @@ If(And(#type#!=0,#type#!=1)){ } SetTitle($@1errands$) -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Errands"}).Vars(application) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Errands"}).Vars(application) SetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: errands_admin_role)) -DBFind("@1roles_participants").Where({"ecosystem": #ecosystem_id#, "role->id": {"$in": [#admin_roles#]}, "member->member_id": #key_id#, "deleted": 0}).Vars(admin_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "role->id": {"$in": [#admin_roles#]}, "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) SetVar(errands_access, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: errands_access)) -DBFind("@1roles_participants").Where({"ecosystem": #ecosystem_id#, "$and": ["role->id": {"$in": [#errands_access#]}, "role->id": #role_id#], "member->member_id": #key_id#, "deleted": 0}).Vars(create_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#errands_access#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(create_access) If(#create_access_id# > 0){ - AddToolButton(Title: $@1new_errand$, Page: @1errand_create, PageParams:"type=#type#", Icon: icon-plus).Popup(50, "$@1new_errand$") + AddToolButton(Title: $@1new_errand$, Page: @1errand_create, PageParams: "type=#type#", Icon: icon-plus).Popup(50, "$@1new_errand$") } Div(btn-group){ @@ -45,33 +45,33 @@ Div(btn-group){ Button(Class: btn bg-gray-lighter, Page: @1errand_list, PageParams: "Status=-1,type=#type#"){Span(Body: Em(Class: fa fa-times), Class: text-danger)} } } - If(Or(#search#!="",#Status#==-1,#Status#==0,#Status#==1)){ + If(Or(#search# != "", #Status# == -1, #Status# == 0, #Status# == 1)){ Span(Button(Class: btn btn-link pull-right, Page: @1errand_list,PageParams: "type=#type#", Body: $@1clear_filters$)).Style(padding-left:10px) } } -If(#type#==1){ - SetVar(where_recipient, {"recipient->role_id": {"$neq": 0}}) +If(#type# == 1){ + SetVar(where_recipient, `, {"recipient->role_id": {"$neq": 0}}`) }.Else{ - SetVar(where_recipient, {"recipient->member_id": {"$neq": 0}}) + SetVar(where_recipient, `, {"recipient->account": {"$neq": 0}}`) } -If(Or(#Status#==-1,#Status#==0,#Status#==1)){ - SetVar(where_status, {"page_params->status": #Status#}) +If(Or(#Status# == -1, #Status# == 0, #Status# == 1)){ + SetVar(where_status, `, {"page_params->status": #Status#}`) } If(#search#){ - SetVar(where_search, {"page_params->name": {"$ilike": "#search#"}}) + SetVar(where_search, `, {"page_params->name": {"$ilike": "#search#"}}`) } -SetVar(where, {"$and": [{"ecosystem": #ecosystem_id#}, {"page_params->type": "task"}, #where_recipient#, #where_status#, #where_search#]}) +SetVar(where, {"$and": [{"ecosystem": "#ecosystem_id#"}, {"page_params->type": "task"} #where_recipient# #where_status# #where_search#]}) Div(list-group-item ml-lg mr-lg pt-lg){ SetVar(search_name, LangRes(@1name)).(page_par, #type#) Include(@1search) } -DBFind(#this_table#, src).Where(#where#).Order({"id": -1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("id,ecosystem,page_params->status,page_params->name,recipient->role_name,recipient->role_id,recipient->member_name,recipient->member_id,recipient->image_id,sender->image_id,sender->role_name,sender->role_id,date_created,page_params->date_end").Custom(_status){ +DBFind(#this_table#, src).Where(#where#).Order({"id": "-1"}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("id,ecosystem,page_params->status,page_params->name,recipient->role_name,recipient->role_id,recipient->member_name,recipient->account,recipient->image_id,sender->image_id,sender->role_name,sender->role_id,date_created,page_params->date_end").Custom(_status){ If(#page_params.status# == 0){ Span(Body:Em(Class:fa fa-hourglass-half) $@1in_progress$,Class: text-primary h5) }.ElseIf(#page_params.status# == -1){ @@ -86,8 +86,8 @@ DBFind(#this_table#, src).Where(#where#).Order({"id": -1}).Limit(#pager_limit#). Span(Class: icon-people fa-2x mr-sm).(#recipient.role_name#) }.Style(display:flex; align-items:center;) } - }.ElseIf(#recipient.member_id# != 0){ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#recipient.member_id#"){ + }.ElseIf(#recipient.account#){ + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#recipient.account#"){ If(#recipient.image_id#>0){ Image(Src: Binary().ById(#recipient.image_id#), Class: img-circle).Style(height: 30px;width: 30px; border: 1px solid #5A5D63; margin-right: 10px;) Span(#recipient.member_name#) diff --git a/platform_apps/errands/pages/errand_settings.ptl b/platform_apps/errands/pages/errand_settings.ptl index 3d88ef053..fe203382d 100644 --- a/platform_apps/errands/pages/errand_settings.ptl +++ b/platform_apps/errands/pages/errand_settings.ptl @@ -1,10 +1,10 @@ -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Errands"}).Vars("app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Errands"}).Vars(app) SetVar(this_page, "@1errand_settings").(errands_access,0).(errands_admin_role,0) SetVar(errands_access, AppParam(App: #app_id#, Name: "errands_access")) SetVar(errands_admin_role, AppParam(App: #app_id#, Name: "errands_admin_role")) -DBFind("@1roles", src_roles).Where({"ecosystem": #ecosystem_id#, "deleted": 0}).Columns("role_name,id").Limit(100) +DBFind("@1roles", src_roles).Where({"ecosystem": "#ecosystem_id#", "deleted": 0}).Columns("role_name,id").Limit(100) SetVar(row,"row mt-sm").(col_left,"col-sm-4 text-right mt-sm").(col_right,"col-sm-8 text-left") @@ -30,7 +30,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#errands_access# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #errands_access#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#errands_access#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# @@ -48,7 +48,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#errands_admin_role# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #errands_admin_role#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#errands_admin_role#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# diff --git a/platform_apps/errands/pages/errand_view.ptl b/platform_apps/errands/pages/errand_view.ptl index ebdb7abd3..f7816d410 100644 --- a/platform_apps/errands/pages/errand_view.ptl +++ b/platform_apps/errands/pages/errand_view.ptl @@ -1,6 +1,6 @@ Div(content-wrapper){ If(#notific_id#>0){ - DBFind(@1notifications).WhereId(#notific_id#).Columns("id,page_params->decision_errand_id,page_params->type,processing_info,closed").Vars(check_decisions) + DBFind("@1notifications").WhereId(#notific_id#).Columns("id,page_params->decision_errand_id,page_params->type,processing_info,closed").Vars(check_decisions) If(And(#check_decisions_page_params_type# == task_decision,#check_decisions_page_params_decision_errand_id# != "")){ SetVar(errand_id,#check_decisions_page_params_decision_errand_id#) }.Else{ @@ -10,7 +10,7 @@ Div(content-wrapper){ SetVar(errand_id,#errand_id#) } - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "id": #errand_id#}).Columns("id,page_params->name,sender->role_id,sender->role_name,sender->image_id,recipient->role_id,recipient->role_name,recipient->image_id,recipient->member_id,recipient->member_name,page_params->status,page_params->date_end,date_created,page_params->text,page_params->answer,processing_info,processing_info->member_id,processing_info->member_name,processing_info->image_id,closed").Vars(prefix) + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "id": "#errand_id#"}).Columns("id,page_params->name,sender->role_id,sender->role_name,sender->image_id,recipient->role_id,recipient->role_name,recipient->image_id,recipient->account,recipient->member_name,page_params->status,page_params->date_end,date_created,page_params->text,page_params->answer,processing_info,processing_info->account,processing_info->member_name,processing_info->image_id,closed").Vars(prefix) Form(row){ Div(col-md-6 col-md-offset-3){ @@ -46,8 +46,8 @@ Div(content-wrapper){ }.Style(display:flex; align-items:center;) } } - }.ElseIf(#prefix_recipient_member_id# != 0){ - Button(Class: btn-link text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#prefix_recipient_member_id#"){ + }.ElseIf(#prefix_recipient_account# != 0){ + Button(Class: btn-link text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#prefix_recipient_account#"){ If(#prefix_recipient_image_id#>0){ Image(Src: Binary().ById(#prefix_recipient_image_id#), Class: img-circle).Style(height: 30px;width: 30px; border: 1px solid #5A5D63; margin-right: 10px;) Span(#prefix_recipient_member_name#) @@ -101,7 +101,7 @@ Div(content-wrapper){ } Div(col-md-2 mt-sm text-center) Div(col-md-5 mt-sm text-left){ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#prefix_processing_info_member_id#"){ + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#prefix_processing_info_account#"){ Span(#prefix_processing_info_member_name#) } } @@ -117,7 +117,7 @@ Div(content-wrapper){ } } } - If(Or(#prefix_recipient_member_id# == #key_id#,#prefix_processing_info_member_id# == #key_id#)){ + If(Or(#prefix_recipient_account# == #account_id#, #prefix_processing_info_account# == #account_id#)){ Div(row){ Div(col-md-12){ Span(Class: h5 text-bold, Body: $@1answer$) @@ -144,9 +144,9 @@ Div(content-wrapper){ } } Div(list-group-item text-right){ - If(Or(#prefix_recipient_role_id# == #role_id#, #prefix_recipient_member_id# == #key_id#)){ + If(Or(#prefix_recipient_role_id# == #role_id#, #prefix_recipient_account# == #account_id#)){ If(#prefix_page_params_status# == 0){ - If(Or(#prefix_recipient_member_id# == #key_id#, #prefix_processing_info_member_id# == #key_id#)){ + If(Or(#prefix_recipient_account# == #account_id#, #prefix_processing_info_account# == #account_id#)){ Button($@1denial$, Class: btn btn-danger pull-left, Page: @1errand_list, PageParams: "type=#type#", Contract: @1ErrandDecision, Params: "ErrandId=#errand_id#,ErrandDecision=-1") Button($@1done$, Class: btn btn-success, Page: @1errand_list, PageParams: "type=#type#", Contract: @1ErrandDecision, Params: "ErrandId=#errand_id#,ErrandDecision=1") }.ElseIf(And(#prefix_recipient_role_id# > 0, #prefix_processing_info# == "")){ @@ -159,7 +159,7 @@ Div(content-wrapper){ } }.ElseIf(#errand_id# > 0){ If(#notific_id# > 0){ - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "id": #notific_id#}).Vars(cl) + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "id": "#notific_id#"}).Vars(cl) } If(#cl_closed# == 0){ If(#cl_processing_info# == ""){ diff --git a/platform_apps/events.json b/platform_apps/events.json index 57dcf55d7..e94d14c4b 100644 --- a/platform_apps/events.json +++ b/platform_apps/events.json @@ -171,7 +171,7 @@ }, { "Name": "e_events", - "Columns": "[\n {\n \"conditions\": \"ContractAccess(\\\"@1EEvent\\\")\",\n \"name\": \"name\",\n \"type\": \"varchar\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1EEvent\\\")\",\n \"name\": \"description\",\n \"type\": \"text\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1EEvent\\\")\",\n \"name\": \"type\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1EEvent\\\")\",\n \"name\": \"starting_date\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1EEvent\\\")\",\n \"name\": \"event_address_json\",\n \"type\": \"json\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1EEvent\\\")\",\n \"name\": \"responsible\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"created_at\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1EEvent\\\")\",\n \"name\": \"deleted_at\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1EEvent\\\")\",\n \"name\": \"ecosystem\",\n \"type\": \"number\"\n }\n]", + "Columns": "[\n {\n \"conditions\": \"ContractAccess(\\\"@1EEvent\\\")\",\n \"name\": \"name\",\n \"type\": \"varchar\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1EEvent\\\")\",\n \"name\": \"description\",\n \"type\": \"text\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1EEvent\\\")\",\n \"name\": \"type\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1EEvent\\\")\",\n \"name\": \"starting_date\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1EEvent\\\")\",\n \"name\": \"event_address_json\",\n \"type\": \"json\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1EEvent\\\")\",\n \"name\": \"responsible\",\n \"type\": \"varchar\"\n },\n {\n \"conditions\": \"false\",\n \"name\": \"created_at\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1EEvent\\\")\",\n \"name\": \"deleted_at\",\n \"type\": \"number\"\n },\n {\n \"conditions\": \"ContractAccess(\\\"@1EEvent\\\")\",\n \"name\": \"ecosystem\",\n \"type\": \"number\"\n }\n]", "Permissions": "{\"insert\":\"ContractAccess(\\\"@1EEvent\\\")\",\"update\":\"ContractAccess(\\\"@1EEvent\\\")\",\"new_column\":\"ContractConditions(\\\"@1AdminCondition\\\")\"}", "Type": "tables" }, @@ -196,49 +196,49 @@ { "Name": "e_event_form", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1e_event_form).(back_page, @1e_events)\n\nSetTitle($@1e_events$)\nDiv(breadcrumb text-muted){\n LinkPage(Body:$@1e_events$, Page: @1e_events)\n Span(/,mh)\n If(#Id#>0){\n $@1e_edit_event$\n }.Else{\n $@1e_new_event$\n }\n}\n\nSetVar(event_name,).(event_description,).(event_event_address_json,{\"type\":\"point\",\"coords\":[[37.620558583362,55.75364730329732]],\"area\":0, \"zoom\":10})\n\nDBFind(@1e_types, t).Where({\"ecosystem\": #ecosystem_id#}).Columns(\"id,name\")\nSetVar(types_json,`\"0\":\"$@1e_new_type$\"`)\nForList(t){\n SetVar(types_json,`#types_json#,\"#id#\":\"#name#\"`)\n}\nJsonToSource(types,{#types_json#})\n\nDiv(row){\n Div(col-sm-6 col-sm-offset-3){\n Form(mt-lg panel panel-primary){\n Div(panel-body){\n If(#Id#>0){\n Input(Name: Id, Type: hidden, Value: #Id#)\n DBFind(\"@1e_events\").WhereId(#Id#).Vars(event)\n If(#MemberId#==\"\"){\n SetVar(MemberId, #event_responsible#)\n }\n If(#Type#==\"\"){\n SetVar(Type, #event_type#)\n }\n }.Else{\n SetVar(Id,)\n }\n Div(row mb-sm){\n Div(col-sm-4 mt text-bold text-right){\n $@1e_responsible$\n }\n Div(col-sm-8 text-left){\n Div(input-group){\n Div(text-muted mt){\n If(#MemberId#!=\"\"){\n SetVar(AddressMemberId, Address(#MemberId#))\n Div(list-group-item){\n #AddressMemberId#\n }.Style(height: 35px; top: -5px;)\n }.Else{\n Div(list-group-item){\n xxxx-xxxx-xxxx-xxxx-xxxx\n }.Style(height: 35px; top: -5px;)\n }\n }\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:\"back_page=#this_page#,EcosystemId=#ecosystem_id#,Id=#Id#\").Popup(Header: $@1member$, Width: \"50\")\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n )\n }\n }\n }\n If(#MemberId#!=\"\"){\n Div(row mb-sm){\n Div(col-md-4 mt-sm text-right text-bold){\n $@1e_event_name$\n }\n Div(col-md-8 text-left){\n Input(Name: Name, Value: #event_name#)\n }\n }\n Div(row mb-sm){\n Div(col-sm-4 mt text-bold text-right){\n $@1description$\n }\n Div(col-sm-8 text-left){\n Input(Name: Description, Type: textarea, Value: #event_description#)\n }\n }\n Div(row mb-sm){\n Div(col-sm-4 mt-sm text-right text-bold){\n $@1e_type$\n }\n Div(col-sm-8 text-left){\n Select(Name: Type, Source: types, NameColumn: value, ValueColumn: key, Value: #Type#)\n }\n }\n Div(row mb-sm){\n Div(col-sm-4 mt text-bold text-right){\n $@1e_event_address$\n }\n Div(col-sm-8 text-left){\n InputMap(Name: EventAddress, Type: point, MapType: streets, Value: #event_event_address_json#)\n }\n }\n Div(row mb-sm){\n Div(col-sm-4 mt-sm text-right text-bold){\n $@1e_starting_date$\n }\n Div(col-sm-8 text-left){\n Div(row){\n If(#Id#>0){\n Div(col-sm-6){\n SetVar(date, DateTime(#event_starting_date#, Format: YYYY-MM-DD))\n Input(Name:StartingDate, Type:date, Value: #date#)\n }\n Div(col-sm-6){\n SetVar(time, DateTime(#event_starting_date#, Format: HH:MI))\n Input(Name:StartingTime, Type:time, Value: #time#)\n }\n }.Else{\n Div(col-sm-6){\n Input(Name:StartingDate, Type:date)\n }\n Div(col-sm-6){\n Input(Name:StartingTime, Type:time, Value: \"00:00\")\n }\n }\n }\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1back$, Class: btn btn-default, Page: #back_page#)\n If(#MemberId#!=\"\"){\n Button(Body: $@1send$, Class: btn btn-primary pull-right, Page: #back_page#, Contract: @1EEvent, Params: \"Responsible=#MemberId#\")\n }\n }\n }\n }\n}", + "Value": "SetVar(this_page, @1e_event_form).(back_page, @1e_events)\n\nSetTitle($@1e_events$)\nDiv(breadcrumb text-muted){\n LinkPage(Body:$@1e_events$, Page: @1e_events)\n Span(/,mh)\n If(#Id#>0){\n $@1e_edit_event$\n }.Else{\n $@1e_new_event$\n }\n}\n\nSetVar(event_name,).(event_description,).(event_event_address_json,{\"type\":\"point\",\"coords\":[[37.620558583362,55.75364730329732]],\"area\":0, \"zoom\":10})\n\nDBFind(\"@1e_types\", t).Where({\"ecosystem\": \"#ecosystem_id#\"}).Columns(\"id,name\")\nSetVar(types_json,`\"0\":\"$@1e_new_type$\"`)\nForList(t){\n SetVar(types_json,`#types_json#,\"#id#\":\"#name#\"`)\n}\nJsonToSource(types,{#types_json#})\n\nDiv(row){\n Div(col-sm-6 col-sm-offset-3){\n Form(mt-lg panel panel-primary){\n Div(panel-body){\n If(#Id#>0){\n Input(Name: Id, Type: hidden, Value: #Id#)\n DBFind(\"@1e_events\").WhereId(#Id#).Vars(event)\n If(#MemberAccount#==\"\"){\n SetVar(MemberAccount, #event_responsible#)\n }\n If(#Type#==\"\"){\n SetVar(Type, #event_type#)\n }\n }.Else{\n SetVar(Id,)\n }\n Div(row mb-sm){\n Div(col-sm-4 mt text-bold text-right){\n $@1e_responsible$\n }\n Div(col-sm-8 text-left){\n Div(input-group){\n Div(text-muted mt){\n If(#MemberAccount#){\n Div(list-group-item){\n #MemberAccount#\n }.Style(height: 35px; top: -5px;)\n }.Else{\n Div(list-group-item){\n xxxx-xxxx-xxxx-xxxx-xxxx\n }.Style(height: 35px; top: -5px;)\n }\n }\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:\"back_page=#this_page#,EcosystemId=#ecosystem_id#,Id=#Id#\").Popup(Header: $@1member$, Width: \"50\")\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n )\n }\n }\n }\n If(#MemberAccount#){\n Div(row mb-sm){\n Div(col-md-4 mt-sm text-right text-bold){\n $@1e_event_name$\n }\n Div(col-md-8 text-left){\n Input(Name: Name, Value: #event_name#)\n }\n }\n Div(row mb-sm){\n Div(col-sm-4 mt text-bold text-right){\n $@1description$\n }\n Div(col-sm-8 text-left){\n Input(Name: Description, Type: textarea, Value: #event_description#)\n }\n }\n Div(row mb-sm){\n Div(col-sm-4 mt-sm text-right text-bold){\n $@1e_type$\n }\n Div(col-sm-8 text-left){\n Select(Name: Type, Source: types, NameColumn: value, ValueColumn: key, Value: #Type#)\n }\n }\n Div(row mb-sm){\n Div(col-sm-4 mt text-bold text-right){\n $@1e_event_address$\n }\n Div(col-sm-8 text-left){\n InputMap(Name: EventAddress, Type: point, MapType: streets, Value: #event_event_address_json#)\n }\n }\n Div(row mb-sm){\n Div(col-sm-4 mt-sm text-right text-bold){\n $@1e_starting_date$\n }\n Div(col-sm-8 text-left){\n Div(row){\n If(#Id#>0){\n Div(col-sm-6){\n SetVar(date, DateTime(#event_starting_date#, Format: YYYY-MM-DD))\n Input(Name:StartingDate, Type:date, Value: #date#)\n }\n Div(col-sm-6){\n SetVar(time, DateTime(#event_starting_date#, Format: HH:MI))\n Input(Name:StartingTime, Type:time, Value: #time#)\n }\n }.Else{\n Div(col-sm-6){\n Input(Name:StartingDate, Type:date)\n }\n Div(col-sm-6){\n Input(Name:StartingTime, Type:time, Value: \"00:00\")\n }\n }\n }\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1back$, Class: btn btn-default, Page: #back_page#)\n If(#MemberAccount#){\n Button(Body: $@1send$, Class: btn btn-primary pull-right, Page: #back_page#, Contract: @1EEvent, Params: \"Responsible=#MemberAccount#\")\n }\n }\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "e_events", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1e_events).(this_table, @1e_events)\nInclude(@1pager_header)\n\nSetTitle($@1e_events$)\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1e_desc$\"))\n\nDBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Events\"}).Vars(application)\nSetVar(admin_ids, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: events_admin_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": #ecosystem_id#, \"$and\": [\"role->id\": {\"$in\": [#admin_ids#]}, \"role->id\": #role_id#], \"member->member_id\": #key_id#, \"deleted\": 0}).Vars(admin_access)\nIf(#admin_access_id#>0){\n AddToolButton(Title: $@1e_types$, Page: @1e_type_form, Icon: icon-docs).Popup(50, $@1e_types$)\n AddToolButton(Title: $@1e_new_event$, Page: @1e_event_form, Icon: icon-plus)\n}\n\nSetVar(where_type,)\nIf(#search#){\n SetVar(where, {\"name\": {\"$ilike\": \"#search#\"}})\n}.ElseIf(#Type#>0){\n SetVar(where_type, {type: #Type#})\n SetVar(where, {\"ecosystem\": #ecosystem_id#, #where_type#})\n}.Else{\n SetVar(where, {\"ecosystem\": #ecosystem_id#, \"id\":{\"$neq\": 0}}).(Type, 0)\n}\n\nDiv(mr-lg text-right){\n Button(Page: @1e_events_filter, Class: btn bg-gray-lighter mr-sm, PageParams: \"sort=#sort#,page_par=#page_par#,search=#search#,current_page=#current_page#\", Body: Em(Class: fa fa-filter) $@1filter$).Popup(Header: $@1filter$, Width: \"50\")\n If(#Type#){\n Button(Page: #this_page#, Class: btn bg-gray-lighter mr-sm, Body: Em(Class: fa fa-close))\n }\n}.Style(margin-top: -28px; z-index: 1001;)\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, $@1name$)\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"starting_date\": 1, \"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,name,description,starting_date,type,event_address_json,event_address_json->address,responsible\").Custom(_responsible){\n Address(#responsible#)\n}.Custom(_type){\n SetVar(t_name,)\n DBFind(@1e_types,tt).Where({\"ecosystem\": #ecosystem_id#, \"id\": #type#}).Columns(\"name\").Vars(t)\n Span(#t_name#)\n}.Custom(_date){\n If(#starting_date#>0){\n Span(Class:text-muted, Body:DateTime(#starting_date#, Format: YYYY-MM-DD HH:MI))\n }\n}.Custom(_address){\n Button(Body:#event_address_json.address#, Page: @1e_map, Class: btn btn-link p0 m0, PageParams: \"Coords=#event_address_json#\").Popup(50, $@1e_map$)\n}.Custom(_actions){\n Button(Page: @1e_event_form, Class: btn bg-gray-lighter fa fa-edit pull-right, PageParams: \"Id=#id#\")\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1id$=id,$@1name$=name,$@1description$=description,$@1e_starting_date$=_date,$@1type$=_type,$@1address$=_address,$@1e_responsible$=_responsible,=_actions\")\n }.Else{\n Div(text-center h4 text-muted){\n $@1e_events$ $@1not_founded$\n }\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, @1e_events).(this_table, @1e_events)\nInclude(@1pager_header)\n\nSetTitle($@1e_events$)\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1e_desc$\"))\n\nDBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Events\"}).Vars(application)\nSetVar(admin_ids, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: events_admin_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#admin_ids#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\nIf(#admin_access_id#>0){\n AddToolButton(Title: $@1e_types$, Page: @1e_type_form, Icon: icon-docs).Popup(50, $@1e_types$)\n AddToolButton(Title: $@1e_new_event$, Page: @1e_event_form, Icon: icon-plus)\n}\n\nIf(#search#){\n SetVar(where, {\"name\": {\"$ilike\": \"#search#\"}})\n}.ElseIf(#Type# > 0){\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"type\": \"#Type#\"})\n}.Else{\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"id\": {\"$neq\": 0}}).(Type, 0)\n}\n\nDiv(mr-lg text-right){\n Button(Page: @1e_events_filter, Class: btn bg-gray-lighter mr-sm, PageParams: \"sort=#sort#,page_par=#page_par#,search=#search#,current_page=#current_page#\", Body: Em(Class: fa fa-filter) $@1filter$).Popup(Header: $@1filter$, Width: \"50\")\n If(#Type#){\n Button(Page: #this_page#, Class: btn bg-gray-lighter mr-sm, Body: Em(Class: fa fa-close))\n }\n}.Style(margin-top: -28px; z-index: 1001;)\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, $@1name$)\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"starting_date\": 1, \"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,name,description,starting_date,type,event_address_json,event_address_json->address,responsible\").Custom(_responsible){\n #responsible#\n}.Custom(_type){\n SetVar(t_name,)\n DBFind(\"@1e_types\", tt).Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#type#\"}).Columns(\"name\").Vars(t)\n Span(#t_name#)\n}.Custom(_date){\n If(#starting_date#>0){\n Span(Class:text-muted, Body:DateTime(#starting_date#, Format: YYYY-MM-DD HH:MI))\n }\n}.Custom(_address){\n Button(Body:#event_address_json.address#, Page: @1e_map, Class: btn btn-link p0 m0, PageParams: \"Coords=#event_address_json#\").Popup(50, $@1e_map$)\n}.Custom(_actions){\n Button(Page: @1e_event_form, Class: btn bg-gray-lighter fa fa-edit pull-right, PageParams: \"Id=#id#\")\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1id$=id,$@1name$=name,$@1description$=description,$@1e_starting_date$=_date,$@1type$=_type,$@1address$=_address,$@1e_responsible$=_responsible,=_actions\")\n }.Else{\n Div(text-center h4 text-muted){\n $@1e_events$ $@1not_founded$\n }\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "e_events_filter", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1e_events_filter)\nIf(#back_page#==\"\"){\n SetVar(back_page, @1e_events)\n}\n\nDBFind(@1e_types, t).Where({\"ecosystem\": #ecosystem_id#}).Columns(\"id,name\")\n\nSetVar(types_json,`\"0\":\"$@1e_select_type$\"`)\nForList(t){\n SetVar(types_json,`#types_json#,\"#id#\":\"#name#\"`)\n}\nJsonToSource(types,{#types_json#})\n\nForm(){\n Div(row mb-sm){\n Div(col-md-3 mt-sm text-right text-bold){\n Label($@1e_type$)\n }\n Div(col-md-9 text-left){\n Select(Name: Type, Source: types, NameColumn: value, ValueColumn: key)\n }\n }\n\n Div(mt pull-right){\n Button(Class: btn btn-default, Page: #back_page#, Body: $@1e_reset$)\n Button(Class: btn btn-primary, Page: #back_page#, PageParams: \"Type=Val(Type)\", Body: $@1filter$)\n }\n}", + "Value": "SetVar(this_page, @1e_events_filter)\nIf(#back_page#==\"\"){\n SetVar(back_page, @1e_events)\n}\n\nDBFind(\"@1e_types\", t).Where({\"ecosystem\": \"#ecosystem_id#\"}).Columns(\"id,name\")\n\nSetVar(types_json,`\"0\":\"$@1e_select_type$\"`)\nForList(t){\n SetVar(types_json,`#types_json#,\"#id#\":\"#name#\"`)\n}\nJsonToSource(types,{#types_json#})\n\nForm(){\n Div(row mb-sm){\n Div(col-md-3 mt-sm text-right text-bold){\n Label($@1e_type$)\n }\n Div(col-md-9 text-left){\n Select(Name: Type, Source: types, NameColumn: value, ValueColumn: key)\n }\n }\n\n Div(mt pull-right){\n Button(Class: btn btn-default, Page: #back_page#, Body: $@1e_reset$)\n Button(Class: btn btn-primary, Page: #back_page#, PageParams: \"Type=Val(Type)\", Body: $@1filter$)\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "e_map", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "If(#back_page#==\"\"){\n SetVar(back_page, @1e_events)\n}\nJsonToSource(c, #Coords#)\nForList(c){\n If(#key#==address){\n Div(Class: mb text-center, Body: #value#)\n }\n}\nMap(Type: point, Hmap: 400, Value: #Coords#)\nDiv(mt text-center){\n Button(Body: $@1back$, Class: btn btn-primary, Page: #back_page#)\n}", + "Value": "If(#back_page# == \"\"){\n SetVar(back_page, @1e_events)\n}\nJsonToSource(c, #Coords#)\nForList(c){\n If(#key# == \"address\"){\n Div(Class: mb text-center, Body: #value#)\n }\n}\nMap(Type: point, Hmap: 400, Value: #Coords#)\nDiv(mt text-center){\n Button(Body: $@1back$, Class: btn btn-primary, Page: #back_page#)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "e_settings", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Events\"}).Vars(\"app\")\n\nSetVar(this_page, \"@1e_settings\").(events_admin_role,0)\nSetVar(events_admin_role, AppParam(App: #app_id#, Name: \"events_admin_role\"))\n\nDBFind(\"@1roles\", src_roles).Where({\"ecosystem\": #ecosystem_id#, \"deleted\": 0}).Columns(\"role_name,id\").Limit(100)\n\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-4 text-right mt-sm\").(col_right,\"col-sm-8 text-left\")\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(@1e_settings)\n }\n Div(text-center text-muted){\n LangRes(@1e_settings_description)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n LangRes(@1e_admin_role)\n }\n }\n Div(#col_right#){\n Select(Name: RoleAdmin, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #events_admin_role#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#events_admin_role# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #events_admin_role#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1apply_settings$, Class: btn btn-primary, Page: #this_page#, Contract: @1ESettings)\n }\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Events\"}).Vars(app)\n\nSetVar(this_page, \"@1e_settings\").(events_admin_role,0)\nSetVar(events_admin_role, AppParam(App: #app_id#, Name: \"events_admin_role\"))\n\nDBFind(\"@1roles\", src_roles).Where({\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0}).Columns(\"role_name,id\").Limit(100)\n\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-4 text-right mt-sm\").(col_right,\"col-sm-8 text-left\")\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(@1e_settings)\n }\n Div(text-center text-muted){\n LangRes(@1e_settings_description)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n LangRes(@1e_admin_role)\n }\n }\n Div(#col_right#){\n Select(Name: RoleAdmin, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #events_admin_role#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#events_admin_role# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#events_admin_role#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1apply_settings$, Class: btn btn-primary, Page: #this_page#, Contract: @1ESettings)\n }\n }\n }\n }\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "e_type_form", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1e_type_form).(back_page, @1e_events)\nSetVar(t_name,)\n\nDBFind(@1e_types, t).Where({\"ecosystem\": #ecosystem_id#}).Columns(\"id,name\")\nSetVar(types_json,`\"0\":\"$@1e_new_type$\"`)\nForList(t){\n SetVar(types_json,`#types_json#,\"#id#\":\"#name#\"`)\n}\nJsonToSource(types,{#types_json#})\n\nForm(){\n Div(row){\n Div(col-sm-3 mt-sm text-right text-bold){\n $@1e_type$\n }\n Div(col-sm-9 text-left){\n Select(Name: Type, Source: types, NameColumn: value, ValueColumn: key, Value: #Type#)\n Span(Class: text-muted h6 m0, Body: $@1e_types_dec$)\n }\n }\n Div(row mt){\n Div(col-sm-3 mt-sm text-right text-bold){\n $@1name$\n }\n Div(col-sm-9 text-left){\n Input(Name: Name, Value: #t_name#)\n }\n }\n Div(mt){\n Div(){\n Button(Body: $@1e_create_type$, Class: btn btn-primary pull-right, Page: #back_page#, Contract: @1EType, Params: \"Id=0\")\n }.Show(Type=0)\n Div(){\n Button(Body: $@1e_edit_type$, Class: btn btn-primary pull-right, Page: #back_page#, Contract: @1EType, Params: \"Id=Val(Type)\")\n }.Hide(Type=0)\n Button(Body: $@1back$, Class: btn btn-default pull-right, Page: #back_page#)\n }\n}", + "Value": "SetVar(this_page, @1e_type_form).(back_page, @1e_events)\nSetVar(t_name,)\n\nDBFind(\"@1e_types\", t).Where({\"ecosystem\": \"#ecosystem_id#\"}).Columns(\"id,name\")\nSetVar(types_json,`\"0\":\"$@1e_new_type$\"`)\nForList(t){\n SetVar(types_json,`#types_json#,\"#id#\":\"#name#\"`)\n}\nJsonToSource(types,{#types_json#})\n\nForm(){\n Div(row){\n Div(col-sm-3 mt-sm text-right text-bold){\n $@1e_type$\n }\n Div(col-sm-9 text-left){\n Select(Name: Type, Source: types, NameColumn: value, ValueColumn: key, Value: #Type#)\n Span(Class: text-muted h6 m0, Body: $@1e_types_dec$)\n }\n }\n Div(row mt){\n Div(col-sm-3 mt-sm text-right text-bold){\n $@1name$\n }\n Div(col-sm-9 text-left){\n Input(Name: Name, Value: #t_name#)\n }\n }\n Div(mt){\n Div(){\n Button(Body: $@1e_create_type$, Class: btn btn-primary pull-right, Page: #back_page#, Contract: @1EType, Params: \"Id=0\")\n }.Show(Type=0)\n Div(){\n Button(Body: $@1e_edit_type$, Class: btn btn-primary pull-right, Page: #back_page#, Contract: @1EType, Params: \"Id=Val(Type)\")\n }.Hide(Type=0)\n Button(Body: $@1back$, Class: btn btn-default pull-right, Page: #back_page#)\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "EEvent", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract EEvent {\n data {\n Id int \"optional\"\n Name string\n Description string\n Type int\n StartingDate string\n StartingTime string\n EventAddress string\n Responsible int\n }\n\n func dateAddTime(d, t string) string {\n var dt string\n if Contains(d, \"T00:00:00Z\") {\n d = Replace(d, \"T00:00:00Z\", \"\")\n }\n if Size(t) == 5 {\n dt = Sprintf(\"%v %v:00\", d, t)\n }\n return dt\n }\n\n conditions{\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Events\"}).One(\"id\")\n var admin_ids string\n admin_ids = AppParam(Int($app), \"events_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+admin_ids+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n if $Id > 0 {\n var event map\n event = DBFind(\"@1e_events\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row()\n if !event {\n warning LangRes(\"@1e_event_not_found\", \"en\")\n }\n if event[\"starting_date\"] < $block_time {\n warning LangRes(\"@1e_event_not_editable\", \"en\")\n }\n }\n\n $date = UnixDateTime(dateAddTime($StartingDate, $StartingTime))\n if $date == 0 {\n warning LangRes(\"@1starting_date_invalid\", \"en\")\n }\n\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": $Responsible}).Row() {\n warning LangRes(\"@1e_responsible_not_found\", \"en\")\n }\n }\n\n action {\n var addr map encAddr string\n addr = JSONDecode($EventAddress)\n addr[\"zoom\"] = 11\n encAddr = JSONEncode(addr)\n\n var m map\n m = {\"name\": $Name, \"description\": $Description, \"type\": $Type, \"starting_date\": $date, \"event_address_json\": encAddr, \"responsible\": $Responsible}\n if $Id > 0 {\n DBUpdate(\"@1e_events\", $Id, m)\n } else {\n m[\"created_at\"] = $block_time\n m[\"ecosystem\"] = $ecosystem_id\n DBInsert(\"@1e_events\", m)\n }\n }\n}", + "Value": "contract EEvent {\n data {\n Id int \"optional\"\n Name string\n Description string\n Type int\n StartingDate string\n StartingTime string\n EventAddress string\n Responsible string\n }\n\n func dateAddTime(d, t string) string {\n var dt string\n if Contains(d, \"T00:00:00Z\") {\n d = Replace(d, \"T00:00:00Z\", \"\")\n }\n if Size(t) == 5 {\n dt = Sprintf(\"%v %v:00\", d, t)\n }\n return dt\n }\n\n conditions{\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Events\"}).One(\"id\")\n var admin_ids string\n admin_ids = AppParam(Int($app), \"events_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+admin_ids+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n if $Id > 0 {\n var event map\n event = DBFind(\"@1e_events\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row()\n if !event {\n warning LangRes(\"@1e_event_not_found\", \"en\")\n }\n if event[\"starting_date\"] < $block_time {\n warning LangRes(\"@1e_event_not_editable\", \"en\")\n }\n }\n\n $date = UnixDateTime(dateAddTime($StartingDate, $StartingTime))\n if $date == 0 {\n warning LangRes(\"@1starting_date_invalid\", \"en\")\n }\n\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": $Responsible, \"deleted\": 0}).Row() {\n warning LangRes(\"@1e_responsible_not_found\", \"en\")\n }\n }\n\n action {\n var addr map encAddr string\n addr = JSONDecode($EventAddress)\n addr[\"zoom\"] = 11\n encAddr = JSONEncode(addr)\n\n var m map\n m = {\"name\": $Name, \"description\": $Description, \"type\": $Type, \"starting_date\": $date, \"event_address_json\": encAddr, \"responsible\": $Responsible}\n if $Id > 0 {\n DBUpdate(\"@1e_events\", $Id, m)\n } else {\n m[\"created_at\"] = $block_time\n m[\"ecosystem\"] = $ecosystem_id\n DBInsert(\"@1e_events\", m)\n }\n }\n}", "Type": "contracts" }, { @@ -250,7 +250,7 @@ { "Name": "EType", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract EType {\n data {\n Id int \"optional\"\n Name string\n }\n\n conditions{\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Events\"}).One(\"id\")\n var admin_ids string\n admin_ids = AppParam(Int($app), \"events_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+admin_ids+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n if DBFind(\"@1e_types\").Where({\"name\": $Name, \"ecosystem\": $ecosystem_id}).Row() {\n warning LangRes(\"e_type_name_exists\", \"en\")\n }\n\n if $Id > 0 {\n if !DBFind(\"@1e_types\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row() {\n warning LangRes(\"e_type_not_found\", \"en\")\n }\n }\n }\n\n action {\n if $Id > 0 {\n DBUpdate(\"@1e_types\", $Id, {\"name\": $Name})\n } else {\n DBInsert(\"@1e_types\", {\"name\": $Name, \"ecosystem\": $ecosystem_id})\n }\n }\n}", + "Value": "contract EType {\n data {\n Id int \"optional\"\n Name string\n }\n\n conditions{\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Events\"}).One(\"id\")\n var admin_ids string\n admin_ids = AppParam(Int($app), \"events_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+admin_ids+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n if DBFind(\"@1e_types\").Where({\"name\": $Name, \"ecosystem\": $ecosystem_id}).Row() {\n warning LangRes(\"e_type_name_exists\", \"en\")\n }\n\n if $Id > 0 {\n if !DBFind(\"@1e_types\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row() {\n warning LangRes(\"e_type_not_found\", \"en\")\n }\n }\n }\n\n action {\n if $Id > 0 {\n DBUpdate(\"@1e_types\", $Id, {\"name\": $Name})\n } else {\n DBInsert(\"@1e_types\", {\"name\": $Name, \"ecosystem\": $ecosystem_id})\n }\n }\n}", "Type": "contracts" } ] diff --git a/platform_apps/events/contracts/EEvent.sim b/platform_apps/events/contracts/EEvent.sim index 23f13e33d..0386dc035 100644 --- a/platform_apps/events/contracts/EEvent.sim +++ b/platform_apps/events/contracts/EEvent.sim @@ -7,7 +7,7 @@ contract EEvent { StartingDate string StartingTime string EventAddress string - Responsible int + Responsible string } func dateAddTime(d, t string) string { @@ -27,7 +27,7 @@ contract EEvent { admin_ids = AppParam(Int($app), "events_admin_role", $ecosystem_id) var rids array rids = JSONDecode("["+admin_ids+"]") - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() { warning LangRes("@1access_denied", "en") } @@ -47,7 +47,7 @@ contract EEvent { warning LangRes("@1starting_date_invalid", "en") } - if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": $Responsible}).Row() { + if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": $Responsible, "deleted": 0}).Row() { warning LangRes("@1e_responsible_not_found", "en") } } diff --git a/platform_apps/events/contracts/EType.sim b/platform_apps/events/contracts/EType.sim index 52bfe846c..22f2c94b3 100644 --- a/platform_apps/events/contracts/EType.sim +++ b/platform_apps/events/contracts/EType.sim @@ -10,7 +10,7 @@ contract EType { admin_ids = AppParam(Int($app), "events_admin_role", $ecosystem_id) var rids array rids = JSONDecode("["+admin_ids+"]") - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() { warning LangRes("@1access_denied", "en") } diff --git a/platform_apps/events/pages/e_event_form.ptl b/platform_apps/events/pages/e_event_form.ptl index 745896e84..7b85b28d5 100644 --- a/platform_apps/events/pages/e_event_form.ptl +++ b/platform_apps/events/pages/e_event_form.ptl @@ -13,7 +13,7 @@ Div(breadcrumb text-muted){ SetVar(event_name,).(event_description,).(event_event_address_json,{"type":"point","coords":[[37.620558583362,55.75364730329732]],"area":0, "zoom":10}) -DBFind(@1e_types, t).Where({"ecosystem": #ecosystem_id#}).Columns("id,name") +DBFind("@1e_types", t).Where({"ecosystem": "#ecosystem_id#"}).Columns("id,name") SetVar(types_json,`"0":"$@1e_new_type$"`) ForList(t){ SetVar(types_json,`#types_json#,"#id#":"#name#"`) @@ -27,8 +27,8 @@ Div(row){ If(#Id#>0){ Input(Name: Id, Type: hidden, Value: #Id#) DBFind("@1e_events").WhereId(#Id#).Vars(event) - If(#MemberId#==""){ - SetVar(MemberId, #event_responsible#) + If(#MemberAccount#==""){ + SetVar(MemberAccount, #event_responsible#) } If(#Type#==""){ SetVar(Type, #event_type#) @@ -43,10 +43,9 @@ Div(row){ Div(col-sm-8 text-left){ Div(input-group){ Div(text-muted mt){ - If(#MemberId#!=""){ - SetVar(AddressMemberId, Address(#MemberId#)) + If(#MemberAccount#){ Div(list-group-item){ - #AddressMemberId# + #MemberAccount# }.Style(height: 35px; top: -5px;) }.Else{ Div(list-group-item){ @@ -65,7 +64,7 @@ Div(row){ } } } - If(#MemberId#!=""){ + If(#MemberAccount#){ Div(row mb-sm){ Div(col-md-4 mt-sm text-right text-bold){ $@1e_event_name$ @@ -128,8 +127,8 @@ Div(row){ } Div(panel-footer text-right){ Button(Body: $@1back$, Class: btn btn-default, Page: #back_page#) - If(#MemberId#!=""){ - Button(Body: $@1send$, Class: btn btn-primary pull-right, Page: #back_page#, Contract: @1EEvent, Params: "Responsible=#MemberId#") + If(#MemberAccount#){ + Button(Body: $@1send$, Class: btn btn-primary pull-right, Page: #back_page#, Contract: @1EEvent, Params: "Responsible=#MemberAccount#") } } } diff --git a/platform_apps/events/pages/e_events.ptl b/platform_apps/events/pages/e_events.ptl index 19352a6f9..79ce6ecae 100644 --- a/platform_apps/events/pages/e_events.ptl +++ b/platform_apps/events/pages/e_events.ptl @@ -4,22 +4,20 @@ Include(@1pager_header) SetTitle($@1e_events$) Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$@1e_desc$")) -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Events"}).Vars(application) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Events"}).Vars(application) SetVar(admin_ids, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: events_admin_role)) -DBFind("@1roles_participants").Where({"ecosystem": #ecosystem_id#, "$and": ["role->id": {"$in": [#admin_ids#]}, "role->id": #role_id#], "member->member_id": #key_id#, "deleted": 0}).Vars(admin_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#admin_ids#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) If(#admin_access_id#>0){ AddToolButton(Title: $@1e_types$, Page: @1e_type_form, Icon: icon-docs).Popup(50, $@1e_types$) AddToolButton(Title: $@1e_new_event$, Page: @1e_event_form, Icon: icon-plus) } -SetVar(where_type,) If(#search#){ SetVar(where, {"name": {"$ilike": "#search#"}}) -}.ElseIf(#Type#>0){ - SetVar(where_type, {type: #Type#}) - SetVar(where, {"ecosystem": #ecosystem_id#, #where_type#}) +}.ElseIf(#Type# > 0){ + SetVar(where, {"ecosystem": "#ecosystem_id#", "type": "#Type#"}) }.Else{ - SetVar(where, {"ecosystem": #ecosystem_id#, "id":{"$neq": 0}}).(Type, 0) + SetVar(where, {"ecosystem": "#ecosystem_id#", "id": {"$neq": 0}}).(Type, 0) } Div(mr-lg text-right){ @@ -35,10 +33,10 @@ Div(list-group-item ml-lg mr-lg pt-lg){ } DBFind(#this_table#, src).Where(#where#).Order({"starting_date": 1, "id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("id,name,description,starting_date,type,event_address_json,event_address_json->address,responsible").Custom(_responsible){ - Address(#responsible#) + #responsible# }.Custom(_type){ SetVar(t_name,) - DBFind(@1e_types,tt).Where({"ecosystem": #ecosystem_id#, "id": #type#}).Columns("name").Vars(t) + DBFind("@1e_types", tt).Where({"ecosystem": "#ecosystem_id#", "id": "#type#"}).Columns("name").Vars(t) Span(#t_name#) }.Custom(_date){ If(#starting_date#>0){ diff --git a/platform_apps/events/pages/e_events_filter.ptl b/platform_apps/events/pages/e_events_filter.ptl index d479d132b..47255b66c 100644 --- a/platform_apps/events/pages/e_events_filter.ptl +++ b/platform_apps/events/pages/e_events_filter.ptl @@ -3,7 +3,7 @@ If(#back_page#==""){ SetVar(back_page, @1e_events) } -DBFind(@1e_types, t).Where({"ecosystem": #ecosystem_id#}).Columns("id,name") +DBFind("@1e_types", t).Where({"ecosystem": "#ecosystem_id#"}).Columns("id,name") SetVar(types_json,`"0":"$@1e_select_type$"`) ForList(t){ diff --git a/platform_apps/events/pages/e_map.ptl b/platform_apps/events/pages/e_map.ptl index 9243a4db1..c1cffe0ae 100644 --- a/platform_apps/events/pages/e_map.ptl +++ b/platform_apps/events/pages/e_map.ptl @@ -1,9 +1,9 @@ -If(#back_page#==""){ +If(#back_page# == ""){ SetVar(back_page, @1e_events) } JsonToSource(c, #Coords#) ForList(c){ - If(#key#==address){ + If(#key# == "address"){ Div(Class: mb text-center, Body: #value#) } } diff --git a/platform_apps/events/pages/e_settings.ptl b/platform_apps/events/pages/e_settings.ptl index ecee1e2c4..99228b21f 100644 --- a/platform_apps/events/pages/e_settings.ptl +++ b/platform_apps/events/pages/e_settings.ptl @@ -1,9 +1,9 @@ -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Events"}).Vars("app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Events"}).Vars(app) SetVar(this_page, "@1e_settings").(events_admin_role,0) SetVar(events_admin_role, AppParam(App: #app_id#, Name: "events_admin_role")) -DBFind("@1roles", src_roles).Where({"ecosystem": #ecosystem_id#, "deleted": 0}).Columns("role_name,id").Limit(100) +DBFind("@1roles", src_roles).Where({"ecosystem": "#ecosystem_id#", "deleted": 0}).Columns("role_name,id").Limit(100) SetVar(row,"row mt-sm").(col_left,"col-sm-4 text-right mt-sm").(col_right,"col-sm-8 text-left") @@ -29,7 +29,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#events_admin_role# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #events_admin_role#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#events_admin_role#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# diff --git a/platform_apps/events/pages/e_type_form.ptl b/platform_apps/events/pages/e_type_form.ptl index 88d13a281..bcc2f8e2d 100644 --- a/platform_apps/events/pages/e_type_form.ptl +++ b/platform_apps/events/pages/e_type_form.ptl @@ -1,7 +1,7 @@ SetVar(this_page, @1e_type_form).(back_page, @1e_events) SetVar(t_name,) -DBFind(@1e_types, t).Where({"ecosystem": #ecosystem_id#}).Columns("id,name") +DBFind("@1e_types", t).Where({"ecosystem": "#ecosystem_id#"}).Columns("id,name") SetVar(types_json,`"0":"$@1e_new_type$"`) ForList(t){ SetVar(types_json,`#types_json#,"#id#":"#name#"`) diff --git a/platform_apps/events/tables/e_events.json b/platform_apps/events/tables/e_events.json index b77b69f37..b4b1bd220 100644 --- a/platform_apps/events/tables/e_events.json +++ b/platform_apps/events/tables/e_events.json @@ -27,7 +27,7 @@ { "conditions": "ContractAccess(\"@1EEvent\")", "name": "responsible", - "type": "number" + "type": "varchar" }, { "conditions": "false", diff --git a/platform_apps/power_of_attorney.json b/platform_apps/power_of_attorney.json index 6d777b6bb..02d6a7abe 100644 --- a/platform_apps/power_of_attorney.json +++ b/platform_apps/power_of_attorney.json @@ -16,13 +16,13 @@ }, { "Name": "poa", - "Columns": "[\n {\n \"name\":\"poa_sender\",\n \"type\":\"json\",\n \"conditions\":\"false\"\n },\n {\n \"name\":\"date_created\",\n \"type\":\"number\",\n \"conditions\":\"false\"\n },\n {\n \"name\":\"date_expiration\",\n \"type\":\"number\",\n \"conditions\":\"false\"\n },\n {\n \"name\":\"deleted\",\n \"type\":\"number\",\n \"conditions\":\"ContractAccess(\\\"@1PoaDelete\\\")\"\n },\n {\n \"name\":\"contract\",\n \"type\":\"text\",\n \"conditions\":\"false\"\n },\n {\n \"name\":\"ecosystem\",\n \"type\":\"number\",\n \"conditions\":\"false\"\n },\n {\n \"name\":\"params\",\n \"type\":\"json\",\n \"conditions\":\"ContractAccess(\\\"@1PoaUpdateParams\\\")\"\n },\n {\n \"name\":\"template_id\",\n \"type\":\"number\",\n \"conditions\":\"false\"\n },\n {\n \"name\":\"poa_recipient\",\n \"type\":\"json\",\n \"conditions\":\"false\"\n },\n {\n \"name\":\"date_deleted\",\n \"type\":\"number\",\n \"conditions\":\"ContractAccess(\\\"@1PoaDelete\\\")\"\n }\n]", + "Columns": "[\n {\n \"name\": \"poa_sender\",\n \"type\": \"json\",\n \"conditions\": \"false\"\n },\n {\n \"name\": \"date_created\",\n \"type\": \"number\",\n \"conditions\": \"false\"\n },\n {\n \"name\": \"date_expiration\",\n \"type\": \"number\",\n \"conditions\": \"false\"\n },\n {\n \"name\": \"deleted\",\n \"type\": \"number\",\n \"conditions\": \"ContractAccess(\\\"@1PoaDelete\\\")\"\n },\n {\n \"name\": \"contract\",\n \"type\": \"text\",\n \"conditions\": \"false\"\n },\n {\n \"name\": \"ecosystem\",\n \"type\": \"number\",\n \"conditions\": \"false\"\n },\n {\n \"name\": \"params\",\n \"type\": \"json\",\n \"conditions\": \"ContractAccess(\\\"@1PoaUpdateParams\\\")\"\n },\n {\n \"name\": \"template_id\",\n \"type\": \"number\",\n \"conditions\": \"false\"\n },\n {\n \"name\": \"poa_recipient\",\n \"type\": \"json\",\n \"conditions\": \"false\"\n },\n {\n \"name\": \"date_deleted\",\n \"type\": \"number\",\n \"conditions\": \"ContractAccess(\\\"@1PoaDelete\\\")\"\n }\n]", "Permissions": "{\"insert\": \"ContractAccess(\\\"@1PoaAdd\\\")\", \"update\": \"ContractAccess(\\\"@1PoaDelete\\\",\\\"@1PoaUpdateParams\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", "Type": "tables" }, { "Name": "poa_templates", - "Columns": "[\n {\n \"name\":\"deleted\",\n \"type\":\"number\",\n \"conditions\":\"ContractAccess(\\\"@1PoaTemplateDelete\\\")\"\n },\n {\n \"name\":\"contract\",\n \"type\":\"text\",\n \"conditions\":\"false\"\n },\n {\n \"name\":\"ecosystem\",\n \"type\":\"number\",\n \"conditions\":\"false\"\n },\n {\n \"name\":\"date_created\",\n \"type\":\"number\",\n \"conditions\":\"false\"\n },\n {\n \"name\":\"params\",\n \"type\":\"json\",\n \"conditions\":\"ContractAccess(\\\"@1PoaTemplateEdit\\\")\"\n },\n {\n \"name\":\"creator\",\n \"type\":\"json\",\n \"conditions\":\"false\"\n },\n {\n \"name\":\"date_deleted\",\n \"type\":\"number\",\n \"conditions\":\"ContractAccess(\\\"@1PoaTemplateDelete\\\")\"\n }\n]", + "Columns": "[\n {\n \"name\": \"deleted\",\n \"type\": \"number\",\n \"conditions\": \"ContractAccess(\\\"@1PoaTemplateDelete\\\")\"\n },\n {\n \"name\": \"contract\",\n \"type\": \"text\",\n \"conditions\": \"false\"\n },\n {\n \"name\": \"ecosystem\",\n \"type\": \"number\",\n \"conditions\": \"false\"\n },\n {\n \"name\": \"date_created\",\n \"type\": \"number\",\n \"conditions\": \"false\"\n },\n {\n \"name\": \"params\",\n \"type\": \"json\",\n \"conditions\": \"ContractAccess(\\\"@1PoaTemplateEdit\\\")\"\n },\n {\n \"name\": \"creator\",\n \"type\": \"json\",\n \"conditions\": \"false\"\n },\n {\n \"name\": \"date_deleted\",\n \"type\": \"number\",\n \"conditions\": \"ContractAccess(\\\"@1PoaTemplateDelete\\\")\"\n }\n]", "Permissions": "{\"insert\": \"ContractAccess(\\\"@1PoaTemplateAdd\\\")\", \"update\": \"ContractAccess(\\\"@1PoaTemplateDelete\\\",\\\"@1PoaTemplateEdit\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", "Type": "tables" }, @@ -41,21 +41,21 @@ { "Name": "poa_add", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Form(){\n Input(Name: TemplateId, Class: hidden, Value: #template_id#)\n DBFind(@1poa_templates).Vars(pre).Where({\"id\": #template_id#, \"ecosystem\": #ecosystem_id#})\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1recipient)\n }\n }\n Div(col-md-9){\n Input(Name: Recipient, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\")\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1expiration_date)\n }\n }\n Div(col-md-9){\n Div(row){\n Div(col-md-6){\n Input(Name: DateExpiration, Type: date)\n }\n\n Div(col-md-6){\n Input(Name: TimeExpiration, Type: time)\n }\n }\n }\n }\n Div(row mt-lg){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1contract)\n }\n }\n Div(col-md-9){\n Input(Name: ContractName, Disabled: \"true\", Value: #pre_contract#)\n }\n }\n Div(row mt){\n Div(col-md-3){}\n Div(col-md-9){\n Div(row){\n Div(col-md-12){\n Div(row){\n Div(col-md-6){\n Span(Class: h6 m0 text-muted, Body: $@1parameter$)\n }\n Div(col-md-6){\n Span(Class: h6 m0 text-muted, Body: $@1value$)\n }\n }\n JsonToSource(pv, #pre_params#)\n ForList(Source: pv){\n Div(row mt-sm){\n Div(col-md-6){\n Input(Name: ParamArr, Value: `#key#`, Disabled: 1)\n }\n Div(col-md-6){\n Input(Name: ValueArr)\n }\n }\n }\n }\n }\n }\n }\n Button(Body: LangRes(@1add), Class: btn btn-primary pull-right mt, Page: @1poa_list, Contract: @1PoaAdd)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1poa_template_list)\n}", + "Value": "Form(){\n Input(Name: TemplateId, Class: hidden, Value: #template_id#)\n DBFind(\"@1poa_templates\").Vars(pre).Where({\"id\": \"#template_id#\", \"ecosystem\": \"#ecosystem_id#\"})\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1recipient)\n }\n }\n Div(col-md-9){\n Input(Name: Recipient, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\")\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1expiration_date)\n }\n }\n Div(col-md-9){\n Div(row){\n Div(col-md-6){\n Input(Name: DateExpiration, Type: date)\n }\n\n Div(col-md-6){\n Input(Name: TimeExpiration, Type: time)\n }\n }\n }\n }\n Div(row mt-lg){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1contract)\n }\n }\n Div(col-md-9){\n Input(Name: ContractName, Disabled: \"true\", Value: #pre_contract#)\n }\n }\n Div(row mt){\n Div(col-md-3){}\n Div(col-md-9){\n Div(row){\n Div(col-md-12){\n Div(row){\n Div(col-md-6){\n Span(Class: h6 m0 text-muted, Body: $@1parameter$)\n }\n Div(col-md-6){\n Span(Class: h6 m0 text-muted, Body: $@1value$)\n }\n }\n JsonToSource(pv, #pre_params#)\n ForList(Source: pv){\n Div(row mt-sm){\n Div(col-md-6){\n Input(Name: ParamArr, Value: `#key#`, Disabled: 1)\n }\n Div(col-md-6){\n Input(Name: ValueArr)\n }\n }\n }\n }\n }\n }\n }\n Button(Body: LangRes(@1add), Class: btn btn-primary pull-right mt, Page: @1poa_list, Contract: @1PoaAdd)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1poa_template_list)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "poa_list", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1poa_list).(this_table, @1poa)\nInclude(@1pager_header)\n\nSetTitle(\"$@1poa_list$\")\nAddToolButton(Page: @1poa_template_list, Title: $@1poa_template_list$, Icon: icon-pin)\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": #ecosystem_id#, \"contract\":{\"$ilike\":\"#search#\"}, \"deleted\": 0})\n}.Else{\n SetVar(where, {\"ecosystem\": #ecosystem_id#, \"deleted\": 0})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1contract))\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,contract,params,date_created,date_expiration,poa_recipient->member_id,poa_recipient->member_name,poa_recipient->image_id,poa_sender->member_id,poa_sender->member_name,poa_sender->image_id,deleted\").Count(poa_count).Custom(_contract){\n Span(Class: h5 text-bold, Body: #contract#)\n}.Custom(_creator){\n If(And(#creator.member_name#!=NULL,#creator.member_name#!=\"\")){\n LinkPage(Class: #style_link# text-bold, Page: @1profile_view, PageParams: \"v_key_id=#creator.member_id#\"){\n #creator.member_name#\n }\n }\n}.Custom(_date_created){\n Div(h6){\n Div(text-nowrap){DateTime(DateTime: #date_created#, Format: \"DD.MM.YYYY HH:MI\")}\n }\n}.Custom(_date_expiration){\n Div(h6){\n Div(text-nowrap){DateTime(DateTime: #date_expiration#, Format: \"DD.MM.YYYY HH:MI\")}\n }\n}.Custom(custom_recipient){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#poa_recipient.member_id#\"){\n If(#poa_recipient.image_id#>0){\n Image(Src: Binary().ById(#poa_recipient.image_id#), Class: img-circle).Style(width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(#poa_recipient.member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(#poa_recipient.member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n}.Custom(custom_arrow){\n Em(Class: fa fa-long-arrow-right fa-1x #style_text#)\n}.Custom(custom_sender){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#poa_sender.member_id#\"){\n If(#poa_sender.image_id#>0){\n Image(Src: Binary().ById(#poa_sender.image_id#), Class: img-circle).Style(width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(#poa_sender.member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(#poa_sender.member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n}.Custom(_params){\n Span(Class: text-muted h6){\n JsonToSource(pv, #params#)\n ForList(Source: pv, Index: s_ind){\n If(#s_ind#>1){\n Span(\",\").Style(margin-right: 5px;)\n }\n \"#key#\"\n }\n }\n}.Custom(_action){\n Div(text-right button-group text-nowrap){\n If(#poa_sender.member_id#==#key_id#){\n If(#deleted# == 0){\n Button(Class: btn bg-gray-lighter, Contract: @1PoaDelete, Params: \"PoaeId=#id#\", Page: #this_page#){\n Em(Class: text-danger fa fa-1x fa-trash)\n }.Alert(Text: \"$@1sure_want_delete$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n Button(Class: icon-eye btn bg-gray-lighter mh-sm, PageParams: \"poa_id=#id#\", Page: @1poa_view).Popup(50, $@1poa_list$)\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1contract$=_contract,$@1sender$=custom_sender,=custom_arrow,$@1recipient$=custom_recipient,$@1params$=_params,$@1date_created$=_date_created,$@1expiration_date$=_date_expiration,=_action\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1poa_list$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, @1poa_list).(this_table, @1poa)\nInclude(@1pager_header)\n\nSetTitle(\"$@1poa_list$\")\nAddToolButton(Page: @1poa_template_list, Title: $@1poa_template_list$, Icon: icon-pin)\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"contract\": {\"$ilike\":\"#search#\"}, \"deleted\": 0})\n}.Else{\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1contract))\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,contract,params,date_created,date_expiration,poa_recipient->account,poa_recipient->member_name,poa_recipient->image_id,poa_sender->account,poa_sender->member_name,poa_sender->image_id,deleted\").Count(poa_count).Custom(_contract){\n Span(Class: h5 text-bold, Body: #contract#)\n}.Custom(_date_created){\n Div(h6){\n Div(text-nowrap){DateTime(DateTime: #date_created#, Format: \"DD.MM.YYYY HH:MI\")}\n }\n}.Custom(_date_expiration){\n Div(h6){\n Div(text-nowrap){DateTime(DateTime: #date_expiration#, Format: \"DD.MM.YYYY HH:MI\")}\n }\n}.Custom(custom_recipient){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#poa_recipient.account#\"){\n If(#poa_recipient.image_id#>0){\n Image(Src: Binary().ById(#poa_recipient.image_id#), Class: img-circle).Style(width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(#poa_recipient.member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(#poa_recipient.member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n}.Custom(custom_arrow){\n Em(Class: fa fa-long-arrow-right fa-1x #style_text#)\n}.Custom(custom_sender){\n LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#poa_sender.account#\"){\n If(#poa_sender.image_id#>0){\n Image(Src: Binary().ById(#poa_sender.image_id#), Class: img-circle).Style(width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(#poa_sender.member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)\n Span(#poa_sender.member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n}.Custom(_params){\n Span(Class: text-muted h6){\n JsonToSource(pv, #params#)\n ForList(Source: pv, Index: s_ind){\n If(#s_ind#>1){\n Span(\",\").Style(margin-right: 5px;)\n }\n \"#key#\"\n }\n }\n}.Custom(_action){\n Div(text-right button-group text-nowrap){\n If(#poa_sender.account# == #account_id#){\n If(#deleted# == 0){\n Button(Class: btn bg-gray-lighter, Contract: @1PoaDelete, Params: \"PoaId=#id#\", Page: #this_page#){\n Em(Class: text-danger fa fa-1x fa-trash)\n }.Alert(Text: \"$@1sure_want_delete$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n Button(Class: icon-eye btn bg-gray-lighter mh-sm, PageParams: \"poa_id=#id#\", Page: @1poa_view).Popup(50, $@1poa_list$)\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1contract$=_contract,$@1sender$=custom_sender,=custom_arrow,$@1recipient$=custom_recipient,$@1params$=_params,$@1date_created$=_date_created,$@1expiration_date$=_date_expiration,=_action\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1poa_list$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "poa_settings", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Power of attorney\"}).Vars(\"app\")\n\nSetVar(this_page, \"@1poa_settings\").(poa_admin_role,0)\nSetVar(poa_admin_role, AppParam(App: #app_id#, Name: \"poa_admin_role\"))\n\nDBFind(\"@1roles\", src_roles).Where({\"ecosystem\": #ecosystem_id#, \"deleted\": 0}).Columns(\"role_name,id\").Limit(100)\n\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-4 text-right mt-sm\").(col_right,\"col-sm-8 text-left\")\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(@1poa_settings)\n }\n Div(text-center text-muted){\n LangRes(@1poa_settings_description)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n LangRes(@1poa_admin_role)\n }\n }\n Div(#col_right#){\n Select(Name: RoleAdmin, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #poa_admin_role#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#poa_admin_role# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #poa_admin_role#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1apply_settings$, Class: btn btn-primary, Page: #this_page#, Contract: @1PoaSettings)\n }\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Power of attorney\"}).Vars(app)\n\nSetVar(this_page, \"@1poa_settings\").(poa_admin_role,0)\nSetVar(poa_admin_role, AppParam(App: #app_id#, Name: \"poa_admin_role\"))\n\nDBFind(\"@1roles\", src_roles).Where({\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0}).Columns(\"role_name,id\").Limit(100)\n\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-4 text-right mt-sm\").(col_right,\"col-sm-8 text-left\")\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(@1poa_settings)\n }\n Div(text-center text-muted){\n LangRes(@1poa_settings_description)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n LangRes(@1poa_admin_role)\n }\n }\n Div(#col_right#){\n Select(Name: RoleAdmin, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #poa_admin_role#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#poa_admin_role# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#poa_admin_role#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1apply_settings$, Class: btn btn-primary, Page: #this_page#, Contract: @1PoaSettings)\n }\n }\n }\n }\n}", "Menu": "admin_menu", "Type": "pages" }, @@ -69,41 +69,41 @@ { "Name": "poa_template_edit", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Form(){\n Input(Name:TemplateId, Class: hidden, Value: #template_id#)\n DBFind(@1poa_templates).Vars(pre).Where({\"id\": #template_id#, \"ecosystem\": #ecosystem_id#})\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1contract)\n }\n }\n Div(col-md-9){\n Input(Name:ContractName, Disabled: \"true\", Value: #pre_contract#)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt text-right){\n Label(){\n LangRes(@1params)\n }\n }\n Div(col-md-9){\n JsonToSource(pv, #pre_params#)\n ForList(Source: pv, Index: s_ind){\n SetVar(max_sec, #s_ind#)\n }\n If(#cs#==\"\"){\n SetVar(cs, #max_sec#)\n }\n If(Or(#del_flag#==1,#del_data#>0)){\n SetVar(cs, Calculate(Exp:#cs#-1, Type: int))\n }\n\n SetVar(next_sec, Calculate(Exp:#cs#+1, Type: int))\n SetVar(data_sec, Calculate(Exp:#cs#-#max_sec#, Type: int))\n\n ForList(Source: pv, Index: s_ind){\n If(#s_ind#>#cs#){\n }.Else{\n Div(row mt-sm){\n Div(col-md-10){\n Input(Name: ParamArr, Value: `#key#`)\n }\n Div(col-md-2 text-center){\n If(#s_ind#==#cs#){\n Button(Body: Em(Class: fa fa-trash), Class: btn btn-default, PageParams: \"template_id=#template_id#,cs=#cs#,del_data=#s_ind#\", Page: @1poa_template_edit).Popup(Header: $@1template_edit$, Width: \"50\")\n }\n }\n }\n }\n }\n Range(params_range, #max_sec#, #cs#)\n ForList(Source: params_range, Index: s_ind){\n Div(row mt-sm){\n Div(col-md-10){\n Input(Name: ParamArr)\n }\n Div(col-md-2 text-center){\n If(#s_ind#==#data_sec#){\n Button(Body: Em(Class: fa fa-trash), Class: btn btn-default, PageParams: \"template_id=#template_id#,cs=#cs#,del_flag=1\", Page: @1poa_template_edit).Popup(Header: $@1template_edit$, Width: \"50\")\n }\n }\n }\n }\n Button(Class: btn-xs btn-link mt, Page: @1poa_template_edit, PageParams: \"template_id=#template_id#,cs=#next_sec#\"){\n Span(Class: h5, Body: $@1add_parameter$)\n }.Popup(Header: $@1ecosystem$, Width: \"50\")\n }\n }\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right mt-sm, Page: @1poa_template_list, Contract: @1PoaTemplateEdit)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt-sm, Page: @1poa_template_list)\n}", + "Value": "Form(){\n Input(Name:TemplateId, Class: hidden, Value: #template_id#)\n DBFind(\"@1poa_templates\").Where({\"id\": \"#template_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(pre)\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1contract)\n }\n }\n Div(col-md-9){\n Input(Name:ContractName, Disabled: \"true\", Value: #pre_contract#)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt text-right){\n Label(){\n LangRes(@1params)\n }\n }\n Div(col-md-9){\n JsonToSource(pv, #pre_params#)\n ForList(Source: pv, Index: s_ind){\n SetVar(max_sec, #s_ind#)\n }\n If(#cs#==\"\"){\n SetVar(cs, #max_sec#)\n }\n If(Or(#del_flag#==1,#del_data#>0)){\n SetVar(cs, Calculate(Exp:#cs#-1, Type: int))\n }\n\n SetVar(next_sec, Calculate(Exp:#cs#+1, Type: int))\n SetVar(data_sec, Calculate(Exp:#cs#-#max_sec#, Type: int))\n\n ForList(Source: pv, Index: s_ind){\n If(#s_ind#>#cs#){\n }.Else{\n Div(row mt-sm){\n Div(col-md-10){\n Input(Name: ParamArr, Value: `#key#`)\n }\n Div(col-md-2 text-center){\n If(#s_ind#==#cs#){\n Button(Body: Em(Class: fa fa-trash), Class: btn btn-default, PageParams: \"template_id=#template_id#,cs=#cs#,del_data=#s_ind#\", Page: @1poa_template_edit).Popup(Header: $@1template_edit$, Width: \"50\")\n }\n }\n }\n }\n }\n Range(params_range, #max_sec#, #cs#)\n ForList(Source: params_range, Index: s_ind){\n Div(row mt-sm){\n Div(col-md-10){\n Input(Name: ParamArr)\n }\n Div(col-md-2 text-center){\n If(#s_ind#==#data_sec#){\n Button(Body: Em(Class: fa fa-trash), Class: btn btn-default, PageParams: \"template_id=#template_id#,cs=#cs#,del_flag=1\", Page: @1poa_template_edit).Popup(Header: $@1template_edit$, Width: \"50\")\n }\n }\n }\n }\n Button(Class: btn-xs btn-link mt, Page: @1poa_template_edit, PageParams: \"template_id=#template_id#,cs=#next_sec#\"){\n Span(Class: h5, Body: $@1add_parameter$)\n }.Popup(Header: $@1ecosystem$, Width: \"50\")\n }\n }\n Button(Body: LangRes(@1save), Class: btn btn-primary pull-right mt-sm, Page: @1poa_template_list, Contract: @1PoaTemplateEdit)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt-sm, Page: @1poa_template_list)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "poa_template_list", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1poa_template_list).(this_table, @1poa_templates)\nInclude(@1pager_header)\n\nSetTitle(\"$@1poa_template_list$\")\nSpan(Class: h5 m0 mb ml-lg){\n LinkPage(Class: ml-sm, Body: $@1poa_list$, Page: @1poa_list)\n Span(Class: text-muted mh-sm, Body: /)\n Span(Class: text-muted, Body: $@1poa_template_list$)\n}.Style(\n display: inline-block;\n)\nDBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Power of attorney\"}).Vars(application)\nSetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: poa_admin_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": #ecosystem_id#, \"$and\": [\"role->id\": {\"$in\": [#admin_roles#]}, \"role->id\": #role_id#], \"member->member_id\": #key_id#, \"deleted\": 0}).Vars(admin_access)\nIf(#admin_access_id# > 0){\n AddToolButton(Page: @1poa_template_add, Title: $@1template_add$, Icon: icon-plus).Popup(Header: $@1template_add$, Width: \"50\")\n}\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": #ecosystem_id#, \"contract\": {\"$ilike\": \"#search#\"}, \"deleted\": 0})\n}.Else{\n SetVar(where, {\"ecosystem\": #ecosystem_id#, \"deleted\": 0})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1contract))\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,contract,params,creator->member_id,creator->member_name,date_created,deleted\").Count(templates_count).Custom(_contract){\n Button(Class: btn-xs btn-link, PageParams: \"template_id=#id#\", Page: @1poa_add){\n Span(Class: h5 text-bold, Body: #contract#)\n }.Popup(50, $@1poa_add$)\n}.Custom(_creator){\n If(And(#creator.member_name#!=NULL,#creator.member_name#!=\"\")){\n LinkPage(Class: text-primary, Page: @1profile_view, PageParams: \"v_key_id=#creator.member_id#\"){\n #creator.member_name#\n }\n }\n}.Custom(_date){\n Div(h6){\n Div(text-nowrap){DateTime(DateTime: #date_created#, Format: \"DD.MM.YYYY HH:MI\")}\n }\n}.Custom(_params){\n Span(Class: text-muted h6){\n JsonToSource(pv, #params#)\n ForList(Source: pv, Index: s_ind){\n If(#s_ind#>1){\n Span(\",\").Style(margin-right: 5px;)\n }\n \"#key#\"\n }\n }\n}.Custom(_action){\n If(#creator.member_id#==#key_id#){\n Div(text-right button-group text-nowrap){\n If(#deleted# == 0){\n Button(Class: btn bg-gray-lighter, Contract: @1PoaTemplateDelete, Params: \"TemplateId=#id#\", Page: #this_page#){\n Em(Class: text-danger fa fa-1x fa-trash)\n }.Alert(Text: \"$@1sure_want_delete$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n Button(Class: fa fa-edit btn bg-gray-lighter mh-sm, PageParams: \"template_id=#id#\", Page: @1poa_template_edit).Popup(50, $@1template_edit$)\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1contract$=_contract,$@1date_created$=_date,$@1creator$=_creator,$@1params$=_params,=_action\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1poa_template_list$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, @1poa_template_list).(this_table, @1poa_templates)\nInclude(@1pager_header)\n\nSetTitle(\"$@1poa_template_list$\")\nSpan(Class: h5 m0 mb ml-lg){\n LinkPage(Class: ml-sm, Body: $@1poa_list$, Page: @1poa_list)\n Span(Class: text-muted mh-sm, Body: /)\n Span(Class: text-muted, Body: $@1poa_template_list$)\n}.Style(\n display: inline-block;\n)\nDBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Power of attorney\"}).Vars(application)\nSetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: poa_admin_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#admin_roles#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\nIf(#admin_access_id# > 0){\n AddToolButton(Page: @1poa_template_add, Title: $@1template_add$, Icon: icon-plus).Popup(Header: $@1template_add$, Width: \"50\")\n}\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"contract\": {\"$ilike\": \"#search#\"}, \"deleted\": 0})\n}.Else{\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1contract))\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns(\"id,contract,params,creator->account,creator->member_name,date_created,deleted\").Count(templates_count).Custom(_contract){\n Button(Class: btn-xs btn-link, PageParams: \"template_id=#id#\", Page: @1poa_add){\n Span(Class: h5 text-bold, Body: #contract#)\n }.Popup(50, $@1poa_add$)\n}.Custom(_creator){\n If(And(#creator.member_name#!=NULL,#creator.member_name#!=\"\")){\n LinkPage(Class: text-primary, Page: @1profile_view, PageParams: \"v_account=#creator.account#\"){\n #creator.member_name#\n }\n }\n}.Custom(_date){\n Div(h6){\n Div(text-nowrap){DateTime(DateTime: #date_created#, Format: \"DD.MM.YYYY HH:MI\")}\n }\n}.Custom(_params){\n Span(Class: text-muted h6){\n JsonToSource(pv, #params#)\n ForList(Source: pv, Index: s_ind){\n If(#s_ind#>1){\n Span(\",\").Style(margin-right: 5px;)\n }\n \"#key#\"\n }\n }\n}.Custom(_action){\n If(#creator.account# == #account_id#){\n Div(text-right button-group text-nowrap){\n If(#deleted# == 0){\n Button(Class: btn bg-gray-lighter, Contract: @1PoaTemplateDelete, Params: \"TemplateId=#id#\", Page: #this_page#){\n Em(Class: text-danger fa fa-1x fa-trash)\n }.Alert(Text: \"$@1sure_want_delete$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n Button(Class: fa fa-edit btn bg-gray-lighter mh-sm, PageParams: \"template_id=#id#\", Page: @1poa_template_edit).Popup(50, $@1template_edit$)\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1contract$=_contract,$@1date_created$=_date,$@1creator$=_creator,$@1params$=_params,=_action\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1poa_template_list$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "poa_view", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Form(){\n Input(Name:TemplateId, Class: hidden, Value: #template_id#)\n DBFind(@1poa).Vars(pre).Where({\"id\": #poa_id#, \"ecosystem\": #ecosystem_id#}).Columns(\"poa_sender->member_id,poa_recipient->member_id,contract,params,date_expiration\")\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1sender)\n }\n }\n Div(col-md-9){\n SetVar(sender_id, Address(#pre_poa_sender_member_id#))\n Input(Name: Recipient, Disabled: \"true\", Value: #sender_id#)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1recipient)\n }\n }\n Div(col-md-9){\n SetVar(recipient_id, Address(#pre_poa_recipient_member_id#))\n Input(Name: Recipient, Disabled: \"true\", Value: #recipient_id#)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1expiration_date)\n }\n }\n Div(col-md-9){\n SetVar(date_expiration, DateTime(DateTime: #pre_date_expiration#, Format: \"DD.MM.YYYY HH:MI\"))\n Input(Name: DateExpiration, Disabled: \"true\", Value: #date_expiration#)\n }\n }\n Div(row mt-lg){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1contract)\n }\n }\n Div(col-md-9){\n Input(Name: ContractName, Disabled: \"true\", Value: #pre_contract#)\n }\n }\n Div(row mt){\n Div(col-md-3){}\n Div(col-md-9){\n Div(row){\n Div(col-md-12){\n Div(row){\n Div(col-md-6){\n Span(Class: h6 m0 text-muted, Body: $@1parameter$)\n }\n Div(col-md-6){\n Span(Class: h6 m0 text-muted, Body: $@1value$)\n }\n }\n JsonToSource(pv, #pre_params#)\n ForList(Source: pv){\n Div(row mt-sm){\n Div(col-md-6){\n Input(Name: ParamArr, Value: `#key#`, Disabled: 1)\n }\n Div(col-md-6){\n Input(Name: ValueArr, Value: `#value#`, Disabled: 1)\n }\n }\n }\n }\n }\n }\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1poa_list)\n}", + "Value": "Form(){\n Input(Name:TemplateId, Class: hidden, Value: #template_id#)\n DBFind(\"@1poa\").Where({\"id\": \"#poa_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Columns(\"poa_sender->account,poa_recipient->account,contract,params,date_expiration\").Vars(pre)\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1sender)\n }\n }\n Div(col-md-9){\n Input(Name: Recipient, Disabled: \"true\", Value: #pre_poa_sender_account#)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1recipient)\n }\n }\n Div(col-md-9){\n Input(Name: Recipient, Disabled: \"true\", Value: #pre_poa_recipient_account#)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1expiration_date)\n }\n }\n Div(col-md-9){\n SetVar(date_expiration, DateTime(DateTime: #pre_date_expiration#, Format: \"DD.MM.YYYY HH:MI\"))\n Input(Name: DateExpiration, Disabled: \"true\", Value: #date_expiration#)\n }\n }\n Div(row mt-lg){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1contract)\n }\n }\n Div(col-md-9){\n Input(Name: ContractName, Disabled: \"true\", Value: #pre_contract#)\n }\n }\n Div(row mt){\n Div(col-md-3){}\n Div(col-md-9){\n Div(row){\n Div(col-md-12){\n Div(row){\n Div(col-md-6){\n Span(Class: h6 m0 text-muted, Body: $@1parameter$)\n }\n Div(col-md-6){\n Span(Class: h6 m0 text-muted, Body: $@1value$)\n }\n }\n JsonToSource(pv, #pre_params#)\n ForList(Source: pv){\n Div(row mt-sm){\n Div(col-md-6){\n Input(Name: ParamArr, Value: `#key#`, Disabled: 1)\n }\n Div(col-md-6){\n Input(Name: ValueArr, Value: `#value#`, Disabled: 1)\n }\n }\n }\n }\n }\n }\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1poa_list)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "tokens_send", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, \"@1tokens_send\")\n\nIf(#back_page# == \"\"){\n If(#parent_back_page# != \"\"){\n SetVar(back_page, #parent_back_page#)\n }.Else{\n SetVar(back_page, \"@1members_list\")\n }\n}\nIf(#MemberId# != \"\"){\n SetVar(v_key_id, #MemberId#)\n}\nIf(Or(#v_key_id#>0,#v_key_id#<0)){\n SetVar(Name: v_address, Value: Address(#v_key_id#))\n}.Else{\n SetVar(Name: v_address, Value: \"\")\n}\nIf(#v_amount# == \"\"){\n SetVar(Name: v_amount, Value: \"\")\n}\n\nDBFind(\"@1keys\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #key_id#}).Vars(\"tokens\")\nDBFind(\"@1ecosystems\").Where({\"id\": #ecosystem_id#}).Vars(\"custom\")\nIf(#ecosystem_id# == 1){\n SetVar(token_title, \"APLA\")\n}.Else{\n SetVar(token_title, #custom_token_title#)\n}\n\nIf(Or(#ecosystem_id# == 1, #custom_token_title# != \"\")){\n Form(){\n If(#poa# == 1){\n Div(row){\n Div(col-sm-3 mt-sm text-right){\n Label($@1poa$)\n Span(Class: text-danger, Body:*)\n }\n Div(col-sm-9){\n Div(input-group){\n DBFind(@1poa, src_poa).Where({\"poa_recipient->member_id\": #key_id#, \"contract\": \"@1PoaTokensSend\", \"ecosystem\": #ecosystem_id#, \"deleted\": 0}).Columns(\"id,poa_sender,poa_sender->member_id,params->amount_max\").Count(poa_count).Custom(_name){\n DBFind(@1keys).Where({\"id\": #poa_sender.member_id#, \"ecosystem\": #ecosystem_id#}).Columns(\"amount\").Vars(k)\n Address(#poa_sender.member_id#) (Money(#k_amount#) #token_title#, Max: Money(#params.amount_max#))\n }.Custom(_id){\n #poa_sender.member_id#\n }\n If(#poa_count#>0){\n Select(Name: Sender, Source: src_poa, NameColumn: _name, ValueColumn: poa_sender.member_id)\n }.Else{\n Input(Name: SenderNF, Disabled: 1, Placeholder: $@1poa_not_found$)\n }\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-toggle-on buttons, Page: @1tokens_send, PageParams: \"back_page=#back_page#,poa=0,v_key_id=#v_key_id#,v_amount=Val(Amount)\").Popup(Header: $@1tokens_send$, Width: \"50\")\n }\n }\n Div(Class: m0 h6 text-muted, Body: $@1send_tokens_by_poa$)\n }\n }\n }.Else{\n Div(row){\n Div(col-sm-3 mt-sm text-right){\n Label($@1sender$)\n Span(Class: text-danger, Body:*)\n }\n Div(col-sm-9){\n Div(input-group){\n SetVar(m_a, Address(#key_id#) (Money(#tokens_amount#) #token_title#))\n Input(Name: Sender, Disabled: 1, Value: #m_a#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-toggle-off buttons, Page: @1tokens_send, PageParams: \"back_page=#back_page#,poa=1,v_key_id=#v_key_id#,v_amount=Val(Amount)\").Popup(Header: $@1tokens_send$, Width: \"50\")\n }\n }\n Div(Class: m0 h6 text-muted, Body: $@1send_tokens_my_balance$)\n }\n }\n }\n Div(row mt){\n Div(col-sm-3 mt-sm text-right){\n Label($@1recipient$)\n Span(Class: text-danger, Body:*)\n }\n Div(col-sm-9){\n Div(input-group){\n Input(Name: Recipient, Disabled: 1, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\", Value: #v_address#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:\"back_page=#this_page#,back_header=$@1tokens_send$,parent_back_page=#back_page#,EcosystemId=#ecosystem_id#\").Popup(Header: $@1member$, Width: \"50\")\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 mt-sm text-right){\n Label(){\n Span(Body: $@1amount$ (#token_title#))\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-sm-9){\n Input(Name: Amount, Type: Number, Value: #v_amount#)\n }\n }\n If(#poa# == 1){\n If(#poa_count#>0){\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right mt, Page: #back_page#, Contract: @1PoaTokensSend).Alert(Text: \"$@1want_send_tokens$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }.Else{\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right mt, Page: #back_page#, Contract: @1TokensSend).Alert(Text: \"$@1want_send_tokens$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#)\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n )\n}.Else{\n Form(){\n Div(row){\n Div(col-sm-12){\n Span(Body: $@1ecosystem_no_tokens$)\n }\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#)\n }\n}", + "Value": "SetVar(this_page, \"@1tokens_send\")\n\nIf(#back_page# == \"\"){\n If(#parent_back_page# != \"\"){\n SetVar(back_page, #parent_back_page#)\n }.Else{\n SetVar(back_page, \"@1members_list\")\n }\n}\nIf(#MemberAccount#){\n SetVar(v_account, #MemberAccount#)\n}\nIf(#v_account#){\n SetVar(Name: v_address, Value: #v_account#)\n}\n\nDBFind(\"@1keys\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#account_id#\", \"deleted\": 0}).Vars(tokens)\nDBFind(\"@1ecosystems\").Where({\"id\": \"#ecosystem_id#\"}).Vars(custom)\nIf(#ecosystem_id# == 1){\n SetVar(token_title, \"APLA\")\n}.Else{\n SetVar(token_title, #custom_token_title#)\n}\n\nIf(Or(#ecosystem_id# == 1, #custom_token_title# != \"\")){\n Form(){\n If(#poa# == 1){\n Div(row){\n Div(col-sm-3 mt-sm text-right){\n Label($@1poa$)\n Span(Class: text-danger, Body:*)\n }\n Div(col-sm-9){\n Div(input-group){\n DBFind(\"@1poa\", src_poa).Where({\"poa_recipient->account\": \"#account_id#\", \"contract\": \"@1PoaTokensSend\", \"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0}).Columns(\"id,poa_sender,poa_sender->account,params->amount_max\").Count(poa_count).Custom(_name){\n DBFind(\"@1keys\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#poa_sender.account#\", \"deleted\": 0}).Columns(\"amount\").Vars(k)\n #poa_sender.account# (Money(#k_amount#) #token_title#, Max: Money(#params.amount_max#))\n }.Custom(_id){\n #poa_sender.account#\n }\n If(#poa_count#>0){\n Select(Name: Sender, Source: src_poa, NameColumn: _name, ValueColumn: poa_sender.account)\n }.Else{\n Input(Name: SenderNF, Disabled: 1, Placeholder: $@1poa_not_found$)\n }\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-toggle-on buttons, Page: @1tokens_send, PageParams: \"back_page=#back_page#,poa=0,v_account=#v_account#,v_amount=Val(Amount)\").Popup(Header: $@1tokens_send$, Width: \"50\")\n }\n }\n Div(Class: m0 h6 text-muted, Body: $@1send_tokens_by_poa$)\n }\n }\n }.Else{\n Div(row){\n Div(col-sm-3 mt-sm text-right){\n Label($@1sender$)\n Span(Class: text-danger, Body:*)\n }\n Div(col-sm-9){\n Div(input-group){\n SetVar(m_a, #account_id# (Money(#tokens_amount#) #token_title#))\n Input(Name: Sender, Disabled: 1, Value: #m_a#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-toggle-off buttons, Page: @1tokens_send, PageParams: \"back_page=#back_page#,poa=1,v_account=#v_account#,v_amount=Val(Amount)\").Popup(Header: $@1tokens_send$, Width: \"50\")\n }\n }\n Div(Class: m0 h6 text-muted, Body: $@1send_tokens_my_balance$)\n }\n }\n }\n Div(row mt){\n Div(col-sm-3 mt-sm text-right){\n Label($@1recipient$)\n Span(Class: text-danger, Body:*)\n }\n Div(col-sm-9){\n Div(input-group){\n Input(Name: Recipient, Disabled: 1, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\", Value: #v_address#)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:\"back_page=#this_page#,back_header=$@1tokens_send$,parent_back_page=#back_page#,EcosystemId=#ecosystem_id#\").Popup(Header: $@1member$, Width: \"50\")\n }\n }\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 mt-sm text-right){\n Label(){\n Span(Body: $@1amount$ (#token_title#))\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-sm-9){\n Input(Name: Amount, Type: Number, Value: #v_amount#)\n }\n }\n If(#poa# == 1){\n If(#poa_count#>0){\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right mt, Page: #back_page#, Contract: @1PoaTokensSend).Alert(Text: \"$@1want_send_tokens$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }.Else{\n Button(Body: LangRes(@1send), Class: btn btn-primary pull-right mt, Page: #back_page#, Contract: @1TokensSend).Alert(Text: \"$@1want_send_tokens$\", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#)\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n )\n}.Else{\n Form(){\n Div(row){\n Div(col-sm-12){\n Span(Body: $@1ecosystem_no_tokens$)\n }\n }\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: #back_page#)\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "PoaAdd", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract PoaAdd {\n data {\n Recipient string\n DateExpiration string \"optional\"\n TimeExpiration string \"optional\"\n TemplateId int\n ParamArr array\n ValueArr array\n }\n\n func getMemberInfo(kid int) map {\n var res member map\n member = DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"id\": kid}).Row()\n if member {\n res[\"member_id\"] = member[\"id\"]\n res[\"member_name\"] = member[\"member_name\"]\n res[\"image_id\"] = member[\"image_id\"]\n } else {\n member = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": kid}).Row()\n if member {\n res[\"member_id\"] = member[\"id\"]\n res[\"member_name\"] = IdToAddress(Int(member[\"id\"]))\n res[\"image_id\"] = 0\n }\n }\n return res\n }\n\n func trimZeroTime(s string) string {\n if Contains(s, \"T00:00:00Z\") {\n s = Replace(s, \"T00:00:00Z\", \"\")\n }\n return s\n }\n\n func dateAddTime(d, t string) string {\n var dt string\n if Size(t) == 5 {\n dt = Sprintf(\"%v %v:00\", trimZeroTime(d), t)\n }\n return dt\n }\n\n conditions {\n //check date\n $date_expiration = dateAddTime($DateExpiration, $TimeExpiration)\n if UnixDateTime($date_expiration) == 0 { // invalid datetimes\n warning LangRes(\"@1invalid_expiration_date\", \"en\")\n }\n\n //check the recipient key\n $recipient_id = AddressToId($Recipient)\n if $recipient_id == 0 {\n warning Sprintf(LangRes(\"@1recipient_x_invalid\", \"en\"), $Recipient)\n }\n\n //check template\n $template_map = DBFind(\"@1poa_templates\").Where({\"ecosystem\": $ecosystem_id, \"id\": $TemplateId}).Row()\n if !$template_map {\n warning Sprintf(LangRes(\"@1poa_template_not_found\", \"en\"), $Recipient)\n }\n }\n\n action {\n var i int params map\n while i < Len($ParamArr) {\n params[$ParamArr[i]] = $ValueArr[i]\n i = i + 1\n }\n\n var m map\n m[\"contract\"] = $template_map[\"contract\"]\n m[\"date_created\"] = $block_time\n m[\"date_expiration\"] = UnixDateTime($date_expiration)\n m[\"deleted\"] = 0\n m[\"ecosystem\"] = $ecosystem_id\n m[\"params\"] = params\n m[\"poa_recipient\"] = getMemberInfo($recipient_id )\n m[\"poa_sender\"] = getMemberInfo($key_id)\n m[\"template_id\"] = $TemplateId\n $result = DBInsert(\"@1poa\", m)\n }\n}", + "Value": "contract PoaAdd {\n data {\n Recipient string\n DateExpiration string \"optional\"\n TimeExpiration string \"optional\"\n TemplateId int\n ParamArr array\n ValueArr array\n }\n\n func getMemberInfo(account string) map {\n var res member map\n member = DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"account\": account}).Row()\n if member {\n res[\"account\"] = member[\"account\"]\n res[\"member_name\"] = member[\"member_name\"]\n res[\"image_id\"] = member[\"image_id\"]\n } else {\n member = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": account, \"deleted\": 0}).Row()\n if member {\n res[\"account\"] = member[\"account\"]\n res[\"member_name\"] = member[\"account\"]\n res[\"image_id\"] = 0\n }\n }\n return res\n }\n\n func trimZeroTime(s string) string {\n if Contains(s, \"T00:00:00Z\") {\n s = Replace(s, \"T00:00:00Z\", \"\")\n }\n return s\n }\n\n func dateAddTime(d, t string) string {\n var dt string\n if Size(t) == 5 {\n dt = Sprintf(\"%v %v:00\", trimZeroTime(d), t)\n }\n return dt\n }\n\n conditions {\n //check date\n $date_expiration = dateAddTime($DateExpiration, $TimeExpiration)\n if UnixDateTime($date_expiration) == 0 { // invalid datetimes\n warning LangRes(\"@1invalid_expiration_date\", \"en\")\n }\n\n //check the recipient key\n var recipient_key int\n recipient_key = AddressToId($Recipient)\n if recipient_key == 0 {\n warning Sprintf(LangRes(\"@1recipient_x_invalid\", \"en\"), $Recipient)\n }\n\n //check template\n $template_map = DBFind(\"@1poa_templates\").Where({\"ecosystem\": $ecosystem_id, \"id\": $TemplateId}).Row()\n if !$template_map {\n warning Sprintf(LangRes(\"@1poa_template_not_found\", \"en\"), $Recipient)\n }\n }\n\n action {\n var i int params map\n while i < Len($ParamArr) {\n params[$ParamArr[i]] = $ValueArr[i]\n i = i + 1\n }\n\n var m map\n m[\"contract\"] = $template_map[\"contract\"]\n m[\"date_created\"] = $block_time\n m[\"date_expiration\"] = UnixDateTime($date_expiration)\n m[\"deleted\"] = 0\n m[\"ecosystem\"] = $ecosystem_id\n m[\"params\"] = params\n m[\"poa_recipient\"] = getMemberInfo($Recipient)\n m[\"poa_sender\"] = getMemberInfo($account_id)\n m[\"template_id\"] = $TemplateId\n $result = DBInsert(\"@1poa\", m)\n }\n}", "Type": "contracts" }, { "Name": "PoaDelete", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract PoaDelete {\n data {\n PoaeId int\n }\n\n conditions {\n var poa_map map\n poa_map = DBFind(\"@1poa\").Where({\"id\": $PoaeId, \"ecosystem\": $ecosystem_id}).Columns(\"id,poa_sender->member_id\").Row()\n if !poa_map {\n warning LangRes(\"@1poa_not_found\", \"en\")\n }\n if Int(poa_map[\"poa_sender.member_id\"]) != $key_id {\n warning LangRes(\"@1poa_not_rights_to_delete\", \"en\")\n }\n }\n\n action {\n var m map\n m[\"deleted\"] = 1\n m[\"date_deleted\"] = $block_time\n DBUpdate(\"@1poa\", $PoaeId, m)\n }\n}", + "Value": "contract PoaDelete {\n data {\n PoaId int\n }\n\n conditions {\n var poa_map map\n poa_map = DBFind(\"@1poa\").Where({\"id\": $PoaId, \"ecosystem\": $ecosystem_id}).Columns(\"id,poa_sender->account\").Row()\n if !poa_map {\n warning LangRes(\"@1poa_not_found\", \"en\")\n }\n if poa_map[\"poa_sender.account\"] != $account_id {\n warning LangRes(\"@1poa_not_rights_to_delete\", \"en\")\n }\n }\n\n action {\n var m map\n m[\"deleted\"] = 1\n m[\"date_deleted\"] = $block_time\n DBUpdate(\"@1poa\", $PoaId, m)\n }\n}", "Type": "contracts" }, { @@ -115,31 +115,31 @@ { "Name": "PoaTemplateAdd", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract PoaTemplateAdd {\n data {\n ContractName string\n ParamArr array\n }\n\n func getMemberInfo(kid int) map {\n var res member map\n member = DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"id\": kid}).Row()\n if member {\n res[\"member_id\"] = member[\"id\"]\n res[\"member_name\"] = member[\"member_name\"]\n res[\"image_id\"] = member[\"image_id\"]\n } else {\n member = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": kid}).Row()\n if member {\n res[\"member_id\"] = member[\"id\"]\n res[\"member_name\"] = IdToAddress(Int(member[\"id\"]))\n res[\"image_id\"] = 0\n }\n }\n return res\n }\n\n conditions {\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Power of attorney\"}).One(\"id\")\n var admin_ids string\n admin_ids = AppParam(Int($app), \"poa_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+admin_ids+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1poa_not_rights_to_create\", \"en\")\n }\n }\n\n action {\n var i int params map\n while i < Len($ParamArr) {\n params[$ParamArr[i]] = \"\"\n i = i + 1\n }\n\n var m map\n m[\"creator\"] = getMemberInfo($key_id)\n m[\"contract\"] = $ContractName\n m[\"date_created\"] = $block_time\n m[\"params\"] = params\n m[\"deleted\"] = 0\n m[\"ecosystem\"] = $ecosystem_id\n $result = DBInsert(\"@1poa_templates\", m)\n }\n}", + "Value": "contract PoaTemplateAdd {\n data {\n ContractName string\n ParamArr array\n }\n\n func getMemberInfo(account string) map {\n var res member map\n member = DBFind(\"@1members\").Where({\"ecosystem\": $ecosystem_id, \"account\": account}).Row()\n if member {\n res[\"account\"] = member[\"account\"]\n res[\"member_name\"] = member[\"member_name\"]\n res[\"image_id\"] = member[\"image_id\"]\n } else {\n member = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": account, \"deleted\": 0}).Row()\n if member {\n res[\"account\"] = member[\"account\"]\n res[\"member_name\"] = member[\"account\"]\n res[\"image_id\"] = 0\n }\n }\n return res\n }\n\n conditions {\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Power of attorney\"}).One(\"id\")\n var admin_ids string\n admin_ids = AppParam(Int($app), \"poa_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+admin_ids+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1poa_not_rights_to_create\", \"en\")\n }\n }\n\n action {\n var i int params map\n while i < Len($ParamArr) {\n params[$ParamArr[i]] = \"\"\n i = i + 1\n }\n\n var m map\n m[\"creator\"] = getMemberInfo($account_id)\n m[\"contract\"] = $ContractName\n m[\"date_created\"] = $block_time\n m[\"params\"] = params\n m[\"deleted\"] = 0\n m[\"ecosystem\"] = $ecosystem_id\n $result = DBInsert(\"@1poa_templates\", m)\n }\n}", "Type": "contracts" }, { "Name": "PoaTemplateDelete", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract PoaTemplateDelete {\n data {\n TemplateId int\n }\n\n conditions {\n var poa_map map\n poa_map = DBFind(\"@1poa_templates\").Where({\"id\": $TemplateId, \"ecosystem\": $ecosystem_id}).Columns(\"id,creator->member_id\").Row()\n if !poa_map {\n warning LangRes(\"@1poa_template_not_found\", \"en\")\n }\n if Int(poa_map[\"creator.member_id\"]) != $key_id {\n warning LangRes(\"@1poa_not_rights_to_delete\", \"en\")\n }\n }\n\n action {\n var m map\n m[\"deleted\"] = 1\n m[\"date_deleted\"] = $block_time\n DBUpdate(\"@1poa_templates\", $TemplateId, m)\n }\n}", + "Value": "contract PoaTemplateDelete {\n data {\n TemplateId int\n }\n\n conditions {\n var poa_map map\n poa_map = DBFind(\"@1poa_templates\").Where({\"id\": $TemplateId, \"ecosystem\": $ecosystem_id}).Columns(\"id,creator->account\").Row()\n if !poa_map {\n warning LangRes(\"@1poa_template_not_found\", \"en\")\n }\n if poa_map[\"creator.account\"] != $account_id {\n warning LangRes(\"@1poa_not_rights_to_delete\", \"en\")\n }\n }\n\n action {\n var m map\n m[\"deleted\"] = 1\n m[\"date_deleted\"] = $block_time\n DBUpdate(\"@1poa_templates\", $TemplateId, m)\n }\n}", "Type": "contracts" }, { "Name": "PoaTemplateEdit", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract PoaTemplateEdit {\n data {\n TemplateId int\n ParamArr array\n }\n\n conditions {\n var poa_template_map map\n poa_template_map = DBFind(\"@1poa_templates\").Where({\"id\": $TemplateId, \"ecosystem\": $ecosystem_id}).Columns(\"id,creator->member_id\").Row()\n if !poa_template_map {\n warning LangRes(\"@1poa_template_not_found\", \"en\")\n }\n if Int(poa_template_map[\"creator.member_id\"]) != $key_id {\n warning LangRes(\"@1poa_not_rights_to_edit\", \"en\")\n }\n }\n\n action {\n var i int params map\n while i < Len($ParamArr) {\n params[$ParamArr[i]] = \"\"\n i = i + 1\n }\n\n var m map\n m[\"params\"] = params\n DBUpdate(\"@1poa_templates\", $TemplateId, m)\n }\n}", + "Value": "contract PoaTemplateEdit {\n data {\n TemplateId int\n ParamArr array\n }\n\n conditions {\n var poa_template_map map\n poa_template_map = DBFind(\"@1poa_templates\").Where({\"id\": $TemplateId, \"ecosystem\": $ecosystem_id}).Columns(\"id,creator->account\").Row()\n if !poa_template_map {\n warning LangRes(\"@1poa_template_not_found\", \"en\")\n }\n if poa_template_map[\"creator.account\"] != $account_id {\n warning LangRes(\"@1poa_not_rights_to_edit\", \"en\")\n }\n }\n\n action {\n var i int params map\n while i < Len($ParamArr) {\n params[$ParamArr[i]] = \"\"\n i = i + 1\n }\n\n var m map\n m[\"params\"] = params\n DBUpdate(\"@1poa_templates\", $TemplateId, m)\n }\n}", "Type": "contracts" }, { "Name": "PoaUpdateParams", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract PoaUpdateParams {\n data {\n PoaId int\n ParamsStr string\n }\n\n func getPermission(cntr string) {\n var prevContract string\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n if cntr != prevContract {\n warning LangRes(\"@1contract_chain_distorted\", \"en\")\n }\n }\n\n conditions {\n var poa_map map\n poa_map = DBFind(\"@1poa\").Where({\"id\": $PoaId, \"ecosystem\": $ecosystem_id, \"deleted\": 0}).Columns(\"id,date_expiration,contract,poa_recipient->member_id\").Row()\n\n if !poa_map {\n warning LangRes(\"@1poa_not_found\", \"en\")\n }\n\n if Int(poa_map[\"poa_recipient.member_id\"]) != $key_id {\n warning LangRes(\"@1poa_not_rights_to_change\", \"en\")\n }\n\n if UnixDateTime(BlockTime()) > Int(poa_map[\"date_expiration\"]) {\n warning LangRes(\"@1poa_expired\", \"en\")\n }\n\n getPermission(Str(poa_map[\"contract\"]))\n }\n\n action {\n var m map\n m = JSONDecode($ParamsStr)\n DBUpdate(\"@1poa\", Int($PoaId), {\"params\": m})\n }\n}", + "Value": "contract PoaUpdateParams {\n data {\n PoaId int\n ParamsStr string\n }\n\n func getPermission(cntr string) {\n var prevContract string\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n if cntr != prevContract {\n warning LangRes(\"@1contract_chain_distorted\", \"en\")\n }\n }\n\n conditions {\n var poa_map map\n poa_map = DBFind(\"@1poa\").Where({\"id\": $PoaId, \"ecosystem\": $ecosystem_id, \"deleted\": 0}).Columns(\"id,date_expiration,contract,poa_recipient->account\").Row()\n\n if !poa_map {\n warning LangRes(\"@1poa_not_found\", \"en\")\n }\n\n if poa_map[\"poa_recipient.account\"] != $account_id {\n warning LangRes(\"@1poa_not_rights_to_change\", \"en\")\n }\n\n if UnixDateTime(BlockTime()) > Int(poa_map[\"date_expiration\"]) {\n warning LangRes(\"@1poa_expired\", \"en\")\n }\n\n getPermission(Str(poa_map[\"contract\"]))\n }\n\n action {\n var m map\n m = JSONDecode($ParamsStr)\n DBUpdate(\"@1poa\", Int($PoaId), {\"params\": m})\n }\n}", "Type": "contracts" }, { "Name": "PoaTokensSend", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract PoaTokensSend {\n data {\n Amount money\n Sender string\n Recipient string\n Comment string \"optional\"\n }\n\n func getPermission() {\n var array_permissions array result i int prevContract string\n array_permissions = [\"@1PoaTokensSend\"]\n\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n while i < Len(array_permissions) {\n var contract_name string\n contract_name = array_permissions[i]\n if contract_name==prevContract {\n result = 1\n }\n i = i + 1\n }\n\n if result == 0 {\n warning LangRes(\"@1tokens_transfer_cannot_be_made\", \"en\")\n }\n }\n\n func checkKeys() {\n $sender_id = AddressToId($Sender)\n $recipient_id = AddressToId($Recipient)\n\n //check the sender key\n if $sender_id == 0 {\n warning Sprintf(LangRes(\"@1sender_x_invalid\", \"en\"), $Sender)\n }\n //check the recipient key\n if $recipient_id == 0 {\n warning Sprintf(LangRes(\"@1recipient_x_invalid\", \"en\"), $Recipient)\n }\n }\n\n func checkPoa() {\n var poa_map map\n poa_map = DBFind(\"@1poa\").Where({\"contract\": \"@1PoaTokensSend\", \"poa_sender->member_id\": $sender_id, \"poa_recipient->member_id\": $key_id, \"ecosystem\": $ecosystem_id, \"deleted\": 0}).Columns(\"id,date_expiration,params->amount_max,params->amount_max_day,params->amount_max_month,params->amount_day,params->amount_month,params->date_day,params->date_month\").Row()\n if !poa_map {\n warning LangRes(\"@1poa_not_found\", \"en\")\n }\n\n if UnixDateTime(BlockTime()) > Int(poa_map[\"date_expiration\"]) {\n warning LangRes(\"@1poa_expired\", \"en\")\n }\n\n $poa_id = poa_map[\"id\"]\n $amount_max = poa_map[\"params.amount_max\"]\n $amount_max_day = poa_map[\"params.amount_max_day\"]\n $amount_max_month = poa_map[\"params.amount_max_month\"]\n $amount_day = poa_map[\"params.amount_day\"]\n $amount_month = poa_map[\"params.amount_month\"]\n $date_day = poa_map[\"params.date_day\"] // 2018-10-19 00:00:00\n $date_month = poa_map[\"params.date_month\"] // 2018-10-01 00:00:00\n\n $cur_date_day = UnixDateTime(Substr(BlockTime(), 0, 10) + \" 00:00:00\")\n $cur_date_month = UnixDateTime(Substr(BlockTime(), 0, 8) + \"01 00:00:00\")\n }\n\n func checkLimit() {\n if Int($cur_date_day) > Int($date_day) {\n $date_day = $cur_date_day\n $amount_day = 0\n }\n if Int($cur_date_month) > Int($date_month) {\n $date_month = $cur_date_month\n $amount_month = 0\n }\n\n if Money($amount_max) < Money($Amount) {\n warning LangRes(\"poa_exceeded_single_limit\", \"en\")\n }\n if Money($amount_max_day) < Money($amount_day) + Money($Amount) {\n warning LangRes(\"poa_exceeded_daily_limit\", \"en\")\n }\n if Money($amount_max_month) < Money($amount_month) + Money($Amount) {\n warning LangRes(\"poa_exceeded_monthly_limit\", \"en\")\n }\n }\n\n func updateParams() {\n $amount_day = Money($amount_day) + Money($Amount)\n $amount_month = Money($amount_month) + Money($Amount)\n\n var m map\n m[\"amount_max\"] = Str($amount_max)\n m[\"amount_max_day\"] = Str($amount_max_day)\n m[\"amount_max_month\"] = Str($amount_max_month)\n m[\"amount_day\"] = Str($amount_day)\n m[\"amount_month\"] = Str($amount_month)\n m[\"date_day\"] = Str($date_day)\n m[\"date_month\"] = Str($date_month)\n\n @1PoaUpdateParams(\"PoaId,ParamsStr\", Int($poa_id), JSONEncode(m))\n }\n\n conditions {\n getPermission()\n checkKeys()\n checkPoa()\n checkLimit()\n }\n\n action {\n @1TokensTransfer(\"Amount,SenderId,RecipientId,Comment\", $Amount, $sender_id, $recipient_id, $Comment)\n updateParams()\n }\n}", + "Value": "contract PoaTokensSend {\n data {\n Amount money\n Sender string\n Recipient string\n Comment string \"optional\"\n }\n\n func getPermission() {\n var array_permissions array result i int prevContract string\n array_permissions = [\"@1PoaTokensSend\"]\n\n prevContract = $stack[0]\n if Len($stack) > 2 {\n prevContract = $stack[Len($stack) - 2]\n }\n while i < Len(array_permissions) {\n var contract_name string\n contract_name = array_permissions[i]\n if contract_name==prevContract {\n result = 1\n }\n i = i + 1\n }\n\n if result == 0 {\n warning LangRes(\"@1tokens_transfer_cannot_be_made\", \"en\")\n }\n }\n\n func checkKeys() {\n var sender_key, recipient_key int\n sender_key = AddressToId($Sender)\n recipient_key = AddressToId($Recipient)\n\n //check the sender key\n if sender_key == 0 {\n warning Sprintf(LangRes(\"@1sender_x_invalid\", \"en\"), $Sender)\n }\n //check the recipient key\n if recipient_key == 0 {\n warning Sprintf(LangRes(\"@1recipient_x_invalid\", \"en\"), $Recipient)\n }\n }\n\n func checkPoa() {\n var poa_map map\n poa_map = DBFind(\"@1poa\").Where({\"contract\": \"@1PoaTokensSend\", \"poa_sender->account\": $Sender, \"poa_recipient->account\": $account_id, \"ecosystem\": $ecosystem_id, \"deleted\": 0}).Columns(\"id,date_expiration,params->amount_max,params->amount_max_day,params->amount_max_month,params->amount_day,params->amount_month,params->date_day,params->date_month\").Row()\n if !poa_map {\n warning LangRes(\"@1poa_not_found\", \"en\")\n }\n\n if UnixDateTime(BlockTime()) > Int(poa_map[\"date_expiration\"]) {\n warning LangRes(\"@1poa_expired\", \"en\")\n }\n\n $poa_id = poa_map[\"id\"]\n $amount_max = poa_map[\"params.amount_max\"]\n $amount_max_day = poa_map[\"params.amount_max_day\"]\n $amount_max_month = poa_map[\"params.amount_max_month\"]\n $amount_day = poa_map[\"params.amount_day\"]\n $amount_month = poa_map[\"params.amount_month\"]\n $date_day = poa_map[\"params.date_day\"] // 2018-10-19 00:00:00\n $date_month = poa_map[\"params.date_month\"] // 2018-10-01 00:00:00\n\n $cur_date_day = UnixDateTime(Substr(BlockTime(), 0, 10) + \" 00:00:00\")\n $cur_date_month = UnixDateTime(Substr(BlockTime(), 0, 8) + \"01 00:00:00\")\n }\n\n func checkLimit() {\n if Int($cur_date_day) > Int($date_day) {\n $date_day = $cur_date_day\n $amount_day = 0\n }\n if Int($cur_date_month) > Int($date_month) {\n $date_month = $cur_date_month\n $amount_month = 0\n }\n\n if Money($amount_max) < Money($Amount) {\n warning LangRes(\"poa_exceeded_single_limit\", \"en\")\n }\n if Money($amount_max_day) < Money($amount_day) + Money($Amount) {\n warning LangRes(\"poa_exceeded_daily_limit\", \"en\")\n }\n if Money($amount_max_month) < Money($amount_month) + Money($Amount) {\n warning LangRes(\"poa_exceeded_monthly_limit\", \"en\")\n }\n }\n\n func updateParams() {\n $amount_day = Money($amount_day) + Money($Amount)\n $amount_month = Money($amount_month) + Money($Amount)\n\n var m map\n m[\"amount_max\"] = Str($amount_max)\n m[\"amount_max_day\"] = Str($amount_max_day)\n m[\"amount_max_month\"] = Str($amount_max_month)\n m[\"amount_day\"] = Str($amount_day)\n m[\"amount_month\"] = Str($amount_month)\n m[\"date_day\"] = Str($date_day)\n m[\"date_month\"] = Str($date_month)\n\n @1PoaUpdateParams(\"PoaId,ParamsStr\", Int($poa_id), JSONEncode(m))\n }\n\n conditions {\n getPermission()\n checkKeys()\n checkPoa()\n checkLimit()\n }\n\n action {\n @1TokensTransfer(\"Amount,SenderAccount,RecipientAccount,Comment\", $Amount, $Sender, $Recipient, $Comment)\n updateParams()\n }\n}", "Type": "contracts" } ] diff --git a/platform_apps/power_of_attorney/contracts/PoaAdd.sim b/platform_apps/power_of_attorney/contracts/PoaAdd.sim index 5d702d8c2..3f07e319a 100644 --- a/platform_apps/power_of_attorney/contracts/PoaAdd.sim +++ b/platform_apps/power_of_attorney/contracts/PoaAdd.sim @@ -8,18 +8,18 @@ contract PoaAdd { ValueArr array } - func getMemberInfo(kid int) map { + func getMemberInfo(account string) map { var res member map - member = DBFind("@1members").Where({"ecosystem": $ecosystem_id, "id": kid}).Row() + member = DBFind("@1members").Where({"ecosystem": $ecosystem_id, "account": account}).Row() if member { - res["member_id"] = member["id"] + res["account"] = member["account"] res["member_name"] = member["member_name"] res["image_id"] = member["image_id"] } else { - member = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": kid}).Row() + member = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": account, "deleted": 0}).Row() if member { - res["member_id"] = member["id"] - res["member_name"] = IdToAddress(Int(member["id"])) + res["account"] = member["account"] + res["member_name"] = member["account"] res["image_id"] = 0 } } @@ -49,8 +49,9 @@ contract PoaAdd { } //check the recipient key - $recipient_id = AddressToId($Recipient) - if $recipient_id == 0 { + var recipient_key int + recipient_key = AddressToId($Recipient) + if recipient_key == 0 { warning Sprintf(LangRes("@1recipient_x_invalid", "en"), $Recipient) } @@ -75,8 +76,8 @@ contract PoaAdd { m["deleted"] = 0 m["ecosystem"] = $ecosystem_id m["params"] = params - m["poa_recipient"] = getMemberInfo($recipient_id ) - m["poa_sender"] = getMemberInfo($key_id) + m["poa_recipient"] = getMemberInfo($Recipient) + m["poa_sender"] = getMemberInfo($account_id) m["template_id"] = $TemplateId $result = DBInsert("@1poa", m) } diff --git a/platform_apps/power_of_attorney/contracts/PoaDelete.sim b/platform_apps/power_of_attorney/contracts/PoaDelete.sim index bc26e2769..88acdbe99 100644 --- a/platform_apps/power_of_attorney/contracts/PoaDelete.sim +++ b/platform_apps/power_of_attorney/contracts/PoaDelete.sim @@ -1,15 +1,15 @@ contract PoaDelete { data { - PoaeId int + PoaId int } conditions { var poa_map map - poa_map = DBFind("@1poa").Where({"id": $PoaeId, "ecosystem": $ecosystem_id}).Columns("id,poa_sender->member_id").Row() + poa_map = DBFind("@1poa").Where({"id": $PoaId, "ecosystem": $ecosystem_id}).Columns("id,poa_sender->account").Row() if !poa_map { warning LangRes("@1poa_not_found", "en") } - if Int(poa_map["poa_sender.member_id"]) != $key_id { + if poa_map["poa_sender.account"] != $account_id { warning LangRes("@1poa_not_rights_to_delete", "en") } } @@ -18,6 +18,6 @@ contract PoaDelete { var m map m["deleted"] = 1 m["date_deleted"] = $block_time - DBUpdate("@1poa", $PoaeId, m) + DBUpdate("@1poa", $PoaId, m) } } \ No newline at end of file diff --git a/platform_apps/power_of_attorney/contracts/PoaTemplateAdd.sim b/platform_apps/power_of_attorney/contracts/PoaTemplateAdd.sim index 3db91da98..eb370c966 100644 --- a/platform_apps/power_of_attorney/contracts/PoaTemplateAdd.sim +++ b/platform_apps/power_of_attorney/contracts/PoaTemplateAdd.sim @@ -4,18 +4,18 @@ contract PoaTemplateAdd { ParamArr array } - func getMemberInfo(kid int) map { + func getMemberInfo(account string) map { var res member map - member = DBFind("@1members").Where({"ecosystem": $ecosystem_id, "id": kid}).Row() + member = DBFind("@1members").Where({"ecosystem": $ecosystem_id, "account": account}).Row() if member { - res["member_id"] = member["id"] + res["account"] = member["account"] res["member_name"] = member["member_name"] res["image_id"] = member["image_id"] } else { - member = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": kid}).Row() + member = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": account, "deleted": 0}).Row() if member { - res["member_id"] = member["id"] - res["member_name"] = IdToAddress(Int(member["id"])) + res["account"] = member["account"] + res["member_name"] = member["account"] res["image_id"] = 0 } } @@ -28,7 +28,7 @@ contract PoaTemplateAdd { admin_ids = AppParam(Int($app), "poa_admin_role", $ecosystem_id) var rids array rids = JSONDecode("["+admin_ids+"]") - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() { warning LangRes("@1poa_not_rights_to_create", "en") } } @@ -41,7 +41,7 @@ contract PoaTemplateAdd { } var m map - m["creator"] = getMemberInfo($key_id) + m["creator"] = getMemberInfo($account_id) m["contract"] = $ContractName m["date_created"] = $block_time m["params"] = params diff --git a/platform_apps/power_of_attorney/contracts/PoaTemplateDelete.sim b/platform_apps/power_of_attorney/contracts/PoaTemplateDelete.sim index 318360bba..5274ad3ce 100644 --- a/platform_apps/power_of_attorney/contracts/PoaTemplateDelete.sim +++ b/platform_apps/power_of_attorney/contracts/PoaTemplateDelete.sim @@ -5,11 +5,11 @@ contract PoaTemplateDelete { conditions { var poa_map map - poa_map = DBFind("@1poa_templates").Where({"id": $TemplateId, "ecosystem": $ecosystem_id}).Columns("id,creator->member_id").Row() + poa_map = DBFind("@1poa_templates").Where({"id": $TemplateId, "ecosystem": $ecosystem_id}).Columns("id,creator->account").Row() if !poa_map { warning LangRes("@1poa_template_not_found", "en") } - if Int(poa_map["creator.member_id"]) != $key_id { + if poa_map["creator.account"] != $account_id { warning LangRes("@1poa_not_rights_to_delete", "en") } } diff --git a/platform_apps/power_of_attorney/contracts/PoaTemplateEdit.sim b/platform_apps/power_of_attorney/contracts/PoaTemplateEdit.sim index d01717907..87742d187 100644 --- a/platform_apps/power_of_attorney/contracts/PoaTemplateEdit.sim +++ b/platform_apps/power_of_attorney/contracts/PoaTemplateEdit.sim @@ -6,11 +6,11 @@ contract PoaTemplateEdit { conditions { var poa_template_map map - poa_template_map = DBFind("@1poa_templates").Where({"id": $TemplateId, "ecosystem": $ecosystem_id}).Columns("id,creator->member_id").Row() + poa_template_map = DBFind("@1poa_templates").Where({"id": $TemplateId, "ecosystem": $ecosystem_id}).Columns("id,creator->account").Row() if !poa_template_map { warning LangRes("@1poa_template_not_found", "en") } - if Int(poa_template_map["creator.member_id"]) != $key_id { + if poa_template_map["creator.account"] != $account_id { warning LangRes("@1poa_not_rights_to_edit", "en") } } diff --git a/platform_apps/power_of_attorney/contracts/PoaTokensSend.sim b/platform_apps/power_of_attorney/contracts/PoaTokensSend.sim index 9fcb29841..d6ca08cb6 100644 --- a/platform_apps/power_of_attorney/contracts/PoaTokensSend.sim +++ b/platform_apps/power_of_attorney/contracts/PoaTokensSend.sim @@ -29,22 +29,23 @@ contract PoaTokensSend { } func checkKeys() { - $sender_id = AddressToId($Sender) - $recipient_id = AddressToId($Recipient) + var sender_key, recipient_key int + sender_key = AddressToId($Sender) + recipient_key = AddressToId($Recipient) //check the sender key - if $sender_id == 0 { + if sender_key == 0 { warning Sprintf(LangRes("@1sender_x_invalid", "en"), $Sender) } //check the recipient key - if $recipient_id == 0 { + if recipient_key == 0 { warning Sprintf(LangRes("@1recipient_x_invalid", "en"), $Recipient) } } func checkPoa() { var poa_map map - poa_map = DBFind("@1poa").Where({"contract": "@1PoaTokensSend", "poa_sender->member_id": $sender_id, "poa_recipient->member_id": $key_id, "ecosystem": $ecosystem_id, "deleted": 0}).Columns("id,date_expiration,params->amount_max,params->amount_max_day,params->amount_max_month,params->amount_day,params->amount_month,params->date_day,params->date_month").Row() + poa_map = DBFind("@1poa").Where({"contract": "@1PoaTokensSend", "poa_sender->account": $Sender, "poa_recipient->account": $account_id, "ecosystem": $ecosystem_id, "deleted": 0}).Columns("id,date_expiration,params->amount_max,params->amount_max_day,params->amount_max_month,params->amount_day,params->amount_month,params->date_day,params->date_month").Row() if !poa_map { warning LangRes("@1poa_not_found", "en") } @@ -111,7 +112,7 @@ contract PoaTokensSend { } action { - @1TokensTransfer("Amount,SenderId,RecipientId,Comment", $Amount, $sender_id, $recipient_id, $Comment) + @1TokensTransfer("Amount,SenderAccount,RecipientAccount,Comment", $Amount, $Sender, $Recipient, $Comment) updateParams() } } \ No newline at end of file diff --git a/platform_apps/power_of_attorney/contracts/PoaUpdateParams.sim b/platform_apps/power_of_attorney/contracts/PoaUpdateParams.sim index bbe8167be..be00d8c20 100644 --- a/platform_apps/power_of_attorney/contracts/PoaUpdateParams.sim +++ b/platform_apps/power_of_attorney/contracts/PoaUpdateParams.sim @@ -17,13 +17,13 @@ contract PoaUpdateParams { conditions { var poa_map map - poa_map = DBFind("@1poa").Where({"id": $PoaId, "ecosystem": $ecosystem_id, "deleted": 0}).Columns("id,date_expiration,contract,poa_recipient->member_id").Row() + poa_map = DBFind("@1poa").Where({"id": $PoaId, "ecosystem": $ecosystem_id, "deleted": 0}).Columns("id,date_expiration,contract,poa_recipient->account").Row() if !poa_map { warning LangRes("@1poa_not_found", "en") } - if Int(poa_map["poa_recipient.member_id"]) != $key_id { + if poa_map["poa_recipient.account"] != $account_id { warning LangRes("@1poa_not_rights_to_change", "en") } diff --git a/platform_apps/power_of_attorney/pages/poa_add.ptl b/platform_apps/power_of_attorney/pages/poa_add.ptl index 2f0991286..242cc0838 100644 --- a/platform_apps/power_of_attorney/pages/poa_add.ptl +++ b/platform_apps/power_of_attorney/pages/poa_add.ptl @@ -1,6 +1,6 @@ Form(){ Input(Name: TemplateId, Class: hidden, Value: #template_id#) - DBFind(@1poa_templates).Vars(pre).Where({"id": #template_id#, "ecosystem": #ecosystem_id#}) + DBFind("@1poa_templates").Vars(pre).Where({"id": "#template_id#", "ecosystem": "#ecosystem_id#"}) Div(row){ Div(col-md-3 mt-sm text-right){ Label(){ diff --git a/platform_apps/power_of_attorney/pages/poa_list.ptl b/platform_apps/power_of_attorney/pages/poa_list.ptl index a9c073236..f6e4f2692 100644 --- a/platform_apps/power_of_attorney/pages/poa_list.ptl +++ b/platform_apps/power_of_attorney/pages/poa_list.ptl @@ -5,9 +5,9 @@ SetTitle("$@1poa_list$") AddToolButton(Page: @1poa_template_list, Title: $@1poa_template_list$, Icon: icon-pin) If(#search#){ - SetVar(where, {"ecosystem": #ecosystem_id#, "contract":{"$ilike":"#search#"}, "deleted": 0}) + SetVar(where, {"ecosystem": "#ecosystem_id#", "contract": {"$ilike":"#search#"}, "deleted": 0}) }.Else{ - SetVar(where, {"ecosystem": #ecosystem_id#, "deleted": 0}) + SetVar(where, {"ecosystem": "#ecosystem_id#", "deleted": 0}) } Div(list-group-item ml-lg mr-lg pt-lg){ @@ -15,14 +15,8 @@ Div(list-group-item ml-lg mr-lg pt-lg){ Include(@1search) } -DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("id,contract,params,date_created,date_expiration,poa_recipient->member_id,poa_recipient->member_name,poa_recipient->image_id,poa_sender->member_id,poa_sender->member_name,poa_sender->image_id,deleted").Count(poa_count).Custom(_contract){ +DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("id,contract,params,date_created,date_expiration,poa_recipient->account,poa_recipient->member_name,poa_recipient->image_id,poa_sender->account,poa_sender->member_name,poa_sender->image_id,deleted").Count(poa_count).Custom(_contract){ Span(Class: h5 text-bold, Body: #contract#) -}.Custom(_creator){ - If(And(#creator.member_name#!=NULL,#creator.member_name#!="")){ - LinkPage(Class: #style_link# text-bold, Page: @1profile_view, PageParams: "v_key_id=#creator.member_id#"){ - #creator.member_name# - } - } }.Custom(_date_created){ Div(h6){ Div(text-nowrap){DateTime(DateTime: #date_created#, Format: "DD.MM.YYYY HH:MI")} @@ -32,7 +26,7 @@ DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).O Div(text-nowrap){DateTime(DateTime: #date_expiration#, Format: "DD.MM.YYYY HH:MI")} } }.Custom(custom_recipient){ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#poa_recipient.member_id#"){ + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#poa_recipient.account#"){ If(#poa_recipient.image_id#>0){ Image(Src: Binary().ById(#poa_recipient.image_id#), Class: img-circle).Style(width: 30px; border: 1px solid #5A5D63; margin-right: 10px;) Span(#poa_recipient.member_name#) @@ -46,7 +40,7 @@ DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).O }.Custom(custom_arrow){ Em(Class: fa fa-long-arrow-right fa-1x #style_text#) }.Custom(custom_sender){ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#poa_sender.member_id#"){ + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#poa_sender.account#"){ If(#poa_sender.image_id#>0){ Image(Src: Binary().ById(#poa_sender.image_id#), Class: img-circle).Style(width: 30px; border: 1px solid #5A5D63; margin-right: 10px;) Span(#poa_sender.member_name#) @@ -69,9 +63,9 @@ DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).O } }.Custom(_action){ Div(text-right button-group text-nowrap){ - If(#poa_sender.member_id#==#key_id#){ + If(#poa_sender.account# == #account_id#){ If(#deleted# == 0){ - Button(Class: btn bg-gray-lighter, Contract: @1PoaDelete, Params: "PoaeId=#id#", Page: #this_page#){ + Button(Class: btn bg-gray-lighter, Contract: @1PoaDelete, Params: "PoaId=#id#", Page: #this_page#){ Em(Class: text-danger fa fa-1x fa-trash) }.Alert(Text: "$@1sure_want_delete$", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question) } diff --git a/platform_apps/power_of_attorney/pages/poa_settings.ptl b/platform_apps/power_of_attorney/pages/poa_settings.ptl index 185d27260..00714acaf 100644 --- a/platform_apps/power_of_attorney/pages/poa_settings.ptl +++ b/platform_apps/power_of_attorney/pages/poa_settings.ptl @@ -1,9 +1,9 @@ -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Power of attorney"}).Vars("app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Power of attorney"}).Vars(app) SetVar(this_page, "@1poa_settings").(poa_admin_role,0) SetVar(poa_admin_role, AppParam(App: #app_id#, Name: "poa_admin_role")) -DBFind("@1roles", src_roles).Where({"ecosystem": #ecosystem_id#, "deleted": 0}).Columns("role_name,id").Limit(100) +DBFind("@1roles", src_roles).Where({"ecosystem": "#ecosystem_id#", "deleted": 0}).Columns("role_name,id").Limit(100) SetVar(row,"row mt-sm").(col_left,"col-sm-4 text-right mt-sm").(col_right,"col-sm-8 text-left") @@ -29,7 +29,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#poa_admin_role# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #poa_admin_role#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#poa_admin_role#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# diff --git a/platform_apps/power_of_attorney/pages/poa_template_edit.ptl b/platform_apps/power_of_attorney/pages/poa_template_edit.ptl index f4bba7df9..e3d309252 100644 --- a/platform_apps/power_of_attorney/pages/poa_template_edit.ptl +++ b/platform_apps/power_of_attorney/pages/poa_template_edit.ptl @@ -1,6 +1,6 @@ Form(){ Input(Name:TemplateId, Class: hidden, Value: #template_id#) - DBFind(@1poa_templates).Vars(pre).Where({"id": #template_id#, "ecosystem": #ecosystem_id#}) + DBFind("@1poa_templates").Where({"id": "#template_id#", "ecosystem": "#ecosystem_id#"}).Vars(pre) Div(row){ Div(col-md-3 mt-sm text-right){ Label(){ diff --git a/platform_apps/power_of_attorney/pages/poa_template_list.ptl b/platform_apps/power_of_attorney/pages/poa_template_list.ptl index ae5e472a7..1747d06cf 100644 --- a/platform_apps/power_of_attorney/pages/poa_template_list.ptl +++ b/platform_apps/power_of_attorney/pages/poa_template_list.ptl @@ -9,17 +9,17 @@ Span(Class: h5 m0 mb ml-lg){ }.Style( display: inline-block; ) -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Power of attorney"}).Vars(application) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Power of attorney"}).Vars(application) SetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: poa_admin_role)) -DBFind("@1roles_participants").Where({"ecosystem": #ecosystem_id#, "$and": ["role->id": {"$in": [#admin_roles#]}, "role->id": #role_id#], "member->member_id": #key_id#, "deleted": 0}).Vars(admin_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#admin_roles#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) If(#admin_access_id# > 0){ AddToolButton(Page: @1poa_template_add, Title: $@1template_add$, Icon: icon-plus).Popup(Header: $@1template_add$, Width: "50") } If(#search#){ - SetVar(where, {"ecosystem": #ecosystem_id#, "contract": {"$ilike": "#search#"}, "deleted": 0}) + SetVar(where, {"ecosystem": "#ecosystem_id#", "contract": {"$ilike": "#search#"}, "deleted": 0}) }.Else{ - SetVar(where, {"ecosystem": #ecosystem_id#, "deleted": 0}) + SetVar(where, {"ecosystem": "#ecosystem_id#", "deleted": 0}) } Div(list-group-item ml-lg mr-lg pt-lg){ @@ -27,13 +27,13 @@ Div(list-group-item ml-lg mr-lg pt-lg){ Include(@1search) } -DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("id,contract,params,creator->member_id,creator->member_name,date_created,deleted").Count(templates_count).Custom(_contract){ +DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("id,contract,params,creator->account,creator->member_name,date_created,deleted").Count(templates_count).Custom(_contract){ Button(Class: btn-xs btn-link, PageParams: "template_id=#id#", Page: @1poa_add){ Span(Class: h5 text-bold, Body: #contract#) }.Popup(50, $@1poa_add$) }.Custom(_creator){ If(And(#creator.member_name#!=NULL,#creator.member_name#!="")){ - LinkPage(Class: text-primary, Page: @1profile_view, PageParams: "v_key_id=#creator.member_id#"){ + LinkPage(Class: text-primary, Page: @1profile_view, PageParams: "v_account=#creator.account#"){ #creator.member_name# } } @@ -52,7 +52,7 @@ DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).O } } }.Custom(_action){ - If(#creator.member_id#==#key_id#){ + If(#creator.account# == #account_id#){ Div(text-right button-group text-nowrap){ If(#deleted# == 0){ Button(Class: btn bg-gray-lighter, Contract: @1PoaTemplateDelete, Params: "TemplateId=#id#", Page: #this_page#){ diff --git a/platform_apps/power_of_attorney/pages/poa_view.ptl b/platform_apps/power_of_attorney/pages/poa_view.ptl index 35e4c387a..222d664a8 100644 --- a/platform_apps/power_of_attorney/pages/poa_view.ptl +++ b/platform_apps/power_of_attorney/pages/poa_view.ptl @@ -1,6 +1,6 @@ Form(){ Input(Name:TemplateId, Class: hidden, Value: #template_id#) - DBFind(@1poa).Vars(pre).Where({"id": #poa_id#, "ecosystem": #ecosystem_id#}).Columns("poa_sender->member_id,poa_recipient->member_id,contract,params,date_expiration") + DBFind("@1poa").Where({"id": "#poa_id#", "ecosystem": "#ecosystem_id#"}).Columns("poa_sender->account,poa_recipient->account,contract,params,date_expiration").Vars(pre) Div(row){ Div(col-md-3 mt-sm text-right){ Label(){ @@ -8,8 +8,7 @@ Form(){ } } Div(col-md-9){ - SetVar(sender_id, Address(#pre_poa_sender_member_id#)) - Input(Name: Recipient, Disabled: "true", Value: #sender_id#) + Input(Name: Recipient, Disabled: "true", Value: #pre_poa_sender_account#) } } Div(row mt-sm){ @@ -19,8 +18,7 @@ Form(){ } } Div(col-md-9){ - SetVar(recipient_id, Address(#pre_poa_recipient_member_id#)) - Input(Name: Recipient, Disabled: "true", Value: #recipient_id#) + Input(Name: Recipient, Disabled: "true", Value: #pre_poa_recipient_account#) } } Div(row mt-sm){ diff --git a/platform_apps/power_of_attorney/pages/tokens_send.ptl b/platform_apps/power_of_attorney/pages/tokens_send.ptl index 4939ab739..265c8f0c6 100644 --- a/platform_apps/power_of_attorney/pages/tokens_send.ptl +++ b/platform_apps/power_of_attorney/pages/tokens_send.ptl @@ -7,20 +7,15 @@ If(#back_page# == ""){ SetVar(back_page, "@1members_list") } } -If(#MemberId# != ""){ - SetVar(v_key_id, #MemberId#) +If(#MemberAccount#){ + SetVar(v_account, #MemberAccount#) } -If(Or(#v_key_id#>0,#v_key_id#<0)){ - SetVar(Name: v_address, Value: Address(#v_key_id#)) -}.Else{ - SetVar(Name: v_address, Value: "") -} -If(#v_amount# == ""){ - SetVar(Name: v_amount, Value: "") +If(#v_account#){ + SetVar(Name: v_address, Value: #v_account#) } -DBFind("@1keys").Where({"ecosystem": #ecosystem_id#, "id": #key_id#}).Vars("tokens") -DBFind("@1ecosystems").Where({"id": #ecosystem_id#}).Vars("custom") +DBFind("@1keys").Where({"ecosystem": "#ecosystem_id#", "account": "#account_id#", "deleted": 0}).Vars(tokens) +DBFind("@1ecosystems").Where({"id": "#ecosystem_id#"}).Vars(custom) If(#ecosystem_id# == 1){ SetVar(token_title, "APLA") }.Else{ @@ -37,19 +32,19 @@ If(Or(#ecosystem_id# == 1, #custom_token_title# != "")){ } Div(col-sm-9){ Div(input-group){ - DBFind(@1poa, src_poa).Where({"poa_recipient->member_id": #key_id#, "contract": "@1PoaTokensSend", "ecosystem": #ecosystem_id#, "deleted": 0}).Columns("id,poa_sender,poa_sender->member_id,params->amount_max").Count(poa_count).Custom(_name){ - DBFind(@1keys).Where({"id": #poa_sender.member_id#, "ecosystem": #ecosystem_id#}).Columns("amount").Vars(k) - Address(#poa_sender.member_id#) (Money(#k_amount#) #token_title#, Max: Money(#params.amount_max#)) + DBFind("@1poa", src_poa).Where({"poa_recipient->account": "#account_id#", "contract": "@1PoaTokensSend", "ecosystem": "#ecosystem_id#", "deleted": 0}).Columns("id,poa_sender,poa_sender->account,params->amount_max").Count(poa_count).Custom(_name){ + DBFind("@1keys").Where({"ecosystem": "#ecosystem_id#", "account": "#poa_sender.account#", "deleted": 0}).Columns("amount").Vars(k) + #poa_sender.account# (Money(#k_amount#) #token_title#, Max: Money(#params.amount_max#)) }.Custom(_id){ - #poa_sender.member_id# + #poa_sender.account# } If(#poa_count#>0){ - Select(Name: Sender, Source: src_poa, NameColumn: _name, ValueColumn: poa_sender.member_id) + Select(Name: Sender, Source: src_poa, NameColumn: _name, ValueColumn: poa_sender.account) }.Else{ Input(Name: SenderNF, Disabled: 1, Placeholder: $@1poa_not_found$) } Div(input-group-btn){ - Button(Class: btn bg-gray-lighter fa fa-toggle-on buttons, Page: @1tokens_send, PageParams: "back_page=#back_page#,poa=0,v_key_id=#v_key_id#,v_amount=Val(Amount)").Popup(Header: $@1tokens_send$, Width: "50") + Button(Class: btn bg-gray-lighter fa fa-toggle-on buttons, Page: @1tokens_send, PageParams: "back_page=#back_page#,poa=0,v_account=#v_account#,v_amount=Val(Amount)").Popup(Header: $@1tokens_send$, Width: "50") } } Div(Class: m0 h6 text-muted, Body: $@1send_tokens_by_poa$) @@ -63,10 +58,10 @@ If(Or(#ecosystem_id# == 1, #custom_token_title# != "")){ } Div(col-sm-9){ Div(input-group){ - SetVar(m_a, Address(#key_id#) (Money(#tokens_amount#) #token_title#)) + SetVar(m_a, #account_id# (Money(#tokens_amount#) #token_title#)) Input(Name: Sender, Disabled: 1, Value: #m_a#) Div(input-group-btn){ - Button(Class: btn bg-gray-lighter fa fa-toggle-off buttons, Page: @1tokens_send, PageParams: "back_page=#back_page#,poa=1,v_key_id=#v_key_id#,v_amount=Val(Amount)").Popup(Header: $@1tokens_send$, Width: "50") + Button(Class: btn bg-gray-lighter fa fa-toggle-off buttons, Page: @1tokens_send, PageParams: "back_page=#back_page#,poa=1,v_account=#v_account#,v_amount=Val(Amount)").Popup(Header: $@1tokens_send$, Width: "50") } } Div(Class: m0 h6 text-muted, Body: $@1send_tokens_my_balance$) diff --git a/platform_apps/power_of_attorney/tables/poa.json b/platform_apps/power_of_attorney/tables/poa.json index cb0bb80e8..ea9a22358 100644 --- a/platform_apps/power_of_attorney/tables/poa.json +++ b/platform_apps/power_of_attorney/tables/poa.json @@ -1,52 +1,52 @@ [ { - "name":"poa_sender", - "type":"json", - "conditions":"false" + "name": "poa_sender", + "type": "json", + "conditions": "false" }, { - "name":"date_created", - "type":"number", - "conditions":"false" + "name": "date_created", + "type": "number", + "conditions": "false" }, { - "name":"date_expiration", - "type":"number", - "conditions":"false" + "name": "date_expiration", + "type": "number", + "conditions": "false" }, { - "name":"deleted", - "type":"number", - "conditions":"ContractAccess(\"@1PoaDelete\")" + "name": "deleted", + "type": "number", + "conditions": "ContractAccess(\"@1PoaDelete\")" }, { - "name":"contract", - "type":"text", - "conditions":"false" + "name": "contract", + "type": "text", + "conditions": "false" }, { - "name":"ecosystem", - "type":"number", - "conditions":"false" + "name": "ecosystem", + "type": "number", + "conditions": "false" }, { - "name":"params", - "type":"json", - "conditions":"ContractAccess(\"@1PoaUpdateParams\")" + "name": "params", + "type": "json", + "conditions": "ContractAccess(\"@1PoaUpdateParams\")" }, { - "name":"template_id", - "type":"number", - "conditions":"false" + "name": "template_id", + "type": "number", + "conditions": "false" }, { - "name":"poa_recipient", - "type":"json", - "conditions":"false" + "name": "poa_recipient", + "type": "json", + "conditions": "false" }, { - "name":"date_deleted", - "type":"number", - "conditions":"ContractAccess(\"@1PoaDelete\")" + "name": "date_deleted", + "type": "number", + "conditions": "ContractAccess(\"@1PoaDelete\")" } ] \ No newline at end of file diff --git a/platform_apps/power_of_attorney/tables/poa_templates.json b/platform_apps/power_of_attorney/tables/poa_templates.json index 85c60f567..f89f17c65 100644 --- a/platform_apps/power_of_attorney/tables/poa_templates.json +++ b/platform_apps/power_of_attorney/tables/poa_templates.json @@ -1,37 +1,37 @@ [ { - "name":"deleted", - "type":"number", - "conditions":"ContractAccess(\"@1PoaTemplateDelete\")" + "name": "deleted", + "type": "number", + "conditions": "ContractAccess(\"@1PoaTemplateDelete\")" }, { - "name":"contract", - "type":"text", - "conditions":"false" + "name": "contract", + "type": "text", + "conditions": "false" }, { - "name":"ecosystem", - "type":"number", - "conditions":"false" + "name": "ecosystem", + "type": "number", + "conditions": "false" }, { - "name":"date_created", - "type":"number", - "conditions":"false" + "name": "date_created", + "type": "number", + "conditions": "false" }, { - "name":"params", - "type":"json", - "conditions":"ContractAccess(\"@1PoaTemplateEdit\")" + "name": "params", + "type": "json", + "conditions": "ContractAccess(\"@1PoaTemplateEdit\")" }, { - "name":"creator", - "type":"json", - "conditions":"false" + "name": "creator", + "type": "json", + "conditions": "false" }, { - "name":"date_deleted", - "type":"number", - "conditions":"ContractAccess(\"@1PoaTemplateDelete\")" + "name": "date_deleted", + "type": "number", + "conditions": "ContractAccess(\"@1PoaTemplateDelete\")" } ] \ No newline at end of file diff --git a/platform_apps/questionnaire.json b/platform_apps/questionnaire.json index 0b77da6c9..b1940958f 100644 --- a/platform_apps/questionnaire.json +++ b/platform_apps/questionnaire.json @@ -5,7 +5,7 @@ { "Name": "q_profile", "Conditions": "ContractConditions(\"MainCondition\")", - "Value": "SetVar(this_page, @1q_profile)\nDBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Questionnaire\"}).Vars(application)\nSetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: q_admin_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": #ecosystem_id#, \"$and\": [\"role->id\": {\"$in\": [#admin_roles#]}, \"role->id\": #role_id#], \"member->member_id\": #key_id#, \"deleted\": 0}).Vars(admin_access)\nIf(#admin_access_id# > 0){\n SetVar(permission, 1)\n}\n\nDBFind(@1q_list,src_q).Where({\"ecosystem\": #ecosystem_id#, \"deleted\": 0, \"status\": 1}).Order({\"created_at\": 1}).Limit(5).Columns(\"id,question,description,answer,ecosystem,init,lastmodified,created_at,expired,status,params->hide,params->change,au_groups,au_roles\").Custom(custom_name){\n If(#permission#==1){\n LinkPage(Class: h5 text-bold, Page: @1q_question, PageParams: \"q_id=#id#\"){\n Div(Class: text-primary text-left){\n Span(Body:#question#).Style({padding-left: 10px;})\n }\n }\n }.Else{\n If(#status#==1){\n If(And(#au_groups#==[0],#au_roles#==[0])){\n LinkPage(Class:h5 text-bold, Page: @1q_question, PageParams: \"q_id=#id#\"){\n Div(Class: text-primary text-left){\n Span(Body:#question#).Style({padding-left: 10px;})\n }\n }\n }.Else{\n DBFind(@1groups_participants).Where({\"member->member_id\": #key_id#, \"deleted\": 0, \"ecosystem\": #ecosystem_id#, \"groups_info->id\": {\"$in\": [0]]}}).Count(gp)\n DBFind(@1roles_participants).Where({\"member->member_id\": #key_id#, \"deleted\": 0, \"ecosystem\": #ecosystem_id#, \"role->id\": {\"$in\": [0]]}}).Count(rl)\n If(Or(#gp#>0,#rl#>0)){\n LinkPage(Class: h5 text-bold, Page: @1q_question, PageParams: \"q_id=#id#\"){\n Div(Class: text-primary text-left){\n Span(Body:#question#).Style({padding-left: 10px;})\n }\n }\n }.Else{\n Div(Class: text-left){\n Span(Class: text-left, Body:#question#).Style({padding-left: 10px;})\n }\n }\n }\n }.Else{\n Div(Class: text-left){\n Span(Class: text-left, Body:#question#).Style({padding-left: 10px;})\n }\n }\n }\n}.Custom(initiator){\n DBFind(@1members).Where({\"ecosystem\": #ecosystem#, id: #init#}).Vars(m)\n If(Or(#m_id#>0,#m_id#<0)){\n SetVar(member_name, #m_member_name#)\n }.Else{\n SetVar(member_name, Address(#id#))\n }\n Span(#member_name#)\n}.Custom(stats){\n Span(Class: pull-right){\n If(Or(#admin_access_id# > 0, #params.hide# ==true)){\n Button(Body: Em(Class: fa fa-comment), Class: btn-xs btn-link, Page: @1q_question_graph, PageParams: \"q_id=#id#,q_page=#this_page#\").Style({margin-left: 30px;}).Popup(Header: $@1q_answer_graph$ / #question#, Width: \"50\")\n }\n }\n}.Count(que)\n\nIf(#que#>0){\n Table(Source: src_q, Columns: \"$@1q_question$=custom_name,$@1q_initiator$=initiators,=stats\").Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n}", + "Value": "SetVar(this_page, @1q_profile)\nDBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Questionnaire\"}).Vars(application)\nSetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: q_admin_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#admin_roles#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\nIf(#admin_access_id# > 0){\n SetVar(permission, 1)\n}\n\nDBFind(\"@1q_list\", src_q).Where({\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0, \"status\": 1}).Order({\"created_at\": 1}).Limit(5).Columns(\"id,question,description,answer,ecosystem,init,lastmodified,created_at,expired,status,params->hide,params->change,au_groups,au_roles\").Custom(custom_name){\n If(#permission#==1){\n LinkPage(Class: h5 text-bold, Page: @1q_question, PageParams: \"q_id=#id#\"){\n Div(Class: text-primary text-left){\n Span(Body:#question#).Style({padding-left: 10px;})\n }\n }\n }.Else{\n If(#status#==1){\n If(And(#au_groups#==[0],#au_roles#==[0])){\n LinkPage(Class:h5 text-bold, Page: @1q_question, PageParams: \"q_id=#id#\"){\n Div(Class: text-primary text-left){\n Span(Body:#question#).Style({padding-left: 10px;})\n }\n }\n }.Else{\n DBFind(\"@1groups_participants\").Where({\"member->account\": \"#account_id#\", \"deleted\": 0, \"ecosystem\": \"#ecosystem_id#\", \"groups_info->id\": {\"$in\": [0]}}).Count(gp)\n DBFind(\"@1roles_participants\").Where({\"member->account\": \"#account_id#\", \"deleted\": 0, \"ecosystem\": \"#ecosystem_id#\", \"role->id\": {\"$in\": [0]}}).Count(rl)\n If(Or(#gp#>0,#rl#>0)){\n LinkPage(Class: h5 text-bold, Page: @1q_question, PageParams: \"q_id=#id#\"){\n Div(Class: text-primary text-left){\n Span(Body:#question#).Style({padding-left: 10px;})\n }\n }\n }.Else{\n Div(Class: text-left){\n Span(Class: text-left, Body:#question#).Style({padding-left: 10px;})\n }\n }\n }\n }.Else{\n Div(Class: text-left){\n Span(Class: text-left, Body:#question#).Style({padding-left: 10px;})\n }\n }\n }\n}.Custom(initiator){\n SetVar(m_account,)\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem#\", \"account\": \"#init#\"}).Vars(m)\n If(#m_account#){\n SetVar(member_name, #m_member_name#)\n }.Else{\n SetVar(member_name, #init#)\n }\n Span(#member_name#)\n}.Custom(stats){\n Span(Class: pull-right){\n If(Or(#admin_access_id# > 0, #params.hide# ==true)){\n Button(Body: Em(Class: fa fa-comment), Class: btn-xs btn-link, Page: @1q_question_graph, PageParams: \"q_id=#id#,q_page=#this_page#\").Style({margin-left: 30px;}).Popup(Header: $@1q_answer_graph$ / #question#, Width: \"50\")\n }\n }\n}.Count(que)\n\nIf(#que#>0){\n Table(Source: src_q, Columns: \"$@1q_question$=custom_name,$@1q_initiator$=initiators,=stats\").Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n}", "Type": "blocks" }, { @@ -247,13 +247,13 @@ }, { "Name": "q_answers", - "Columns": "[\n {\n \"name\":\"answer_id\",\n \"type\":\"number\",\n \"conditions\":\"ContractAccess(\\\"@1QAnswer\\\")\"\n },\n {\n \"name\":\"decision\",\n \"type\":\"text\",\n \"conditions\":\"ContractAccess(\\\"@1QAnswer\\\")\"\n },\n {\n \"name\":\"ecosystem\",\n \"type\":\"number\",\n \"conditions\":\"ContractAccess(\\\"@1QAnswer\\\")\"\n },\n {\n \"name\":\"lastmodified\",\n \"type\":\"number\",\n \"conditions\":\"ContractAccess(\\\"@1QAnswer\\\")\"\n },\n {\n \"name\":\"member\",\n \"type\":\"number\",\n \"conditions\":\"ContractAccess(\\\"@1QAnswer\\\")\"\n },\n {\n \"name\":\"question_id\",\n \"type\":\"number\",\n \"conditions\":\"ContractAccess(\\\"@1QAnswer\\\")\"\n }\n]", + "Columns": "[\n {\n \"name\": \"answer_id\",\n \"type\": \"number\",\n \"conditions\": \"ContractAccess(\\\"@1QAnswer\\\")\"\n },\n {\n \"name\": \"decision\",\n \"type\": \"text\",\n \"conditions\": \"ContractAccess(\\\"@1QAnswer\\\")\"\n },\n {\n \"name\": \"ecosystem\",\n \"type\": \"number\",\n \"conditions\": \"ContractAccess(\\\"@1QAnswer\\\")\"\n },\n {\n \"name\": \"lastmodified\",\n \"type\": \"number\",\n \"conditions\": \"ContractAccess(\\\"@1QAnswer\\\")\"\n },\n {\n \"name\": \"member\",\n \"type\": \"varchar\",\n \"conditions\": \"ContractAccess(\\\"@1QAnswer\\\")\"\n },\n {\n \"name\": \"question_id\",\n \"type\": \"number\",\n \"conditions\": \"ContractAccess(\\\"@1QAnswer\\\")\"\n }\n]", "Permissions": "{\"insert\": \"ContractAccess(\\\"@1QAnswer\\\")\", \"update\": \"ContractAccess(\\\"@1QAnswer\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", "Type": "tables" }, { "Name": "q_list", - "Columns": "[\n {\n \"name\":\"answer\",\n \"type\":\"json\",\n \"conditions\":\"ContractAccess(\\\"@1QOperations\\\")\"\n },\n {\n \"name\":\"au_groups\",\n \"type\":\"json\",\n \"conditions\":\"ContractAccess(\\\"@1QOperations\\\")\"\n },\n {\n \"name\":\"au_roles\",\n \"type\":\"json\",\n \"conditions\":\"ContractAccess(\\\"@1QOperations\\\")\"\n },\n {\n \"name\":\"created_at\",\n \"type\":\"number\",\n \"conditions\":\"false\"\n },\n {\n \"name\":\"deleted\",\n \"type\":\"number\",\n \"conditions\":\"ContractAccess(\\\"@1QOperations\\\")\"\n },\n {\n \"name\":\"description\",\n \"type\":\"text\",\n \"conditions\":\"ContractAccess(\\\"@1QOperations\\\")\"\n },\n {\n \"name\":\"ecosystem\",\n \"type\":\"number\",\n \"conditions\":\"ContractAccess(\\\"@1QOperations\\\")\"\n },\n {\n \"name\":\"expired\",\n \"type\":\"number\",\n \"conditions\":\"ContractAccess(\\\"@1QOperations\\\",\\\"@1QAnswer\\\")\"\n },\n {\n \"name\":\"init\",\n \"type\":\"number\",\n \"conditions\":\"ContractAccess(\\\"@1QOperations\\\")\"\n },\n {\n \"name\":\"lastmodified\",\n \"type\":\"number\",\n \"conditions\":\"ContractAccess(\\\"@1QOperations\\\",\\\"@1QAnswer\\\")\"\n },\n {\n \"name\":\"params\",\n \"type\":\"json\",\n \"conditions\":\"false\"\n },\n {\n \"name\":\"question\",\n \"type\":\"text\",\n \"conditions\":\"ContractAccess(\\\"@1QOperations\\\")\"\n },\n {\n \"name\":\"status\",\n \"type\":\"number\",\n \"conditions\":\"ContractAccess(\\\"@1QOperations\\\",\\\"@1QAnswer\\\")\"\n }\n]", + "Columns": "[\n {\n \"name\": \"answer\",\n \"type\": \"json\",\n \"conditions\": \"ContractAccess(\\\"@1QOperations\\\")\"\n },\n {\n \"name\": \"au_groups\",\n \"type\": \"json\",\n \"conditions\": \"ContractAccess(\\\"@1QOperations\\\")\"\n },\n {\n \"name\": \"au_roles\",\n \"type\": \"json\",\n \"conditions\": \"ContractAccess(\\\"@1QOperations\\\")\"\n },\n {\n \"name\": \"created_at\",\n \"type\": \"number\",\n \"conditions\": \"false\"\n },\n {\n \"name\": \"deleted\",\n \"type\": \"number\",\n \"conditions\": \"ContractAccess(\\\"@1QOperations\\\")\"\n },\n {\n \"name\": \"description\",\n \"type\": \"text\",\n \"conditions\": \"ContractAccess(\\\"@1QOperations\\\")\"\n },\n {\n \"name\": \"ecosystem\",\n \"type\": \"number\",\n \"conditions\": \"ContractAccess(\\\"@1QOperations\\\")\"\n },\n {\n \"name\": \"expired\",\n \"type\": \"number\",\n \"conditions\": \"ContractAccess(\\\"@1QOperations\\\",\\\"@1QAnswer\\\")\"\n },\n {\n \"name\": \"init\",\n \"type\": \"varchar\",\n \"conditions\": \"ContractAccess(\\\"@1QOperations\\\")\"\n },\n {\n \"name\": \"lastmodified\",\n \"type\": \"number\",\n \"conditions\": \"ContractAccess(\\\"@1QOperations\\\",\\\"@1QAnswer\\\")\"\n },\n {\n \"name\": \"params\",\n \"type\": \"json\",\n \"conditions\": \"false\"\n },\n {\n \"name\": \"question\",\n \"type\": \"text\",\n \"conditions\": \"ContractAccess(\\\"@1QOperations\\\")\"\n },\n {\n \"name\": \"status\",\n \"type\": \"number\",\n \"conditions\": \"ContractAccess(\\\"@1QOperations\\\",\\\"@1QAnswer\\\")\"\n }\n]", "Permissions": "{\"insert\": \"ContractAccess(\\\"@1QOperations\\\")\", \"update\": \"ContractAccess(\\\"@1QOperations\\\",\\\"@1QAnswer\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}", "Type": "tables" }, @@ -272,62 +272,62 @@ { "Name": "q_listing", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1q_listing).(this_table, @1q_list)\nInclude(@1pager_header)\n\nSetTitle($@1q_poll$)\nDBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Questionnaire\"}).Vars(application)\nSetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: q_admin_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": #ecosystem_id#, \"$and\": [\"role->id\": {\"$in\": [#admin_roles#]}, \"role->id\": #role_id#], \"member->member_id\": #key_id#, \"deleted\": 0}).Vars(admin_access)\nIf(#admin_access_id# > 0){\n SetVar(permission,1)\n}\nIf(#permission#==1){\n AddToolButton(Title: $@1q_new_question$, Page: @1q_question_new, Icon: icon-plus).Popup(Header: $@1q_new_question$, Width: \"60\")\n}\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": #ecosystem_id#, \"deleted\": 0, {\"$or\": [{\"question\": {\"$ilike\": \"#search#\"}}]}})\n}.Else{\n SetVar(where, {\"ecosystem\": #ecosystem_id#, \"deleted\": 0})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1q_question))\n Include(@1search)\n}\n\nDBFind(#this_table#,src_q).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Columns(\"id,question,description,answer,ecosystem,init,lastmodified,created_at,expired,status,params->hide,params->change,au_groups,au_roles\").Custom(custom_name){\n If(#permission#==1){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1q_question, PageParams: \"q_id=#id#\"){\n Div(Class: text-primary){\n Span(#question#)\n }\n }\n }.Else{\n If(#status#==1){\n If(And(#au_groups#==[0],#au_roles#==[0])){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1q_question, PageParams: \"q_id=#id#\"){\n Div(Class: text-primary){\n Span(#question#)\n }\n }\n }.Else{\n DBFind(@1groups_participants).Where({\"member->member_id\": #key_id#, \"deleted\": 0, \"ecosystem\": #ecosystem_id#, \"groups_info->id\": {\"$in\": #au_groups#}}).Count(gp)\n DBFind(@1roles_participants).Where({\"member->member_id\": #key_id#, \"deleted\": 0, \"ecosystem\": #ecosystem_id#, \"role->id\": {\"$in\": #au_roles#}}).Count(rl)\n If(And(#gp#>0,#rl#>0)){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1q_question, PageParams: \"q_id=#id#\"){\n Div(Class: text-primary){\n Span(#question#)\n }\n }\n }.Else{\n Span(#question#)\n }\n }\n }.Else{\n Span(#question#)\n }\n }\n}.Custom(custom_status){\n If(#status#==0){\n Span(Class: text-success, Body: LangRes(@1q_status_created))\n }\n If(#status#==1){\n Span(Class: text-success, Body: LangRes(@1q_status_started))\n }\n If(#status#==2){\n Span(Class: text-primary, Body: LangRes(@1q_status_ended))\n }\n If(#status#==3){\n Span(Class: text-warning, Body: LangRes(@1q_status_admin))\n }\n}.Custom(time){\n P(Class:h6 m0, Body: DateTime(#created_at#,HH:MI DD.MM.YYYY))\n P(Class:h6 m0, Body: DateTime(#expired#,HH:MI DD.MM.YYYY))\n}.Custom(initiator){\n DBFind(@1members).Where({\"ecosystem\": #ecosystem#, \"id\":#init#}).Vars(m)\n If(Or(#m_id#>0,#m_id#<0)){\n SetVar(member_name, #m_member_name#)\n }.Else{\n SetVar(member_name, Address(#id#))\n }\n Span(#member_name#)\n}.Custom(hidden){\n If(#params.hide#==true){\n Span(Class: fa fa-check fa-1x)\n }.Else{\n Span(Class:fa fa-times fa-1x)\n }\n}.Custom(change){\n If(#params.change#==true){\n Span(Class: fa fa-check fa-1x)\n }.Else{\n Span(Class:fa fa-times fa-1x)\n }\n}.Custom(ops){\n Span(Class: pull-right){\n If(#permission#==1){\n If(#status#==0){\n LinkPage(Body: Em(Class: fa fa-edit), Class: btn btn-link, Page: @1q_question_edit, PageParams: \"q_id=#id#\")\n }\n DBFind(@1q_answers).Where({\"question_id\": #id#}).Count(answers)\n If(#answers#>0){\n Button(Body: Em(Class: fa fa-bars), Class: btn btn-link, Page: @1q_question_log, PageParams: \"q_id=#id#\").Popup(Header: #question#, Width: \"50\")\n }\n If(#status#==0){\n Button(Body: Em(Class: fa fa-play), Class: btn btn-link, Page: @1q_listing, Contract: @1QOperations, Params: \"Operation=T,Id=#id#\")\n }\n If(#status#==1){\n Button(Body: Em(Class: fa fa-stop), Class: btn btn-link, Page: @1q_listing, Contract: @1QOperations, Params: \"Operation=Z,Id=#id#\")\n }\n Button(Body: Em(Class: fa fa-info-circle), Class: btn btn-link, Page: @1q_question_graph, PageParams: \"q_id=#id#\").Popup(Header: $@1q_answer_graph$ / #question#, Width: \"50\")\n Button(Body: Em(Class: fa fa-trash-o), Class: btn btn-link, Page: @1q_listing, Contract: @1QOperations, Params: \"Operation=D,Id=#id#\")\n }\n }\n}.Count(q)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#q#>0){\n Table(Source: src_q, Columns: \"$@1q_question$=custom_name,$@1q_initiator$=initiator,$@1q_status$=custom_status,$@1q_change$=change,$@1q_date_start$/$@1q_date_expiration$=time,=ops\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: $@1q_no_questions$)\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, @1q_listing).(this_table, @1q_list)\nInclude(@1pager_header)\n\nSetTitle($@1q_poll$)\nDBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Questionnaire\"}).Vars(application)\nSetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: q_admin_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#admin_roles#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\nIf(#admin_access_id# > 0){\n SetVar(permission,1)\n}\nIf(#permission#==1){\n AddToolButton(Title: $@1q_new_question$, Page: @1q_question_new, Icon: icon-plus).Popup(Header: $@1q_new_question$, Width: \"60\")\n}\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0, \"question\": {\"$ilike\": \"#search#\"}})\n}.Else{\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1q_question))\n Include(@1search)\n}\n\nDBFind(#this_table#, src_q).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Columns(\"id,question,description,answer,ecosystem,init,lastmodified,created_at,expired,status,params->hide,params->change,au_groups,au_roles\").Custom(custom_name){\n If(#permission#==1){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1q_question, PageParams: \"q_id=#id#\"){\n Div(Class: text-primary){\n Span(#question#)\n }\n }\n }.Else{\n If(#status#==1){\n If(And(#au_groups#==[0],#au_roles#==[0])){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1q_question, PageParams: \"q_id=#id#\"){\n Div(Class: text-primary){\n Span(#question#)\n }\n }\n }.Else{\n DBFind(\"@1groups_participants\").Where({\"member->account\": \"#account_id#\", \"deleted\": 0, \"ecosystem\": \"#ecosystem_id#\", \"groups_info->id\": {\"$in\": #au_groups#}}).Count(gp)\n DBFind(\"@1roles_participants\").Where({\"member->account\": \"#account_id#\", \"deleted\": 0, \"ecosystem\": \"#ecosystem_id#\", \"role->id\": {\"$in\": #au_roles#}}).Count(rl)\n If(And(#gp#>0,#rl#>0)){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1q_question, PageParams: \"q_id=#id#\"){\n Div(Class: text-primary){\n Span(#question#)\n }\n }\n }.Else{\n Span(#question#)\n }\n }\n }.Else{\n Span(#question#)\n }\n }\n}.Custom(custom_status){\n If(#status#==0){\n Span(Class: text-success, Body: LangRes(@1q_status_created))\n }\n If(#status#==1){\n Span(Class: text-success, Body: LangRes(@1q_status_started))\n }\n If(#status#==2){\n Span(Class: text-primary, Body: LangRes(@1q_status_ended))\n }\n If(#status#==3){\n Span(Class: text-warning, Body: LangRes(@1q_status_admin))\n }\n}.Custom(time){\n P(Class:h6 m0, Body: DateTime(#created_at#,HH:MI DD.MM.YYYY))\n P(Class:h6 m0, Body: DateTime(#expired#,HH:MI DD.MM.YYYY))\n}.Custom(initiator){\n SetVar(m_account,)\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem#\", \"account\": \"#init#\"}).Vars(m)\n If(#m_account#){\n SetVar(member_name, #m_member_name#)\n }.Else{\n SetVar(member_name, #init#)\n }\n Span(#member_name#)\n}.Custom(hidden){\n If(#params.hide#==true){\n Span(Class: fa fa-check fa-1x)\n }.Else{\n Span(Class:fa fa-times fa-1x)\n }\n}.Custom(change){\n If(#params.change#==true){\n Span(Class: fa fa-check fa-1x)\n }.Else{\n Span(Class:fa fa-times fa-1x)\n }\n}.Custom(ops){\n Span(Class: pull-right){\n If(#permission#==1){\n If(#status#==0){\n LinkPage(Body: Em(Class: fa fa-edit), Class: btn btn-link, Page: @1q_question_edit, PageParams: \"q_id=#id#\")\n }\n DBFind(\"@1q_answers\").Where({\"question_id\": \"#id#\"}).Count(answers)\n If(#answers#>0){\n Button(Body: Em(Class: fa fa-bars), Class: btn btn-link, Page: @1q_question_log, PageParams: \"q_id=#id#\").Popup(Header: #question#, Width: \"50\")\n }\n If(#status#==0){\n Button(Body: Em(Class: fa fa-play), Class: btn btn-link, Page: @1q_listing, Contract: @1QOperations, Params: \"Operation=T,Id=#id#\")\n }\n If(#status#==1){\n Button(Body: Em(Class: fa fa-stop), Class: btn btn-link, Page: @1q_listing, Contract: @1QOperations, Params: \"Operation=Z,Id=#id#\")\n }\n Button(Body: Em(Class: fa fa-info-circle), Class: btn btn-link, Page: @1q_question_graph, PageParams: \"q_id=#id#\").Popup(Header: $@1q_answer_graph$ / #question#, Width: \"50\")\n Button(Body: Em(Class: fa fa-trash-o), Class: btn btn-link, Page: @1q_listing, Contract: @1QOperations, Params: \"Operation=D,Id=#id#\")\n }\n }\n}.Count(q)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#q#>0){\n Table(Source: src_q, Columns: \"$@1q_question$=custom_name,$@1q_initiator$=initiator,$@1q_status$=custom_status,$@1q_change$=change,$@1q_date_start$/$@1q_date_expiration$=time,=ops\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: $@1q_no_questions$)\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "q_question", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "If(#notific_id#>0){\n DBFind(@1notifications).Where({id:#notific_id#}).Columns(\"page_params->id\").Vars(prefix)\n SetVar(q_id,#prefix_page_params_id#)\n}\nDBFind(@1q_list).Where({\"id\": #q_id#}).Columns(\"id,question,description,answer,ecosystem,init,lastmodified,created_at,expired,status,params->hide,params->change\").Vars(question)\nDBFind(@1q_answers).Where({\"question_id\": #question_id#}).Count(answers)\nDBFind(@1q_answers).Where({\"question_id\": #question_id#, member:#key_id#}).Vars(your_answer).Count(a)\nDBFind(@1members).Where({\"ecosystem\": #question_ecosystem#}).Count(total)\n\nDBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Questionnaire\"}).Vars(application)\nSetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: q_admin_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": #ecosystem_id#, \"$and\": [\"role->id\": {\"$in\": [#admin_roles#]}, \"role->id\": #role_id#], \"member->member_id\": #key_id#, \"deleted\": 0}).Vars(admin_access)\nIf(#admin_access_id# > 0){\n SetVar(permission,1)\n}\n\nDiv(content-wrapper){\n Div(row mt-sm){\n Div(col-lg-10 col-lg-offset-1){\n Form(panel panel-primary){\n Div(list-group-item text-center){\n P(Class: h3 text-bold m0, Body: #question_description#)\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-6 text-right){\n Label(For: Date Start){\n Span(Body: LangRes(@1q_date_start):)\n }\n }\n Div(col-md-6 text-left){\n DateTime(#question_created_at#,HH:MI DD.MM.YYYY)\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n Label(For: Last Modified){\n Span(Body: LangRes(@1q_lastmodified):)\n }\n }\n Div(col-md-6 text-left){\n DateTime(#question_lastmodified#,HH:MI DD.MM.YYYY)\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n Label(For: Date Ending){\n Span(Body: LangRes(@1q_date_expiration):)\n }\n }\n Div(col-md-6 text-left){\n DateTime(#question_expired#,HH:MI DD.MM.YYYY)\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n Label(For: Status){\n Span(Body: LangRes(@1status):)\n }\n }\n Div(col-md-6 text-left){\n If(#question_status#==0){\n Span(Class: text-success, Body: LangRes(@1q_status_created))\n }\n If(#question_status#==1){\n Span(Class: text-success, Body: LangRes(@1q_status_started))\n }\n If(#question_status#==2){\n Span(Class: text-primary, Body: LangRes(@1q_status_ended))\n }\n If(#question_status#==3){\n Span(Class: text-warning, Body: LangRes(@1q_status_admin))\n }\n }\n }\n }\n If(#question_status#!=0){\n Div(list-group-item text-center t5){\n If(#a#>0){\n Div(row mb){\n Div(col-sm-6 mt-sm text-right){\n Label(For: Notifications){\n Span(Body: LangRes(@1q_answer)\n }\n }\n Div(col-sm-6 mt-sm text-left){\n Input(Name: Change, Type: checkbox, Value: true, Disabled: true, Class: m0, Placeholder: #your_answer_decision#)\n }\n }\n }\n If(And(#question_params_change#==true,#a#>0,#question_status#==1)){\n Div(row mb-sm){\n Div(col-md-12 text-center){\n Span(Class: h6, Body: LangRes(@1q_hint_answer_revoting))\n }\n }\n }\n If(#question_status#==1){\n Div(row){\n Div(col-md-12 text-center){\n ArrayToSource(src, #question_answer#)\n ForList(Source: src, Index:ind){\n If(#a#==0){\n Button(Body: #value#, Page: @1q_question, Class: btn btn-primary ml-sm mr-sm, Contract: @1QAnswer, PageParams: \"q_id=#question_id#\", Params: \"QuestionId=#question_id#,AnswerId=#ind#,Decision=#value#,Operation=CV\")\n }\n If(And(#question_params_change#==true,#a#>0)){\n Button(Body: #value#, Page: @1q_question, Class: btn btn-primary ml-sm mr-sm, Contract: @1QAnswer, PageParams: \"q_id=#question_id#\", Params: \"Id=#your_answer_id#,QuestionId=#question_id#,AnswerId=#ind#,Decision=#value#,Operation=UV\")\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n}", + "Value": "If(#notific_id#>0){\n DBFind(\"@1notifications\").Where({\"id\": \"#notific_id#\"}).Columns(\"page_params->id\").Vars(prefix)\n SetVar(q_id,#prefix_page_params_id#)\n}\nDBFind(\"@1q_list\").Where({\"id\": \"#q_id#\"}).Columns(\"id,question,description,answer,ecosystem,init,lastmodified,created_at,expired,status,params->hide,params->change\").Vars(question)\nDBFind(\"@1q_answers\").Where({\"question_id\": \"#question_id#\"}).Count(answers)\nDBFind(\"@1q_answers\").Where({\"question_id\": \"#question_id#\", \"member\": \"#account_id#\"}).Vars(your_answer).Count(a)\nDBFind(\"@1members\").Where({\"ecosystem\": \"#question_ecosystem#\"}).Count(total)\n\nDBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Questionnaire\"}).Vars(application)\nSetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: q_admin_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#admin_roles#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\nIf(#admin_access_id# > 0){\n SetVar(permission,1)\n}\n\nDiv(content-wrapper){\n Div(row mt-sm){\n Div(col-lg-10 col-lg-offset-1){\n Form(panel panel-primary){\n Div(list-group-item text-center){\n P(Class: h3 text-bold m0, Body: #question_description#)\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-6 text-right){\n Label(For: Date Start){\n Span(Body: LangRes(@1q_date_start):)\n }\n }\n Div(col-md-6 text-left){\n DateTime(#question_created_at#,HH:MI DD.MM.YYYY)\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n Label(For: Last Modified){\n Span(Body: LangRes(@1q_lastmodified):)\n }\n }\n Div(col-md-6 text-left){\n DateTime(#question_lastmodified#,HH:MI DD.MM.YYYY)\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n Label(For: Date Ending){\n Span(Body: LangRes(@1q_date_expiration):)\n }\n }\n Div(col-md-6 text-left){\n DateTime(#question_expired#,HH:MI DD.MM.YYYY)\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n Label(For: Status){\n Span(Body: LangRes(@1status):)\n }\n }\n Div(col-md-6 text-left){\n If(#question_status#==0){\n Span(Class: text-success, Body: LangRes(@1q_status_created))\n }\n If(#question_status#==1){\n Span(Class: text-success, Body: LangRes(@1q_status_started))\n }\n If(#question_status#==2){\n Span(Class: text-primary, Body: LangRes(@1q_status_ended))\n }\n If(#question_status#==3){\n Span(Class: text-warning, Body: LangRes(@1q_status_admin))\n }\n }\n }\n }\n If(#question_status#!=0){\n Div(list-group-item text-center t5){\n If(#a#>0){\n Div(row mb){\n Div(col-sm-6 mt-sm text-right){\n Label(For: Notifications){\n Span(Body: LangRes(@1q_answer)\n }\n }\n Div(col-sm-6 mt-sm text-left){\n Input(Name: Change, Type: checkbox, Value: true, Disabled: true, Class: m0, Placeholder: #your_answer_decision#)\n }\n }\n }\n If(And(#question_params_change#==true,#a#>0,#question_status#==1)){\n Div(row mb-sm){\n Div(col-md-12 text-center){\n Span(Class: h6, Body: LangRes(@1q_hint_answer_revoting))\n }\n }\n }\n If(#question_status#==1){\n Div(row){\n Div(col-md-12 text-center){\n ArrayToSource(src, #question_answer#)\n ForList(Source: src, Index:ind){\n If(#a#==0){\n Button(Body: #value#, Page: @1q_question, Class: btn btn-primary ml-sm mr-sm, Contract: @1QAnswer, PageParams: \"q_id=#question_id#\", Params: \"QuestionId=#question_id#,AnswerId=#ind#,Decision=#value#,Operation=CV\")\n }\n If(And(#question_params_change#==true,#a#>0)){\n Button(Body: #value#, Page: @1q_question, Class: btn btn-primary ml-sm mr-sm, Contract: @1QAnswer, PageParams: \"q_id=#question_id#\", Params: \"Id=#your_answer_id#,QuestionId=#question_id#,AnswerId=#ind#,Decision=#value#,Operation=UV\")\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "q_question_edit", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1q_list).Where({\"ecosystem\": #ecosystem_id#, id:#q_id#}).Vars(question)\nDBFind(@1roles,src_rid).Where({\"ecosystem\": #ecosystem_id#}).Count(r)\nDBFind(@1groups,src_gp).Where({\"ecosystem\": #ecosystem_id#}).Count(g)\n\nArrayToSource(src, #question_answer#)\n\nIf(And(#question_au_groups#==[0],#question_au_roles#==[0])){\n SetVar(access,$@1q_question_everyone$)\n}.Else{\n SetVar(access,$@1q_question_nobody$)\n}\n\nIf(#question_status#==0){\n SetVar(editable,1)\n}\nSetVar(time,DateTime(#question_lastmodified#,HH:MI DD.MM.YYYY))\n\nSetTitle(#question_question#)\nSpan(Class: h5 m0 mb ml-lg){\n LinkPage(Class: ml-sm, Body: $@1q_poll$, Page: @1q_listing)\n Span(Class: text-muted mh-sm, Body: /)\n Span(Class: text-muted, Body: #question_question#)\n}.Style(\n display: inline-block;\n)\n\nDiv(content-wrapper){\n Form(){\n Div(form-group){\n Label($@1title$)\n If(#editable#==1){\n Input(Name: Question, Value: #question_question#)\n }.Else{\n Input(Name: Question, Value: #question_question#, Disabled: true)\n }\n }\n Div(form-group){\n If(#editable#==1){\n Label($@1q_description$)\n Input(Type: textarea, Name: Description, Value: #question_description#).Style(resize: vertical; min-height: 6em;)\n }\n }\n If(#g#>0){\n Div(form-group){\n Label($@1q_question_groups$)\n If(#editable#==1){\n Div(input-group mb-sm){\n Select(Name: AuGroups, Source: src_gp, NameColumn: group_name, ValueColumn: id)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-plus mtl buttons, Page: @1q_question_edit, PageParams:\"q_id=#question_id#\", Contract: @1QOperations, Params:\"Id=#question_id#,Operation=GA\")\n }\n }\n }\n ArrayToSource(au_g_src, #question_au_groups#)\n ForList(Source: au_g_src, Index: ind){\n DBFind(@1groups).Where({\"id\": #value#}).Vars(gn)\n If(#editable#==1){\n If(#value#==0){\n Button(Body: #access#, Class: btn-xs bg-gray-lighter ml-sm)\n }.Else{\n Button(Body: Span(Class: fa fa-remove) #gn_group_name#, Page: @1q_question_edit, Class: btn-xs bg-gray-lighter ml-sm, Contract: @1QOperations, PageParams: \"q_id=#question_id#\", Params: \"Id=#question_id#,AuGroups=#value#,Operation=GD\")\n }\n }.Else{\n If(#value#==0){\n Button(Body: #access#, Class: btn-xs bg-gray-lighter ml-sm)\n }.Else{\n Button(Body: #gn_group_name#, Class: btn-xs bg-gray-lighter ml-sm)\n }\n }\n }\n }\n }\n If(#r#>0){\n Div(form-group){\n Label($@1q_question_roles$)\n If(#editable#==1){\n Div(input-group mb-sm){\n Select(Name: AuRoles, Source: src_rid, NameColumn: role_name, ValueColumn: id)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-plus mtl buttons, Page: @1q_question_edit, PageParams:\"q_id=#question_id#\", Contract: @1QOperations, Params: \"Id=#question_id#,Operation=RA\")\n }\n }\n }\n ArrayToSource(au_r_src, #question_au_roles#)\n ForList(Source: au_r_src, Index: ind){\n DBFind(@1roles).Where({\"id\": #value#}).Vars(rn)\n If(#editable#==1){\n If(#value#==0){\n Button(Body: #access#, Class: btn-xs bg-gray-lighter ml-sm)\n }.Else{\n Button(Body: Span(Class: fa fa-remove) #rn_role_name#, Page: @1q_question_edit, Class: btn-xs bg-gray-lighter ml-sm, Contract: @1QOperations, PageParams: \"q_id=#question_id#\", Params: \"Id=#question_id#,AuRoles=#value#,Operation=RD\")\n }\n }.Else{\n If(#value#==0){\n Button(Body: #access#, Class: btn-xs bg-gray-lighter ml-sm)\n }.Else{\n Button(Body: #rn_role_name#, Class: btn-xs bg-gray-lighter ml-sm)\n }\n }\n }\n }\n }\n Div(form-group){\n Label($@1q_answer$)\n\n If(#editable#==1){\n Div(input-group mb-sm){\n Input(Name: Answer)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-plus mtl buttons, Page: @1q_question_edit, PageParams:\"q_id=#question_id#\", Contract: @1QOperations, Params:\"Id=#question_id#,Operation=AA\")\n }\n }\n }\n ForList(Source: src, Index: ind){\n If(#editable#==1){\n Button(Body: Span(Class: fa fa-remove) #value#, Page: @1q_question_edit, Class: btn-xs bg-gray-lighter ml-sm, Contract: @1QOperations, PageParams: \"q_id=#question_id#\", Params: \"Id=#question_id#,Answer=#value#,Operation=AD\")\n }.Else{\n Button(Body: #value#, Class: btn-xs bg-gray-lighter ml-sm)\n }\n }\n }\n Div(form-group){\n Button(Class: btn btn-primary pull-right mt sm, Body: $@1save$, Contract: @1QOperations, Page: @1q_listing, Params: \"Id=#question_id#,Operation=E\")\n Button(Class: btn btn-default pull-right mt sm, Body: LangRes(@1back), Page: @1q_listing)\n }\n }\n}.Style(\n .buttons{border: 1px solid #dde6e9;}\n)", + "Value": "DBFind(\"@1q_list\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#q_id#\"}).Vars(question)\nDBFind(\"@1roles\", src_rid).Where({\"ecosystem\": \"#ecosystem_id#\"}).Count(r)\nDBFind(\"@1groups\", src_gp).Where({\"ecosystem\": \"#ecosystem_id#\"}).Count(g)\n\nArrayToSource(src, #question_answer#)\n\nIf(And(#question_au_groups#==[0],#question_au_roles#==[0])){\n SetVar(access,$@1q_question_everyone$)\n}.Else{\n SetVar(access,$@1q_question_nobody$)\n}\n\nIf(#question_status#==0){\n SetVar(editable,1)\n}\nSetVar(time,DateTime(#question_lastmodified#,HH:MI DD.MM.YYYY))\n\nSetTitle(#question_question#)\nSpan(Class: h5 m0 mb ml-lg){\n LinkPage(Class: ml-sm, Body: $@1q_poll$, Page: @1q_listing)\n Span(Class: text-muted mh-sm, Body: /)\n Span(Class: text-muted, Body: #question_question#)\n}.Style(\n display: inline-block;\n)\n\nDiv(content-wrapper){\n Form(){\n Div(form-group){\n Label($@1title$)\n If(#editable#==1){\n Input(Name: Question, Value: #question_question#)\n }.Else{\n Input(Name: Question, Value: #question_question#, Disabled: true)\n }\n }\n Div(form-group){\n If(#editable#==1){\n Label($@1q_description$)\n Input(Type: textarea, Name: Description, Value: #question_description#).Style(resize: vertical; min-height: 6em;)\n }\n }\n If(#g#>0){\n Div(form-group){\n Label($@1q_question_groups$)\n If(#editable#==1){\n Div(input-group mb-sm){\n Select(Name: AuGroups, Source: src_gp, NameColumn: group_name, ValueColumn: id)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-plus mtl buttons, Page: @1q_question_edit, PageParams:\"q_id=#question_id#\", Contract: @1QOperations, Params:\"Id=#question_id#,Operation=GA\")\n }\n }\n }\n ArrayToSource(au_g_src, #question_au_groups#)\n ForList(Source: au_g_src, Index: ind){\n DBFind(\"@1groups\").Where({\"id\": \"#value#\"}).Vars(gn)\n If(#editable#==1){\n If(#value#==0){\n Button(Body: #access#, Class: btn-xs bg-gray-lighter ml-sm)\n }.Else{\n Button(Body: Span(Class: fa fa-remove) #gn_group_name#, Page: @1q_question_edit, Class: btn-xs bg-gray-lighter ml-sm, Contract: @1QOperations, PageParams: \"q_id=#question_id#\", Params: \"Id=#question_id#,AuGroups=#value#,Operation=GD\")\n }\n }.Else{\n If(#value#==0){\n Button(Body: #access#, Class: btn-xs bg-gray-lighter ml-sm)\n }.Else{\n Button(Body: #gn_group_name#, Class: btn-xs bg-gray-lighter ml-sm)\n }\n }\n }\n }\n }\n If(#r#>0){\n Div(form-group){\n Label($@1q_question_roles$)\n If(#editable#==1){\n Div(input-group mb-sm){\n Select(Name: AuRoles, Source: src_rid, NameColumn: role_name, ValueColumn: id)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-plus mtl buttons, Page: @1q_question_edit, PageParams:\"q_id=#question_id#\", Contract: @1QOperations, Params: \"Id=#question_id#,Operation=RA\")\n }\n }\n }\n ArrayToSource(au_r_src, #question_au_roles#)\n ForList(Source: au_r_src, Index: ind){\n DBFind(\"@1roles\").Where({\"id\": \"#value#\"}).Vars(rn)\n If(#editable#==1){\n If(#value#==0){\n Button(Body: #access#, Class: btn-xs bg-gray-lighter ml-sm)\n }.Else{\n Button(Body: Span(Class: fa fa-remove) #rn_role_name#, Page: @1q_question_edit, Class: btn-xs bg-gray-lighter ml-sm, Contract: @1QOperations, PageParams: \"q_id=#question_id#\", Params: \"Id=#question_id#,AuRoles=#value#,Operation=RD\")\n }\n }.Else{\n If(#value#==0){\n Button(Body: #access#, Class: btn-xs bg-gray-lighter ml-sm)\n }.Else{\n Button(Body: #rn_role_name#, Class: btn-xs bg-gray-lighter ml-sm)\n }\n }\n }\n }\n }\n Div(form-group){\n Label($@1q_answer$)\n\n If(#editable#==1){\n Div(input-group mb-sm){\n Input(Name: Answer)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-plus mtl buttons, Page: @1q_question_edit, PageParams:\"q_id=#question_id#\", Contract: @1QOperations, Params:\"Id=#question_id#,Operation=AA\")\n }\n }\n }\n ForList(Source: src, Index: ind){\n If(#editable#==1){\n Button(Body: Span(Class: fa fa-remove) #value#, Page: @1q_question_edit, Class: btn-xs bg-gray-lighter ml-sm, Contract: @1QOperations, PageParams: \"q_id=#question_id#\", Params: \"Id=#question_id#,Answer=#value#,Operation=AD\")\n }.Else{\n Button(Body: #value#, Class: btn-xs bg-gray-lighter ml-sm)\n }\n }\n }\n Div(form-group){\n Button(Class: btn btn-primary pull-right mt sm, Body: $@1save$, Contract: @1QOperations, Page: @1q_listing, Params: \"Id=#question_id#,Operation=E\")\n Button(Class: btn btn-default pull-right mt sm, Body: LangRes(@1back), Page: @1q_listing)\n }\n }\n}.Style(\n .buttons{border: 1px solid #dde6e9;}\n)", "Menu": "default_menu", "Type": "pages" }, { "Name": "q_question_graph", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Form(){\n DBFind(@1q_list).Where({\"id\": #q_id#}).Columns(\"id,question,description,answer,ecosystem,init,lastmodified,created_at,expired,status,params->hide,params->change\").Vars(question)\n DBFind(@1q_answers).Where({\"question_id\": #question_id#}).Count(answers)\n Div(list-group-item){\n Div(row){\n Div(col-md-12 text-center){\n P(Class: h3 m0, Body: #question_description#)\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-6 text-right){\n Label(For: Date Start){\n Span(Body: LangRes(@1q_date_start):)\n }\n }\n Div(col-md-6 text-left){\n DateTime(#question_created_at#,HH:MI DD.MM.YYYY)\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n Label(For: Last Modified){\n Span(Body: LangRes(@1q_lastmodified):)\n }\n }\n Div(col-md-6 text-left){\n DateTime(#question_lastmodified#,HH:MI DD.MM.YYYY)\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n Label(For: Date Ending){\n Span(Body: LangRes(@1q_date_expiration):)\n }\n }\n Div(col-md-6 text-left){\n DateTime(#question_expired#,HH:MI DD.MM.YYYY)\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n Label(For: Status){\n Span(Body: LangRes(@1status):)\n }\n }\n Div(col-md-6 text-left){\n If(#question_status#==0){\n Span(Class: text-success, Body: LangRes(@1q_status_created))\n }\n If(#question_status#==1){\n Span(Class: text-success, Body: LangRes(@1q_status_started))\n }\n If(#question_status#==2){\n Span(Class: text-primary, Body: LangRes(@1q_status_ended))\n }\n If(#question_status#==3){\n Span(Class: text-warning, Body: LangRes(@1q_status_admin))\n }\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n Label(For: Stats){\n Span(Body: LangRes(@1q_answer_data):)\n }\n }\n Div(col-md-6 text-left){\n #answers#\n }\n }\n }\n Div(list-group-item text-center){\n ArrayToSource(src, #question_answer#)\n ForList(Source: src, Index:ind){\n DBFind(@1q_answers).Where({\"question_id\": #question_id#, \"decision\": #value#}).Count(a)\n Span(){\n Span(Class: h4 m0 text-primary, Body: #value#:#a#)\n }.Style(margin-right: 15px; margin-left: 15px;)\n }\n }\n Div(row mt){\n Div(col-md-12 text-center){\n If(#q_page#==\"@1q_profile\"){\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: @1profile_view)\n }.Else{\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: @1q_listing)\n }\n }\n }\n}", + "Value": "Form(){\n DBFind(\"@1q_list\").Where({\"id\": \"#q_id#\"}).Columns(\"id,question,description,answer,ecosystem,init,lastmodified,created_at,expired,status,params->hide,params->change\").Vars(question)\n DBFind(\"@1q_answers\").Where({\"question_id\": \"#question_id#\"}).Count(answers)\n Div(list-group-item){\n Div(row){\n Div(col-md-12 text-center){\n P(Class: h3 m0, Body: #question_description#)\n }\n }\n }\n Div(list-group-item){\n Div(row){\n Div(col-md-6 text-right){\n Label(For: Date Start){\n Span(Body: LangRes(@1q_date_start):)\n }\n }\n Div(col-md-6 text-left){\n DateTime(#question_created_at#,HH:MI DD.MM.YYYY)\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n Label(For: Last Modified){\n Span(Body: LangRes(@1q_lastmodified):)\n }\n }\n Div(col-md-6 text-left){\n DateTime(#question_lastmodified#,HH:MI DD.MM.YYYY)\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n Label(For: Date Ending){\n Span(Body: LangRes(@1q_date_expiration):)\n }\n }\n Div(col-md-6 text-left){\n DateTime(#question_expired#,HH:MI DD.MM.YYYY)\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n Label(For: Status){\n Span(Body: LangRes(@1status):)\n }\n }\n Div(col-md-6 text-left){\n If(#question_status#==0){\n Span(Class: text-success, Body: LangRes(@1q_status_created))\n }\n If(#question_status#==1){\n Span(Class: text-success, Body: LangRes(@1q_status_started))\n }\n If(#question_status#==2){\n Span(Class: text-primary, Body: LangRes(@1q_status_ended))\n }\n If(#question_status#==3){\n Span(Class: text-warning, Body: LangRes(@1q_status_admin))\n }\n }\n }\n Div(row){\n Div(col-md-6 text-right){\n Label(For: Stats){\n Span(Body: LangRes(@1q_answer_data):)\n }\n }\n Div(col-md-6 text-left){\n #answers#\n }\n }\n }\n Div(list-group-item text-center){\n ArrayToSource(src, #question_answer#)\n ForList(Source: src, Index: ind){\n DBFind(\"@1q_answers\").Where({\"question_id\": \"#question_id#\", \"decision\": \"#value#\"}).Count(a)\n Span(){\n Span(Class: h4 m0 text-primary, Body: #value#:#a#)\n }.Style(margin-right: 15px; margin-left: 15px;)\n }\n }\n Div(row mt){\n Div(col-md-12 text-center){\n If(#q_page#==\"@1q_profile\"){\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: @1profile_view)\n }.Else{\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: @1q_listing)\n }\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "q_question_log", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Form(){\n SetVar(this_page, @1q_question_log).(this_table, @1q_answers)\n Include(@1pager_header)\n DBFind(@1q_list).Where({\"id\": #q_id#}).Columns(\"id\").Vars(q)\n\n If(#a_id#>0){\n SetVar(where, {\"question_id\": #q_id#, \"answer_id\": #a_id#})\n }.Else{\n SetVar(where, {\"question_id\": #q_id#})\n }\n\n DBFind(@1q_answers,src_a).Where(#where#).Limit(#pager_limit#).Custom(ans){\n #answer_id# : #decision#\n }.Custom(c_m){\n Address(#member#)\n }.Custom(time){\n DateTime(#lastmodified#,HH:MI DD.MM.YYYY)\n }.Count(a)\n\n Div(row form-group){\n Div(col-sm-12){\n Table(Source: src_a, Columns:\"$@1q_answer_member$=c_m,$@1q_date_lastmodified$=time,$@1q_answer$=ans\")\n Div(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n }\n }\n }\n Div(row mt){\n Div(col-md-12 text-center){\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: @1q_listing)\n }\n }\n}", + "Value": "Form(){\n SetVar(this_page, @1q_question_log).(this_table, @1q_answers)\n Include(@1pager_header)\n DBFind(\"@1q_list\").Where({\"id\": \"#q_id#\"}).Columns(\"id\").Vars(q)\n\n If(#a_id# > 0){\n SetVar(where, {\"question_id\": \"#q_id#\", \"answer_id\": \"#a_id#\"})\n }.Else{\n SetVar(where, {\"question_id\": \"#q_id#\"})\n }\n\n DBFind(\"@1q_answers\", src_a).Where(#where#).Limit(#pager_limit#).Custom(ans){\n #answer_id# : #decision#\n }.Custom(c_m){\n #member#\n }.Custom(time){\n DateTime(#lastmodified#,HH:MI DD.MM.YYYY)\n }.Count(a)\n\n Div(row form-group){\n Div(col-sm-12){\n Table(Source: src_a, Columns:\"$@1q_answer_member$=c_m,$@1q_date_lastmodified$=time,$@1q_answer$=ans\")\n Div(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n }\n }\n }\n Div(row mt){\n Div(col-md-12 text-center){\n Button(Body: LangRes(@1back), Class: btn btn-default, Page: @1q_listing)\n }\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "q_question_new", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Form(){\n Data(bool,\"value,name\"){\n 0,$@1ex_unavaliable$\n 1,$@1ex_avaliable$\n }\n Div(row){\n Div(col-sm-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1title)\n Span(*,text-danger)\n }\n }\n Div(col-sm-9){\n Input(Name: Question, Type: text)\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1q_description)\n Span(*,text-danger)\n }\n }\n Div(col-sm-9){\n Input(Type: textarea, Name: Description, Value: \"\", Placeholder: $@1message_type_here$).Style(resize: vertical; min-height: 6em;)\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1q_answer)\n Span(*,text-danger)\n }\n }\n Div(col-sm-9){\n Div(input-group mb-sm){\n Input(Name: Answer)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-plus mtl buttons, Page: @1q_question_new, Contract: @1QOperations, Params:\"Id=#question_id#, Operation=AA\").Popup(60, $@1message_type_here$)\n }\n }\n DBFind(@1buffer_data).Where({\"key\": \"q_answers\", \"member_id\": #key_id#, \"ecosystem\": #ecosystem_id#}).Vars(ans)\n ArrayToSource(src, #ans_value#)\n ForList(Source: src, Index: ind){\n Button(Body: Span(Class: fa fa-remove) #value#, Class: btn-xs bg-gray-lighter mr-sm mb-sm, Page: @1q_question_new, Contract: @1QOperations, Params: \"Id=#question_id#,Answer=#value#,Operation=AD\").Popup(60, $@1message_type_here$)\n }\n }\n }\n Div(row mt-lg){\n Div(col-sm-3 mt-sm text-right){\n Label(){\n LangRes(@1date_end)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-6){\n Input(Name: EndDate, Type: date)\n }\n Div(col-md-6){\n Input(Name: EndTime, Type: time, Value: \"00:00\")\n }\n }\n }\n }\n Div(row mt){\n Div(col-sm-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1notifications)\n }\n }\n Div(col-sm-9 mt-sm){\n Input(Name: Notifications, Type: checkbox, Value: false, Class: m0, Placeholder: \"$@1q_notifications_send$\")\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1result)\n }\n }\n Div(col-sm-9 mt-sm){\n Input(Name: Hide, Type: checkbox, Value: false, Class: m0, Placeholder: \"$@1q_hide$\")\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1answer)\n }\n\n }\n Div(col-sm-9 mt-sm){\n Input(Name: Change, Type: checkbox, Value: false, Class: m0, Placeholder: \"$@1q_answer_change$\")\n }\n }\n Div(row mt){\n Div(col-md-12){\n Button(Body: LangRes(@1create), Page: @1q_listing, Class: btn btn-primary pull-right mt-sm, Contract: @1QOperations, Params: \"Operation=C\")\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt-sm, Page: @1q_listing)\n }\n }\n}.Style(\n .buttons{border: 1px solid #dde6e9;}\n)", + "Value": "Form(){\n Data(bool,\"value,name\"){\n 0,$@1ex_unavaliable$\n 1,$@1ex_avaliable$\n }\n Div(row){\n Div(col-sm-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1title)\n Span(*,text-danger)\n }\n }\n Div(col-sm-9){\n Input(Name: Question, Type: text)\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1q_description)\n Span(*,text-danger)\n }\n }\n Div(col-sm-9){\n Input(Type: textarea, Name: Description, Value: \"\", Placeholder: $@1message_type_here$).Style(resize: vertical; min-height: 6em;)\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1q_answer)\n Span(*,text-danger)\n }\n }\n Div(col-sm-9){\n Div(input-group mb-sm){\n Input(Name: Answer)\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-plus mtl buttons, Page: @1q_question_new, Contract: @1QOperations, Params:\"Id=#question_id#, Operation=AA\").Popup(60, $@1message_type_here$)\n }\n }\n DBFind(\"@1buffer_data\").Where({\"key\": \"q_answers\", \"account\": \"#account_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(ans)\n ArrayToSource(src, #ans_value#)\n ForList(Source: src, Index: ind){\n Button(Body: Span(Class: fa fa-remove) #value#, Class: btn-xs bg-gray-lighter mr-sm mb-sm, Page: @1q_question_new, Contract: @1QOperations, Params: \"Id=#question_id#,Answer=#value#,Operation=AD\").Popup(60, $@1message_type_here$)\n }\n }\n }\n Div(row mt-lg){\n Div(col-sm-3 mt-sm text-right){\n Label(){\n LangRes(@1date_end)\n Span(*,text-danger)\n }\n }\n Div(col-md-9 text-left){\n Div(row){\n Div(col-md-6){\n Input(Name: EndDate, Type: date)\n }\n Div(col-md-6){\n Input(Name: EndTime, Type: time, Value: \"00:00\")\n }\n }\n }\n }\n Div(row mt){\n Div(col-sm-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1notifications)\n }\n }\n Div(col-sm-9 mt-sm){\n Input(Name: Notifications, Type: checkbox, Value: false, Class: m0, Placeholder: \"$@1q_notifications_send$\")\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1result)\n }\n }\n Div(col-sm-9 mt-sm){\n Input(Name: Hide, Type: checkbox, Value: false, Class: m0, Placeholder: \"$@1q_hide$\")\n }\n }\n Div(row mt-sm){\n Div(col-sm-3 mt-sm text-right){\n Label(){\n Span(Body: LangRes(@1answer)\n }\n\n }\n Div(col-sm-9 mt-sm){\n Input(Name: Change, Type: checkbox, Value: false, Class: m0, Placeholder: \"$@1q_answer_change$\")\n }\n }\n Div(row mt){\n Div(col-md-12){\n Button(Body: LangRes(@1create), Page: @1q_listing, Class: btn btn-primary pull-right mt-sm, Contract: @1QOperations, Params: \"Operation=C\")\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt-sm, Page: @1q_listing)\n }\n }\n}.Style(\n .buttons{border: 1px solid #dde6e9;}\n)", "Menu": "default_menu", "Type": "pages" }, { "Name": "q_settings", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Questionnaire\"}).Vars(\"app\")\n\nSetVar(this_page, \"@1q_settings\").(q_admin_role,0)\nSetVar(q_admin_role, AppParam(App: #app_id#, Name: \"q_admin_role\"))\n\nDBFind(\"@1roles\", src_roles).Where({\"ecosystem\": #ecosystem_id#, \"deleted\": 0}).Columns(\"role_name,id\").Limit(100)\n\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-4 text-right mt-sm\").(col_right,\"col-sm-8 text-left\")\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(@1q_settings)\n }\n Div(text-center text-muted){\n LangRes(@1q_settings_description)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n LangRes(@1q_admin_role)\n }\n }\n Div(#col_right#){\n Select(Name: RoleAdmin, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #q_admin_role#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#q_admin_role# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #q_admin_role#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1apply_settings$, Class: btn btn-primary, Page: #this_page#, Contract: @1QSettings)\n }\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Questionnaire\"}).Vars(app)\n\nSetVar(this_page, \"@1q_settings\").(q_admin_role,0)\nSetVar(q_admin_role, AppParam(App: #app_id#, Name: \"q_admin_role\"))\n\nDBFind(\"@1roles\", src_roles).Where({\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0}).Columns(\"role_name,id\").Limit(100)\n\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-4 text-right mt-sm\").(col_right,\"col-sm-8 text-left\")\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(@1q_settings)\n }\n Div(text-center text-muted){\n LangRes(@1q_settings_description)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n LangRes(@1q_admin_role)\n }\n }\n Div(#col_right#){\n Select(Name: RoleAdmin, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #q_admin_role#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#q_admin_role# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#q_admin_role#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1apply_settings$, Class: btn btn-primary, Page: #this_page#, Contract: @1QSettings)\n }\n }\n }\n }\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "QAnswer", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract QAnswer {\n data {\n Id int \"optional\"\n Operation string\n QuestionId int\n Decision string\n AnswerId int\n }\n\n conditions {\n $question = DBFind(\"@1q_list\").Where({\"id\": $QuestionId}).Columns(\"deleted,status,params->change,au_roles,au_groups,expired\").Row()\n if $question[\"deleted\"] == 1 {\n warning LangRes(\"@1q_error_cannot\", \"en\")\n }\n if $question[\"status\"] != 1 {\n warning LangRes(\"@1q_error_cannot\", \"en\")\n }\n if $Operation == \"UV\" {\n if $question[\"params.change\"] != \"true\" {\n warning LangRes(\"@1q_error_revoting\", \"en\")\n }\n }\n if $question[\"au_roles\"] != \"[0]\" {\n var au_roles array\n au_roles = JSONDecode($question[\"au_roles\"])\n if !DBFind(\"@1roles_participants\").Where({\"member->member_id\": $key_id, \"deleted\": 0, \"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": au_roles}}) {\n warning LangRes(\"@1q_error_cannot\", \"en\")\n }\n }\n if $question[\"au_groups\"] != \"[0]\" {\n var au_groups array\n au_groups = JSONDecode($question[\"au_groups\"])\n if !DBFind(\"@1groups_participants\").Where({\"member->member_id\": $key_id, \"deleted\": 0, \"ecosystem\": $ecosystem_id,\" groups_info->id\": {\"$in\": au_groups}}) {\n warning LangRes(\"@1q_error_cannot\", \"en\")\n }\n }\n }\n\n action {\n var notes array i int note map\n notes = DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"recipient->member_id\": $key_id, \"page_name\": \"@1q_question\", \"page_params->id\": $QuestionId, \"closed\": 0}).Columns(\"id\")\n while i < Len(notes) {\n note = notes[i]\n @1NotificationsClose(\"NotificId\", Int(note[\"id\"]))\n i = i + 1\n }\n\n var m map\n if $block_time > Int($question[\"expired\"]) {\n m[\"expired\"] = $block_time\n m[\"status\"] = 2\n m[\"lastmodified\"] = $block_time\n DBUpdate(\"@1q_list\", $QuestionId, m)\n } else {\n m[\"member\"] = $key_id\n m[\"decision\"] = $Decision\n m[\"answer_id\"] = $AnswerId\n m[\"ecosystem\"] = $ecosystem_id\n m[\"lastmodified\"] = $block_time\n m[\"question_id\"] = $QuestionId\n if $Operation == \"CV\" {\n DBInsert(\"@1q_answers\", m)\n }\n if $Operation == \"UV\" {\n DBUpdate(\"@1q_answers\", $Id, m)\n }\n }\n }\n}", + "Value": "contract QAnswer {\n data {\n Id int \"optional\"\n Operation string\n QuestionId int\n Decision string\n AnswerId int\n }\n\n conditions {\n $question = DBFind(\"@1q_list\").Where({\"id\": $QuestionId}).Columns(\"deleted,status,params->change,au_roles,au_groups,expired\").Row()\n if $question[\"deleted\"] == 1 {\n warning LangRes(\"@1q_error_cannot\", \"en\")\n }\n if $question[\"status\"] != 1 {\n warning LangRes(\"@1q_error_cannot\", \"en\")\n }\n if $Operation == \"UV\" {\n if $question[\"params.change\"] != \"true\" {\n warning LangRes(\"@1q_error_revoting\", \"en\")\n }\n }\n if $question[\"au_roles\"] != \"[0]\" {\n var au_roles array\n au_roles = JSONDecode($question[\"au_roles\"])\n if !DBFind(\"@1roles_participants\").Where({\"member->account\": $account_id, \"deleted\": 0, \"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": au_roles}}) {\n warning LangRes(\"@1q_error_cannot\", \"en\")\n }\n }\n if $question[\"au_groups\"] != \"[0]\" {\n var au_groups array\n au_groups = JSONDecode($question[\"au_groups\"])\n if !DBFind(\"@1groups_participants\").Where({\"member->account\": $account_id, \"deleted\": 0, \"ecosystem\": $ecosystem_id,\" groups_info->id\": {\"$in\": au_groups}}) {\n warning LangRes(\"@1q_error_cannot\", \"en\")\n }\n }\n }\n\n action {\n var notes array i int note map\n notes = DBFind(\"@1notifications\").Where({\"ecosystem\": $ecosystem_id, \"recipient->account\": $account_id, \"page_name\": \"@1q_question\", \"page_params->id\": $QuestionId, \"closed\": 0}).Columns(\"id\")\n while i < Len(notes) {\n note = notes[i]\n @1NotificationsClose(\"NotificId\", Int(note[\"id\"]))\n i = i + 1\n }\n\n var m map\n if $block_time > Int($question[\"expired\"]) {\n m[\"expired\"] = $block_time\n m[\"status\"] = 2\n m[\"lastmodified\"] = $block_time\n DBUpdate(\"@1q_list\", $QuestionId, m)\n } else {\n m[\"member\"] = $account_id\n m[\"decision\"] = $Decision\n m[\"answer_id\"] = $AnswerId\n m[\"ecosystem\"] = $ecosystem_id\n m[\"lastmodified\"] = $block_time\n m[\"question_id\"] = $QuestionId\n if $Operation == \"CV\" {\n DBInsert(\"@1q_answers\", m)\n }\n if $Operation == \"UV\" {\n DBUpdate(\"@1q_answers\", $Id, m)\n }\n }\n }\n}", "Type": "contracts" }, { "Name": "QOperations", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract QOperations {\n data {\n Id int \"optional\"\n Description string\n Question string\n Answer string\n Operation string\n Notifications bool \"optional\"\n Hide bool \"optional\"\n Change bool \"optional\"\n AuGroups int \"optional\"\n AuRoles int \"optional\"\n EndDate string\n EndTime string\n }\n\n func trimZeroTime(s string) string {\n if Contains(s, \"T00:00:00Z\") {\n s = Replace(s, \"T00:00:00Z\", \"\")\n }\n return s\n }\n\n func dateAddTime(d, t string) string {\n var dt string\n if Size(t) == 5 {\n dt = Sprintf(\"%v %v:00\", trimZeroTime(d), t)\n }\n return dt\n }\n\n func expToTimestamp() {\n $ext_string = dateAddTime($EndDate, $EndTime)\n if $block_time > UnixDateTime($ext_string) {\n warning LangRes(\"@1ending_date_invalid\", \"en\")\n }\n }\n\n conditions {\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Questionnaire\"}).One(\"id\")\n var admin_ids string\n admin_ids = AppParam(Int($app), \"q_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+admin_ids+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n if $Operation == \"GA\" {\n $groups = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).Columns(\"au_groups\").One(\"au_groups\"))\n var i int\n i = 0\n while i < Len($groups) {\n if $groups[i] == $AuRoles {\n warning LangRes(\"@1q_error_groups\", \"en\")\n }\n i = i + 1\n }\n }\n if $Operation == \"RA\" {\n $roles = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).Columns(\"au_roles\").One(\"au_roles\"))\n var i int\n i = 0\n while i < Len($roles) {\n if $roles[i] == $AuRoles {\n warning LangRes(\"@1q_error_roles\", \"en\")\n }\n i = i + 1\n }\n }\n if $Operation == \"AA\" {\n if $Answer == \"\" {\n warning LangRes(\"@1q_error_blank\", \"en\")\n }\n }\n if $Operation == \"C\" {\n if $Description == \"\" {\n warning LangRes(\"@1q_error_blank\", \"en\")\n }\n if $Question == \"\" {\n warning LangRes(\"@1q_error_blank\", \"en\")\n }\n expToTimestamp()\n if $block_time > UnixDateTime($ext_string) {\n warning LangRes(\"@1q_error_expdate\", \"en\")\n }\n }\n }\n\n action {\n var q map audience audience_new array\n //notifications when start and changing status\n if $Operation == \"C\" {\n var decision array\n decision = JSONDecode(DBFind(\"@1buffer_data\").Where({\"key\": \"q_answers\", \"member_id\": $key_id, \"ecosystem\": $ecosystem_id}).One(\"value\"))\n var params map\n params[\"notifications\"] = $Notifications\n params[\"hide\"] = $Hide\n params[\"change\"] = $Change\n q[\"question\"] = $Question\n q[\"description\"] = $Description\n q[\"answer\"] = JSONEncode(decision)\n q[\"ecosystem\"] = $ecosystem_id\n q[\"deleted\"] = 0\n q[\"init\"] = $key_id\n q[\"status\"] = 0\n q[\"au_roles\"] = \"[0]\"\n q[\"au_groups\"] = \"[0]\"\n q[\"created_at\"] = $block_time\n q[\"params\"] = JSONEncode(params)\n q[\"lastmodified\"] = $block_time\n q[\"expired\"] = UnixDateTime($ext_string)\n DBInsert(\"@1q_list\", q)\n }\n if $Operation == \"E\" {\n q[\"description\"] = $Description\n q[\"question\"] = $Question\n q[\"ecosystem\"] = $ecosystem_id\n q[\"init\"] = $key_id\n q[\"lastmodified\"] = $block_time\n DBUpdate(\"@1q_list\", $Id, q)\n }\n if $Operation == \"AA\" {\n if $Id == 0 {\n if !DBFind(\"@1buffer_data\").Where({\"key\": \"q_answers\", \"member_id\": $key_id, \"ecosystem\": $ecosystem_id}).One(\"value\") {\n var decision array\n decision = Append(decision, Str($Answer))\n q[\"value\"] = JSONEncode(decision)\n q[\"member_id\"] = $key_id\n q[\"key\"] = \"q_answers\"\n q[\"ecosystem\"] = $ecosystem_id\n DBInsert(\"@1buffer_data\", q)\n } else {\n var decision array\n $id_upd = Int(DBFind(\"@1buffer_data\").Where({\"key\": \"q_answers\", \"member_id\": $key_id, \"ecosystem\": $ecosystem_id}).One(\"id\"))\n decision = JSONDecode(DBFind(\"@1buffer_data\").Where({\"key\": \"q_answers\", \"member_id\": $key_id, \"ecosystem\": $ecosystem_id}).One(\"value\"))\n decision = Append(decision, Str($Answer))\n q[\"value\"] = JSONEncode(decision)\n DBUpdate(\"@1buffer_data\", $id_upd, q)\n }\n } else {\n var decision array\n decision = JSONDecode(DBFind(\"@1q_list\").Columns(\"answer\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).One(\"answer\"))\n decision = Append(decision, Str($Answer))\n q[\"answer\"] = JSONEncode(decision)\n DBUpdate(\"@1q_list\", $Id, q)\n }\n }\n if $Operation == \"AD\" {\n if $Id == 0 {\n var decision decision_new array\n decision = JSONDecode(DBFind(\"@1buffer_data\").Where({\"key\": \"q_answers\", \"member_id\": $key_id}).One(\"value\"))\n $id_upd = Int(DBFind(\"@1buffer_data\").Where({\"key\": \"q_answers\", \"member_id\": $key_id}).One(\"id\"))\n var i int\n while i < Len(decision) {\n if decision[i] != Str($Answer) {\n decision_new = Append(decision_new, decision[i])\n }\n i = i + 1\n }\n q[\"value\"] = JSONEncode(decision_new)\n DBUpdate(\"@1buffer_data\", $id_upd, q)\n } else {\n var decision decision_new array\n decision = JSONDecode(DBFind(\"@1q_list\").Columns(\"answer\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).One(\"answer\"))\n var i int\n while i < Len(decision) {\n if decision[i] != Str($Answer) {\n decision_new = Append(decision_new, decision[i])\n }\n i = i + 1\n }\n q[\"answer\"] = JSONEncode(decision_new)\n DBUpdate(\"@1q_list\", $Id, q)\n }\n }\n if $Operation == \"RA\" {\n audience = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).Columns(\"au_roles\").One(\"au_roles\"))\n if audience[0]==0 {\n audience[0] = $AuRoles\n } else {\n audience = Append(audience, $AuRoles)\n }\n q[\"au_roles\"] = JSONEncode(audience)\n DBUpdate(\"@1q_list\", $Id, q)\n }\n if $Operation == \"GA\" {\n audience = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).Columns(\"au_groups\").One(\"au_groups\"))\n if audience[0]==0 {\n audience[0] = $AuGroups\n } else {\n audience = Append(audience, $AuGroups)\n }\n q[\"au_groups\"] = JSONEncode(audience)\n DBUpdate(\"@1q_list\", $Id, q)\n }\n if $Operation == \"RD\" {\n audience = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).Columns(\"au_roles\").One(\"au_roles\"))\n var i int\n if audience[0]==$AuRoles && Len(audience)<2 {\n audience[0] = 0\n q[\"au_roles\"] = JSONEncode(audience)\n } else {\n while i < Len(audience) {\n if audience[i] != $AuRoles {\n audience_new = Append(audience_new, audience[i])\n }\n i = i + 1\n }\n q[\"au_roles\"] = JSONEncode(audience_new)\n }\n DBUpdate(\"@1q_list\", $Id, q)\n }\n if $Operation == \"GD\" {\n audience = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).Columns(\"au_groups\").One(\"au_groups\"))\n var i int\n if audience[0]==$AuGroups && Len(audience)<2 {\n audience[0] = 0\n q[\"au_groups\"] = JSONEncode(audience)\n } else {\n while i < Len(audience) {\n if audience[i] != $AuRoles {\n audience_new = Append(audience_new, audience[i])\n }\n i = i + 1\n }\n q[\"au_groups\"] = JSONEncode(audience)\n }\n DBUpdate(\"@1q_list\", $Id, q)\n }\n if $Operation == \"T\" {\n q[\"init\"] = $key_id\n q[\"status\"] = 1\n q[\"lastmodified\"] = $block_time\n DBUpdate(\"@1q_list\", $Id, q)\n var params map\n params = DBFind(\"@1q_list\").Where({\"id\": $Id}).Columns(\"id,question,params->notifications\").Row()\n var rid_array grp_array array\n rid_array = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).One(\"au_roles\"))\n grp_array = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).One(\"au_groups\"))\n if rid_array[0] == 0 && grp_array[0] == 0 && params[\"params.notifications\"] == \"true\" {\n var participants array\n participants = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"deleted\": 0}).Columns(\"id\")\n var i int\n while i < Len(participants) {\n var participant map\n participant = participants[i]\n @1NotificationsSend(\"MemberId,Sender,Icon,Header,Body,Page,Params,Rid,Closure\", Int(participant[\"id\"]), 1, \"fa fa-question-circle\", LangRes(\"@1q_new_question\", \"en\"), params[\"question\"], \"@1q_question\", params, 0, 0)\n i = i + 1\n }\n }\n }\n if $Operation == \"Z\" {\n q[\"init\"] = $key_id\n q[\"status\"] = 3\n q[\"lastmodified\"] = $block_time\n DBUpdate(\"@1q_list\", $Id, q)\n var question string\n var params map\n params = DBFind(\"@1q_list\").Where({\"id\": $Id}).Columns(\"id,question,params->notifications\").Row()\n question = params[\"question\"]\n var c_notifications map\n c_notifications = DBFind(\"@1notifications\").Where({\"page_params->question\": question, \"page_params->id\": $Id, \"ecosystem\": $ecosystem_id}).Columns(\"id\")\n var rid_array grp_array array\n rid_array = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).One(\"au_roles\"))\n grp_array = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).One(\"au_groups\"))\n if rid_array[0] == 0 && grp_array[0] == 0 && params[\"params.notifications\"] == \"true\" {\n var i int\n while i < Len(c_notifications) {\n var notific map\n notific = c_notifications[i]\n @1NotificationsClose(\"NotificId\", Int(notific[\"id\"]))\n i = i + 1\n }\n }\n }\n if $Operation == \"D\" {\n q[\"init\"] = $key_id\n q[\"status\"] = 3\n q[\"deleted\"] = 1\n q[\"lastmodified\"] = $block_time\n DBUpdate(\"@1q_list\", $Id, q)\n var question string\n var params map\n params = DBFind(\"@1q_list\").Where({\"id\": $Id}).Columns(\"id,question,params->notifications\").Row()\n question = params[\"question\"]\n var c_notifications map\n c_notifications = DBFind(\"@1notifications\").Where({\"page_params->question\": question, \"page_params->id\": $Id, \"ecosystem\": $ecosystem_id}).Columns(\"id\")\n var rid_array grp_array array\n rid_array = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).One(\"au_roles\"))\n grp_array = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).One(\"au_groups\"))\n if rid_array[0] == 0 && grp_array[0] == 0 && params[\"params.notifications\"] == \"true\" {\n var i int\n while i < Len(c_notifications) {\n var notific map\n notific = c_notifications[i]\n @1NotificationsClose(\"NotificId\", Int(notific[\"id\"]))\n i = i + 1\n }\n }\n }\n }\n}", + "Value": "contract QOperations {\n data {\n Id int \"optional\"\n Operation string\n Description string \"optional\"\n Question string \"optional\"\n Answer string \"optional\"\n Notifications bool \"optional\"\n Hide bool \"optional\"\n Change bool \"optional\"\n AuGroups int \"optional\"\n AuRoles int \"optional\"\n EndDate string \"optional\"\n EndTime string \"optional\"\n }\n\n func trimZeroTime(s string) string {\n if Contains(s, \"T00:00:00Z\") {\n s = Replace(s, \"T00:00:00Z\", \"\")\n }\n return s\n }\n\n func dateAddTime(d, t string) string {\n var dt string\n if Size(t) == 5 {\n dt = Sprintf(\"%v %v:00\", trimZeroTime(d), t)\n }\n return dt\n }\n\n func expToTimestamp() {\n $ext_string = dateAddTime($EndDate, $EndTime)\n if $block_time > UnixDateTime($ext_string) {\n warning LangRes(\"@1ending_date_invalid\", \"en\")\n }\n }\n\n conditions {\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Questionnaire\"}).One(\"id\")\n var admin_ids string\n admin_ids = AppParam(Int($app), \"q_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+admin_ids+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n if $Operation == \"GA\" {\n $groups = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).One(\"au_groups\"))\n var i int\n i = 0\n while i < Len($groups) {\n if $groups[i] == $AuRoles {\n warning LangRes(\"@1q_error_groups\", \"en\")\n }\n i = i + 1\n }\n }\n if $Operation == \"RA\" {\n $roles = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).One(\"au_roles\"))\n var i int\n i = 0\n while i < Len($roles) {\n if $roles[i] == $AuRoles {\n warning LangRes(\"@1q_error_roles\", \"en\")\n }\n i = i + 1\n }\n }\n if $Operation == \"AA\" {\n if $Answer == \"\" {\n warning LangRes(\"@1q_error_blank\", \"en\")\n }\n }\n if $Operation == \"C\" {\n if $Description == \"\" {\n warning LangRes(\"@1q_error_blank\", \"en\")\n }\n if $Question == \"\" {\n warning LangRes(\"@1q_error_blank\", \"en\")\n }\n expToTimestamp()\n if $block_time > UnixDateTime($ext_string) {\n warning LangRes(\"@1q_error_expdate\", \"en\")\n }\n }\n }\n\n action {\n var q map audience audience_new array\n //notifications when start and changing status\n if $Operation == \"C\" {\n var decision array\n decision = JSONDecode(DBFind(\"@1buffer_data\").Where({\"key\": \"q_answers\", \"account\": $account_id, \"ecosystem\": $ecosystem_id}).One(\"value\"))\n var params map\n params[\"notifications\"] = $Notifications\n params[\"hide\"] = $Hide\n params[\"change\"] = $Change\n q[\"question\"] = $Question\n q[\"description\"] = $Description\n q[\"answer\"] = JSONEncode(decision)\n q[\"ecosystem\"] = $ecosystem_id\n q[\"deleted\"] = 0\n q[\"init\"] = $account_id\n q[\"status\"] = 0\n q[\"au_roles\"] = \"[0]\"\n q[\"au_groups\"] = \"[0]\"\n q[\"created_at\"] = $block_time\n q[\"params\"] = JSONEncode(params)\n q[\"lastmodified\"] = $block_time\n q[\"expired\"] = UnixDateTime($ext_string)\n DBInsert(\"@1q_list\", q)\n }\n if $Operation == \"E\" {\n q[\"description\"] = $Description\n q[\"question\"] = $Question\n q[\"ecosystem\"] = $ecosystem_id\n q[\"init\"] = $account_id\n q[\"lastmodified\"] = $block_time\n DBUpdate(\"@1q_list\", $Id, q)\n }\n if $Operation == \"AA\" {\n if $Id == 0 {\n if !DBFind(\"@1buffer_data\").Where({\"key\": \"q_answers\", \"account\": $account_id, \"ecosystem\": $ecosystem_id}).One(\"value\") {\n var decision array\n decision = Append(decision, Str($Answer))\n q[\"value\"] = JSONEncode(decision)\n q[\"account\"] = $account_id\n q[\"key\"] = \"q_answers\"\n q[\"ecosystem\"] = $ecosystem_id\n DBInsert(\"@1buffer_data\", q)\n } else {\n var decision array\n $id_upd = Int(DBFind(\"@1buffer_data\").Where({\"key\": \"q_answers\", \"account\": $account_id, \"ecosystem\": $ecosystem_id}).One(\"id\"))\n decision = JSONDecode(DBFind(\"@1buffer_data\").Where({\"key\": \"q_answers\", \"account\": $account_id, \"ecosystem\": $ecosystem_id}).One(\"value\"))\n decision = Append(decision, Str($Answer))\n q[\"value\"] = JSONEncode(decision)\n DBUpdate(\"@1buffer_data\", $id_upd, q)\n }\n } else {\n var decision array\n decision = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).One(\"answer\"))\n decision = Append(decision, Str($Answer))\n q[\"answer\"] = JSONEncode(decision)\n DBUpdate(\"@1q_list\", $Id, q)\n }\n }\n if $Operation == \"AD\" {\n if $Id == 0 {\n var decision decision_new array\n decision = JSONDecode(DBFind(\"@1buffer_data\").Where({\"key\": \"q_answers\", \"account\": $account_id}).One(\"value\"))\n $id_upd = Int(DBFind(\"@1buffer_data\").Where({\"key\": \"q_answers\", \"account\": $account_id}).One(\"id\"))\n var i int\n while i < Len(decision) {\n if decision[i] != Str($Answer) {\n decision_new = Append(decision_new, decision[i])\n }\n i = i + 1\n }\n q[\"value\"] = JSONEncode(decision_new)\n DBUpdate(\"@1buffer_data\", $id_upd, q)\n } else {\n var decision decision_new array\n decision = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).One(\"answer\"))\n var i int\n while i < Len(decision) {\n if decision[i] != Str($Answer) {\n decision_new = Append(decision_new, decision[i])\n }\n i = i + 1\n }\n q[\"answer\"] = JSONEncode(decision_new)\n DBUpdate(\"@1q_list\", $Id, q)\n }\n }\n if $Operation == \"RA\" {\n audience = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).One(\"au_roles\"))\n if audience[0]==0 {\n audience[0] = $AuRoles\n } else {\n audience = Append(audience, $AuRoles)\n }\n q[\"au_roles\"] = JSONEncode(audience)\n DBUpdate(\"@1q_list\", $Id, q)\n }\n if $Operation == \"GA\" {\n audience = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).One(\"au_groups\"))\n if audience[0]==0 {\n audience[0] = $AuGroups\n } else {\n audience = Append(audience, $AuGroups)\n }\n q[\"au_groups\"] = JSONEncode(audience)\n DBUpdate(\"@1q_list\", $Id, q)\n }\n if $Operation == \"RD\" {\n audience = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).One(\"au_roles\"))\n var i int\n if audience[0]==$AuRoles && Len(audience)<2 {\n audience[0] = 0\n q[\"au_roles\"] = JSONEncode(audience)\n } else {\n while i < Len(audience) {\n if audience[i] != $AuRoles {\n audience_new = Append(audience_new, audience[i])\n }\n i = i + 1\n }\n q[\"au_roles\"] = JSONEncode(audience_new)\n }\n DBUpdate(\"@1q_list\", $Id, q)\n }\n if $Operation == \"GD\" {\n audience = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).One(\"au_groups\"))\n var i int\n if audience[0]==$AuGroups && Len(audience)<2 {\n audience[0] = 0\n q[\"au_groups\"] = JSONEncode(audience)\n } else {\n while i < Len(audience) {\n if audience[i] != $AuRoles {\n audience_new = Append(audience_new, audience[i])\n }\n i = i + 1\n }\n q[\"au_groups\"] = JSONEncode(audience)\n }\n DBUpdate(\"@1q_list\", $Id, q)\n }\n if $Operation == \"T\" {\n q[\"init\"] = $account_id\n q[\"status\"] = 1\n q[\"lastmodified\"] = $block_time\n DBUpdate(\"@1q_list\", $Id, q)\n var params map\n params = DBFind(\"@1q_list\").Where({\"id\": $Id}).Columns(\"id,question,params->notifications\").Row()\n var rid_array grp_array array\n rid_array = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).One(\"au_roles\"))\n grp_array = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).One(\"au_groups\"))\n if rid_array[0] == 0 && grp_array[0] == 0 && params[\"params.notifications\"] == \"true\" {\n var participants array\n participants = DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"deleted\": 0}).Columns(\"account\")\n var i int\n while i < Len(participants) {\n var participant map\n participant = participants[i]\n @1NotificationsSend(\"MemberAccount,Sender,Icon,Header,Body,Page,Params,Rid,Closure\", participant[\"account\"], 1, \"fa fa-question-circle\", LangRes(\"@1q_new_question\", \"en\"), params[\"question\"], \"@1q_question\", params, 0, 0)\n i = i + 1\n }\n }\n }\n if $Operation == \"Z\" {\n q[\"init\"] = $account_id\n q[\"status\"] = 3\n q[\"lastmodified\"] = $block_time\n DBUpdate(\"@1q_list\", $Id, q)\n var question string\n var params map\n params = DBFind(\"@1q_list\").Where({\"id\": $Id}).Columns(\"id,question,params->notifications\").Row()\n question = params[\"question\"]\n var c_notifications map\n c_notifications = DBFind(\"@1notifications\").Where({\"page_params->question\": question, \"page_params->id\": $Id, \"ecosystem\": $ecosystem_id}).Columns(\"id\")\n var rid_array grp_array array\n rid_array = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).One(\"au_roles\"))\n grp_array = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).One(\"au_groups\"))\n if rid_array[0] == 0 && grp_array[0] == 0 && params[\"params.notifications\"] == \"true\" {\n var i int\n while i < Len(c_notifications) {\n var notific map\n notific = c_notifications[i]\n @1NotificationsClose(\"NotificId\", Int(notific[\"id\"]))\n i = i + 1\n }\n }\n }\n if $Operation == \"D\" {\n q[\"init\"] = $account_id\n q[\"status\"] = 3\n q[\"deleted\"] = 1\n q[\"lastmodified\"] = $block_time\n DBUpdate(\"@1q_list\", $Id, q)\n var question string\n var params map\n params = DBFind(\"@1q_list\").Where({\"id\": $Id}).Columns(\"id,question,params->notifications\").Row()\n question = params[\"question\"]\n var c_notifications map\n c_notifications = DBFind(\"@1notifications\").Where({\"page_params->question\": question, \"page_params->id\": $Id, \"ecosystem\": $ecosystem_id}).Columns(\"id\")\n var rid_array grp_array array\n rid_array = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).One(\"au_roles\"))\n grp_array = JSONDecode(DBFind(\"@1q_list\").Where({\"id\": $Id}).One(\"au_groups\"))\n if rid_array[0] == 0 && grp_array[0] == 0 && params[\"params.notifications\"] == \"true\" {\n var i int\n while i < Len(c_notifications) {\n var notific map\n notific = c_notifications[i]\n @1NotificationsClose(\"NotificId\", Int(notific[\"id\"]))\n i = i + 1\n }\n }\n }\n }\n}", "Type": "contracts" }, { diff --git a/platform_apps/questionnaire/blocks/q_profile.ptl b/platform_apps/questionnaire/blocks/q_profile.ptl index 32ac1a64d..a350efcd5 100644 --- a/platform_apps/questionnaire/blocks/q_profile.ptl +++ b/platform_apps/questionnaire/blocks/q_profile.ptl @@ -1,12 +1,12 @@ SetVar(this_page, @1q_profile) -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Questionnaire"}).Vars(application) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Questionnaire"}).Vars(application) SetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: q_admin_role)) -DBFind("@1roles_participants").Where({"ecosystem": #ecosystem_id#, "$and": ["role->id": {"$in": [#admin_roles#]}, "role->id": #role_id#], "member->member_id": #key_id#, "deleted": 0}).Vars(admin_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#admin_roles#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) If(#admin_access_id# > 0){ SetVar(permission, 1) } -DBFind(@1q_list,src_q).Where({"ecosystem": #ecosystem_id#, "deleted": 0, "status": 1}).Order({"created_at": 1}).Limit(5).Columns("id,question,description,answer,ecosystem,init,lastmodified,created_at,expired,status,params->hide,params->change,au_groups,au_roles").Custom(custom_name){ +DBFind("@1q_list", src_q).Where({"ecosystem": "#ecosystem_id#", "deleted": 0, "status": 1}).Order({"created_at": 1}).Limit(5).Columns("id,question,description,answer,ecosystem,init,lastmodified,created_at,expired,status,params->hide,params->change,au_groups,au_roles").Custom(custom_name){ If(#permission#==1){ LinkPage(Class: h5 text-bold, Page: @1q_question, PageParams: "q_id=#id#"){ Div(Class: text-primary text-left){ @@ -22,8 +22,8 @@ DBFind(@1q_list,src_q).Where({"ecosystem": #ecosystem_id#, "deleted": 0, "status } } }.Else{ - DBFind(@1groups_participants).Where({"member->member_id": #key_id#, "deleted": 0, "ecosystem": #ecosystem_id#, "groups_info->id": {"$in": [0]]}}).Count(gp) - DBFind(@1roles_participants).Where({"member->member_id": #key_id#, "deleted": 0, "ecosystem": #ecosystem_id#, "role->id": {"$in": [0]]}}).Count(rl) + DBFind("@1groups_participants").Where({"member->account": "#account_id#", "deleted": 0, "ecosystem": "#ecosystem_id#", "groups_info->id": {"$in": [0]}}).Count(gp) + DBFind("@1roles_participants").Where({"member->account": "#account_id#", "deleted": 0, "ecosystem": "#ecosystem_id#", "role->id": {"$in": [0]}}).Count(rl) If(Or(#gp#>0,#rl#>0)){ LinkPage(Class: h5 text-bold, Page: @1q_question, PageParams: "q_id=#id#"){ Div(Class: text-primary text-left){ @@ -43,11 +43,12 @@ DBFind(@1q_list,src_q).Where({"ecosystem": #ecosystem_id#, "deleted": 0, "status } } }.Custom(initiator){ - DBFind(@1members).Where({"ecosystem": #ecosystem#, id: #init#}).Vars(m) - If(Or(#m_id#>0,#m_id#<0)){ + SetVar(m_account,) + DBFind("@1members").Where({"ecosystem": "#ecosystem#", "account": "#init#"}).Vars(m) + If(#m_account#){ SetVar(member_name, #m_member_name#) }.Else{ - SetVar(member_name, Address(#id#)) + SetVar(member_name, #init#) } Span(#member_name#) }.Custom(stats){ diff --git a/platform_apps/questionnaire/contracts/QAnswer.sim b/platform_apps/questionnaire/contracts/QAnswer.sim index 1ce5240c2..2cf03b6c4 100644 --- a/platform_apps/questionnaire/contracts/QAnswer.sim +++ b/platform_apps/questionnaire/contracts/QAnswer.sim @@ -23,14 +23,14 @@ contract QAnswer { if $question["au_roles"] != "[0]" { var au_roles array au_roles = JSONDecode($question["au_roles"]) - if !DBFind("@1roles_participants").Where({"member->member_id": $key_id, "deleted": 0, "ecosystem": $ecosystem_id, "role->id": {"$in": au_roles}}) { + if !DBFind("@1roles_participants").Where({"member->account": $account_id, "deleted": 0, "ecosystem": $ecosystem_id, "role->id": {"$in": au_roles}}) { warning LangRes("@1q_error_cannot", "en") } } if $question["au_groups"] != "[0]" { var au_groups array au_groups = JSONDecode($question["au_groups"]) - if !DBFind("@1groups_participants").Where({"member->member_id": $key_id, "deleted": 0, "ecosystem": $ecosystem_id," groups_info->id": {"$in": au_groups}}) { + if !DBFind("@1groups_participants").Where({"member->account": $account_id, "deleted": 0, "ecosystem": $ecosystem_id," groups_info->id": {"$in": au_groups}}) { warning LangRes("@1q_error_cannot", "en") } } @@ -38,7 +38,7 @@ contract QAnswer { action { var notes array i int note map - notes = DBFind("@1notifications").Where({"ecosystem": $ecosystem_id, "recipient->member_id": $key_id, "page_name": "@1q_question", "page_params->id": $QuestionId, "closed": 0}).Columns("id") + notes = DBFind("@1notifications").Where({"ecosystem": $ecosystem_id, "recipient->account": $account_id, "page_name": "@1q_question", "page_params->id": $QuestionId, "closed": 0}).Columns("id") while i < Len(notes) { note = notes[i] @1NotificationsClose("NotificId", Int(note["id"])) @@ -52,7 +52,7 @@ contract QAnswer { m["lastmodified"] = $block_time DBUpdate("@1q_list", $QuestionId, m) } else { - m["member"] = $key_id + m["member"] = $account_id m["decision"] = $Decision m["answer_id"] = $AnswerId m["ecosystem"] = $ecosystem_id diff --git a/platform_apps/questionnaire/contracts/QOperations.sim b/platform_apps/questionnaire/contracts/QOperations.sim index c47254576..06d8839d1 100644 --- a/platform_apps/questionnaire/contracts/QOperations.sim +++ b/platform_apps/questionnaire/contracts/QOperations.sim @@ -1,17 +1,17 @@ contract QOperations { data { Id int "optional" - Description string - Question string - Answer string Operation string + Description string "optional" + Question string "optional" + Answer string "optional" Notifications bool "optional" Hide bool "optional" Change bool "optional" AuGroups int "optional" AuRoles int "optional" - EndDate string - EndTime string + EndDate string "optional" + EndTime string "optional" } func trimZeroTime(s string) string { @@ -42,12 +42,12 @@ contract QOperations { admin_ids = AppParam(Int($app), "q_admin_role", $ecosystem_id) var rids array rids = JSONDecode("["+admin_ids+"]") - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() { warning LangRes("@1access_denied", "en") } if $Operation == "GA" { - $groups = JSONDecode(DBFind("@1q_list").Where({"id": $Id}).Columns("au_groups").One("au_groups")) + $groups = JSONDecode(DBFind("@1q_list").Where({"id": $Id}).One("au_groups")) var i int i = 0 while i < Len($groups) { @@ -58,7 +58,7 @@ contract QOperations { } } if $Operation == "RA" { - $roles = JSONDecode(DBFind("@1q_list").Where({"id": $Id}).Columns("au_roles").One("au_roles")) + $roles = JSONDecode(DBFind("@1q_list").Where({"id": $Id}).One("au_roles")) var i int i = 0 while i < Len($roles) { @@ -92,7 +92,7 @@ contract QOperations { //notifications when start and changing status if $Operation == "C" { var decision array - decision = JSONDecode(DBFind("@1buffer_data").Where({"key": "q_answers", "member_id": $key_id, "ecosystem": $ecosystem_id}).One("value")) + decision = JSONDecode(DBFind("@1buffer_data").Where({"key": "q_answers", "account": $account_id, "ecosystem": $ecosystem_id}).One("value")) var params map params["notifications"] = $Notifications params["hide"] = $Hide @@ -102,7 +102,7 @@ contract QOperations { q["answer"] = JSONEncode(decision) q["ecosystem"] = $ecosystem_id q["deleted"] = 0 - q["init"] = $key_id + q["init"] = $account_id q["status"] = 0 q["au_roles"] = "[0]" q["au_groups"] = "[0]" @@ -116,31 +116,31 @@ contract QOperations { q["description"] = $Description q["question"] = $Question q["ecosystem"] = $ecosystem_id - q["init"] = $key_id + q["init"] = $account_id q["lastmodified"] = $block_time DBUpdate("@1q_list", $Id, q) } if $Operation == "AA" { if $Id == 0 { - if !DBFind("@1buffer_data").Where({"key": "q_answers", "member_id": $key_id, "ecosystem": $ecosystem_id}).One("value") { + if !DBFind("@1buffer_data").Where({"key": "q_answers", "account": $account_id, "ecosystem": $ecosystem_id}).One("value") { var decision array decision = Append(decision, Str($Answer)) q["value"] = JSONEncode(decision) - q["member_id"] = $key_id + q["account"] = $account_id q["key"] = "q_answers" q["ecosystem"] = $ecosystem_id DBInsert("@1buffer_data", q) } else { var decision array - $id_upd = Int(DBFind("@1buffer_data").Where({"key": "q_answers", "member_id": $key_id, "ecosystem": $ecosystem_id}).One("id")) - decision = JSONDecode(DBFind("@1buffer_data").Where({"key": "q_answers", "member_id": $key_id, "ecosystem": $ecosystem_id}).One("value")) + $id_upd = Int(DBFind("@1buffer_data").Where({"key": "q_answers", "account": $account_id, "ecosystem": $ecosystem_id}).One("id")) + decision = JSONDecode(DBFind("@1buffer_data").Where({"key": "q_answers", "account": $account_id, "ecosystem": $ecosystem_id}).One("value")) decision = Append(decision, Str($Answer)) q["value"] = JSONEncode(decision) DBUpdate("@1buffer_data", $id_upd, q) } } else { var decision array - decision = JSONDecode(DBFind("@1q_list").Columns("answer").Where({"id": $Id, "ecosystem": $ecosystem_id}).One("answer")) + decision = JSONDecode(DBFind("@1q_list").Where({"id": $Id, "ecosystem": $ecosystem_id}).One("answer")) decision = Append(decision, Str($Answer)) q["answer"] = JSONEncode(decision) DBUpdate("@1q_list", $Id, q) @@ -149,8 +149,8 @@ contract QOperations { if $Operation == "AD" { if $Id == 0 { var decision decision_new array - decision = JSONDecode(DBFind("@1buffer_data").Where({"key": "q_answers", "member_id": $key_id}).One("value")) - $id_upd = Int(DBFind("@1buffer_data").Where({"key": "q_answers", "member_id": $key_id}).One("id")) + decision = JSONDecode(DBFind("@1buffer_data").Where({"key": "q_answers", "account": $account_id}).One("value")) + $id_upd = Int(DBFind("@1buffer_data").Where({"key": "q_answers", "account": $account_id}).One("id")) var i int while i < Len(decision) { if decision[i] != Str($Answer) { @@ -162,7 +162,7 @@ contract QOperations { DBUpdate("@1buffer_data", $id_upd, q) } else { var decision decision_new array - decision = JSONDecode(DBFind("@1q_list").Columns("answer").Where({"id": $Id, "ecosystem": $ecosystem_id}).One("answer")) + decision = JSONDecode(DBFind("@1q_list").Where({"id": $Id, "ecosystem": $ecosystem_id}).One("answer")) var i int while i < Len(decision) { if decision[i] != Str($Answer) { @@ -175,7 +175,7 @@ contract QOperations { } } if $Operation == "RA" { - audience = JSONDecode(DBFind("@1q_list").Where({"id": $Id}).Columns("au_roles").One("au_roles")) + audience = JSONDecode(DBFind("@1q_list").Where({"id": $Id}).One("au_roles")) if audience[0]==0 { audience[0] = $AuRoles } else { @@ -185,7 +185,7 @@ contract QOperations { DBUpdate("@1q_list", $Id, q) } if $Operation == "GA" { - audience = JSONDecode(DBFind("@1q_list").Where({"id": $Id}).Columns("au_groups").One("au_groups")) + audience = JSONDecode(DBFind("@1q_list").Where({"id": $Id}).One("au_groups")) if audience[0]==0 { audience[0] = $AuGroups } else { @@ -195,7 +195,7 @@ contract QOperations { DBUpdate("@1q_list", $Id, q) } if $Operation == "RD" { - audience = JSONDecode(DBFind("@1q_list").Where({"id": $Id}).Columns("au_roles").One("au_roles")) + audience = JSONDecode(DBFind("@1q_list").Where({"id": $Id}).One("au_roles")) var i int if audience[0]==$AuRoles && Len(audience)<2 { audience[0] = 0 @@ -212,7 +212,7 @@ contract QOperations { DBUpdate("@1q_list", $Id, q) } if $Operation == "GD" { - audience = JSONDecode(DBFind("@1q_list").Where({"id": $Id}).Columns("au_groups").One("au_groups")) + audience = JSONDecode(DBFind("@1q_list").Where({"id": $Id}).One("au_groups")) var i int if audience[0]==$AuGroups && Len(audience)<2 { audience[0] = 0 @@ -229,7 +229,7 @@ contract QOperations { DBUpdate("@1q_list", $Id, q) } if $Operation == "T" { - q["init"] = $key_id + q["init"] = $account_id q["status"] = 1 q["lastmodified"] = $block_time DBUpdate("@1q_list", $Id, q) @@ -240,18 +240,18 @@ contract QOperations { grp_array = JSONDecode(DBFind("@1q_list").Where({"id": $Id}).One("au_groups")) if rid_array[0] == 0 && grp_array[0] == 0 && params["params.notifications"] == "true" { var participants array - participants = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "deleted": 0}).Columns("id") + participants = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "deleted": 0}).Columns("account") var i int while i < Len(participants) { var participant map participant = participants[i] - @1NotificationsSend("MemberId,Sender,Icon,Header,Body,Page,Params,Rid,Closure", Int(participant["id"]), 1, "fa fa-question-circle", LangRes("@1q_new_question", "en"), params["question"], "@1q_question", params, 0, 0) + @1NotificationsSend("MemberAccount,Sender,Icon,Header,Body,Page,Params,Rid,Closure", participant["account"], 1, "fa fa-question-circle", LangRes("@1q_new_question", "en"), params["question"], "@1q_question", params, 0, 0) i = i + 1 } } } if $Operation == "Z" { - q["init"] = $key_id + q["init"] = $account_id q["status"] = 3 q["lastmodified"] = $block_time DBUpdate("@1q_list", $Id, q) @@ -275,7 +275,7 @@ contract QOperations { } } if $Operation == "D" { - q["init"] = $key_id + q["init"] = $account_id q["status"] = 3 q["deleted"] = 1 q["lastmodified"] = $block_time diff --git a/platform_apps/questionnaire/pages/q_listing.ptl b/platform_apps/questionnaire/pages/q_listing.ptl index 611d77672..1682ab2c6 100644 --- a/platform_apps/questionnaire/pages/q_listing.ptl +++ b/platform_apps/questionnaire/pages/q_listing.ptl @@ -2,9 +2,9 @@ SetVar(this_page, @1q_listing).(this_table, @1q_list) Include(@1pager_header) SetTitle($@1q_poll$) -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Questionnaire"}).Vars(application) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Questionnaire"}).Vars(application) SetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: q_admin_role)) -DBFind("@1roles_participants").Where({"ecosystem": #ecosystem_id#, "$and": ["role->id": {"$in": [#admin_roles#]}, "role->id": #role_id#], "member->member_id": #key_id#, "deleted": 0}).Vars(admin_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#admin_roles#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) If(#admin_access_id# > 0){ SetVar(permission,1) } @@ -13,9 +13,9 @@ If(#permission#==1){ } If(#search#){ - SetVar(where, {"ecosystem": #ecosystem_id#, "deleted": 0, {"$or": [{"question": {"$ilike": "#search#"}}]}}) + SetVar(where, {"ecosystem": "#ecosystem_id#", "deleted": 0, "question": {"$ilike": "#search#"}}) }.Else{ - SetVar(where, {"ecosystem": #ecosystem_id#, "deleted": 0}) + SetVar(where, {"ecosystem": "#ecosystem_id#", "deleted": 0}) } Div(list-group-item ml-lg mr-lg pt-lg){ @@ -23,7 +23,7 @@ Div(list-group-item ml-lg mr-lg pt-lg){ Include(@1search) } -DBFind(#this_table#,src_q).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Columns("id,question,description,answer,ecosystem,init,lastmodified,created_at,expired,status,params->hide,params->change,au_groups,au_roles").Custom(custom_name){ +DBFind(#this_table#, src_q).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Columns("id,question,description,answer,ecosystem,init,lastmodified,created_at,expired,status,params->hide,params->change,au_groups,au_roles").Custom(custom_name){ If(#permission#==1){ LinkPage(Class: #style_link# h5 text-bold, Page: @1q_question, PageParams: "q_id=#id#"){ Div(Class: text-primary){ @@ -39,8 +39,8 @@ DBFind(#this_table#,src_q).Where(#where#).Order({"id": 1}).Limit(#pager_limit#). } } }.Else{ - DBFind(@1groups_participants).Where({"member->member_id": #key_id#, "deleted": 0, "ecosystem": #ecosystem_id#, "groups_info->id": {"$in": #au_groups#}}).Count(gp) - DBFind(@1roles_participants).Where({"member->member_id": #key_id#, "deleted": 0, "ecosystem": #ecosystem_id#, "role->id": {"$in": #au_roles#}}).Count(rl) + DBFind("@1groups_participants").Where({"member->account": "#account_id#", "deleted": 0, "ecosystem": "#ecosystem_id#", "groups_info->id": {"$in": #au_groups#}}).Count(gp) + DBFind("@1roles_participants").Where({"member->account": "#account_id#", "deleted": 0, "ecosystem": "#ecosystem_id#", "role->id": {"$in": #au_roles#}}).Count(rl) If(And(#gp#>0,#rl#>0)){ LinkPage(Class: #style_link# h5 text-bold, Page: @1q_question, PageParams: "q_id=#id#"){ Div(Class: text-primary){ @@ -72,11 +72,12 @@ DBFind(#this_table#,src_q).Where(#where#).Order({"id": 1}).Limit(#pager_limit#). P(Class:h6 m0, Body: DateTime(#created_at#,HH:MI DD.MM.YYYY)) P(Class:h6 m0, Body: DateTime(#expired#,HH:MI DD.MM.YYYY)) }.Custom(initiator){ - DBFind(@1members).Where({"ecosystem": #ecosystem#, "id":#init#}).Vars(m) - If(Or(#m_id#>0,#m_id#<0)){ + SetVar(m_account,) + DBFind("@1members").Where({"ecosystem": "#ecosystem#", "account": "#init#"}).Vars(m) + If(#m_account#){ SetVar(member_name, #m_member_name#) }.Else{ - SetVar(member_name, Address(#id#)) + SetVar(member_name, #init#) } Span(#member_name#) }.Custom(hidden){ @@ -97,7 +98,7 @@ DBFind(#this_table#,src_q).Where(#where#).Order({"id": 1}).Limit(#pager_limit#). If(#status#==0){ LinkPage(Body: Em(Class: fa fa-edit), Class: btn btn-link, Page: @1q_question_edit, PageParams: "q_id=#id#") } - DBFind(@1q_answers).Where({"question_id": #id#}).Count(answers) + DBFind("@1q_answers").Where({"question_id": "#id#"}).Count(answers) If(#answers#>0){ Button(Body: Em(Class: fa fa-bars), Class: btn btn-link, Page: @1q_question_log, PageParams: "q_id=#id#").Popup(Header: #question#, Width: "50") } diff --git a/platform_apps/questionnaire/pages/q_question.ptl b/platform_apps/questionnaire/pages/q_question.ptl index 929ecacd6..d112e0c96 100644 --- a/platform_apps/questionnaire/pages/q_question.ptl +++ b/platform_apps/questionnaire/pages/q_question.ptl @@ -1,15 +1,15 @@ If(#notific_id#>0){ - DBFind(@1notifications).Where({id:#notific_id#}).Columns("page_params->id").Vars(prefix) + DBFind("@1notifications").Where({"id": "#notific_id#"}).Columns("page_params->id").Vars(prefix) SetVar(q_id,#prefix_page_params_id#) } -DBFind(@1q_list).Where({"id": #q_id#}).Columns("id,question,description,answer,ecosystem,init,lastmodified,created_at,expired,status,params->hide,params->change").Vars(question) -DBFind(@1q_answers).Where({"question_id": #question_id#}).Count(answers) -DBFind(@1q_answers).Where({"question_id": #question_id#, member:#key_id#}).Vars(your_answer).Count(a) -DBFind(@1members).Where({"ecosystem": #question_ecosystem#}).Count(total) +DBFind("@1q_list").Where({"id": "#q_id#"}).Columns("id,question,description,answer,ecosystem,init,lastmodified,created_at,expired,status,params->hide,params->change").Vars(question) +DBFind("@1q_answers").Where({"question_id": "#question_id#"}).Count(answers) +DBFind("@1q_answers").Where({"question_id": "#question_id#", "member": "#account_id#"}).Vars(your_answer).Count(a) +DBFind("@1members").Where({"ecosystem": "#question_ecosystem#"}).Count(total) -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Questionnaire"}).Vars(application) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Questionnaire"}).Vars(application) SetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: q_admin_role)) -DBFind("@1roles_participants").Where({"ecosystem": #ecosystem_id#, "$and": ["role->id": {"$in": [#admin_roles#]}, "role->id": #role_id#], "member->member_id": #key_id#, "deleted": 0}).Vars(admin_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#admin_roles#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) If(#admin_access_id# > 0){ SetVar(permission,1) } diff --git a/platform_apps/questionnaire/pages/q_question_edit.ptl b/platform_apps/questionnaire/pages/q_question_edit.ptl index 543b11be5..61a7e2233 100644 --- a/platform_apps/questionnaire/pages/q_question_edit.ptl +++ b/platform_apps/questionnaire/pages/q_question_edit.ptl @@ -1,6 +1,6 @@ -DBFind(@1q_list).Where({"ecosystem": #ecosystem_id#, id:#q_id#}).Vars(question) -DBFind(@1roles,src_rid).Where({"ecosystem": #ecosystem_id#}).Count(r) -DBFind(@1groups,src_gp).Where({"ecosystem": #ecosystem_id#}).Count(g) +DBFind("@1q_list").Where({"ecosystem": "#ecosystem_id#", "id": "#q_id#"}).Vars(question) +DBFind("@1roles", src_rid).Where({"ecosystem": "#ecosystem_id#"}).Count(r) +DBFind("@1groups", src_gp).Where({"ecosystem": "#ecosystem_id#"}).Count(g) ArrayToSource(src, #question_answer#) @@ -53,7 +53,7 @@ Div(content-wrapper){ } ArrayToSource(au_g_src, #question_au_groups#) ForList(Source: au_g_src, Index: ind){ - DBFind(@1groups).Where({"id": #value#}).Vars(gn) + DBFind("@1groups").Where({"id": "#value#"}).Vars(gn) If(#editable#==1){ If(#value#==0){ Button(Body: #access#, Class: btn-xs bg-gray-lighter ml-sm) @@ -83,7 +83,7 @@ Div(content-wrapper){ } ArrayToSource(au_r_src, #question_au_roles#) ForList(Source: au_r_src, Index: ind){ - DBFind(@1roles).Where({"id": #value#}).Vars(rn) + DBFind("@1roles").Where({"id": "#value#"}).Vars(rn) If(#editable#==1){ If(#value#==0){ Button(Body: #access#, Class: btn-xs bg-gray-lighter ml-sm) diff --git a/platform_apps/questionnaire/pages/q_question_graph.ptl b/platform_apps/questionnaire/pages/q_question_graph.ptl index 4e0a7dab5..13d62baba 100644 --- a/platform_apps/questionnaire/pages/q_question_graph.ptl +++ b/platform_apps/questionnaire/pages/q_question_graph.ptl @@ -1,6 +1,6 @@ Form(){ - DBFind(@1q_list).Where({"id": #q_id#}).Columns("id,question,description,answer,ecosystem,init,lastmodified,created_at,expired,status,params->hide,params->change").Vars(question) - DBFind(@1q_answers).Where({"question_id": #question_id#}).Count(answers) + DBFind("@1q_list").Where({"id": "#q_id#"}).Columns("id,question,description,answer,ecosystem,init,lastmodified,created_at,expired,status,params->hide,params->change").Vars(question) + DBFind("@1q_answers").Where({"question_id": "#question_id#"}).Count(answers) Div(list-group-item){ Div(row){ Div(col-md-12 text-center){ @@ -73,8 +73,8 @@ Form(){ } Div(list-group-item text-center){ ArrayToSource(src, #question_answer#) - ForList(Source: src, Index:ind){ - DBFind(@1q_answers).Where({"question_id": #question_id#, "decision": #value#}).Count(a) + ForList(Source: src, Index: ind){ + DBFind("@1q_answers").Where({"question_id": "#question_id#", "decision": "#value#"}).Count(a) Span(){ Span(Class: h4 m0 text-primary, Body: #value#:#a#) }.Style(margin-right: 15px; margin-left: 15px;) diff --git a/platform_apps/questionnaire/pages/q_question_log.ptl b/platform_apps/questionnaire/pages/q_question_log.ptl index 3a34a3fb3..e88b3a45a 100644 --- a/platform_apps/questionnaire/pages/q_question_log.ptl +++ b/platform_apps/questionnaire/pages/q_question_log.ptl @@ -1,18 +1,18 @@ Form(){ SetVar(this_page, @1q_question_log).(this_table, @1q_answers) Include(@1pager_header) - DBFind(@1q_list).Where({"id": #q_id#}).Columns("id").Vars(q) + DBFind("@1q_list").Where({"id": "#q_id#"}).Columns("id").Vars(q) - If(#a_id#>0){ - SetVar(where, {"question_id": #q_id#, "answer_id": #a_id#}) + If(#a_id# > 0){ + SetVar(where, {"question_id": "#q_id#", "answer_id": "#a_id#"}) }.Else{ - SetVar(where, {"question_id": #q_id#}) + SetVar(where, {"question_id": "#q_id#"}) } - DBFind(@1q_answers,src_a).Where(#where#).Limit(#pager_limit#).Custom(ans){ + DBFind("@1q_answers", src_a).Where(#where#).Limit(#pager_limit#).Custom(ans){ #answer_id# : #decision# }.Custom(c_m){ - Address(#member#) + #member# }.Custom(time){ DateTime(#lastmodified#,HH:MI DD.MM.YYYY) }.Count(a) diff --git a/platform_apps/questionnaire/pages/q_question_new.ptl b/platform_apps/questionnaire/pages/q_question_new.ptl index df73e837f..02bf7658f 100644 --- a/platform_apps/questionnaire/pages/q_question_new.ptl +++ b/platform_apps/questionnaire/pages/q_question_new.ptl @@ -39,7 +39,7 @@ Form(){ Button(Class: btn bg-gray-lighter fa fa-plus mtl buttons, Page: @1q_question_new, Contract: @1QOperations, Params:"Id=#question_id#, Operation=AA").Popup(60, $@1message_type_here$) } } - DBFind(@1buffer_data).Where({"key": "q_answers", "member_id": #key_id#, "ecosystem": #ecosystem_id#}).Vars(ans) + DBFind("@1buffer_data").Where({"key": "q_answers", "account": "#account_id#", "ecosystem": "#ecosystem_id#"}).Vars(ans) ArrayToSource(src, #ans_value#) ForList(Source: src, Index: ind){ Button(Body: Span(Class: fa fa-remove) #value#, Class: btn-xs bg-gray-lighter mr-sm mb-sm, Page: @1q_question_new, Contract: @1QOperations, Params: "Id=#question_id#,Answer=#value#,Operation=AD").Popup(60, $@1message_type_here$) diff --git a/platform_apps/questionnaire/pages/q_settings.ptl b/platform_apps/questionnaire/pages/q_settings.ptl index ae769cb45..9a385426b 100644 --- a/platform_apps/questionnaire/pages/q_settings.ptl +++ b/platform_apps/questionnaire/pages/q_settings.ptl @@ -1,9 +1,9 @@ -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Questionnaire"}).Vars("app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Questionnaire"}).Vars(app) SetVar(this_page, "@1q_settings").(q_admin_role,0) SetVar(q_admin_role, AppParam(App: #app_id#, Name: "q_admin_role")) -DBFind("@1roles", src_roles).Where({"ecosystem": #ecosystem_id#, "deleted": 0}).Columns("role_name,id").Limit(100) +DBFind("@1roles", src_roles).Where({"ecosystem": "#ecosystem_id#", "deleted": 0}).Columns("role_name,id").Limit(100) SetVar(row,"row mt-sm").(col_left,"col-sm-4 text-right mt-sm").(col_right,"col-sm-8 text-left") @@ -29,7 +29,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#q_admin_role# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #q_admin_role#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#q_admin_role#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# diff --git a/platform_apps/questionnaire/tables/q_answers.json b/platform_apps/questionnaire/tables/q_answers.json index e5a5f8e63..ba8911e9f 100644 --- a/platform_apps/questionnaire/tables/q_answers.json +++ b/platform_apps/questionnaire/tables/q_answers.json @@ -1,32 +1,32 @@ [ { - "name":"answer_id", - "type":"number", - "conditions":"ContractAccess(\"@1QAnswer\")" + "name": "answer_id", + "type": "number", + "conditions": "ContractAccess(\"@1QAnswer\")" }, { - "name":"decision", - "type":"text", - "conditions":"ContractAccess(\"@1QAnswer\")" + "name": "decision", + "type": "text", + "conditions": "ContractAccess(\"@1QAnswer\")" }, { - "name":"ecosystem", - "type":"number", - "conditions":"ContractAccess(\"@1QAnswer\")" + "name": "ecosystem", + "type": "number", + "conditions": "ContractAccess(\"@1QAnswer\")" }, { - "name":"lastmodified", - "type":"number", - "conditions":"ContractAccess(\"@1QAnswer\")" + "name": "lastmodified", + "type": "number", + "conditions": "ContractAccess(\"@1QAnswer\")" }, { - "name":"member", - "type":"number", - "conditions":"ContractAccess(\"@1QAnswer\")" + "name": "member", + "type": "varchar", + "conditions": "ContractAccess(\"@1QAnswer\")" }, { - "name":"question_id", - "type":"number", - "conditions":"ContractAccess(\"@1QAnswer\")" + "name": "question_id", + "type": "number", + "conditions": "ContractAccess(\"@1QAnswer\")" } ] \ No newline at end of file diff --git a/platform_apps/questionnaire/tables/q_list.json b/platform_apps/questionnaire/tables/q_list.json index 4a46f7619..783458208 100644 --- a/platform_apps/questionnaire/tables/q_list.json +++ b/platform_apps/questionnaire/tables/q_list.json @@ -1,67 +1,67 @@ [ { - "name":"answer", - "type":"json", - "conditions":"ContractAccess(\"@1QOperations\")" + "name": "answer", + "type": "json", + "conditions": "ContractAccess(\"@1QOperations\")" }, { - "name":"au_groups", - "type":"json", - "conditions":"ContractAccess(\"@1QOperations\")" + "name": "au_groups", + "type": "json", + "conditions": "ContractAccess(\"@1QOperations\")" }, { - "name":"au_roles", - "type":"json", - "conditions":"ContractAccess(\"@1QOperations\")" + "name": "au_roles", + "type": "json", + "conditions": "ContractAccess(\"@1QOperations\")" }, { - "name":"created_at", - "type":"number", - "conditions":"false" + "name": "created_at", + "type": "number", + "conditions": "false" }, { - "name":"deleted", - "type":"number", - "conditions":"ContractAccess(\"@1QOperations\")" + "name": "deleted", + "type": "number", + "conditions": "ContractAccess(\"@1QOperations\")" }, { - "name":"description", - "type":"text", - "conditions":"ContractAccess(\"@1QOperations\")" + "name": "description", + "type": "text", + "conditions": "ContractAccess(\"@1QOperations\")" }, { - "name":"ecosystem", - "type":"number", - "conditions":"ContractAccess(\"@1QOperations\")" + "name": "ecosystem", + "type": "number", + "conditions": "ContractAccess(\"@1QOperations\")" }, { - "name":"expired", - "type":"number", - "conditions":"ContractAccess(\"@1QOperations\",\"@1QAnswer\")" + "name": "expired", + "type": "number", + "conditions": "ContractAccess(\"@1QOperations\",\"@1QAnswer\")" }, { - "name":"init", - "type":"number", - "conditions":"ContractAccess(\"@1QOperations\")" + "name": "init", + "type": "varchar", + "conditions": "ContractAccess(\"@1QOperations\")" }, { - "name":"lastmodified", - "type":"number", - "conditions":"ContractAccess(\"@1QOperations\",\"@1QAnswer\")" + "name": "lastmodified", + "type": "number", + "conditions": "ContractAccess(\"@1QOperations\",\"@1QAnswer\")" }, { - "name":"params", - "type":"json", - "conditions":"false" + "name": "params", + "type": "json", + "conditions": "false" }, { - "name":"question", - "type":"text", - "conditions":"ContractAccess(\"@1QOperations\")" + "name": "question", + "type": "text", + "conditions": "ContractAccess(\"@1QOperations\")" }, { - "name":"status", - "type":"number", - "conditions":"ContractAccess(\"@1QOperations\",\"@1QAnswer\")" + "name": "status", + "type": "number", + "conditions": "ContractAccess(\"@1QOperations\",\"@1QAnswer\")" } ] \ No newline at end of file diff --git a/platform_apps/ratings.json b/platform_apps/ratings.json index e7dcd8fc4..f756cb1a3 100644 --- a/platform_apps/ratings.json +++ b/platform_apps/ratings.json @@ -151,35 +151,35 @@ { "Name": "r_accruals", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1r_accruals).(this_table, @1r_accruals)\nInclude(@1pager_header)\n\nIf(#Id#!=\"\"){\n SetVar(member, Address(#Id#))\n}.Else{\n SetVar(member, Address(#key_id#))\n}\n\nSetVar(where, {\"member\": #member#, \"ecosystem\": #ecosystem_id#})\n\nSetTitle($@1r_accruals$ (#member#))\nSpan(Class: h5 m0 mb ml-lg){\n LinkPage(Class: ml-sm, Body: $@1r_rating$, Page: @1r_ratings)\n Span(/,text-muted mh)\n Span($@1r_accruals$, text-muted)\n}.Style(\n display: inline-block;\n)\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": -1}).Limit(#pager_limit#).Offset(#pager_offset#).Count(count).Custom(_type){\n SetVar(t_name,)\n DBFind(@1e_types).Where({\"ecosystem\": #ecosystem_id#, \"id\": #event_type#}).Columns(\"name\").Vars(t)\n Span(#t_name#,ml-sm text-muted)\n}.Custom(_created){\n DateTime(#created_at#, Format: YYYY-MM-DD HH:MI:SS)\n}.Custom(_manager){\n SetVar(manager_key_id, AddressToId(#manager#))\n LinkPage(Class: h5 text-primary, Page: @1profile_view, PageParams: \"v_key_id=#manager_key_id#\"){\n Div(){\n Span(Class: fa icon-user fa-2x mr).(#manager#)\n }.Style(display:flex; align-items:center;)\n }\n}\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1id$=id,$@1r_amount$=amount,$@1r_manager$=_manager,$@1r_created$=_created,$@1r_event_type$=_type,$@1r_event_id$=event_id\")\n }.Else{\n Div(text-center h4 text-muted){\n $@1r_accruals$ $@1not_founded$\n }\n }\n }.Style(\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, @1r_accruals).(this_table, @1r_accruals)\nInclude(@1pager_header)\n\nIf(#Account#){\n SetVar(member, #Account#)\n}.Else{\n SetVar(member, #account_id#)\n}\n\nSetTitle($@1r_accruals$ (#member#))\nSpan(Class: h5 m0 mb ml-lg){\n LinkPage(Class: ml-sm, Body: $@1r_rating$, Page: @1r_ratings)\n Span(/,text-muted mh)\n Span($@1r_accruals$, text-muted)\n}.Style(\n display: inline-block;\n)\n\nDBFind(#this_table#, src).Where({\"member\": \"#member#\", \"ecosystem\": \"#ecosystem_id#\"}).Order({\"id\": \"-1\"}).Limit(#pager_limit#).Offset(#pager_offset#).Count(count).Custom(_type){\n SetVar(t_name,)\n DBFind(\"@1e_types\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#event_type#\"}).Columns(\"name\").Vars(t)\n Span(#t_name#, ml-sm text-muted)\n}.Custom(_created){\n DateTime(#created_at#, Format: YYYY-MM-DD HH:MI:SS)\n}.Custom(_manager){\n LinkPage(Class: h5 text-primary, Page: @1profile_view, PageParams: \"v_account=#manager#\"){\n Div(){\n Span(Class: fa icon-user fa-2x mr).(#manager#)\n }.Style(display:flex; align-items:center;)\n }\n}\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1id$=id,$@1r_amount$=amount,$@1r_manager$=_manager,$@1r_created$=_created,$@1r_event_type$=_type,$@1r_event_id$=event_id\")\n }.Else{\n Div(text-center h4 text-muted){\n $@1r_accruals$ $@1not_founded$\n }\n }\n }.Style(\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "r_rating_group", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1r_rating_group).(back_page,@1r_ratings)\n\nDBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Ratings\"}).Vars(application)\nSetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: ratings_admin_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": #ecosystem_id#, \"$and\": [\"role->id\": {\"$in\": [#admin_roles#]}, \"role->id\": #role_id#], \"member->member_id\": #key_id#, \"deleted\": 0}).Vars(admin_access)\nIf(#admin_access_id# > 0){\n SetVar(isManager,1)\n}\n\nForm(){\n Div(mb-sm text-muted){\n $@1r_rating_group_description$\n }\n Div(mb-sm){\n Input(Name: Ratings, Type: textarea)\n }\n Div(){\n If(#isManager#==1){\n Button(Body: $@1save$, Class: btn btn-primary pull-right mt, Page: #back_page#, Contract: @1RUpdateGroup)\n }\n Button(Body: $@1back$, Class: btn btn-default pull-right mt, Page: #back_page#)\n }\n}", + "Value": "SetVar(this_page, @1r_rating_group).(back_page,@1r_ratings)\n\nDBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Ratings\"}).Vars(application)\nSetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: ratings_admin_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [\"role->id\": {\"$in\": [#admin_roles#]}, \"role->id\": #role_id#], \"member->account\": #account_id#, \"deleted\": 0}).Vars(admin_access)\nIf(#admin_access_id# > 0){\n SetVar(isManager,1)\n}\n\nForm(){\n Div(mb-sm text-muted){\n $@1r_rating_group_description$\n }\n Div(mb-sm){\n Input(Name: Ratings, Type: textarea)\n }\n Div(){\n If(#isManager#==1){\n Button(Body: $@1save$, Class: btn btn-primary pull-right mt, Page: #back_page#, Contract: @1RUpdateGroup)\n }\n Button(Body: $@1back$, Class: btn btn-default pull-right mt, Page: #back_page#)\n }\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "r_rating_member", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1r_rating_member).(back_page, @1r_ratings)\nDBFind(@1e_types, types).Where({\"ecosystem\": #ecosystem_id#}).Columns(\"id,name\")\n\nDBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Ratings\"}).Vars(application)\nSetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: ratings_admin_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": #ecosystem_id#, \"$and\": [\"role->id\": {\"$in\": [#admin_roles#]}, \"role->id\": #role_id#], \"member->member_id\": #key_id#, \"deleted\": 0}).Vars(admin_access)\nIf(#admin_access_id# > 0){\n SetVar(isManager,1)\n}\n\nForm(){\n If(#isManager#==1){\n Div(row){\n Div(col-sm-4 mt-sm text-bold text-right){\n Label(For:Member){\n $@1r_member$\n }\n }\n Div(col-sm-8 text-left){\n Div(input-group){\n If(#MemberId#!=\"\"){\n SetVar(Member, Address(#MemberId#))\n Input(Name: Member, Disabled: 1, Value: #Member#)\n }.Else{\n Input(Name: Member, Disabled: 1, Value: \"xxxx-xxxx-xxxx-xxxx-xxxx\")\n }\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:\"back_page=#this_page#,back_header=$@1send$,EcosystemId=#ecosystem_id#,Id=#Id#\").Popup(Header: $@1member$, Width: \"50\")\n }\n }\n }\n }\n If(#MemberId#!=\"\"){\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(For:Amount){\n $@1r_amount$\n }\n }\n Div(col-sm-8 text-left){\n Input(Name: Amount, Type: number)\n }\n }\n DBFind(@1e_events, events).Where({\"ecosystem\": #ecosystem_id#}).Limit(10).Order(\"created_at\").Columns(\"name,id\")\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(For:LastEvent){\n $@1r_last_events$\n }\n }\n Div(col-sm-8 mt-sm text-left){\n Input(Name: LastEvent, Type: \"checkbox\", Value: \"true\", Class: m0 ml-sm)\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(For:EventId){\n $@1r_event$\n }\n }\n Div(col-sm-8 text-left){\n Select(Name: EventId, Source: events, NameColumn: name, ValueColumn: id)\n }\n }.Hide(LastEvent=false)\n\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(For:EventType){\n $@1r_event_type$\n }\n }\n Div(col-sm-8 text-left){\n Select(Name: EventType, Source: types, NameColumn: name, ValueColumn: id)\n }\n }.Hide(LastEvent=true)\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(For:EventId){\n $@1r_event_id$\n }\n }\n Div(col-sm-8 text-left){\n Input(Name: EventId, Type: number)\n }\n }.Hide(LastEvent=true)\n Button(Body: $@1save$, Class: btn btn-primary pull-right mt, Page: #back_page#, Contract: @1RUpdate)\n }\n }\n Button(Body: $@1back$, Class: btn btn-default pull-right mt, Page: #back_page#)\n}.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n)", + "Value": "SetVar(this_page, @1r_rating_member).(back_page, @1r_ratings)\nDBFind(\"@1e_types\", types).Where({\"ecosystem\": \"#ecosystem_id#\"}).Columns(\"id,name\")\n\nDBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Ratings\"}).Vars(application)\nSetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: ratings_admin_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#admin_roles#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\nIf(#admin_access_id# > 0){\n SetVar(isManager,1)\n}\n\nForm(){\n If(#isManager# == 1){\n Div(row){\n Div(col-sm-4 mt-sm text-bold text-right){\n Label(For:Member){\n $@1r_member$\n }\n }\n Div(col-sm-8 text-left){\n Div(input-group){\n If(#MemberAccount#){\n Input(Name: Member, Disabled: 1, Value: #MemberAccount#)\n }.Else{\n Input(Name: Member, Disabled: 1, Value: \"xxxx-xxxx-xxxx-xxxx-xxxx\")\n }\n Div(input-group-btn){\n Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:\"back_page=#this_page#,back_header=$@1send$,EcosystemId=#ecosystem_id#,Id=#Id#\").Popup(Header: $@1member$, Width: \"50\")\n }\n }\n }\n }\n If(#MemberAccount#){\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(For: Amount){\n $@1r_amount$\n }\n }\n Div(col-sm-8 text-left){\n Input(Name: Amount, Type: number)\n }\n }\n DBFind(\"@1e_events\", events).Where({\"ecosystem\": \"#ecosystem_id#\"}).Limit(10).Order(\"created_at\").Columns(\"name,id\")\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(For:LastEvent){\n $@1r_last_events$\n }\n }\n Div(col-sm-8 mt-sm text-left){\n Input(Name: LastEvent, Type: \"checkbox\", Value: \"true\", Class: m0 ml-sm)\n }\n }\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(For:EventId){\n $@1r_event$\n }\n }\n Div(col-sm-8 text-left){\n Select(Name: EventId, Source: events, NameColumn: name, ValueColumn: id)\n }\n }.Hide(LastEvent=false)\n\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(For:EventType){\n $@1r_event_type$\n }\n }\n Div(col-sm-8 text-left){\n Select(Name: EventType, Source: types, NameColumn: name, ValueColumn: id)\n }\n }.Hide(LastEvent=true)\n Div(row mt-sm){\n Div(col-sm-4 mt-sm text-right){\n Label(For:EventId){\n $@1r_event_id$\n }\n }\n Div(col-sm-8 text-left){\n Input(Name: EventId, Type: number)\n }\n }.Hide(LastEvent=true)\n Button(Body: $@1save$, Class: btn btn-primary pull-right mt, Page: #back_page#, Contract: @1RUpdate)\n }\n }\n Button(Body: $@1back$, Class: btn btn-default pull-right mt, Page: #back_page#)\n}.Style(\n .buttons {\n border: 1px solid #dde6e9;\n padding: 6px 16px;\n }\n)", "Menu": "default_menu", "Type": "pages" }, { "Name": "r_ratings", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1r_ratings).(this_table, @1keys)\nInclude(@1pager_header)\n\nSetTitle($@1r_ratings$)\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1r_desc$\"))\n\nDBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Ratings\"}).Vars(application)\nSetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: ratings_admin_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": #ecosystem_id#, \"$and\": [\"role->id\": {\"$in\": [#admin_roles#]}, \"role->id\": #role_id#], \"member->member_id\": #key_id#, \"deleted\": 0}).Vars(admin_access)\nIf(#admin_access_id# > 0){\n SetVar(isManager,1)\n}\nIf(#isManager#==1){\n AddToolButton(Title: $@1r_rating_group$, Page: @1r_rating_group, Icon: icon-drawer).Popup(Header: $@1r_rating_group$, Width: \"50\")\n}\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": #ecosystem_id#, \"id\": {\"$neq\":#guest_key#}, \"deleted\": 0, \"id\": AddressToId(#search#)})\n}.Else{\n SetVar(where, {\"ecosystem\": #ecosystem_id#, \"id\": {\"$neq\":#guest_key#}, \"deleted\": 0})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, $@1wallet$)\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Count(count).Custom(_id){\n SetVar(Name: style_text, Value: \"text-normal\")\n SetVar(Name: style_link, Value: \"text-primary\")\n Span(Class: h6 text-muted, Body: #id#)\n SetVar(m_id, 0)\n DBFind(@1members).Where({\"ecosystem\": #ecosystem_id#, \"id\": #id#}).Vars(m)\n If(Or(#m_id#>0,#m_id#<0)){\n SetVar(image_id, #m_image_id#)\n SetVar(member_name, #m_member_name#)\n }.Else{\n SetVar(image_id, 0)\n SetVar(member_name, Address(#id#))\n }\n}.Custom(_member_id){\n Button(Class: btn-xs btn-link, Page: @1r_accruals, PageParams: \"Id=#id#\"){\n Span(Class: h5, Body: $@1view$)\n }\n}.Custom(_rating){\n SetVar(rating_amount, 0).(member, Address(#id#))\n DBFind(@1r_ratings, r).Where({\"ecosystem\": #ecosystem_id#, \"member\": #member#}).Vars(rating)\n Span(#rating_amount#)\n}.Custom(_username){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: \"v_key_id=#id#\"){\n If(#image_id#>0){\n Image(Src: Binary().ById(#image_id#), Class: img-circle).Style(height: 30px;width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(#member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x mr)).(#member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n}.Custom(_actions){\n If(#isManager#==1){\n Button(Page:@1r_rating_member, PageParams: \"MemberId=#id#\", Class: btn bg-gray-lighter fa fa-plus pull-right).Popup(Header:$@1r_change_rating$, Width: 50)\n }\n}\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1name$=_username,$@1r_accruals$=_member_id,$@1r_rating$=_rating,=_actions\")\n }.Else{\n Div(text-center h4 text-muted){\n $@1members$ $@1not_founded$\n }\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "SetVar(this_page, @1r_ratings).(this_table, @1keys)\nInclude(@1pager_header)\n\nSetTitle($@1r_ratings$)\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1r_desc$\"))\n\nDBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Ratings\"}).Vars(application)\nSetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: ratings_admin_role))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#admin_roles#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\nIf(#admin_access_id# > 0){\n SetVar(isManager,1)\n}\nIf(#isManager#==1){\n AddToolButton(Title: $@1r_rating_group$, Page: @1r_rating_group, Icon: icon-drawer).Popup(Header: $@1r_rating_group$, Width: \"50\")\n}\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0, \"$and\": [{\"account\": {\"$ilike\": \"#search#\"}}, {\"account\": {\"$neq\": \"#guest_account#\"}}]})\n}.Else{\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"account\": {\"$neq\": \"#guest_account#\"}, \"deleted\": 0})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, $@1wallet$)\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"account\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Count(count).Custom(_id){\n SetVar(Name: style_text, Value: \"text-normal\")\n SetVar(Name: style_link, Value: \"text-primary\")\n Span(Class: h6 text-muted, Body: #account#)\n SetVar(m_account,)\n DBFind(\"@1members\").Where({\"ecosystem\": \"#ecosystem_id#\", \"account\": \"#account#\"}).Vars(m)\n If(#m_account#){\n SetVar(image_id, #m_image_id#)\n SetVar(member_name, #m_member_name#)\n }.Else{\n SetVar(image_id, 0)\n SetVar(member_name, #account#)\n }\n}.Custom(_account){\n Button(Class: btn-xs btn-link, Page: @1r_accruals, PageParams: \"Account=#account#\"){\n Span(Class: h5, Body: $@1view$)\n }\n}.Custom(_rating){\n SetVar(rating_amount, 0).(member, #account#)\n DBFind(\"@1r_ratings\", r).Where({\"ecosystem\": \"#ecosystem_id#\", \"member\": \"#member#\"}).Vars(rating)\n Span(#rating_amount#)\n}.Custom(_username){\n LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: \"v_account=#account#\"){\n If(#image_id#>0){\n Image(Src: Binary().ById(#image_id#), Class: img-circle).Style(height: 30px;width: 30px; border: 1px solid #5A5D63; margin-right: 10px;)\n Span(#member_name#)\n }.Else{\n Div(){\n Span(Em(Class: fa icon-user fa-2x mr)).(#member_name#)\n }.Style(display:flex; align-items:center;)\n }\n }\n}.Custom(_actions){\n If(#isManager#==1){\n Button(Page:@1r_rating_member, PageParams: \"MemberAccount=#account#\", Class: btn bg-gray-lighter fa fa-plus pull-right).Popup(Header:$@1r_change_rating$, Width: 50)\n }\n}\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1name$=_username,$@1r_accruals$=_account,$@1r_rating$=_rating,=_actions\")\n }.Else{\n Div(text-center h4 text-muted){\n $@1members$ $@1not_founded$\n }\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", "Menu": "default_menu", "Type": "pages" }, { "Name": "r_settings", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Ratings\"}).Vars(\"app\")\n\nSetVar(this_page, \"@1r_settings\").(ratings_admin_role,0)\nSetVar(ratings_admin_role, AppParam(App: #app_id#, Name: \"ratings_admin_role\"))\n\nDBFind(\"@1roles\", src_roles).Where({\"ecosystem\": #ecosystem_id#, \"deleted\": 0}).Columns(\"role_name,id\").Limit(100)\n\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-4 text-right mt-sm\").(col_right,\"col-sm-8 text-left\")\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(@1r_settings)\n }\n Div(text-center text-muted){\n LangRes(@1r_settings_description)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n LangRes(@1r_admin_role)\n }\n }\n Div(#col_right#){\n Select(Name: RoleAdmin, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #ratings_admin_role#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#ratings_admin_role# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #ratings_admin_role#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1apply_settings$, Class: btn btn-primary, Page: #this_page#, Contract: @1RSettings)\n }\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Ratings\"}).Vars(app)\n\nSetVar(this_page, \"@1r_settings\").(ratings_admin_role,0)\nSetVar(ratings_admin_role, AppParam(App: #app_id#, Name: \"ratings_admin_role\"))\n\nDBFind(\"@1roles\", src_roles).Where({\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0}).Columns(\"role_name,id\").Limit(100)\n\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-4 text-right mt-sm\").(col_right,\"col-sm-8 text-left\")\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(@1r_settings)\n }\n Div(text-center text-muted){\n LangRes(@1r_settings_description)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n LangRes(@1r_admin_role)\n }\n }\n Div(#col_right#){\n Select(Name: RoleAdmin, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #ratings_admin_role#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#ratings_admin_role# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#ratings_admin_role#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1apply_settings$, Class: btn btn-primary, Page: #this_page#, Contract: @1RSettings)\n }\n }\n }\n }\n}", "Menu": "admin_menu", "Type": "pages" }, @@ -192,7 +192,7 @@ { "Name": "RUpdate", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract RUpdate {\n data {\n Member string\n Amount int\n EventType int \"optional\"\n EventId int\n LastEvent string \"optional\"\n }\n\n func updateRating(){\n var accruals array total money offset limit i accrualsLen int acc map\n limit = 250\n while true {\n accruals = DBFind(\"@1r_accruals\").Where({\"ecosystem\": $ecosystem_id, \"member\": $Member}).Limit(limit).Offset(offset)\n accrualsLen = Len(accruals)\n if accrualsLen == 0 {\n break\n }\n i = 0\n while i < accrualsLen {\n acc = accruals[i]\n total = total + Money(acc[\"amount\"])\n i = i + 1\n }\n offset = offset + limit\n }\n var rating m map\n rating = DBFind(\"@1r_ratings\").Where({\"member\": $Member, \"ecosystem\": $ecosystem_id}).Row()\n m = {\"amount\": total, \"updated_at\": $block_time}\n if rating {\n if Money(rating[\"amount\"]) != total {\n DBUpdate(\"@1r_ratings\", Int(rating[\"id\"]), m)\n }\n } else {\n m[\"member\"] = $Member\n m[\"ecosystem\"] = $ecosystem_id\n DBInsert(\"@1r_ratings\", m)\n }\n }\n\n conditions{\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Ratings\"}).One(\"id\")\n var admin_ids string\n admin_ids = AppParam(Int($app), \"ratings_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+admin_ids+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n if $Amount == 0 {\n warning \"Invalid amount\"\n }\n\n var id int\n id = AddressToId($Member)\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"id\": id}).Row() {\n warning \"Wallet not found\"\n }\n\n if $LastEvent == \"true\" {\n var event map\n event = DBFind(\"@1e_events\").WhereId($EventId).Row()\n if !event {\n warning \"Event not found\"\n }\n $EventType = Int(event[\"type\"])\n }\n }\n\n action {\n var m map manager string\n manager = IdToAddress($key_id)\n m = {\"member\": $Member, \"amount\": $Amount, \"manager\": manager, \"created_at\": $block_time, \"event_id\": $EventId, \"event_type\": $EventType, \"ecosystem\": $ecosystem_id}\n DBInsert(\"@1r_accruals\", m)\n updateRating()\n }\n}", + "Value": "contract RUpdate {\n data {\n Member string\n Amount int\n EventType int \"optional\"\n EventId int\n LastEvent string \"optional\"\n }\n\n func updateRating(){\n var accruals array total money offset limit i accrualsLen int acc map\n limit = 250\n while true {\n accruals = DBFind(\"@1r_accruals\").Where({\"ecosystem\": $ecosystem_id, \"member\": $Member}).Limit(limit).Offset(offset)\n accrualsLen = Len(accruals)\n if accrualsLen == 0 {\n break\n }\n i = 0\n while i < accrualsLen {\n acc = accruals[i]\n total = total + Money(acc[\"amount\"])\n i = i + 1\n }\n offset = offset + limit\n }\n var rating m map\n rating = DBFind(\"@1r_ratings\").Where({\"member\": $Member, \"ecosystem\": $ecosystem_id}).Row()\n m = {\"amount\": total, \"updated_at\": $block_time}\n if rating {\n if Money(rating[\"amount\"]) != total {\n DBUpdate(\"@1r_ratings\", Int(rating[\"id\"]), m)\n }\n } else {\n m[\"member\"] = $Member\n m[\"ecosystem\"] = $ecosystem_id\n DBInsert(\"@1r_ratings\", m)\n }\n }\n\n conditions{\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Ratings\"}).One(\"id\")\n var admin_ids string\n admin_ids = AppParam(Int($app), \"ratings_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+admin_ids+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n if $Amount == 0 {\n warning \"Invalid amount\"\n }\n\n if !DBFind(\"@1keys\").Where({\"ecosystem\": $ecosystem_id, \"account\": $Member, \"deleted\": 0}).Row() {\n warning \"Wallet not found\"\n }\n\n if $LastEvent == \"true\" {\n var event map\n event = DBFind(\"@1e_events\").WhereId($EventId).Row()\n if !event {\n warning \"Event not found\"\n }\n $EventType = Int(event[\"type\"])\n }\n }\n\n action {\n var m map\n m = {\"member\": $Member, \"amount\": $Amount, \"manager\": $account_id, \"created_at\": $block_time, \"event_id\": $EventId, \"event_type\": $EventType, \"ecosystem\": $ecosystem_id}\n DBInsert(\"@1r_accruals\", m)\n updateRating()\n }\n}", "Type": "contracts" }, { diff --git a/platform_apps/ratings/contracts/RUpdate.sim b/platform_apps/ratings/contracts/RUpdate.sim index 462c0d696..714e4996a 100644 --- a/platform_apps/ratings/contracts/RUpdate.sim +++ b/platform_apps/ratings/contracts/RUpdate.sim @@ -44,7 +44,7 @@ contract RUpdate { admin_ids = AppParam(Int($app), "ratings_admin_role", $ecosystem_id) var rids array rids = JSONDecode("["+admin_ids+"]") - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() { warning LangRes("@1access_denied", "en") } @@ -52,9 +52,7 @@ contract RUpdate { warning "Invalid amount" } - var id int - id = AddressToId($Member) - if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": id}).Row() { + if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": $Member, "deleted": 0}).Row() { warning "Wallet not found" } @@ -69,9 +67,8 @@ contract RUpdate { } action { - var m map manager string - manager = IdToAddress($key_id) - m = {"member": $Member, "amount": $Amount, "manager": manager, "created_at": $block_time, "event_id": $EventId, "event_type": $EventType, "ecosystem": $ecosystem_id} + var m map + m = {"member": $Member, "amount": $Amount, "manager": $account_id, "created_at": $block_time, "event_id": $EventId, "event_type": $EventType, "ecosystem": $ecosystem_id} DBInsert("@1r_accruals", m) updateRating() } diff --git a/platform_apps/ratings/pages/r_accruals.ptl b/platform_apps/ratings/pages/r_accruals.ptl index 23fb0c30d..0a0aae784 100644 --- a/platform_apps/ratings/pages/r_accruals.ptl +++ b/platform_apps/ratings/pages/r_accruals.ptl @@ -1,14 +1,12 @@ SetVar(this_page, @1r_accruals).(this_table, @1r_accruals) Include(@1pager_header) -If(#Id#!=""){ - SetVar(member, Address(#Id#)) +If(#Account#){ + SetVar(member, #Account#) }.Else{ - SetVar(member, Address(#key_id#)) + SetVar(member, #account_id#) } -SetVar(where, {"member": #member#, "ecosystem": #ecosystem_id#}) - SetTitle($@1r_accruals$ (#member#)) Span(Class: h5 m0 mb ml-lg){ LinkPage(Class: ml-sm, Body: $@1r_rating$, Page: @1r_ratings) @@ -18,15 +16,14 @@ Span(Class: h5 m0 mb ml-lg){ display: inline-block; ) -DBFind(#this_table#, src).Where(#where#).Order({"id": -1}).Limit(#pager_limit#).Offset(#pager_offset#).Count(count).Custom(_type){ +DBFind(#this_table#, src).Where({"member": "#member#", "ecosystem": "#ecosystem_id#"}).Order({"id": "-1"}).Limit(#pager_limit#).Offset(#pager_offset#).Count(count).Custom(_type){ SetVar(t_name,) - DBFind(@1e_types).Where({"ecosystem": #ecosystem_id#, "id": #event_type#}).Columns("name").Vars(t) - Span(#t_name#,ml-sm text-muted) + DBFind("@1e_types").Where({"ecosystem": "#ecosystem_id#", "id": "#event_type#"}).Columns("name").Vars(t) + Span(#t_name#, ml-sm text-muted) }.Custom(_created){ DateTime(#created_at#, Format: YYYY-MM-DD HH:MI:SS) }.Custom(_manager){ - SetVar(manager_key_id, AddressToId(#manager#)) - LinkPage(Class: h5 text-primary, Page: @1profile_view, PageParams: "v_key_id=#manager_key_id#"){ + LinkPage(Class: h5 text-primary, Page: @1profile_view, PageParams: "v_account=#manager#"){ Div(){ Span(Class: fa icon-user fa-2x mr).(#manager#) }.Style(display:flex; align-items:center;) diff --git a/platform_apps/ratings/pages/r_rating_group.ptl b/platform_apps/ratings/pages/r_rating_group.ptl index a92291889..dfac0674f 100644 --- a/platform_apps/ratings/pages/r_rating_group.ptl +++ b/platform_apps/ratings/pages/r_rating_group.ptl @@ -1,8 +1,8 @@ SetVar(this_page, @1r_rating_group).(back_page,@1r_ratings) -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Ratings"}).Vars(application) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Ratings"}).Vars(application) SetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: ratings_admin_role)) -DBFind("@1roles_participants").Where({"ecosystem": #ecosystem_id#, "$and": ["role->id": {"$in": [#admin_roles#]}, "role->id": #role_id#], "member->member_id": #key_id#, "deleted": 0}).Vars(admin_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": ["role->id": {"$in": [#admin_roles#]}, "role->id": #role_id#], "member->account": #account_id#, "deleted": 0}).Vars(admin_access) If(#admin_access_id# > 0){ SetVar(isManager,1) } diff --git a/platform_apps/ratings/pages/r_rating_member.ptl b/platform_apps/ratings/pages/r_rating_member.ptl index 8432fe23d..d0ca4113b 100644 --- a/platform_apps/ratings/pages/r_rating_member.ptl +++ b/platform_apps/ratings/pages/r_rating_member.ptl @@ -1,15 +1,15 @@ SetVar(this_page, @1r_rating_member).(back_page, @1r_ratings) -DBFind(@1e_types, types).Where({"ecosystem": #ecosystem_id#}).Columns("id,name") +DBFind("@1e_types", types).Where({"ecosystem": "#ecosystem_id#"}).Columns("id,name") -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Ratings"}).Vars(application) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Ratings"}).Vars(application) SetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: ratings_admin_role)) -DBFind("@1roles_participants").Where({"ecosystem": #ecosystem_id#, "$and": ["role->id": {"$in": [#admin_roles#]}, "role->id": #role_id#], "member->member_id": #key_id#, "deleted": 0}).Vars(admin_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#admin_roles#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) If(#admin_access_id# > 0){ SetVar(isManager,1) } Form(){ - If(#isManager#==1){ + If(#isManager# == 1){ Div(row){ Div(col-sm-4 mt-sm text-bold text-right){ Label(For:Member){ @@ -18,9 +18,8 @@ Form(){ } Div(col-sm-8 text-left){ Div(input-group){ - If(#MemberId#!=""){ - SetVar(Member, Address(#MemberId#)) - Input(Name: Member, Disabled: 1, Value: #Member#) + If(#MemberAccount#){ + Input(Name: Member, Disabled: 1, Value: #MemberAccount#) }.Else{ Input(Name: Member, Disabled: 1, Value: "xxxx-xxxx-xxxx-xxxx-xxxx") } @@ -30,10 +29,10 @@ Form(){ } } } - If(#MemberId#!=""){ + If(#MemberAccount#){ Div(row mt-sm){ Div(col-sm-4 mt-sm text-right){ - Label(For:Amount){ + Label(For: Amount){ $@1r_amount$ } } @@ -41,7 +40,7 @@ Form(){ Input(Name: Amount, Type: number) } } - DBFind(@1e_events, events).Where({"ecosystem": #ecosystem_id#}).Limit(10).Order("created_at").Columns("name,id") + DBFind("@1e_events", events).Where({"ecosystem": "#ecosystem_id#"}).Limit(10).Order("created_at").Columns("name,id") Div(row mt-sm){ Div(col-sm-4 mt-sm text-right){ Label(For:LastEvent){ diff --git a/platform_apps/ratings/pages/r_ratings.ptl b/platform_apps/ratings/pages/r_ratings.ptl index 675e7cff5..306485cc0 100644 --- a/platform_apps/ratings/pages/r_ratings.ptl +++ b/platform_apps/ratings/pages/r_ratings.ptl @@ -4,9 +4,9 @@ Include(@1pager_header) SetTitle($@1r_ratings$) Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$@1r_desc$")) -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Ratings"}).Vars(application) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Ratings"}).Vars(application) SetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: ratings_admin_role)) -DBFind("@1roles_participants").Where({"ecosystem": #ecosystem_id#, "$and": ["role->id": {"$in": [#admin_roles#]}, "role->id": #role_id#], "member->member_id": #key_id#, "deleted": 0}).Vars(admin_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#admin_roles#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) If(#admin_access_id# > 0){ SetVar(isManager,1) } @@ -15,9 +15,9 @@ If(#isManager#==1){ } If(#search#){ - SetVar(where, {"ecosystem": #ecosystem_id#, "id": {"$neq":#guest_key#}, "deleted": 0, "id": AddressToId(#search#)}) + SetVar(where, {"ecosystem": "#ecosystem_id#", "deleted": 0, "$and": [{"account": {"$ilike": "#search#"}}, {"account": {"$neq": "#guest_account#"}}]}) }.Else{ - SetVar(where, {"ecosystem": #ecosystem_id#, "id": {"$neq":#guest_key#}, "deleted": 0}) + SetVar(where, {"ecosystem": "#ecosystem_id#", "account": {"$neq": "#guest_account#"}, "deleted": 0}) } Div(list-group-item ml-lg mr-lg pt-lg){ @@ -25,29 +25,29 @@ Div(list-group-item ml-lg mr-lg pt-lg){ Include(@1search) } -DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Count(count).Custom(_id){ +DBFind(#this_table#, src).Where(#where#).Order({"account": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Count(count).Custom(_id){ SetVar(Name: style_text, Value: "text-normal") SetVar(Name: style_link, Value: "text-primary") - Span(Class: h6 text-muted, Body: #id#) - SetVar(m_id, 0) - DBFind(@1members).Where({"ecosystem": #ecosystem_id#, "id": #id#}).Vars(m) - If(Or(#m_id#>0,#m_id#<0)){ + Span(Class: h6 text-muted, Body: #account#) + SetVar(m_account,) + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#account#"}).Vars(m) + If(#m_account#){ SetVar(image_id, #m_image_id#) SetVar(member_name, #m_member_name#) }.Else{ SetVar(image_id, 0) - SetVar(member_name, Address(#id#)) + SetVar(member_name, #account#) } -}.Custom(_member_id){ - Button(Class: btn-xs btn-link, Page: @1r_accruals, PageParams: "Id=#id#"){ +}.Custom(_account){ + Button(Class: btn-xs btn-link, Page: @1r_accruals, PageParams: "Account=#account#"){ Span(Class: h5, Body: $@1view$) } }.Custom(_rating){ - SetVar(rating_amount, 0).(member, Address(#id#)) - DBFind(@1r_ratings, r).Where({"ecosystem": #ecosystem_id#, "member": #member#}).Vars(rating) + SetVar(rating_amount, 0).(member, #account#) + DBFind("@1r_ratings", r).Where({"ecosystem": "#ecosystem_id#", "member": "#member#"}).Vars(rating) Span(#rating_amount#) }.Custom(_username){ - LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#id#"){ + LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: "v_account=#account#"){ If(#image_id#>0){ Image(Src: Binary().ById(#image_id#), Class: img-circle).Style(height: 30px;width: 30px; border: 1px solid #5A5D63; margin-right: 10px;) Span(#member_name#) @@ -59,7 +59,7 @@ DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).O } }.Custom(_actions){ If(#isManager#==1){ - Button(Page:@1r_rating_member, PageParams: "MemberId=#id#", Class: btn bg-gray-lighter fa fa-plus pull-right).Popup(Header:$@1r_change_rating$, Width: 50) + Button(Page:@1r_rating_member, PageParams: "MemberAccount=#account#", Class: btn bg-gray-lighter fa fa-plus pull-right).Popup(Header:$@1r_change_rating$, Width: 50) } } @@ -67,7 +67,7 @@ Div(fullscreen){ Div(table-responsive ml-lg mr-lg){ Div(list-group-item){ If(#count# > 0){ - Table(src, "$@1name$=_username,$@1r_accruals$=_member_id,$@1r_rating$=_rating,=_actions") + Table(src, "$@1name$=_username,$@1r_accruals$=_account,$@1r_rating$=_rating,=_actions") }.Else{ Div(text-center h4 text-muted){ $@1members$ $@1not_founded$ diff --git a/platform_apps/ratings/pages/r_settings.ptl b/platform_apps/ratings/pages/r_settings.ptl index d62025f01..1737e00da 100644 --- a/platform_apps/ratings/pages/r_settings.ptl +++ b/platform_apps/ratings/pages/r_settings.ptl @@ -1,9 +1,9 @@ -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Ratings"}).Vars("app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Ratings"}).Vars(app) SetVar(this_page, "@1r_settings").(ratings_admin_role,0) SetVar(ratings_admin_role, AppParam(App: #app_id#, Name: "ratings_admin_role")) -DBFind("@1roles", src_roles).Where({"ecosystem": #ecosystem_id#, "deleted": 0}).Columns("role_name,id").Limit(100) +DBFind("@1roles", src_roles).Where({"ecosystem": "#ecosystem_id#", "deleted": 0}).Columns("role_name,id").Limit(100) SetVar(row,"row mt-sm").(col_left,"col-sm-4 text-right mt-sm").(col_right,"col-sm-8 text-left") @@ -29,7 +29,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#ratings_admin_role# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #ratings_admin_role#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#ratings_admin_role#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# diff --git a/platform_apps/token_emission.json b/platform_apps/token_emission.json index 59fb34d2d..100bf2170 100644 --- a/platform_apps/token_emission.json +++ b/platform_apps/token_emission.json @@ -162,47 +162,47 @@ { "Name": "te_create", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1applications).Columns(\"id\").Where({\"name\": \"Token emission\", \"deleted\": 0, \"ecosystem\": 1}).Vars(application)\nAppParam(App:#application_id#, Name:type_emission, Source:type_emission, Ecosystem:1)\nAppParam(App:#application_id#, Name:type_withdraw, Source:type_withdraw, Ecosystem:1)\nDBFind(@1ecosystems).WhereId(#ecosystem_id#).Vars(e)\n\nForm(){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1emission_amount)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Amount, Type: number)\n }\n }\n If(#e_type_emission#==0){\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1token_title)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Title)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1type_emission)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Select(Name: TypeEmission, Source: type_emission, NameColumn: name, ValueColumn: id)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1type_withdraw)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Select(Name: TypeWithdraw, Source: type_withdraw, NameColumn: name, ValueColumn: id)\n }\n }\n }\n Button(Body: LangRes(@1create), Class: btn btn-primary pull-right mt, Page: @1te_view, Contract: @1TeCreate).Alert(Text: \"$@1want_make_emission$\", ConfirmButton: \"$@1yes$\", CancelButton: \"$@1no$\", Icon: icon-question)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1te_view)\n}", + "Value": "DBFind(\"@1applications\").Where({\"name\": \"Token emission\", \"deleted\": 0, \"ecosystem\": 1}).Columns(\"id\").Vars(application)\nAppParam(App:#application_id#, Name:type_emission, Source:type_emission, Ecosystem:1)\nAppParam(App:#application_id#, Name:type_withdraw, Source:type_withdraw, Ecosystem:1)\nDBFind(\"@1ecosystems\").WhereId(#ecosystem_id#).Vars(e)\n\nForm(){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1emission_amount)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Amount, Type: number)\n }\n }\n If(#e_type_emission#==0){\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1token_title)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Input(Name: Title)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1type_emission)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Select(Name: TypeEmission, Source: type_emission, NameColumn: name, ValueColumn: id)\n }\n }\n Div(row mt-sm){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1type_withdraw)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Select(Name: TypeWithdraw, Source: type_withdraw, NameColumn: name, ValueColumn: id)\n }\n }\n }\n Button(Body: LangRes(@1create), Class: btn btn-primary pull-right mt, Page: @1te_view, Contract: @1TeCreate).Alert(Text: \"$@1want_make_emission$\", ConfirmButton: \"$@1yes$\", CancelButton: \"$@1no$\", Icon: icon-question)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1te_view)\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "te_edit", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1applications).Columns(\"id\").Where({\"name\": \"Token emission\", \"deleted\": 0, \"ecosystem\": 1}).Vars(application)\nAppParam(App:#application_id#, Name:type_emission, Source:type_emission, Ecosystem:1)\nAppParam(App:#application_id#, Name:type_withdraw, Source:type_withdraw, Ecosystem:1)\nDBFind(@1ecosystems).WhereId(#ecosystem_id#).Vars(e)\n\nForm(){\n Input(Name: TypeChange, Type: Hidden, Value: #TypeChange#)\n If(#TypeChange# == emission){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1type_emission)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Select(Name: Value, Source: type_emission, NameColumn: name, ValueColumn: id, Value: #e_type_emission#)\n }\n }\n }\n If(#TypeChange# == withdraw){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1type_withdraw)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Select(Name: Value, Source: type_withdraw, NameColumn: name, ValueColumn: id, Value: #e_type_withdraw#)\n }\n }\n }\n Button(Body: LangRes(@1change), Class: btn btn-primary pull-right mt, Page: @1te_view, Contract: @1TeChange)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1te_view)\n}", + "Value": "DBFind(\"@1applications\").Where({\"name\": \"Token emission\", \"deleted\": 0, \"ecosystem\": 1}).Columns(\"id\").Vars(application)\nAppParam(App:#application_id#, Name:type_emission, Source:type_emission, Ecosystem:1)\nAppParam(App:#application_id#, Name:type_withdraw, Source:type_withdraw, Ecosystem:1)\nDBFind(\"@1ecosystems\").WhereId(#ecosystem_id#).Vars(e)\n\nForm(){\n Input(Name: TypeChange, Type: Hidden, Value: #TypeChange#)\n If(#TypeChange# == emission){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1type_emission)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Select(Name: Value, Source: type_emission, NameColumn: name, ValueColumn: id, Value: #e_type_emission#)\n }\n }\n }\n If(#TypeChange# == withdraw){\n Div(row){\n Div(col-md-3 mt-sm text-right){\n Label(){\n LangRes(@1type_withdraw)\n Span(Class: text-danger, Body:*)\n }\n }\n Div(col-md-9 text-left){\n Select(Name: Value, Source: type_withdraw, NameColumn: name, ValueColumn: id, Value: #e_type_withdraw#)\n }\n }\n }\n Button(Body: LangRes(@1change), Class: btn btn-primary pull-right mt, Page: @1te_view, Contract: @1TeChange)\n Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1te_view)\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "te_settings", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Token emission\"}).Vars(\"app\")\n\nSetVar(this_page, \"@1te_settings\").(te_admin_role,0)\nSetVar(te_admin_role, AppParam(App: #app_id#, Name: \"te_admin_role\"))\n\nDBFind(\"@1roles\", src_roles).Where({\"ecosystem\": #ecosystem_id#, \"deleted\": 0}).Columns(\"role_name,id\").Limit(100)\n\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-4 text-right mt-sm\").(col_right,\"col-sm-8 text-left\")\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(@1te_settings)\n }\n Div(text-center text-muted){\n LangRes(@1te_settings_description)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n LangRes(@1te_admin_role)\n }\n }\n Div(#col_right#){\n Select(Name: RoleAdmin, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #te_admin_role#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#te_admin_role# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": #ecosystem_id#, \"id\": #te_admin_role#}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1apply_settings$, Class: btn btn-primary, Page: #this_page#, Contract: @1TeSettings)\n }\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Token emission\"}).Vars(app)\n\nSetVar(this_page, \"@1te_settings\").(te_admin_role,0)\nSetVar(te_admin_role, AppParam(App: #app_id#, Name: \"te_admin_role\"))\n\nDBFind(\"@1roles\", src_roles).Where({\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0}).Columns(\"role_name,id\").Limit(100)\n\nSetVar(row,\"row mt-sm\").(col_left,\"col-sm-4 text-right mt-sm\").(col_right,\"col-sm-8 text-left\")\n\nDiv(content-wrapper){\n Div(row){\n Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){\n Form(panel panel-primary){\n Div(panel-body){\n Div(text-center text-bold h4 m0){\n LangRes(@1te_settings)\n }\n Div(text-center text-muted){\n LangRes(@1te_settings_description)\n }\n Div(row mt-lg){\n Div(#col_left#){\n Label(){\n LangRes(@1te_admin_role)\n }\n }\n Div(#col_right#){\n Select(Name: RoleAdmin, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #te_admin_role#)\n Div(m0 h6 text-muted){\n SetVar(r_name, $@1role_not_found$)\n If(#te_admin_role# > 0){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#te_admin_role#\"}).Columns(\"role_name\").Vars(r)\n SetVar(r_name, #r_role_name#)\n }\n LangRes(@1current_value): #r_name#\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1apply_settings$, Class: btn btn-primary, Page: #this_page#, Contract: @1TeSettings)\n }\n }\n }\n }\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "te_view", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1applications).Columns(\"id\").Where({\"name\": \"Token emission\", \"deleted\": 0, \"ecosystem\": 1}).Vars(application)\nAppParam(App:#application_id#, Name:type_emission, Source:type_emission, Ecosystem:1)\nAppParam(App:#application_id#, Name:type_withdraw, Source:type_withdraw, Ecosystem:1)\nDBFind(@1ecosystems).WhereId(#ecosystem_id#).Vars(e)\n\nSetTitle($@1emission_tokens$)\nIf(#e_type_emission#>0){\n If(#e_type_withdraw#==2){\n AddToolButton(Page: @1te_burn, Icon: icon-minus, Title: $@1burn$).Popup(50, $@1emission_new$)\n }\n If(#e_type_emission#==2){\n AddToolButton(Page: @1te_create, Icon: icon-plus, Title: $@1emission_new$).Popup(50, $@1emission_new$)\n }\n}.Else{\n DBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"Token emission\"}).Vars(ecosystem_application)\n SetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #ecosystem_application_id#, Name: te_admin_role))\n DBFind(\"@1roles_participants\").Where({\"ecosystem\": #ecosystem_id#, \"$and\": [\"role->id\": {\"$in\": [#admin_roles#]}, \"role->id\": #role_id#], \"member->member_id\": #key_id#, \"deleted\": 0}).Vars(admin_access)\n If(#admin_access_id# > 0){\n AddToolButton(Page: @1te_create, Icon: icon-plus, Title: $@1emission_new$).Popup(50, $@1emission_new$)\n }\n}\n\nForm(content-wrapper){\n If(#e_type_emission#>0){\n Div(row){\n Div(col-sm-8 col-sm-offset-2){\n Div(list-group-item){\n Div(text-center text-bold h4 m0){\n LangRes(@1tokens)\n }\n Div(row mt){\n Div(col-sm-6 text-right){\n LangRes(@1token_title)\n }\n Div(col-sm-6 text-left){\n Span(Class: ml-sm, Body: #e_token_title#)\n }\n }\n Div(row){\n Div(col-sm-6 text-right){\n LangRes(@1type_emission)\n }\n Div(col-sm-6){\n Button(Page:@1te_edit, PageParams: \"TypeChange=emission\", Class: btn-xs btn-link){\n Span(Class: h5, Body: AppParam(App:#application_id#, Name:type_emission, Index:#e_type_emission#, Ecosystem:1))\n }.Popup(50, $@1change$)\n }\n }\n Div(row){\n Div(col-sm-6 text-right){\n LangRes(@1type_withdraw)\n }\n Div(col-sm-6){\n Button(Page:@1te_edit, PageParams: \"TypeChange=withdraw\", Class: btn-xs btn-link){\n Span(Class: h5, Body: AppParam(App:#application_id#, Name:type_withdraw, Index:#e_type_withdraw#, Ecosystem:1))\n }.Popup(50, $@1change$)\n }\n }\n If(#e_emission_amount#!=\"\"){\n ArrayToSource(emission, #e_emission_amount#)\n }\n Div(list-group-item mt){\n Div(text-center text-bold h5 m0 mb){\n LangRes(@1completed_stages)\n }\n ForList(Source: emission, Index:ind){\n Div(row mt-sm){\n Div(col-sm-1){\n #ind#\n }\n JsonToSource(src, #value#, src)\n ForList(Source: src){\n If(#src_key#==time){\n Div(col-sm-5){\n DateTime(#src_value#, Format: YYYY-MM-DD HH:MI:SS)\n }\n }\n If(#src_key#==type){\n Div(col-sm-3 text-center){\n If(#src_value# == emission){\n Span(Class: text-success, Body: $@1emission_tokens$)\n }\n If(#src_value# == burn){\n Span(Class: text-danger, Body: $@1burning_tokens$)\n }\n }\n }\n If(#src_key#==val){\n Div(col-sm-3 text-right #stl#){\n Money(#src_value#) #e_token_title#\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }.Else{\n Div(md-12 alert alert-warning text-center text-bold){\n Span(Body: LangRes(@1emission_not_fulfilled))\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"name\": \"Token emission\", \"deleted\": 0, \"ecosystem\": 1}).Columns(\"id\").Vars(application)\nAppParam(App:#application_id#, Name:type_emission, Source:type_emission, Ecosystem:1)\nAppParam(App:#application_id#, Name:type_withdraw, Source:type_withdraw, Ecosystem:1)\nDBFind(\"@1ecosystems\").WhereId(#ecosystem_id#).Vars(e)\n\nSetTitle($@1emission_tokens$)\nIf(#e_type_emission#>0){\n If(#e_type_withdraw#==2){\n AddToolButton(Page: @1te_burn, Icon: icon-minus, Title: $@1burn$).Popup(50, $@1emission_new$)\n }\n If(#e_type_emission#==2){\n AddToolButton(Page: @1te_create, Icon: icon-plus, Title: $@1emission_new$).Popup(50, $@1emission_new$)\n }\n}.Else{\n DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"Token emission\"}).Vars(ecosystem_application)\n SetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #ecosystem_application_id#, Name: te_admin_role))\n DBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#admin_roles#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n If(#admin_access_id# > 0){\n AddToolButton(Page: @1te_create, Icon: icon-plus, Title: $@1emission_new$).Popup(50, $@1emission_new$)\n }\n}\n\nForm(content-wrapper){\n If(#e_type_emission#>0){\n Div(row){\n Div(col-sm-8 col-sm-offset-2){\n Div(list-group-item){\n Div(text-center text-bold h4 m0){\n LangRes(@1tokens)\n }\n Div(row mt){\n Div(col-sm-6 text-right){\n LangRes(@1token_title)\n }\n Div(col-sm-6 text-left){\n Span(Class: ml-sm, Body: #e_token_title#)\n }\n }\n Div(row){\n Div(col-sm-6 text-right){\n LangRes(@1type_emission)\n }\n Div(col-sm-6){\n Button(Page:@1te_edit, PageParams: \"TypeChange=emission\", Class: btn-xs btn-link){\n Span(Class: h5, Body: AppParam(App:#application_id#, Name:type_emission, Index:#e_type_emission#, Ecosystem:1))\n }.Popup(50, $@1change$)\n }\n }\n Div(row){\n Div(col-sm-6 text-right){\n LangRes(@1type_withdraw)\n }\n Div(col-sm-6){\n Button(Page:@1te_edit, PageParams: \"TypeChange=withdraw\", Class: btn-xs btn-link){\n Span(Class: h5, Body: AppParam(App:#application_id#, Name:type_withdraw, Index:#e_type_withdraw#, Ecosystem:1))\n }.Popup(50, $@1change$)\n }\n }\n If(#e_emission_amount#!=\"\"){\n ArrayToSource(emission, #e_emission_amount#)\n }\n Div(list-group-item mt){\n Div(text-center text-bold h5 m0 mb){\n LangRes(@1completed_stages)\n }\n ForList(Source: emission, Index:ind){\n Div(row mt-sm){\n Div(col-sm-1){\n #ind#\n }\n JsonToSource(src, #value#, src)\n ForList(Source: src){\n If(#src_key#==time){\n Div(col-sm-5){\n DateTime(#src_value#, Format: YYYY-MM-DD HH:MI:SS)\n }\n }\n If(#src_key#==type){\n Div(col-sm-3 text-center){\n If(#src_value# == emission){\n Span(Class: text-success, Body: $@1emission_tokens$)\n }\n If(#src_value# == burn){\n Span(Class: text-danger, Body: $@1burning_tokens$)\n }\n }\n }\n If(#src_key#==val){\n Div(col-sm-3 text-right #stl#){\n Money(#src_value#) #e_token_title#\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }.Else{\n Div(md-12 alert alert-warning text-center text-bold){\n Span(Body: LangRes(@1emission_not_fulfilled))\n }\n }\n}", "Menu": "admin_menu", "Type": "pages" }, { "Name": "TeBurn", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract TeBurn {\n data {\n Amount money\n }\n\n func checkSender() {\n var sender_map map\n sender_map = DBFind(\"@1keys\").Where({\"id\": $key_id, \"ecosystem\": $ecosystem_id}).Row()\n\n if !sender_map {\n warning Sprintf(LangRes(\"@1sender_x_invalid\", \"en\"), $key_id)\n }\n if Int(sender_map[\"blocked\"]) != 0 {\n warning LangRes(\"@1sender_blocked\", \"en\")\n }\n if Int(sender_map[\"deleted\"]) != 0 {\n warning LangRes(\"@1sender_deleted\", \"en\")\n }\n if Money(sender_map[\"amount\"]) < $Amount {\n warning LangRes(\"@1amount_less_than_needed\", \"en\")\n }\n }\n\n conditions {\n if $ecosystem_id == 1 {\n warning LangRes(\"@1burning_blocked\", \"en\")\n }\n\n checkSender() //check the sender\n\n //check amount\n if $Amount == 0 {\n warning LangRes(\"@1amount_zero\", \"en\")\n }\n if $Amount < 0 {\n warning LangRes(\"@1amount_less_zero\", \"en\")\n }\n\n $item = DBFind(\"@1ecosystems\").WhereId($ecosystem_id).Row()\n if $item[\"type_withdraw\"] == 1 {\n warning LangRes(\"@1burning_blocked\", \"en\")\n }\n }\n\n action {\n var mb map\n var burn map arr array\n burn[\"type\"] = \"burn\"\n burn[\"time\"] = Str($block_time)\n burn[\"val\"] = Money($Amount)\n arr = JSONDecode($item[\"emission_amount\"])\n arr = Append(arr, burn)\n mb[\"emission_amount\"] = JSONEncode(arr)\n DBUpdate(\"@1ecosystems\", $ecosystem_id, mb)\n\n var m map\n m[\"sender_id\"] = $key_id\n m[\"recipient_id\"] = $guest_key\n m[\"amount\"] = $Amount\n m[\"comment\"] = \"New burn\"\n m[\"block_id\"] = $block\n m[\"txhash\"] = $txhash\n m[\"ecosystem\"] = $ecosystem_id\n m[\"type\"] = 4\n m[\"created_at\"] = $block_time\n DBInsert(\"@1history\", m)\n\n DBUpdateExt(\"@1keys\", {\"id\": $key_id, \"ecosystem\": $ecosystem_id}, {\"-amount\": $Amount})\n DBUpdateExt(\"@1keys\", {\"id\": $guest_key, \"ecosystem\": $ecosystem_id}, {\"+amount\": $Amount})\n }\n}", + "Value": "contract TeBurn {\n data {\n Amount money\n }\n\n func checkSender() {\n var sender_map map\n sender_map = DBFind(\"@1keys\").Where({\"account\": $account_id, \"deleted\": 0, \"ecosystem\": $ecosystem_id}).Row()\n\n if !sender_map {\n warning Sprintf(LangRes(\"@1sender_x_invalid\", \"en\"), $account_id)\n }\n if Int(sender_map[\"blocked\"]) != 0 {\n warning LangRes(\"@1sender_blocked\", \"en\")\n }\n if Int(sender_map[\"deleted\"]) != 0 {\n warning LangRes(\"@1sender_deleted\", \"en\")\n }\n if Money(sender_map[\"amount\"]) < $Amount {\n warning LangRes(\"@1amount_less_than_needed\", \"en\")\n }\n }\n\n conditions {\n if $ecosystem_id == 1 {\n warning LangRes(\"@1burning_blocked\", \"en\")\n }\n\n checkSender() //check the sender\n\n //check amount\n if $Amount == 0 {\n warning LangRes(\"@1amount_zero\", \"en\")\n }\n if $Amount < 0 {\n warning LangRes(\"@1amount_less_zero\", \"en\")\n }\n\n $item = DBFind(\"@1ecosystems\").WhereId($ecosystem_id).Row()\n if $item[\"type_withdraw\"] == 1 {\n warning LangRes(\"@1burning_blocked\", \"en\")\n }\n }\n\n action {\n var mb map\n var burn map arr array\n burn[\"type\"] = \"burn\"\n burn[\"time\"] = Str($block_time)\n burn[\"val\"] = Money($Amount)\n arr = JSONDecode($item[\"emission_amount\"])\n arr = Append(arr, burn)\n mb[\"emission_amount\"] = JSONEncode(arr)\n DBUpdate(\"@1ecosystems\", $ecosystem_id, mb)\n\n var m map guest_account string\n guest_account = IdToAddress(Int($guest_key))\n m[\"sender_id\"] = AddressToId($account_id)\n m[\"recipient_id\"] = AddressToId(guest_account)\n m[\"amount\"] = $Amount\n m[\"comment\"] = \"New burn\"\n m[\"block_id\"] = $block\n m[\"txhash\"] = $txhash\n m[\"ecosystem\"] = $ecosystem_id\n m[\"type\"] = 4\n m[\"created_at\"] = $block_time\n DBInsert(\"@1history\", m)\n\n DBUpdateExt(\"@1keys\", {\"account\": $account_id, \"deleted\": 0, \"ecosystem\": $ecosystem_id}, {\"-amount\": $Amount})\n DBUpdateExt(\"@1keys\", {\"account\": guest_account, \"deleted\": 0, \"ecosystem\": $ecosystem_id}, {\"+amount\": $Amount})\n }\n}", "Type": "contracts" }, { "Name": "TeChange", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract TeChange {\n data {\n TypeChange string\n Value int\n }\n\n conditions {\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Token emission\"}).One(\"id\")\n var admin_ids string\n admin_ids = AppParam(Int($app), \"te_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+admin_ids+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->member_id\": $key_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n $item = DBFind(\"@1ecosystems\").WhereId($ecosystem_id).Row()\n if !$item {\n warning LangRes(\"@1emission_not_found\", \"en\")\n }\n\n if $Value < 1 || $Value > 2 {\n warning LangRes(\"@1value_between_1_and_2\", \"en\")\n }\n }\n\n action {\n var m map\n if $TypeChange == \"emission\" {\n m[\"type_emission\"] = $Value\n }\n if $TypeChange == \"withdraw\" {\n m[\"type_withdraw\"] = $Value\n }\n\n DBUpdate(\"@1ecosystems\", $ecosystem_id, m)\n }\n}", + "Value": "contract TeChange {\n data {\n TypeChange string\n Value int\n }\n\n conditions {\n $app = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"Token emission\"}).One(\"id\")\n var admin_ids string\n admin_ids = AppParam(Int($app), \"te_admin_role\", $ecosystem_id)\n var rids array\n rids = JSONDecode(\"[\"+admin_ids+\"]\")\n if !DBFind(\"@1roles_participants\").Where({\"ecosystem\": $ecosystem_id, \"role->id\": {\"$in\": rids}, \"member->account\": $account_id, \"deleted\": 0}).Row() {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n $item = DBFind(\"@1ecosystems\").WhereId($ecosystem_id).Row()\n if !$item {\n warning LangRes(\"@1emission_not_found\", \"en\")\n }\n\n if $Value < 1 || $Value > 2 {\n warning LangRes(\"@1value_between_1_and_2\", \"en\")\n }\n }\n\n action {\n var m map\n if $TypeChange == \"emission\" {\n m[\"type_emission\"] = $Value\n }\n if $TypeChange == \"withdraw\" {\n m[\"type_withdraw\"] = $Value\n }\n\n DBUpdate(\"@1ecosystems\", $ecosystem_id, m)\n }\n}", "Type": "contracts" }, { "Name": "TeCreate", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract TeCreate {\n data {\n Title string \"optional\"\n Amount money\n TypeWithdraw int \"optional\"\n TypeEmission int \"optional\"\n }\n\n func getEmissionConditionContract() string {\n var param map contractName string contractId int\n param = DBFind(\"@1parameters\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"emission_condition_contract\"}).Row()\n if param {\n contractName = param[\"value\"]\n if Size(contractName) > 0 {\n contractId = GetContractByName(contractName)\n if contractId == 0 {\n warning LangRes(\"@1emission_conditions_contract_not_found\", \"en\")\n }\n }\n }\n return contractName\n }\n\n func createEmissionConditionParam() {\n if !DBFind(\"@1parameters\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"emission_condition_contract\"}).Row(){\n @1NewParameter(\"Name,Value,Conditions\", \"emission_condition_contract\", \"AdminCondition\", \"ContractConditions(\\\"AdminCondition\\\")\")\n }\n }\n\n conditions {\n if $ecosystem_id == 1 {\n warning LangRes(\"@1emission_blocked\", \"en\")\n }\n\n $founder = Int(EcosysParam(\"founder_account\"))\n\n $item = DBFind(\"@1ecosystems\").WhereId($ecosystem_id).Row()\n $SECONDARY_EMISSION = $item[\"type_emission\"] == 1 || $item[\"type_emission\"] == 2\n\n if $SECONDARY_EMISSION {\n if $item[\"type_emission\"] == 1 {\n warning LangRes(\"@1emission_blocked\", \"en\")\n }\n } else {\n if Size($Title) == 0 {\n warning Sprintf(LangRes(\"@1template_creation_error_x_unspecified\", \"en\"), \"token_title\")\n }\n if $TypeWithdraw < 1 || $TypeWithdraw > 2 {\n warning Sprintf(LangRes(\"@1template_creation_error_x_unspecified\", \"en\"), \"type_withdraw\")\n }\n if $TypeEmission < 1 || $TypeEmission > 2 {\n warning Sprintf(LangRes(\"@1template_creation_error_x_unspecified\", \"en\"), \"type_emission\")\n }\n }\n }\n\n action {\n createEmissionConditionParam()\n\n var contract_name string\n contract_name = getEmissionConditionContract()\n ContractConditions(contract_name)\n\n var m emission map arr array\n emission[\"type\"] = \"emission\"\n emission[\"time\"] = Str($block_time)\n emission[\"val\"] = Money($Amount)\n if $SECONDARY_EMISSION {\n if $item[\"emission_amount\"] {\n arr = JSONDecode($item[\"emission_amount\"])\n }\n } else {\n m[\"type_emission\"] = $TypeEmission\n m[\"token_title\"] = $Title\n m[\"type_withdraw\"] = $TypeWithdraw\n }\n arr = Append(arr, emission)\n m[\"emission_amount\"] = JSONEncode(arr)\n DBUpdate(\"@1ecosystems\", $ecosystem_id, m)\n\n var h map\n h[\"sender_id\"] = 0\n h[\"recipient_id\"] = $founder\n h[\"amount\"] = Money($Amount)\n h[\"comment\"] = \"New emission\"\n h[\"block_id\"] = $block\n h[\"txhash\"] = $txhash\n h[\"ecosystem\"] = $ecosystem_id\n h[\"type\"] = 2\n h[\"created_at\"] = $block_time\n DBInsert(\"@1history\", h)\n\n DBUpdateExt(\"@1keys\", {\"ecosystem\": $ecosystem_id, \"id\": $founder}, {\"+amount\": $Amount})\n }\n}", + "Value": "contract TeCreate {\n data {\n Title string \"optional\"\n Amount money\n TypeWithdraw int \"optional\"\n TypeEmission int \"optional\"\n }\n\n func getEmissionConditionContract() string {\n var param map contractName string contractId int\n param = DBFind(\"@1parameters\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"emission_condition_contract\"}).Row()\n if param {\n contractName = param[\"value\"]\n if Size(contractName) > 0 {\n contractId = GetContractByName(contractName)\n if contractId == 0 {\n warning LangRes(\"@1emission_conditions_contract_not_found\", \"en\")\n }\n }\n }\n return contractName\n }\n\n func createEmissionConditionParam() {\n if !DBFind(\"@1parameters\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"emission_condition_contract\"}).Row(){\n @1NewParameter(\"Name,Value,Conditions\", \"emission_condition_contract\", \"AdminCondition\", \"ContractConditions(\\\"AdminCondition\\\")\")\n }\n }\n\n conditions {\n if $ecosystem_id == 1 {\n warning LangRes(\"@1emission_blocked\", \"en\")\n }\n\n $founder = Int(EcosysParam(\"founder_account\"))\n\n $item = DBFind(\"@1ecosystems\").WhereId($ecosystem_id).Row()\n $SECONDARY_EMISSION = $item[\"type_emission\"] == 1 || $item[\"type_emission\"] == 2\n\n if $SECONDARY_EMISSION {\n if $item[\"type_emission\"] == 1 {\n warning LangRes(\"@1emission_blocked\", \"en\")\n }\n } else {\n if Size($Title) == 0 {\n warning Sprintf(LangRes(\"@1template_creation_error_x_unspecified\", \"en\"), \"token_title\")\n }\n if $TypeWithdraw < 1 || $TypeWithdraw > 2 {\n warning Sprintf(LangRes(\"@1template_creation_error_x_unspecified\", \"en\"), \"type_withdraw\")\n }\n if $TypeEmission < 1 || $TypeEmission > 2 {\n warning Sprintf(LangRes(\"@1template_creation_error_x_unspecified\", \"en\"), \"type_emission\")\n }\n }\n }\n\n action {\n createEmissionConditionParam()\n\n var contract_name string\n contract_name = getEmissionConditionContract()\n ContractConditions(contract_name)\n\n var m emission map arr array\n emission[\"type\"] = \"emission\"\n emission[\"time\"] = Str($block_time)\n emission[\"val\"] = Money($Amount)\n if $SECONDARY_EMISSION {\n if $item[\"emission_amount\"] {\n arr = JSONDecode($item[\"emission_amount\"])\n }\n } else {\n m[\"type_emission\"] = $TypeEmission\n m[\"token_title\"] = $Title\n m[\"type_withdraw\"] = $TypeWithdraw\n }\n arr = Append(arr, emission)\n m[\"emission_amount\"] = JSONEncode(arr)\n DBUpdate(\"@1ecosystems\", $ecosystem_id, m)\n\n var h map\n h[\"sender_id\"] = 0\n h[\"recipient_id\"] = $founder\n h[\"amount\"] = Money($Amount)\n h[\"comment\"] = \"New emission\"\n h[\"block_id\"] = $block\n h[\"txhash\"] = $txhash\n h[\"ecosystem\"] = $ecosystem_id\n h[\"type\"] = 2\n h[\"created_at\"] = $block_time\n DBInsert(\"@1history\", h)\n\n $founder = IdToAddress($founder)\n DBUpdateExt(\"@1keys\", {\"ecosystem\": $ecosystem_id, \"account\": $founder, \"deleted\": 0}, {\"+amount\": $Amount})\n }\n}", "Type": "contracts" }, { diff --git a/platform_apps/token_emission/contracts/TeBurn.sim b/platform_apps/token_emission/contracts/TeBurn.sim index 5357e12cd..577a5772c 100644 --- a/platform_apps/token_emission/contracts/TeBurn.sim +++ b/platform_apps/token_emission/contracts/TeBurn.sim @@ -5,10 +5,10 @@ contract TeBurn { func checkSender() { var sender_map map - sender_map = DBFind("@1keys").Where({"id": $key_id, "ecosystem": $ecosystem_id}).Row() + sender_map = DBFind("@1keys").Where({"account": $account_id, "deleted": 0, "ecosystem": $ecosystem_id}).Row() if !sender_map { - warning Sprintf(LangRes("@1sender_x_invalid", "en"), $key_id) + warning Sprintf(LangRes("@1sender_x_invalid", "en"), $account_id) } if Int(sender_map["blocked"]) != 0 { warning LangRes("@1sender_blocked", "en") @@ -53,9 +53,10 @@ contract TeBurn { mb["emission_amount"] = JSONEncode(arr) DBUpdate("@1ecosystems", $ecosystem_id, mb) - var m map - m["sender_id"] = $key_id - m["recipient_id"] = $guest_key + var m map guest_account string + guest_account = IdToAddress(Int($guest_key)) + m["sender_id"] = AddressToId($account_id) + m["recipient_id"] = AddressToId(guest_account) m["amount"] = $Amount m["comment"] = "New burn" m["block_id"] = $block @@ -65,7 +66,7 @@ contract TeBurn { m["created_at"] = $block_time DBInsert("@1history", m) - DBUpdateExt("@1keys", {"id": $key_id, "ecosystem": $ecosystem_id}, {"-amount": $Amount}) - DBUpdateExt("@1keys", {"id": $guest_key, "ecosystem": $ecosystem_id}, {"+amount": $Amount}) + DBUpdateExt("@1keys", {"account": $account_id, "deleted": 0, "ecosystem": $ecosystem_id}, {"-amount": $Amount}) + DBUpdateExt("@1keys", {"account": guest_account, "deleted": 0, "ecosystem": $ecosystem_id}, {"+amount": $Amount}) } } \ No newline at end of file diff --git a/platform_apps/token_emission/contracts/TeChange.sim b/platform_apps/token_emission/contracts/TeChange.sim index 04735b302..ef818f014 100644 --- a/platform_apps/token_emission/contracts/TeChange.sim +++ b/platform_apps/token_emission/contracts/TeChange.sim @@ -10,7 +10,7 @@ contract TeChange { admin_ids = AppParam(Int($app), "te_admin_role", $ecosystem_id) var rids array rids = JSONDecode("["+admin_ids+"]") - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() { warning LangRes("@1access_denied", "en") } diff --git a/platform_apps/token_emission/contracts/TeCreate.sim b/platform_apps/token_emission/contracts/TeCreate.sim index abe545ba3..f8abf2a82 100644 --- a/platform_apps/token_emission/contracts/TeCreate.sim +++ b/platform_apps/token_emission/contracts/TeCreate.sim @@ -90,6 +90,7 @@ contract TeCreate { h["created_at"] = $block_time DBInsert("@1history", h) - DBUpdateExt("@1keys", {"ecosystem": $ecosystem_id, "id": $founder}, {"+amount": $Amount}) + $founder = IdToAddress($founder) + DBUpdateExt("@1keys", {"ecosystem": $ecosystem_id, "account": $founder, "deleted": 0}, {"+amount": $Amount}) } } \ No newline at end of file diff --git a/platform_apps/token_emission/pages/te_create.ptl b/platform_apps/token_emission/pages/te_create.ptl index 289173e7e..0a2a4f637 100644 --- a/platform_apps/token_emission/pages/te_create.ptl +++ b/platform_apps/token_emission/pages/te_create.ptl @@ -1,7 +1,7 @@ -DBFind(@1applications).Columns("id").Where({"name": "Token emission", "deleted": 0, "ecosystem": 1}).Vars(application) +DBFind("@1applications").Where({"name": "Token emission", "deleted": 0, "ecosystem": 1}).Columns("id").Vars(application) AppParam(App:#application_id#, Name:type_emission, Source:type_emission, Ecosystem:1) AppParam(App:#application_id#, Name:type_withdraw, Source:type_withdraw, Ecosystem:1) -DBFind(@1ecosystems).WhereId(#ecosystem_id#).Vars(e) +DBFind("@1ecosystems").WhereId(#ecosystem_id#).Vars(e) Form(){ Div(row){ diff --git a/platform_apps/token_emission/pages/te_edit.ptl b/platform_apps/token_emission/pages/te_edit.ptl index 1a328ec7d..0a579575b 100644 --- a/platform_apps/token_emission/pages/te_edit.ptl +++ b/platform_apps/token_emission/pages/te_edit.ptl @@ -1,7 +1,7 @@ -DBFind(@1applications).Columns("id").Where({"name": "Token emission", "deleted": 0, "ecosystem": 1}).Vars(application) +DBFind("@1applications").Where({"name": "Token emission", "deleted": 0, "ecosystem": 1}).Columns("id").Vars(application) AppParam(App:#application_id#, Name:type_emission, Source:type_emission, Ecosystem:1) AppParam(App:#application_id#, Name:type_withdraw, Source:type_withdraw, Ecosystem:1) -DBFind(@1ecosystems).WhereId(#ecosystem_id#).Vars(e) +DBFind("@1ecosystems").WhereId(#ecosystem_id#).Vars(e) Form(){ Input(Name: TypeChange, Type: Hidden, Value: #TypeChange#) diff --git a/platform_apps/token_emission/pages/te_settings.ptl b/platform_apps/token_emission/pages/te_settings.ptl index 3b7ff7344..ae3734c92 100644 --- a/platform_apps/token_emission/pages/te_settings.ptl +++ b/platform_apps/token_emission/pages/te_settings.ptl @@ -1,9 +1,9 @@ -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Token emission"}).Vars("app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Token emission"}).Vars(app) SetVar(this_page, "@1te_settings").(te_admin_role,0) SetVar(te_admin_role, AppParam(App: #app_id#, Name: "te_admin_role")) -DBFind("@1roles", src_roles).Where({"ecosystem": #ecosystem_id#, "deleted": 0}).Columns("role_name,id").Limit(100) +DBFind("@1roles", src_roles).Where({"ecosystem": "#ecosystem_id#", "deleted": 0}).Columns("role_name,id").Limit(100) SetVar(row,"row mt-sm").(col_left,"col-sm-4 text-right mt-sm").(col_right,"col-sm-8 text-left") @@ -29,7 +29,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#te_admin_role# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #te_admin_role#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#te_admin_role#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# diff --git a/platform_apps/token_emission/pages/te_view.ptl b/platform_apps/token_emission/pages/te_view.ptl index b2df99abe..39956eeb4 100644 --- a/platform_apps/token_emission/pages/te_view.ptl +++ b/platform_apps/token_emission/pages/te_view.ptl @@ -1,7 +1,7 @@ -DBFind(@1applications).Columns("id").Where({"name": "Token emission", "deleted": 0, "ecosystem": 1}).Vars(application) +DBFind("@1applications").Where({"name": "Token emission", "deleted": 0, "ecosystem": 1}).Columns("id").Vars(application) AppParam(App:#application_id#, Name:type_emission, Source:type_emission, Ecosystem:1) AppParam(App:#application_id#, Name:type_withdraw, Source:type_withdraw, Ecosystem:1) -DBFind(@1ecosystems).WhereId(#ecosystem_id#).Vars(e) +DBFind("@1ecosystems").WhereId(#ecosystem_id#).Vars(e) SetTitle($@1emission_tokens$) If(#e_type_emission#>0){ @@ -12,9 +12,9 @@ If(#e_type_emission#>0){ AddToolButton(Page: @1te_create, Icon: icon-plus, Title: $@1emission_new$).Popup(50, $@1emission_new$) } }.Else{ - DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "Token emission"}).Vars(ecosystem_application) + DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Token emission"}).Vars(ecosystem_application) SetVar(admin_roles, AppParam(Ecosystem: #ecosystem_id#, App: #ecosystem_application_id#, Name: te_admin_role)) - DBFind("@1roles_participants").Where({"ecosystem": #ecosystem_id#, "$and": ["role->id": {"$in": [#admin_roles#]}, "role->id": #role_id#], "member->member_id": #key_id#, "deleted": 0}).Vars(admin_access) + DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#admin_roles#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) If(#admin_access_id# > 0){ AddToolButton(Page: @1te_create, Icon: icon-plus, Title: $@1emission_new$).Popup(50, $@1emission_new$) } diff --git a/src/basic/app_params/voting_template_validators.csv b/src/basic/app_params/voting_template_consortium_member.csv similarity index 100% rename from src/basic/app_params/voting_template_validators.csv rename to src/basic/app_params/voting_template_consortium_member.csv diff --git a/src/basic/blocks/notifications_roles.ptl b/src/basic/blocks/notifications_roles.ptl index 9b4a69869..e309bdfa3 100644 --- a/src/basic/blocks/notifications_roles.ptl +++ b/src/basic/blocks/notifications_roles.ptl @@ -2,15 +2,15 @@ SetVar(this_page, @1notifications_list).(this_table, @1notifications) Include(@1pager_header) If(#role_id#>0){ - DBFind(@1roles).Where({"id": #role_id#}).Vars(my) + DBFind("@1roles").Where({"id": "#role_id#"}).Vars(my) SetTitle($@1role_notifics$ (#my_role_name#)) }.Else{ SetTitle($@1role_notifics$) } -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "System"}).Vars("system_app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(system_app) SetVar(role_admin, AppParam(App: #system_app_id#, Name: "role_admin")) If(And(#role_id# == #role_admin#, #ecosystem_id# == 1)){ - DBFind(@1ecosystems).Count(ecos_count) + DBFind("@1ecosystems").Count(ecos_count) If(#ecos_count#>1){ AddToolButton(Title: $@1broadcast$, Page: @1notifications_broadcast, Icon: icon-plus).Popup(Header: $@1notifications_broadcast$, Width: "50") } @@ -18,9 +18,9 @@ If(And(#role_id# == #role_admin#, #ecosystem_id# == 1)){ AddToolButton(Title: $@1send$, Page: @1notifications_roles_send, Icon: icon-plus).Popup(Header: $@1send$, Width: "50") If(#search#){ - SetVar(where, {"ecosystem": #ecosystem_id#, "recipient->role_id": #role_id#, {"$and": [{"notification->type":2}, {"$or": [{"sender->member_name":{"$ilike": "#search#"}}, {"sender->role_name":{"$ilike": "#search#"}}]}]}}) + SetVar(where, {"ecosystem": "#ecosystem_id#", "recipient->role_id": "#role_id#", "$and": [{"notification->type": 2}, {"$or": [{"sender->member_name": {"$ilike": "#search#"}}, {"sender->role_name": {"$ilike": "#search#"}}]}]}) }.Else{ - SetVar(where, {"ecosystem": #ecosystem_id#, "notification->type": 2, "recipient->role_id": #role_id#}) + SetVar(where, {"ecosystem": "#ecosystem_id#", "notification->type": 2, "recipient->role_id": "#role_id#"}) } Div(list-group-item ml-lg mr-lg pt-lg){ @@ -28,7 +28,7 @@ Div(list-group-item ml-lg mr-lg pt-lg){ Include(@1search) } -DBFind(#this_table#, src).Where(#where#).Order([{closed:"1"},{id:"-1"}]).Limit(#pager_limit#).Offset(#pager_offset#).Columns("id,recipient->role_id,recipient->role_name,recipient->image_id,sender->type,sender->member_id,sender->member_name,sender->role_id,sender->role_name,notification->icon,notification->popup,page_name,page_params,date_created,date_closed,date_start_processing,processing_info->member_name,closed").Custom(_id){ +DBFind(#this_table#, src).Where(#where#).Order({"closed": 1, "id": "-1"}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("id,recipient->role_id,recipient->role_name,recipient->image_id,sender->type,sender->account,sender->member_name,sender->role_id,sender->role_name,notification->icon,notification->popup,page_name,page_params,date_created,date_closed,date_start_processing,processing_info->member_name,closed").Custom(_id){ If(#closed# == 0){ SetVar(style_text,"text-normal").(style_link,"text-primary") }.Else{ @@ -51,7 +51,7 @@ DBFind(#this_table#, src).Where(#where#).Order([{closed:"1"},{id:"-1"}]).Limit(# Em(Class: fa fa-long-arrow-right fa-1x #style_text#) }.Custom(_sender){ If(#sender.type#==1){ - LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#sender.member_id#"){#sender.member_name#} + LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: "v_account=#sender.account#"){#sender.member_name#} } If(#sender.type#==2){ LinkPage(Class: #style_link# h5 text-bold, Page: @1roles_view, PageParams: "v_role_id=#sender.role_id#"){#sender.role_name#} diff --git a/src/basic/blocks/notifications_single.ptl b/src/basic/blocks/notifications_single.ptl index 127100333..ddfd3523f 100644 --- a/src/basic/blocks/notifications_single.ptl +++ b/src/basic/blocks/notifications_single.ptl @@ -2,10 +2,10 @@ SetVar(this_page, @1notifications_list).(this_table, @1notifications) Include(@1pager_header) SetTitle("$@1personal_notifics$") -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "System"}).Vars("system_app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(system_app) SetVar(role_admin, AppParam(App: #system_app_id#, Name: "role_admin")) If(And(#role_id# == #role_admin#, #ecosystem_id# == 1)){ - DBFind(@1ecosystems).Count(ecos_count) + DBFind("@1ecosystems").Count(ecos_count) If(#ecos_count#>1){ AddToolButton(Title: $@1broadcast$, Page: @1notifications_broadcast, Icon: icon-plus).Popup(Header: $@1notifications_broadcast$, Width: "50") } @@ -13,9 +13,9 @@ If(And(#role_id# == #role_admin#, #ecosystem_id# == 1)){ AddToolButton(Title: $@1send$, Page: @1notifications_single_send, Icon: icon-plus).Popup(Header: $@1send$, Width: "50") If(#search#){ - SetVar(where, {"ecosystem": #ecosystem_id#, "recipient->member_id": #key_id#, {"$and": [{"notification->type":1}, {"$or": [{"sender->member_name":{"$ilike": "#search#"}}, {"sender->role_name":{"$ilike": "#search#"}}]}]}}) + SetVar(where, {"ecosystem": "#ecosystem_id#", "recipient->account": "#account_id#", "$and": [{"notification->type": 1}, {"$or": [{"sender->member_name": {"$ilike": "#search#"}}, {"sender->role_name": {"$ilike": "#search#"}}]}]}) }.Else{ - SetVar(where, {"ecosystem": #ecosystem_id#, "notification->type": 1, "recipient->member_id": #key_id#}) + SetVar(where, {"ecosystem": "#ecosystem_id#", "notification->type": 1, "recipient->account": "#account_id#"}) } Div(list-group-item ml-lg mr-lg pt-lg){ @@ -23,7 +23,7 @@ Div(list-group-item ml-lg mr-lg pt-lg){ Include(@1search) } -DBFind(#this_table#, src).Where(#where#).Order([{closed:"1"}, {id:"-1"}]).Limit(#pager_limit#).Offset(#pager_offset#).Columns("id,recipient->member_id,recipient->member_name,recipient->image_id,sender->type,sender->member_id,sender->member_name,sender->role_id,sender->role_name,notification->icon,notification->popup,page_name,page_params,date_created,date_closed,closed").Custom(custom_id){ +DBFind(#this_table#, src).Where(#where#).Order({"closed": 1, "id": "-1"}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("id,recipient->account,recipient->member_name,recipient->image_id,sender->type,sender->account,sender->member_name,sender->role_id,sender->role_name,notification->icon,notification->popup,page_name,page_params,date_created,date_closed,closed").Custom(custom_id){ If(#closed# == 0){ SetVar(Name: style_text, Value: "text-normal") SetVar(Name: style_link, Value: "text-primary") @@ -33,7 +33,7 @@ DBFind(#this_table#, src).Where(#where#).Order([{closed:"1"}, {id:"-1"}]).Limit( } Span(Class: #style_text#, Body: #id#) }.Custom(custom_recipient){ - LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#recipient.member_id#"){ + LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: "v_account=#recipient.account#"){ If(#recipient.image_id#>0){ Image(Src: Binary().ById(#recipient.image_id#), Class: img-circle).Style(width: 30px; border: 1px solid #5A5D63; margin-right: 10px;) Span(#recipient.member_name#) @@ -48,7 +48,7 @@ DBFind(#this_table#, src).Where(#where#).Order([{closed:"1"}, {id:"-1"}]).Limit( Em(Class: fa fa-long-arrow-right fa-1x #style_text#) }.Custom(custom_sender){ If(#sender.type#==1){ - LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#sender.member_id#"){ + LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: "v_account=#sender.account#"){ Span(Body: #sender.member_name#) } } diff --git a/src/basic/blocks/profile.ptl b/src/basic/blocks/profile.ptl index 6bc96317c..f96783611 100644 --- a/src/basic/blocks/profile.ptl +++ b/src/basic/blocks/profile.ptl @@ -1,10 +1,9 @@ -If(Or(#v_key_id# > 0, #v_key_id# < 0)){ -}.Else{ - SetVar(v_key_id, #key_id#) +If(#v_account# == ""){ + SetVar(v_account, #account_id#) } -DBFind(@1members).Where({"ecosystem": #ecosystem_id#, "id": #v_key_id#}).Columns("id,image_id,member_name,member_info->information").Vars(member) +DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#v_account#"}).Columns("account,image_id,member_name,member_info->information").Vars(member) -If(Or(#member_id# > 0, #member_id# < 0)){ +If(#member_account#){ SetVar(member_name, #member_member_name#).(member_info, #member_member_info_information#) } @@ -18,8 +17,8 @@ Div(content-wrapper){ } Div(row mt-lg){ Div(col-md-12 text-center){ - If(Or(#member_id# > 0, #member_id# < 0)){ - If(#member_id# == #key_id#){ + If(#member_account#){ + If(#member_account# == #account_id#){ Button(Class: btn btn-link, Page: @1profile_edit){ If(#member_image_id# > 0){ Image(Src: Binary().ById(#member_image_id#), Class: img-thumbnail).Style(width: 120px; border: 1px solid #5A5D63;) @@ -29,7 +28,7 @@ Div(content-wrapper){ Div(m0 h4 text-bold){ #member_name# If(#role_id# > 0){ - DBFind(@1roles).Where({"ecosystem": #ecosystem_id#, "id": #role_id#}).Columns("role_name").Vars(role) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#role_id#"}).Columns("role_name").Vars(role) Span(Body: " (#role_role_name#)") } } @@ -44,7 +43,7 @@ Div(content-wrapper){ } Div(Class: h5 text-muted m0, Body: #member_info#) }.Else{ - If(#v_key_id# == #key_id#){ + If(#v_account# == #account_id#){ Button(Class: btn btn-link, Page: @1profile_edit){ Div(Class: h4 m0, Body: LangRes(@1edit_profile)) }.Popup(Header: $@1edit_profile$, Width: 50) @@ -55,16 +54,16 @@ Div(content-wrapper){ Div(row mt-lg){ Div(col-md-12 text-center){ Div(text-bold m0 h5, Body: LangRes(@1wallet_address)) - Span(Class: h5, Body: Address(#v_key_id#)) + Span(Class: h5, Body: #v_account#) } } - If(#v_key_id# == #key_id#){ + If(#v_account# == #account_id#){ Div(row){ Div(col-md-12 mt text-center){ - DBFind(@1keys).Where({"ecosystem": 1, "id": #v_key_id#}).Vars(apl) + DBFind("@1keys").Where({"ecosystem": 1, "account": "#v_account#", "deleted": 0}).Vars(apl) If(#ecosystem_id# > 1){ - DBFind("@1keys").Where({"ecosystem": #ecosystem_id#, "id": #v_key_id#}).Vars("tokens") - DBFind("@1ecosystems").Where({"id": #ecosystem_id#}).Vars("custom") + DBFind("@1keys").Where({"ecosystem": "#ecosystem_id#", "account": "#v_account#", "deleted": 0}).Vars(tokens) + DBFind("@1ecosystems").Where({"id": "#ecosystem_id#"}).Vars(custom) } Div(text-bold m0 h5, Body: LangRes(@1balance)) Div(Class: m0 h5, Body: Money(#apl_amount#) APLA) @@ -86,9 +85,9 @@ Div(content-wrapper){ } Div(list-group-item text-center mt-lg){ Div(text-bold m0 h5, Body: LangRes(@1roles)) - DBFind(@1roles_participants).Where({"ecosystem": #ecosystem_id#, "member->member_id": #v_key_id#, "deleted": 0}).Columns("id").Vars(check) + DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "member->account": "#v_account#", "deleted": 0}).Columns("id").Vars(check) If(#check_id# > 0){ - DBFind(@1roles_participants,src_roles).Where({"ecosystem": #ecosystem_id#, "member->member_id":#v_key_id#, "deleted": 0}).Columns("role->id,role->name").Order("id") + DBFind("@1roles_participants", src_roles).Where({"ecosystem": "#ecosystem_id#", "member->account": "#v_account#", "deleted": 0}).Columns("role->id,role->name").Order("id") ForList(src_roles){ Span(){ LinkPage(Class: h6 m0 text-primary, Page: @1roles_view, PageParams: "v_role_id=#role.id#", Body: "#role.name#") @@ -97,9 +96,9 @@ Div(content-wrapper){ }.Else{ Span(LangRes(@1role_none)) } - If(#v_key_id# == #key_id#){ - SetVar(founder_account, EcosysParam("founder_account")) - If(#founder_account# != #key_id#){ + If(#v_account# == #account_id#){ + SetVar(founder_account, Address(EcosysParam("founder_account"))) + If(#founder_account# != #account_id#){ Div(row){ Div(col-md-12 text-center){ Button(Class: btn-xs btn-link, Page: @1roles_request, Body: LangRes(@1request)).Popup(Header: $@1request_to_role$, Width: "50") diff --git a/src/basic/config.json b/src/basic/config.json index 8d26d1415..e125b2ee0 100644 --- a/src/basic/config.json +++ b/src/basic/config.json @@ -41,11 +41,11 @@ "Conditions": "ContractConditions(\"@1DeveloperCondition\")" }, { - "Name": "ValidatorDelete", + "Name": "ConsortiumMemberDelete", "Conditions": "ContractConditions(\"@1DeveloperCondition\")" }, { - "Name": "ValidatorRequest", + "Name": "ConsortiumMemberRequest", "Conditions": "ContractConditions(\"@1DeveloperCondition\")" }, { @@ -221,7 +221,7 @@ "Conditions": "ContractConditions(\"@1DeveloperCondition\")" }, { - "Name": "ValidatorResign", + "Name": "ConsortiumMemberResign", "Conditions": "ContractConditions(\"@1DeveloperCondition\")" }, { @@ -265,11 +265,11 @@ "Conditions": "ContractConditions(\"@1DeveloperCondition\")" }, { - "Name": "VotingRunNewValidator", + "Name": "VotingRunNewConsortiumMember", "Conditions": "ContractConditions(\"@1DeveloperCondition\")" }, { - "Name": "VotingRunRemoveValidator", + "Name": "VotingRunRemoveConsortiumMember", "Conditions": "ContractConditions(\"@1DeveloperCondition\")" }, { @@ -321,7 +321,7 @@ "Conditions": "ContractConditions(\"@1DeveloperCondition\")" }, { - "Name": "VotingValidatorAccept", + "Name": "VotingConsortiumMemberAccept", "Conditions": "ContractConditions(\"@1DeveloperCondition\")" }, { @@ -559,12 +559,12 @@ "Menu": "default_menu" }, { - "Name": "validator_candidates_create", + "Name": "consortium_member_request", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", "Menu": "admin_menu" }, { - "Name": "validator_candidates_list", + "Name": "consortium_member_candidates", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", "Menu": "admin_menu" }, @@ -579,7 +579,7 @@ "Menu": "admin_menu" }, { - "Name": "validator_resign", + "Name": "consortium_member_resign", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", "Menu": "admin_menu" }, @@ -697,9 +697,9 @@ "Permissions": "{\"insert\": \"ContractAccess(\\\"@1VotingSubjectCandidates\\\",\\\"@1VotingSubjectContract\\\",\\\"@1VotingSubjectDocument\\\")\", \"update\": \"ContractAccess(\\\"@1VotingCandidateAccept\\\",\\\"@1VotingDecisionAccept\\\",\\\"@1VotingDecisionReject\\\",\\\"@1VotingSubjectContract\\\",\\\"@1VotingSubjectDocument\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}" }, { - "Name": "validator_candidates", + "Name": "consortium_member_requests", "Conditions": "ContractAccess(\"@1EditTable\")", - "Permissions": "{\"insert\": \"ContractAccess(\\\"@1ValidatorRequest\\\")\", \"update\": \"ContractAccess(\\\"@1ValidatorDelete\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}" + "Permissions": "{\"insert\": \"ContractAccess(\\\"@1ConsortiumMemberRequest\\\")\", \"update\": \"ContractAccess(\\\"@1ConsortiumMemberDelete\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}" }, { "Name": "tokens_refund", @@ -812,7 +812,7 @@ "Conditions": "ContractConditions(\"@1DeveloperCondition\")" }, { - "Name": "voting_template_validators", + "Name": "voting_template_consortium_member", "Conditions": "ContractConditions(\"@1DeveloperCondition\")" }, { @@ -820,4 +820,4 @@ "Conditions": "ContractConditions(\"@1DeveloperCondition\")" } ] -} +} \ No newline at end of file diff --git a/src/basic/contracts/BlockMember.sim b/src/basic/contracts/BlockMember.sim index adbcf95ed..abf6cde3f 100644 --- a/src/basic/contracts/BlockMember.sim +++ b/src/basic/contracts/BlockMember.sim @@ -1,6 +1,6 @@ contract BlockMember { data { - KeyId int + MemberAccount string Value int } @@ -9,6 +9,6 @@ contract BlockMember { } action { - @1TokensLockoutMember("KeyId,Value", $KeyId, $Value) + @1TokensLockoutMember("MemberAccount,Value", $MemberAccount, $Value) } } \ No newline at end of file diff --git a/src/basic/contracts/BufferManager.sim b/src/basic/contracts/BufferManager.sim index 78a51f654..ee3ef34d2 100644 --- a/src/basic/contracts/BufferManager.sim +++ b/src/basic/contracts/BufferManager.sim @@ -15,13 +15,13 @@ contract BufferManager { action { $emptyVal = JSONEncode("") - $buf = DBFind("@1buffer_data").Where({"ecosystem": $ecosystem_id, "key": $Key, "member_id": $key_id}).Row() + $buf = DBFind("@1buffer_data").Where({"ecosystem": $ecosystem_id, "key": $Key, "account": $account_id}).Row() if !$buf { var buf map, id int - id = DBInsert("@1buffer_data", {ecosystem:$ecosystem_id, key:$Key, value:$emptyVal, member_id:$key_id}) + id = DBInsert("@1buffer_data", {ecosystem: $ecosystem_id, key: $Key, value: $emptyVal, account: $account_id}) buf["id"] = Str(id) buf["value"] = "" - buf["member_id"] = Str($key_id) + buf["account"] = Str($account_id) buf["key"] = Str($Key) $buf = buf } diff --git a/src/basic/contracts/ConsortiumMemberDelete.sim b/src/basic/contracts/ConsortiumMemberDelete.sim new file mode 100644 index 000000000..6bceda0aa --- /dev/null +++ b/src/basic/contracts/ConsortiumMemberDelete.sim @@ -0,0 +1,22 @@ +contract ConsortiumMemberDelete { + data { + Id int + } + + conditions { + $system_app_id = DBFind("@1applications").Where({"ecosystem": $ecosystem_id, "name": "System"}).One("id") + var roleId int candidateAccount string + roleId = Int(AppParam(Int($system_app_id), "role_consortium_member_candidate", $ecosystem_id)) + candidateAccount = DBFind("@1consortium_member_requests").Where({"ecosystem": $ecosystem_id, "id": $Id}).One("candidate_account") + + $role = DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "deleted": 0, "role->id": roleId, "member->account": candidateAccount}).Row() + if !$role { + warning LangRes("@1candidate_role_not_found", "en") + } + } + + action { + DBUpdate("@1consortium_member_requests", $Id, {"deleted": 1}) + @1RolesUnassign("RowId", Int($role["id"])) + } +} \ No newline at end of file diff --git a/src/basic/contracts/ValidatorRequest.sim b/src/basic/contracts/ConsortiumMemberRequest.sim similarity index 70% rename from src/basic/contracts/ValidatorRequest.sim rename to src/basic/contracts/ConsortiumMemberRequest.sim index 51abc3a58..99b417524 100644 --- a/src/basic/contracts/ValidatorRequest.sim +++ b/src/basic/contracts/ConsortiumMemberRequest.sim @@ -1,8 +1,8 @@ -contract ValidatorRequest { +contract ConsortiumMemberRequest { data { TcpAddress string ApiAddress string - KeyId int + CandidateAccount string PubKey string Description string "optional" Comment string "optional" @@ -12,7 +12,7 @@ contract ValidatorRequest { if $ecosystem_id != 1 { warning LangRes("@1contract_first_ecosystem_only", "en") } - if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": $KeyId}).Row() { + if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": $CandidateAccount, "deleted": 0}).Row() { warning LangRes("@1address_invalid", "en") } } @@ -20,14 +20,14 @@ contract ValidatorRequest { action { $system_app_id = DBFind("@1applications").Where({"ecosystem": $ecosystem_id, "name": "System"}).One("id") var roleId int - roleId = Int(AppParam(Int($system_app_id), "role_candidate_for_validators", $ecosystem_id)) + roleId = Int(AppParam(Int($system_app_id), "role_consortium_member_candidate", $ecosystem_id)) if !DBFind("@1roles").Where({"ecosystem": 1, "id": roleId, "deleted": 0}).One("id") { - warning Sprintf(LangRes("@1role_app_param_not_found", "en"), "role_candidate_for_validators") + warning Sprintf(LangRes("@1role_app_param_not_found", "en"), "role_consortium_member_candidate") } - @1RolesAssign("Rid,MemberId", roleId, $key_id) + @1RolesAssign("Rid,MemberAccount", roleId, $account_id) var m map - m["candidate_key_id"] = $KeyId + m["candidate_account"] = $CandidateAccount m["tcp_address"] = $TcpAddress m["api_address"] = $ApiAddress m["pub_key"] = $PubKey @@ -35,6 +35,6 @@ contract ValidatorRequest { m["comment"] = $Comment m["date_created"] = $block_time m["deleted"] = 0 - DBInsert("@1validator_candidates", m) + DBInsert("@1consortium_member_requests", m) } } \ No newline at end of file diff --git a/src/basic/contracts/ValidatorResign.sim b/src/basic/contracts/ConsortiumMemberResign.sim similarity index 61% rename from src/basic/contracts/ValidatorResign.sim rename to src/basic/contracts/ConsortiumMemberResign.sim index 62dcd5b99..17950c551 100644 --- a/src/basic/contracts/ValidatorResign.sim +++ b/src/basic/contracts/ConsortiumMemberResign.sim @@ -1,4 +1,4 @@ -contract ValidatorResign { +contract ConsortiumMemberResign { func getRoleId(name string) int { var rid int @@ -11,12 +11,12 @@ contract ValidatorResign { conditions { $system_app_id = DBFind("@1applications").Where({"ecosystem": $ecosystem_id, "name": "System"}).One("id") - var roleValidatorId int - roleValidatorId = getRoleId("role_validator") - if !RoleAccess(roleValidatorId) { - warning LangRes("@1not_validator_can_not_run", "en") + var roleConsortiumMember int + roleConsortiumMember = getRoleId("role_consortium_member") + if !RoleAccess(roleConsortiumMember) { + warning LangRes("@1consortium_members_only", "en") } - $assigned = DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "member->member_id": $key_id, "role->id": roleValidatorId, "deleted": 0}).One("id") + $assigned = DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "member->account": $account_id, "role->id": roleConsortiumMember, "deleted": 0}).One("id") } action { diff --git a/src/basic/contracts/DelegateRefresh.sim b/src/basic/contracts/DelegateRefresh.sim index 910c0c8a8..cb16f8372 100644 --- a/src/basic/contracts/DelegateRefresh.sim +++ b/src/basic/contracts/DelegateRefresh.sim @@ -53,12 +53,14 @@ contract DelegateRefresh { // remove old role assigns rid = Int($role["id"]) - currentDelegates = DBFind("@1roles_participants").Where({"role->id": rid, "deleted": 0}).Columns("id,member->member_id") + currentDelegates = DBFind("@1roles_participants").Where({"role->id": rid, "deleted": 0}).Columns("id,member->account") var delegate map id int i = 0 while i < Len(currentDelegates) { delegate = currentDelegates[i] - if notInArray(delegate["member.member_id"], delegateIds){ + var memberKey string + memberKey = Str(AddressToId(delegate["member.account"])) + if notInArray(memberKey, delegateIds){ id = Int(delegate["id"]) @1RolesUnassign("RowId", id) } @@ -70,11 +72,13 @@ contract DelegateRefresh { i = 0 while i < Len(delegateIds) { delegateId = Int(delegateIds[i]) - key = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": delegateId}).Row() + var delegateAccount string + delegateAccount = IdToAddress(delegateId) + key = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": delegateAccount, "deleted": 0}).Row() if key { // check role dup - if !DBFind("@1roles_participants").Where({"member->member_id": delegateId, "role->id": rid, "deleted": 0}).Row(){ - @1RolesAssign("Rid,MemberId", rid, Int(key["id"])) + if !DBFind("@1roles_participants").Where({"member->account": delegateAccount, "role->id": rid, "deleted": 0}).Row(){ + @1RolesAssign("Rid,MemberAccount", rid, delegateAccount) } } i = i + 1 diff --git a/src/basic/contracts/DeleteMember.sim b/src/basic/contracts/DeleteMember.sim index 4e42c5f48..4e1fb2b58 100644 --- a/src/basic/contracts/DeleteMember.sim +++ b/src/basic/contracts/DeleteMember.sim @@ -1,6 +1,6 @@ contract DeleteMember { data { - KeyId int + MemberAccount string } func getPermission() { @@ -14,7 +14,7 @@ contract DeleteMember { while i < Len(array_permissions) { var contract_name string contract_name = array_permissions[i] - if contract_name==prevContract { + if contract_name == prevContract { result = 1 } i = i + 1 @@ -30,12 +30,12 @@ contract DeleteMember { getPermission() - if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": $KeyId}).One("id"){ - warning LangRes("@1key_not_found", "en") + if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": $MemberAccount}).One("account"){ + warning LangRes("@1account_not_found", "en") } } action { - DBUpdateExt("@1keys", {"ecosystem": $ecosystem_id, "id": $KeyId}, {"deleted": 1}) + DBUpdateExt("@1keys", {"ecosystem": $ecosystem_id, "account": $MemberAccount}, {"deleted": 1}) } } \ No newline at end of file diff --git a/src/basic/contracts/FormStateSave.sim b/src/basic/contracts/FormStateSave.sim index 2e2ef75c2..49cb96aaa 100644 --- a/src/basic/contracts/FormStateSave.sim +++ b/src/basic/contracts/FormStateSave.sim @@ -34,14 +34,13 @@ contract FormStateSave { } action { - var values string - values = $Param1+";"+$Param2+";"+ $Param3+";"+ $Param4+";"+ $Param5+";"+ $Param6+";"+$Param7+";"+$Param8+";"+$Param9+";"+$Param10+";"+$Param11+";"+$Param12+";"+$Param13+";"+ $Param14+";"+ $Param15+";"+ $Param16+";"+$Param17+";"+$Param18+";"+$Param19+";"+$Param20 - $ParamValue = Split(values, ";") + var val_array array + val_array = [$Param1,$Param2,$Param3,$Param4,$Param5,$Param6,$Param7,$Param8,$Param9,$Param10,$Param11,$Param12,$Param13,$Param14,$Param15,$Param16,$Param17,$Param18,$Param19,$Param20] $ParamName = Split($ParamNames, ";") var buffer_data map, i int i = 0 while i < Len($ParamName) { - buffer_data[$ParamName[i]] = $ParamValue[i] + buffer_data[$ParamName[i]] = val_array[i] i = i + 1 } @1BufferManager("Action,Key,Val", "set", $FormName, JSONEncode(buffer_data)) diff --git a/src/basic/contracts/GroupAccessManager.sim b/src/basic/contracts/GroupAccessManager.sim index 30f1722e6..ebe469cf6 100644 --- a/src/basic/contracts/GroupAccessManager.sim +++ b/src/basic/contracts/GroupAccessManager.sim @@ -23,7 +23,7 @@ contract GroupAccessManager { filled["group_type"] = $GroupType filled["group_information"] = $GroupInfo if !$buffer_id { - DBInsert("@1buffer_data", {"ecosystem": $ecosystem_id, "member_id": $key_id, "key": "group_access", "value": filled}) + DBInsert("@1buffer_data", {"ecosystem": $ecosystem_id, "account": $account_id, "key": "group_access", "value": filled}) } else { DBUpdate("@1buffer_data", Int($buffer_id), {"value": filled}) } @@ -56,7 +56,7 @@ contract GroupAccessManager { $buffer_id = 0 $ids = [] var buffer map - buffer = DBFind("@1buffer_data").Where({"ecosystem": $ecosystem_id, "member_id": $key_id, "key": "group_access"}).Columns("id,value,value->groups_access").Row() + buffer = DBFind("@1buffer_data").Where({"ecosystem": $ecosystem_id, "account": $account_id, "key": "group_access"}).Columns("id,value,value->groups_access").Row() if buffer { $buffer_managers = buffer["value.groups_access"] $buffer_id = buffer["id"] diff --git a/src/basic/contracts/GroupRequestDecide.sim b/src/basic/contracts/GroupRequestDecide.sim index a1f95004f..c12e11e3d 100644 --- a/src/basic/contracts/GroupRequestDecide.sim +++ b/src/basic/contracts/GroupRequestDecide.sim @@ -5,7 +5,7 @@ contract GroupRequestDecide { } conditions { - $notific = DBFind("@1notifications").WhereId($NotificId).Columns("id,closed,page_params->gr_id,page_params->member_id,sender,sender->member_id,recipient,recipient->role_id").Row() + $notific = DBFind("@1notifications").WhereId($NotificId).Columns("id,closed,page_params->gr_id,page_params->account,sender,sender->account,recipient,recipient->role_id").Row() if $notific["closed"] == 1 { warning LangRes("@1request_already", "en") } @@ -13,9 +13,9 @@ contract GroupRequestDecide { action { $gr_id = Int($notific["page_params.gr_id"]) - $member_id = Int($notific["page_params.member_id"]) + $account = Int($notific["page_params.account"]) if $Accept == 1 { - @1GroupsAssign("GroupId,MemberId", $gr_id, $member_id) + @1GroupsAssign("GroupId,MemberAccount", $gr_id, $account) } var params map params["gr_id"] = $gr_id @@ -29,19 +29,19 @@ contract GroupRequestDecide { header = "Request to group" body = "Solution for your request" page = "@1groups_request_view" - member = Int($notific["sender.member_id"]) + member = $notific["sender.account"] if $notific["recipient.role_id"] > 0 { var check_send_notific array v map i int - check_send_notific = DBFind("@1notifications").Columns("id,closed,ecosystem,sender,sender->member_id,page_params->gr_id,page_params->member_id").Where({"sender->member_id":member,"page_params->gr_id":$gr_id,"page_params->member_id":member,"closed":0,"ecosystem":$ecosystem_id}) + check_send_notific = DBFind("@1notifications").Columns("id,closed,ecosystem,sender,sender->account,page_params->gr_id,page_params->account").Where({"sender->account": member, "page_params->gr_id": $gr_id, "page_params->account": member, "closed": 0, "ecosystem": $ecosystem_id}) while i < Len(check_send_notific) { v = check_send_notific[i] @1NotificationsProcess("NotificId", Int(v["id"])) @1NotificationsClose("NotificId", Int(v["id"])) i = i + 1 } - @1NotificationsSend("MemberId,Sender,Icon,Header,Body,Page,Params,EcosystemId,CurrentRid", member, 2, icon, header, body, page, params, $ecosystem_id, Int($notific["recipient.role_id"])) + @1NotificationsSend("MemberAccount,Sender,Icon,Header,Body,Page,Params,EcosystemId,CurrentRid", member, 2, icon, header, body, page, params, $ecosystem_id, Int($notific["recipient.role_id"])) } else{ - @1NotificationsSend("MemberId,Sender,Icon,Header,Body,Page,Params,EcosystemId", member, 1, icon, header, body, page, params, $ecosystem_id) + @1NotificationsSend("MemberAccount,Sender,Icon,Header,Body,Page,Params,EcosystemId", member, 1, icon, header, body, page, params, $ecosystem_id) @1NotificationsClose("NotificId", $NotificId) } } diff --git a/src/basic/contracts/GroupRequestMembership.sim b/src/basic/contracts/GroupRequestMembership.sim index 67ce62300..1842b713a 100644 --- a/src/basic/contracts/GroupRequestMembership.sim +++ b/src/basic/contracts/GroupRequestMembership.sim @@ -4,21 +4,21 @@ contract GroupRequestMembership { } conditions { - $group = DBFind("@1groups").Where({"id": $GroupId}).Columns("id,deleted,group_type,group_name,image_id,creator->member_id,group_access,group_name").Row() + $group = DBFind("@1groups").Where({"id": $GroupId}).Columns("id,deleted,group_type,group_name,image_id,creator->account,group_access,group_name").Row() if !$group { warning LangRes("@1group_not_found", "en") } - if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": $key_id}).Row() { - warning LangRes("@1key_not_found", "en") + if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": $account_id, "deleted": 0}).Row() { + warning LangRes("@1account_not_found", "en") } if $group["deleted"] == 1 { warning LangRes("@1group_deleted_request_impossible", "en") } - $check_join = DBFind("@1groups_participants").Where({"deleted": 0, "member->member_id": $key_id, "groups_info->id": $GroupId, "ecosystem": $ecosystem_id}).Columns("id,deleted,member,member->member_id,groups_info,groups_info->id,ecosystem").One("id") + $check_join = DBFind("@1groups_participants").Where({"deleted": 0, "member->account": $account_id, "groups_info->id": $GroupId, "ecosystem": $ecosystem_id}).Columns("id,deleted,member,member->account,groups_info,groups_info->id,ecosystem").One("id") if $check_join { warning LangRes("@1already_group", "en") } - $check_send_notific = DBFind("@1notifications").Where({"sender->member_id": $key_id, "page_params->gr_id": $GroupId, "closed": 0, "ecosystem": $ecosystem_id}).Columns("id,closed,ecosystem,sender,sender->member_id,page_params->gr_id").One("id") + $check_send_notific = DBFind("@1notifications").Where({"sender->account": $account_id, "page_params->gr_id": $GroupId, "closed": 0, "ecosystem": $ecosystem_id}).Columns("id,closed,ecosystem,sender,sender->account,page_params->gr_id").One("id") if $check_send_notific { info LangRes("@1request_to_group", "en") } @@ -29,7 +29,7 @@ contract GroupRequestMembership { var params map params["gr_id"] = $GroupId - params["member_id"] = $key_id + params["account"] = $account_id icon = "icon icon-user-follow" header = "New request" body = "New request to the group " + Str($group["group_name"]) @@ -40,12 +40,12 @@ contract GroupRequestMembership { while i < Len(gr_ids) { var id_role int id_role = Int(gr_ids[i]) - @1NotificationsSend("Rid,Sender,Icon,Header,Body,Page,Params,EcosystemId,Closure", id_role, 1, icon, header, body, page, params, $ecosystem_id,1) + @1NotificationsSend("Rid,Sender,Icon,Header,Body,Page,Params,EcosystemId,Closure", id_role, 1, icon, header, body, page, params, $ecosystem_id, 1) i = i + 1 } } else { - $creator_id = Int($group["creator.member_id"]) - @1NotificationsSend("MemberId,Sender,Icon,Header,Body,Page,Params,EcosystemId", $creator_id, 1, icon, header, body, page, params, $ecosystem_id) + $creator_id = $group["creator.account"] + @1NotificationsSend("MemberAccount,Sender,Icon,Header,Body,Page,Params,EcosystemId", $creator_id, 1, icon, header, body, page, params, $ecosystem_id) } } } diff --git a/src/basic/contracts/GroupsAccessCheck.sim b/src/basic/contracts/GroupsAccessCheck.sim index 88b71f761..eb32f6dad 100644 --- a/src/basic/contracts/GroupsAccessCheck.sim +++ b/src/basic/contracts/GroupsAccessCheck.sim @@ -5,18 +5,18 @@ contract GroupsAccessCheck { conditions { var group map - group = DBFind("@1groups").Where({"ecosystem": $ecosystem_id, "id": $GroupId}).Columns("id,group_name,deleted,group_access,creator->member_id").Row() + group = DBFind("@1groups").Where({"ecosystem": $ecosystem_id, "id": $GroupId}).Columns("id,group_name,deleted,group_access,creator->account").Row() if !group { warning Sprintf("%v: " + "group not found", $this_contract) } - if group["creator.member_id"] == $key_id { + if group["creator.account"] == $account_id { return } var gr_ids array gr_ids = JSONDecode(group["group_access"]) - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": gr_ids}, "member->member_id":$key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": gr_ids}, "member->account": $account_id, "deleted": 0}).Row() { warning Sprintf(LangRes("@1group_change_no_permission", "en"), group["group_name"]) } } diff --git a/src/basic/contracts/GroupsAssign.sim b/src/basic/contracts/GroupsAssign.sim index 49094d6ab..502785c7c 100644 --- a/src/basic/contracts/GroupsAssign.sim +++ b/src/basic/contracts/GroupsAssign.sim @@ -1,34 +1,33 @@ contract GroupsAssign { data { GroupId int - MemberId int + MemberAccount string } - func getMemberInfo(kid int) map { + func getMemberInfo(account string) map { var res member map - member = DBFind("@1members").Where({"ecosystem": $ecosystem_id, "id": kid}).Row() + member = DBFind("@1members").Where({"ecosystem": $ecosystem_id, "account": account}).Row() if member { - res["member_id"] = member["id"] + res["account"] = member["account"] res["member_name"] = member["member_name"] res["image_id"] = member["image_id"] } else { - member = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": kid}).Row() - if member { - res["member_id"] = member["id"] - res["member_name"] = IdToAddress(Int(member["id"])) - res["image_id"] = 0 + if DBFind("@1keys").Columns("id").Where({"ecosystem": $ecosystem_id, "account": account, "deleted": 0}).Row() { + res["account"] = account + res["member_name"] = account + res["image_id"] = "0" } } return res } conditions { - $group = DBFind("@1groups").Where({"id": $GroupId}).Columns("id,deleted,group_type,group_name,image_id,creator->member_id").Row() + $group = DBFind("@1groups").Where({"id": $GroupId}).Columns("id,deleted,group_type,group_name,image_id,creator->account").Row() if !$group { warning LangRes("@1group_not_found", "en") } - if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": $MemberId}).Row() { - warning LangRes("@1key_not_found", "en") + if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": $MemberAccount, "deleted": 0}).Row() { + warning LangRes("@1account_not_found", "en") } if Int($group["deleted"]) == 1 { warning LangRes("@1group_deleted_request_impossible", "en") @@ -39,7 +38,7 @@ contract GroupsAssign { } action { - if DBFind("@1groups_participants").Where({"ecosystem": $ecosystem_id, "groups_info->id": $GroupId, "member->member_id": $MemberId, "deleted": 0}).One("id") { + if DBFind("@1groups_participants").Where({"ecosystem": $ecosystem_id, "groups_info->id": $GroupId, "member->account": $MemberAccount, "deleted": 0}).One("id") { // do not re-assign and do not warning because this contract may be called for other return } @@ -49,8 +48,8 @@ contract GroupsAssign { group["type"] = $group["group_type"] group["name"] = $group["group_name"] group["image_id"] = $group["image_id"] - member = getMemberInfo($MemberId) - appointer = getMemberInfo($key_id) + member = getMemberInfo($MemberAccount) + appointer = getMemberInfo($account_id) var m map m["groups_info"] = group diff --git a/src/basic/contracts/GroupsAssignList.sim b/src/basic/contracts/GroupsAssignList.sim index 82413c022..5157c3011 100644 --- a/src/basic/contracts/GroupsAssignList.sim +++ b/src/basic/contracts/GroupsAssignList.sim @@ -15,17 +15,18 @@ contract GroupsAssignList { warning LangRes("@1key_too_long", "en") } - var k_id int - k_id = PubToID(pub_key) - if k_id == 0 { + var account_key int account string + account_key = PubToID(pub_key) + if account_key == 0 { warning LangRes("@1public_key_invalid", "en") } - $check_user = DBFind("@1keys").Where({"id": k_id, "ecosystem": $ecosystem_id}) + account = IdToAddress(account_key) + $check_user = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": account, "deleted": 0}) if !$check_user { warning Sprintf("%v: " + "key not found", pub_key) } - @1GroupsAssign("GroupId,MemberId",$GroupId,k_id) + @1GroupsAssign("GroupId,MemberAccount", $GroupId, account) } conditions { diff --git a/src/basic/contracts/GroupsCreate.sim b/src/basic/contracts/GroupsCreate.sim index 1bf2ffe85..e170f6ebf 100644 --- a/src/basic/contracts/GroupsCreate.sim +++ b/src/basic/contracts/GroupsCreate.sim @@ -6,19 +6,18 @@ contract GroupsCreate { GroupId int "optional" } - func getMemberInfo(kid int) map { + func getMemberInfo(account string) map { var res member map - member = DBFind("@1members").Where({"ecosystem": $ecosystem_id, "id": kid}).Row() + member = DBFind("@1members").Where({"ecosystem": $ecosystem_id, "account": account}).Row() if member { - res["member_id"] = member["id"] + res["account"] = member["account"] res["member_name"] = member["member_name"] res["image_id"] = member["image_id"] } else { - member = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": kid}).Row() - if member { - res["member_id"] = member["id"] - res["member_name"] = IdToAddress(Int(member["id"])) - res["image_id"] = 0 + if DBFind("@1keys").Columns("id").Where({"ecosystem": $ecosystem_id, "account": account, "deleted": 0}).Row() { + res["account"] = account + res["member_name"] = account + res["image_id"] = "0" } } return res @@ -38,7 +37,7 @@ contract GroupsCreate { if $check_access != "" { var rids array rids = JSONDecode("[" + $check_access + "]") - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in":rids}, "member->member_id": $key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() { warning LangRes("@1access_denied", "en") } } else { @@ -46,7 +45,7 @@ contract GroupsCreate { admin_id = AppParam(Int($system_app_id), "role_admin", $ecosystem_id) var rids array rids = JSONDecode("[" + admin_id + "]") - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() { warning LangRes("@1access_denied", "en") } } @@ -58,7 +57,7 @@ contract GroupsCreate { action { if $GroupId == 0 { var roles_access_arr array, buffer map - buffer = DBFind("@1buffer_data").Where({"ecosystem": $ecosystem_id, "member_id": $key_id, "key": "group_access"}).Columns("id,value,value->groups_access").Row() + buffer = DBFind("@1buffer_data").Where({"ecosystem": $ecosystem_id, "account": $account_id, "key": "group_access"}).Columns("id,value,value->groups_access").Row() if buffer { roles_access_arr = JSONDecode(buffer["value.groups_access"]) var filled map @@ -70,7 +69,7 @@ contract GroupsCreate { } var m map - m["creator"] = getMemberInfo($key_id) + m["creator"] = getMemberInfo($account_id) m["group_name"] = $GroupName m["group_type"] = $GroupType m["date_created"] = $block_time diff --git a/src/basic/contracts/GroupsUnassign.sim b/src/basic/contracts/GroupsUnassign.sim index 686ef8563..e44ae8062 100644 --- a/src/basic/contracts/GroupsUnassign.sim +++ b/src/basic/contracts/GroupsUnassign.sim @@ -5,7 +5,7 @@ contract GroupsUnassign { conditions { var assigned map - assigned = DBFind("@1groups_participants").Where({"ecosystem": $ecosystem_id, "id": $RowId, "deleted": 0}).Columns("id,ecosystem,deleted,groups_info->id,member->member_id").Row() + assigned = DBFind("@1groups_participants").Where({"ecosystem": $ecosystem_id, "id": $RowId, "deleted": 0}).Columns("id,ecosystem,deleted,groups_info->id,member->account").Row() if !assigned { warning LangRes("@1group_participant_not_found", "en") } @@ -21,7 +21,7 @@ contract GroupsUnassign { warning LangRes("@1group_not_found", "en") } if $groupType == 1 { - if Int(assigned["member.member_id"]) != $key_id { + if assigned["member.account"] != $account_id { @1GroupsAccessCheck("GroupId", $groupId) } } else { diff --git a/src/basic/contracts/InvestorRefresh.sim b/src/basic/contracts/InvestorRefresh.sim index 1fe668be7..9d9da5fc6 100644 --- a/src/basic/contracts/InvestorRefresh.sim +++ b/src/basic/contracts/InvestorRefresh.sim @@ -41,11 +41,11 @@ contract InvestorRefresh { warning LangRes("@1app_not_found", "en") } - var roleValidatorId roleInvestorId string + var roleConsortiumMemberId roleInvestorId string - roleValidatorId = getRoleId("role_validator") - if !RoleAccess(roleValidatorId) { - warning LangRes("@1not_validator_can_not_run", "en") + roleConsortiumMemberId = getRoleId("role_consortium_member") + if !RoleAccess(roleConsortiumMemberId) { + warning LangRes("@1consortium_members_only", "en") } roleInvestorId = getRoleId("role_investor_with_voting_rights") @@ -60,22 +60,22 @@ contract InvestorRefresh { action { // get investors ids var keysInvestors assignedInvestors investorsIds assignedIds array - keysInvestors = DBFind("@1keys").Where({"ecosystem": $ecosystem_id}).Columns("id").Order([{amount:"-1"},{id:"-1"}]).Limit($limitInvestors) - assignedInvestors = DBFind("@1roles_participants").Where({"role->id": $roleId, "deleted": 0}).Columns("member->member_id") + keysInvestors = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "deleted": 0}).Columns("account").Order({"amount": "-1", "id": "-1"}).Limit($limitInvestors) + assignedInvestors = DBFind("@1roles_participants").Where({"role->id": $roleId, "deleted": 0}).Columns("member->account") // get ids var i int while i < Len(keysInvestors) { var inv map inv = keysInvestors[i] - investorsIds[i] = inv["id"] + investorsIds[i] = inv["account"] i = i + 1 } i = 0 while i < Len(assignedInvestors) { var inv map inv = assignedInvestors[i] - assignedIds[i] = inv["member.member_id"] + assignedIds[i] = inv["member.account"] i = i + 1 } @@ -85,7 +85,7 @@ contract InvestorRefresh { while i < Len(assignedIds) { if notInArray(assignedIds[i], investorsIds){ mid = assignedIds[i] - assigned = DBFind("@1roles_participants").Where({"member->member_id": mid, "role->id": $roleId}).Row() + assigned = DBFind("@1roles_participants").Where({"member->account": mid, "role->id": $roleId}).Row() if assigned { @1RolesUnassign("RowId", Int(assigned["id"])) } @@ -96,10 +96,10 @@ contract InvestorRefresh { i = 0 while i < Len(investorsIds) { if notInArray(investorsIds[i], assignedIds){ - var id int - id = Int(investorsIds[i]) - if DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": id}).Row(){ - @1RolesAssign("Rid,MemberId", $roleId, id) + var account string + account = investorsIds[i] + if DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": account, "deleted": 0}).Row(){ + @1RolesAssign("Rid,MemberAccount", $roleId, account) } } i = i + 1 diff --git a/src/basic/contracts/MembershipAdd.sim b/src/basic/contracts/MembershipAdd.sim index ab9c4cb7e..6e3a1f951 100644 --- a/src/basic/contracts/MembershipAdd.sim +++ b/src/basic/contracts/MembershipAdd.sim @@ -12,18 +12,19 @@ contract MembershipAdd { warning LangRes("@1key_too_long", "en") } - var k_id int - k_id = PubToID(pub) - if k_id == 0 { + var account_key int account string + account_key = PubToID(pub) + if account_key == 0 { warning LangRes("@1public_key_invalid", "en") } - $check_user = DBFind("@1keys").Where({"id": k_id, "ecosystem": $ecosystem_id}) + account = IdToAddress(account_key) + $check_user = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": account, "deleted": 0}) if $check_user { - warning LangRes("@1key_already_exists", "en") + warning LangRes("@1wallet_already_exists", "en") } var pub_bytes bytes pub_bytes = HexToPub(pub) - DBInsert("@1keys",{id:k_id, pub:pub_bytes, ecosystem:$ecosystem_id}) + DBInsert("@1keys", {"ecosystem": $ecosystem_id, "id": account_key, "account": account, "pub": pub_bytes, "deleted": 0}) } conditions { diff --git a/src/basic/contracts/MembershipDecide.sim b/src/basic/contracts/MembershipDecide.sim index 47d373c69..4b0288106 100644 --- a/src/basic/contracts/MembershipDecide.sim +++ b/src/basic/contracts/MembershipDecide.sim @@ -6,7 +6,7 @@ contract MembershipDecide { conditions { $system_app_id = DBFind("@1applications").Where({"ecosystem": $ecosystem_id, "name": "System"}).One("id") - $request = DBFind("@1notifications").Where({"ecosystem": $ecosystem_id, "id": $NotificId}).Columns("id,closed,sender->member_id,page_params->ecosystem_id,page_params->ecosystem_sender").Row() + $request = DBFind("@1notifications").Where({"ecosystem": $ecosystem_id, "id": $NotificId}).Columns("id,closed,sender->account,page_params->ecosystem_id,page_params->ecosystem_sender").Row() var ecoId int ecoId = Int($request["page_params.ecosystem_id"]) @@ -26,11 +26,12 @@ contract MembershipDecide { params["ecosystem_id"] = $request["page_params.ecosystem_id"] if $Accept == 1 { params["status"] = 1 - var pub string mid eco_id int - mid = Int($request["sender.member_id"]) + var pub account string eco_id account_key int + account = $request["sender.account"] + account_key = AddressToId(account) eco_id = Int($request["page_params.ecosystem_id"]) - pub = DBFind("@1keys").Where({"ecosystem": 1, "id": mid}).One("pub") - DBInsert("@1keys", {id:mid, pub:pub, ecosystem:$ecosystem_id}) + pub = DBFind("@1keys").Where({"ecosystem": 1, "account": account, "deleted": 0}).One("pub") + DBInsert("@1keys", {"ecosystem": $ecosystem_id, "id": account_key, "account": account, "pub": pub, "deleted": 0}) } else { params["status"] = 0 } @@ -43,7 +44,7 @@ contract MembershipDecide { body = Sprintf(LangRes("@1ecosystem_request_approved", "en"), ecoName, ecoId) page = "@1membership_user_view" - @1NotificationsSend("MemberId,Sender,Icon,Header,Body,Page,Params,EcosystemId", Int($request["sender.member_id"]), 1, icon, header, body, page, params, Int($request["page_params.ecosystem_sender"])) + @1NotificationsSend("MemberAccount,Sender,Icon,Header,Body,Page,Params,EcosystemId", $request["sender.account"], 1, icon, header, body, page, params, Int($request["page_params.ecosystem_sender"])) @1NotificationsProcess("NotificId", $NotificId) @1NotificationsClose("NotificId", $NotificId) } diff --git a/src/basic/contracts/MembershipRequest.sim b/src/basic/contracts/MembershipRequest.sim index db37d5a91..e5e4133c8 100644 --- a/src/basic/contracts/MembershipRequest.sim +++ b/src/basic/contracts/MembershipRequest.sim @@ -16,13 +16,13 @@ contract MembershipRequest { warning Sprintf(LangRes("@1template_eco_not_exist", "en"), $EcosystemId) } - if DBFind("@1keys").Where({"id": $key_id, "ecosystem": $EcosystemId}) { + if DBFind("@1keys").Where({"ecosystem": $EcosystemId, "account": $account_id, "deleted": 0}) { warning LangRes("@1member_added_before", "en") } $free_membership = Int(DBFind("@1parameters").Where({"ecosystem": $EcosystemId, "name": "free_membership"}).One("value")) if $free_membership == 0 { - if DBFind("@1notifications").Where({"ecosystem": $EcosystemId, "page_params->ecosystem_id": $EcosystemId, "sender->member_id": $key_id, "closed": 0, "page_name": "@1membership_admin_view"}).Row(){ + if DBFind("@1notifications").Where({"ecosystem": $EcosystemId, "page_params->ecosystem_id": $EcosystemId, "sender->account": $account_id, "closed": 0, "page_name": "@1membership_admin_view"}).Row(){ warning LangRes("@1request_sent_already", "en") } @@ -44,9 +44,10 @@ contract MembershipRequest { @1NotificationsSend("Rid,Sender,Icon,Header,Body,Page,Params,Closure,EcosystemId", $admin_id, 1, "icon icon-user-follow", LangRes("@1membership_request_new", "en"), LangRes("@1details_view", "en"), "@1membership_admin_view", notific_params,1,$EcosystemId) } if $free_membership == 1 { - var pub string - pub = DBFind("@1keys").Where({"ecosystem": 1, "id": $key_id}).One("pub") - DBInsert("@1keys", {id:$key_id, pub:pub, ecosystem:$EcosystemId}) + var pub string account_key int + account_key = AddressToId($account_id) + pub = DBFind("@1keys").Where({"ecosystem": 1, "account": $account_id, "deleted": 0}).One("pub") + DBInsert("@1keys", {"ecosystem": $EcosystemId, "id": account_key, "account": $account_id, "pub": pub, "deleted": 0}) var params map params["ecosystem_id"] = $EcosystemId @@ -59,7 +60,7 @@ contract MembershipRequest { body = Sprintf(LangRes("@1ecosystem_request_approved", "en"), ecoName, $EcosystemId) page = "@1membership_user_view" - @1NotificationsSend("MemberId,Sender,Icon,Header,Body,Page,Params,EcosystemId", $key_id, 1, icon, header, body, page, params, $ecosystem_id) + @1NotificationsSend("MemberAccount,Sender,Icon,Header,Body,Page,Params,EcosystemId", $account_id, 1, icon, header, body, page, params, $ecosystem_id) } } } \ No newline at end of file diff --git a/src/basic/contracts/NodeRemoveByKey.sim b/src/basic/contracts/NodeRemoveByKey.sim index 0afb83eb5..e1aad4e18 100644 --- a/src/basic/contracts/NodeRemoveByKey.sim +++ b/src/basic/contracts/NodeRemoveByKey.sim @@ -1,7 +1,7 @@ contract NodeRemoveByKey { data {} - func nodesRemove(keyId int) array { + func nodesRemove(key int) array { var nodesJSON string nodes res array nodesJSON = SysParamString("full_nodes") if !HasPrefix(nodesJSON, "[") { @@ -13,7 +13,7 @@ contract NodeRemoveByKey { while i < Len(nodes) { var node map node = nodes[i] - if node["key_id"] != keyId { + if node["key_id"] != key { res = Append(res, node) } i = i + 1 @@ -22,14 +22,14 @@ contract NodeRemoveByKey { } conditions { - if $original_contract != "ValidatorResign" { + if $original_contract != "ConsortiumMemberResign" { warning LangRes("@1contract_chain_distorted", "en") } } action { var nodes array fullNodes string - nodes = nodesRemove($key_id) + nodes = nodesRemove(Int(AddressToId($account_id))) fullNodes = JSONEncode(nodes) DBUpdateSysParam("full_nodes", fullNodes, "") } diff --git a/src/basic/contracts/NotificationsBroadcast.sim b/src/basic/contracts/NotificationsBroadcast.sim index 5a6397a50..dfaeb3e40 100644 --- a/src/basic/contracts/NotificationsBroadcast.sim +++ b/src/basic/contracts/NotificationsBroadcast.sim @@ -6,17 +6,17 @@ contract NotificationsBroadcast { Popup string "optional" } - func getMemberInfo(kid int) map { + func getMemberInfo(account string) map { var res member map - member = DBFind("@1members").Where({"ecosystem": $ecosystem_id, "id": kid}).Row() + member = DBFind("@1members").Where({"ecosystem": $ecosystem_id, "account": account}).Row() if member { - res["member_id"] = member["id"] + res["account"] = member["account"] res["member_name"] = member["member_name"] res["image_id"] = member["image_id"] } else { - if DBFind("@1keys").Columns("id").Where({"ecosystem": $ecosystem_id, "id": kid}).Row() { - res["member_id"] = Str(kid) - res["member_name"] = IdToAddress(kid) + if DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": account, "deleted": 0}).Row() { + res["account"] = account + res["member_name"] = account res["image_id"] = "0" } } @@ -39,7 +39,7 @@ contract NotificationsBroadcast { action { var i lenIds int eco map ids array sender recipient params note map - sender = getMemberInfo($key_id) + sender = getMemberInfo($account_id) sender["type"] = 1 note["header"] = $Header note["type"] = 1 @@ -59,12 +59,12 @@ contract NotificationsBroadcast { $system_app_id = DBFind("@1applications").Where({"ecosystem": ecoId, "name": "System"}).One("id") var adminRoleId int adminRoleId = Int(AppParam(Int($system_app_id), "role_admin", $ecosystem_id)) - ids = DBFind("@1roles_participants").Where({"ecosystem": ecoId, "role->id": adminRoleId, "role->type": 3}).Columns("member->member_id") + ids = DBFind("@1roles_participants").Where({"ecosystem": ecoId, "role->id": adminRoleId, "role->type": 3}).Columns("member->account") lenIds = Len(ids) var i_ids int while i_ids < lenIds { recipient = ids[i_ids] - recipient = getMemberInfo(Int(recipient["member.member_id"])) + recipient = getMemberInfo(recipient["member.account"]) var m map m["recipient"] = recipient m["sender"] = sender diff --git a/src/basic/contracts/NotificationsClose.sim b/src/basic/contracts/NotificationsClose.sim index 7b3a42e69..754fbd9eb 100644 --- a/src/basic/contracts/NotificationsClose.sim +++ b/src/basic/contracts/NotificationsClose.sim @@ -23,7 +23,7 @@ contract NotificationsClose { } conditions { - $notify = DBFind("@1notifications").Where({"ecosystem": $ecosystem_id, "id": $NotificId}).Columns("id,date_start_processing,processing_info->member_id,closed,notification->type,recipient->member_id,recipient->role_id").Row() + $notify = DBFind("@1notifications").Where({"ecosystem": $ecosystem_id, "id": $NotificId}).Columns("id,date_start_processing,processing_info->account,closed,notification->type,recipient->account,recipient->role_id").Row() if !$notify { warning LangRes("@1notification_not_found", "en") } @@ -39,7 +39,7 @@ contract NotificationsClose { // checking personal notification if $notify["notification.type"] == 1 && flag_permission == 0 { - if $notify["recipient.member_id"] != $key_id { + if $notify["recipient.account"] != $account_id { warning LangRes("@1notification_another_member", "en") } } @@ -50,7 +50,7 @@ contract NotificationsClose { warning LangRes("@1notification_processing_not_started", "en") } - if $notify["processing_info.member_id"] != $key_id { + if $notify["processing_info.account"] != $account_id { warning LangRes("@1notice_processing_started_another_member", "en") } } @@ -69,7 +69,7 @@ contract NotificationsClose { DBUpdate("@1notifications", $NotificId, m) if $notify["notification.type"] == 1 { - UpdateNotifications($ecosystem_id, Int($notify["recipient.member_id"])) + UpdateNotifications($ecosystem_id, $notify["recipient.account"]) } else { UpdateRolesNotifications($ecosystem_id, Int($notify["recipient.role_id"])) } diff --git a/src/basic/contracts/NotificationsProcess.sim b/src/basic/contracts/NotificationsProcess.sim index be4ecf0e7..b7d2fb43a 100644 --- a/src/basic/contracts/NotificationsProcess.sim +++ b/src/basic/contracts/NotificationsProcess.sim @@ -3,19 +3,18 @@ contract NotificationsProcess { NotificId int } - func getMemberInfo(kid int) map { + func getMemberInfo(account string) map { var res member map - member = DBFind("@1members").Where({"ecosystem": $ecosystem_id, "id": kid}).Row() + member = DBFind("@1members").Where({"ecosystem": $ecosystem_id, "account": account}).Row() if member { - res["member_id"] = member["id"] + res["account"] = member["account"] res["member_name"] = member["member_name"] res["image_id"] = member["image_id"] } else { - member = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": kid}).Row() - if member { - res["member_id"] = member["id"] - res["member_name"] = IdToAddress(Int(member["id"])) - res["image_id"] = 0 + if DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": account, "deleted": 0}).Row() { + res["account"] = account + res["member_name"] = account + res["image_id"] = "0" } } return res @@ -34,7 +33,7 @@ contract NotificationsProcess { var rid string rid = Int($notify["recipient.role_id"]) if rid > 0{ - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": rid, "member->member_id": $key_id, "deleted": 0}).One("id") { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": rid, "member->account": $account_id, "deleted": 0}).One("id") { warning LangRes("@1notification_not_part_of_role", "en") } } @@ -47,7 +46,7 @@ contract NotificationsProcess { action { var model map - model["processing_info"] = getMemberInfo($key_id) + model["processing_info"] = getMemberInfo($account_id) model["date_start_processing"] = $block_time DBUpdate("@1notifications", $NotificId, model) } diff --git a/src/basic/contracts/NotificationsSend.sim b/src/basic/contracts/NotificationsSend.sim index 185a699b6..f53842c84 100644 --- a/src/basic/contracts/NotificationsSend.sim +++ b/src/basic/contracts/NotificationsSend.sim @@ -1,6 +1,6 @@ contract NotificationsSend { data { - MemberId int "optional" + MemberAccount string "optional" Rid int "optional" GroupId int "optional" Closure int "optional" @@ -15,17 +15,17 @@ contract NotificationsSend { Popup string "optional" } - func getMemberInfo(kid, ecoId int) map { + func getMemberInfo(account string, ecoId int) map { var res member map - member = DBFind("@1members").Where({"ecosystem": ecoId, "id": kid}).Row() + member = DBFind("@1members").Where({"ecosystem": ecoId, "account": account}).Row() if member { - res["member_id"] = member["id"] + res["account"] = member["account"] res["member_name"] = member["member_name"] res["image_id"] = member["image_id"] } else { - if DBFind("@1keys").Where({"ecosystem": ecoId, "id": kid}).Columns("id").Row() { - res["member_id"] = Str(kid) - res["member_name"] = IdToAddress(kid) + if DBFind("@1keys").Where({"ecosystem": ecoId, "account": account, "deleted": 0}).Row() { + res["account"] = account + res["member_name"] = account res["image_id"] = "0" } } @@ -47,7 +47,7 @@ contract NotificationsSend { if $Sender == 1 && $senderMember { // send from member sender["type"] = $Sender - sender["member_id"] = $senderMember["member_id"] + sender["account"] = $senderMember["account"] sender["member_name"] = $senderMember["member_name"] sender["image_id"] = $senderMember["image_id"] } else { @@ -83,13 +83,12 @@ contract NotificationsSend { if $EcosystemId == 0 { $EcosystemId = $ecosystem_id } - $MemberId = Int($MemberId) if Size($Icon) < 1 { $Icon = "icon-envelope" } - if $MemberId != 0 { - if !DBFind("@1keys").Where({"ecosystem": $EcosystemId, "id": $MemberId}).Row() { - warning LangRes("@1key_not_found", "en") + if $MemberAccount && $MemberAccount != "0" { + if !DBFind("@1keys").Where({"ecosystem": $EcosystemId, "account": $MemberAccount, "deleted": 0}).Row() { + warning LangRes("@1account_not_found", "en") } $notify_type = 1 } elif $Rid > 0 { @@ -114,7 +113,7 @@ contract NotificationsSend { $senderMember = nil $senderRole = nil if $Sender == 1 { - $senderMember = getMemberInfo($key_id, $ecosystem_id) + $senderMember = getMemberInfo($account_id, $ecosystem_id) } elif $Sender == 2 { if !RoleAccess($CurrentRid) { warning LangRes("@1access_denied", "en") @@ -129,9 +128,9 @@ contract NotificationsSend { } action { - if $MemberId != 0 { - sendNotify(getMemberInfo($MemberId, $EcosystemId)) - UpdateNotifications($EcosystemId, Int($MemberId)) + if $MemberAccount && $MemberAccount != "0" { + sendNotify(getMemberInfo($MemberAccount, $EcosystemId)) + UpdateNotifications($EcosystemId, $MemberAccount) } elif $Rid > 0 { if $Closure == 1 { // Single closure: one begins the process - the others do not see @@ -141,25 +140,25 @@ contract NotificationsSend { // Multiple closure: to each his own notification $notify_type = 1 var participants array - participants = DBFind("@1roles_participants").Where({"ecosystem": $EcosystemId, "role->id": $Rid, "deleted": 0}).Columns("member->member_id") + participants = DBFind("@1roles_participants").Where({"ecosystem": $EcosystemId, "role->id": $Rid, "deleted": 0}).Columns("member->account") var i int while i < Len(participants) { var p map p = participants[i] - sendNotify(getMemberInfo(Int(p["member.member_id"]), $EcosystemId)) - UpdateNotifications($EcosystemId, Int(p["member.member_id"])) + sendNotify(getMemberInfo(p["member.account"], $EcosystemId)) + UpdateNotifications($EcosystemId, p["member.account"]) i = i + 1 } } } elif $GroupId > 0 { var participants array - participants = DBFind("@1groups_participants").Where({"ecosystem": $EcosystemId, "groups_info->id": $GroupId, "deleted": 0}).Columns("member->member_id") + participants = DBFind("@1groups_participants").Where({"ecosystem": $EcosystemId, "groups_info->id": $GroupId, "deleted": 0}).Columns("member->account") var i int while i < Len(participants) { var p map p = participants[i] - sendNotify(getMemberInfo(Int(p["member.member_id"]), $EcosystemId)) - UpdateNotifications($EcosystemId, Int(p["member.member_id"])) + sendNotify(getMemberInfo(p["member.account"], $EcosystemId)) + UpdateNotifications($EcosystemId, p["member.account"]) i = i + 1 } } diff --git a/src/basic/contracts/PlatformAppsSettings.sim b/src/basic/contracts/PlatformAppsSettings.sim index 2eb2adf01..ae9902b84 100644 --- a/src/basic/contracts/PlatformAppsSettings.sim +++ b/src/basic/contracts/PlatformAppsSettings.sim @@ -1,12 +1,11 @@ contract PlatformAppsSettings { data { RoleAdmin int - RoleValidatorCandidate int - RoleConsensus int + RoleConsortiumMemberCandidate int + RoleConsortiumMember int RoleDelegate int RoleDeveloper int RoleInvestor int - RoleValidator int RoleCreatesRoles int } @@ -40,12 +39,11 @@ contract PlatformAppsSettings { action { $app_id = DBFind("@1applications").Where({"ecosystem": $ecosystem_id, "name": "System"}).One("id") updateParam("role_admin", $RoleAdmin) - updateParam("role_candidate_for_validators", $RoleValidatorCandidate) - updateParam("role_consensus", $RoleConsensus) + updateParam("role_consortium_member_candidate", $RoleConsortiumMemberCandidate) + updateParam("role_consortium_member", $RoleConsortiumMember) updateParam("role_delegate", $RoleDelegate) updateParam("role_developer", $RoleDeveloper) updateParam("role_investor_with_voting_rights", $RoleInvestor) - updateParam("role_validator", $RoleValidator) updateParam("role_creates_roles", $RoleCreatesRoles) } } \ No newline at end of file diff --git a/src/basic/contracts/ProfileEdit.sim b/src/basic/contracts/ProfileEdit.sim index afdeb402e..d436b6bc8 100644 --- a/src/basic/contracts/ProfileEdit.sim +++ b/src/basic/contracts/ProfileEdit.sim @@ -6,7 +6,7 @@ contract ProfileEdit { } conditions { - $member = DBFind("@1members").Where({"ecosystem": $ecosystem_id, "id": $key_id}).Row() + $member = DBFind("@1members").Where({"ecosystem": $ecosystem_id, "account": $account_id}).Row() $app_id = DBFind("@1applications").Where({"ecosystem": $ecosystem_id, "name": "Basic", "deleted": 0}).One("id") $ImageId = Int($ImageId) @@ -32,9 +32,9 @@ contract ProfileEdit { m["image_id"] = $ImageId if $member { - DBUpdateExt("@1members", {"ecosystem": $ecosystem_id, "id": $key_id}, m) + DBUpdateExt("@1members", {"ecosystem": $ecosystem_id, "account": $account_id}, m) } else { - m["id"] = $key_id + m["account"] = $account_id m["member_name"] = $Name m["ecosystem"] = $ecosystem_id DBInsert("@1members", m) diff --git a/src/basic/contracts/RoleConditions.sim b/src/basic/contracts/RoleConditions.sim index c15551b13..128351cc4 100644 --- a/src/basic/contracts/RoleConditions.sim +++ b/src/basic/contracts/RoleConditions.sim @@ -4,7 +4,7 @@ contract RoleConditions { } conditions { - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->name": $Role, "member->member_id": $key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->name": $Role, "member->account": $account_id, "deleted": 0}).Row() { warning Sprintf(LangRes("@1x_role_only_action", "en"), $Role) } } diff --git a/src/basic/contracts/RolesAccessCheck.sim b/src/basic/contracts/RolesAccessCheck.sim index 442aa8013..94256bce4 100644 --- a/src/basic/contracts/RolesAccessCheck.sim +++ b/src/basic/contracts/RolesAccessCheck.sim @@ -5,18 +5,18 @@ contract RolesAccessCheck { conditions { var role map - role = DBFind("@1roles").Where({"ecosystem": $ecosystem_id, "id": $Rid}).Columns("id,role_name,deleted,roles_access,role_type,creator->member_id").Row() + role = DBFind("@1roles").Where({"ecosystem": $ecosystem_id, "id": $Rid}).Columns("id,role_name,deleted,roles_access,role_type,creator->account").Row() if !role { warning Sprintf("%v: " + LangRes("@1role_not_found", "en"), $this_contract) } - if role["creator.member_id"] == $key_id { + if role["creator.account"] == $account_id { return } var rids array rids = JSONDecode(role["roles_access"]) - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() { warning Sprintf(LangRes("@1role_change_no_permission", "en"), role["role_name"]) } } diff --git a/src/basic/contracts/RolesAccessManager.sim b/src/basic/contracts/RolesAccessManager.sim index ad7069019..ae20e4d4a 100644 --- a/src/basic/contracts/RolesAccessManager.sim +++ b/src/basic/contracts/RolesAccessManager.sim @@ -22,7 +22,7 @@ contract RolesAccessManager { filled["role_type"] = $Type if !$buffer_id { - DBInsert("@1buffer_data", {ecosystem:$ecosystem_id, "member_id": $key_id, "key": "roles_access", "value": filled}) + DBInsert("@1buffer_data", {ecosystem:$ecosystem_id, "account": $account_id, "key": "roles_access", "value": filled}) } else { DBUpdate("@1buffer_data", Int($buffer_id), {"value": filled}) } @@ -56,7 +56,7 @@ contract RolesAccessManager { $buffer_id = 0 $ids = [] var buffer map - buffer = DBFind("@1buffer_data").Where({"ecosystem": $ecosystem_id, "member_id": $key_id, "key": "roles_access"}).Columns("id,value,value->roles_access").Row() + buffer = DBFind("@1buffer_data").Where({"ecosystem": $ecosystem_id, "account": $account_id, "key": "roles_access"}).Columns("id,value,value->roles_access").Row() if buffer { $buffer_managers = buffer["value.roles_access"] $buffer_id = buffer["id"] diff --git a/src/basic/contracts/RolesAssign.sim b/src/basic/contracts/RolesAssign.sim index 466a3743a..10955e1aa 100644 --- a/src/basic/contracts/RolesAssign.sim +++ b/src/basic/contracts/RolesAssign.sim @@ -1,29 +1,28 @@ contract RolesAssign { data { Rid int - MemberId int + MemberAccount string } - func getMemberInfo(kid int) map { + func getMemberInfo(account string) map { var res member map - member = DBFind("@1members").Where({"ecosystem": $ecosystem_id, "id": kid}).Row() + member = DBFind("@1members").Where({"ecosystem": $ecosystem_id, "account": account}).Row() if member { - res["member_id"] = member["id"] + res["account"] = member["account"] res["member_name"] = member["member_name"] res["image_id"] = member["image_id"] } else { - member = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": kid}).Row() - if member { - res["member_id"] = member["id"] - res["member_name"] = IdToAddress(Int(member["id"])) - res["image_id"] = 0 + if DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": account, "deleted": 0}).Row() { + res["account"] = account + res["member_name"] = account + res["image_id"] = "0" } } return res } conditions { - $role = DBFind("@1roles").Where({"id": $Rid}).Columns("id,deleted,role_type,role_name,image_id,creator->member_id").Row() + $role = DBFind("@1roles").Where({"id": $Rid}).Columns("id,deleted,role_type,role_name,image_id,creator->account").Row() if Int($role["role_type"]) == 2 { warning LangRes("@1elective_role_voting_only", "en") } @@ -31,8 +30,8 @@ contract RolesAssign { warning LangRes("@1role_not_found", "en") } - if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": $MemberId}).Row() { - warning LangRes("@1key_not_found", "en") + if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": $MemberAccount, "deleted": 0}).Row() { + warning LangRes("@1account_not_found", "en") } if $role["deleted"] == 1 { @@ -44,9 +43,9 @@ contract RolesAssign { if Len($stack) > 2{ prev_contract = $stack[Len($stack) - 2] } - specRules["@1VotingValidatorAccept"] = 1 + specRules["@1VotingConsortiumMemberAccept"] = 1 specRules["@1DelegateRefresh"] = 1 - specRules["@1ValidatorRequest"] = 1 + specRules["@1ConsortiumMemberRequest"] = 1 specRules["@1InvestorRefresh"] = 1 if specRules[prev_contract] != 1 { @@ -55,7 +54,7 @@ contract RolesAssign { } action { - if DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": $Rid, "member->member_id": $MemberId, "deleted": 0}).One("id") { + if DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": $Rid, "member->account": $MemberAccount, "deleted": 0}).One("id") { // do not re-assign and do not warning because this contract may be called for other return } @@ -65,8 +64,8 @@ contract RolesAssign { role["name"] = $role["role_name"] role["image_id"] = $role["image_id"] - member = getMemberInfo($MemberId) - appointer = getMemberInfo($key_id) + member = getMemberInfo($MemberAccount) + appointer = getMemberInfo($account_id) var m map m["role"] = role m["member"] = member diff --git a/src/basic/contracts/RolesCreate.sim b/src/basic/contracts/RolesCreate.sim index ad4296113..f38894acb 100644 --- a/src/basic/contracts/RolesCreate.sim +++ b/src/basic/contracts/RolesCreate.sim @@ -4,19 +4,18 @@ contract RolesCreate { Type int } - func getMemberInfo(kid int) map { + func getMemberInfo(account string) map { var res member map - member = DBFind("@1members").Where({"ecosystem": $ecosystem_id, "id": kid}).Row() + member = DBFind("@1members").Where({"ecosystem": $ecosystem_id, "account": account}).Row() if member { - res["member_id"] = member["id"] + res["account"] = member["account"] res["member_name"] = member["member_name"] res["image_id"] = member["image_id"] } else { - member = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": kid}).Row() - if member { - res["member_id"] = member["id"] - res["member_name"] = IdToAddress(Int(member["id"])) - res["image_id"] = 0 + if DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": account, "deleted": 0}).Row() { + res["account"] = account + res["member_name"] = account + res["image_id"] = "0" } } return res @@ -34,7 +33,7 @@ contract RolesCreate { if $check_access && Str($check_access) != "0" { var rids array rids = JSONDecode("["+$check_access+"]") - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() { warning LangRes("@1access_denied", "en") } } else { @@ -42,7 +41,7 @@ contract RolesCreate { admin_id = AppParam(Int($system_app_id), "role_admin", $ecosystem_id) var rids array rids = JSONDecode("["+admin_id+"]") - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() { warning LangRes("@1access_denied", "en") } } @@ -56,7 +55,7 @@ contract RolesCreate { action { var roles_access_arr array, buffer map - buffer = DBFind("@1buffer_data").Where({"ecosystem": $ecosystem_id, "member_id": $key_id, "key": "roles_access"}).Columns("id,value,value->roles_access").Row() + buffer = DBFind("@1buffer_data").Where({"ecosystem": $ecosystem_id, "account": $account_id, "key": "roles_access"}).Columns("id,value,value->roles_access").Row() if buffer { roles_access_arr = JSONDecode(buffer["value.roles_access"]) var filled map @@ -66,7 +65,7 @@ contract RolesCreate { DBUpdate("@1buffer_data", Int(buffer["id"]), {"value": filled}) } var m map - m["creator"] = getMemberInfo($key_id) + m["creator"] = getMemberInfo($account_id) m["role_name"] = $Name m["role_type"] = $Type m["date_created"] = $block_time diff --git a/src/basic/contracts/RolesInstall.sim b/src/basic/contracts/RolesInstall.sim index e7417f11d..2faa8b16c 100644 --- a/src/basic/contracts/RolesInstall.sim +++ b/src/basic/contracts/RolesInstall.sim @@ -30,7 +30,7 @@ contract RolesInstall { m["deleted"] = 0 m["creator->image_id"] = 0 m["creator->member_name"] = "founder" - m["creator->member_id"] = Str($key_id) + m["creator->account"] = Str($account_id) m["date_created"] = $block_time if managerId > 0 { m["roles_access"] = Sprintf("[%v]", managerId) @@ -48,7 +48,7 @@ contract RolesInstall { participant["role->type"] = m["role_type"] participant["role->name"] = m["role_name"] participant["role->image_id"] = 0 - participant["member->member_id"] = Str($key_id) + participant["member->account"] = Str($account_id) participant["member->member_name"] = "founder" participant["member->image_id"] = 0 participant["ecosystem"] = $ecosystem_id @@ -73,10 +73,10 @@ contract RolesInstall { addRole("Developer", true, managerId) if $ecosystem_id == 1 { - addRole("Consensus", false, managerId) - addRole("Candidate for validators", false, managerId) - addRole("Validator", false, managerId) - addRole("Investor with voting rights", false, managerId) + addRole("Consortium Member", true, managerId) + addRole("Consortium Member Candidate", false, managerId) + addRole("Sidechain Node", true, managerId) + addRole("Investor with Voting Rights", false, managerId) addRole("Delegate", false, managerId) } diff --git a/src/basic/contracts/RolesRequest.sim b/src/basic/contracts/RolesRequest.sim index bd1248a37..3e0ae0f03 100644 --- a/src/basic/contracts/RolesRequest.sim +++ b/src/basic/contracts/RolesRequest.sim @@ -8,11 +8,11 @@ contract RolesRequest { warning LangRes("@1role_not_found", "en") } - if DBFind("@1roles_participants").Where({"role->id": $Rid, "member->member_id":$key_id, "deleted": 0}).One("id") { + if DBFind("@1roles_participants").Where({"role->id": $Rid, "member->account": $account_id, "deleted": 0}).One("id") { warning LangRes("@1role_you_added_already", "en") } - if DBFind("@1notifications").Where({"ecosystem": $ecosystem_id, "page_name": "@1roles_request_view", "page_params->rid": $Rid, "sender->member_id": $key_id, "closed": 0}).One("id") { + if DBFind("@1notifications").Where({"ecosystem": $ecosystem_id, "page_name": "@1roles_request_view", "page_params->rid": $Rid, "sender->account": $account_id, "closed": 0}).One("id") { warning LangRes("@1request_sent_already", "en") } } @@ -21,9 +21,10 @@ contract RolesRequest { var params map params["rid"] = $Rid - var member_id int - member_id = EcosysParam("founder_account") + var founder_id int founder_account string + founder_id = Int(EcosysParam("founder_account")) + founder_account = IdToAddress(founder_id) - @1NotificationsSend("MemberId,Sender,Icon,Header,Body,Page,Params", member_id, 1, "fa-bars", LangRes("@1roles", "en"), LangRes("@1new_request_received", "en"), "@1roles_request_view", params) + @1NotificationsSend("MemberAccount,Sender,Icon,Header,Body,Page,Params", founder_account, 1, "fa-bars", LangRes("@1roles", "en"), LangRes("@1new_request_received", "en"), "@1roles_request_view", params) } } \ No newline at end of file diff --git a/src/basic/contracts/RolesRequestDecision.sim b/src/basic/contracts/RolesRequestDecision.sim index 6558cdfa7..206e9678d 100644 --- a/src/basic/contracts/RolesRequestDecision.sim +++ b/src/basic/contracts/RolesRequestDecision.sim @@ -3,14 +3,14 @@ contract RolesRequestDecision { Decision int NotificId int Rid int "optional" - MemberId int "optional" + MemberAccount string "optional" } conditions {} action { if $Decision == 1 { - @1RolesAssign("Rid,MemberId", $Rid, $MemberId) + @1RolesAssign("Rid,MemberAccount", $Rid, $MemberAccount) } if $NotificId > 0 { diff --git a/src/basic/contracts/RolesUnassign.sim b/src/basic/contracts/RolesUnassign.sim index 67e22e632..7af09b45b 100644 --- a/src/basic/contracts/RolesUnassign.sim +++ b/src/basic/contracts/RolesUnassign.sim @@ -21,9 +21,9 @@ contract RolesUnassign { if Len($stack) > 2{ prev_contract = $stack[Len($stack) - 2] } - specialRules["@1VotingValidatorAccept"] = 1 + specialRules["@1VotingConsortiumMemberAccept"] = 1 specialRules["@1DelegateRefresh"] = 1 - specialRules["@1ValidatorRequest"] = 1 + specialRules["@1ConsortiumMemberRequest"] = 1 specialRules["@1InvestorRefresh"] = 1 if specialRules[prev_contract] != 1 { diff --git a/src/basic/contracts/TokensDecDeposit.sim b/src/basic/contracts/TokensDecDeposit.sim index d64162934..80c41257f 100644 --- a/src/basic/contracts/TokensDecDeposit.sim +++ b/src/basic/contracts/TokensDecDeposit.sim @@ -1,6 +1,6 @@ contract TokensDecDeposit { data { - MemberId int + MemberAccount string Amount money } @@ -15,7 +15,7 @@ contract TokensDecDeposit { while i < Len(array_permissions) { var contract_name string contract_name = array_permissions[i] - if contract_name==prevContract { + if contract_name == prevContract { result = 1 } i = i + 1 @@ -33,6 +33,6 @@ contract TokensDecDeposit { action { var s map s["-deposit"] = $Amount - DBUpdate("@1keys",Int($MemberId),s) + DBUpdateExt("@1keys", {"account": $MemberAccount, "deleted": 0}, s) } } \ No newline at end of file diff --git a/src/basic/contracts/TokensIncDeposit.sim b/src/basic/contracts/TokensIncDeposit.sim index 42223fbb8..46eb29727 100644 --- a/src/basic/contracts/TokensIncDeposit.sim +++ b/src/basic/contracts/TokensIncDeposit.sim @@ -4,7 +4,7 @@ contract TokensIncDeposit { } conditions { - $amount = DBFind("@1keys").WhereId($key_id).Row() + $amount = DBFind("@1keys").Where({"account": $account_id, "deleted": 0}).Row() if Money($Amount) > (Money($amount["amount"]) - Money($amount["deposit"])){ warning LangRes("@1insufficient_funds", "en") } @@ -13,6 +13,6 @@ contract TokensIncDeposit { action { var s map s["+deposit"] = $Amount - DBUpdate("@1keys",$key_id,s) + DBUpdateExt("@1keys", {"account": $account_id, "deleted": 0}, s) } } \ No newline at end of file diff --git a/src/basic/contracts/TokensLockoutMember.sim b/src/basic/contracts/TokensLockoutMember.sim index b5807e7da..2a971d26b 100644 --- a/src/basic/contracts/TokensLockoutMember.sim +++ b/src/basic/contracts/TokensLockoutMember.sim @@ -1,6 +1,6 @@ contract TokensLockoutMember { data { - KeyId int + MemberAccount string Value int } @@ -15,7 +15,7 @@ contract TokensLockoutMember { while i < Len(array_permissions) { var contract_name string contract_name = array_permissions[i] - if contract_name==prevContract { + if contract_name == prevContract { result = 1 } i = i + 1 @@ -29,8 +29,8 @@ contract TokensLockoutMember { conditions { getPermission() - if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": $KeyId}).One("id") { - warning LangRes("@1key_not_found", "en") + if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": $MemberAccount, "deleted": 0}).One("account") { + warning LangRes("@1account_not_found", "en") } if Int($Value) < 0 || Int($Value) > 1 { @@ -39,6 +39,6 @@ contract TokensLockoutMember { } action { - DBUpdateExt("@1keys", {"ecosystem": $ecosystem_id, "id": $KeyId}, {"blocked": $Value}) + DBUpdateExt("@1keys", {"ecosystem": $ecosystem_id, "account": $MemberAccount, "deleted": 0}, {"blocked": $Value}) } } \ No newline at end of file diff --git a/src/basic/contracts/TokensRefundAccept.sim b/src/basic/contracts/TokensRefundAccept.sim index bb983066c..ea972014d 100644 --- a/src/basic/contracts/TokensRefundAccept.sim +++ b/src/basic/contracts/TokensRefundAccept.sim @@ -18,8 +18,8 @@ contract TokensRefundAccept { warning LangRes("@1tokens_refund_not_found", "en") } - $RecipientId = Int($tokenrefund["victim_key_id"]) - $SenderId = Int($tokenrefund["attacker_key_id"]) + $RecipientAccount = $tokenrefund["victim_account"] + $SenderAccount = $tokenrefund["attacker_account"] $amount = Money($tokenrefund["amount"]) $votingID = Int($tokenrefund["voting_id"]) @@ -28,11 +28,11 @@ contract TokensRefundAccept { } var sender map - sender = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": $SenderId}).Row() + sender = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": $SenderAccount, "deleted": 0}).Row() if !sender { warning LangRes("@1sender_invalid", "en") } - if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": $RecipientId}).Row() { + if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": $RecipientAccount, "deleted": 0}).Row() { warning LangRes("@1recipient_invalid", "en") } if sender["amount"] < $amount { @@ -42,10 +42,10 @@ contract TokensRefundAccept { action { if $tokenrefund["result"] == 0 { - TokensLockoutMember("KeyId,Value", $RecipientId, 0) - TokensLockoutMember("KeyId,Value", $SenderId, 0) + TokensLockoutMember("MemberAccount,Value", $RecipientAccount, 0) + TokensLockoutMember("MemberAccount,Value", $SenderAccount, 0) - @1TokensTransfer("Amount,SenderId,RecipientId,Comment", $amount, $SenderId, $RecipientId, "Refund tokens") + @1TokensTransfer("Amount,SenderAccount,RecipientAccount,Comment", $amount, $SenderAccount, $RecipientAccount, "Refund tokens") var m map m["status"] = 2 diff --git a/src/basic/contracts/TokensRefundReject.sim b/src/basic/contracts/TokensRefundReject.sim index 9c9212d82..234fcb26d 100644 --- a/src/basic/contracts/TokensRefundReject.sim +++ b/src/basic/contracts/TokensRefundReject.sim @@ -18,16 +18,16 @@ contract TokensRefundReject { warning LangRes("@1tokens_refund_not_found", "en") } - $RecipientId = Int($tokenrefund["victim_key_id"]) - $SenderId = Int($tokenrefund["attacker_key_id"]) + $RecipientAccount = $tokenrefund["victim_account"] + $SenderAccount = $tokenrefund["attacker_account"] $amount = Money($tokenrefund["amount"]) $votingID = Int($tokenrefund["voting_id"]) } action { if $tokenrefund["result"] == 0 { - TokensLockoutMember("KeyId,Value", $RecipientId, 0) - TokensLockoutMember("KeyId,Value", $SenderId, 0) + TokensLockoutMember("MemberAccount,Value", $RecipientAccount, 0) + TokensLockoutMember("MemberAccount,Value", $SenderAccount, 0) var m map m["status"] = 2 diff --git a/src/basic/contracts/TokensSend.sim b/src/basic/contracts/TokensSend.sim index 7e5bf6a96..5ae21cb45 100644 --- a/src/basic/contracts/TokensSend.sim +++ b/src/basic/contracts/TokensSend.sim @@ -29,14 +29,9 @@ contract TokensSend { conditions { getPermission() - - $recipient_id = AddressToId($Recipient) - if $recipient_id == 0 { - warning Sprintf(LangRes("@1recipient_x_invalid", "en"), $Recipient) - } } action { - @1TokensTransfer("Amount,SenderId,RecipientId,Comment,Ecosystem", $Amount, $key_id, $recipient_id, $Comment, $ecosystem_id) + @1TokensTransfer("Amount,SenderAccount,RecipientAccount,Comment,Ecosystem", $Amount, $account_id, $Recipient, $Comment, $ecosystem_id) } } \ No newline at end of file diff --git a/src/basic/contracts/TokensTransfer.sim b/src/basic/contracts/TokensTransfer.sim index 0879672e2..a10ca88fd 100644 --- a/src/basic/contracts/TokensTransfer.sim +++ b/src/basic/contracts/TokensTransfer.sim @@ -1,8 +1,8 @@ contract TokensTransfer { data { Amount money - SenderId int - RecipientId int + SenderAccount string + RecipientAccount string Comment string "optional" Ecosystem int "optional" } @@ -29,7 +29,7 @@ contract TokensTransfer { while i < Len(array_permissions) { var contract_name string contract_name = array_permissions[i] - if contract_name==prevContract { + if contract_name == prevContract { result = 1 } i = i + 1 @@ -42,10 +42,10 @@ contract TokensTransfer { func checkSender() { var sender_map map check_dep money - sender_map = DBFind("@1keys").Where({"id": $SenderId, "ecosystem": $e_id}).Row() + sender_map = DBFind("@1keys").Where({"ecosystem": $e_id, "account": $SenderAccount, "deleted": 0}).Row() if !sender_map { - warning Sprintf(LangRes("@1sender_x_invalid", "en"), $SenderId) + warning Sprintf(LangRes("@1sender_x_invalid", "en"), $SenderAccount) } if Int(sender_map["blocked"]) != 0 { warning LangRes("@1sender_blocked", "en") @@ -64,10 +64,10 @@ contract TokensTransfer { func checkRecipient() { var recipient_map map - recipient_map = DBFind("@1keys").Where({"id": $RecipientId, "ecosystem": $e_id}).Row() + recipient_map = DBFind("@1keys").Where({"ecosystem": $e_id, "account": $RecipientAccount, "deleted": 0}).Row() if !recipient_map { - warning Sprintf(LangRes("@1recipient_x_invalid", "en"), $RecipientId) + warning Sprintf(LangRes("@1recipient_x_invalid", "en"), $RecipientAccount) } if Int(recipient_map["blocked"]) != 0 { warning LangRes("@1recipient_blocked", "en") @@ -93,12 +93,12 @@ contract TokensTransfer { } action { - DBUpdateExt("@1keys", {"id": $SenderId, "ecosystem": $e_id}, {"-amount": $Amount}) - DBUpdateExt("@1keys", {"id": $RecipientId, "ecosystem": $e_id}, {"+amount": $Amount}) + DBUpdateExt("@1keys", {"ecosystem": $e_id, "account": $SenderAccount, "deleted": 0}, {"-amount": $Amount}) + DBUpdateExt("@1keys", {"ecosystem": $e_id, "account": $RecipientAccount, "deleted": 0}, {"+amount": $Amount}) var m map - m["sender_id"] = $SenderId - m["recipient_id"] = $RecipientId + m["sender_id"] = AddressToId($SenderAccount) + m["recipient_id"] = AddressToId($RecipientAccount) m["amount"] = $Amount m["comment"] = $Comment m["block_id"] = $block diff --git a/src/basic/contracts/ValidatorDelete.sim b/src/basic/contracts/ValidatorDelete.sim deleted file mode 100644 index 719a62101..000000000 --- a/src/basic/contracts/ValidatorDelete.sim +++ /dev/null @@ -1,21 +0,0 @@ -contract ValidatorDelete { - data { - Id int - } - - conditions { - var candidateId roleId int - roleId = 2 // Candidate for validators - candidateId = DBFind("@1validator_candidates").Where({"ecosystem": $ecosystem_id, "id": $Id}).One("candidate_key_id") - - $role = DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "deleted": 0, "role->id": roleId, "member->member_id": candidateId}).Row() - if !$role { - warning LangRes("@1candidate_role_not_found", "en") - } - } - - action { - DBUpdate("@1validator_candidates", $Id, {deleted:1}) - @1RolesUnassign("RowId", Int($role["id"])) - } -} \ No newline at end of file diff --git a/src/basic/contracts/VotingCandidateAccept.sim b/src/basic/contracts/VotingCandidateAccept.sim index 66108ab3c..380921628 100644 --- a/src/basic/contracts/VotingCandidateAccept.sim +++ b/src/basic/contracts/VotingCandidateAccept.sim @@ -1,7 +1,7 @@ contract VotingCandidateAccept { data { VotingId int - CandidateId int + CandidateAccount string RoleId int } @@ -12,7 +12,7 @@ contract VotingCandidateAccept { @1NotificationsClose("NotificId", role_id_search) } else { var id int - id = Int(DBFind("@1notifications").Where({"ecosystem": $ecosystem_id, "recipient->member_id": $key_id, "page_name": "@1voting_view", "page_params->voting_id": $VotingId, "closed": 0}).One("id")) + id = Int(DBFind("@1notifications").Where({"ecosystem": $ecosystem_id, "recipient->account": $account_id, "page_name": "@1voting_view", "page_params->voting_id": $VotingId, "closed": 0}).One("id")) if id > 0 { @1NotificationsClose("NotificId", id) } @@ -35,16 +35,16 @@ contract VotingCandidateAccept { if $voting["status"] != $STARTED { warning LangRes("@1voting_not_started", "en") } - $subject = DBFind("@1votings_subject").Where({"ecosystem": $ecosystem_id, "voting_id": $VotingId, "subject->member_id": $CandidateId}).Columns("id,number_accept,results").Row() + $subject = DBFind("@1votings_subject").Where({"ecosystem": $ecosystem_id, "voting_id": $VotingId, "subject->account": $CandidateAccount}).Columns("id,number_accept,results").Row() if !$subject { warning LangRes("@1voting_subject_not_found", "en") } if Int($voting["voting.type_participants"]) != 5 { - $participant = DBFind("@1votings_participants").Where({"ecosystem": $ecosystem_id, "voting_id": $VotingId, "member->member_id": $key_id, "decision": 0}).Columns("id,rating").Row() + $participant = DBFind("@1votings_participants").Where({"ecosystem": $ecosystem_id, "voting_id": $VotingId, "member->account": $account_id, "decision": 0}).Columns("id,rating").Row() } if Int($voting["voting.type_participants"]) == 5 { - $participant = DBFind("@1votings_participants").Where({"ecosystem": $ecosystem_id, "voting_id": $VotingId, "member->member_id": 0, "member->role_id": $RoleId, "decision": 0}).Columns("id,rating").Row() + $participant = DBFind("@1votings_participants").Where({"ecosystem": $ecosystem_id, "voting_id": $VotingId, "member->account": 0, "member->role_id": $RoleId, "decision": 0}).Columns("id,rating").Row() } if !$participant { warning LangRes("@1voting_not_participant", "en") @@ -53,16 +53,16 @@ contract VotingCandidateAccept { action { if Int($voting["voting.type_participants"]) == 5 { - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "member->member_id": $key_id, "role->id": $RoleId, "deleted": 0}).One("id") { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "member->account": $account_id, "role->id": $RoleId, "deleted": 0}).One("id") { warning LangRes("@1voting_not_participant", "en") } else { var member map - member["member_id"] = $key_id - member["member_name"] = IdToAddress($key_id) + member["account"] = $account_id + member["member_name"] = $account_id member["role_id"] = $RoleId var member_json string member_json = JSONEncode(member) - DBUpdate("@1votings_participants", Int($participant["id"]), {"member":member_json}) + DBUpdate("@1votings_participants", Int($participant["id"]), {"member": member_json}) } } @@ -73,7 +73,7 @@ contract VotingCandidateAccept { if $voting["flags.decision"] != 1 { var m map m["decision_date"] = $block_time - m["decision"] = $CandidateId + m["decision"] = AddressToId($CandidateAccount) DBUpdate("@1votings_participants", Int($participant["id"]), m) var p map diff --git a/src/basic/contracts/VotingValidatorAccept.sim b/src/basic/contracts/VotingConsortiumMemberAccept.sim similarity index 67% rename from src/basic/contracts/VotingValidatorAccept.sim rename to src/basic/contracts/VotingConsortiumMemberAccept.sim index e54cd12de..f8c705a5e 100644 --- a/src/basic/contracts/VotingValidatorAccept.sim +++ b/src/basic/contracts/VotingConsortiumMemberAccept.sim @@ -1,4 +1,4 @@ -contract VotingValidatorAccept { +contract VotingConsortiumMemberAccept { data { TemplateId string VotingId string @@ -26,7 +26,7 @@ contract VotingValidatorAccept { var appId tId int appId = Int(DBFind("@1applications").Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").One("id")) - tId = Int(AppParam(appId,"voting_template_validators", 1)) + tId = Int(AppParam(appId,"voting_template_consortium_member", 1)) if !DBFind("@1voting_templates").Where({"ecosystem": $ecosystem_id, "id": tId}).One("id") { warning LangRes("@1voting_template_not_found", "en") } @@ -35,24 +35,24 @@ contract VotingValidatorAccept { } var oldRoleId roleId int roleName string - oldRoleId = getRoleId("role_candidate_for_validators", false) - roleId = getRoleId("role_validator", true) + oldRoleId = getRoleId("role_consortium_member_candidate", false) + roleId = getRoleId("role_consortium_member", true) - var validator_map map - validator_map = DBFind("@1votings_subject").Where({"ecosystem": $ecosystem_id, "voting_id": $VotingId}).Columns("subject->contract_accept_params").One("subject->contract_accept_params") - if !validator_map { + var consortium_member_map map + consortium_member_map = DBFind("@1votings_subject").Where({"ecosystem": $ecosystem_id, "voting_id": $VotingId}).Columns("subject->contract_accept_params").One("subject->contract_accept_params") + if !consortium_member_map { warning LangRes("@1voting_subject_not_found", "en") } - validator_map = JSONDecode(validator_map) - $validator_id = Int(validator_map["ValidatorId"]) - $flag = validator_map["flag"] + consortium_member_map = JSONDecode(consortium_member_map) + $consortium_member = IdToAddress(Int(consortium_member_map["ConsortiumMemberId"])) + $flag = consortium_member_map["flag"] - $oldRoleRowId = Int(DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "deleted": 0, "role->id": oldRoleId, "member->member_id": $validator_id}).One("id")) - $roleRowId = Int(DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "deleted": 0, "role->id": roleId, "member->member_id": $validator_id}).One("id")) + $oldRoleRowId = Int(DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "deleted": 0, "role->id": oldRoleId, "member->account": $consortium_member}).One("id")) + $roleRowId = Int(DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "deleted": 0, "role->id": roleId, "member->account": $consortium_member}).One("id")) $roleId = Int(DBFind("@1roles").Where({"ecosystem": $ecosystem_id, "id": roleId, "deleted": 0}).One("id")) if $roleId == 0 { - warning LangRes("@1validator_role_not_found", "en") + warning LangRes("@1consortium_member_role_not_found", "en") } } @@ -61,7 +61,7 @@ contract VotingValidatorAccept { if $oldRoleRowId > 0 { @1RolesUnassign("RowId", $oldRoleRowId) } - @1RolesAssign("Rid,MemberId", $roleId, Int($validator_id)) + @1RolesAssign("Rid,MemberAccount", $roleId, $consortium_member) } if $flag == "remove" { if $roleRowId > 0 { diff --git a/src/basic/contracts/VotingCreate.sim b/src/basic/contracts/VotingCreate.sim index 6c8732c82..3fce2f473 100644 --- a/src/basic/contracts/VotingCreate.sim +++ b/src/basic/contracts/VotingCreate.sim @@ -99,8 +99,8 @@ contract VotingCreate { if $Type == 2 { var systemAllowed map systemAllowed["@1VotingRunEditPlatformParam"] = 1 - systemAllowed["@1VotingRunNewValidator"] = 1 - systemAllowed["@1VotingRunRemoveValidator"] = 1 + systemAllowed["@1VotingRunNewConsortiumMember"] = 1 + systemAllowed["@1VotingRunRemoveConsortiumMember"] = 1 systemAllowed["@1VotingRunVes"] = 1 systemAllowed["@1VotingRunTokenRefund"] = 1 systemAllowed["@1VotingRunEditEcosysParam"] = 1 @@ -109,7 +109,7 @@ contract VotingCreate { } } - $key = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": $key_id}).Row() + $key = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": $account_id, "deleted": 0}).Row() if !$key { warning LangRes("@1ecosystem_not_member", "en") } @@ -143,8 +143,8 @@ contract VotingCreate { flags["full_data"] = "0" flags["notifics"] = "0" - creator["member_id"] = $key["id"] - creator["member_name"] = IdToAddress($key_id) + creator["account"] = $account_id + creator["member_name"] = $account_id var m map m["voting"] = voting m["progress"] = progress diff --git a/src/basic/contracts/VotingDecisionAccept.sim b/src/basic/contracts/VotingDecisionAccept.sim index c64ee5063..8d050796f 100644 --- a/src/basic/contracts/VotingDecisionAccept.sim +++ b/src/basic/contracts/VotingDecisionAccept.sim @@ -11,7 +11,7 @@ contract VotingDecisionAccept { @1NotificationsClose("NotificId", role_id_search) } else { var id int - id = Int(DBFind("@1notifications").Where({"ecosystem": $ecosystem_id, "recipient->member_id": $key_id, "page_params->voting_id": $VotingId, "closed": 0}).One("id")) + id = Int(DBFind("@1notifications").Where({"ecosystem": $ecosystem_id, "recipient->account": $account_id, "page_params->voting_id": $VotingId, "closed": 0}).One("id")) if id > 0 { @1NotificationsClose("NotificId", id) } @@ -45,10 +45,10 @@ contract VotingDecisionAccept { } if Int($voting["voting.type_participants"]) != 5 { - $participant = DBFind("@1votings_participants").Where({"ecosystem": $ecosystem_id, "voting_id": $VotingId, "member->member_id": $key_id, "decision": 0}).Columns("id,rating").Row() + $participant = DBFind("@1votings_participants").Where({"ecosystem": $ecosystem_id, "voting_id": $VotingId, "member->account": $account_id, "decision": 0}).Columns("id,rating").Row() } if Int($voting["voting.type_participants"]) == 5 { - $participant = DBFind("@1votings_participants").Where({"ecosystem": $ecosystem_id, "voting_id": $VotingId, "member->member_id": 0, "member->role_id": $RoleId, "decision": 0}).Columns("id,rating").Row() + $participant = DBFind("@1votings_participants").Where({"ecosystem": $ecosystem_id, "voting_id": $VotingId, "member->account": 0, "member->role_id": $RoleId, "decision": 0}).Columns("id,rating").Row() } if !$participant { warning LangRes("@1voting_not_participant", "en") @@ -57,16 +57,16 @@ contract VotingDecisionAccept { action { if Int($voting["voting.type_participants"]) == 5 { - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "member->member_id": $key_id, "role->id": $RoleId, "deleted": 0}).One("id") { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "member->account": $account_id, "role->id": $RoleId, "deleted": 0}).One("id") { warning LangRes("@1voting_not_participant", "en") } else { var member map - member["member_id"] = $key_id - member["member_name"] = IdToAddress($key_id) + member["account"] = $account_id + member["member_name"] = $account_id member["role_id"] = $RoleId var member_json string member_json = JSONEncode(member) - DBUpdate("@1votings_participants", Int($participant["id"]), {"member":member_json}) + DBUpdate("@1votings_participants", Int($participant["id"]), {"member": member_json}) } } diff --git a/src/basic/contracts/VotingDecisionCheck.sim b/src/basic/contracts/VotingDecisionCheck.sim index c90d92dd1..f54a039a7 100644 --- a/src/basic/contracts/VotingDecisionCheck.sim +++ b/src/basic/contracts/VotingDecisionCheck.sim @@ -64,7 +64,7 @@ contract VotingDecisionCheck { flag_decision = $REJECT // none of the candidates has been added yet var subjects array - subjects = DBFind("@1votings_subject").Where({"ecosystem": $ecosystem_id, "voting_id": $VotingId, "results": {"$gt":0}}).Order({"results":"-1"}).Columns("subject->member_id,subject->member_name") + subjects = DBFind("@1votings_subject").Where({"ecosystem": $ecosystem_id, "voting_id": $VotingId, "results": {"$gt": 0}}).Order({"results": "-1"}).Columns("subject->account,subject->member_name") i = 0 while i < Len(subjects) { var subject map @@ -78,10 +78,10 @@ contract VotingDecisionCheck { role = DBFind("@1roles").Columns("id,role_type,role_name,image_id").Where({"ecosystem": $ecosystem_id, "id": buffer_id}).Row() if role { var member assignedMember map mid rid string - member["member_id"] = subject["subject.member_id"] - mid = member["member_id"] + member["account"] = subject["subject.account"] + mid = member["account"] rid = role["id"] - assignedMember = DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "member->member_id": mid, "role->id": rid, "deleted": 0}).Row() + assignedMember = DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "member->account": mid, "role->id": rid, "deleted": 0}).Row() if !assignedMember { member["member_name"] = subject["subject.member_name"] diff --git a/src/basic/contracts/VotingDecisionReject.sim b/src/basic/contracts/VotingDecisionReject.sim index 16aa5d34e..729dbb73e 100644 --- a/src/basic/contracts/VotingDecisionReject.sim +++ b/src/basic/contracts/VotingDecisionReject.sim @@ -11,7 +11,7 @@ contract VotingDecisionReject { @1NotificationsClose("NotificId", role_id_search) } else { var id int - id = Int(DBFind("@1notifications").Where({"ecosystem": $ecosystem_id, "recipient->member_id": $key_id, "page_params->voting_id": $VotingId, "closed": 0}).One("id")) + id = Int(DBFind("@1notifications").Where({"ecosystem": $ecosystem_id, "recipient->account": $account_id, "page_params->voting_id": $VotingId, "closed": 0}).One("id")) if id > 0 { @1NotificationsClose("NotificId", id) } @@ -45,10 +45,10 @@ contract VotingDecisionReject { } if Int($voting["voting.type_participants"]) != 5 { - $participant = DBFind("@1votings_participants").Where({"ecosystem": $ecosystem_id, "voting_id": $VotingId, "member->member_id": $key_id, "decision": 0}).Columns("id,rating").Row() + $participant = DBFind("@1votings_participants").Where({"ecosystem": $ecosystem_id, "voting_id": $VotingId, "member->account": $account_id, "decision": 0}).Columns("id,rating").Row() } if Int($voting["voting.type_participants"]) == 5 { - $participant = DBFind("@1votings_participants").Where({"ecosystem": $ecosystem_id, "voting_id": $VotingId, "member->member_id": 0, "member->role_id": $RoleId, "decision": 0}).Columns("id,rating").Row() + $participant = DBFind("@1votings_participants").Where({"ecosystem": $ecosystem_id, "voting_id": $VotingId, "member->account": 0, "member->role_id": $RoleId, "decision": 0}).Columns("id,rating").Row() } if !$participant { warning LangRes("@1voting_not_participant", "en") @@ -57,16 +57,16 @@ contract VotingDecisionReject { action { if Int($voting["voting.type_participants"]) == 5 { - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "member->member_id": $key_id, "role->id": $RoleId, "deleted": 0}).One("id") { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "member->account": $account_id, "role->id": $RoleId, "deleted": 0}).One("id") { warning LangRes("@1voting_not_participant", "en") } else { var member map - member["member_id"] = $key_id - member["member_name"] = IdToAddress($key_id) + member["account"] = $account_id + member["member_name"] = $account_id member["role_id"] = $RoleId var member_json string member_json = JSONEncode(member) - DBUpdate("@1votings_participants", Int($participant["id"]), {"member":member_json}) + DBUpdate("@1votings_participants", Int($participant["id"]), {"member": member_json}) } } diff --git a/src/basic/contracts/VotingDelete.sim b/src/basic/contracts/VotingDelete.sim index 4dca7fa34..11b0209f0 100644 --- a/src/basic/contracts/VotingDelete.sim +++ b/src/basic/contracts/VotingDelete.sim @@ -10,7 +10,7 @@ contract VotingDelete { $FINISHED = 4 var voting map - voting = DBFind("@1votings").Where({"ecosystem": $ecosystem_id, "id": $VotingId, "creator->member_id": $key_id, "status": $INVALID}).Columns("id").Row() + voting = DBFind("@1votings").Where({"ecosystem": $ecosystem_id, "id": $VotingId, "creator->account": $account_id, "status": $INVALID}).Columns("id").Row() if !voting { warning LangRes("@1voting_delete_impossible", "en") } diff --git a/src/basic/contracts/VotingInvite.sim b/src/basic/contracts/VotingInvite.sim index d64b702f0..36d806a61 100644 --- a/src/basic/contracts/VotingInvite.sim +++ b/src/basic/contracts/VotingInvite.sim @@ -1,20 +1,20 @@ contract VotingInvite { data { VotingId int - VarId int //0, member_id, role_id, group_id + VarId string //0, account, role_id, group_id } - func addVotingParticipant(votingId int, k_id int, r_id int) { + func addVotingParticipant(votingId int, k_id string, r_id string) { var m member role map - if k_id != 0 { - member["member_id"] = k_id - member["member_name"] = IdToAddress(k_id) + if k_id && k_id != "0" { + member["account"] = k_id + member["member_name"] = k_id } else { - member["member_id"] = 0 + member["account"] = 0 } - if r_id != 0 { + if r_id && r_id != "0" { member["role_id"] = r_id } @@ -31,11 +31,11 @@ contract VotingInvite { $STARTED = 3 $FINISHED = 4 - $voting = DBFind("@1votings").Where({"ecosystem": $ecosystem_id, "id": $VotingId, "status": [{"$neq": $STARTED},{"$neq": $FINISHED}]}).Columns("progress,progress->number_participants,voting->type_participants,voting->type,id,date_ended,creator->member_id").Row() + $voting = DBFind("@1votings").Where({"ecosystem": $ecosystem_id, "id": $VotingId, "status": [{"$neq": $STARTED}, {"$neq": $FINISHED}]}).Columns("progress,progress->number_participants,voting->type_participants,voting->type,id,date_ended,creator->account").Row() if !$voting { warning LangRes("@1voting_expired_can_not_add_participants", "en") } - if $voting["creator.member_id"] != $key_id { + if $voting["creator.account"] != $account_id { warning LangRes("@1access_denied", "en") } @@ -48,10 +48,10 @@ contract VotingInvite { } var isAdded string if $type_participants == 2 { - if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": $VarId}).Row(){ - warning LangRes("@1key_not_found", "en") + if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": $VarId, "deleted": 0}).Row(){ + warning LangRes("@1account_not_found", "en") } - isAdded = DBFind("@1votings_participants").Where({"ecosystem": $ecosystem_id, "voting_id": $VotingId, "member->member_id": $VarId}).One("id") + isAdded = DBFind("@1votings_participants").Where({"ecosystem": $ecosystem_id, "voting_id": $VotingId, "member->account": $VarId}).One("id") if isAdded { warning LangRes("@1member_added_before", "en") } @@ -93,40 +93,41 @@ contract VotingInvite { action { var i int if $type_participants == 1 { // everybody - var keys array - keys = DBFind("@1keys").Where({"id": {"$neq": $guest_key}, ecosystem:$ecosystem_id}) + var keys array guest_account string + guest_account = IdToAddress(Int($guest_key)) + keys = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": {"$neq": guest_account}, "deleted": 0}) while i < Len(keys) { var key map key = keys[i] - addVotingParticipant($VotingId, Int(key["id"]), 0) + addVotingParticipant($VotingId, key["account"], "0") $number_participants = $number_participants + 1 i = i + 1 } } if $type_participants == 2 { // manual var key map - key = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": $VarId}).Row() - addVotingParticipant($VotingId, Int(key["id"]), 0) + key = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": $VarId, "deleted": 0}).Row() + addVotingParticipant($VotingId, key["account"], "0") $number_participants = $number_participants + 1 } if $type_participants == 3 { // one role var roles array - roles = DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": $VarId, "deleted": 0}).Columns("member->member_id").Order("id") + roles = DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": $VarId, "deleted": 0}).Columns("member->account").Order("id") while i < Len(roles) { var role m map role = roles[i] - addVotingParticipant($VotingId, Int(role["member.member_id"]), 0) + addVotingParticipant($VotingId, role["member.account"], "0") $number_participants = $number_participants + 1 i = i + 1 } } if $type_participants == 4 { // all participants in the selected roles vote var roles array - roles = DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": $VarId, "deleted": 0}).Columns("member->member_id").Order("id") + roles = DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": $VarId, "deleted": 0}).Columns("member->account").Order("id") while i < Len(roles) { var role m map role = roles[i] - addVotingParticipant($VotingId, Int(role["member.member_id"]), $VarId) + addVotingParticipant($VotingId, role["member.account"], $VarId) $number_participants = $number_participants + 1 i = i + 1 } @@ -134,16 +135,16 @@ contract VotingInvite { if $type_participants == 5 { // one participant of the selected roles votes var rl map rl = DBFind("@1roles").Where({"ecosystem": $ecosystem_id, "id": $VarId}).Row() - addVotingParticipant($VotingId, 0, Int(rl["id"])) + addVotingParticipant($VotingId, "0", rl["id"]) $number_participants = $number_participants + 1 } if $type_participants == 6 { // one group var groups array - groups = DBFind("@1groups_participants").Where({"ecosystem": $ecosystem_id, "groups_info->id": $VarId, "deleted": 0}).Columns("member->member_id").Order("id") + groups = DBFind("@1groups_participants").Where({"ecosystem": $ecosystem_id, "groups_info->id": $VarId, "deleted": 0}).Columns("member->account").Order("id") while i < Len(groups) { var group m map group = groups[i] - addVotingParticipant($VotingId, Int(group["member.member_id"]), 0) + addVotingParticipant($VotingId, group["member.account"], "0") $number_participants = $number_participants + 1 i = i + 1 } @@ -154,6 +155,7 @@ contract VotingInvite { v["voting->role_id"] = $VarId } v["progress->number_participants"] = $number_participants + DBUpdate("@1votings", $VotingId, v) @1VotingStatusUpdate() } diff --git a/src/basic/contracts/VotingNotificationSend.sim b/src/basic/contracts/VotingNotificationSend.sim index 7e88b83ab..e0b998185 100644 --- a/src/basic/contracts/VotingNotificationSend.sim +++ b/src/basic/contracts/VotingNotificationSend.sim @@ -12,16 +12,16 @@ contract VotingNotificationSend { } conditions { - $voting = DBFind("@1votings").Columns("id,date_ended").Where({"ecosystem": $ecosystem_id, "id": $VotingId, "date_ended":[{"$gt": $block_time}]}).One("id") + $voting = DBFind("@1votings").Columns("id,date_ended").Where({"ecosystem": $ecosystem_id, "id": $VotingId, "date_ended": [{"$gt": $block_time}]}).One("id") if !$voting { warning LangRes("@1voting_expired_can_not_notify", "en") } - $voting = DBFind("@1votings").Columns("voting->name,creator->member_id,flags->notifics,flags,date_started").Where({"ecosystem": $ecosystem_id, "id": $VotingId, "date_started":[{"$gt": $block_time}]}).Row() + $voting = DBFind("@1votings").Columns("voting->name,creator->account,flags->notifics,flags,date_started").Where({"ecosystem": $ecosystem_id, "id": $VotingId, "date_started": [{"$gt": $block_time}]}).Row() if !$voting { warning LangRes("@1voting_not_started", "en") } - if $voting["creator.member_id"] != $key_id { + if $voting["creator.account"] != $account_id { warning LangRes("@1voting_not_creator", "en") } if $voting["flags.notifics"] == 1 { @@ -40,7 +40,7 @@ contract VotingNotificationSend { participant = participants[i] member = safeJsonToMap(participant["member"]) params["voting_id"] = $VotingId - @1NotificationsSend("MemberId,Sender,Icon,Header,Body,Page,Params", Int(member["member_id"]), 1, "fa-check", LangRes("@1voting", "en"), $voting_name, "voting_view", JSONEncode(params)) + @1NotificationsSend("MemberAccount,Sender,Icon,Header,Body,Page,Params", member["account"], 1, "fa-check", LangRes("@1voting", "en"), $voting_name, "voting_view", JSONEncode(params)) i = i + 1 } diff --git a/src/basic/contracts/VotingRunNewValidator.sim b/src/basic/contracts/VotingRunNewConsortiumMember.sim similarity index 83% rename from src/basic/contracts/VotingRunNewValidator.sim rename to src/basic/contracts/VotingRunNewConsortiumMember.sim index 11b5eec76..aef60cc07 100644 --- a/src/basic/contracts/VotingRunNewValidator.sim +++ b/src/basic/contracts/VotingRunNewConsortiumMember.sim @@ -1,6 +1,6 @@ -contract VotingRunNewValidator { +contract VotingRunNewConsortiumMember { data { - ValidatorId int + ConsortiumMemberId int } func warn(name, detail string) { @@ -65,11 +65,11 @@ contract VotingRunNewValidator { } } - func checkKeyId(keyid int) { + func checkKeyId(key int) { var existed map - existed = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": keyid}).Row() + existed = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": key}).Row() if !existed { - warning LangRes("@1key_not_found", "en") + warning LangRes("@1account_not_found", "en") } } @@ -99,20 +99,20 @@ contract VotingRunNewValidator { conditions { $app_id = Int(DBFind("@1applications").Where({"ecosystem": $ecosystem_id, "name": "Basic"}).One("id")) - $templateId = Int(DBFind("@1app_params").Where({"app_id": $app_id, "name": "voting_template_validators", "ecosystem": $ecosystem_id}).One("value")) + $templateId = Int(DBFind("@1app_params").Where({"app_id": $app_id, "name": "voting_template_consortium_member", "ecosystem": $ecosystem_id}).One("value")) if $templateId == 0 { warning LangRes("@1template_id_not_found", "en") } - $validator = DBFind("@1validator_candidates").Where({"id": $ValidatorId, "deleted": 0}).Row() - if !$validator { + $ConsortiumMember = DBFind("@1consortium_member_requests").Where({"id": $ConsortiumMemberId, "deleted": 0}).Row() + if !$ConsortiumMember { warning LangRes("@1candidate_not_found", "en") } - $TcpAddress = $validator["tcp_address"] - $ApiAddress = $validator["api_address"] - $KeyId = $validator["candidate_key_id"] - $PubKey = $validator["pub_key"] + $TcpAddress = $ConsortiumMember["tcp_address"] + $ApiAddress = $ConsortiumMember["api_address"] + $KeyId = AddressToId($ConsortiumMember["candidate_account"]) + $PubKey = $ConsortiumMember["pub_key"] checkKeyId(Int($KeyId)) checkPub($PubKey) @@ -137,7 +137,7 @@ contract VotingRunNewValidator { var pars map pars["Name"] = "full_nodes" pars["Value"] = JSONEncode(nodes) - pars["ValidatorId"] = Str($KeyId) + pars["ConsortiumMemberId"] = Str($KeyId) pars["flag"] = "add" @1VotingTemplateRun("TemplateId,Duration,ContractAcceptParams", $templateId, 14, JSONEncode(pars)) diff --git a/src/basic/contracts/VotingRunRemoveValidator.sim b/src/basic/contracts/VotingRunRemoveConsortiumMember.sim similarity index 86% rename from src/basic/contracts/VotingRunRemoveValidator.sim rename to src/basic/contracts/VotingRunRemoveConsortiumMember.sim index d0a16ebdb..8e08c070d 100644 --- a/src/basic/contracts/VotingRunRemoveValidator.sim +++ b/src/basic/contracts/VotingRunRemoveConsortiumMember.sim @@ -1,11 +1,11 @@ -contract VotingRunRemoveValidator { +contract VotingRunRemoveConsortiumMember { data { Index int } conditions { $app_id = Int(DBFind("@1applications").Where({"ecosystem": $ecosystem_id, "name": "Basic"}).One("id")) - $templateId = Int(DBFind("@1app_params").Where({"app_id": $app_id, "name": "voting_template_validators", "ecosystem": $ecosystem_id}).One("value")) + $templateId = Int(DBFind("@1app_params").Where({"app_id": $app_id, "name": "voting_template_consortium_member", "ecosystem": $ecosystem_id}).One("value")) if $templateId == 0 { warning LangRes("@1template_id_not_found", "en") } @@ -38,7 +38,7 @@ contract VotingRunRemoveValidator { var pars map pars["Name"] = "full_nodes" pars["Value"] = JSONEncode(nodesNew) - pars["ValidatorId"] = Str($KeyId) + pars["ConsortiumMemberId"] = Str($KeyId) pars["flag"] = "remove" @1VotingTemplateRun("TemplateId,Duration,ContractAcceptParams", $templateId, 14, JSONEncode(pars)) diff --git a/src/basic/contracts/VotingRunTokenRefund.sim b/src/basic/contracts/VotingRunTokenRefund.sim index 276c5ab4f..170deeef8 100644 --- a/src/basic/contracts/VotingRunTokenRefund.sim +++ b/src/basic/contracts/VotingRunTokenRefund.sim @@ -7,13 +7,11 @@ contract VotingRunTokenRefund { } conditions { - $victimId = AddressToId($VictimAccount) - $attackerId = AddressToId($SuspectAccount) - if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": $victimId}).Row() { - warning LangRes("@1victim_key_invalid", "en") + if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": $VictimAccount, "deleted": 0}).Row() { + warning LangRes("@1victim_wallet_invalid", "en") } - if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": $attackerId}).Row() { - warning LangRes("@1attacker_key_invalid", "en") + if !DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": $SuspectAccount, "deleted": 0}).Row() { + warning LangRes("@1attacker_wallet_invalid", "en") } if $Amount <= 0 { @@ -31,15 +29,15 @@ contract VotingRunTokenRefund { } action { - TokensLockoutMember("KeyId,Value", $victimId, 1) - TokensLockoutMember("KeyId,Value", $attackerId, 1) + TokensLockoutMember("MemberAccount,Value", $VictimAccount, 1) + TokensLockoutMember("MemberAccount,Value", $SuspectAccount, 1) var pars m map - m["victim_key_id"] = $victimId - m["attacker_key_id"] = $attackerId + m["victim_account"] = $VictimAccount + m["attacker_account"] = $SuspectAccount m["amount"] = $Amount m["note"] = $Note - m["validator_key_id"] = $key_id + m["consortium_member_account"] = $account_id m["blocked_at"] = $block_time m["status"] = 1 m["result"] = 0 diff --git a/src/basic/contracts/VotingStatusUpdate.sim b/src/basic/contracts/VotingStatusUpdate.sim index d1d5acb21..635ea4334 100644 --- a/src/basic/contracts/VotingStatusUpdate.sim +++ b/src/basic/contracts/VotingStatusUpdate.sim @@ -18,14 +18,14 @@ contract VotingStatusUpdate { i = i + 1 } } else { - voters = DBFind("@1votings_participants").Columns("member->member_id").Limit(10000).Where({"ecosystem": $ecosystem_id, "voting_id": id, "decision": 0}) + voters = DBFind("@1votings_participants").Columns("member->account").Limit(10000).Where({"ecosystem": $ecosystem_id, "voting_id": id, "decision": 0}) lenVoters = Len(voters) while i < lenVoters { - var voter memberId params map + var voter memberAccount params map voter = voters[i] - memberId = Int(voter["member.member_id"]) + memberAccount = voter["member.account"] params["voting_id"] = id - @1NotificationsSend("MemberId,Sender,Icon,Header,Body,Page,Params", memberId, 1, "fa-check", LangRes("@1voting", "en"), title, $page_name, params) + @1NotificationsSend("MemberAccount,Sender,Icon,Header,Body,Page,Params", memberAccount, 1, "fa-check", LangRes("@1voting", "en"), title, $page_name, params) i = i + 1 } } @@ -35,16 +35,16 @@ contract VotingStatusUpdate { if voting["voting.rating"] == 1 && voting["voting.type_participants"] != 5 { var id i lenVoters int voters array id = Int(voting["id"]) - voters = DBFind("@1votings_participants").Columns("id,member->member_id").Limit(10000).Where({"ecosystem": $ecosystem_id, "voting_id": id}) + voters = DBFind("@1votings_participants").Columns("id,member->account").Limit(10000).Where({"ecosystem": $ecosystem_id, "voting_id": id}) lenVoters = Len(voters) while i < lenVoters { - var voter map memberId int + var voter map memberAccount string voter = voters[i] - memberId = Int(voter["member.member_id"]) + memberAccount = voter["member.account"] var where rating map - where[$rating_wallet] = IdToAddress(memberId) + where[$rating_wallet] = memberAccount where["ecosystem"] = $ecosystem_id if GetColumnType($rating_table, $rating_amount) != "" { rating = DBFind($rating_table).Columns($request_columns).Where(where).Row() @@ -117,14 +117,14 @@ contract VotingStatusUpdate { action { //setting status INVALID - changeVotings({status:$WAITING, "flags->full_data":0}, {"status":$INVALID}) - changeVotings({status:$WAITING, "progress->number_participants":0}, {"status":$INVALID}) + changeVotings({"status": $WAITING, "flags->full_data": 0}, {"status": $INVALID}) + changeVotings({"status": $WAITING, "progress->number_participants": 0}, {"status": $INVALID}) //setting status WAITING - changeVotings({status:$INVALID, "flags->full_data":1, "progress->number_participants":{"$gt":0}}, {"status":$WAITING}) + changeVotings({"status": $INVALID, "flags->full_data": 1, "progress->number_participants": {"$gt": 0}}, {"status": $WAITING}) //setting status STARTED - changeVotings({status:$INVALID, "date_started":{"$lte":$block_time}, "flags->full_data":1, "progress->number_participants":{"$gt":0}}, {"status":$STARTED}) - changeVotings({status:$WAITING, "date_started":{"$lte":$block_time}}, {status:$STARTED}) + changeVotings({"status": $INVALID, "date_started": {"$lte": $block_time}, "flags->full_data": 1, "progress->number_participants": {"$gt": 0}}, {"status": $STARTED}) + changeVotings({"status": $WAITING, "date_started": {"$lte": $block_time}}, {"status": $STARTED}) //setting status FINISHED - changeVotings({status:$STARTED, "date_ended":{"$lte":$block_time}}, {"status":$FINISHED}) + changeVotings({"status": $STARTED, "date_ended": {"$lte": $block_time}}, {"status": $FINISHED}) } } \ No newline at end of file diff --git a/src/basic/contracts/VotingSubjectCandidates.sim b/src/basic/contracts/VotingSubjectCandidates.sim index f595ac79a..122d9d934 100644 --- a/src/basic/contracts/VotingSubjectCandidates.sim +++ b/src/basic/contracts/VotingSubjectCandidates.sim @@ -1,22 +1,21 @@ contract VotingSubjectCandidates { data { VotingId int - MemberId int + MemberAccount string } - func getMemberInfo(kid int) map { + func getMemberInfo(account string) map { var res member map - member = DBFind("@1members").Where({"ecosystem": $ecosystem_id, "id": kid}).Row() + member = DBFind("@1members").Where({"ecosystem": $ecosystem_id, "account": account}).Row() if member { - res["member_id"] = member["id"] + res["account"] = member["account"] res["member_name"] = member["member_name"] res["image_id"] = member["image_id"] } else { - member = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": kid}).Row() - if member { - res["member_id"] = member["id"] - res["member_name"] = IdToAddress(Int(member["id"])) - res["image_id"] = 0 + if DBFind("@1keys").Columns("id").Where({"ecosystem": $ecosystem_id, "account": account, "deleted": 0}).Row() { + res["account"] = account + res["member_name"] = account + res["image_id"] = "0" } } return res @@ -25,12 +24,12 @@ contract VotingSubjectCandidates { conditions { $STARTED = 3 $FINISHED = 4 - $voting = DBFind("@1votings").Where({"ecosystem": $ecosystem_id, "id": $VotingId}).Columns("id,optional->number_candidates,voting->type,flags->full_data,status,creator->member_id,voting->type_decision").Row() + $voting = DBFind("@1votings").Where({"ecosystem": $ecosystem_id, "id": $VotingId}).Columns("id,optional->number_candidates,voting->type,flags->full_data,status,creator->account,voting->type_decision").Row() if !$voting { warning LangRes("@1voting_started_can_not_edit", "en") } - if $voting["creator.member_id"] != $key_id { - if $voting["voting.type_decision"] != 1 && $MemberId != $key_id { + if $voting["creator.account"] != $account_id { + if $voting["voting.type_decision"] != 1 && $MemberAccount != $account_id { warning LangRes("@1access_denied", "en") } } @@ -45,22 +44,22 @@ contract VotingSubjectCandidates { warning LangRes("@1system_voting_can_not_edit", "en") } - if $MemberId == 0 { - $MemberId = $key_id + if !$MemberAccount || $MemberAccount == "0" { + $MemberAccount = $account_id } - if DBFind("@1votings_subject").Where({"ecosystem": $ecosystem_id, "voting_id": $VotingId, "subject->member_id": $MemberId}).One("id") { + if DBFind("@1votings_subject").Where({"ecosystem": $ecosystem_id, "voting_id": $VotingId, "subject->account": $MemberAccount}).One("id") { warning LangRes("@1candidate_added_before", "en") } - $member = getMemberInfo($MemberId) + $member = getMemberInfo($MemberAccount) if !$member { - warning Sprintf(LangRes("@1key_not_found", "en") + " (%v)", $MemberId) + warning Sprintf(LangRes("@1account_not_found", "en") + " (%v)", $MemberAccount) } } action { - DBInsert("@1votings_subject", {ecosystem: $ecosystem_id, voting_id:$VotingId, subject:$member}) + DBInsert("@1votings_subject", {ecosystem: $ecosystem_id, voting_id: $VotingId, subject: $member}) var m map m["optional->number_candidates"] = Int($voting["optional.number_candidates"]) + 1 DBUpdate("@1votings", $VotingId, m) diff --git a/src/basic/contracts/VotingSubjectContract.sim b/src/basic/contracts/VotingSubjectContract.sim index b209ccb51..c8b8cad23 100644 --- a/src/basic/contracts/VotingSubjectContract.sim +++ b/src/basic/contracts/VotingSubjectContract.sim @@ -22,11 +22,11 @@ contract VotingSubjectContract { $STARTED = 3 $FINISHED = 4 - $voting = DBFind("@1votings").Where({"ecosystem": $ecosystem_id, "id": $VotingId, "status":[{"$neq":$STARTED},{"$neq":$FINISHED}]}).Columns("id,date_started,voting->type,flags->full_data,optional,creator->member_id").Row() + $voting = DBFind("@1votings").Where({"ecosystem": $ecosystem_id, "id": $VotingId, "status": [{"$neq": $STARTED}, {"$neq": $FINISHED}]}).Columns("id,date_started,voting->type,flags->full_data,optional,creator->account").Row() if !$voting { warning LangRes("@1voting_started_can_not_edit", "en") } - if $voting["creator.member_id"] != $key_id { + if $voting["creator.account"] != $account_id { warning LangRes("@1access_denied", "en") } if $voting["flags.full_data"] == 1 && $voting["voting.type"] == 2 { diff --git a/src/basic/contracts/VotingSubjectDocument.sim b/src/basic/contracts/VotingSubjectDocument.sim index e2e0f7ce9..fccf7514e 100644 --- a/src/basic/contracts/VotingSubjectDocument.sim +++ b/src/basic/contracts/VotingSubjectDocument.sim @@ -18,11 +18,11 @@ contract VotingSubjectDocument { conditions { $STARTED = 3 $FINISHED = 4 - $voting = DBFind("@1votings").Where({"ecosystem": $ecosystem_id, "id": $VotingId, "status":[{"$neq":$STARTED},{"$neq":$FINISHED}]}).Columns("id,date_started,flags->full_data,voting->type,optional,creator->member_id").Row() + $voting = DBFind("@1votings").Where({"ecosystem": $ecosystem_id, "id": $VotingId, "status": [{"$neq": $STARTED}, {"$neq": $FINISHED}]}).Columns("id,date_started,flags->full_data,voting->type,optional,creator->account").Row() if !$voting { warning LangRes("@1voting_started_can_not_edit", "en") } - if $voting["creator.member_id"] != $key_id { + if $voting["creator.account"] != $account_id { warning LangRes("@1access_denied", "en") } diff --git a/src/basic/contracts/VotingSubjectSettings.sim b/src/basic/contracts/VotingSubjectSettings.sim index 7876a9808..45da0b148 100644 --- a/src/basic/contracts/VotingSubjectSettings.sim +++ b/src/basic/contracts/VotingSubjectSettings.sim @@ -23,12 +23,12 @@ contract VotingSubjectSettings { $STARTED = 3 $FINISHED = 4 - $voting = DBFind("@1votings").Where({"ecosystem": $ecosystem_id, "id": $VotingId, "status":[{"$neq": $STARTED},{"$neq": $FINISHED}]}).Columns("optional,voting->type,flags->full_data,creator->member_id").Row() + $voting = DBFind("@1votings").Where({"ecosystem": $ecosystem_id, "id": $VotingId, "status": [{"$neq": $STARTED}, {"$neq": $FINISHED}]}).Columns("optional,voting->type,flags->full_data,creator->account").Row() if !$voting { warning LangRes("@1voting_started_can_not_edit", "en") } - if $voting["creator.member_id"] != $key_id { + if $voting["creator.account"] != $account_id { warning LangRes("@1access_denied", "en") } if $voting["flags.full_data"] == 1 && $voting["voting.type"] == 2 { diff --git a/src/basic/contracts/VotingTemplateRun.sim b/src/basic/contracts/VotingTemplateRun.sim index 9d31ce8bc..72f074a3a 100644 --- a/src/basic/contracts/VotingTemplateRun.sim +++ b/src/basic/contracts/VotingTemplateRun.sim @@ -16,7 +16,7 @@ contract VotingTemplateRun { func getPermission() { var array_permissions array result i int prevContract string - array_permissions = ["@1VotingRunEditPlatformParam", "@1VotingRunNewValidator", "@1VotingRunRemoveValidator", "@1VotingRunVes", "@1VotingRunTokenRefund", "@1VotingRunEditEcosysParam"] + array_permissions = ["@1VotingRunEditPlatformParam", "@1VotingRunNewConsortiumMember", "@1VotingRunRemoveConsortiumMember", "@1VotingRunVes", "@1VotingRunTokenRefund", "@1VotingRunEditEcosysParam"] prevContract = $stack[0] if Len($stack) > 2 { @@ -111,7 +111,7 @@ contract VotingTemplateRun { if !DBFind("@1roles").Where({"ecosystem": $ecosystem_id, "id": $s_voters, "deleted": 0}).One("id") { warning Sprintf(LangRes("@1voters_role_id_not_found", "en"), $s_voters) } - if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "deleted": 0, "role->id": $s_voters, "member->member_id": $key_id}).One("id") { + if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "deleted": 0, "role->id": $s_voters, "member->account": $account_id}).One("id") { warning LangRes("@1role_not_involved", "en") } } @@ -152,7 +152,7 @@ contract VotingTemplateRun { // setting the subject of the vote if $v_type_decision == 1 || $v_type_decision == 2 { - @1VotingSubjectCandidates("VotingId,MemberId", votingId, $key_id) + @1VotingSubjectCandidates("VotingId,MemberAccount", votingId, $account_id) @1VotingSubjectSettings("VotingId,RoleId,Vacancies,OptContractAcceptName,OptContractAcceptParams,OptContractRejectName,OptContractRejectParams", votingId, $s_candidates, $s_vacancies, $o_contract_accept, JSONEncode(o_accept_params), $o_contract_reject, JSONEncode(o_reject_params)) } diff --git a/src/basic/contracts/VotingTemplatesInstall.sim b/src/basic/contracts/VotingTemplatesInstall.sim index cb97724d8..f23e3cffe 100644 --- a/src/basic/contracts/VotingTemplatesInstall.sim +++ b/src/basic/contracts/VotingTemplatesInstall.sim @@ -38,7 +38,7 @@ contract VotingTemplatesInstall { template["voting->type_participants"] = 3 template["subject->candidates"] = 0 template["subject->vacancies"] = 0 - template["subject->voters"] = $consensusRoleId + template["subject->voters"] = $consortiumMemberRoleId template["subject->contract_accept"] = "@1UpdateSysParam" template["subject->contract_reject"] = "" template["optional->contract_accept"] = "" @@ -50,8 +50,8 @@ contract VotingTemplatesInstall { template["ecosystem"] = 1 applyTemplate(template, "voting_template_platformparams") - // Validator - template["voting->name"] = "Voting for Validator" + // Consortium Member + template["voting->name"] = "Voting for Consortium Member" template["voting->type"] = 2 template["voting->volume"] = 75 template["voting->quorum"] = 75 @@ -61,17 +61,17 @@ contract VotingTemplatesInstall { template["voting->type_participants"] = 3 template["subject->candidates"] = 0 template["subject->vacancies"] = 0 - template["subject->voters"] = $consensusRoleId + template["subject->voters"] = $consortiumMemberRoleId template["subject->contract_accept"] = "@1UpdateSysParam" template["subject->contract_reject"] = "" - template["optional->contract_accept"] = "VotingValidatorAccept" + template["optional->contract_accept"] = "VotingConsortiumMemberAccept" template["optional->contract_reject"] = "" template["optional->init_contract"] = "" template["optional->contract_accept_params"] = "" template["optional->contract_reject_params"] = "" template["optional->init_contract_params"] = "" template["ecosystem"] = 1 - applyTemplate(template, "voting_template_validators") + applyTemplate(template, "voting_template_consortium_member") // Valued ecosystem template["voting->name"] = "Voting for Valued Ecosystem" @@ -84,7 +84,7 @@ contract VotingTemplatesInstall { template["voting->type_participants"] = 3 template["subject->candidates"] = 0 template["subject->vacancies"] = 0 - template["subject->voters"] = $consensusRoleId + template["subject->voters"] = $consortiumMemberRoleId template["subject->contract_accept"] = "VotingVesAccept" template["subject->contract_reject"] = "" template["optional->contract_accept"] = "" @@ -107,7 +107,7 @@ contract VotingTemplatesInstall { template["voting->type_participants"] = 3 template["subject->candidates"] = 0 template["subject->vacancies"] = 0 - template["subject->voters"] = $consensusRoleId + template["subject->voters"] = $consortiumMemberRoleId template["subject->contract_accept"] = "TokensRefundAccept" template["subject->contract_reject"] = "TokensRefundReject" template["optional->contract_accept"] = "" @@ -130,7 +130,7 @@ contract VotingTemplatesInstall { template["voting->type_participants"] = 3 template["subject->candidates"] = 0 template["subject->vacancies"] = 0 - template["subject->voters"] = $consensusRoleId + template["subject->voters"] = $consortiumMemberRoleId template["subject->contract_accept"] = "@1EditParameter" template["subject->contract_reject"] = "" template["optional->contract_accept"] = "" @@ -173,8 +173,7 @@ contract VotingTemplatesInstall { conditions { $app_id = Int(DBFind("@1applications").Where({"ecosystem": $ecosystem_id, "name": "Basic"}).One("id")) $system_app_id = DBFind("@1applications").Where({"ecosystem": $ecosystem_id, "name": "System"}).One("id") - $consensusRoleId = getRoleId("role_consensus") - $validatorRoleId = getRoleId("role_validator") + $consortiumMemberRoleId = getRoleId("role_consortium_member") } action { diff --git a/src/basic/contracts/VotingWizardBuffer.sim b/src/basic/contracts/VotingWizardBuffer.sim index 0075f2126..c344495ae 100644 --- a/src/basic/contracts/VotingWizardBuffer.sim +++ b/src/basic/contracts/VotingWizardBuffer.sim @@ -32,12 +32,12 @@ contract VotingWizardBuffer { action { if $LoadAutosave == "no" { - DBUpdateExt("@1buffer_data", {"key": "voting_wizard_buffer", "member_id": $key_id, "ecosystem": $ecosystem_id}, {"value": "{}"}) + DBUpdateExt("@1buffer_data", {"key": "voting_wizard_buffer", "account": $account_id, "ecosystem": $ecosystem_id}, {"value": "{}"}) } var buffer_map old_buffer old_value map - old_buffer = DBFind("@1buffer_data").Where({"key": "voting_wizard_buffer", "member_id": $key_id, "ecosystem": $ecosystem_id}).Row() + old_buffer = DBFind("@1buffer_data").Where({"key": "voting_wizard_buffer", "account": $account_id, "ecosystem": $ecosystem_id}).Row() if old_buffer { old_value = JSONDecode(old_buffer["value"]) } @@ -181,9 +181,9 @@ contract VotingWizardBuffer { } if old_buffer { - DBUpdateExt("@1buffer_data", {"key": "voting_wizard_buffer", "member_id": $key_id, "ecosystem": $ecosystem_id}, {"value": buffer_map}) + DBUpdateExt("@1buffer_data", {"key": "voting_wizard_buffer", "account": $account_id, "ecosystem": $ecosystem_id}, {"value": buffer_map}) } else { - DBInsert("@1buffer_data", {"key": "voting_wizard_buffer", "member_id": $key_id, "ecosystem": $ecosystem_id, "value": buffer_map}) + DBInsert("@1buffer_data", {"key": "voting_wizard_buffer", "account": $account_id, "ecosystem": $ecosystem_id, "value": buffer_map}) } } } \ No newline at end of file diff --git a/src/basic/contracts/VotingWizardCreate.sim b/src/basic/contracts/VotingWizardCreate.sim index 565f3cd95..d164d7913 100644 --- a/src/basic/contracts/VotingWizardCreate.sim +++ b/src/basic/contracts/VotingWizardCreate.sim @@ -37,9 +37,9 @@ contract VotingWizardCreate { current_participant = Int(participants_list[i]) var participants_count int if type == "role" { - participants_count = Len(DBFind("@1roles_participants").Where({ecosystem: $ecosystem_id, "role->id": current_participant, deleted: 0})) + participants_count = Len(DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": current_participant, "deleted": 0})) } elif type == "group" { - participants_count = Len(DBFind("@1groups_participants").Where({ecosystem: $ecosystem_id, "groups_info->id": current_participant, deleted: 0})) + participants_count = Len(DBFind("@1groups_participants").Where({"ecosystem": $ecosystem_id, "groups_info->id": current_participant, "deleted": 0})) } if type == "member" || participants_count != 0 { @@ -86,7 +86,7 @@ contract VotingWizardCreate { if $TypeDecision == 1 && $Apply == 1 { m["VotingId"] = voting_id - m["MemberId"] = 0 + m["MemberAccount"] = 0 CallContract("@1VotingSubjectCandidates", m) subject_map["RoleId"] = Int($RoleId) subject_map["Vacancies"] = Int($Vacancies) @@ -97,7 +97,7 @@ contract VotingWizardCreate { i = 0 while i < Len(candidates_list) { m["VotingId"] = voting_id - m["MemberId"] = Int(candidates_list[i]) + m["MemberAccount"] = candidates_list[i] CallContract("@1VotingSubjectCandidates", m) i = i + 1 } @@ -118,6 +118,6 @@ contract VotingWizardCreate { } elif Str($GroupParticipants) != "0" { sendInvites(voting_id, $GroupParticipants, "group") } - DBUpdateExt("@1buffer_data", {"key": "voting_wizard_buffer", "member_id": $key_id, "ecosystem": $ecosystem_id}, {"value": "{}"}) + DBUpdateExt("@1buffer_data", {"key": "voting_wizard_buffer", "account": $account_id, "ecosystem": $ecosystem_id}, {"value": "{}"}) } } \ No newline at end of file diff --git a/src/basic/menus/admin_menu.ptl b/src/basic/menus/admin_menu.ptl index d9bdf2eca..df9c8390a 100644 --- a/src/basic/menus/admin_menu.ptl +++ b/src/basic/menus/admin_menu.ptl @@ -4,5 +4,5 @@ MenuItem(Title:$@1platform_parameters$, Page:@1sysparams_list, Icon:"icon-settin MenuItem(Title:$@1roles$, Page:@1roles_list, Icon:"icon-pie-chart") MenuItem(Title:$@1groups$, Page:@1groups_list, Icon:"icon-user-following") MenuItem(Title:$@1tokens_refund$, Page:@1tokenrefund_list, Icon:"icon-shuffle") -MenuItem(Title:$@1validators$, Page:@1validator_candidates_list, Icon:"icon-graduation") +MenuItem(Title:$@1consortium_members$, Page:@1consortium_member_candidates, Icon:"icon-graduation") MenuItem(Title:$@1pa_settings$, Page:@1platform_apps_settings, Icon: "icon-wrench") \ No newline at end of file diff --git a/src/basic/pages/validator_candidates_list.ptl b/src/basic/pages/consortium_member_candidates.ptl similarity index 61% rename from src/basic/pages/validator_candidates_list.ptl rename to src/basic/pages/consortium_member_candidates.ptl index 405785c6f..bdf436346 100644 --- a/src/basic/pages/validator_candidates_list.ptl +++ b/src/basic/pages/consortium_member_candidates.ptl @@ -1,12 +1,12 @@ -SetVar(this_page, @1validator_candidates_list).(this_table, @1validator_candidates) +SetVar(this_page, @1consortium_member_candidates).(this_table, @1consortium_member_requests) Include(@1pager_header) -SetTitle("$@1validators$") -Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$@1sysparams_candidates_list_desc$")) -AddToolButton(Title: $@1create_request$, Icon: icon-plus, Page: @1validator_candidates_create).Popup(50, $@1sysparams_candidate_validators_form$) +SetTitle("$@1consortium_member_candidates$") +Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$@1consortium_member_candidates_list_desc$")) +AddToolButton(Title: $@1create_request$, Icon: icon-plus, Page: @1consortium_member_request).Popup(50, $@1consortium_member_request_form$) If(#search#){ - SetVar(where, {{"host_ip": {"$ilike": "#search#"}}, "deleted": 0}) + SetVar(where, {"host_ip": {"$ilike": "#search#"}, "deleted": 0}) }.Else{ SetVar(where, {"deleted": 0}) } @@ -16,16 +16,16 @@ Div(list-group-item ml-lg mr-lg pt-lg){ Include(@1search) } -DBFind(@1applications).Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) -SetVar(template_id, AppParam(Ecosystem:1, App:#application_id#, Name: voting_template_validators)) +DBFind("@1applications").Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) +SetVar(template_id, AppParam(Ecosystem: 1, App: #application_id#, Name: voting_template_consortium_member)) If(#template_id# > 0){ - DBFind(@1voting_templates).Where({"ecosystem": #ecosystem_id#, "id": #template_id#}).Columns("subject->voters").Vars(template) + DBFind("@1voting_templates").Where({"ecosystem": "#ecosystem_id#", "id": "#template_id#"}).Columns("subject->voters").Vars(template) } DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_actions){ - If(And(#template_subject_voters#>0,#template_subject_voters#==#role_id#)){ + If(And(#template_subject_voters# > 0, #template_subject_voters# == #role_id#)){ Form(btn-group pull-right){ - Button(Contract: @1VotingRunNewValidator, Params: "ValidatorId=#id#", Page: @1voting_list, Class: btn btn-default fa fa-play) + Button(Contract: @1VotingRunNewConsortiumMember, Params: "ConsortiumMemberId=#id#", Page: @1voting_list, Class: btn btn-default fa fa-play) } }.Else{ If(#template_id# > 0){ @@ -45,18 +45,18 @@ DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).O }.Custom(_comment){ Span(Class: h6, Body: #comment#) }.Custom(custom_username){ - SetVar(user_member_name, "") - DBFind(@1members).Where({"id": #candidate_key_id#, "ecosystem": #ecosystem_id#}).Vars(user) - If(#user_member_name##==""){ - SetVar(user_member_name, Address(#candidate_key_id#)) + SetVar(user_member_name,) + DBFind("@1members").Where({"account": "#candidate_account#", "ecosystem": "#ecosystem_id#"}).Vars(user) + If(#user_member_name# == ""){ + SetVar(user_member_name, #candidate_account#) } - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#candidate_key_id#"){ + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#candidate_account#"){ If(#user_image_id#>0){ - Image(Src: Binary().ById(#user_image_id#), Class: img-circle).Style(height: 30px;width: 30px; border: 1px solid #5A5D63; margin-right: 10px;) + Image(Src: Binary().ById(#user_image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63; margin-right: 10px;) Span(#user_member_name#) }.Else{ Div(){ - Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;) + Span(Em(Class: fa icon-user fa-2x)).Style(margin-right: 10px;) Span(#user_member_name#) }.Style(display:flex; align-items:center;) } @@ -69,7 +69,7 @@ Div(fullscreen){ If(#count# > 0){ Table(src, "$@1name$=custom_username,$@1api_address$=_api_address,$@1tcp_address$=_tcp_address,$@1hardware_description$=_description,$@1comment$=_comment,$@1date_created$=_date,$@1voting$=_actions") }.Else{ - Div(Class: text-center h4 text-muted, Body: "$@1sysparams_candidates$ $@1not_founded$") + Div(Class: text-center h4 text-muted, Body: "$@1consortium_member_candidates$ $@1not_founded$") } }.Style( margin-top:-15px; diff --git a/src/basic/pages/consortium_member_request.ptl b/src/basic/pages/consortium_member_request.ptl new file mode 100644 index 000000000..64e37aa74 --- /dev/null +++ b/src/basic/pages/consortium_member_request.ptl @@ -0,0 +1,58 @@ +Form(){ + Div(row){ + Div(col-md-4 mt-sm text-right){ + Label(LangRes(@1tcp_address)) + Span(Class: text-danger, Body:*) + } + Div(col-md-8 text-left){ + Input(Name: TcpAddress, Placeholder: "xxx.xxx.xxx.xxx:port") + } + } + Div(row mt-sm){ + Div(col-md-4 mt-sm text-right){ + Label(LangRes(@1api_address)) + Span(Class: text-danger, Body:*) + } + Div(col-md-8 text-left){ + Input(Name: ApiAddress, Placeholder: "protocol://xxx.xxx.xxx.xxx:port") + } + } + Div(row mt-sm){ + Div(col-md-4 mt-sm text-right){ + Label(LangRes(@1node_founder_account)) + Span(Class: text-danger, Body:*) + } + Div(col-md-8 text-left){ + Input(Name: CandidateAccount, Disabled: true, Value: #account_id#) + Div(Class: m0 h6 text-muted, Body: LangRes(@1node_founder_key_id): AddressToId(#account_id#)) + } + } + Div(row mt-sm){ + Div(col-md-4 mt-sm text-right){ + Label(LangRes(@1node_pub_key)) + Span(Class: text-danger, Body:*) + } + Div(col-md-8 text-left){ + Input(Name: PubKey, Type: textarea).Style(resize:vertical) + } + } + Div(row mt-sm){ + Div(col-md-4 mt-sm text-right){ + Label(LangRes(@1hardware_description)) + } + Div(col-md-8 text-left){ + Input(Name: Description, Type: textarea).Style(resize:vertical) + } + } + Div(row mt-sm){ + Div(col-md-4 mt-sm text-right){ + Label(LangRes(@1comment)) + } + Div(col-md-8 text-left){ + Input(Name: Comment, Type: textarea).Style(resize:vertical) + } + } + + Button(Contract: @1ConsortiumMemberRequest, Class: btn btn-primary pull-right mt, Page: @1consortium_member_candidates, Body: $@1send_request$) + Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1consortium_member_candidates) +} \ No newline at end of file diff --git a/src/basic/pages/consortium_member_resign.ptl b/src/basic/pages/consortium_member_resign.ptl new file mode 100644 index 000000000..dc742309b --- /dev/null +++ b/src/basic/pages/consortium_member_resign.ptl @@ -0,0 +1,14 @@ +Form(){ + Div(row){ + Div(col-sm-12 text-center h4){ + $@1consortium_member_removing_desc$ + } + } + DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(system_app) + SetVar(role_consortium_member, AppParam(App: #system_app_id#, Name: "role_consortium_member")) + DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "member->account": "#account_id#", "role->id": "#role_consortium_member#", "deleted": 0}).Columns("id").Vars(consortium_member) + If(#consortium_member_id# > 0){ + Button(Body: $@1resign$, Class: btn btn-danger pull-right mt-lg, Page: @1sysparams_list, Contract: @1ConsortiumMemberResign).Alert(Text: "$@1want_resign$", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question) + } + Button(Body: $@1back$, Class: btn btn-default pull-right mt-lg, Page: @1sysparams_list) +} \ No newline at end of file diff --git a/src/basic/pages/contract_bind_request.ptl b/src/basic/pages/contract_bind_request.ptl index 920c910e2..c6d23a4ff 100644 --- a/src/basic/pages/contract_bind_request.ptl +++ b/src/basic/pages/contract_bind_request.ptl @@ -1,5 +1,5 @@ Div(content-wrapper){ - DBFind(@1notifications).Where({"id": #notific_id#, "ecosystem": #ecosystem_id#}).Columns("sender->image_id,sender->member_id,sender->member_name,closed,page_params->contract_id,page_params->contract_name").Vars(notific) + DBFind("@1notifications").Where({"id": "#notific_id#", "ecosystem": "#ecosystem_id#"}).Columns("closed,page_params->contract_id").Vars(notific) Div(row){ Div(col-sm-8 col-sm-offset-2 col-lg-6 col-lg-offset-3){ @@ -16,7 +16,7 @@ Div(content-wrapper){ Div(row){ Div(col-md-12 mt-lg text-center){ Button(Class: btn btn-danger mr-lg, Body: LangRes(@1request_reject), Contract: NotificationsClose, Page: notifications_list, Params: "NotificId=#notific_id#").Alert(Text: $@1want_reject_request$, ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question) - Button(Class: btn btn-success, Body: LangRes(@1contract_binding_accept), Contract: @1BindWallet, Page: notifications_list, Params: "Id=#notific_page_params_contract_id#,NotificId=#notific_id#").Alert(Text: $@1want_bind_contract$, ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question) + Button(Class: btn btn-success, Body: LangRes(@1contract_binding_accept), Contract: @1BindWallet, Page: notifications_list, Params: "Id=#notific_page_params_contract_id#").Alert(Text: $@1want_bind_contract$, ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question) } } } diff --git a/src/basic/pages/default_page.ptl b/src/basic/pages/default_page.ptl index 3b92513c0..9d391def7 100644 --- a/src/basic/pages/default_page.ptl +++ b/src/basic/pages/default_page.ptl @@ -1,4 +1,4 @@ -If(#key_id#==#guest_key#){ +If(#account_id# == #guest_account#){ Include(@1apps_description) }.Else{ Include(@1profile) diff --git a/src/basic/pages/ecosystem_add_members.ptl b/src/basic/pages/ecosystem_add_members.ptl index 9fe3c837c..137442af2 100644 --- a/src/basic/pages/ecosystem_add_members.ptl +++ b/src/basic/pages/ecosystem_add_members.ptl @@ -2,6 +2,6 @@ Form(){ Label(Public Key) P(Class: text-muted h6 m0, Body: "$@1keys_must_be_separated$") Input(Name: Keys, Type: textarea) - Button(Contract: @1MembershipAdd, Class: btn btn-primary pull-right mt, Page:@1members_list, Body: $@1members_add$) + Button(Contract: @1MembershipAdd, Class: btn btn-primary pull-right mt, Page: @1members_list, Body: $@1members_add$) Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1members_list) } \ No newline at end of file diff --git a/src/basic/pages/ecosystems_list.ptl b/src/basic/pages/ecosystems_list.ptl index 31b193ea9..c157e39fc 100644 --- a/src/basic/pages/ecosystems_list.ptl +++ b/src/basic/pages/ecosystems_list.ptl @@ -6,22 +6,23 @@ Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$@1ecosys AddToolButton(Title: $@1update_metrics$, Page: @1ecosystems_metrics_update, Icon: icon-refresh).Popup(Header: $@1update_metrics$, Width: "30") If(#search#){ - SetVar(w_search, {"name": {"$ilike": "#search#"}}) + SetVar(where, {"name": {"$ilike": "#search#"}}) +}.Else{ + SetVar(where, {}) } -SetVar(where, {#w_search#}) Div(list-group-item ml-lg mr-lg pt-lg){ SetVar(search_name, LangRes(@1ecosystem_name)) Include(@1search) } -DBFind(@1buffer_data).Where({"ecosystem": #ecosystem_id#, "member_id": #key_id#, "key": "metrics"}).Vars(m) +DBFind("@1buffer_data").Where({"ecosystem": "#ecosystem_id#", "account": "#account_id#", "key": "metrics"}).Vars(m) JsonToSource(src_metrics,#m_value#) -DBFind(@1applications).Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) +DBFind("@1applications").Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) SetVar(template_id, AppParam(Ecosystem:1, App:#application_id#, Name: voting_template_ves)) If(#template_id# > 0){ - DBFind(@1voting_templates).Where({"ecosystem": #ecosystem_id#, "id": #template_id#}).Columns("subject->voters").Vars(template) + DBFind("@1voting_templates").Where({"ecosystem": "#ecosystem_id#", "id": "#template_id#"}).Columns("subject->voters").Vars(template) } DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_id){ @@ -30,16 +31,16 @@ DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).O Span(#name#) }.Custom(_metrics){ If(#m_id#>0){ - SetVar(eco_id,#id#) + SetVar(eco_id, #id#) ForList(src_metrics){ - If(#key#==#eco_id#){ - LinkPage(Body: `#value#`, Page: @1sysparams_metrics, PageParams:"Id=#key#") + If(#key# == #eco_id#){ + LinkPage(Body: #value#, Page: @1sysparams_metrics, PageParams: "Id=#key#") } } } }.Custom(valued){ If(#is_valued# == 0){ - If(And(#template_subject_voters#>0,#template_subject_voters#==#role_id#)){ + If(And(#template_subject_voters# > 0, #template_subject_voters# == #role_id#)){ Button(Body: $@1start_voting_ves$, Class: btn-xs btn-link, Page: @1voting_list, Contract: @1VotingRunVes, Params: "EcosystemId=#id#") }.Else{ If(#template_id# > 0){ diff --git a/src/basic/pages/groups_assign.ptl b/src/basic/pages/groups_assign.ptl index 6928a27f7..aaecbef74 100644 --- a/src/basic/pages/groups_assign.ptl +++ b/src/basic/pages/groups_assign.ptl @@ -1,15 +1,15 @@ -DBFind(@1applications).Columns("name,id").Where({"name": "Basic", "ecosystem": 1}).Vars(application) +DBFind("@1applications").Columns("name,id").Where({"name": "Basic", "ecosystem": 1}).Vars(application) If(#Id#!=""){ SetVar(v_group_id, #Id#) } If(#v_group_id#>0){ - DBFind(@1groups, src_groups).Where({"ecosystem": #ecosystem_id#, "id": #v_group_id#}).Columns("id,group_name,group_type,group_access,creator->member_id,deleted").Vars(prefix) - If(#prefix_creator_member_id#==#key_id#){ + DBFind("@1groups", src_groups).Where({"ecosystem": "#ecosystem_id#", "id": "#v_group_id#"}).Columns("id,group_name,group_type,group_access,creator->account,deleted").Vars(prefix) + If(#prefix_creator_account#==#account_id#){ SetVar(manager_id, 1) }.ElseIf(And(#prefix_group_access#!="NULL",#prefix_group_access#!="",#prefix_group_access#!="[]",#prefix_deleted#==0)){ - DBFind(@1roles_participants).Where({"ecosystem": #ecosystem_id#, "id": {"$in": #prefix_group_access#}}).Columns("id").Vars(manager) + DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "id": {"$in": #prefix_group_access#}}).Columns("id").Vars(manager) } Form(){ @@ -46,15 +46,14 @@ If(#v_group_id#>0){ } } Div(col-md-9 text-left){ - If(#MemberId# == ""){ - SetVar(MemberId, 0) - } - Input(Name: member_id, Type:hidden, Value: #MemberId#) Div(input-group){ - If(Or(#MemberId#>0,#MemberId#<0)){ - SetVar(AddressMemberId, Address(#MemberId#)) + If(#MemberAccount#){ + Input(Name: account, Type: hidden, Value: #MemberAccount#) + Input(Name: m_name, Disabled: 1, Placeholder: "xxxx-xxxx-xxxx-xxxx-xxxx", Value: #MemberAccount#) + }.Else{ + Input(Name: account, Type: hidden, Value: 0) + Input(Name: m_name, Disabled: 1, Placeholder: "xxxx-xxxx-xxxx-xxxx-xxxx") } - Input(Name: m_name, Disabled: 1, Placeholder: "xxxx-xxxx-xxxx-xxxx-xxxx", Value: #AddressMemberId#) Div(input-group-btn){ Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:"back_page=@1groups_assign,back_header=$@1assign$,Id=#v_group_id#,EcosystemId=#ecosystem_id#").Popup(Header: $@1member$, Width: "50") }.Style( @@ -67,7 +66,7 @@ If(#v_group_id#>0){ } } If(#manager_id#>0){ - Button(Body: LangRes(@1assign), Class: btn btn-primary pull-right mt, Page: @1groups_view, PageParams: "v_group_id=#v_group_id#", Contract: @1GroupsAssign, Params: "MemberId=Val(member_id)").Alert(Text: "$@1want_assign_member_to_role$", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question) + Button(Body: LangRes(@1assign), Class: btn btn-primary pull-right mt, Page: @1groups_view, PageParams: "v_group_id=#v_group_id#", Contract: @1GroupsAssign, Params: "MemberAccount=Val(account)").Alert(Text: "$@1want_assign_member_to_role$", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question) } Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1groups_view, PageParams: "v_group_id=#v_group_id#") } diff --git a/src/basic/pages/groups_create.ptl b/src/basic/pages/groups_create.ptl index cb733f3f3..bd7b629f1 100644 --- a/src/basic/pages/groups_create.ptl +++ b/src/basic/pages/groups_create.ptl @@ -1,22 +1,22 @@ -DBFind(@1applications).Columns("name,id").Where({"ecosystem": 1, "name": "Basic"}).Vars(application) -DBFind(@1roles, src_roles).Columns("id,role_name").Where({"ecosystem": #ecosystem_id#, "deleted": 0}).Order(id) +DBFind("@1applications").Columns("name,id").Where({"ecosystem": 1, "name": "Basic"}).Vars(application) +DBFind("@1roles", src_roles).Columns("id,role_name").Where({"ecosystem": "#ecosystem_id#", "deleted": 0}).Order("id") If(#back_page#==""){ SetVar(back_page, "@1groups_list") } If(#GroupId#==""){ SetVar(title, $@1new_group$) - DBFind(@1buffer_data).Columns(value).Where({"ecosystem": #ecosystem_id#, "key": "group_access", "member_id": #key_id#}).Columns("id,key,member_id,ecosystem,value->groups_access,value->group_information,value->group_type,value->group_name").Vars(buffer) + DBFind("@1buffer_data").Columns(value).Where({"ecosystem": "#ecosystem_id#", "key": "group_access", "account": "#account_id#"}).Columns("id,key,account,ecosystem,value->groups_access,value->group_information,value->group_type,value->group_name").Vars(buffer) AppParam(Source: type_group, Ecosystem: 1, App: #application_id#, Name: groups_types) If(And(#buffer_value_groups_access#!="NULL",#buffer_value_groups_access#!="",#buffer_value_groups_access#!="[]")){ - DBFind(@1roles, src_roles_access).Where({"ecosystem": #ecosystem_id#, "id": {"$in": #buffer_value_groups_access#}}).Columns("id,role_name").Count(ra_count).Order("role_name") + DBFind("@1roles", src_roles_access).Where({"ecosystem": "#ecosystem_id#", "id": {"$in": #buffer_value_groups_access#}}).Columns("id,role_name").Count(ra_count).Order("role_name") } }.Else{ SetVar(title, $@1edit_group$) - DBFind(@1groups).Where({"ecosystem": #ecosystem_id#, "id": #GroupId#}).Columns("id,group_name,group_type,group_info,group_access").Vars(gr_e) + DBFind("@1groups").Where({"ecosystem": "#ecosystem_id#", "id": "#GroupId#"}).Columns("id,group_name,group_type,group_info,group_access").Vars(gr_e) SetVar(type_group, AppParam(Ecosystem: 1, App: #application_id#, Name: groups_types, Index: #gr_e_group_type#)) If(And(#gr_e_group_access#!="NULL",#gr_e_group_access#!="",#gr_e_group_access#!="[]")){ - DBFind(@1roles, src_roles_access).Where({"ecosystem": #ecosystem_id#, "id": {"$in": #gr_e_group_access#}}).Columns("id,role_name").Count(ra_count).Order("role_name") + DBFind("@1roles", src_roles_access).Where({"ecosystem": "#ecosystem_id#", "id": {"$in": #gr_e_group_access#}}).Columns("id,role_name").Count(ra_count).Order("role_name") } } diff --git a/src/basic/pages/groups_list.ptl b/src/basic/pages/groups_list.ptl index 5fb2b40a4..12cdde3b5 100644 --- a/src/basic/pages/groups_list.ptl +++ b/src/basic/pages/groups_list.ptl @@ -6,17 +6,18 @@ Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: $@1group_d AddToolButton(Page: @1groups_create, Icon: icon-plus, Title: $@1create$).Popup(50, $@1new_group$) If(#search#){ - SetVar(w_search, {"group_name": {"$ilike": "#search#"}}) + SetVar(where, {"ecosystem": "#ecosystem_id#", "group_name": {"$ilike": "#search#"}}) +}.Else{ + SetVar(where, {"ecosystem": "#ecosystem_id#"}) } -SetVar(where, {"ecosystem": #ecosystem_id#, {#w_search#}}) Div(list-group-item ml-lg mr-lg pt-lg){ SetVar(search_name, $@1groups$) Include(@1search) } -DBFind(@1applications).Columns("id,name").Where({"ecosystem": 1, "name": "Basic"}).Vars(application) +DBFind("@1applications").Columns("id,name").Where({"ecosystem": 1, "name": "Basic"}).Vars(application) -DBFind(#this_table#, src_groups).Where(#where#).Order({"deleted": "1", "id": "1"}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("id,group_name,image_id,creator->member_id,creator->member_name,date_created,date_deleted,deleted,group_access,group_info,group_type").Custom(_id){ +DBFind(#this_table#, src_groups).Where(#where#).Order({"deleted": 1, "id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("id,group_name,image_id,creator->account,creator->member_name,date_created,date_deleted,deleted,group_access,group_info,group_type").Custom(_id){ If(#deleted# == 0){ SetVar(style_text, "text-normal").(style_link, "text-primary") }.Else{ @@ -25,7 +26,7 @@ DBFind(#this_table#, src_groups).Where(#where#).Order({"deleted": "1", "id": "1" Span(Class: #style_text#, Body: #id#) }.Custom(_creator){ If(And(#creator.member_name# != NULL, #creator.member_name# != "")){ - LinkPage(Class: #style_link# text-bold, Page: @1profile_view, PageParams: "v_key_id=#creator.member_id#"){ + LinkPage(Class: #style_link# text-bold, Page: @1profile_view, PageParams: "v_account=#creator.account#"){ #creator.member_name# } } @@ -66,13 +67,13 @@ DBFind(#this_table#, src_groups).Where(#where#).Order({"deleted": "1", "id": "1" } } }.Custom(_access){ - If(#creator.member_id# == #key_id#){ + If(#creator.account# == #account_id#){ SetVar(access,done) }.Else{ SetVar(access,) } If(And(#group_access#!="NULL",#group_access# != "",#group_access#!=[])){ - DBFind(@1roles,src_access_list).Where({"id": {"$in": #group_access#}}).Columns("id,role_name").Count(access_count).Order(role_name) + DBFind("@1roles", src_access_list).Where({"id": {"$in": #group_access#}}).Columns("id,role_name").Count(access_count).Order("role_name") Div(#style_text# breaker){ ForList(src_access_list){ If(#role_id# == #id#){ @@ -111,9 +112,9 @@ DBFind(#this_table#, src_groups).Where(#where#).Order({"deleted": "1", "id": "1" } }.Custom(join_group){ If(#deleted# == 0){ - DBFind("@1groups_participants").Columns("id,groups_info,groups_info->id,deleted,member,member->member_id").Where({"groups_info->id": #id#, "deleted": 0, "member->member_id": #key_id#}).Vars(j_l).Count(check_membership) + DBFind("@1groups_participants").Columns("id,groups_info,groups_info->id,deleted,member,member->account").Where({"groups_info->id": "#id#", "deleted": 0, "member->account": "#account_id#"}).Vars(j_l).Count(check_membership) If(And(#group_type# == 1, #check_membership# == 0)){ - Button(Body: $@1join_the_group$, Class: btn btn-link pull-right, Contract: @1GroupsAssign, Page: @1groups_view, PageParams: "v_group_id=#id#", Params: "GroupId=#id#,MemberId=#key_id#") + Button(Body: $@1join_the_group$, Class: btn btn-link pull-right, Contract: @1GroupsAssign, Page: @1groups_view, PageParams: "v_group_id=#id#", Params: "GroupId=#id#,MemberAccount=#account_id#") }.ElseIf(And(#group_type# == 1,#check_membership# == 1)){ Button(Body: $@1leave_the_group$, Class: btn btn-link pull-right, Contract: @1GroupsUnassign, Page: @1groups_list, Params:"RowId=#j_l_id#") }.ElseIf(And(#group_type# == 2,#check_membership# == 0)){ diff --git a/src/basic/pages/groups_request_view.ptl b/src/basic/pages/groups_request_view.ptl index 3841115f3..32f0ceea0 100644 --- a/src/basic/pages/groups_request_view.ptl +++ b/src/basic/pages/groups_request_view.ptl @@ -1,5 +1,5 @@ Div(content-wrapper){ - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "id": #notific_id#}).Columns("page_params->gr_id,page_params->decide,sender->image_id,recipient->member_name,recipient->member_id,recipient->image_id,sender->member_id,sender->member_name,closed").Vars(notific) + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "id": "#notific_id#"}).Columns("page_params->gr_id,page_params->decide,sender->image_id,recipient->member_name,recipient->account,recipient->image_id,sender->account,sender->member_name,closed").Vars(notific) Div(row){ Div(col-sm-8 col-sm-offset-2 col-lg-6 col-lg-offset-3){ @@ -38,13 +38,13 @@ Div(content-wrapper){ Div(list-group-item text-center){ Div(text-muted m0 h5, Body: LangRes(@1address)) If(Or(#notific_page_params_decide# == 1,#notific_page_params_decide# == -1)){ - Span(Class: h5 text-bold, Body: Address(#notific_recipient_member_id#)) + Span(Class: h5 text-bold, Body: #notific_recipient_account#) }.Else{ - Span(Class: h5 text-bold, Body: Address(#notific_sender_member_id#)) + Span(Class: h5 text-bold, Body: #notific_sender_account#) } } Div(list-group-item text-center){ - DBFind(@1groups).Where({"ecosystem": #ecosystem_id#, "id": #notific_page_params_gr_id#}).Vars(group) + DBFind("@1groups").Where({"ecosystem": "#ecosystem_id#", "id": "#notific_page_params_gr_id#"}).Vars(group) Div(text-muted m0 h5, Body: $@1group$) Span(Class: h5 text-bold, Body: #group_group_name# (#group_id#)) } diff --git a/src/basic/pages/groups_view.ptl b/src/basic/pages/groups_view.ptl index 0ed2c89fe..2fcf0a285 100644 --- a/src/basic/pages/groups_view.ptl +++ b/src/basic/pages/groups_view.ptl @@ -6,11 +6,11 @@ If(#v_group_id# > 0){ SetVar(this_page, @1groups_view).(this_table, @1groups_participants) Include(@1pager_header) - DBFind(@1groups).Where({"ecosystem": #ecosystem_id#, "id": #v_group_id#}).Columns("group_name,group_type,deleted,group_access,creator->member_id,deleted").Vars(prefix) - If(#prefix_creator_member_id#==#key_id#){ + DBFind("@1groups").Where({"ecosystem": "#ecosystem_id#", "id": "#v_group_id#"}).Columns("group_name,group_type,deleted,group_access,creator->account,deleted").Vars(prefix) + If(#prefix_creator_account#==#account_id#){ SetVar(manager_id,1) }.ElseIf(And(#prefix_group_access#!="NULL",#prefix_group_access#!="",#prefix_group_access#!="[]",#prefix_deleted#==0)){ - DBFind(@1roles_participants).Where({"ecosystem": #ecosystem_id#, "id": {"$in": #prefix_group_access#}}).Columns("id").Vars(manager) + DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "id": {"$in": #prefix_group_access#}}).Columns("id").Vars(manager) } If(#manager_id#>0){ @@ -26,18 +26,18 @@ If(#v_group_id# > 0){ }.Style( display: inline-block; ) - If(#search#){ - SetVar(w_search, {"member->member_name": {"$ilike": "#search#"}}) + SetVar(where, {"ecosystem": "#ecosystem_id#", "groups_info->id": "#v_group_id#", "member->member_name": {"$ilike": "#search#"}}) + }.Else{ + SetVar(where, {"ecosystem": "#ecosystem_id#", "groups_info->id": "#v_group_id#"}) } - SetVar(where, {"ecosystem": #ecosystem_id#, "groups_info->id": #v_group_id#, {#w_search#}}) Div(list-group-item ml-lg mr-lg pt-lg){ SetVar(search_name, LangRes(@1member)).(page_par, #v_group_id#) Include(@1search) } - DBFind(#this_table#, src_participants).Where(#where#).Order({"deleted": 1, "id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("id,member->member_id,groups_info,groups_info->id,member->member_name,member->image_id,appointed->member_id,appointed->member_name,date_created,date_deleted,deleted").Custom(custom_id){ + DBFind(#this_table#, src_participants).Where(#where#).Order({"deleted": 1, "id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("id,member->account,groups_info,groups_info->id,member->member_name,member->image_id,appointed->account,appointed->member_name,date_created,date_deleted,deleted").Custom(custom_id){ If(#deleted# == 0){ SetVar(Name: style_text, Value: "text-normal") SetVar(Name: style_link, Value: "text-primary") @@ -47,13 +47,13 @@ If(#v_group_id# > 0){ } Span(Class: #style_text#, Body: #id#) }.Custom(custom_appointed){ - If(Or(#appointed.member_id#>0,#appointed.member_id#<0)){ - LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#appointed.member_id#"){ + If(And(#appointed.account# != "", #appointed.account# != NULL)){ + LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: "v_account=#appointed.account#"){ Span(Body: #appointed.member_name#) } } }.Custom(custom_member){ - LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#member.member_id#"){ + LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: "v_account=#member.account#"){ If(#member.image_id#>0){ Image(Src: Binary().ById(#member.image_id#), Class: img-circle).Style(width: 30px; border: 1px solid #5A5D63; margin-right: 10px;) Span(#member.member_name#) @@ -65,7 +65,7 @@ If(#v_group_id# > 0){ } } }.Custom(custom_address){ - Span(Class: #style_text#, Body: Address(#member.member_id#)) + Span(Class: #style_text#, Body: #member.account#) }.Custom(custom_date){ Div(Class: #style_text# h6 m0, Body: DateTime(DateTime: #date_created#, Format: "DD.MM.YYYY HH:MI")) If(#deleted# == 1){ diff --git a/src/basic/pages/members_list.ptl b/src/basic/pages/members_list.ptl index 5f3765b72..d1476a879 100644 --- a/src/basic/pages/members_list.ptl +++ b/src/basic/pages/members_list.ptl @@ -3,16 +3,16 @@ Include(@1pager_header) SetTitle("$@1ecosystem_members$") Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$@1ecosystem_members_list_desc$")) -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "System"}).Vars("system_app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(system_app) SetVar(role_admin, AppParam(App: #system_app_id#, Name: "role_admin")) If(And(#role_id# == #role_admin#, #ecosystem_id# != 1)){ AddToolButton(Title: $@1members_add$, Page:@1ecosystem_add_members, Icon: icon-plus).Popup(50, $@1ecosystem_add_members$) } If(#search#){ - SetVar(where, {"ecosystem": #ecosystem_id#, "id": {"$neq":#guest_key#}, "deleted": 0, "id": AddressToId(#search#)}) + SetVar(where, {"ecosystem": "#ecosystem_id#", "deleted": 0, "$and": [{"account": {"$ilike": "#search#"}}, {"account": {"$neq": "#guest_account#"}}]}) }.Else{ - SetVar(where, {"ecosystem": #ecosystem_id#, "id": {"$neq":#guest_key#}, "deleted": 0}) + SetVar(where, {"ecosystem": "#ecosystem_id#", "account": {"$neq": "#guest_account#"}, "deleted": 0}) } Div(list-group-item ml-lg mr-lg pt-lg){ @@ -20,33 +20,33 @@ Div(list-group-item ml-lg mr-lg pt-lg){ Include(@1search) } -DBFind("@1ecosystems").Where({"id": #ecosystem_id#}).Vars("custom") +DBFind("@1ecosystems").Where({"id": "#ecosystem_id#"}).Vars(custom) -DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(custom_id){ +DBFind(#this_table#, src).Where(#where#).Order({"account": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(custom_id){ SetVar(Name: style_text, Value: "text-normal") SetVar(Name: style_link, Value: "text-primary") - Span(Class: h6 text-muted, Body: #id#) - SetVar(m_id, 0) - DBFind(@1members).Where({"ecosystem": #ecosystem_id#, "id": #id#}).Vars(m) - If(Or(#m_id#>0,#m_id#<0)){ + Span(Class: h6 text-muted, Body: #account#) + SetVar(m_account,) + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#account#"}).Vars(m) + If(#m_account#){ SetVar(image_id, #m_image_id#) SetVar(member_name, #m_member_name#) }.Else{ SetVar(image_id, 0) - SetVar(member_name, Address(#id#)) + SetVar(member_name, #account#) } -}.Custom(custom_member_id){ +}.Custom(custom_account){ If(Or(#ecosystem_id# == 1, #custom_token_title# != "")){ - Button(Class: btn-xs btn-link, Page: @1tokens_send, PageParams: "v_key_id=#id#"){ - Span(Class: h5, Body: Address(#id#)) + Button(Class: btn-xs btn-link, Page: @1tokens_send, PageParams: "v_account=#account#"){ + Span(Class: h5, Body: #account#) }.Popup(Header: $@1tokens_send$, Width: "50") }.Else{ - Span(Class: h5, Body: Address(#id#)) + Span(Class: h5, Body: #account#) } }.Custom(custom_username){ - LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#id#"){ + LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: "v_account=#account#"){ If(#image_id#>0){ - Image(Src: Binary().ById(#image_id#), Class: img-circle).Style(height: 30px;width: 30px; border: 1px solid #5A5D63; margin-right: 10px;) + Image(Src: Binary().ById(#image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63; margin-right: 10px;) Span(#member_name#) }.Else{ Div(){ @@ -61,7 +61,7 @@ Div(fullscreen){ Div(table-responsive ml-lg mr-lg){ Div(list-group-item){ If(#count# > 0){ - Table(src, "$@1name$=custom_username,$@1wallet$=custom_member_id") + Table(src, "$@1name$=custom_username,$@1wallet$=custom_account") }.Else{ Div(Class: text-center h4 text-muted, Body: "$@1members$ $@1not_founded$") } diff --git a/src/basic/pages/members_list_admin.ptl b/src/basic/pages/members_list_admin.ptl index 2a0450308..f913cf78a 100644 --- a/src/basic/pages/members_list_admin.ptl +++ b/src/basic/pages/members_list_admin.ptl @@ -3,67 +3,68 @@ Include(@1pager_header) SetTitle("$@1member_management$") Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$@1member_management_desc$")) -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "System"}).Vars("system_app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(system_app) SetVar(role_admin, AppParam(App: #system_app_id#, Name: "role_admin")) If(And(#role_id# == #role_admin#, #ecosystem_id# != 1)){ AddToolButton(Title: $@1members_add$, Page: @1ecosystem_add_members, Icon: icon-plus).Popup(50, $@1ecosystem_add_members$) } If(#search#){ - SetVar(w_search, {"id": AddressToId(#search#)}) + SetVar(where, {"ecosystem": "#ecosystem_id#", "$and": [{"account": {"$ilike": "#search#"}}, {"account": {"$neq": "#guest_account#"}}]}) +}.Else{ + SetVar(where, {"ecosystem": "#ecosystem_id#", "account": {"$neq": "#guest_account#"}}) } -SetVar(where, {"ecosystem": #ecosystem_id#, "id": {"$neq":#guest_key#}, {#w_search#}}) Div(list-group-item ml-lg mr-lg pt-lg){ SetVar(search_name, LangRes(@1wallet)) Include(@1search) } -DBFind("@1ecosystems").Where({"id": #ecosystem_id#}).Vars("custom") +DBFind("@1ecosystems").Where({"id": "#ecosystem_id#"}).Vars(custom) -DBFind(#this_table#, src).Where(#where#).Order({deleted:"1", id:"1"}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(custom_id){ +DBFind(#this_table#, src).Where(#where#).Order({"deleted": 1, "account": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(custom_id){ If(#deleted# == 0){ SetVar(style_text, "text-normal").(style_link, "text-primary") }.Else{ SetVar(style_text,"text-muted").(style_link,"text-muted") } - Span(Class: h6 text-muted, Body: #id#) - SetVar(m_id, 0) - DBFind(@1members).Where({"ecosystem": #ecosystem_id#, "id": #id#}).Vars(m) - If(Or(#m_id#>0,#m_id#<0)){ - SetVar(image_id, #m_image_id#) - SetVar(member_name, #m_member_name#) - }.Else{ - SetVar(image_id, 0) - SetVar(member_name, Address(#id#)) - } -}.Custom(custom_member_id){ + Span(Class: h6 text-muted, Body: #account#) +}.Custom(custom_account){ If(Or(#ecosystem_id# == 1, #custom_token_title# != "")){ - Button(Class: btn-xs btn-link, Page: @1tokens_send, PageParams: "v_key_id=#id#,back_page=#this_page#"){ - Span(Class: h5 #style_text#, Body: Address(#id#)) + Button(Class: btn-xs btn-link, Page: @1tokens_send, PageParams: "v_account=#account#,back_page=#this_page#"){ + Span(Class: h5 #style_text#, Body: #account#) }.Popup(Header: $@1tokens_send$, Width: "50") }.Else{ - Span(Class: h5 #style_text#, Body: Address(#id#)) + Span(Class: h5 #style_text#, Body: #account#) } }.Custom(custom_username){ - LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#id#"){ + SetVar(m_account,) + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#account#"}).Vars(m) + If(#m_account#){ + SetVar(image_id, #m_image_id#) + SetVar(member_name, #m_member_name#) + }.Else{ + SetVar(image_id, 0) + SetVar(member_name, #account#) + } + LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: "v_account=#account#"){ If(#image_id#>0){ - Image(Src: Binary().ById(#image_id#), Class: img-circle).Style(height: 30px;width: 30px; border: 1px solid #5A5D63; margin-right: 10px;) + Image(Src: Binary().ById(#image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63; margin-right: 10px;) Span(#member_name#) }.Else{ Div(){ - Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;) + Span(Em(Class: fa icon-user fa-2x)).Style(margin-right: 10px;) Span(#member_name#) }.Style(display:flex; align-items:center;) } } }.Custom(actions){ If(#deleted#==0){ - Button(Body: LangRes(@1delete), Class: btn-xs btn-link pull-right, Page: #this_page#, Params:"KeyId=#id#", Contract: @1DeleteMember).Alert(Text: "$@1want_delete_key$", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question) + Button(Body: LangRes(@1delete), Class: btn-xs btn-link pull-right, Page: #this_page#, Params: "MemberAccount=#account#", Contract: @1DeleteMember).Alert(Text: "$@1want_delete_account$", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question) If(#blocked#==0){ - Button(Body: LangRes(@1block_key), Class: btn-xs btn-link pull-right, Page: #this_page#, Params:"KeyId=#id#,Value=1", Contract: @1BlockMember).Alert(Text: "$@1want_block_key$", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question) + Button(Body: LangRes(@1block_account), Class: btn-xs btn-link pull-right, Page: #this_page#, Params: "MemberAccount=#account#,Value=1", Contract: @1BlockMember).Alert(Text: "$@1want_block_account$", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question) }.Else{ - Button(Body: LangRes(@1unblock_key), Class: btn-xs btn-link pull-right, Page: #this_page#, Params:"KeyId=#id#,Value=0", Contract: @1BlockMember).Alert(Text: "$@1want_unblock_key$", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question) + Button(Body: LangRes(@1unblock_account), Class: btn-xs btn-link pull-right, Page: #this_page#, Params: "MemberAccount=#account#,Value=0", Contract: @1BlockMember).Alert(Text: "$@1want_unblock_account$", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question) } }.Else{ Span(Class: h6 text-muted pull-right, Body: $@1deleted$) @@ -74,7 +75,7 @@ Div(fullscreen){ Div(table-responsive ml-lg mr-lg){ Div(list-group-item){ If(#count# > 0){ - Table(src, "$@1name$=custom_username,$@1id$=custom_id,$@1wallet$=custom_member_id,=actions") + Table(src, "$@1name$=custom_username,$@1id$=custom_id,$@1wallet$=custom_account,=actions") }.Else{ Div(Class: text-center h4 text-muted, Body: "$@1members$ $@1not_founded$") } @@ -88,4 +89,4 @@ Div(fullscreen){ } Div(mt-sm ml-lg mr-sm mb-sm){ Include(@1pager) -} \ No newline at end of file +} diff --git a/src/basic/pages/membership_admin_view.ptl b/src/basic/pages/membership_admin_view.ptl index a4ca65063..8cc2b8646 100644 --- a/src/basic/pages/membership_admin_view.ptl +++ b/src/basic/pages/membership_admin_view.ptl @@ -1,6 +1,6 @@ Div(content-wrapper){ - DBFind(@1notifications).Where({"id": #notific_id#}).Columns("page_params->ecosystem_id,sender->image_id,sender->member_id,sender->member_name,closed").Vars(notific) - DBFind(@1ecosystems).Where({"id": #notific_page_params_ecosystem_id#}).Vars(ecosystem) + DBFind("@1notifications").Where({"id": "#notific_id#"}).Columns("page_params->ecosystem_id,sender->image_id,sender->account,sender->member_name,closed").Vars(notific) + DBFind("@1ecosystems").Where({"id": "#notific_page_params_ecosystem_id#"}).Vars(ecosystem) Div(row){ Div(col-sm-8 col-sm-offset-2 col-lg-6 col-lg-offset-3){ @@ -23,7 +23,7 @@ Div(content-wrapper){ } Div(list-group-item text-center){ Div(text-muted m0 h5, Body: LangRes(@1address)) - Span(Class: h5 text-bold, Body: Address(#notific_sender_member_id#)) + Span(Class: h5 text-bold, Body: #notific_sender_account#) } Div(list-group-item text-center){ Div(text-muted m0 h5, Body: LangRes(@1ecosystem)) diff --git a/src/basic/pages/membership_user_view.ptl b/src/basic/pages/membership_user_view.ptl index 04886b987..76df3055b 100644 --- a/src/basic/pages/membership_user_view.ptl +++ b/src/basic/pages/membership_user_view.ptl @@ -1,6 +1,6 @@ Div(content-wrapper){ - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "id": #notific_id#}).Columns("page_params->ecosystem_id,page_params->status,recipient->image_id,recipient->member_name,closed").Vars(notific) - DBFind(@1ecosystems).Where({"id": #notific_page_params_ecosystem_id#}).Vars(ecosystem) + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "id": "#notific_id#"}).Columns("page_params->ecosystem_id,page_params->status,recipient->image_id,recipient->member_name,closed").Vars(notific) + DBFind("@1ecosystems").Where({"id": "#notific_page_params_ecosystem_id#"}).Vars(ecosystem) Div(row){ Div(col-sm-8 col-sm-offset-2 col-lg-6 col-lg-offset-3){ @@ -12,7 +12,7 @@ Div(content-wrapper){ Div(form-group){ Div(row){ Div(col-md-12 mt-sm text-center){ - If(#notific_recipient_image_id#>0){ + If(#notific_recipient_image_id# > 0){ Image(Src: Binary().ById(#notific_recipient_image_id#), Class: img-thumbnail).Style(width: 120px; border: 1px solid #5A5D63;) }.Else{ Span(Class: fa icon-user fa-5x) diff --git a/src/basic/pages/message_create.ptl b/src/basic/pages/message_create.ptl index c98cc93cf..d9eb0ccf5 100644 --- a/src/basic/pages/message_create.ptl +++ b/src/basic/pages/message_create.ptl @@ -3,8 +3,11 @@ SetVar(this_page, @1message_create) If(#EcosystemId# == ""){ SetVar(EcosystemId, #ecosystem_id#) } -If(#MemberId# == ""){ - SetVar(MemberId, 0) +If(#MemberAccount#){ + SetVar(MemberAccountInputValue, #MemberAccount#) +}.Else{ + SetVar(MemberAccount, 0) + SetVar(MemberAccountInputValue,) } If(#RoleId#){ @@ -15,12 +18,6 @@ If(#RoleId#){ SetVar(broadcast_type_value, "member") } -If(Or(#MemberId# > 0, #MemberId# < 0)){ - SetVar(AddressMemberId, Address(#MemberId#)) -}.Else{ - SetVar(AddressMemberId,) -} - Form(){ Div(row){ Div(col-md-3 mt-sm text-right){ @@ -44,9 +41,9 @@ Form(){ } } Div(col-md-9 text-left){ - Input(Name: MemberId, Type: hidden, Value: #MemberId#) + Input(Name: MemberAccount, Type: hidden, Value: #MemberAccount#) Div(input-group){ - Input(Name: m_name, Disabled: 1, Placeholder: "xxxx-xxxx-xxxx-xxxx-xxxx", Value: #AddressMemberId#) + Input(Name: m_name, Disabled: 1, Placeholder: "xxxx-xxxx-xxxx-xxxx-xxxx", Value: #MemberAccountInputValue#) Div(input-group-btn){ Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams: "back_page=#this_page#,back_header=$@1message_create$,EcosystemId=#EcosystemId#").Popup(Header: $@1member$, Width: "50") } @@ -62,14 +59,14 @@ Form(){ Div(col-md-9 text-left){ If(RoleId == ""){ SetVar(RoleId, 0) - SetVar(RoleName, "") + SetVar(RoleName,) }.Else{ Input(Name: Rid, Type: hidden, Value: #RoleId#) } Div(input-group){ If(#RoleId# > 0){ SetVar(Id, #RoleId#) - DBFind(@1roles).WhereId(#RoleId#).Columns("role_name").Vars(r) + DBFind("@1roles").WhereId(#RoleId#).Columns("role_name").Vars(r) } Input(Name: m_name, Disabled: 1, Value: #r_role_name#) Div(input-group-btn){ @@ -87,14 +84,14 @@ Form(){ Div(col-md-9 text-left){ If(GroupId == ""){ SetVar(GroupId, 0) - SetVar(GroupName, "") + SetVar(GroupName,) }.Else{ Input(Name: GroupId, Type: hidden, Value: #GroupId#) } Div(input-group){ If(#GroupId# > 0){ SetVar(Id, #GroupId#) - DBFind(@1groups).WhereId(#GroupId#).Columns("group_name").Vars(g) + DBFind("@1groups").WhereId(#GroupId#).Columns("group_name").Vars(g) } Input(Name: m_name, Disabled: 1, Value: #g_group_name#) Div(input-group-btn){ @@ -134,10 +131,10 @@ Form(){ Button(Body: LangRes(@1send), Class: btn btn-primary pull-right, Page: @1messages_list, Contract: @1NotificationsSend, Params: "Rid=0,GroupId=0,CurrentRid=#role_id#") }.Show("broadcast_type=member") Div(){ - Button(Body: LangRes(@1send), Class: btn btn-primary pull-right, Page: @1messages_list, Contract: @1NotificationsSend, Params: "MemberId=0,GroupId=0,CurrentRid=#role_id#,Closure=2") + Button(Body: LangRes(@1send), Class: btn btn-primary pull-right, Page: @1messages_list, Contract: @1NotificationsSend, Params: "MemberAccount=0,GroupId=0,CurrentRid=#role_id#,Closure=2") }.Show("broadcast_type=role") Div(){ - Button(Body: LangRes(@1send), Class: btn btn-primary pull-right, Page: @1messages_list, Contract: @1NotificationsSend, Params: "MemberId=0,Rid=0,CurrentRid=#role_id#") + Button(Body: LangRes(@1send), Class: btn btn-primary pull-right, Page: @1messages_list, Contract: @1NotificationsSend, Params: "MemberAccount=0,Rid=0,CurrentRid=#role_id#") }.Show("broadcast_type=group") Button(Body: LangRes(@1back), Class: btn btn-default pull-right, Page: @1messages_list) } diff --git a/src/basic/pages/message_view.ptl b/src/basic/pages/message_view.ptl index ec471a2a3..6763e6fd0 100644 --- a/src/basic/pages/message_view.ptl +++ b/src/basic/pages/message_view.ptl @@ -1,30 +1,30 @@ If(#notific_id# > 0){ - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "id": #notific_id#}).Columns("id,sender->member_id,sender->member_name,sender->image_id,recipient->member_id,recipient->member_name,notification->body,notification->header,page_params->thread,date_created,closed").Vars(message) - DBFind(@1members).Where({"ecosystem": #ecosystem_id#, "id": #message_sender_member_id#}).Vars(highlighted) - If(#highlighted_id#){ + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "id": "#notific_id#"}).Columns("id,sender->account,sender->member_name,sender->image_id,recipient->account,recipient->member_name,notification->body,notification->header,page_params->thread,date_created,closed").Vars(message) + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#message_sender_account#"}).Vars(highlighted) + If(#highlighted_account#){ SetVar(message_sender_member_name, #highlighted_member_name#) SetVar(message_sender_image_id, #highlighted_image_id#) } If(#message_page_params_thread# > 0){ SetVar(thread, #message_page_params_thread#) - DBFind(@1notifications,src_thread).Where({"ecosystem": #ecosystem_id#, "page_params->thread": #message_page_params_thread#}).Order("id").Count("thread_quantity").Columns("id,sender->member_id,sender->member_name,sender->image_id,notification->body,date_created") - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "id": #message_page_params_thread#}).Columns("id,sender->member_id,sender->member_name,sender->image_id,recipient->member_id,notification->body,date_created").Vars(init_message) + DBFind("@1notifications",src_thread).Where({"ecosystem": "#ecosystem_id#", "page_params->thread": "#message_page_params_thread#"}).Order("id").Count("thread_quantity").Columns("id,sender->account,sender->member_name,sender->image_id,notification->body,date_created") + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "id": "#message_page_params_thread#"}).Columns("id,sender->account,sender->member_name,sender->image_id,recipient->account,notification->body,date_created").Vars(init_message) }.Else{ SetVar(thread, #message_id#) - DBFind(@1notifications,src_thread).Where({"ecosystem": #ecosystem_id#, "page_params->thread": #message_id#}).Order("id").Count("thread_quantity").Columns("id,sender->member_id,sender->member_name,sender->image_id,notification->body,date_created") - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "id": #message_id#}).Columns("id,sender->member_id,sender->member_name,sender->image_id,recipient->member_id,notification->body,date_created").Vars(init_message) + DBFind("@1notifications",src_thread).Where({"ecosystem": "#ecosystem_id#", "page_params->thread": "#message_id#"}).Order("id").Count("thread_quantity").Columns("id,sender->account,sender->member_name,sender->image_id,notification->body,date_created") + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "id": "#message_id#"}).Columns("id,sender->account,sender->member_name,sender->image_id,recipient->account,notification->body,date_created").Vars(init_message) } - DBFind(@1members).Where({"ecosystem": #ecosystem_id#, "id": #init_message_sender_member_id#}).Vars(starter) - If(#starter_id#){ + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#init_message_sender_account#"}).Vars(starter) + If(#starter_account#){ SetVar(init_message_sender_member_name, #starter_member_name#) SetVar(init_message_sender_image_id, #starter_image_id#) } - If(#init_message_sender_member_id# != #key_id#){ - SetVar(reply_recipient, #init_message_sender_member_id#) + If(#init_message_sender_account# != #account_id#){ + SetVar(reply_recipient, #init_message_sender_account#) }.Else{ - SetVar(reply_recipient, #init_message_recipient_member_id#) + SetVar(reply_recipient, #init_message_recipient_account#) } If(#message_notification_header# == ""){ SetVar(thread_name, $@1message_subject_empty$) @@ -47,7 +47,7 @@ If(#notific_id# > 0){ Div(col-lg-6 col-lg-offset-3 col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1){ Form(panel panel-primary){ Div(text-center pt){ - If(#message_sender_member_id# == #key_id#){ + If(#message_sender_account# == #account_id#){ Span(Class: h4 text-bold, Body: LangRes(@1message_from_you)) }.Else{ Span(Class: h4 text-bold, Body: LangRes(@1message_from) #message_sender_member_name#) @@ -56,7 +56,7 @@ If(#notific_id# > 0){ Div(panel-body pt pb){ Div(list-group-item wrapper-block){ Div(avatar-block text-center){ - LinkPage(Page: @1profile_view, PageParams: "v_key_id=#message_sender_member_id#"){ + LinkPage(Page: @1profile_view, PageParams: "v_account=#message_sender_account#"){ If(#message_sender_image_id# > 0){ Image(Src: Binary().ById(#message_sender_image_id#), Class: img-circle avatar) }.Else{ @@ -75,13 +75,13 @@ If(#notific_id# > 0){ Div(row mt-lg){ Div(col-md-12 text-left){ Label(){ - If(#message_sender_member_id# != #key_id#){ + If(#message_sender_account# != #account_id#){ Span(Body: LangRes(@1reply_text)) }.Else{ Span(Body: LangRes(@1message_text)) } } - Input(Type: Hidden, Name: MemberId, Value: "#reply_recipient#") + Input(Type: Hidden, Name: MemberAccount, Value: "#reply_recipient#") Input(Type: Hidden, Name: EcosystemId, Value: "#ecosystem_id#") Input(Type: Hidden, Name: Sender, Value: "1") Input(Type: Hidden, Name: Icon, Value: "icon-speech") @@ -91,12 +91,12 @@ If(#notific_id# > 0){ Input(Type: textarea, Name: Body, Value: "", Placeholder: $@1message_type_here$).Style(resize: vertical; min-height: 6em;) } } - If(#message_sender_member_id# == #key_id#){ + If(#message_sender_account# == #account_id#){ SetVar(send_button, $@1send$) }.Else{ SetVar(send_button, $@1reply$) } - If(And(#message_closed# == 0, Or(#message_sender_member_id# != #key_id#, #message_recipient_member_id# == #key_id#))){ + If(And(#message_closed# == 0, Or(#message_sender_account# != #account_id#, #message_recipient_account# == #account_id#))){ Div(mt text-right){ Button(Body: LangRes(@1mark_read), Class: btn btn-default, Contract: @1NotificationsClose, Params: "NotificId=#notific_id#", Page: @1messages_list) Button(Body: #send_button#, Class: btn btn-primary, Contract: @1NotificationsSend, Params: "CurrentRid=#role_id#", Page: @1message_view, PageParams: "notific_id=#message_id#").CompositeContract(@1NotificationsClose, [{"NotificId": #notific_id#}]) @@ -118,7 +118,7 @@ If(#notific_id# > 0){ } Div(list-group-item wrapper-block){ Div(avatar-block text-center){ - LinkPage(Page: @1profile_view, PageParams: "v_key_id=#init_message_sender_member_id#"){ + LinkPage(Page: @1profile_view, PageParams: "v_account=#init_message_sender_account#"){ If(#init_message_sender_image_id# > 0){ Image(Src: Binary().ById(#init_message_sender_image_id#), Class: img-circle avatar) }.Else{ @@ -138,12 +138,12 @@ If(#notific_id# > 0){ ForList(src_thread){ Div(list-group-item wrapper-block){ Div(avatar-block text-center){ - DBFind(@1members).Where({"ecosystem": #ecosystem_id#, "id": #sender.member_id#}).Vars(thread_message) - If(#thread_message_id# == ""){ + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#sender.account#"}).Vars(thread_message) + If(#thread_message_account# == ""){ SetVar(thread_message_member_name, #sender.member_name#) SetVar(thread_message_image_id, #sender.image_id#) } - LinkPage(Page: @1profile_view, PageParams: "v_key_id=#sender.member_id#"){ + LinkPage(Page: @1profile_view, PageParams: "v_account=#sender.account#"){ If(#thread_message_image_id# > 0){ Image(Src: Binary().ById(#thread_message_image_id#), Class: img-circle avatar) }.Else{ diff --git a/src/basic/pages/messages_list.ptl b/src/basic/pages/messages_list.ptl index 27db4700a..c3ddfd15d 100644 --- a/src/basic/pages/messages_list.ptl +++ b/src/basic/pages/messages_list.ptl @@ -1,4 +1,4 @@ -DBFind(@1notifications,threads).Where({"ecosystem": #ecosystem_id#, "page_params->type": "message", {"$or": [{"sender->member_id": #key_id#}, {"recipient->member_id": #key_id#}]}}).Order({"id":"-1"}).Limit(250).Count(threads_count).Columns("id,sender->member_id,sender->member_name,sender->image_id,recipient->member_id,recipient->member_name,notification->body,notification->header,page_params->thread,date_created,closed") +DBFind("@1notifications",threads).Where({"ecosystem": "#ecosystem_id#", "page_params->type": "message", "$or": [{"sender->account": "#account_id#"}, {"recipient->account": "#account_id#"}]}).Order({"id": "-1"}).Limit(250).Count(threads_count).Columns("id,sender->account,sender->member_name,sender->image_id,recipient->account,recipient->member_name,notification->body,notification->header,page_params->thread,date_created,closed") Div(content-wrapper){ Div(row){ @@ -17,41 +17,41 @@ Div(content-wrapper){ If(#threads_count# > 0){ ForList(threads){ If(#page_params.thread# > 0){ - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "page_params->thread": #page_params.thread#}).Order({"id":"-1"}).Limit(1).Columns("id").Vars(last) + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "page_params->thread": "#page_params.thread#"}).Order({"id": "-1"}).Limit(1).Columns("id").Vars(last) }.Else{ - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "page_params->thread": #id#}).Count(thread_depth) + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "page_params->thread": "#id#"}).Count(thread_depth) } If(Or(#id# == #last_id#, #thread_depth# == 0)){ - If(And(#closed# == 0, Or(#sender.member_id# != #key_id#, #recipient.member_id# == #key_id#))){ + If(And(#closed# == 0, Or(#sender.account# != #account_id#, #recipient.account# == #account_id#))){ SetVar(status, "unread") }.Else{ SetVar(status, "read") } Div(list-group-item col-sm-12 thread-block #status#){ Div(avatar-block text-center){ - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "id": #id#}).Columns("sender->member_id,recipient->member_id,sender->member_name,recipient->member_name,sender->image_id,recipient->image_id").Vars(init_message) - If(#init_message_sender_member_id# != #key_id#){ - DBFind(@1members).Where({"ecosystem": #ecosystem_id#, "id": #init_message_sender_member_id#}).Vars(talker) - If(#talker_id#){ + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "id": "#id#"}).Columns("sender->account,recipient->account,sender->member_name,recipient->member_name,sender->image_id,recipient->image_id").Vars(init_message) + If(#init_message_sender_account# != #account_id#){ + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#init_message_sender_account#"}).Vars(talker) + If(#talker_account#){ SetVar(talker_name, #talker_member_name#) SetVar(talker_picture, #talker_image_id#) }.Else{ - SetVar(talker_id, #init_message_sender_member_id#) + SetVar(talker_account, #init_message_sender_account#) SetVar(talker_name, #init_message_sender_member_name#) SetVar(talker_picture, #init_message_sender_image_id#) } }.Else{ - DBFind(@1members).Where({"ecosystem": #ecosystem_id#, "id": #init_message_recipient_member_id#}).Vars(talker) - If(#talker_id#){ + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#init_message_recipient_account#"}).Vars(talker) + If(#talker_account#){ SetVar(talker_name, #talker_member_name#) SetVar(talker_picture, #talker_image_id#) }.Else{ - SetVar(talker_id, #init_message_recipient_member_id#) + SetVar(talker_account, #init_message_recipient_account#) SetVar(talker_name, #init_message_recipient_member_name#) SetVar(talker_picture, #init_message_recipient_image_id#) } } - LinkPage(Page: @1profile_view, PageParams: "v_key_id=#talker_id#"){ + LinkPage(Page: @1profile_view, PageParams: "v_account=#talker_account#"){ If(#talker_picture# > 0){ Image(Src: Binary().ById(#talker_picture#), Class: img-circle avatar) }.Else{ @@ -67,7 +67,7 @@ Div(content-wrapper){ }.Else{ Div(Class: preview h4 m0, Body: #notification.header#) } - If(#sender.member_id# == #key_id#){ + If(#sender.account# == #account_id#){ Div(Class: preview text-muted, Body: $@1you$: #notification.body#) }.Else{ Div(Class: preview text-muted, Body: #notification.body#) diff --git a/src/basic/pages/notifications.ptl b/src/basic/pages/notifications.ptl index 44548ea3f..63f4c00fe 100644 --- a/src/basic/pages/notifications.ptl +++ b/src/basic/pages/notifications.ptl @@ -1,6 +1,6 @@ -DBFind(@1notifications,notification_singles).Where({"ecosystem": #ecosystem_id#, "closed": 0, "notification->type": 1, "recipient->member_id": #key_id#}).Columns("id,page_name,notification->icon,notification->header,notification->popup,notification->body").Count(count_singles) +DBFind("@1notifications",notification_singles).Where({"ecosystem": "#ecosystem_id#", "closed": 0, "notification->type": 1, "recipient->account": "#account_id#"}).Columns("id,page_name,notification->icon,notification->header,notification->popup,notification->body").Count(count_singles) -DBFind(@1notifications,notification_roles).Where({"ecosystem": #ecosystem_id#, "closed": 0, "notification->type": 2, "recipient->role_id": #role_id#, {"$or": [{"date_start_processing": 0}, {"processing_info->member_id": #key_id#}]}}).Columns("id,page_name,notification->icon,notification->header,notification->popup,notification->body,recipient->role_id").Count(count_current_role) +DBFind("@1notifications",notification_roles).Where({"ecosystem": "#ecosystem_id#", "closed": 0, "notification->type": 2, "recipient->role_id": "#role_id#", "$or": [{"date_start_processing": 0}, {"processing_info->account": "#account_id#"}]}).Columns("id,page_name,notification->icon,notification->header,notification->popup,notification->body,recipient->role_id").Count(count_current_role) SetVar(limit,10).(limit_count,#limit#) SetVar(remaining,Calculate(#count_singles#+#count_current_role#-#limit#)) @@ -43,7 +43,7 @@ If(And(#limit_count#>0,#count_singles#>0)){ } If(And(#limit_count#>0,#count_current_role#>0)){ - DBFind(@1roles).Where({"ecosystem": #ecosystem_id#, "id": #role_id#}).Columns("role_name").Vars(role) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#role_id#"}).Columns("role_name").Vars(role) Div(dropdown-heading b0){ $@1role_notifics$ (#role_role_name#) } diff --git a/src/basic/pages/notifications_broadcast.ptl b/src/basic/pages/notifications_broadcast.ptl index 4809f5a27..a340ef958 100644 --- a/src/basic/pages/notifications_broadcast.ptl +++ b/src/basic/pages/notifications_broadcast.ptl @@ -1,6 +1,6 @@ -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "System"}).Vars("system_app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(system_app) SetVar(role_admin, AppParam(App: #system_app_id#, Name: "role_admin")) -DBFind(@1ecosystems).Count(ecos_count) +DBFind("@1ecosystems").Count(ecos_count) Form(){ If(And(#role_id# == #role_admin#, #ecosystem_id# == 1, #ecos_count# > 1)){ Div(row){ diff --git a/src/basic/pages/notifications_roles_send.ptl b/src/basic/pages/notifications_roles_send.ptl index f02ae8192..c00f6a4a2 100644 --- a/src/basic/pages/notifications_roles_send.ptl +++ b/src/basic/pages/notifications_roles_send.ptl @@ -1,5 +1,5 @@ SetVar(this_page,@1notifications_roles_send).(back_page,@1notifications_list) -DBFind(@1applications).Columns("name,id").Where({"ecosystem": 1, "name": "Basic"}).Vars(application) +DBFind("@1applications").Columns("name,id").Where({"ecosystem": 1, "name": "Basic"}).Vars(application) If(#EcosystemId# == ""){ SetVar(EcosystemId, #ecosystem_id#) @@ -15,7 +15,7 @@ Form(){ Div(col-md-9 text-left){ Input(Name: EcosystemId, Type:hidden, Value: #EcosystemId#) Div(input-group){ - DBFind(@1ecosystems).Columns("id,name").WhereId(#EcosystemId#).Vars(e) + DBFind("@1ecosystems").Columns("id,name").WhereId(#EcosystemId#).Vars(e) Input(Name: e_name, Disabled: 1, Value: #e_name#) Div(input-group-btn){ Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_ecosystem, PageParams:"back_page=#this_page#,back_header=$@1send$,EcosystemId=#EcosystemId#,Type=ALL_LIST").Popup(Header: $@1ecosystem$, Width: "40") @@ -35,7 +35,7 @@ Form(){ } } Div(col-md-9 text-left){ - DBFind(@1roles,source_roles).Where({"ecosystem": #EcosystemId#, "deleted": 0}).Columns("id,role_name").Count(roles_count) + DBFind("@1roles", source_roles).Where({"ecosystem": "#EcosystemId#", "deleted": 0}).Columns("id,role_name").Count(roles_count) If(#roles_count#>0){ Select(Name: Rid, Source: source_roles, NameColumn: role_name, ValueColumn: id) }.Else{ diff --git a/src/basic/pages/notifications_show.ptl b/src/basic/pages/notifications_show.ptl index bd0ace8da..2cb7685b0 100644 --- a/src/basic/pages/notifications_show.ptl +++ b/src/basic/pages/notifications_show.ptl @@ -1,11 +1,11 @@ -DBFind(@1applications).Columns("name,id").Where({"ecosystem": 1, "name": "Basic"}).Vars(application) +DBFind("@1applications").Columns("name,id").Where({"ecosystem": 1, "name": "Basic"}).Vars(application) SetTitle($@1notifications_view$) SetVar(type,0).(header,).(body,) Div(content-wrapper){ If(#notific_id#>0){ - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "id": #notific_id#}).Columns("id,sender->type,notification->header,notification->body,date_start_processing,closed").Vars(note) + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "id": "#notific_id#"}).Columns("id,sender->type,notification->header,notification->body,date_start_processing,closed").Vars(note) SetVar(type,#note_sender_type#) SetVar(header,#note_notification_header#) SetVar(body,#note_notification_body#) diff --git a/src/basic/pages/notifications_single_send.ptl b/src/basic/pages/notifications_single_send.ptl index d83b89b1c..07d3ffbf3 100644 --- a/src/basic/pages/notifications_single_send.ptl +++ b/src/basic/pages/notifications_single_send.ptl @@ -1,18 +1,14 @@ SetVar(this_page,@1notifications_single_send).(back_page,@1notifications_list) -DBFind(@1applications).Columns("name,id").Where({"ecosystem": 1, "name": "Basic"}).Vars(application) +DBFind("@1applications").Columns("name,id").Where({"ecosystem": 1, "name": "Basic"}).Vars(application) If(#EcosystemId# == ""){ SetVar(EcosystemId, #ecosystem_id#) } - -If(#MemberId# == ""){ - SetVar(MemberId, 0) -} - -If(Or(#MemberId#>0,#MemberId#<0)){ - SetVar(AddressMemberId, Address(#MemberId#)) +If(#MemberAccount#){ + SetVar(MemberAccountInputValue, #MemberAccount#) }.Else{ - SetVar(AddressMemberId,) + SetVar(MemberAccount, 0) + SetVar(MemberAccountInputValue,) } Form(){ @@ -23,9 +19,9 @@ Form(){ } } Div(col-md-9 text-left){ - Input(Name: EcosystemId, Type:hidden, Value: #EcosystemId#) + Input(Name: EcosystemId, Type: hidden, Value: #EcosystemId#) Div(input-group){ - DBFind(@1ecosystems).Columns("id,name").WhereId(#EcosystemId#).Vars(e) + DBFind("@1ecosystems").Columns("id,name").WhereId(#EcosystemId#).Vars(e) Input(Name: e_name, Disabled: 1, Value: #e_name#) Div(input-group-btn){ Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_ecosystem, PageParams:"back_page=#this_page#,back_header=$@1send$,EcosystemId=#EcosystemId#,Type=ALL_LIST").Popup(Header: $@1ecosystem$, Width: "40") @@ -45,9 +41,9 @@ Form(){ } } Div(col-md-9 text-left){ - Input(Name: MemberId, Type:hidden, Value: #MemberId#) + Input(Name: MemberAccount, Type: hidden, Value: #MemberAccount#) Div(input-group){ - Input(Name: m_name, Disabled: 1, Placeholder: "xxxx-xxxx-xxxx-xxxx-xxxx", Value: #AddressMemberId#) + Input(Name: m_name, Disabled: 1, Placeholder: "xxxx-xxxx-xxxx-xxxx-xxxx", Value: #MemberAccountInputValue#) Div(input-group-btn){ Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:"back_page=#this_page#,back_header=$@1send$,EcosystemId=#EcosystemId#").Popup(Header: $@1member$, Width: "50") }.Style( diff --git a/src/basic/pages/notifications_testpage.ptl b/src/basic/pages/notifications_testpage.ptl index 4004cc6cf..a90efa371 100644 --- a/src/basic/pages/notifications_testpage.ptl +++ b/src/basic/pages/notifications_testpage.ptl @@ -1,8 +1,8 @@ Div(content-wrapper){ - DBFind(@1applications).Columns("name,id").Where({"ecosystem": 1, "name": "Basic"}).Vars(application) + DBFind("@1applications").Columns("name,id").Where({"ecosystem": 1, "name": "Basic"}).Vars(application) If(#notific_id#>0){ - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "id": #notific_id#}).Columns("id,sender->type,notification->type,notification->header,notification->body,page_params->param_int,page_params->param_str,date_start_processing,closed").Vars(prefix) + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "id": "#notific_id#"}).Columns("id,sender->type,notification->type,notification->header,notification->body,page_params->param_int,page_params->param_str,date_start_processing,closed").Vars(prefix) SetVar(sender_type,#prefix_sender_type#).(notification_type,#prefix_notification_type#).(notific_header,#prefix_notification_header#).(notific_body,#prefix_notification_body#).(notific_val_int,#prefix_page_params_param_int#).(notific_val_str,#prefix_page_params_param_str#) }.Else{ Div(md-12 alert alert-danger text-center){ diff --git a/src/basic/pages/notifications_testpage_popup.ptl b/src/basic/pages/notifications_testpage_popup.ptl index 98757d0f3..3e6708c9b 100644 --- a/src/basic/pages/notifications_testpage_popup.ptl +++ b/src/basic/pages/notifications_testpage_popup.ptl @@ -1,7 +1,7 @@ -DBFind(@1applications).Columns("name,id").Where({"ecosystem": 1, "name": "Basic"}).Vars(application) +DBFind("@1applications").Columns("name,id").Where({"ecosystem": 1, "name": "Basic"}).Vars(application) If(#notific_id#>0){ - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "id": #notific_id#}).Columns("id,sender->type,notification->type,notification->header,notification->body,page_params->param_int,page_params->param_str,date_start_processing,closed").Vars(prefix) + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "id": "#notific_id#"}).Columns("id,sender->type,notification->type,notification->header,notification->body,page_params->param_int,page_params->param_str,date_start_processing,closed").Vars(prefix) SetVar(sender_type,#prefix_sender_type#).(notification_type,#prefix_notification_type#).(notific_header,#prefix_notification_header#).(notific_body,#prefix_notification_body#).(notific_val_int,#prefix_page_params_param_int#).(notific_val_str,#prefix_page_params_param_str#) }.Else{ Div(md-12 alert alert-danger text-center){ diff --git a/src/basic/pages/platform_apps_settings.ptl b/src/basic/pages/platform_apps_settings.ptl index ee7b7d56d..3879e57ca 100644 --- a/src/basic/pages/platform_apps_settings.ptl +++ b/src/basic/pages/platform_apps_settings.ptl @@ -1,16 +1,15 @@ -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "System"}).Vars("app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(app) -SetVar(this_page, "@1platform_apps_settings").(role_admin,0).(role_candidate_for_validators,0).(role_consensus,0).(role_delegate,0).(role_developer,0).(role_investor_with_voting_rights,0).(role_validator,0).(role_creates_roles,0) +SetVar(this_page, "@1platform_apps_settings").(role_admin,0).(role_consortium_member_candidate,0).(role_consortium_member,0).(role_delegate,0).(role_developer,0).(role_investor_with_voting_rights,0).(role_creates_roles,0) SetVar(role_admin, AppParam(App: #app_id#, Name: "role_admin")) -SetVar(role_candidate_for_validators, AppParam(App: #app_id#, Name: "role_candidate_for_validators")) -SetVar(role_consensus, AppParam(App: #app_id#, Name: "role_consensus")) +SetVar(role_consortium_member_candidate, AppParam(App: #app_id#, Name: "role_consortium_member_candidate")) +SetVar(role_consortium_member, AppParam(App: #app_id#, Name: "role_consortium_member")) SetVar(role_delegate, AppParam(App: #app_id#, Name: "role_delegate")) SetVar(role_developer, AppParam(App: #app_id#, Name: "role_developer")) SetVar(role_investor_with_voting_rights, AppParam(App: #app_id#, Name: "role_investor_with_voting_rights")) -SetVar(role_validator, AppParam(App: #app_id#, Name: "role_validator")) SetVar(role_creates_roles, AppParam(App: #app_id#, Name: "role_creates_roles")) -DBFind("@1roles", src_roles).Where({"ecosystem": #ecosystem_id#, "deleted": 0}).Columns("role_name,id").Limit(100) +DBFind("@1roles", src_roles).Where({"ecosystem": "#ecosystem_id#", "deleted": 0}).Columns("role_name,id").Limit(100) SetVar(row,"row mt-sm").(col_left,"col-sm-4 text-right mt-sm").(col_right,"col-sm-8 text-left") @@ -36,7 +35,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#role_admin# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #role_admin#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#role_admin#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# @@ -54,7 +53,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#role_developer# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #role_developer#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#role_developer#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# @@ -65,15 +64,15 @@ Div(content-wrapper){ Div(#row#){ Div(#col_left#){ Label(){ - "Candidate for validators" + "Consortium Member Candidate" } } Div(#col_right#){ - Select(Name: RoleValidatorCandidate, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_candidate_for_validators#) + Select(Name: RoleConsortiumMemberCandidate, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_consortium_member_candidate#) Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) - If(#role_candidate_for_validators# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #role_candidate_for_validators#}).Columns("role_name").Vars(r) + If(#role_consortium_member_candidate# > 0){ + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#role_consortium_member_candidate#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# @@ -83,15 +82,15 @@ Div(content-wrapper){ Div(#row#){ Div(#col_left#){ Label(){ - "Consensus" + "Consortium Member" } } Div(#col_right#){ - Select(Name: RoleConsensus, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_consensus#) + Select(Name: RoleConsortiumMember, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_consortium_member#) Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) - If(#role_consensus# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #role_consensus#}).Columns("role_name").Vars(r) + If(#role_consortium_member# > 0){ + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#role_consortium_member#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# @@ -109,7 +108,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#role_delegate# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #role_delegate#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#role_delegate#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# @@ -119,7 +118,7 @@ Div(content-wrapper){ Div(#row#){ Div(#col_left#){ Label(){ - "Investor with voting rights" + "Investor with Voting Rights" } } Div(#col_right#){ @@ -127,25 +126,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#role_investor_with_voting_rights# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #role_investor_with_voting_rights#}).Columns("role_name").Vars(r) - SetVar(r_name, #r_role_name#) - } - LangRes(@1current_value): #r_name# - } - } - } - Div(#row#){ - Div(#col_left#){ - Label(){ - "Validator" - } - } - Div(#col_right#){ - Select(Name: RoleValidator, Source: src_roles, NameColumn: role_name, ValueColumn: id, Value: #role_validator#) - Div(m0 h6 text-muted){ - SetVar(r_name, $@1role_not_found$) - If(#role_validator# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #role_validator#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#role_investor_with_voting_rights#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# @@ -164,7 +145,7 @@ Div(content-wrapper){ Div(m0 h6 text-muted){ SetVar(r_name, $@1role_not_found$) If(#role_creates_roles# > 0){ - DBFind("@1roles").Where({"ecosystem": #ecosystem_id#, "id": #role_creates_roles#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#role_creates_roles#"}).Columns("role_name").Vars(r) SetVar(r_name, #r_role_name#) } LangRes(@1current_value): #r_name# diff --git a/src/basic/pages/profile_edit.ptl b/src/basic/pages/profile_edit.ptl index f4ef227f9..8f09c7213 100644 --- a/src/basic/pages/profile_edit.ptl +++ b/src/basic/pages/profile_edit.ptl @@ -1,13 +1,13 @@ -DBFind(@1applications).Where({"ecosystem": #ecosystem_id#, "name": "Basic"}).Columns("name,id").Vars(application) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Basic"}).Columns("name,id").Vars(application) SetVar(member_image_id, 0) -DBFind(@1members).Where({"ecosystem": #ecosystem_id#, "id": #key_id#}).Columns("id,member_name,image_id,member_info->information").Vars(member) -DBFind(@1buffer_data).Columns("value->id,value->member_name,value->image_id,value->member_info_information").Where({"ecosystem": #ecosystem_id#, "key": "edit_profile_form", "member_id": #key_id#}).Vars(buffer) +DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#account_id#"}).Columns("account,member_name,image_id,member_info->information").Vars(member) +DBFind("@1buffer_data").Columns("value->id,value->member_name,value->image_id,value->member_info_information").Where({"ecosystem": "#ecosystem_id#", "key": "edit_profile_form", "account": "#account_id#"}).Vars(buffer) If(#buffered# == 1){ SetVar(member_member_name, #buffer_value_member_name#) SetVar(member_member_info_information, #buffer_value_member_info_information#) } If(#uploaded# == 1){ - DBFind(@1buffer_data).Columns("value->binary_id").Where({"ecosystem": #ecosystem_id#, "key": "avatar", "member_id": #key_id#}).Vars(avatar) + DBFind("@1buffer_data").Columns("value->binary_id").Where({"ecosystem": "#ecosystem_id#", "key": "avatar", "account": "#account_id#"}).Vars(avatar) SetVar(member_image_id, #avatar_value_binary_id#) }.ElseIf(#buffered# == 1){ SetVar(member_image_id, #buffer_value_image_id#) @@ -17,7 +17,7 @@ Form(){ Div(row){ Div(col-md-4 mt-sm text-center){ SetVar(ParamNames, "id;member_name;image_id;member_info_information") - Button(Class: btn btn-link, Page: @1upload_page, PageParams: "back_page=@1profile_edit,back_page_popup=50,back_page_popup_header=$@1editing_profile$,application_id=#application_id#,buffer_key=avatar", Contract: @1FormStateSave, Params: "AppId=#application_id#,FormName=edit_profile_form,ParamNames=#ParamNames#,Param1=#key_id#,Param2=Val(Name),Param3=Val(ImageId),Param4=Val(Info)"){ + Button(Class: btn btn-link, Page: @1upload_page, PageParams: "back_page=@1profile_edit,back_page_popup=50,back_page_popup_header=$@1editing_profile$,application_id=#application_id#,buffer_key=avatar", Contract: @1FormStateSave, Params: "AppId=#application_id#,FormName=edit_profile_form,ParamNames=#ParamNames#,Param1=#account_id#,Param2=Val(Name),Param3=Val(ImageId),Param4=Val(Info)"){ If(#member_image_id# > 0){ Input(Name: ImageId, Type: hidden, Value: #member_image_id#) Image(Src: Binary().ById(#member_image_id#), Class: img-thumbnail).Style(width: 140px; border: 1px solid #5A5D63;) @@ -34,7 +34,7 @@ Form(){ Label(){ Span(Body: LangRes(@1member_name)).(Class: text-danger, Body: *) } - If(Or(#member_id# > 0, #member_id# < 0)){ + If(#member_account#){ Input(Name: Name, Value: #member_member_name#, Disabled: true) }.Else{ Input(Name: Name, Value: #member_member_name#).Validate(minLength:5, maxLength:20) diff --git a/src/basic/pages/profile_transactions.ptl b/src/basic/pages/profile_transactions.ptl index a5acf65cf..378cf5dc6 100644 --- a/src/basic/pages/profile_transactions.ptl +++ b/src/basic/pages/profile_transactions.ptl @@ -6,38 +6,41 @@ SetTitle($@1transactions_history$) If(#ecosystem_id# == 1){ SetVar(token_title, "APLA") }.Else{ - DBFind("@1ecosystems").Where({"id": #ecosystem_id#}).Vars("custom") + DBFind("@1ecosystems").Where({"id": "#ecosystem_id#"}).Vars(custom) SetVar(token_title, #custom_token_title#) } - -If(#wallet# == ""){ +If(#wallet#){ + SetVar(wallet_address, #wallet#) + SetVar(wallet, AddressToId(#wallet#)) +}.Else{ SetVar(wallet, 0) } +SetVar(account_key, AddressToId(#account_id#)) If(#new_filter#){ If(#show_fees#!="true"){ - SetVar(filter1, {"type": {"$neq": 1}}) + SetVar(filter1, `, {"type": {"$neq": 1}}`) } If(#wallet# != 0){ - SetVar(filter2, {"$or": [{"$and": [{"sender_id": #key_id#}, {"recipient_id": #wallet#}]}, {"$and": [{"sender_id": #wallet#}, {"recipient_id": #key_id#}]}]}) + SetVar(filter2, `, {"$or": [{"$and": [{"sender_id": #account_key#}, {"recipient_id": #wallet#}]}, {"$and": [{"sender_id": #wallet#}, {"recipient_id": #account_key#}]}]}`) }.Else{ - SetVar(filter2, {"$or": [{"sender_id":#key_id#}, {"recipient_id":#key_id#}]}) + SetVar(filter2, `, {"$or": [{"sender_id": #account_key#}, {"recipient_id": #account_key#}]}`) } If(#lower_limit#>0){ If(#upper_limit#>0){ - SetVar(filter3, {"amount": [{"$gte": Calculate(Exp: #lower_limit#*1000000000000000000, Type: money)}, {"$lte": Calculate(Exp: #upper_limit#*1000000000000000000, Type: money)}]}) + SetVar(filter3, `, {"amount": [{"$gte": Calculate(Exp: #lower_limit#*1000000000000000000, Type: money)}, {"$lte": Calculate(Exp: #upper_limit#*1000000000000000000, Type: money)}]}`) }.Else{ - SetVar(filter3, {"amount": {"$gte": Calculate(Exp: #lower_limit#*1000000000000000000, Type: money)}}) + SetVar(filter3, `, {"amount": {"$gte": Calculate(Exp: #lower_limit#*1000000000000000000, Type: money)}}`) } }.ElseIf(#upper_limit#>0){ - SetVar(filter3, {"amount": {"$lte": Calculate(Exp: #upper_limit#*1000000000000000000, Type: money)}}) + SetVar(filter3, `, {"amount": {"$lte": Calculate(Exp: #upper_limit#*1000000000000000000, Type: money)}}`) } - SetVar(filters, {"$and": [{"ecosystem":#ecosystem_id#}, #filter1#, #filter2#, #filter3#]}) + SetVar(filters, {"$and": [{"ecosystem": "#ecosystem_id#"} #filter1# #filter2# #filter3#]}) SetVar(page_par, #filters#) }.ElseIf(#page_par#){ SetVar(filters, #page_par#) }.Else{ - SetVar(filters, {"$and": [{"ecosystem":#ecosystem_id#}, {"type": {"$neq": 1}}, {"$or": [{"sender_id":#key_id#}, {"recipient_id":#key_id#}]}]}) + SetVar(filters, {"$and": [{"ecosystem": "#ecosystem_id#"}, {"type": {"$neq": 1}}, {"$or": [{"sender_id": #account_key#}, {"recipient_id": #account_key#}]}]}) } If(#search#){ @@ -47,7 +50,7 @@ If(#search#){ } Div(mr-lg text-right){ - Button(Page: @1profile_transactions_filter, Class: btn bg-gray-lighter mr-sm, PageParams: "show_fees=#show_fees#,MemberId=#wallet#,lower_limit=#lower_limit#,upper_limit=#upper_limit#", Body: Em(Class: fa fa-filter) $@1filter$).Popup(Header: $@1filter$, Width: "50") + Button(Page: @1profile_transactions_filter, Class: btn bg-gray-lighter mr-sm, PageParams: "show_fees=#show_fees#,MemberAccount=#wallet_address#,lower_limit=#lower_limit#,upper_limit=#upper_limit#", Body: Em(Class: fa fa-filter) $@1filter$).Popup(Header: $@1filter$, Width: "50") If(#page_par#){ Button(Page: #this_page#, Class: btn bg-gray-lighter mr-sm, Body: Em(Class: fa fa-close)) } @@ -57,22 +60,24 @@ Div(list-group-item ml-lg mr-lg pt-lg){ Include(@1search) } -DBFind(@1applications).Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) +DBFind("@1applications").Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) -DBFind(@1history, src_history).Where(#where#).Order({"id": -1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(sender_wallet){ +DBFind("@1history", src_history).Where(#where#).Order({"id": "-1"}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(sender_wallet){ If(#sender_id# != 0){ - LinkPage(Page: @1profile_view, PageParams: "v_key_id=#sender_id#"){ - Address(#sender_id#) + SetVar(sender_address, Address(#sender_id#)) + LinkPage(Page: @1profile_view, PageParams: "v_account=#sender_address#"){ + #sender_address# } } }.Custom(recipient_wallet){ - LinkPage(Page: @1profile_view, PageParams: "v_key_id=#recipient_id#"){ - Address(#recipient_id#) + SetVar(recipient_address, Address(#recipient_id#)) + LinkPage(Page: @1profile_view, PageParams: "v_account=#recipient_address#"){ + #recipient_address# } }.Custom(amount_apl){ Span(Money(#amount#) #token_title#) }.Custom(_type){ - AppParam(Ecosystem:1, App:#application_id#, Name: type_tokens_transfer, Index: #type#) + AppParam(Ecosystem: 1, App: #application_id#, Name: type_tokens_transfer, Index: #type#) }.Count(count) Div(fullscreen){ diff --git a/src/basic/pages/profile_transactions_filter.ptl b/src/basic/pages/profile_transactions_filter.ptl index 880b894e1..d9394b996 100644 --- a/src/basic/pages/profile_transactions_filter.ptl +++ b/src/basic/pages/profile_transactions_filter.ptl @@ -3,21 +3,17 @@ SetVar(this_page,@1profile_transactions_filter) If(#EcosystemId# == ""){ SetVar(EcosystemId, #ecosystem_id#) } - -If(#MemberId# == ""){ - SetVar(MemberId, 0) -} - -If(Or(#MemberId#>0,#MemberId#<0)){ - SetVar(AddressMemberId, Address(#MemberId#)) +If(#MemberAccount#){ + SetVar(MemberAccountInputValue, #MemberAccount#) + SetVar(MemberAccount, AddressToId(#MemberAccount#)) }.Else{ - SetVar(AddressMemberId,) + SetVar(MemberAccount, 0) } If(#ecosystem_id# == 1){ SetVar(token_title, "APLA") }.Else{ - DBFind("@1ecosystems").Where({"id": #ecosystem_id#}).Vars("custom") + DBFind("@1ecosystems").Where({"id": "#ecosystem_id#"}).Vars(custom) SetVar(token_title, #custom_token_title#) } @@ -29,9 +25,9 @@ Form(){ } } Div(col-md-8){ - Input(Name: wallet, Type:hidden, Value: #MemberId#) + Input(Name: wallet, Type: hidden, Value: #MemberAccount#) Div(input-group){ - Input(Name: m_name, Disabled: 1, Placeholder: "xxxx-xxxx-xxxx-xxxx-xxxx", Value: #AddressMemberId#) + Input(Name: m_name, Disabled: 1, Placeholder: "xxxx-xxxx-xxxx-xxxx-xxxx", Value: #MemberAccountInputValue#) Div(input-group-btn){ Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:"back_page=#this_page#,back_header=$@1filter$,EcosystemId=#EcosystemId#").Popup(Header: $@1member$, Width: "50") }.Style( @@ -51,7 +47,7 @@ Form(){ } } Div(col-sm-3 pr0){ - If(#lower_limit#>0){ + If(#lower_limit# > 0){ Input(Name: lower_limit, Placeholder: "$@1for_example$: 0.1", Value: #lower_limit#) }.Else{ Input(Name: lower_limit, Placeholder: "$@1for_example$: 0.1") @@ -62,7 +58,7 @@ Form(){ Label(Body: "< $@1amount$ <") } Div(col-sm-3 pl0){ - If(#upper_limit#>0){ + If(#upper_limit# > 0){ Input(Name: upper_limit, Placeholder: "$@1for_example$: 100", Value: #upper_limit#) }.Else{ Input(Name: upper_limit, Placeholder: "$@1for_example$: 100") @@ -77,13 +73,13 @@ Form(){ } } Div(col-md-8){ - If(#show_fees#=="true"){ + If(#show_fees# == "true"){ Input(Name: show_fees, Type: "checkbox", Value: "true") }.Else{ Input(Name: show_fees, Type: "checkbox", Value: "false") } } } - Button(Body: LangRes(@1filter), Class: btn btn-primary pull-right, Page: @1profile_transactions, PageParams: "new_filter=1,show_fees=Val(show_fees),wallet=#MemberId#,lower_limit=Val(lower_limit),upper_limit=Val(upper_limit)") + Button(Body: LangRes(@1filter), Class: btn btn-primary pull-right, Page: @1profile_transactions, PageParams: "new_filter=1,show_fees=Val(show_fees),wallet=#MemberAccountInputValue#,lower_limit=Val(lower_limit),upper_limit=Val(upper_limit)") Button(Body: LangRes(@1clear), Class: btn btn-default pull-right, Page: @1profile_transactions) } \ No newline at end of file diff --git a/src/basic/pages/profile_view.ptl b/src/basic/pages/profile_view.ptl index 3b92513c0..9d391def7 100644 --- a/src/basic/pages/profile_view.ptl +++ b/src/basic/pages/profile_view.ptl @@ -1,4 +1,4 @@ -If(#key_id#==#guest_key#){ +If(#account_id# == #guest_account#){ Include(@1apps_description) }.Else{ Include(@1profile) diff --git a/src/basic/pages/roles_assign.ptl b/src/basic/pages/roles_assign.ptl index 8d5a2a1cf..92eaa2c72 100644 --- a/src/basic/pages/roles_assign.ptl +++ b/src/basic/pages/roles_assign.ptl @@ -1,15 +1,15 @@ -DBFind(@1applications).Columns("name,id").Where({"name": "Basic", "ecosystem": 1}).Vars(application) +DBFind("@1applications").Columns("name,id").Where({"name": "Basic", "ecosystem": 1}).Vars(application) If(#Id#!=""){ SetVar(v_role_id, #Id#) } If(#v_role_id#>0){ - DBFind(@1roles, src_roles).Where({"ecosystem": #ecosystem_id#, "id": #v_role_id#}).Columns("id,role_name,role_type,roles_access,creator->member_id,deleted").Vars(prefix) - If(#prefix_creator_member_id#==#key_id#){ + DBFind("@1roles", src_roles).Where({"ecosystem": "#ecosystem_id#", "id": "#v_role_id#"}).Columns("id,role_name,role_type,roles_access,creator->account,deleted").Vars(prefix) + If(#prefix_creator_account#==#account_id#){ SetVar(manager_id, 1) }.ElseIf(And(#prefix_roles_access#!="NULL",#prefix_roles_access#!="",#prefix_roles_access#!="[]",#role_id#>0,#prefix_deleted#==0,#prefix_role_type#!=2)){ - DBFind(@1roles_participants).Where({"ecosystem": #ecosystem_id#, "id": {"$in": #prefix_roles_access#}}).Columns("id").Vars(manager) + DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "id": {"$in": #prefix_roles_access#}}).Columns("id").Vars(manager) } Form(){ @@ -50,15 +50,14 @@ If(#v_role_id#>0){ } } Div(col-md-9 text-left){ - If(#MemberId# == ""){ - SetVar(MemberId, 0) - } - Input(Name: member_id, Type:hidden, Value: #MemberId#) Div(input-group){ - If(Or(#MemberId#>0,#MemberId#<0)){ - SetVar(AddressMemberId, Address(#MemberId#)) + If(#MemberAccount#){ + Input(Name: account, Type: hidden, Value: #MemberAccount#) + Input(Name: m_name, Disabled: 1, Placeholder: "xxxx-xxxx-xxxx-xxxx-xxxx", Value: #MemberAccount#) + }.Else{ + Input(Name: account, Type: hidden, Value: 0) + Input(Name: m_name, Disabled: 1, Placeholder: "xxxx-xxxx-xxxx-xxxx-xxxx") } - Input(Name: m_name, Disabled: 1, Placeholder: "xxxx-xxxx-xxxx-xxxx-xxxx", Value: #AddressMemberId#) Div(input-group-btn){ Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:"back_page=@1roles_assign,back_header=$@1assign$,Id=#v_role_id#,EcosystemId=#ecosystem_id#").Popup(Header: $@1member$, Width: "50") }.Style( @@ -72,7 +71,7 @@ If(#v_role_id#>0){ } } If(And(#manager_id#>0,#prefix_role_type#!=2)){ - Button(Body: LangRes(@1assign), Class: btn bg-primary pull-right mt, Page: @1roles_view, PageParams: "v_role_id=#v_role_id#", Contract: @1RolesAssign, Params: "MemberId=Val(member_id)").Alert(Text: "$@1want_assign_member_to_role$", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question) + Button(Body: LangRes(@1assign), Class: btn bg-primary pull-right mt, Page: @1roles_view, PageParams: "v_role_id=#v_role_id#", Contract: @1RolesAssign, Params: "MemberAccount=Val(account)").Alert(Text: "$@1want_assign_member_to_role$", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question) } Button(Body: LangRes(@1back), Class: btn bg-gray-lighter pull-right mt, Page: @1roles_view, PageParams: "v_role_id=#v_role_id#") } diff --git a/src/basic/pages/roles_create.ptl b/src/basic/pages/roles_create.ptl index ee973a322..2581b6b42 100644 --- a/src/basic/pages/roles_create.ptl +++ b/src/basic/pages/roles_create.ptl @@ -1,22 +1,22 @@ -DBFind(@1applications).Columns("name,id").Where({"ecosystem": 1, "name": "Basic"}).Vars(application) -DBFind(@1roles, src_roles).Columns("id,role_name").Where({"ecosystem": #ecosystem_id#, "deleted": 0}).Order(id) +DBFind("@1applications").Columns("name,id").Where({"ecosystem": 1, "name": "Basic"}).Vars(application) +DBFind("@1roles", src_roles).Columns("id,role_name").Where({"ecosystem": "#ecosystem_id#", "deleted": 0}).Order("id") If(#back_page#==""){ SetVar(back_page, "@1roles_list") } If(#rid#==""){ SetVar(title, $@1new_role$) - DBFind(@1buffer_data).Where({"ecosystem": #ecosystem_id#, "key": "roles_access", "member_id": #key_id#}).Columns("id,key,member_id,ecosystem,value->roles_access,value->role_type,value->role_name").Vars(buffer) + DBFind("@1buffer_data").Where({"ecosystem": "#ecosystem_id#", "key": "roles_access", "account": "#account_id#"}).Columns("id,key,account,ecosystem,value->roles_access,value->role_type,value->role_name").Vars(buffer) AppParam(Source: app_roles_types, Ecosystem: 1, App: #application_id#, Name: roles_types_selection) If(And(#buffer_value_roles_access#!="NULL",#buffer_value_roles_access#!="",#buffer_value_roles_access#!="[]")){ - DBFind(@1roles, src_roles_access).Where({"ecosystem": #ecosystem_id#, "id": {"$in": #buffer_value_roles_access#}}).Columns("id,role_name").Count(ra_count).Order("role_name") + DBFind("@1roles", src_roles_access).Where({"ecosystem": "#ecosystem_id#", "id": {"$in": #buffer_value_roles_access#}}).Columns("id,role_name").Count(ra_count).Order("role_name") } }.Else{ SetVar(title, $@1edit_role$) - DBFind(@1roles).Where({"ecosystem": #ecosystem_id#, "id": #rid#}).Columns("roles_access,role_type,role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#rid#"}).Columns("roles_access,role_type,role_name").Vars(r) SetVar(role_type, AppParam(Ecosystem: 1, App: #application_id#, Name: roles_types, Index: #r_role_type#)) If(And(#r_roles_access#!="NULL",#r_roles_access#!="",#r_roles_access#!="[]")){ - DBFind(@1roles, src_roles_access).Where({"ecosystem": #ecosystem_id#, "id": {"$in": #r_roles_access#}}).Columns("id,role_name").Count(ra_count).Order("role_name") + DBFind("@1roles", src_roles_access).Where({"ecosystem": "#ecosystem_id#", "id": {"$in": #r_roles_access#}}).Columns("id,role_name").Count(ra_count).Order("role_name") } } diff --git a/src/basic/pages/roles_list.ptl b/src/basic/pages/roles_list.ptl index 26b0fe16a..3bc1e0512 100644 --- a/src/basic/pages/roles_list.ptl +++ b/src/basic/pages/roles_list.ptl @@ -6,17 +6,18 @@ Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$@1roles_ AddToolButton(Page: @1roles_create, Icon: icon-plus, Title: $@1create$).Popup(50, $@1new_role$) If(#search#){ - SetVar(w_search, {"role_name": {"$ilike": "#search#"}}) + SetVar(where, {"ecosystem": "#ecosystem_id#", "role_name": {"$ilike": "#search#"}}) +}.Else{ + SetVar(where, {"ecosystem": "#ecosystem_id#"}) } -SetVar(where, {"ecosystem": #ecosystem_id#, {#w_search#}}) Div(list-group-item ml-lg mr-lg pt-lg){ SetVar(search_name, LangRes(@1role)) Include(@1search) } -DBFind(#this_table#).Where({"ecosystem": #ecosystem_id#}).Count(all_roles_count) -DBFind(#this_table#, src_roles).Where(#where#).Order({deleted:"1", id:"1"}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("id,role_name,role_type,image_id,creator->member_id,creator->member_name,date_created,date_deleted,deleted,roles_access").Custom(_id){ +DBFind(#this_table#).Where({"ecosystem": "#ecosystem_id#"}).Count(all_roles_count) +DBFind(#this_table#, src_roles).Where(#where#).Order({"deleted": 1, "id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("id,role_name,role_type,image_id,creator->account,creator->member_name,date_created,date_deleted,deleted,roles_access").Custom(_id){ If(#deleted# == 0){ SetVar(style_text,"text-normal").(style_link, "text-primary") }.Else{ @@ -25,7 +26,7 @@ DBFind(#this_table#, src_roles).Where(#where#).Order({deleted:"1", id:"1"}).Limi Span(Class: #style_text#, Body: #id#) }.Custom(_creator){ If(And(#creator.member_name#!=NULL,#creator.member_name#!="")){ - LinkPage(Class: #style_link# text-bold, Page: @1profile_view, PageParams: "v_key_id=#creator.member_id#"){ + LinkPage(Class: #style_link# text-bold, Page: @1profile_view, PageParams: "v_account=#creator.account#"){ #creator.member_name# } } @@ -58,7 +59,7 @@ DBFind(#this_table#, src_roles).Where(#where#).Order({deleted:"1", id:"1"}).Limi } } }.Custom(_type){ - DBFind(@1applications).Where({"name": "Basic", "ecosystem": 1}).Columns("name,id").Vars(application) + DBFind("@1applications").Where({"name": "Basic", "ecosystem": 1}).Columns("name,id").Vars(application) Span(Class: #style_text#, Body: AppParam(Ecosystem: 1, App: #application_id#, Name: roles_types, Index: #role_type#)) }.Custom(_status){ Span(Class:#style_text#){ @@ -69,13 +70,13 @@ DBFind(#this_table#, src_roles).Where(#where#).Order({deleted:"1", id:"1"}).Limi } } }.Custom(_access){ - If(#creator.member_id#==#key_id#){ + If(#creator.account# == #account_id#){ SetVar(access,done) }.Else{ SetVar(access,) } If(And(#roles_access#!="NULL",#roles_access#!="",#roles_access#!="[]")){ - DBFind(@1roles,src_access_list).Where({"id": {"$in": #roles_access#}}).Columns("id,role_name").Count(access_count).Order(role_name) + DBFind("@1roles", src_access_list).Where({"id": {"$in": #roles_access#}}).Columns("id,role_name").Count(access_count).Order("role_name") Div(#style_text# breaker){ ForList(src_access_list){ If(And(#role_id#==#id#)){ diff --git a/src/basic/pages/roles_request.ptl b/src/basic/pages/roles_request.ptl index 3df670053..0fcebbb55 100644 --- a/src/basic/pages/roles_request.ptl +++ b/src/basic/pages/roles_request.ptl @@ -6,7 +6,7 @@ Form(){ } } Div(col-md-9 text-left){ - DBFind(@1roles,src_roles).Where({"ecosystem": #ecosystem_id#, "role_type": 1, "deleted": 0}).Columns("id,role_name").Count(roles_count) + DBFind("@1roles", src_roles).Where({"ecosystem": "#ecosystem_id#", "role_type": 1, "deleted": 0}).Columns("id,role_name").Count(roles_count) If(#roles_count#==0){ Div(Body: LangRes(@1no_assigned_roles)) }.Else{ diff --git a/src/basic/pages/roles_request_view.ptl b/src/basic/pages/roles_request_view.ptl index e848daa5b..cd646e0ba 100644 --- a/src/basic/pages/roles_request_view.ptl +++ b/src/basic/pages/roles_request_view.ptl @@ -1,5 +1,5 @@ Div(content-wrapper){ - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "id": #notific_id#}).Columns("page_params->rid,sender->image_id,sender->member_id,sender->member_name,closed").Vars(notific) + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "id": #notific_id#}).Columns("page_params->rid,sender->image_id,sender->account,sender->member_name,closed").Vars(notific) Div(row){ Div(col-sm-8 col-sm-offset-2 col-lg-6 col-lg-offset-3){ @@ -22,17 +22,17 @@ Div(content-wrapper){ } Div(list-group-item text-center){ Div(text-muted m0 h5, Body: LangRes(@1address)) - Span(Class: h5 text-bold, Body: Address(#notific_sender_member_id#)) + Span(Class: h5 text-bold, Body: #notific_sender_account#) } Div(list-group-item text-center){ - DBFind(@1roles).Where({"ecosystem": #ecosystem_id#, "id": #notific_page_params_rid#}).Columns("role_name").Vars(r) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#notific_page_params_rid#"}).Columns("role_name").Vars(r) Div(text-muted m0 h5, Body: LangRes(@1role)) Span(Class: h5 text-bold, Body: #notific_page_params_rid# - #r_role_name#) } If(#notific_closed# == 0){ Div(row){ Div(col-md-12 mt-lg text-center){ - Input(Name: MemberId, Class: hidden, Value: #notific_sender_member_id#) + Input(Name: MemberAccount, Class: hidden, Value: #notific_sender_account#) Input(Name: Rid, Class: hidden, Value: #notific_page_params_rid#) Button(Class: btn btn-danger mh-sm, Body: $@1reject$, Contract: @1RolesRequestDecision, Page: @1roles_list, Params: "NotificId=#notific_id#,Decision=0") Button(Class: btn btn-success mh-sm, Body: $@1accept$, Contract: @1RolesRequestDecision, Page: @1roles_list, Params: "NotificId=#notific_id#,Decision=1") diff --git a/src/basic/pages/roles_view.ptl b/src/basic/pages/roles_view.ptl index 6e864df4d..f78dfe702 100644 --- a/src/basic/pages/roles_view.ptl +++ b/src/basic/pages/roles_view.ptl @@ -6,11 +6,11 @@ If(#v_role_id#>0){ SetVar(this_page, @1roles_view).(this_table, @1roles_participants) Include(@1pager_header) - DBFind(@1roles).Where({"ecosystem": #ecosystem_id#, "id": #v_role_id#}).Columns("role_name,role_type,deleted,roles_access,creator->member_id").Vars(prefix) - If(#prefix_creator_member_id#==#key_id#){ + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#v_role_id#"}).Columns("role_name,role_type,deleted,roles_access,creator->account").Vars(prefix) + If(#prefix_creator_account#==#account_id#){ SetVar(manager_id,1) }.ElseIf(And(#prefix_roles_access#!="NULL",#prefix_roles_access#!="",#prefix_roles_access#!="[]",#role_id#>0,#prefix_deleted#==0,#prefix_role_type#!=2)){ - DBFind(@1roles).Where({"ecosystem": #ecosystem_id#, "id": [{"$in": #prefix_roles_access#}, {"$eq": #role_id#}]}).Columns("id").Vars(manager) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": [{"$in": #prefix_roles_access#}, {"$eq": "#role_id#"}]}).Columns("id").Vars(manager) } If(#manager_id#>0){ @@ -27,16 +27,17 @@ If(#v_role_id#>0){ ) If(#search#){ - SetVar(w_search, {"member->member_name": {"$ilike": "#search#"}}) + SetVar(where, {"ecosystem": "#ecosystem_id#", "role->id": "#v_role_id#", "member->member_name": {"$ilike": "#search#"}}) + }.Else{ + SetVar(where, {"ecosystem": "#ecosystem_id#", "role->id": "#v_role_id#"}) } - SetVar(where, {"ecosystem":#ecosystem_id#, "role->id":#v_role_id#, {#w_search#}}) Div(list-group-item ml-lg mr-lg pt-lg){ SetVar(search_name, LangRes(@1member)).(page_par, #v_role_id#) Include(@1search) } - DBFind(#this_table#, src_participants).Where(#where#).Order({"deleted": 1, "id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("id,member->member_id,member->member_name,member->image_id,appointed->member_id,appointed->member_name,appointed->voting_id,appointed->voting_name,date_created,date_deleted,deleted").Custom(custom_id){ + DBFind(#this_table#, src_participants).Where(#where#).Order({"deleted": 1, "id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("id,member->account,member->member_name,member->image_id,appointed->account,appointed->member_name,appointed->voting_id,appointed->voting_name,date_created,date_deleted,deleted").Custom(custom_id){ If(#deleted# == 0){ SetVar(Name: style_text, Value: "text-normal") SetVar(Name: style_link, Value: "text-primary") @@ -46,8 +47,8 @@ If(#v_role_id#>0){ } Span(Class: #style_text#, Body: #id#) }.Custom(custom_appointed){ - If(Or(#appointed.member_id#>0,#appointed.member_id#<0)){ - LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#appointed.member_id#"){ + If(And(#appointed.account# != "", #appointed.account# != NULL)){ + LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: "v_account=#appointed.account#"){ Span(Body: #appointed.member_name#) } } @@ -57,7 +58,7 @@ If(#v_role_id#>0){ } } }.Custom(custom_member){ - LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#member.member_id#"){ + LinkPage(Class: #style_link# h5 text-bold, Page: @1profile_view, PageParams: "v_account=#member.account#"){ If(#member.image_id#>0){ Image(Src: Binary().ById(#member.image_id#), Class: img-circle).Style(width: 30px; border: 1px solid #5A5D63; margin-right: 10px;) Span(#member.member_name#) @@ -69,7 +70,7 @@ If(#v_role_id#>0){ } } }.Custom(custom_address){ - Span(Class: #style_text#, Body: Address(#member.member_id#)) + Span(Class: #style_text#, Body: #member.account#) }.Custom(custom_date){ Div(Class: #style_text# h6 m0, Body: DateTime(DateTime: #date_created#, Format: "DD.MM.YYYY HH:MI")) Div(Class: #style_text# h6 m0, Body: DateTime(DateTime: #date_deleted#, Format: "DD.MM.YYYY HH:MI")) diff --git a/src/basic/pages/select_ecosystem.ptl b/src/basic/pages/select_ecosystem.ptl index 19ae77e8e..46487993a 100644 --- a/src/basic/pages/select_ecosystem.ptl +++ b/src/basic/pages/select_ecosystem.ptl @@ -1,15 +1,16 @@ -If(#Type#==ALL_LIST){ - DBFind(@1ecosystems,items).Limit(250).Columns("name,id") - SetVar(name_column,"name") - SetVar(value_column,"id") +If(#Type# == "ALL_LIST"){ + DBFind("@1ecosystems", items).Limit(250).Columns("name,id") + SetVar(name_column, "name") + SetVar(value_column, "id") } -If(#Type#==ONLY_MY){ - DBFind(@1parameters,items).Where({"$and": [{"ecosystem": {"$neq": 1}}, {"$or": [{"$and": [{"name": "founder_account"},{"value": #key_id#}]},{"$and": [{"name": "delegate_account"},{"value": #key_id#}]}]}]}).Columns("ecosystem").Custom("custom_name"){ - DBFind(@1ecosystems).Where({"id": #ecosystem#}).Vars(eco) +If(#Type# == "ONLY_MY"){ + SetVar(account_key, AddressToId(#account_id#)) + DBFind("@1parameters", items).Where({"$and": [{"ecosystem": {"$neq": 1}}, {"$or": [{"$and": [{"name": "founder_account"}, {"value": "#account_key#"}]}, {"$and": [{"name": "delegate_account"}, {"value": "#account_key#"}]}]}]}).Columns("ecosystem").Custom("custom_name"){ + DBFind("@1ecosystems").Where({"id": "#ecosystem#"}).Vars(eco) Span(#eco_name#) } - SetVar(name_column,"custom_name") - SetVar(value_column,"ecosystem") + SetVar(name_column, "custom_name") + SetVar(value_column, "ecosystem") } Form(){ @@ -18,7 +19,7 @@ Form(){ Select(Name: EcosystemId, Source: items, NameColumn: #name_column#, ValueColumn: #value_column#, Value: #EcosystemId#) } } - If(#back_header#!=""){ + If(#back_header#){ Button(Body: LangRes(@1select), Class: btn btn-primary pull-right mt, Page: #back_page#, PageParams: "EcosystemId=Val(EcosystemId)").Popup(Header: #back_header#, Width: 50) If(#go_home# == 1) { Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1ec_list) diff --git a/src/basic/pages/select_group.ptl b/src/basic/pages/select_group.ptl index 361e172ad..d497540b4 100644 --- a/src/basic/pages/select_group.ptl +++ b/src/basic/pages/select_group.ptl @@ -8,9 +8,9 @@ If(#page_par#){ } If(#search#){ - SetVar(where, {"ecosystem": #EcosystemId#, "deleted": 0, "group_name": #search#}) + SetVar(where, {"ecosystem": "#EcosystemId#", "deleted": 0, "group_name": {"$ilike": "#search#"}}) }.Else{ - SetVar(where, {"ecosystem": #EcosystemId#, "deleted": 0}) + SetVar(where, {"ecosystem": "#EcosystemId#", "deleted": 0}) } Div(){ diff --git a/src/basic/pages/select_role.ptl b/src/basic/pages/select_role.ptl index d3e868856..4d2101960 100644 --- a/src/basic/pages/select_role.ptl +++ b/src/basic/pages/select_role.ptl @@ -8,9 +8,9 @@ If(#page_par#){ } If(#search#){ - SetVar(where, {"ecosystem": #EcosystemId#, "deleted": 0, "role_name": #search#}) + SetVar(where, {"ecosystem": "#EcosystemId#", "deleted": 0, "role_name": {"$ilike": "#search#"}}) }.Else{ - SetVar(where, {"ecosystem": #EcosystemId#, "deleted": 0}) + SetVar(where, {"ecosystem": "#EcosystemId#", "deleted": 0}) } Div(){ diff --git a/src/basic/pages/select_wallet.ptl b/src/basic/pages/select_wallet.ptl index 57b64fe84..d84fe82c2 100644 --- a/src/basic/pages/select_wallet.ptl +++ b/src/basic/pages/select_wallet.ptl @@ -8,9 +8,9 @@ If(#page_par#){ } If(#search#){ - SetVar(where, {"ecosystem": #EcosystemId#, "id": {"$neq":#guest_key#}, "deleted": 0, "id": AddressToId(#search#)}) + SetVar(where, {"ecosystem": "#EcosystemId#", "deleted": 0, "$and": [{"account": {"$ilike": "#search#"}}, {"account": {"$neq": "#guest_account#"}}]}) }.Else{ - SetVar(where, {"ecosystem": #EcosystemId#, "id": {"$neq":#guest_key#}, "deleted": 0}) + SetVar(where, {"ecosystem": "#EcosystemId#", "account": {"$neq": "#guest_account#"}, "deleted": 0}) } Div(){ @@ -30,36 +30,36 @@ Div(){ .buttons{border: 1px solid #dde6e9;} ) -DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(custom_id){ - Span(Class: h6 text-muted, Body: #id#) - SetVar(m_id, 0) - DBFind(@1members).Where({"ecosystem": #ecosystem_id#, "id": #id#}).Vars(m) - If(Or(#m_id#>0,#m_id#<0)){ +DBFind(#this_table#, src).Where(#where#).Order({"account": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(custom_id){ + Span(Class: h6 text-muted, Body: #account#) + SetVar(m_account,) + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#account#"}).Vars(m) + If(#m_account#){ SetVar(image_id, #m_image_id#) SetVar(member_name, #m_member_name#) }.Else{ SetVar(image_id, 0) - SetVar(member_name, Address(#id#)) + SetVar(member_name, #account#) } -}.Custom(custom_member_id){ +}.Custom(custom_account){ If(#back_header#!=""){ - Button(Class: btn-xs btn-link pull-right, Page: #back_page#, PageParams: "MemberId=#id#,EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#"){ - Span(Class: h5 text-bold, Body: Address(#id#)) + Button(Class: btn-xs btn-link pull-right, Page: #back_page#, PageParams: "MemberAccount=#account#,EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#"){ + Span(Class: h5 text-bold, Body: #account#) }.Popup(Header: #back_header#, Width: 50) }.Else{ - Button(Class: btn-xs btn-link pull-right, Page: #back_page#, PageParams: "MemberId=#id#,EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#"){ - Span(Class: h5 text-bold, Body: Address(#id#)) + Button(Class: btn-xs btn-link pull-right, Page: #back_page#, PageParams: "MemberAccount=#account#,EcosystemId=#EcosystemId#,Id=#Id#,parent_back_page=#parent_back_page#"){ + Span(Class: h5 text-bold, Body: #account#) } } }.Custom(custom_ecosystem){ Span(Class: text-muted h5, Body: $@1ecosystem$ #EcosystemId#) }.Custom(custom_username){ If(#image_id#>0){ - Image(Src: Binary().ById(#image_id#), Class: img-circle).Style(height: 30px;width: 30px; border: 1px solid #5A5D63; margin-right: 10px;) + Image(Src: Binary().ById(#image_id#), Class: img-circle).Style(height: 30px; width: 30px; border: 1px solid #5A5D63; margin-right: 10px;) Span(Class: h5, Body: #member_name#) }.Else{ Div(){ - Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;) + Span(Em(Class: fa icon-user fa-2x)).Style(margin-right: 10px;) Span(Class: h5, Body: #member_name#) }.Style(display:flex; align-items:center;) } @@ -69,7 +69,7 @@ Div(fullscreen){ Div(table-responsive){ Div(){ If(#count# > 0){ - Table(src, "=custom_username,=custom_ecosystem,=custom_member_id") + Table(src, "=custom_username,=custom_ecosystem,=custom_account") }.Else{ Div(Class: text-center h4 text-muted, Body: "$@1members$ $@1not_founded$") } diff --git a/src/basic/pages/sysparams_list.ptl b/src/basic/pages/sysparams_list.ptl index c817ee573..151586d73 100644 --- a/src/basic/pages/sysparams_list.ptl +++ b/src/basic/pages/sysparams_list.ptl @@ -3,17 +3,18 @@ Include(@1pager_header) SetTitle("$@1platform_parameters$") Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$@1platform_params_desc$")) -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "System"}).Vars("system_app") -SetVar(role_validator, AppParam(App: #system_app_id#, Name: "role_validator")) -DBFind(@1roles_participants).Where({"ecosystem": #ecosystem_id#, "member->member_id": #key_id#, "role->id": #role_validator#, "deleted": 0}).Columns("id").Vars(validator) -If(#validator_id#>0){ - AddToolButton(Title: $@1sysparams_validator_resign$, Icon: icon-pin, Page: @1validator_resign).Popup(50, $@1sysparams_validator_resign$) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(system_app) +SetVar(role_consortium_member, AppParam(App: #system_app_id#, Name: "role_consortium_member")) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "member->account": "#account_id#", "role->id": "#role_consortium_member#", "deleted": 0}).Columns("id").Vars(consortium_member) +If(#consortium_member_id#>0){ + AddToolButton(Title: $@1consortium_member_resign$, Icon: icon-pin, Page: @1consortium_member_resign).Popup(50, $@1consortium_member_resign$) } If(#search#){ - SetVar(w_search, {"name": {"$ilike": "#search#"}}) + SetVar(where, {"name": {"$ilike": "#search#"}}) +}.Else{ + SetVar(where, {}) } -SetVar(where, {#w_search#}) Div(list-group-item ml-lg mr-lg pt-lg){ SetVar(search_name, LangRes(@1name)) @@ -22,7 +23,7 @@ Div(list-group-item ml-lg mr-lg pt-lg){ DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_actions){ SetVar(sp_id,0) - DBFind(@1contracts).Where({"ecosystem": 1, "name": #name#}).Columns(id).Vars(sp) + DBFind("@1contracts").Where({"ecosystem": 1, "name": "#name#"}).Columns(id).Vars(sp) If(#sp_id#>0){ Span(Class: pull-right){ LinkPage(Class: text-primary h4, Body: Em(Class: fa fa-cogs), Page: @1sysparams_voting, PageParams: "param_index=#id#,param_name=#name#") diff --git a/src/basic/pages/sysparams_metrics.ptl b/src/basic/pages/sysparams_metrics.ptl index 9cf3e7f38..b8808da06 100644 --- a/src/basic/pages/sysparams_metrics.ptl +++ b/src/basic/pages/sysparams_metrics.ptl @@ -1,4 +1,4 @@ -DBFind("@1ecosystems").WhereId(#Id#).Vars("eco") +DBFind("@1ecosystems").WhereId(#Id#).Vars(eco) Div(content-wrapper){ Div(breadcrumb){ @@ -18,7 +18,7 @@ Div(content-wrapper){ tx,ecosystem_tx } ForList(tables){ - DBFind(@1metrics,src_metric).Where({"key": #Id#, "metric": #Metric#}).Order("time").Count(count) + DBFind("@1metrics", src_metric).Where({"key": "#Id#", "metric": "#Metric#"}).Order("time").Count(count) If(#count#>0){ Div(h3){LangRes(#Name#)} Table(src_metric,"$@1timestam$=time,$@1value$=value") diff --git a/src/basic/pages/sysparams_voting.ptl b/src/basic/pages/sysparams_voting.ptl index 2b7fedb9c..faa8b03ea 100644 --- a/src/basic/pages/sysparams_voting.ptl +++ b/src/basic/pages/sysparams_voting.ptl @@ -14,14 +14,14 @@ Form(content-wrapper){ } } - DBFind(@1applications).Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) + DBFind("@1applications").Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) If(#param_name# == full_nodes){ - SetVar(template_id, AppParam(Ecosystem:1, App:#application_id#, Name: voting_template_validators)) + SetVar(template_id, AppParam(Ecosystem:1, App:#application_id#, Name: voting_template_consortium_member)) }.Else{ SetVar(template_id, AppParam(Ecosystem:1, App:#application_id#, Name: voting_template_platformparams)) } If(#template_id#){ - DBFind(@1voting_templates).Where({"ecosystem": #ecosystem_id#, "id": #template_id#}).Columns("subject->voters").Vars(template) + DBFind("@1voting_templates").Where({"ecosystem": "#ecosystem_id#", "id": "#template_id#"}).Columns("subject->voters").Vars(template) } If(#template_id# > 0){}.Else{ @@ -37,7 +37,7 @@ Form(content-wrapper){ If(#template_id# > 0){ If(#param_name# != full_nodes){ - DBFind(@1system_parameters).Where({"name": #param_name#}).Vars(param) + DBFind("@1system_parameters").Where({"name": "#param_name#"}).Vars(param) Div(form-group){ Label($@1name$) Input(Name: Name, Value: #param_name#, Disabled: true) @@ -64,15 +64,15 @@ Form(content-wrapper){ } }.Else{ SetVar(full_nodes, SysParam(full_nodes)) - SetVar(first_node, AppParam(Ecosystem:1, App:#application_id#, Name: first_node)).(first_node_set, "") - If(`#full_nodes#` == ""){ + SetVar(first_node, AppParam(Ecosystem: 1, App :#application_id#, Name: first_node)).(first_node_set,) + If(#full_nodes# == ""){ JsonToSource(src_first_node, #first_node#) ForList(src_first_node){ - If(#value#==""){ + If(#value# == ""){ SetVar(first_node_set, error) } } - If(#first_node_set#==error){ + If(#first_node_set# == error){ Div(text-center){ ForList(src_first_node){ If(#value#==""){ @@ -81,7 +81,7 @@ Form(content-wrapper){ } } Div(text-center){ - DBFind(@1app_params).Where({"ecosystem": #ecosystem_id#, "name": first_node}).Vars(first_node_param) + DBFind("@1app_params").Where({"ecosystem": "#ecosystem_id#", "name": "first_node"}).Vars(first_node_param) Button(Page: @1app_params_edit, Class: btn btn-info, PageParams: "id=#first_node_param_id#,back_page=@1sysparams_list", Body: $@1install_first_node$) } } @@ -100,7 +100,7 @@ Form(content-wrapper){ Div(col-md-3 text-right mt-lg){ If(And(#template_subject_voters#>0,#template_subject_voters#==#role_id#)){ SetVar(Index, Calculate(#src_full_nodes_index# - 1)) - Button(Body: $@1delete$, Class: btn btn-danger mt, Contract: @1VotingRunRemoveValidator, Params: "Index=#Index#" Page: @1voting_list) + Button(Body: $@1delete$, Class: btn btn-danger mt, Contract: @1VotingRunRemoveConsortiumMember, Params: "Index=#Index#" Page: @1voting_list) }.Else{ Div(mt-lg){ If(#template_id# > 0){ diff --git a/src/basic/pages/tokenrefund_create.ptl b/src/basic/pages/tokenrefund_create.ptl index 16f9a8a6c..ba4d3ceb7 100644 --- a/src/basic/pages/tokenrefund_create.ptl +++ b/src/basic/pages/tokenrefund_create.ptl @@ -16,7 +16,7 @@ Form(){ } } Div(col-sm-9){ - Input(Name: VictimAccount, Placeholder: $@1key_id_or_wallet$) + Input(Name: VictimAccount, Placeholder: $@1wallet_address$) } } Div(row mt-sm){ @@ -26,7 +26,7 @@ Form(){ } } Div(col-sm-9){ - Input(Name: SuspectAccount, Placeholder: $@1key_id_or_wallet$) + Input(Name: SuspectAccount, Placeholder: $@1wallet_address$) } } Div(row mt-sm){ diff --git a/src/basic/pages/tokenrefund_list.ptl b/src/basic/pages/tokenrefund_list.ptl index 6ec6a48ee..382cfd9b3 100644 --- a/src/basic/pages/tokenrefund_list.ptl +++ b/src/basic/pages/tokenrefund_list.ptl @@ -2,10 +2,10 @@ SetVar(this_page, @1tokenrefund_list).(this_table, @1tokens_refund) Include(@1pager_header) SetTitle("$@1tokens_refunds_list$") -DBFind(@1applications).Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) +DBFind("@1applications").Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) SetVar(tid, AppParam(App: #application_id#, Name: voting_template_tokenrefund, Ecosystem: 1)) If(#tid# > 0){ - DBFind(@1voting_templates).Where({"ecosystem": #ecosystem_id#, "id": #tid#}).Columns("subject->voters").Vars(template) + DBFind("@1voting_templates").Where({"ecosystem": "#ecosystem_id#", "id": "#tid#"}).Columns("subject->voters").Vars(template) } If(And(#template_subject_voters#>0,#template_subject_voters#==#role_id#)){ Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: $@1tokens_refunds_list_desc$)) @@ -19,9 +19,10 @@ If(And(#template_subject_voters#>0,#template_subject_voters#==#role_id#)){ } If(#search#){ - SetVar(w_search, {"note": {"$ilike": "#search#"}}) + SetVar(where, {"note": {"$ilike": "#search#"}}) +}.Else{ + SetVar(where, {}) } -SetVar(where, {#w_search#}) Div(list-group-item ml-lg mr-lg pt-lg){ SetVar(search_name, LangRes(@1description)) @@ -43,8 +44,8 @@ DBFind(#this_table#, src_refunds_list).Where(#where#).Order({"id": 1}).Limit(#pa }.Custom(_closed){ DateTime(Format: YYYY-MM-DD HH:MI:SS, DateTime: #closed_at#) }.Custom(_accounts){ - Div(){$@1tokens_refund_victim$: Address(#victim_key_id#)} - Div(){$@1tokens_refund_attacker$: Address(#attacker_key_id#)} + Div(){$@1tokens_refund_victim$: #victim_account#} + Div(){$@1tokens_refund_attacker$: #attacker_account#} }.Custom(_amount){ Money(#amount#) }.Count(count) @@ -53,7 +54,7 @@ Div(fullscreen){ Div(table-responsive ml-lg mr-lg){ Div(list-group-item){ If(#count# > 0){ - Table(src_refunds_list, "$@1accounts$=_accounts,$@1description$=note,$@1validator_id$=validator_id,$@1blocked_at$=_blocked,$@1closed$=_closed,$@1result$=_result,$@1amount$=_amount,$@1status$=_status") + Table(src_refunds_list, "$@1accounts$=_accounts,$@1description$=note,$@1consortium_member$=consortium_member_account,$@1blocked_at$=_blocked,$@1closed$=_closed,$@1result$=_result,$@1amount$=_amount,$@1status$=_status") }.Else{ Div(Class: text-center h4 text-muted, Body: "$@1tokens_refunds$ $@1not_founded$") } diff --git a/src/basic/pages/tokens_send.ptl b/src/basic/pages/tokens_send.ptl index 7d2bcdb19..04fd1b09e 100644 --- a/src/basic/pages/tokens_send.ptl +++ b/src/basic/pages/tokens_send.ptl @@ -7,20 +7,15 @@ If(#back_page# == ""){ SetVar(back_page, "@1members_list") } } -If(#MemberId# != ""){ - SetVar(v_key_id, #MemberId#) +If(#MemberAccount#){ + SetVar(v_account, #MemberAccount#) } -If(Or(#v_key_id#>0,#v_key_id#<0)){ - SetVar(Name: v_address, Value: Address(#v_key_id#)) -}.Else{ - SetVar(Name: v_address, Value: "") -} -If(#v_amount#==""){ - SetVar(Name: v_amount, Value: "") +If(#v_account#){ + SetVar(Name: v_address, Value: #v_account#) } -DBFind("@1keys").Where({"ecosystem": #ecosystem_id#, "id": #key_id#}).Vars("tokens") -DBFind("@1ecosystems").Where({"id": #ecosystem_id#}).Vars("custom") +DBFind("@1keys").Where({"ecosystem": "#ecosystem_id#", "account": "#account_id#", "deleted": 0}).Vars(tokens) +DBFind("@1ecosystems").Where({"id": "#ecosystem_id#"}).Vars(custom) If(#ecosystem_id# == 1){ SetVar(token_title, "APLA") }.Else{ @@ -35,7 +30,7 @@ If(Or(#ecosystem_id# == 1, #custom_token_title# != "")){ Span(Class: text-danger, Body:*) } Div(col-sm-9){ - SetVar(m_a, Address(#key_id#) (Money(#tokens_amount#) #token_title#)) + SetVar(m_a, #account_id# (Money(#tokens_amount#) #token_title#)) Input(Name: Sender, Disabled: 1, Value: #m_a#) Div(Class: m0 h6 text-muted, Body: $@1send_tokens_my_balance$) } diff --git a/src/basic/pages/upload_page.ptl b/src/basic/pages/upload_page.ptl index 7024cc42e..b2bc58de2 100644 --- a/src/basic/pages/upload_page.ptl +++ b/src/basic/pages/upload_page.ptl @@ -1,7 +1,10 @@ Form(){ Div(row){ Div(col-sm-12){ - Input(Name: FileData, Type: file) + Input(Name: FileData, Type: file).Validate(required: "1") + Div(Class: text-danger){ + InputErr(Name: FileData, required: $@1file_not_selected$) + } } } If(#back_page_popup# == 50){ diff --git a/src/basic/pages/validator_candidates_create.ptl b/src/basic/pages/validator_candidates_create.ptl deleted file mode 100644 index e060492a6..000000000 --- a/src/basic/pages/validator_candidates_create.ptl +++ /dev/null @@ -1,57 +0,0 @@ -Form(){ - Div(row){ - Div(col-md-3 mt-sm text-right){ - Label(LangRes(@1tcp_address)) - Span(Class: text-danger, Body:*) - } - Div(col-md-9 text-left){ - Input(Name: TcpAddress, Placeholder: "xxx.xxx.xxx.xxx:port") - } - } - Div(row mt-sm){ - Div(col-md-3 mt-sm text-right){ - Label(LangRes(@1api_address)) - Span(Class: text-danger, Body:*) - } - Div(col-md-9 text-left){ - Input(Name: ApiAddress, Placeholder: "protocol://xxx.xxx.xxx.xxx:port") - } - } - Div(row mt-sm){ - Div(col-md-3 mt-sm text-right){ - Label(LangRes(@1node_founder_key_id)) - Span(Class: text-danger, Body:*) - } - Div(col-md-9 text-left){ - Input(Name: KeyId,Type: number, Value: #key_id#) - } - } - Div(row mt-sm){ - Div(col-md-3 mt-sm text-right){ - Label(LangRes(@1node_pub_key)) - Span(Class: text-danger, Body:*) - } - Div(col-md-9 text-left){ - Input(Name: PubKey, Type: textarea) - } - } - Div(row mt-sm){ - Div(col-md-3 mt-sm text-right){ - Label(LangRes(@1hardware_description)) - } - Div(col-md-9 text-left){ - Input(Name: Description, Type: textarea) - } - } - Div(row mt-sm){ - Div(col-md-3 mt-sm text-right){ - Label(LangRes(@1comment)) - } - Div(col-md-9 text-left){ - Input(Name: Comment, Type: textarea) - } - } - - Button(Contract: @1ValidatorRequest, Class: btn btn-primary pull-right mt, Page: @1validator_candidates_list, Body: $@1send_request$) - Button(Body: LangRes(@1back), Class: btn btn-default pull-right mt, Page: @1validator_candidates_list) -} \ No newline at end of file diff --git a/src/basic/pages/validator_resign.ptl b/src/basic/pages/validator_resign.ptl deleted file mode 100644 index 7c65a0143..000000000 --- a/src/basic/pages/validator_resign.ptl +++ /dev/null @@ -1,14 +0,0 @@ -Form(){ - Div(row){ - Div(col-sm-12 text-center h4){ - $@1validator_removing_desc$ - } - } - DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "System"}).Vars("system_app") - SetVar(role_validator, AppParam(App: #system_app_id#, Name: "role_validator")) - DBFind(@1roles_participants).Where({"ecosystem": #ecosystem_id#, "member->member_id": #key_id#, "role->id": #role_validator#, "deleted": 0}).Columns("id").Vars(validator) - If(#validator_id# > 0){ - Button(Body: $@1resign$, Class: btn btn-danger pull-right mt-lg, Page: @1sysparams_list, Contract: @1ValidatorResign).Alert(Text: "$@1want_resign$", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question) - } - Button(Body: $@1back$, Class: btn btn-default pull-right mt-lg, Page: @1sysparams_list) -} \ No newline at end of file diff --git a/src/basic/pages/voting_create.ptl b/src/basic/pages/voting_create.ptl index d3a51c917..87b7ba707 100644 --- a/src/basic/pages/voting_create.ptl +++ b/src/basic/pages/voting_create.ptl @@ -1,4 +1,4 @@ -DBFind(@1applications).Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) +DBFind("@1applications").Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) SetVar(this_page, "@1voting_create") Form(){ diff --git a/src/basic/pages/voting_decision_candidates.ptl b/src/basic/pages/voting_decision_candidates.ptl index 69fc0d168..389adcb74 100644 --- a/src/basic/pages/voting_decision_candidates.ptl +++ b/src/basic/pages/voting_decision_candidates.ptl @@ -1,5 +1,5 @@ If(#vID# == ""){ - DBFind(@1buffer_data).Columns("value->voting_id").Where({"key": "voting", "member_id": #key_id#, "ecosystem": #ecosystem_id#}).Vars(buffer) + DBFind("@1buffer_data").Columns("value->voting_id").Where({"key": "voting", "account": "#account_id#", "ecosystem": "#ecosystem_id#"}).Vars(buffer) If(#buffer_value_voting_id#>0){ SetVar(vID, #buffer_value_voting_id#) SetVar(toPageInvite, 1) @@ -9,12 +9,12 @@ If(#vID# > 0){ If(#back_page#){}.Else{ SetVar(back_page,@1voting_view) } - DBFind(@1votings).WhereId(#vID#).Columns("id,voting->name,optional->role_id,optional->role_vacancies,optional->contract_accept,optional->contract_reject,optional->contract_accept_params,optional->contract_reject_params").Vars(instance) - DBFind(@1votings_subject).Where({"voting_id": #vID#, "subject->member_id": #key_id#}).Columns("id").Vars(already_candidate) - DBFind(@1roles,src_roles).Where({"ecosystem": #ecosystem_id#, "role_type": 2, "deleted": 0}).Columns("id,role_name").Count(elective_roles_count) + DBFind("@1votings").WhereId(#vID#).Columns("id,voting->name,optional->role_id,optional->role_vacancies,optional->contract_accept,optional->contract_reject,optional->contract_accept_params,optional->contract_reject_params").Vars(instance) + DBFind("@1votings_subject").Where({"voting_id": "#vID#", "subject->account": "#account_id#"}).Columns("id").Vars(already_candidate) + DBFind("@1roles", src_roles).Where({"ecosystem": "#ecosystem_id#", "role_type": 2, "deleted": 0}).Columns("id,role_name").Count(elective_roles_count) If(#elective_roles_count#>0){ Form(){ - Input(Name: MemberId, Type: hidden, Value: 0) + Input(Name: MemberAccount, Type: hidden, Value: 0) Input(Name: VotingId, Type: hidden, Value: #vID#) If(#already_candidate_id#>0){ @@ -44,10 +44,10 @@ If(#vID# > 0){ } } } - DBFind(@1votings_subject,src_voting_subject).Where({"voting_id": #vID#}).Columns("id,subject->member_id,subject->member_name").Count(members_count).Custom(_address){ - Address(#subject.member_id#) + DBFind("@1votings_subject",src_voting_subject).Where({"voting_id": "#vID#"}).Columns("id,subject->account,subject->member_name").Count(members_count).Custom(_address){ + #subject.account# }.Custom(_member){ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#subject.member_id#"){ + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#subject.account#"){ Span(Body: #subject.member_name#) } } diff --git a/src/basic/pages/voting_decision_contract.ptl b/src/basic/pages/voting_decision_contract.ptl index faa48edea..ca625d819 100644 --- a/src/basic/pages/voting_decision_contract.ptl +++ b/src/basic/pages/voting_decision_contract.ptl @@ -1,5 +1,5 @@ If(#vID# == ""){ - DBFind(@1buffer_data).Columns("value->voting_id").Where({"key": "voting", "member_id": #key_id#, "ecosystem": #ecosystem_id#}).Vars(buffer) + DBFind("@1buffer_data").Columns("value->voting_id").Where({"key": "voting", "account": "#account_id#", "ecosystem": "#ecosystem_id#"}).Vars(buffer) If(#buffer_value_voting_id#>0){ SetVar(vID, #buffer_value_voting_id#) SetVar(toPageInvite, 1) @@ -10,8 +10,8 @@ If(#vID# > 0){ SetVar(back_page,@1voting_view) } - DBFind(@1votings, src_voting).WhereId(#vID#).Columns("id,voting->name").Vars(instance) - DBFind(@1votings_subject, src_subject).Where({"voting_id": #vID#}).Columns("id,subject->contract_accept,subject->contract_reject,subject->contract_accept_params,subject->contract_reject_params").Vars(prefix) + DBFind("@1votings", src_voting).WhereId(#vID#).Columns("id,voting->name").Vars(instance) + DBFind("@1votings_subject", src_subject).Where({"voting_id": "#vID#"}).Columns("id,subject->contract_accept,subject->contract_reject,subject->contract_accept_params,subject->contract_reject_params").Vars(prefix) If(#prefix_id#>0){ }.Else{ diff --git a/src/basic/pages/voting_decision_document.ptl b/src/basic/pages/voting_decision_document.ptl index 8fb0ab4e5..575abeea0 100644 --- a/src/basic/pages/voting_decision_document.ptl +++ b/src/basic/pages/voting_decision_document.ptl @@ -1,5 +1,5 @@ If(#vID# == ""){ - DBFind(@1buffer_data).Columns("value->voting_id").Where({"key": "voting", "member_id": #key_id#, "ecosystem": #ecosystem_id#}).Vars(buffer) + DBFind("@1buffer_data").Columns("value->voting_id").Where({"key": "voting", "account": "#account_id#", "ecosystem": "#ecosystem_id#"}).Vars(buffer) If(#buffer_value_voting_id#>0){ SetVar(vID, #buffer_value_voting_id#) SetVar(toPageInvite, 1) @@ -10,8 +10,8 @@ If(#vID# > 0){ SetVar(back_page,@1voting_view) } - DBFind(@1votings, src_voting).WhereId(#vID#).Columns("id,voting->name,optional->contract_accept,optional->contract_reject,optional->contract_accept_params,optional->contract_reject_params").Vars(instance) - DBFind(@1votings_subject, src_voting_subject).Where({"voting_id": #vID#}).Columns("id,subject->text").Vars(prefix) + DBFind("@1votings", src_voting).WhereId(#vID#).Columns("id,voting->name,optional->contract_accept,optional->contract_reject,optional->contract_accept_params,optional->contract_reject_params").Vars(instance) + DBFind("@1votings_subject", src_voting_subject).Where({"voting_id": "#vID#"}).Columns("id,subject->text").Vars(prefix) If(#prefix_id#>0){ }.Else{ diff --git a/src/basic/pages/voting_decision_election.ptl b/src/basic/pages/voting_decision_election.ptl index cd8e5270e..ad46b771c 100644 --- a/src/basic/pages/voting_decision_election.ptl +++ b/src/basic/pages/voting_decision_election.ptl @@ -1,5 +1,5 @@ If(#vID# == ""){ - DBFind(@1buffer_data).Columns("value->voting_id").Where({"key": "voting", "member_id": #key_id#, "ecosystem": #ecosystem_id#}).Vars(buffer) + DBFind("@1buffer_data").Columns("value->voting_id").Where({"key": "voting", "account": "#account_id#", "ecosystem": "#ecosystem_id#"}).Vars(buffer) If(#buffer_value_voting_id#>0){ SetVar(vID, #buffer_value_voting_id#) } @@ -11,18 +11,18 @@ If(#vID# > 0){ If(#back_page#){}.Else{ SetVar(back_page,@1voting_view) } - DBFind(@1votings, src_voting).WhereId(#vID#).Columns("id,voting->name,optional->role_id,optional->role_vacancies,optional->contract_accept,optional->contract_reject,optional->contract_accept_params,optional->contract_reject_params").Vars(instance) - DBFind(@1votings_subject, src_subject).Where({"voting_id": #vID#}).Columns("id,subject->member_id,subject->member_name").Custom(_address){ - SetVar(candidates,"#candidates#,#subject.member_id#") - Address(#subject.member_id#) + DBFind("@1votings", src_voting).WhereId(#vID#).Columns("id,voting->name,optional->role_id,optional->role_vacancies,optional->contract_accept,optional->contract_reject,optional->contract_accept_params,optional->contract_reject_params").Vars(instance) + DBFind("@1votings_subject", src_subject).Where({"voting_id": "#vID#"}).Columns("id,subject->account,subject->member_name").Custom(_address){ + SetVar(candidates,"#candidates#,#subject.account#") + #subject.account# }.Custom(_member){ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#subject.member_id#"){ + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#subject.account#"){ Span(Body: #subject.member_name#) } } - DBFind(@1roles,src_roles).Where({"ecosystem": #ecosystem_id#, "role_type": 2, "deleted": 0}).Columns("id,role_name").Count(elective_roles_count) - If(#elective_roles_count#>0){ + DBFind("@1roles", src_roles).Where({"ecosystem": "#ecosystem_id#", "role_type": 2, "deleted": 0}).Columns("id,role_name").Count(elective_roles_count) + If(#elective_roles_count# > 0){ Form(){ Input(Name: VotingId, Type: hidden, Value: #vID#) Div(form-group){ @@ -34,16 +34,19 @@ If(#vID# > 0){ } Div(col-md-9 mc-sm text-left){ Div(input-group){ - If(#MemberId#!=""){ - SetVar(AddressMemberId, Address(#MemberId#)) + If(#MemberAccount#){ + Input(Name: m_name, Disabled: 1, Placeholder: "xxxx-xxxx-xxxx-xxxx-xxxx", Value: #MemberAccount#) + }.Else{ + Input(Name: m_name, Disabled: 1, Placeholder: "xxxx-xxxx-xxxx-xxxx-xxxx") } - Input(Name: m_name, Disabled: 1, Placeholder: "xxxx-xxxx-xxxx-xxxx-xxxx", Value: #AddressMemberId#) Div(input-group-btn){ - Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:"back_page=@1voting_decision_election,back_header=$@1voting_subject$,EcosystemId=#ecosystem_id#,Id=#vID#").Popup(Header: $@1member$, Width: "50") - If(#MemberId#!=""){ - Button(Class: btn bg-gray-lighter fa fa-plus buttons, Page: @1voting_decision_election, PageParams: "vID=#vID#,back_page=#back_page#", Contract: @1VotingSubjectCandidates, Params:"MemberId=#MemberId#").Popup(50, $@1subject_voting$) + Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams: "back_page=@1voting_decision_election,back_header=$@1voting_subject$,EcosystemId=#ecosystem_id#,Id=#vID#").Popup(Header: $@1member$, Width: "50") + If(#MemberAccount#){ + Button(Class: btn bg-gray-lighter fa fa-plus buttons, Page: @1voting_decision_election, PageParams: "vID=#vID#,back_page=#back_page#", Contract: @1VotingSubjectCandidates, Params: "MemberAccount=#MemberAccount#").Popup(50, $@1subject_voting$) } - } + }.Style( + .buttons{border: 1px solid #dde6e9;} + ) } } } diff --git a/src/basic/pages/voting_invite.ptl b/src/basic/pages/voting_invite.ptl index 2eaa8d708..97a4e5608 100644 --- a/src/basic/pages/voting_invite.ptl +++ b/src/basic/pages/voting_invite.ptl @@ -10,16 +10,16 @@ If(#vID# > 0){ If(#back_page#==""){ SetVar(back_page,@1voting_view) } - DBFind(@1votings).WhereId(#vID#).Columns("id,voting->name,voting->type_participants").Vars(instance) - DBFind(@1votings_participants, src_participants).Where({"voting_id": #vID#}).Columns("id,member->member_id,member->member_name,member->role_id,member->member->member_id,member->member->member_name").Count(participants_count).Custom(_id){ - Address(#member.member_id#) + DBFind("@1votings").WhereId(#vID#).Columns("id,voting->name,voting->type_participants").Vars(instance) + DBFind("@1votings_participants", src_participants).Where({"voting_id": "#vID#"}).Columns("id,member->account,member->member_name,member->role_id").Count(participants_count).Custom(_id){ + #member.account# }.Custom(_name){ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#member.member_id#", Body: #member.member_name#) + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#member.account#", Body: #member.member_name#) }.Custom(_sent){ $@1voting_role_added$ }.Custom(_member_roles){ SetVar(rl_id,0) - DBFind(@1roles).Columns("id,role_name,image_id").WhereId(#member.role_id#).Vars(rl) + DBFind("@1roles").Columns("id,role_name,image_id").WhereId(#member.role_id#).Vars(rl) LinkPage(Class: text-primary h5 text-bold, Page: @1roles_view, PageParams: "v_role_id=#rl_id#"){ If(#rl_image_id#>0){ Image(Src: Binary().ById(#rl_image_id#), Class: mr-sm).Style(width: 30px; border: 1px solid #5A5D63;) @@ -53,17 +53,15 @@ If(#vID# > 0){ } } Div(col-md-9 text-left){ - If(#MemberId# == ""){ - SetVar(MemberId, 0) - }.Else{ - Input(Name: VarId, Type: hidden, Value: #MemberId#) - } Div(input-group){ - If(Or(#MemberId#>0,#MemberId#<0)){ - SetVar(AddressMemberId, Address(#MemberId#)) - SetVar(Id, #MemberId#) - } - Input(Name: m_name, Disabled: 1, Placeholder: "xxxx-xxxx-xxxx-xxxx-xxxx", Value: #AddressMemberId#) + If(#MemberAccount#){ + SetVar(Id, #MemberAccount#) + Input(Name: VarId, Type: hidden, Value: #MemberAccount#) + Input(Name: m_name, Disabled: 1, Placeholder: "xxxx-xxxx-xxxx-xxxx-xxxx", Value: #MemberAccount#) + }.Else{ + Input(Name: VarId, Type: hidden, Value: 0) + Input(Name: m_name, Disabled: 1, Placeholder: "xxxx-xxxx-xxxx-xxxx-xxxx") + } Div(input-group-btn){ Button(Class: btn bg-gray-lighter fa fa-caret-down buttons, Page: @1select_wallet, PageParams:"back_page=@1voting_invite,back_header=$@1participants_add$,EcosystemId=#ecosystem_id#,Id=#vID#").Popup(Header: $@1member$, Width: "50") } @@ -82,14 +80,14 @@ If(#vID# > 0){ Div(col-md-9 text-left){ If(RoleId == ""){ SetVar(RoleId, 0) - SetVar(RoleName, "") + SetVar(RoleName,) }.Else{ Input(Name: VarId, Type: hidden, Value: #RoleId#) } Div(input-group){ If(#RoleId#>0){ SetVar(Id, #RoleId#) - DBFind(@1roles).WhereId(#RoleId#).Columns("role_name").Vars(r) + DBFind("@1roles").WhereId(#RoleId#).Columns("role_name").Vars(r) } Input(Name: m_name, Disabled: 1, Value: #r_role_name#) Div(input-group-btn){ @@ -110,14 +108,14 @@ If(#vID# > 0){ Div(col-md-9 text-left){ If(GroupId == ""){ SetVar(GroupId, 0) - SetVar(GroupName, "") + SetVar(GroupName,) }.Else{ Input(Name: VarId, Type: hidden, Value: #GroupId#) } Div(input-group){ - If(#GroupId#>0){ + If(#GroupId# > 0){ SetVar(Id, #GroupId#) - DBFind(@1groups).WhereId(#GroupId#).Columns("group_name").Vars(g) + DBFind("@1groups").WhereId(#GroupId#).Columns("group_name").Vars(g) } Input(Name: m_name, Disabled: 1, Value: #g_group_name#) Div(input-group-btn){ @@ -129,7 +127,7 @@ If(#vID# > 0){ } Div(text-right){ Button(Body: $@1back$, Class: btn btn-default, Page: #back_page#, PageParams: "vID=#vID#") - If(Or(#AddressMemberId#!="",#RoleId#!="",#GroupId#!="")){ + If(Or(#MemberAccount# != "", #RoleId# != "", #GroupId# != "")){ Button(Body: $@1send$, Class: btn btn-primary, Page: @1voting_invite, PageParams: "vID=#vID#,back_page=#back_page#", Contract: @1VotingInvite).Popup(50, $@1participants_add$) } } diff --git a/src/basic/pages/voting_list.ptl b/src/basic/pages/voting_list.ptl index 749964258..5fb6278c9 100644 --- a/src/basic/pages/voting_list.ptl +++ b/src/basic/pages/voting_list.ptl @@ -3,10 +3,9 @@ Include(@1pager_header) SetTitle("$@1voting_list$") Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$@1votings_list_desc$")) -AddToolButton(Title: $@1voting_wizard$, Page: @1voting_wizard, Icon: icon-magic-wand).Popup(50, $@1voting_wizard$) AddToolButton(Title: $@1templates_list$, Page: @1voting_templates_list, Icon: icon-pin) AddToolButton(Title: $@1create$, Page: @1voting_create, Icon: icon-plus).Popup(60, $@1new_voting$) -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "System"}).Vars("system_app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(system_app) SetVar(role_admin, AppParam(App: #system_app_id#, Name: "role_admin")) If(#role_id# == #role_admin#){ Div(btn-group ml-lg){ @@ -15,9 +14,9 @@ If(#role_id# == #role_admin#){ } If(#search#){ - SetVar(where, {"ecosystem": #ecosystem_id#, "deleted": 0, "voting->type": {"$in":[1,2]}, "voting->name": {"$ilike": "#search#"}}) + SetVar(where, {"ecosystem": "#ecosystem_id#", "deleted": 0, "voting->type": {"$in": [1, 2]}, "voting->name": {"$ilike": "#search#"}}) }.Else{ - SetVar(where, {"ecosystem": #ecosystem_id#, "deleted": 0, "voting->type": {"$in":[1,2]}}) + SetVar(where, {"ecosystem": "#ecosystem_id#", "deleted": 0, "voting->type": {"$in": [1, 2]}}) } Div(list-group-item ml-lg mr-lg pt-lg){ @@ -26,9 +25,9 @@ Div(list-group-item ml-lg mr-lg pt-lg){ } SetVar(INVALID,1).(WAITING,2).(STARTED,3).(FINISHED,4) -DBFind(@1applications).Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) +DBFind("@1applications").Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) -DBFind(#this_table#, src).Where(#where#).Order({"id": -1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("id,voting->name,voting->type,voting->type_decision,voting->type_participants,flags->success,flags->decision,flags->full_data,progress->percent_success,progress->number_participants,creator->member_id,creator->member_name,date_started,date_ended,deleted,status,voting->count_type_voters,voting->volume,progress->number_voters").Count(count_votings).Custom(_id){ +DBFind(#this_table#, src).Where(#where#).Order({"id": "-1"}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("id,voting->name,voting->type,voting->type_decision,voting->type_participants,flags->success,flags->decision,flags->full_data,progress->percent_success,progress->number_participants,creator->account,creator->member_name,date_started,date_ended,deleted,status,voting->count_type_voters,voting->volume,progress->number_voters").Count(count_votings).Custom(_id){ Span(Class: h5, Body: #id#) }.Custom(_name){ LinkPage(Page: @1voting_view, PageParams: "vID=#id#"){ @@ -74,7 +73,7 @@ DBFind(#this_table#, src).Where(#where#).Order({"id": -1}).Limit(#pager_limit#). } } }.Custom(_creator){ - LinkPage(Class: text-primary h6, Page: @1profile_view, PageParams: "v_key_id=#creator.member_id#", Body: #creator.member_name#) + LinkPage(Class: text-primary h6, Page: @1profile_view, PageParams: "v_account=#creator.account#", Body: #creator.member_name#) }.Custom(_date){ P(Class: text-center h6 m0, Body: DateTime(DateTime: #date_started#, Format: "DD.MM.YYYY HH:MI")) P(Class: text-center h6 m0, Body: DateTime(DateTime: #date_ended#, Format: "DD.MM.YYYY HH:MI")) @@ -94,7 +93,7 @@ DBFind(#this_table#, src).Where(#where#).Order({"id": -1}).Limit(#pager_limit#). }.Custom(_decision){ Div(text-center){ If(#flags.decision# == 0){ - If(And(#status#==#FINISHED#,#creator.member_id#==#key_id#)){ + If(And(#status# = =#FINISHED#, #creator.account# == #account_id#)){ Button(Body: LangRes(@1decision), Class: btn btn-primary, Contract: @1VotingDecisionCheck, Params: "VotingId=#id#", Page: #this_page#) }.Else{ Div(text-muted){LangRes(@1no)} @@ -122,7 +121,7 @@ DBFind(#this_table#, src).Where(#where#).Order({"id": -1}).Limit(#pager_limit#). } }.Custom(_actions){ Div(text-right){ - If(And(#creator.member_id#==#key_id#,#status#==#INVALID#)){ + If(And(#creator.account# == #account_id#, #status# == #INVALID#)){ Button(Class: fa fa-trash btn btn-default, Contract: @1VotingDelete, Params: "VotingId=#id#", Page: #this_page#).Alert(Text: "$@1want_delete_voting$", ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question) } } diff --git a/src/basic/pages/voting_template_create.ptl b/src/basic/pages/voting_template_create.ptl index 480d2410e..4fcd57215 100644 --- a/src/basic/pages/voting_template_create.ptl +++ b/src/basic/pages/voting_template_create.ptl @@ -1,9 +1,9 @@ SetVar(this_page, @1voting_template_create) -DBFind(@1applications).Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) +DBFind("@1applications").Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) SetVar(name, "New voting").(typevoting, 0).(volume, 50).(quorum, 51).(vacancies, 1) If(#TemplateId#>0){ - DBFind(@1voting_templates).Where({"id": #TemplateId#, "ecosystem": #ecosystem_id#}).Columns("voting->count_type_voters,voting->name,voting->volume,voting->quorum,voting->type_decision,voting->type_participants,voting->type,voting->rating,subject->candidates,subject->vacancies,subject->voters,subject->contract_accept,subject->contract_reject,optional->contract_accept,optional->contract_reject,optional->init_contract,optional->contract_accept_params,optional->contract_reject_params,optional->init_contract_params").Vars(template) + DBFind("@1voting_templates").Where({"id": "#TemplateId#", "ecosystem": "#ecosystem_id#"}).Columns("voting->count_type_voters,voting->name,voting->volume,voting->quorum,voting->type_decision,voting->type_participants,voting->type,voting->rating,subject->candidates,subject->vacancies,subject->voters,subject->contract_accept,subject->contract_reject,optional->contract_accept,optional->contract_reject,optional->init_contract,optional->contract_accept_params,optional->contract_reject_params,optional->init_contract_params").Vars(template) If(#CountTypeVoters# == ""){ SetVar(CountTypeVoters, #template_voting_count_type_voters#) @@ -88,7 +88,7 @@ Form(){ } } Div(col-md-9 text-left){ - DBFind(@1roles, src_roles1).Where({"ecosystem": #ecosystem_id#, "deleted": 0}).Order(id).Custom(name){ + DBFind("@1roles", src_roles1).Where({"ecosystem": "#ecosystem_id#", "deleted": 0}).Order("id").Custom(name){ #role_name# } Select(Name: Voters, Source: src_roles1, NameColumn: name, ValueColumn: id, Value: #voters#) @@ -186,7 +186,7 @@ Form(){ } } Div(col-md-9 text-left){ - DBFind(@1roles,src_roles2).Where({"role_type": 2, "ecosystem": #ecosystem_id#, "deleted": 0}).Order(id).Custom(name){ + DBFind("@1roles", src_roles2).Where({"role_type": 2, "ecosystem": "#ecosystem_id#", "deleted": 0}).Order("id").Custom(name){ #role_name# } Select(Name: Candidates, Source: src_roles2, NameColumn: name, ValueColumn: id, Value: #candidates#) diff --git a/src/basic/pages/voting_template_view.ptl b/src/basic/pages/voting_template_view.ptl index 8bd52552b..78e3d6362 100644 --- a/src/basic/pages/voting_template_view.ptl +++ b/src/basic/pages/voting_template_view.ptl @@ -1,12 +1,12 @@ -DBFind(@1applications).Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) +DBFind("@1applications").Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) If(#TemplateId#>0){ - DBFind(@1voting_templates).Where({"id": #TemplateId#, "ecosystem": #ecosystem_id#}).Columns("voting->count_type_voters,voting->name,voting->volume,voting->quorum,voting->type_decision,voting->type_participants,voting->type,voting->rating,subject->candidates,subject->vacancies,subject->voters,subject->contract_accept,subject->contract_reject,optional->contract_accept,optional->contract_reject,optional->init_contract,optional->contract_accept_params,optional->contract_reject_params,optional->init_contract_params").Vars(template) + DBFind("@1voting_templates").Where({"id": "#TemplateId#", "ecosystem": "#ecosystem_id#"}).Columns("voting->count_type_voters,voting->name,voting->volume,voting->quorum,voting->type_decision,voting->type_participants,voting->type,voting->rating,subject->candidates,subject->vacancies,subject->voters,subject->contract_accept,subject->contract_reject,optional->contract_accept,optional->contract_reject,optional->init_contract,optional->contract_accept_params,optional->contract_reject_params,optional->init_contract_params").Vars(template) If(#template_subject_voters#>0){ - DBFind(@1roles).Where({"ecosystem": #ecosystem_id#, "id": #template_subject_voters#}).Columns("role_name").Vars(vid) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#template_subject_voters#"}).Columns("role_name").Vars(vid) SetVar(v_role, "#vid_role_name#") } If(#template_subject_candidates#>0){ - DBFind(@1roles).Where({"ecosystem": #ecosystem_id#, "id": #template_subject_candidates#}).Columns("role_name").Vars(cid) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#template_subject_candidates#"}).Columns("role_name").Vars(cid) SetVar(c_role, "#cid_role_name#") } } diff --git a/src/basic/pages/voting_templates_list.ptl b/src/basic/pages/voting_templates_list.ptl index 2cbc4df2d..95cea8afc 100644 --- a/src/basic/pages/voting_templates_list.ptl +++ b/src/basic/pages/voting_templates_list.ptl @@ -11,17 +11,20 @@ Span(Class: h5 m0 mb ml-lg){ ) If(#search#){ - SetVar(w_search, {"voting->name": {"$ilike": "#search#"}}) + SetVar(where, {"ecosystem": "#ecosystem_id#", "voting->type": {"$in": [1, 2]}, "voting->name": {"$ilike": "#search#"}}) +}.Else{ + SetVar(where, {"ecosystem": "#ecosystem_id#", "voting->type": {"$in": [1, 2]}}) } -SetVar(where, {"ecosystem": #ecosystem_id#, "voting->type": {"$in": [1,2]}, {#w_search#}}) Div(list-group-item ml-lg mr-lg pt-lg){ SetVar(search_name, LangRes(@1template)) Include(@1search) } -DBFind(@1applications).Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) +DBFind("@1applications").Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) +SetVar(all_templates_count, 0) +DBFind(#this_table#).Where({"ecosystem": "#ecosystem_id#"}).Count(all_templates_count) DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Columns("voting->name,voting->type_participants,voting->type_decision,voting->type").Custom(_participants){ P(Class: m0 h6, Body: AppParam(Ecosystem:1, App:#application_id#, Name:type_voting_participants, Index: #voting.type_participants#)) }.Custom(_decision){ @@ -41,7 +44,7 @@ Div(fullscreen){ Div(list-group-item){ If(#count# > 0){ Table(src, "$@1template$=_name,$@1participants$=_participants,$@1decision$=_decision,$@1voting_type$=_type") - }.ElseIf(#ecosystem_id#==1){ + }.ElseIf(And(#ecosystem_id# == 1, #all_templates_count# == 0)){ Form(Class: text-center h6){ Data(autofill, "value,description"){ yes,$@1use_default_voting_templates$ diff --git a/src/basic/pages/voting_view.ptl b/src/basic/pages/voting_view.ptl index 4d9125c21..c3b088b31 100644 --- a/src/basic/pages/voting_view.ptl +++ b/src/basic/pages/voting_view.ptl @@ -1,6 +1,6 @@ -DBFind(@1applications).Columns("name,id").Where({"ecosystem": 1, "name": "Basic"}).Vars(application) +DBFind("@1applications").Columns("name,id").Where({"ecosystem": 1, "name": "Basic"}).Vars(application) If(#notific_id#>0){ - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "id": #notific_id#}).Columns("page_params->voting_id").Vars(notific) + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "id": "#notific_id#"}).Columns("page_params->voting_id").Vars(notific) SetVar(vID,#notific_page_params_voting_id#) } @@ -10,16 +10,16 @@ SetVar(this_page,"@1voting_view") Div(content-wrapper){ If(#vID# > 0){ - DBFind(@1votings).WhereId(#vID#).Columns("id,voting->rating,voting->name,voting->volume,voting->quorum,voting->type_participants,voting->type,voting->count_type_voters,voting->type_decision,voting->description,optional->role_id,optional->role_vacancies,optional->number_candidates,optional->contract_accept,optional->contract_reject,optional->contract_accept_params,optional->contract_reject_params,progress->number_participants,progress->number_voters,progress->percent_success,progress->percent_voters,flags->success,flags->full_data,flags->decision,flags->notifics,date_started,date_ended,status,creator->member_id").Vars(instance) + DBFind("@1votings").WhereId(#vID#).Columns("id,voting->rating,voting->name,voting->volume,voting->quorum,voting->type_participants,voting->type,voting->count_type_voters,voting->type_decision,voting->description,optional->role_id,optional->role_vacancies,optional->number_candidates,optional->contract_accept,optional->contract_reject,optional->contract_accept_params,optional->contract_reject_params,progress->number_participants,progress->number_voters,progress->percent_success,progress->percent_voters,flags->success,flags->full_data,flags->decision,flags->notifics,date_started,date_ended,status,creator->account").Vars(instance) SetVar(type_decision,#instance_voting_type_decision#) SetVar(type_participants,#instance_voting_type_participants#) SetVar(isVotingAllowed,0) SetVar(isStartProcessing,0) If(Or(#type_participants#==1,#type_participants#==2,#type_participants#==3,#type_participants#==4,#type_participants#==6)){ - DBFind(@1votings_participants).Where({"voting_id": #vID#, "member->member_id": #key_id#, "decision": 0, "ecosystem": #ecosystem_id#}).Columns("id").Vars(flag_participant) + DBFind("@1votings_participants").Where({"voting_id": "#vID#", "member->account": "#account_id#", "decision": 0, "ecosystem": "#ecosystem_id#"}).Columns("id").Vars(flag_participant) If(And(#instance_status#==#STARTED#,#flag_participant_id#>0)){ - DBFind(@1notifications).Where({"ecosystem": #ecosystem_id#, "recipient->member_id": #key_id#, "page_name": #this_page#, "page_params->voting_id": #vID#, "closed": 0}).Columns("id,notification->type,date_start_processing").Vars(notificcc) + DBFind("@1notifications").Where({"ecosystem": "#ecosystem_id#", "recipient->account": "#account_id#", "page_name": "#this_page#", "page_params->voting_id": "#vID#", "closed": 0}).Columns("id,notification->type,date_start_processing").Vars(notificcc) If(#notificcc_id#>0){ SetVar(isVotingAllowed,1) SetVar(notific_id,#notificcc_id#) @@ -27,7 +27,7 @@ Div(content-wrapper){ SetVar(isStartProcessing,1) } }.Else{ - DBFind(@1votings_participants).Where({"ecosystem": #ecosystem_id#, "member->member_id": #key_id#, "voting_id": #vID#}).Columns("id,decision_date").Vars(md) + DBFind("@1votings_participants").Where({"ecosystem": "#ecosystem_id#", "member->account": "#account_id#", "voting_id": "#vID#"}).Columns("id,decision_date").Vars(md) If(And(#md_id#>0, #md_decision_date#==0)){ SetVar(isVotingAllowed,1) } @@ -35,9 +35,9 @@ Div(content-wrapper){ } } If(#type_participants#==5){ - DBFind(@1votings_participants).Where({"voting_id": #vID#, "member->role_id": #role_id#, "decision": 0, "ecosystem": #ecosystem_id#}).Columns("id").Vars(flag_participant) + DBFind("@1votings_participants").Where({"voting_id": "#vID#", "member->role_id": "#role_id#", "decision": 0, "ecosystem": "#ecosystem_id#"}).Columns("id").Vars(flag_participant) If(And(#instance_status#==#STARTED#,#flag_participant_id#>0)){ - DBFind(@1notifications).Where({{"$or":[{"date_start_processing": 0}, {"processing_info->member_id": #key_id#}]}, "ecosystem": #ecosystem_id#, "recipient->role_id": #role_id#, "page_name": #this_page#, "page_params->voting_id": #vID#, "closed": 0}).Columns("id,notification->type,date_start_processing").Vars(notificcc) + DBFind("@1notifications").Where({"$or": [{"date_start_processing": 0}, {"processing_info->account": "#account_id#"}], "ecosystem": "#ecosystem_id#", "recipient->role_id": "#role_id#", "page_name": "#this_page#", "page_params->voting_id": "#vID#", "closed": 0}).Columns("id,notification->type,date_start_processing").Vars(notificcc) If(#notificcc_id#>0){ SetVar(isVotingAllowed,1) SetVar(notific_id,#notificcc_id#) @@ -80,7 +80,7 @@ Div(content-wrapper){ } Div(col-md-6 text-left){ If(#instance_optional_role_id# > 0){ - DBFind(@1roles).Where({"ecosystem": #ecosystem_id#, "id": #instance_optional_role_id#}).Columns("id,role_name").Vars(prefix) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#", "id": "#instance_optional_role_id#"}).Columns("id,role_name").Vars(prefix) #prefix_role_name# (LangRes(@1id): #prefix_id#) }.Else{ Span(Class:text-danger, Body: LangRes(@1not_filled)) @@ -111,10 +111,10 @@ Div(content-wrapper){ } } } - DBFind(@1votings_subject, src_voting_subject).Where({"voting_id": #vID#}).Order("id").Columns("id,subject->member_id,subject->member_name").Custom(_address){ - Address(#subject.member_id#) + DBFind("@1votings_subject", src_voting_subject).Where({"voting_id": "#vID#"}).Order("id").Columns("id,subject->account,subject->member_name").Custom(_address){ + #subject.account# }.Custom(_member){ - LinkPage(Class: text-primary t6 text-bold, Page: @1profile_view, PageParams: "v_key_id=#subject.member_id#"){ + LinkPage(Class: text-primary t6 text-bold, Page: @1profile_view, PageParams: "v_account=#subject.account#"){ #subject.member_name# } }.Custom(_voting){ @@ -122,7 +122,7 @@ Div(content-wrapper){ Button(Body: LangRes(@1process), Class: btn btn-info text-capitalize, Contract: @1NotificationsProcess, Params: "NotificId=#notific_id#", Page: #this_page#, PageParams: "notific_id=#notific_id#") }.Else{ If(#isVotingAllowed#==1){ - Button(Body: LangRes(@1vote), Class: btn btn-success, Page: #this_page#, PageParams: "vID=#vID#", Contract: @1VotingCandidateAccept, Params: "CandidateId=#subject.member_id#,RoleId=#role_id#") + Button(Body: LangRes(@1vote), Class: btn btn-success, Page: #this_page#, PageParams: "vID=#vID#", Contract: @1VotingCandidateAccept, Params: "CandidateAccount=#subject.account#,RoleId=#role_id#") } } } @@ -135,23 +135,23 @@ Div(content-wrapper){ Div(col-md-12){ If(And(Or(#instance_status#==#INVALID#,#instance_status#==#WAITING#),#instance_voting_type#==1)){ If(#type_decision#==1){ - If(#instance_creator_member_id#==#key_id#){ + If(#instance_creator_account#==#account_id#){ Button(Class: btn btn-link, Page: @1voting_decision_candidates, PageParams: "vID=#vID#"){ Strong(LangRes(@1subject_voting_edit)) }.Popup(60, $@1subject_voting$) }.Else{ - DBFind(@1votings_subject).Where({"voting_id": #vID#, "subject->member_id": #key_id#}).Columns("id").Vars(already_candidate) + DBFind("@1votings_subject").Where({"voting_id": "#vID#", "subject->account": "#account_id#"}).Columns("id").Vars(already_candidate) If(#already_candidate_id#>0){ SetVar(hidden,hidden) }.Else{ SetVar(hidden,) } Div(#hidden#){ - Button(Body: $@1can_apply_voting$, Class: btn btn-link, Page: #this_page#, PageParams: "vID=#vID#", Contract: @1VotingSubjectCandidates, Params: "VotingId=#vID#,MemberId=#key_id#") + Button(Body: $@1can_apply_voting$, Class: btn btn-link, Page: #this_page#, PageParams: "vID=#vID#", Contract: @1VotingSubjectCandidates, Params: "VotingId=#vID#,MemberAccount=#account_id#") } } } - If(#instance_creator_member_id#==#key_id#){ + If(#instance_creator_account#==#account_id#){ If(#type_decision#==2){ Button(Class: btn btn-link, Page: @1voting_decision_election, PageParams: "vID=#vID#"){ Strong(LangRes(@1subject_voting_edit)) @@ -163,7 +163,7 @@ Div(content-wrapper){ } } If(#type_decision#==3){ - DBFind(@1votings_subject, src_voting_subject).Where({"voting_id": #vID#}).Columns("id,subject->text,subject->hash,results->percent_accepted").Vars(subject) + DBFind("@1votings_subject", src_voting_subject).Where({"voting_id": "#vID#"}).Columns("id,subject->text,subject->hash,results->percent_accepted").Vars(subject) Div(row t6 mt-lg){ Div(col-sm-8 col-sm-offset-2 col-lg-8 col-lg-offset-2){ Div(list-group-item){ @@ -185,7 +185,7 @@ Div(content-wrapper){ Div(row mt-sm t6){ Div(col-md-12){ If(And(Or(#instance_status#==#INVALID#,#instance_status#==#WAITING#),#instance_voting_type#==1)){ - If(#instance_creator_member_id#==#key_id#){ + If(#instance_creator_account#==#account_id#){ Button(Class: btn btn-link, Page: @1voting_decision_document, PageParams: "vID=#vID#"){ Strong(LangRes(@1subject_voting_edit)) }.Popup(60, $@1subject_voting$) @@ -207,7 +207,7 @@ Div(content-wrapper){ } } If(#type_decision#==4){ - DBFind(@1votings_subject, src_voting_subject).Where({"voting_id": #vID#}).Columns("id,subject->contract_accept,subject->contract_accept_params,subject->contract_reject,subject->contract_reject_params,results->percent_accepted").Vars(subject) + DBFind("@1votings_subject", src_voting_subject).Where({"voting_id": "#vID#"}).Columns("id,subject->contract_accept,subject->contract_accept_params,subject->contract_reject,subject->contract_reject_params,results->percent_accepted").Vars(subject) Div(row t6){ Div(col-md-6 text-right){ LangRes(@1contract_accept) @@ -263,7 +263,7 @@ Div(content-wrapper){ Div(row mt-sm t6){ Div(col-md-12){ If(And(Or(#instance_status#==#INVALID#,#instance_status#==#WAITING#),#instance_voting_type#==1)){ - If(#instance_creator_member_id#==#key_id#){ + If(#instance_creator_account#==#account_id#){ Button(Class: btn btn-link, Page: @1voting_decision_contract, PageParams: "vID=#vID#"){ Strong(LangRes(@1subject_voting_edit)) }.Popup(60, $@1subject_voting$) @@ -429,7 +429,7 @@ Div(content-wrapper){ } If(#instance_voting_type#==1){ If(Or(#instance_status#==#INVALID#,#instance_status#==#WAITING#)){ - If(#instance_creator_member_id#==#key_id#){ + If(#instance_creator_account#==#account_id#){ Button(Class: btn-xs btn-link text-bold ml, Page: @1voting_invite, PageParams: "vID=#vID#"){ LangRes(@1participants_add) }.Popup(60, $@1participants_add$) diff --git a/src/basic/pages/voting_wizard.ptl b/src/basic/pages/voting_wizard.ptl index c30bc73d7..1d26885f8 100644 --- a/src/basic/pages/voting_wizard.ptl +++ b/src/basic/pages/voting_wizard.ptl @@ -1,7 +1,7 @@ SetVar(this_page, "@1voting_wizard") SetVar(back_page, "@1voting_list") DBFind("@1applications").Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) -DBFind("@1buffer_data").Where({"key": "voting_wizard_buffer", "member_id": #key_id#, "ecosystem": #ecosystem_id#}).Columns("value->save_time,value->voting_name,value->voting_type,value->type_participants,value->type_decision,value->volume,value->quorum,value->rating,value->count_type_voters,value->description,value->interval,value->start_date,value->start_time,value->end_date,value->end_time,value->member_participants,value->role_participants,value->group_participants,value->execute_contract,value->contract_accept_name,value->contract_accept_params,value->contract_reject_name,value->contract_reject_params,value->text_document,value->candidates,value->apply,value->role_id,value->vacancies").Vars(buffer) +DBFind("@1buffer_data").Where({"key": "voting_wizard_buffer", "account": "#account_id#", "ecosystem": "#ecosystem_id#"}).Columns("value->save_time,value->voting_name,value->voting_type,value->type_participants,value->type_decision,value->volume,value->quorum,value->rating,value->count_type_voters,value->description,value->interval,value->start_date,value->start_time,value->end_date,value->end_time,value->member_participants,value->role_participants,value->group_participants,value->execute_contract,value->contract_accept_name,value->contract_accept_params,value->contract_reject_name,value->contract_reject_params,value->text_document,value->candidates,value->apply,value->role_id,value->vacancies").Vars(buffer) If(#stage# == ""){ If(#buffer_value_save_time# == ""){ @@ -75,7 +75,7 @@ Form(){ SetVar(apply, 1) } - DBFind(@1roles,src_roles).Where({"ecosystem": #ecosystem_id#, "role_type": 2, "deleted": 0}).Columns("id,role_name").Count(elective_roles_count) + DBFind("@1roles", src_roles).Where({"ecosystem": "#ecosystem_id#", "role_type": 2, "deleted": 0}).Columns("id,role_name").Count(elective_roles_count) If(#elective_roles_count# > 0){ Div(row mt-sm){ Div(col-md-3 mt-sm text-right){ @@ -101,16 +101,16 @@ Form(){ } } If(#apply# == 1){ - DBFind("@1members").Where({"ecosystem": #ecosystem_id#, "id": #key_id#}).Vars(my) + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#account_id#"}).Vars(my) If(#my_member_name# == ""){ - SetVar(my_member_name, Address(#key_id#)) + SetVar(my_member_name, #account_id#) } Data(src_voting_subject,"id,name"){ - #key_id#,#my_member_name# + #account_id#,#my_member_name# }.Custom(_address){ - Address(#id#) + #account# }.Custom(_member){ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#id#"){ + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#account#"){ Span(Body: #name#) } } @@ -188,26 +188,26 @@ Form(){ } } - DBFind(@1keys, src_subject).Where({"ecosystem": #ecosystem_id#, "id": {"$in": [#candidates#]}}).Custom(_address){ - Address(#id#) + DBFind("@1keys", src_subject).Where({"ecosystem": "#ecosystem_id#", "account": {"$in": [#candidates#]}, "deleted": 0}).Custom(_address){ + #account# }.Custom(_member){ - DBFind(@1members).WhereId(#id#).Count(have_name).Vars(participant) + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#account#"}).Count(have_name).Vars(participant) If(#have_name# > 0){ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#id#", Body: #participant_member_name#) + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#account#", Body: #participant_member_name#) }.Else{ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#id#", Body: Address(#id#)) + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#account#", Body: #account#) } } - DBFind(@1keys,src_keys).Where({"ecosystem": #ecosystem_id#, {"$and": [{"id": {"$neq": #guest_key#}}, {"id": {"$nin": [#candidates#]}}]}}).Columns("id").Count(members_count).Custom(_name){ - DBFind(@1members).Where({"ecosystem": #ecosystem_id#, "id": #id#}).Columns("id,member_name").Count(have_name).Vars(m) - Address(#id#) + DBFind("@1keys", src_accounts).Where({"ecosystem": "#ecosystem_id#", "$and": [{"account": {"$neq": "#guest_account#"}}, {"account": {"$nin": [#candidates#]}}], "deleted": 0}).Columns("account").Count(members_count).Custom(_name){ + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#account#"}).Columns("account,member_name").Count(have_name).Vars(m) + #account# If(#have_name# > 0){ " (#m_member_name#)" } } - DBFind(@1roles,src_roles).Where({"ecosystem": #ecosystem_id#, "role_type": 2, "deleted": 0}).Columns("id,role_name").Count(elective_roles_count) + DBFind("@1roles", src_roles).Where({"ecosystem": "#ecosystem_id#", "role_type": 2, "deleted": 0}).Columns("id,role_name").Count(elective_roles_count) If(#elective_roles_count# > 0){ Div(form-group){ Div(row){ @@ -219,13 +219,13 @@ Form(){ Div(col-md-9 mc-sm text-left){ Div(input-group){ If(#members_count# > 0){ - Select(Name: MemberId, Source: src_keys, NameColumn: _name, ValueColumn: id) + Select(Name: MemberAccount, Source: src_accounts, NameColumn: _name, ValueColumn: account) Div(input-group-btn){ - Button(Class: btn bg-gray-lighter fa fa-plus buttons, Page: #this_page#, PageParams: "stage=2,new_candidate=Val(MemberId),candidates=#candidates#,val_role_id=Val(RoleId),val_role_vacancies=Val(Vacancies),val_execute_contract=Val(ExecuteContract),val_contract_accept_name=Val(ContractAcceptName),val_contract_accept_params=Val(ContractAcceptParams),val_contract_reject_name=Val(ContractRejectName),val_contract_reject_params=Val(ContractRejectParams)").Popup(50, $@1voting_wizard$) + Button(Class: btn bg-gray-lighter fa fa-plus buttons, Page: #this_page#, PageParams: "stage=2,new_candidate=Val(MemberAccount),candidates=#candidates#,val_role_id=Val(RoleId),val_role_vacancies=Val(Vacancies),val_execute_contract=Val(ExecuteContract),val_contract_accept_name=Val(ContractAcceptName),val_contract_accept_params=Val(ContractAcceptParams),val_contract_reject_name=Val(ContractRejectName),val_contract_reject_params=Val(ContractRejectParams)").Popup(50, $@1voting_wizard$) Button(Class: btn bg-gray-lighter fa fa-undo buttons, Page: #this_page#, PageParams: "stage=2,candidates=0,val_role_id=Val(RoleId),val_role_vacancies=Val(Vacancies),val_execute_contract=Val(ExecuteContract),val_contract_accept_name=Val(ContractAcceptName),val_contract_accept_params=Val(ContractAcceptParams),val_contract_reject_name=Val(ContractRejectName),val_contract_reject_params=Val(ContractRejectParams)").Popup(50, $@1voting_wizard$) } }.Else{ - Input(Class: mb, Disabled: 1, Value: "$@1voting_all_keys_added$") + Input(Class: mb, Disabled: 1, Value: "$@1voting_all_members_added$") Div(input-group-btn input-group-top){ Button(Class: btn bg-gray-lighter fa fa-undo buttons, Page: #this_page#, PageParams: "stage=2,candidates=0,val_role_id=Val(RoleId),val_role_vacancies=Val(Vacancies),val_execute_contract=Val(ExecuteContract),val_contract_accept_name=Val(ContractAcceptName),val_contract_accept_params=Val(ContractAcceptParams),val_contract_reject_name=Val(ContractRejectName),val_contract_reject_params=Val(ContractRejectParams)").Popup(50, $@1voting_wizard$) } @@ -432,14 +432,14 @@ Form(){ SetVar(member_participants, "#member_participants#,#new_participant#") } } - DBFind(@1keys, src_participants).Where({"ecosystem": #ecosystem_id#, "id": {"$in": [#member_participants#]}}).Count(participants_count).Custom(_id){ - Address(#id#) + DBFind("@1keys", src_participants).Where({"ecosystem": "#ecosystem_id#", "account": {"$in": [#member_participants#]}, "deleted": 0}).Count(participants_count).Custom(_id){ + #account# }.Custom(_name){ - DBFind(@1members).WhereId(#id#).Count(have_name).Vars(participant) + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#account#"}).Count(have_name).Vars(participant) If(#have_name# > 0){ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#id#", Body: #participant_member_name#) + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#account#", Body: #participant_member_name#) }.Else{ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#id#", Body: Address(#id#)) + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#account#", Body: #account#) } } }.ElseIf(#buffer_value_type_participants# == 6){ @@ -451,14 +451,14 @@ Form(){ } } If(#group_participants# != 0){ - DBFind(@1groups_participants, src_participants).Where({"ecosystem": #ecosystem_id#, "groups_info->id": {"$in": [#group_participants#]}}).Columns("member->member_id,groups_info->id").Count(participants_count).Custom(_id){ - Address(#member.member_id#) + DBFind("@1groups_participants", src_participants).Where({"ecosystem": "#ecosystem_id#", "groups_info->id": {"$in": [#group_participants#]}}).Columns("member->account,groups_info->id").Count(participants_count).Custom(_id){ + #member.account# }.Custom(_name){ - DBFind(@1members).WhereId(#member.member_id#).Count(have_name).Vars(participant) + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#member.account#"}).Count(have_name).Vars(participant) If(#have_name# > 0){ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#id#", Body: #participant_member_name#) + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#account#", Body: #participant_member_name#) }.Else{ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#id#", Body: Address(#id#)) + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#account#", Body: #account#) } } } @@ -471,19 +471,19 @@ Form(){ } } If(And(Or(#buffer_value_type_participants# == 3, #buffer_value_type_participants# == 4), #role_participants# != 0)){ - DBFind(@1roles_participants, src_participants).Where({"ecosystem": #ecosystem_id#, "role->id": {"$in": [#role_participants#]}}).Columns("member->member_id,role->id").Count(participants_count).Custom(_id){ - Address(#member.member_id#) + DBFind("@1roles_participants", src_participants).Where({"ecosystem": "#ecosystem_id#", "role->id": {"$in": [#role_participants#]}}).Columns("member->account,role->id").Count(participants_count).Custom(_id){ + #member.account# }.Custom(_name){ - DBFind(@1members).WhereId(#member.member_id#).Count(have_name).Vars(participant) + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#member.account#"}).Count(have_name).Vars(participant) If(#have_name# > 0){ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#id#", Body: #participant_member_name#) + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#account#", Body: #participant_member_name#) }.Else{ - LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#id#", Body: Address(#id#)) + LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#account#", Body: #account#) } }.Custom(_sent){ $@1voting_role_added$ }.Custom(_member_roles){ - DBFind(@1roles).Columns("id,role_name,image_id").WhereId(#role.id#).Vars(rl) + DBFind("@1roles").Columns("id,role_name,image_id").WhereId(#role.id#).Vars(rl) LinkPage(Class: text-primary h5 text-bold, Page: @1roles_view, PageParams: "v_role_id=#rl_id#"){ If(#rl_image_id# > 0){ Image(Src: Binary().ById(#rl_image_id#), Class: mr-sm).Style(width: 30px; border: 1px solid #5A5D63;) @@ -496,7 +496,7 @@ Form(){ } } }.ElseIf(And(#buffer_value_type_participants# == 5, #role_participants# != 0)){ - DBFind(@1roles, src_participants).Columns("id,role_name,image_id").Where({"id": {"$in": [#role_participants#]}}).Count(participants_count).Custom(_sent){ + DBFind("@1roles", src_participants).Columns("id,role_name,image_id").Where({"id": {"$in": [#role_participants#]}}).Count(participants_count).Custom(_sent){ $@1voting_role_added$ }.Custom(_member_roles){ LinkPage(Class: text-primary h5 text-bold, Page: @1roles_view, PageParams: "v_role_id=#id#"){ @@ -527,29 +527,32 @@ Form(){ If(#buffer_value_type_participants# != 1){ Div(row){ If(#buffer_value_type_participants# == 2){ - DBFind(@1keys,src_keys).Where({"ecosystem": #ecosystem_id#, {"$and": [{"id": {"$neq": #guest_key#}}, {"id": {"$nin": [#member_participants#]}}]}}).Columns("id").Count(keys_count).Custom(_name){ + DBFind("@1keys", src_keys).Where({"ecosystem": "#ecosystem_id#", "$and": [{"account": {"$neq": "#guest_account#"}}, {"account": {"$nin": [#member_participants#]}}], "deleted": 0}).Columns("account").Count(keys_count).Custom(_name){ SetVar(m_member_name,) - DBFind(@1members).Where({"ecosystem": #ecosystem_id#, "id": #id#}).Columns("id,member_name").Count(have_name).Vars(m) - Address(#id#) + DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#account#"}).Columns("account,member_name").Count(have_name).Vars(m) + #account# If(#have_name# > 0){ " (#m_member_name#)" } } - SetVar(source, src_keys) + SetVar(source, "src_keys") + SetVar(value, "account") SetVar(select_label, $@1member$) SetVar(hint, $@1select_member$) }.ElseIf(#buffer_value_type_participants# == 6){ - DBFind(@1groups, src_groups).Where({"ecosystem": #ecosystem_id#, "deleted": 0, "id": {"$nin": [#group_participants#]}}).Count(groups_count).Columns("id,group_name").Custom(_name){ + DBFind("@1groups", src_groups).Where({"ecosystem": "#ecosystem_id#", "deleted": 0, "id": {"$nin": [#group_participants#]}}).Count(groups_count).Columns("id,group_name").Custom(_name){ Span(#group_name#) } - SetVar(source, src_groups) + SetVar(source, "src_groups") + SetVar(value, "id") SetVar(select_label, $@1group$) SetVar(hint, $@1select_group$) }.ElseIf(#buffer_value_type_participants# > 2){ - DBFind(@1roles, src_roles).Where({"ecosystem": #ecosystem_id#, "deleted": 0, "id": {"$nin": [#role_participants#]}}).Count(roles_count).Columns("id,role_name").Custom(_name){ + DBFind("@1roles", src_roles).Where({"ecosystem": "#ecosystem_id#", "deleted": 0, "id": {"$nin": [#role_participants#]}}).Count(roles_count).Columns("id,role_name").Custom(_name){ Span(#role_name#) } - SetVar(source, src_roles) + SetVar(source, "src_roles") + SetVar(value, "id") SetVar(select_label, $@1role$) SetVar(hint, $@1select_role$) } @@ -571,7 +574,7 @@ Form(){ } If(Or(And(#buffer_value_type_participants# == 2, #keys_count# > 0), And(#buffer_value_type_participants# == 3, #participants_count# == 0), And(#buffer_value_type_participants# == 6, #participants_count# == 0), And(#buffer_value_type_participants# > 3, #roles_count# > 0))){ Div(input-group){ - Select(Name: VarId, Source: #source#, NameColumn: _name, ValueColumn: id) + Select(Name: VarId, Source: #source#, NameColumn: _name, ValueColumn: #value#) Div(input-group-btn){ Button(Class: btn bg-gray-lighter fa fa-plus buttons, Page: #this_page#, PageParams: "stage=4,new_participant=Val(VarId),member_participants=#member_participants#,role_participants=#role_participants#,group_participants=#group_participants#").Popup(50, $@1voting_wizard$) Button(Class: btn bg-gray-lighter fa fa-undo buttons, Page: #this_page#, PageParams: "stage=4,member_participants=0,role_participants=0,group_participants=0").Popup(50, $@1voting_wizard$) @@ -601,7 +604,7 @@ Form(){ } }.Else{ Div(input-group){ - Input(Class: mb, Disabled: 1, Value: "$@1voting_all_keys_added$") + Input(Class: mb, Disabled: 1, Value: "$@1voting_all_members_added$") Div(input-group-btn input-group-top){ Button(Class: btn bg-gray-lighter fa fa-undo buttons, Page: #this_page#, PageParams: "stage=4,member_participants=0,role_participants=0,group_participants=0").Popup(50, $@1voting_wizard$) } diff --git a/src/basic/struct.dot b/src/basic/struct.dot index bc5baa6ac..5f37be35e 100644 --- a/src/basic/struct.dot +++ b/src/basic/struct.dot @@ -219,7 +219,7 @@ size="30"; "1metrics\ntable" -> "sysparams_metrics\npage" "sysparams_metrics\npage" [color=green, fontcolor=green, group=pages, shape=record]; "sysparams_voting\npage" -> "@1VotingRunEditPlatformParam\ncontract" [ color=red ] -"sysparams_voting\npage" -> "@1VotingRunRemoveValidator\ncontract" [ color=red ] +"sysparams_voting\npage" -> "@1VotingRunRemoveConsortiumMember\ncontract" [ color=red ] "1applications\ntable" -> "sysparams_voting\npage" "1voting_templates\ntable" -> "sysparams_voting\npage" "1system_parameters\ntable" -> "sysparams_voting\npage" @@ -240,21 +240,21 @@ size="30"; "tokens_send\npage" [color=green, fontcolor=green, group=pages, shape=record]; "upload_page\npage" -> "@1BufferFileUpload\ncontract" [ color=red ] "upload_page\npage" [color=green, fontcolor=green, group=pages, shape=record]; -"validator_candidates_create\npage" -> "@1ValidatorRequest\ncontract" [ color=red ] -"validator_candidates_create\npage" [color=green, fontcolor=green, group=pages, shape=record]; -"validator_candidates_list\npage" -> "@1VotingRunNewValidator\ncontract" [ color=red ] -"1applications\ntable" -> "validator_candidates_list\npage" -"1voting_templates\ntable" -> "validator_candidates_list\npage" -"src\ntable" -> "validator_candidates_list\npage" -"1members\ntable" -> "validator_candidates_list\npage" -"validator_candidates_list\npage" -> "@1pager_header\nblock" [ color=green, label=include ] -"validator_candidates_list\npage" -> "@1search\nblock" [ color=green, label=include ] -"validator_candidates_list\npage" -> "@1pager\nblock" [ color=green, label=include ] -"validator_candidates_list\npage" [color=green, fontcolor=green, group=pages, shape=record]; -"validator_resign\npage" -> "@1ValidatorResign\ncontract" [ color=red ] -"1applications\ntable" -> "validator_resign\npage" -"1roles_participants\ntable" -> "validator_resign\npage" -"validator_resign\npage" [color=green, fontcolor=green, group=pages, shape=record]; +"consortium_member_request\npage" -> "@1ConsortiumMemberRequest\ncontract" [ color=red ] +"consortium_member_request\npage" [color=green, fontcolor=green, group=pages, shape=record]; +"consortium_member_candidates\npage" -> "@1VotingRunNewConsortiumMember\ncontract" [ color=red ] +"1applications\ntable" -> "consortium_member_candidates\npage" +"1voting_templates\ntable" -> "consortium_member_candidates\npage" +"src\ntable" -> "consortium_member_candidates\npage" +"1members\ntable" -> "consortium_member_candidates\npage" +"consortium_member_candidates\npage" -> "@1pager_header\nblock" [ color=green, label=include ] +"consortium_member_candidates\npage" -> "@1search\nblock" [ color=green, label=include ] +"consortium_member_candidates\npage" -> "@1pager\nblock" [ color=green, label=include ] +"consortium_member_candidates\npage" [color=green, fontcolor=green, group=pages, shape=record]; +"consortium_member_resign\npage" -> "@1ConsortiumMemberResign\ncontract" [ color=red ] +"1applications\ntable" -> "consortium_member_resign\npage" +"1roles_participants\ntable" -> "consortium_member_resign\npage" +"consortium_member_resign\npage" [color=green, fontcolor=green, group=pages, shape=record]; "voting_create\npage" -> "@1VotingCreate\ncontract" [ color=red ] "1applications\ntable" -> "voting_create\npage" "voting_create\npage" [color=green, fontcolor=green, group=pages, shape=record]; @@ -447,7 +447,7 @@ size="30"; "MembershipRequest\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; "MetricsUpdate\ncontract" -> "BufferManager\ncontract" [ color=red ] "MetricsUpdate\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; -"NodeRemoveByKey\ncontract" -> "ValidatorResign\ncontract" [ color=red ] +"NodeRemoveByKey\ncontract" -> "ConsortiumMemberResign\ncontract" [ color=red ] "NodeRemoveByKey\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; "1members\ntable" -> "NotificationsBroadcast\ncontract" "1keys\ntable" -> "NotificationsBroadcast\ncontract" @@ -493,8 +493,8 @@ size="30"; "RolesAssign\ncontract" -> "DelegateRefresh\ncontract" [ color=red ] "RolesAssign\ncontract" -> "InvestorRefresh\ncontract" [ color=red ] "RolesAssign\ncontract" -> "RolesAccessCheck\ncontract" [ color=red ] -"RolesAssign\ncontract" -> "ValidatorRequest\ncontract" [ color=red ] -"RolesAssign\ncontract" -> "VotingValidatorAccept\ncontract" [ color=red ] +"RolesAssign\ncontract" -> "ConsortiumMemberRequest\ncontract" [ color=red ] +"RolesAssign\ncontract" -> "VotingConsortiumMemberAccept\ncontract" [ color=red ] "1members\ntable" -> "RolesAssign\ncontract" "1keys\ntable" -> "RolesAssign\ncontract" "1roles\ntable" -> "RolesAssign\ncontract" @@ -531,8 +531,8 @@ size="30"; "RolesUnassign\ncontract" -> "DelegateRefresh\ncontract" [ color=red ] "RolesUnassign\ncontract" -> "InvestorRefresh\ncontract" [ color=red ] "RolesUnassign\ncontract" -> "RolesAccessCheck\ncontract" [ color=red ] -"RolesUnassign\ncontract" -> "ValidatorRequest\ncontract" [ color=red ] -"RolesUnassign\ncontract" -> "VotingValidatorAccept\ncontract" [ color=red ] +"RolesUnassign\ncontract" -> "ConsortiumMemberRequest\ncontract" [ color=red ] +"RolesUnassign\ncontract" -> "VotingConsortiumMemberAccept\ncontract" [ color=red ] "1roles_participants\ntable" -> "RolesUnassign\ncontract" "1roles\ntable" -> "RolesUnassign\ncontract" "RolesUnassign\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; @@ -559,20 +559,20 @@ size="30"; "1ecosystems\ntable" -> "TokensTransfer\ncontract" "1keys\ntable" -> "TokensTransfer\ncontract" "TokensTransfer\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; -"ValidatorDelete\ncontract" -> "RolesUnassign\ncontract" [ color=red ] -"1validator_candidates\ntable" -> "ValidatorDelete\ncontract" -"1roles_participants\ntable" -> "ValidatorDelete\ncontract" -"ValidatorDelete\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; -"ValidatorRequest\ncontract" -> "RolesAssign\ncontract" [ color=red ] -"1keys\ntable" -> "ValidatorRequest\ncontract" -"1applications\ntable" -> "ValidatorRequest\ncontract" -"1roles\ntable" -> "ValidatorRequest\ncontract" -"ValidatorRequest\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; -"ValidatorResign\ncontract" -> "NodeRemoveByKey\ncontract" [ color=red ] -"ValidatorResign\ncontract" -> "RolesUnassign\ncontract" [ color=red ] -"1applications\ntable" -> "ValidatorResign\ncontract" -"1roles_participants\ntable" -> "ValidatorResign\ncontract" -"ValidatorResign\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; +"ConsortiumMemberDelete\ncontract" -> "RolesUnassign\ncontract" [ color=red ] +"1consortium_member_requests\ntable" -> "ConsortiumMemberDelete\ncontract" +"1roles_participants\ntable" -> "ConsortiumMemberDelete\ncontract" +"ConsortiumMemberDelete\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; +"ConsortiumMemberRequest\ncontract" -> "RolesAssign\ncontract" [ color=red ] +"1keys\ntable" -> "ConsortiumMemberRequest\ncontract" +"1applications\ntable" -> "ConsortiumMemberRequest\ncontract" +"1roles\ntable" -> "ConsortiumMemberRequest\ncontract" +"ConsortiumMemberRequest\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; +"ConsortiumMemberResign\ncontract" -> "NodeRemoveByKey\ncontract" [ color=red ] +"ConsortiumMemberResign\ncontract" -> "RolesUnassign\ncontract" [ color=red ] +"1applications\ntable" -> "ConsortiumMemberResign\ncontract" +"1roles_participants\ntable" -> "ConsortiumMemberResign\ncontract" +"ConsortiumMemberResign\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; "VotingCandidateAccept\ncontract" -> "NotificationsClose\ncontract" [ color=red ] "VotingCandidateAccept\ncontract" -> "VotingUpdate\ncontract" [ color=red ] "1notifications\ntable" -> "VotingCandidateAccept\ncontract" @@ -585,8 +585,8 @@ size="30"; "VotingCreate\ncontract" -> "VotingInvite\ncontract" [ color=red ] "VotingCreate\ncontract" -> "VotingRunEditEcosysParam\ncontract" [ color=red ] "VotingCreate\ncontract" -> "VotingRunEditPlatformParam\ncontract" [ color=red ] -"VotingCreate\ncontract" -> "VotingRunNewValidator\ncontract" [ color=red ] -"VotingCreate\ncontract" -> "VotingRunRemoveValidator\ncontract" [ color=red ] +"VotingCreate\ncontract" -> "VotingRunNewConsortiumMember\ncontract" [ color=red ] +"VotingCreate\ncontract" -> "VotingRunRemoveConsortiumMember\ncontract" [ color=red ] "VotingCreate\ncontract" -> "VotingRunTokenRefund\ncontract" [ color=red ] "VotingCreate\ncontract" -> "VotingRunVes\ncontract" [ color=red ] "1keys\ntable" -> "VotingCreate\ncontract" @@ -638,17 +638,17 @@ size="30"; "1applications\ntable" -> "VotingRunEditPlatformParam\ncontract" "1app_params\ntable" -> "VotingRunEditPlatformParam\ncontract" "VotingRunEditPlatformParam\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; -"VotingRunNewValidator\ncontract" -> "DelegateRefresh\ncontract" [ color=red ] -"VotingRunNewValidator\ncontract" -> "VotingTemplateRun\ncontract" [ color=red ] -"1keys\ntable" -> "VotingRunNewValidator\ncontract" -"1applications\ntable" -> "VotingRunNewValidator\ncontract" -"1app_params\ntable" -> "VotingRunNewValidator\ncontract" -"1validator_candidates\ntable" -> "VotingRunNewValidator\ncontract" -"VotingRunNewValidator\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; -"VotingRunRemoveValidator\ncontract" -> "VotingTemplateRun\ncontract" [ color=red ] -"1applications\ntable" -> "VotingRunRemoveValidator\ncontract" -"1app_params\ntable" -> "VotingRunRemoveValidator\ncontract" -"VotingRunRemoveValidator\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; +"VotingRunNewConsortiumMember\ncontract" -> "DelegateRefresh\ncontract" [ color=red ] +"VotingRunNewConsortiumMember\ncontract" -> "VotingTemplateRun\ncontract" [ color=red ] +"1keys\ntable" -> "VotingRunNewConsortiumMember\ncontract" +"1applications\ntable" -> "VotingRunNewConsortiumMember\ncontract" +"1app_params\ntable" -> "VotingRunNewConsortiumMember\ncontract" +"1consortium_member_requests\ntable" -> "VotingRunNewConsortiumMember\ncontract" +"VotingRunNewConsortiumMember\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; +"VotingRunRemoveConsortiumMember\ncontract" -> "VotingTemplateRun\ncontract" [ color=red ] +"1applications\ntable" -> "VotingRunRemoveConsortiumMember\ncontract" +"1app_params\ntable" -> "VotingRunRemoveConsortiumMember\ncontract" +"VotingRunRemoveConsortiumMember\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; "VotingRunTokenRefund\ncontract" -> "TokensLockoutMember\ncontract" [ color=red ] "VotingRunTokenRefund\ncontract" -> "VotingTemplateRun\ncontract" [ color=red ] "VotingRunTokenRefund\ncontract" -> "tokens_refund\ntable" [ color="" ] @@ -696,8 +696,8 @@ size="30"; "VotingTemplateRun\ncontract" -> "VotingInvite\ncontract" [ color=red ] "VotingTemplateRun\ncontract" -> "VotingRunEditEcosysParam\ncontract" [ color=red ] "VotingTemplateRun\ncontract" -> "VotingRunEditPlatformParam\ncontract" [ color=red ] -"VotingTemplateRun\ncontract" -> "VotingRunNewValidator\ncontract" [ color=red ] -"VotingTemplateRun\ncontract" -> "VotingRunRemoveValidator\ncontract" [ color=red ] +"VotingTemplateRun\ncontract" -> "VotingRunNewConsortiumMember\ncontract" [ color=red ] +"VotingTemplateRun\ncontract" -> "VotingRunRemoveConsortiumMember\ncontract" [ color=red ] "VotingTemplateRun\ncontract" -> "VotingRunTokenRefund\ncontract" [ color=red ] "VotingTemplateRun\ncontract" -> "VotingRunVes\ncontract" [ color=red ] "VotingTemplateRun\ncontract" -> "VotingSubjectCandidates\ncontract" [ color=red ] @@ -711,7 +711,7 @@ size="30"; "VotingTemplateRun\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; "VotingTemplatesInstall\ncontract" -> "TokensRefundAccept\ncontract" [ color=red ] "VotingTemplatesInstall\ncontract" -> "TokensRefundReject\ncontract" [ color=red ] -"VotingTemplatesInstall\ncontract" -> "VotingValidatorAccept\ncontract" [ color=red ] +"VotingTemplatesInstall\ncontract" -> "VotingConsortiumMemberAccept\ncontract" [ color=red ] "VotingTemplatesInstall\ncontract" -> "VotingVesAccept\ncontract" [ color=red ] "1app_params\ntable" -> "VotingTemplatesInstall\ncontract" "1applications\ntable" -> "VotingTemplatesInstall\ncontract" @@ -720,15 +720,15 @@ size="30"; "VotingUpdate\ncontract" -> "VotingDecisionCheck\ncontract" [ color=red ] "1votings\ntable" -> "VotingUpdate\ncontract" "VotingUpdate\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; -"VotingValidatorAccept\ncontract" -> "RolesAssign\ncontract" [ color=red ] -"VotingValidatorAccept\ncontract" -> "RolesUnassign\ncontract" [ color=red ] -"VotingValidatorAccept\ncontract" -> "VotingDecisionCheck\ncontract" [ color=red ] -"1applications\ntable" -> "VotingValidatorAccept\ncontract" -"1voting_templates\ntable" -> "VotingValidatorAccept\ncontract" -"1votings_subject\ntable" -> "VotingValidatorAccept\ncontract" -"1roles_participants\ntable" -> "VotingValidatorAccept\ncontract" -"1roles\ntable" -> "VotingValidatorAccept\ncontract" -"VotingValidatorAccept\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; +"VotingConsortiumMemberAccept\ncontract" -> "RolesAssign\ncontract" [ color=red ] +"VotingConsortiumMemberAccept\ncontract" -> "RolesUnassign\ncontract" [ color=red ] +"VotingConsortiumMemberAccept\ncontract" -> "VotingDecisionCheck\ncontract" [ color=red ] +"1applications\ntable" -> "VotingConsortiumMemberAccept\ncontract" +"1voting_templates\ntable" -> "VotingConsortiumMemberAccept\ncontract" +"1votings_subject\ntable" -> "VotingConsortiumMemberAccept\ncontract" +"1roles_participants\ntable" -> "VotingConsortiumMemberAccept\ncontract" +"1roles\ntable" -> "VotingConsortiumMemberAccept\ncontract" +"VotingConsortiumMemberAccept\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; "VotingVesAccept\ncontract" -> "VotingDecisionCheck\ncontract" [ color=red ] "1applications\ntable" -> "VotingVesAccept\ncontract" "1voting_templates\ntable" -> "VotingVesAccept\ncontract" @@ -746,7 +746,7 @@ size="30"; "groups\ntable" [color="", fontcolor="", group=tables, shape=""]; "groups_participants\ntable" [color="", fontcolor="", group=tables, shape=""]; "tokens_refund\ntable" [color="", fontcolor="", group=tables, shape=""]; -"validator_candidates\ntable" [color="", fontcolor="", group=tables, shape=""]; +"consortium_member_requests\ntable" [color="", fontcolor="", group=tables, shape=""]; "voting_templates\ntable" [color="", fontcolor="", group=tables, shape=""]; "votings\ntable" [color="", fontcolor="", group=tables, shape=""]; "votings_participants\ntable" [color="", fontcolor="", group=tables, shape=""]; diff --git a/src/basic/tables/consortium_member_requests.json b/src/basic/tables/consortium_member_requests.json new file mode 100644 index 000000000..b577898bc --- /dev/null +++ b/src/basic/tables/consortium_member_requests.json @@ -0,0 +1,42 @@ +[ + { + "name": "api_address", + "conditions": "false", + "type": "text" + }, + { + "name": "candidate_account", + "conditions": "false", + "type": "varchar" + }, + { + "name": "comment", + "conditions": "false", + "type": "text" + }, + { + "name": "date_created", + "conditions": "false", + "type": "number" + }, + { + "name": "deleted", + "conditions": "ContractAccess(\"@1ConsortiumMemberDelete\")", + "type": "number" + }, + { + "name": "description", + "conditions": "false", + "type": "text" + }, + { + "name": "pub_key", + "conditions": "false", + "type": "text" + }, + { + "name": "tcp_address", + "conditions": "false", + "type": "text" + } +] \ No newline at end of file diff --git a/src/basic/tables/groups.json b/src/basic/tables/groups.json index 8921e6427..8194f4104 100644 --- a/src/basic/tables/groups.json +++ b/src/basic/tables/groups.json @@ -1,52 +1,52 @@ [ { - "name":"creator", - "conditions":"false", - "type":"json" + "name": "creator", + "conditions": "false", + "type": "json" }, { - "name":"date_created", - "conditions":"false", - "type":"number" + "name": "date_created", + "conditions": "false", + "type": "number" }, { - "name":"date_deleted", + "name": "date_deleted", "conditions": "ContractAccess(\"@1GroupsDelete\")", - "type":"number" + "type": "number" }, { - "name":"deleted", + "name": "deleted", "conditions": "ContractAccess(\"@1GroupsDelete\")", - "type":"number" + "type": "number" }, { - "name":"ecosystem", - "conditions":"false", - "type":"number" + "name": "ecosystem", + "conditions": "false", + "type": "number" }, { - "name":"group_access", + "name": "group_access", "conditions": "ContractAccess(\"@1GroupAccessManager\")", - "type":"json" + "type": "json" }, { - "name":"group_info", + "name": "group_info", "conditions": "ContractAccess(\"@1GroupsCreate\")", - "type":"text" + "type": "text" }, { - "name":"group_name", - "conditions":"false", - "type":"text" + "name": "group_name", + "conditions": "false", + "type": "text" }, { - "name":"group_type", - "conditions":"false", - "type":"number" + "name": "group_type", + "conditions": "false", + "type": "number" }, { - "name":"image_id", - "conditions":"false", - "type":"number" + "name": "image_id", + "conditions": "false", + "type": "number" } ] \ No newline at end of file diff --git a/src/basic/tables/groups_participants.json b/src/basic/tables/groups_participants.json index 0a2280b22..91a82b902 100644 --- a/src/basic/tables/groups_participants.json +++ b/src/basic/tables/groups_participants.json @@ -1,37 +1,37 @@ [ { - "name":"appointed", - "conditions":"false", - "type":"json" + "name": "appointed", + "conditions": "false", + "type": "json" }, { - "name":"date_created", - "conditions":"false", - "type":"number" + "name": "date_created", + "conditions": "false", + "type": "number" }, { - "name":"date_deleted", + "name": "date_deleted", "conditions": "ContractAccess(\"@1GroupsUnassign\")", - "type":"number" + "type": "number" }, { - "name":"deleted", + "name": "deleted", "conditions": "ContractAccess(\"@1GroupsUnassign\")", - "type":"number" + "type": "number" }, { - "name":"ecosystem", - "conditions":"false", - "type":"number" + "name": "ecosystem", + "conditions": "false", + "type": "number" }, { - "name":"groups_info", - "conditions":"false", - "type":"json" + "name": "groups_info", + "conditions": "false", + "type": "json" }, { - "name":"member", - "conditions":"false", - "type":"json" + "name": "member", + "conditions": "false", + "type": "json" } ] \ No newline at end of file diff --git a/src/basic/tables/tokens_refund.json b/src/basic/tables/tokens_refund.json index 352cfeba3..fabc00dfd 100644 --- a/src/basic/tables/tokens_refund.json +++ b/src/basic/tables/tokens_refund.json @@ -1,47 +1,47 @@ [ { - "conditions":"false", - "name":"amount", - "type":"money" + "name": "amount", + "conditions": "false", + "type": "money" }, { - "conditions":"ContractAccess(\"@1TokensRefundAccept\",\"@1TokensRefundReject\")", - "name":"status", - "type":"number" + "name": "attacker_account", + "conditions": "false", + "type": "varchar" }, { - "conditions":"false", - "name":"victim_key_id", - "type":"number" + "name": "blocked_at", + "conditions": "false", + "type": "number" }, { - "conditions":"false", - "name":"attacker_key_id", - "type":"number" + "name": "closed_at", + "conditions": "ContractAccess(\"@1TokensRefundAccept\",\"@1TokensRefundReject\")", + "type": "number" }, { - "conditions":"false", - "name":"validator_key_id", - "type":"number" + "name": "note", + "conditions": "false", + "type": "text" }, { - "conditions":"false", - "name":"note", - "type":"text" + "name": "result", + "conditions": "ContractAccess(\"@1TokensRefundAccept\",\"@1TokensRefundReject\")", + "type": "number" }, { - "conditions":"ContractAccess(\"@1TokensRefundAccept\",\"@1TokensRefundReject\")", - "name":"result", - "type":"number" + "name": "status", + "conditions": "ContractAccess(\"@1TokensRefundAccept\",\"@1TokensRefundReject\")", + "type": "number" }, { - "conditions":"ContractAccess(\"@1TokensRefundAccept\",\"@1TokensRefundReject\")", - "name":"closed_at", - "type":"number" + "name": "consortium_member_account", + "conditions": "false", + "type": "varchar" }, { - "conditions":"false", - "name":"blocked_at", - "type":"number" + "name": "victim_account", + "conditions": "false", + "type": "varchar" } ] \ No newline at end of file diff --git a/src/basic/tables/validator_candidates.json b/src/basic/tables/validator_candidates.json deleted file mode 100644 index e44b1b163..000000000 --- a/src/basic/tables/validator_candidates.json +++ /dev/null @@ -1,42 +0,0 @@ -[ - { - "conditions":"false", - "name":"date_created", - "type":"number" - }, - { - "conditions":"false", - "name":"candidate_key_id", - "type":"number" - }, - { - "conditions":"false", - "name":"comment", - "type":"text" - }, - { - "conditions":"ContractAccess(\"@1ValidatorDelete\")", - "name":"deleted", - "type":"number" - }, - { - "conditions":"false", - "name":"tcp_address", - "type":"text" - }, - { - "conditions":"false", - "name":"api_address", - "type":"text" - }, - { - "conditions":"false", - "name":"pub_key", - "type":"text" - }, - { - "conditions":"false", - "name":"description", - "type":"text" - } -] \ No newline at end of file diff --git a/src/basic/tables/voting_templates.json b/src/basic/tables/voting_templates.json index 3e007e971..8a5563787 100644 --- a/src/basic/tables/voting_templates.json +++ b/src/basic/tables/voting_templates.json @@ -1,22 +1,22 @@ [ { - "conditions":"false", - "name": "voting", - "type": "json" + "name": "ecosystem", + "conditions": "false", + "type": "number" }, { - "conditions":"false", "name": "optional", + "conditions": "false", "type": "json" }, { - "conditions":"false", "name": "subject", + "conditions": "false", "type": "json" }, { - "conditions":"false", - "name":"ecosystem", - "type":"number" + "name": "voting", + "conditions": "false", + "type": "json" } ] \ No newline at end of file diff --git a/src/basic/tables/votings.json b/src/basic/tables/votings.json index 190fa2708..ac2cc1aa2 100644 --- a/src/basic/tables/votings.json +++ b/src/basic/tables/votings.json @@ -1,52 +1,52 @@ [ { - "conditions": "ContractAccess(\"@1VotingInvite\")", - "name": "voting", + "name": "creator", + "conditions": "false", "type": "json" }, { - "conditions": "ContractAccess(\"@1VotingSubjectCandidates\", \"@1VotingSubjectDocument\", \"@1VotingSubjectContract\", \"@1VotingSubjectSettings\")", - "name": "optional", - "type": "json" + "name": "date_ended", + "conditions": "false", + "type": "number" }, { - "conditions": "ContractAccess(\"@1VotingUpdate\",\"@1VotingInvite\")", - "name": "progress", - "type": "json" + "name": "date_started", + "conditions": "false", + "type": "number" + }, + { + "name": "deleted", + "conditions": "ContractAccess(\"@1VotingDelete\")", + "type": "number" }, { + "name": "ecosystem", "conditions": "false", - "name": "date_ended", "type": "number" }, { - "conditions": "ContractAccess(\"@1VotingDecisionCheck\", \"@1VotingNotificationSend\", \"@1VotingStatusUpdate\", \"@1VotingSubjectCheck\", \"@1VotingUpdate\")", "name": "flags", + "conditions": "ContractAccess(\"@1VotingDecisionCheck\", \"@1VotingNotificationSend\", \"@1VotingStatusUpdate\", \"@1VotingSubjectCheck\", \"@1VotingUpdate\")", "type": "json" }, { - "conditions": "ContractAccess(\"@1VotingStatusUpdate\",\"@1VotingUpdate\")", - "name": "status", - "type": "number" - }, - { - "conditions": "false", - "name": "creator", + "name": "optional", + "conditions": "ContractAccess(\"@1VotingSubjectCandidates\", \"@1VotingSubjectDocument\", \"@1VotingSubjectContract\", \"@1VotingSubjectSettings\")", "type": "json" }, { - "conditions": "ContractAccess(\"@1VotingDelete\")", - "name": "deleted", - "type": "number" + "name": "progress", + "conditions": "ContractAccess(\"@1VotingUpdate\",\"@1VotingInvite\")", + "type": "json" }, { - "conditions": "false", - "name": "ecosystem", + "name": "status", + "conditions": "ContractAccess(\"@1VotingStatusUpdate\",\"@1VotingUpdate\")", "type": "number" }, { - "conditions": "false", - "name": "date_started", - "type": "number" + "name": "voting", + "conditions": "ContractAccess(\"@1VotingInvite\")", + "type": "json" } ] \ No newline at end of file diff --git a/src/basic/tables/votings_participants.json b/src/basic/tables/votings_participants.json index 287194281..035a70665 100644 --- a/src/basic/tables/votings_participants.json +++ b/src/basic/tables/votings_participants.json @@ -1,32 +1,32 @@ [ { + "name": "decision", "conditions": "ContractAccess(\"@1VotingCandidateAccept\", \"@1VotingDecisionAccept\", \"@1VotingDecisionReject\")", - "name": "member", - "type": "json" + "type": "number" }, { + "name": "decision_date", "conditions": "ContractAccess(\"@1VotingCandidateAccept\", \"@1VotingDecisionAccept\", \"@1VotingDecisionReject\")", - "name": "decision", "type": "number" }, { - "conditions": "false", "name": "ecosystem", - "type": "number" - }, - { "conditions": "false", - "name": "voting_id", "type": "number" }, { + "name": "member", "conditions": "ContractAccess(\"@1VotingCandidateAccept\", \"@1VotingDecisionAccept\", \"@1VotingDecisionReject\")", - "name": "decision_date", - "type": "number" + "type": "json" }, { - "conditions": "ContractAccess(\"@1VotingStatusUpdate\")", "name": "rating", + "conditions": "ContractAccess(\"@1VotingStatusUpdate\")", + "type": "number" + }, + { + "name": "voting_id", + "conditions": "false", "type": "number" } ] \ No newline at end of file diff --git a/src/basic/tables/votings_subject.json b/src/basic/tables/votings_subject.json index d068b1695..21b24539a 100644 --- a/src/basic/tables/votings_subject.json +++ b/src/basic/tables/votings_subject.json @@ -1,27 +1,27 @@ [ { + "name": "ecosystem", "conditions": "false", - "name": "voting_id", "type": "number" }, { - "conditions": "ContractAccess(\"@1VotingCandidateAccept\", \"@1VotingDecisionAccept\")", "name": "number_accept", + "conditions": "ContractAccess(\"@1VotingCandidateAccept\", \"@1VotingDecisionAccept\")", "type": "number" }, { - "conditions": "ContractAccess(\"@1VotingSubjectContract\", \"@1VotingSubjectDocument\")", + "name": "results", + "conditions": "ContractAccess(\"@1VotingCandidateAccept\", \"@1VotingDecisionAccept\", \"@1VotingDecisionReject\")", + "type": "json" + }, + { "name": "subject", + "conditions": "ContractAccess(\"@1VotingSubjectContract\", \"@1VotingSubjectDocument\")", "type": "json" }, { + "name": "voting_id", "conditions": "false", - "name": "ecosystem", "type": "number" - }, - { - "conditions": "ContractAccess(\"@1VotingCandidateAccept\", \"@1VotingDecisionAccept\", \"@1VotingDecisionReject\")", - "name": "results", - "type": "json" } ] \ No newline at end of file diff --git a/src/conditions/contracts/full_nodes.sim b/src/conditions/contracts/full_nodes.sim index 42d7f6f49..876458a33 100644 --- a/src/conditions/contracts/full_nodes.sim +++ b/src/conditions/contracts/full_nodes.sim @@ -43,7 +43,7 @@ contract full_nodes { warning "API address was not received" } if Size(key_id) == 0 { - warning "Key ID was not received" + warning "Account was not received" } i = i + 1 diff --git a/src/lang_res/languages/account_not_found.json b/src/lang_res/languages/account_not_found.json new file mode 100644 index 000000000..06ac32044 --- /dev/null +++ b/src/lang_res/languages/account_not_found.json @@ -0,0 +1 @@ +{"en": "The account is not found", "ru": "Указанный аккаунт не найден"} \ No newline at end of file diff --git a/src/lang_res/languages/attacker_key_invalid.json b/src/lang_res/languages/attacker_key_invalid.json deleted file mode 100644 index b83f9e05a..000000000 --- a/src/lang_res/languages/attacker_key_invalid.json +++ /dev/null @@ -1 +0,0 @@ -{"en": "The specified attacker key is not valid", "ru": "Ключ злоумышленника задан неверно"} \ No newline at end of file diff --git a/src/lang_res/languages/attacker_wallet_invalid.json b/src/lang_res/languages/attacker_wallet_invalid.json new file mode 100644 index 000000000..06a7d6d33 --- /dev/null +++ b/src/lang_res/languages/attacker_wallet_invalid.json @@ -0,0 +1 @@ +{"en": "The specified attacker wallet is not valid", "ru": "Кошелёк злоумышленника задан неверно"} \ No newline at end of file diff --git a/src/lang_res/languages/attention_not_validator.json b/src/lang_res/languages/attention_not_validator.json deleted file mode 100644 index 1ed1ad2d7..000000000 --- a/src/lang_res/languages/attention_not_validator.json +++ /dev/null @@ -1 +0,0 @@ -{"en": "You are not a member of the Validator role", "ru": "Вы не принадлежите к роли Validator"} \ No newline at end of file diff --git a/src/lang_res/languages/block_key.json b/src/lang_res/languages/block_account.json similarity index 100% rename from src/lang_res/languages/block_key.json rename to src/lang_res/languages/block_account.json diff --git a/src/lang_res/languages/candidate_already_validator.json b/src/lang_res/languages/candidate_already_validator.json deleted file mode 100644 index 6b10bf49d..000000000 --- a/src/lang_res/languages/candidate_already_validator.json +++ /dev/null @@ -1 +0,0 @@ -{"en": "This candidate is already a member of the Validator role", "ru": "Кандидат уже является членом роли Validator"} \ No newline at end of file diff --git a/src/lang_res/languages/candidate_key_not_found.json b/src/lang_res/languages/candidate_key_not_found.json deleted file mode 100644 index 2e612228f..000000000 --- a/src/lang_res/languages/candidate_key_not_found.json +++ /dev/null @@ -1 +0,0 @@ -{"en": "The candidate key ID is not found", "ru": "Идентификатор ключа кандидата не найден"} \ No newline at end of file diff --git a/src/lang_res/languages/consortium_member.json b/src/lang_res/languages/consortium_member.json new file mode 100644 index 000000000..6e6727e61 --- /dev/null +++ b/src/lang_res/languages/consortium_member.json @@ -0,0 +1 @@ +{"en": "Consortium Member", "ru": "Член роли Consortium Member"} \ No newline at end of file diff --git a/src/lang_res/languages/consortium_member_candidates.json b/src/lang_res/languages/consortium_member_candidates.json new file mode 100644 index 000000000..5541a094b --- /dev/null +++ b/src/lang_res/languages/consortium_member_candidates.json @@ -0,0 +1 @@ +{"en": "Consortium Member Candidates", "ru": "Кандидаты на роль Consortium Member"} \ No newline at end of file diff --git a/src/lang_res/languages/consortium_member_candidates_list_desc.json b/src/lang_res/languages/consortium_member_candidates_list_desc.json new file mode 100644 index 000000000..c9f1a2a29 --- /dev/null +++ b/src/lang_res/languages/consortium_member_candidates_list_desc.json @@ -0,0 +1 @@ +{"en": "This page is used to create and manage requests for the Consortium Member role", "ru": "Эта страница используется для создания и управления запросами кандидатов на роль Consortium Member"} \ No newline at end of file diff --git a/src/lang_res/languages/consortium_member_removing_desc.json b/src/lang_res/languages/consortium_member_removing_desc.json new file mode 100644 index 000000000..8a7a9dba3 --- /dev/null +++ b/src/lang_res/languages/consortium_member_removing_desc.json @@ -0,0 +1 @@ +{"en": "You are Consortium Member. You can remove the entry about your node and resign from the Consortium Member role at any time", "ru": "Вы являетесь членом роли Consortium Member. В любой момент вы можете удалить запись о своем узле и уйти с роли Consortium Member"} \ No newline at end of file diff --git a/src/lang_res/languages/consortium_member_request_form.json b/src/lang_res/languages/consortium_member_request_form.json new file mode 100644 index 000000000..ddef510c2 --- /dev/null +++ b/src/lang_res/languages/consortium_member_request_form.json @@ -0,0 +1 @@ +{"en": "Consortium Member candidate request form", "ru": "Форма запроса кандидата на роль Consortium Member"} \ No newline at end of file diff --git a/src/lang_res/languages/consortium_member_resign.json b/src/lang_res/languages/consortium_member_resign.json new file mode 100644 index 000000000..12d86fa37 --- /dev/null +++ b/src/lang_res/languages/consortium_member_resign.json @@ -0,0 +1 @@ +{"en": "Consortium Member resignation", "ru": "Отставка члена роли Consortium Member"} \ No newline at end of file diff --git a/src/lang_res/languages/consortium_member_role_not_found.json b/src/lang_res/languages/consortium_member_role_not_found.json new file mode 100644 index 000000000..3c9441bac --- /dev/null +++ b/src/lang_res/languages/consortium_member_role_not_found.json @@ -0,0 +1 @@ +{"en": "Consortium Member role is not found", "ru": "Роль Consortium Member не найдена"} \ No newline at end of file diff --git a/src/lang_res/languages/consortium_members.json b/src/lang_res/languages/consortium_members.json new file mode 100644 index 000000000..2a85e2093 --- /dev/null +++ b/src/lang_res/languages/consortium_members.json @@ -0,0 +1 @@ +{"en": "Consortium Members", "ru": "Члены роли Consortium Member"} \ No newline at end of file diff --git a/src/lang_res/languages/consortium_members_only.json b/src/lang_res/languages/consortium_members_only.json new file mode 100644 index 000000000..e5889cb10 --- /dev/null +++ b/src/lang_res/languages/consortium_members_only.json @@ -0,0 +1 @@ +{"en": "You are not a member of the Consortium Member role. You cannot execute this", "ru": "Вашему аккаунту не присвоена роль Consortium Member. Вы не можете запустить это"} \ No newline at end of file diff --git a/src/lang_res/languages/contract_hash_list_outside.json b/src/lang_res/languages/contract_hash_list_outside.json new file mode 100644 index 000000000..de2835ae2 --- /dev/null +++ b/src/lang_res/languages/contract_hash_list_outside.json @@ -0,0 +1 @@ +{"en": "Contracts Hash List", "ru": "Список хэшей контрактов"} diff --git a/src/lang_res/languages/file_not_selected.json b/src/lang_res/languages/file_not_selected.json new file mode 100644 index 000000000..79b41e2b6 --- /dev/null +++ b/src/lang_res/languages/file_not_selected.json @@ -0,0 +1 @@ +{"en": "File not selected", "ru": "Файл не выбран"} \ No newline at end of file diff --git a/src/lang_res/languages/hash_list_outside.json b/src/lang_res/languages/hash_list_outside.json new file mode 100644 index 000000000..c091e3f82 --- /dev/null +++ b/src/lang_res/languages/hash_list_outside.json @@ -0,0 +1 @@ +{"en": "Hash list", "ru": "Список хэшей"} diff --git a/src/lang_res/languages/key_id_investor.json b/src/lang_res/languages/investor.json similarity index 100% rename from src/lang_res/languages/key_id_investor.json rename to src/lang_res/languages/investor.json diff --git a/src/lang_res/languages/join_the_group.json b/src/lang_res/languages/join_the_group.json index 6cf25a2bc..169567d68 100644 --- a/src/lang_res/languages/join_the_group.json +++ b/src/lang_res/languages/join_the_group.json @@ -1 +1 @@ -{"en": "Join the group", "ru": "Присоеденится к группе"} \ No newline at end of file +{"en": "Join the group", "ru": "Присоединиться к группе"} \ No newline at end of file diff --git a/src/lang_res/languages/key_already_exists.json b/src/lang_res/languages/key_already_exists.json deleted file mode 100644 index 268ce1304..000000000 --- a/src/lang_res/languages/key_already_exists.json +++ /dev/null @@ -1 +0,0 @@ -{"en":"This key already exists","ru":"Данный ключ уже существует"} \ No newline at end of file diff --git a/src/lang_res/languages/key_id.json b/src/lang_res/languages/key_id.json deleted file mode 100644 index a5cc09989..000000000 --- a/src/lang_res/languages/key_id.json +++ /dev/null @@ -1 +0,0 @@ -{"en": "ID", "ru": "Идентификатор"} \ No newline at end of file diff --git a/src/lang_res/languages/key_id_or_wallet.json b/src/lang_res/languages/key_id_or_wallet.json deleted file mode 100644 index 332d807ae..000000000 --- a/src/lang_res/languages/key_id_or_wallet.json +++ /dev/null @@ -1 +0,0 @@ -{"en": "Key ID or wallet", "ru": "Идентификатор ключа или адрес кошелька"} \ No newline at end of file diff --git a/src/lang_res/languages/key_not_found.json b/src/lang_res/languages/key_not_found.json deleted file mode 100644 index 397841115..000000000 --- a/src/lang_res/languages/key_not_found.json +++ /dev/null @@ -1 +0,0 @@ -{"en": "The key ID is not found", "ru": "Идентификатор ключа не найден"} \ No newline at end of file diff --git a/src/lang_res/languages/network_list_outside.json b/src/lang_res/languages/network_list_outside.json new file mode 100644 index 000000000..d5339c171 --- /dev/null +++ b/src/lang_res/languages/network_list_outside.json @@ -0,0 +1 @@ +{"en": "Network list", "ru": "Список сетей"} diff --git a/src/lang_res/languages/node_founder_account.json b/src/lang_res/languages/node_founder_account.json new file mode 100644 index 000000000..bff1e8210 --- /dev/null +++ b/src/lang_res/languages/node_founder_account.json @@ -0,0 +1 @@ +{"en": "Node founder account", "ru": "Адрес кошелька основателя узла"} \ No newline at end of file diff --git a/src/lang_res/languages/node_founder_key_id.json b/src/lang_res/languages/node_founder_key_id.json index 71d46cce9..a0b53c995 100644 --- a/src/lang_res/languages/node_founder_key_id.json +++ b/src/lang_res/languages/node_founder_key_id.json @@ -1 +1 @@ -{"en": "Key ID of the node founder", "ru": "Идентификатор ключа основателя узла"} \ No newline at end of file +{"en": "Node founder Key ID", "ru": "Идентификатор ключа основателя узла"} \ No newline at end of file diff --git a/src/lang_res/languages/not_validator_can_not_run.json b/src/lang_res/languages/not_validator_can_not_run.json deleted file mode 100644 index 50e01f168..000000000 --- a/src/lang_res/languages/not_validator_can_not_run.json +++ /dev/null @@ -1 +0,0 @@ -{"en": "You are not a member of the Validator role. You cannot execute this", "ru": "Вашему аккаунту не присвоена роль Validator. Вы не можете запустить это"} \ No newline at end of file diff --git a/src/lang_res/languages/role_change_no_view_permission.json b/src/lang_res/languages/role_change_no_view_permission.json new file mode 100644 index 000000000..a497f1dd6 --- /dev/null +++ b/src/lang_res/languages/role_change_no_view_permission.json @@ -0,0 +1 @@ +{"en": "You do not have permission to view the page", "ru": "У вас нет прав на просмотр страницы"} diff --git a/src/lang_res/languages/key_id_sale_apl_admin.json b/src/lang_res/languages/sale_apl_admin.json similarity index 100% rename from src/lang_res/languages/key_id_sale_apl_admin.json rename to src/lang_res/languages/sale_apl_admin.json diff --git a/src/lang_res/languages/key_id_sale_apl_manager.json b/src/lang_res/languages/sale_apl_manager.json similarity index 100% rename from src/lang_res/languages/key_id_sale_apl_manager.json rename to src/lang_res/languages/sale_apl_manager.json diff --git a/src/lang_res/languages/key_id_consensus.json b/src/lang_res/languages/signer_consensus.json similarity index 100% rename from src/lang_res/languages/key_id_consensus.json rename to src/lang_res/languages/signer_consensus.json diff --git a/src/lang_res/languages/sysparams_candidate_validators_form.json b/src/lang_res/languages/sysparams_candidate_validators_form.json deleted file mode 100644 index 89238433e..000000000 --- a/src/lang_res/languages/sysparams_candidate_validators_form.json +++ /dev/null @@ -1 +0,0 @@ -{"en": "Validator role candidate request form", "ru": "Форма запроса кандидата в валидаторы"} \ No newline at end of file diff --git a/src/lang_res/languages/sysparams_candidates.json b/src/lang_res/languages/sysparams_candidates.json deleted file mode 100644 index f1bc0f968..000000000 --- a/src/lang_res/languages/sysparams_candidates.json +++ /dev/null @@ -1 +0,0 @@ -{"en": "Candidates for the Validator role", "ru": "Кандидаты на роль Validator"} \ No newline at end of file diff --git a/src/lang_res/languages/sysparams_candidates_list_desc.json b/src/lang_res/languages/sysparams_candidates_list_desc.json deleted file mode 100644 index 5fd6c29f8..000000000 --- a/src/lang_res/languages/sysparams_candidates_list_desc.json +++ /dev/null @@ -1 +0,0 @@ -{"en": "This page is used to create and manage requests for the Validator role", "ru": "Эта страница используется для создания и управления запросами кандидатов на роль Validator"} \ No newline at end of file diff --git a/src/lang_res/languages/sysparams_validator_resign.json b/src/lang_res/languages/sysparams_validator_resign.json deleted file mode 100644 index 68b279071..000000000 --- a/src/lang_res/languages/sysparams_validator_resign.json +++ /dev/null @@ -1 +0,0 @@ -{"en": "Validator's resignation", "ru": "Отставка валидатора"} \ No newline at end of file diff --git a/src/lang_res/languages/key_id_seller.json b/src/lang_res/languages/token_seller.json similarity index 100% rename from src/lang_res/languages/key_id_seller.json rename to src/lang_res/languages/token_seller.json diff --git a/src/lang_res/languages/unblock_key.json b/src/lang_res/languages/unblock_account.json similarity index 100% rename from src/lang_res/languages/unblock_key.json rename to src/lang_res/languages/unblock_account.json diff --git a/src/lang_res/languages/validator_removing.json b/src/lang_res/languages/validator_removing.json deleted file mode 100644 index 6acba4b18..000000000 --- a/src/lang_res/languages/validator_removing.json +++ /dev/null @@ -1 +0,0 @@ -{"en": "Validator removal", "ru": "Удаление валидатора"} \ No newline at end of file diff --git a/src/lang_res/languages/validator_removing_desc.json b/src/lang_res/languages/validator_removing_desc.json deleted file mode 100644 index 1ae5039fe..000000000 --- a/src/lang_res/languages/validator_removing_desc.json +++ /dev/null @@ -1 +0,0 @@ -{"en": "You are a Validator. You can remove the entry about your node and resign from the Validator role at any time", "ru": "Вы являетесь Валидатором. В любой момент вы можете удалить запись о своем узле и уйти с роли Валидатор"} \ No newline at end of file diff --git a/src/lang_res/languages/validator_role_not_found.json b/src/lang_res/languages/validator_role_not_found.json deleted file mode 100644 index cce88f202..000000000 --- a/src/lang_res/languages/validator_role_not_found.json +++ /dev/null @@ -1 +0,0 @@ -{"en": "The Validator role is not found", "ru": "Роль Validator не найдена"} \ No newline at end of file diff --git a/src/lang_res/languages/validators.json b/src/lang_res/languages/validators.json deleted file mode 100644 index 04cff48b2..000000000 --- a/src/lang_res/languages/validators.json +++ /dev/null @@ -1 +0,0 @@ -{"en": "Validators", "ru": "Валидаторы"} \ No newline at end of file diff --git a/src/lang_res/languages/victim_key_invalid.json b/src/lang_res/languages/victim_key_invalid.json deleted file mode 100644 index 421437e46..000000000 --- a/src/lang_res/languages/victim_key_invalid.json +++ /dev/null @@ -1 +0,0 @@ -{"en": "The victim key is not valid", "ru": "Ключ пострадавшего задан неверно"} \ No newline at end of file diff --git a/src/lang_res/languages/victim_wallet_invalid.json b/src/lang_res/languages/victim_wallet_invalid.json new file mode 100644 index 000000000..9ad293e5b --- /dev/null +++ b/src/lang_res/languages/victim_wallet_invalid.json @@ -0,0 +1 @@ +{"en": "The victim wallet is not valid", "ru": "Кошелёк пострадавшего задан неверно"} \ No newline at end of file diff --git a/src/lang_res/languages/voting_all_keys_added.json b/src/lang_res/languages/voting_all_members_added.json similarity index 100% rename from src/lang_res/languages/voting_all_keys_added.json rename to src/lang_res/languages/voting_all_members_added.json diff --git a/src/lang_res/languages/wallet_already_exists.json b/src/lang_res/languages/wallet_already_exists.json new file mode 100644 index 000000000..78b578865 --- /dev/null +++ b/src/lang_res/languages/wallet_already_exists.json @@ -0,0 +1 @@ +{"en":"This wallet already exists","ru":"Данный кошелёк уже существует"} \ No newline at end of file diff --git a/src/lang_res/languages/want_block_account.json b/src/lang_res/languages/want_block_account.json new file mode 100644 index 000000000..f1099bd28 --- /dev/null +++ b/src/lang_res/languages/want_block_account.json @@ -0,0 +1 @@ +{"en": "Do you want to block this account?", "ru": "Вы хотите блокировать этот аккаунт?"} \ No newline at end of file diff --git a/src/lang_res/languages/want_block_key.json b/src/lang_res/languages/want_block_key.json deleted file mode 100644 index 17ce172bc..000000000 --- a/src/lang_res/languages/want_block_key.json +++ /dev/null @@ -1 +0,0 @@ -{"en": "Do you want to block this key?", "ru": "Вы хотите блокировать этот ключ?"} \ No newline at end of file diff --git a/src/lang_res/languages/want_delete_account.json b/src/lang_res/languages/want_delete_account.json new file mode 100644 index 000000000..303cc8fd3 --- /dev/null +++ b/src/lang_res/languages/want_delete_account.json @@ -0,0 +1 @@ +{"en": "Do you want to delete this account?", "ru": "Вы хотите удалить этот аккаунт?"} \ No newline at end of file diff --git a/src/lang_res/languages/want_delete_key.json b/src/lang_res/languages/want_delete_key.json deleted file mode 100644 index 9f96cb26b..000000000 --- a/src/lang_res/languages/want_delete_key.json +++ /dev/null @@ -1 +0,0 @@ -{"en": "Do you want to delete this key?", "ru": "Вы хотите удалить этот ключ?"} \ No newline at end of file diff --git a/src/lang_res/languages/want_resign.json b/src/lang_res/languages/want_resign.json index 1d2f0360a..7f8dd2a47 100644 --- a/src/lang_res/languages/want_resign.json +++ b/src/lang_res/languages/want_resign.json @@ -1 +1 @@ -{"en": "Do you really want to resign from the Validator role?", "ru": "Вы уверены, что хотите уйти с роли Validator?"} \ No newline at end of file +{"en": "Do you really want to resign from the Consortium Member role?", "ru": "Вы уверены, что хотите уйти с роли Consortium Member?"} \ No newline at end of file diff --git a/src/lang_res/languages/want_unblock_account.json b/src/lang_res/languages/want_unblock_account.json new file mode 100644 index 000000000..f0de0601e --- /dev/null +++ b/src/lang_res/languages/want_unblock_account.json @@ -0,0 +1 @@ +{"en": "Do you want to unblock this account?", "ru": "Вы хотите разблокировать этот аккаунт?"} \ No newline at end of file diff --git a/src/lang_res/languages/want_unblock_key.json b/src/lang_res/languages/want_unblock_key.json deleted file mode 100644 index f59620037..000000000 --- a/src/lang_res/languages/want_unblock_key.json +++ /dev/null @@ -1 +0,0 @@ -{"en": "Do you want to unblock this key?", "ru": "Вы хотите разблокировать этот ключ?"} \ No newline at end of file diff --git a/src/lang_res/struct.dot b/src/lang_res/struct.dot deleted file mode 100644 index 31cf68db0..000000000 --- a/src/lang_res/struct.dot +++ /dev/null @@ -1,8 +0,0 @@ -digraph G { -fontsize="24"; -label="lang_res\nTuesday, 05-Mar-19 16:27:58 +10"; -nojustify=true; -ordering=out; -rankdir=LR; -size="30"; -} diff --git a/src/system/app_params/role_candidate_for_validators.csv b/src/system/app_params/role_consortium_member.csv similarity index 100% rename from src/system/app_params/role_candidate_for_validators.csv rename to src/system/app_params/role_consortium_member.csv diff --git a/src/system/app_params/role_consensus.csv b/src/system/app_params/role_consortium_member_candidate.csv similarity index 100% rename from src/system/app_params/role_consensus.csv rename to src/system/app_params/role_consortium_member_candidate.csv diff --git a/src/system/app_params/role_validator.csv b/src/system/app_params/role_validator.csv deleted file mode 100644 index c22708346..000000000 --- a/src/system/app_params/role_validator.csv +++ /dev/null @@ -1 +0,0 @@ -0 \ No newline at end of file diff --git a/src/system/blocks/admin_link.ptl b/src/system/blocks/admin_link.ptl index ef7776d61..527f07c8b 100644 --- a/src/system/blocks/admin_link.ptl +++ b/src/system/blocks/admin_link.ptl @@ -1,14 +1,14 @@ If(#sort#==1){ - SetVar(sort_name, "{id:1}") + SetVar(sort_name, "{id: 1}") }.ElseIf(#sort#==2){ - SetVar(sort_name, "{id:-1}") + SetVar(sort_name, "{id: -1}") }.ElseIf(#sort#==3){ SetVar(sort_name, "{name: 1}") }.ElseIf(#sort#==4){ SetVar(sort_name, "{name: -1}") }.Else{ SetVar(sort, "1") - SetVar(sort_name, "{id:1}") + SetVar(sort_name, "{id: 1}") } If(Or(#width#==12,#width#==6,#width#==4)){ @@ -19,7 +19,7 @@ If(Or(#width#==12,#width#==6,#width#==4)){ Form(){ Div(clearfix){ Div(pull-left ml-sm){ - DBFind(@1applications,apps).Where({"ecosystem": #ecosystem_id#}) + DBFind("@1applications",apps).Where({"ecosystem": "#ecosystem_id#"}) Select(Name:AppId, Source:apps, NameColumn: name, ValueColumn: id, Value: #buffer_value_app_id#, Class: bg-gray-lighter).Style(border: 0px; padding-top: 4px;) } Div(pull-left ml-sm){ diff --git a/src/system/blocks/export_info.ptl b/src/system/blocks/export_info.ptl index 12f6c7962..73b065181 100644 --- a/src/system/blocks/export_info.ptl +++ b/src/system/blocks/export_info.ptl @@ -1,12 +1,12 @@ -DBFind(@1buffer_data).Columns("value->app_id,value->app_name,value->menu_name,value->menu_id,value->count_menu").Where({"key": 'export', "member_id": #key_id#, "ecosystem": #ecosystem_id#}).Vars(buffer) +DBFind("@1buffer_data").Columns("value->app_id,value->app_name,value->menu_name,value->menu_id,value->count_menu").Where({"key": "export", "account": "#account_id#", "ecosystem": "#ecosystem_id#"}).Vars(buffer) If(#buffer_value_app_id# > 0){ - DBFind(@1pages, src_pages).Where({"app_id": #buffer_value_app_id#, "ecosystem": #ecosystem_id#}).Limit(250).Order("name").Count(count_pages) - DBFind(@1blocks, src_blocks).Where({"app_id": #buffer_value_app_id#, "ecosystem": #ecosystem_id#}).Limit(250).Order("name").Count(count_blocks) - DBFind(@1app_params, src_parameters).Where({"app_id": #buffer_value_app_id#, "ecosystem": #ecosystem_id#}).Limit(250).Order("name").Count(count_parameters) - DBFind(@1languages, src_languages).Where({"id": 0}).Limit(250).Order("name").Count(count_languages) - DBFind(@1contracts, src_contracts).Where({"app_id": #buffer_value_app_id#, "ecosystem": #ecosystem_id#}).Limit(250).Order("name").Count(count_contracts) - DBFind(@1tables, src_tables).Where({"app_id": #buffer_value_app_id#, "ecosystem": #ecosystem_id#}).Limit(250).Order("name").Count(count_tables) + DBFind("@1pages", src_pages).Where({"app_id": "#buffer_value_app_id#", "ecosystem": "#ecosystem_id#"}).Limit(250).Order("name").Count(count_pages) + DBFind("@1blocks", src_blocks).Where({"app_id": "#buffer_value_app_id#", "ecosystem": "#ecosystem_id#"}).Limit(250).Order("name").Count(count_blocks) + DBFind("@1app_params", src_parameters).Where({"app_id": "#buffer_value_app_id#", "ecosystem": "#ecosystem_id#"}).Limit(250).Order("name").Count(count_parameters) + DBFind("@1languages", src_languages).Where({"id": 0}).Limit(250).Order("name").Count(count_languages) + DBFind("@1contracts", src_contracts).Where({"app_id": "#buffer_value_app_id#", "ecosystem": "#ecosystem_id#"}).Limit(250).Order("name").Count(count_contracts) + DBFind("@1tables", src_tables).Where({"app_id": "#buffer_value_app_id#", "ecosystem": "#ecosystem_id#"}).Limit(250).Order("name").Count(count_tables) } Div(panel panel-primary){ diff --git a/src/system/config.json b/src/system/config.json index 7206eb185..4d4a05820 100644 --- a/src/system/config.json +++ b/src/system/config.json @@ -52,6 +52,14 @@ "Name": "BindWallet", "Conditions": "ContractConditions(\"@1DeveloperCondition\")" }, + { + "Name": "BufferFileUpload", + "Conditions": "ContractConditions(\"@1DeveloperCondition\")" + }, + { + "Name": "BufferManager", + "Conditions": "ContractConditions(\"@1DeveloperCondition\")" + }, { "Name": "CallDelayedContract", "Conditions": "ContractConditions(\"@1DeveloperCondition\")" @@ -459,11 +467,11 @@ "Conditions": "ContractConditions(\"@1DeveloperCondition\")" }, { - "Name": "role_candidate_for_validators", + "Name": "role_consortium_member_candidate", "Conditions": "ContractConditions(\"@1DeveloperCondition\")" }, { - "Name": "role_consensus", + "Name": "role_consortium_member", "Conditions": "ContractConditions(\"@1DeveloperCondition\")" }, { @@ -481,10 +489,6 @@ { "Name": "role_investor_with_voting_rights", "Conditions": "ContractConditions(\"@1DeveloperCondition\")" - }, - { - "Name": "role_validator", - "Conditions": "ContractConditions(\"@1DeveloperCondition\")" } ] } \ No newline at end of file diff --git a/src/system/contracts/AdminCondition.sim b/src/system/contracts/AdminCondition.sim index 9e13929c2..45b455ba9 100644 --- a/src/system/contracts/AdminCondition.sim +++ b/src/system/contracts/AdminCondition.sim @@ -5,22 +5,21 @@ contract AdminCondition { conditions { - if EcosysParam("founder_account") == $key_id { + // check for Founder + if EcosysParam("founder_account") == AddressToId($account_id) { return } - $system_app_id = DBFind("@1applications").Where({"ecosystem": $ecosystem_id, "name": "System"}).One("id") - var role_id_param string - role_id_param = AppParam(Int($system_app_id), "role_admin", $ecosystem_id) - if Size(role_id_param) == 0 { - warning "Sorry, you do not have access to this action" - } - - var role_id int - role_id = Int(role_id_param) + // check for Admin role + var app_id int role_id string + app_id = Int(DBFind("@1applications").Where({"ecosystem": $ecosystem_id, "name": "System"}).One("id")) + role_id = AppParam(app_id, "role_admin", $ecosystem_id) - if !RoleAccess(role_id) { - warning "Sorry, you do not have access to this action" + if Size(role_id) == 0 { + warning "AdminCondition: Sorry, you do not have access to this action" + } + if !RoleAccess(Int(role_id)) { + warning "AdminCondition: Sorry, you do not have access to this action" } } } \ No newline at end of file diff --git a/src/system/contracts/AppInstall.sim b/src/system/contracts/AppInstall.sim index 0e8cf1f8c..127f301da 100644 --- a/src/system/contracts/AppInstall.sim +++ b/src/system/contracts/AppInstall.sim @@ -4,6 +4,8 @@ contract AppInstall { } conditions { + DeveloperCondition() + $check_app = DBFind("@1applications").Columns("id,ecosystem,name,conditions").Where({"id": $ApplicationId, "ecosystem": 1}).Row() if !$check_app["id"] { warning LangRes("@1item_not_found", "en") @@ -32,13 +34,7 @@ contract AppInstall { var app_ins map app_ins["app_name"] = $app_name - $import_id = DBFind("@1buffer_data").Where({"member_id": $key_id, "key": "import_info", "ecosystem": $ecosystem_id}).One("id") - if $import_id { - $import_id = Int($import_id) - DBUpdate("@1buffer_data", $import_id, {"value": app_ins}) - } else { - DBInsert("@1buffer_data", {"member_id": $key_id, "key": "import_info", "value": app_ins, "ecosystem": $ecosystem_id}) - } + @1BufferManager("Action,Key,Val", "set", "import_info", JSONEncode(app_ins)) //import var i int diff --git a/src/system/contracts/AppendMenu.sim b/src/system/contracts/AppendMenu.sim index 5d4bbe192..5bc3de60d 100644 --- a/src/system/contracts/AppendMenu.sim +++ b/src/system/contracts/AppendMenu.sim @@ -5,6 +5,8 @@ contract AppendMenu { } conditions { + DeveloperCondition() + ConditionById("menu", false) } @@ -14,6 +16,5 @@ contract AppendMenu { var val string val = row["value"] + "\r\n" + $Value DBUpdate("@1menu", $Id, {"value": val}) - } } \ No newline at end of file diff --git a/src/system/contracts/AppendPage.sim b/src/system/contracts/AppendPage.sim index 4da3bc722..cb4b82326 100644 --- a/src/system/contracts/AppendPage.sim +++ b/src/system/contracts/AppendPage.sim @@ -5,6 +5,8 @@ contract AppendPage { } conditions { + DeveloperCondition() + RowConditions("@1pages", $Id, false) } diff --git a/src/system/contracts/BindWallet.sim b/src/system/contracts/BindWallet.sim index 75bc3ba43..a4efc0a67 100644 --- a/src/system/contracts/BindWallet.sim +++ b/src/system/contracts/BindWallet.sim @@ -8,9 +8,7 @@ contract BindWallet { if GetContractByName("@1NotificationsSend") == 0 { warning LangRes("@1notifications_install_needed", "en") } else { - var w_id int - w_id = AddressToId($WalletId) - $request = DBFind("@1notifications").Columns("id").Where({"recipient->member_id": w_id, "page_name": "contract_bind_request", "page_params->contract_id": $Id, "ecosystem": $ecosystem_id, "closed": 0}) + $request = DBFind("@1notifications").Where({"recipient->account": $WalletId, "page_name": "contract_bind_request", "page_params->contract_id": $Id, "ecosystem": $ecosystem_id, "closed": 0}).Columns("id") if $request { warning LangRes("@1request_sent_already", "en") } @@ -18,7 +16,7 @@ contract BindWallet { var notific params map params["contract_id"] = $Id params["contract_name"] = $cur["name"] - notific["MemberId"] = AddressToId($WalletId) + notific["MemberAccount"] = $WalletId notific["Sender"] = 1 notific["Icon"] = "icon icon-link" notific["Header"] = LangRes("@1request_contract_binding", "en") @@ -33,7 +31,7 @@ contract BindWallet { if GetContractByName("@1NotificationsClose") == 0 { warning LangRes("@1notifications_install_needed", "en") } else { - $request = DBFind("@1notifications").Columns("id").Where({"recipient->member_id": $key_id, "page_name": "contract_bind_request", "page_params->contract_id": $Id, "ecosystem": $ecosystem_id, "closed": 0}) + $request = DBFind("@1notifications").Where({"recipient->account": $account_id, "page_name": "contract_bind_request", "page_params->contract_id": $Id, "ecosystem": $ecosystem_id, "closed": 0}).Columns("id") var i int r map while i < Len($request) { r = $request[i] @@ -46,18 +44,20 @@ contract BindWallet { } conditions { + DeveloperCondition() + $cur = DBFind("@1contracts").Columns("id,name,conditions,wallet_id").Where({"id": $Id, "ecosystem": $ecosystem_id}).Row() if !$cur { warning Sprintf(LangRes("@1contract_x_not_exist", "en"), $Id) } - if $WalletId != "" && AddressToId($WalletId) == 0 { + if Size($WalletId) == 0 { warning LangRes("@1wallet_not_found", "en") } RowConditions("@1contracts", $Id, false) } action { - if $WalletId == "" || AddressToId($WalletId) == $key_id { + if $WalletId == "" || $WalletId == $account_id { BndWallet($Id, $ecosystem_id) closeInvite() } else { diff --git a/src/system/contracts/BufferFileUpload.sim b/src/system/contracts/BufferFileUpload.sim new file mode 100644 index 000000000..7dd50e33c --- /dev/null +++ b/src/system/contracts/BufferFileUpload.sim @@ -0,0 +1,29 @@ +contract BufferFileUpload { + data { + AppId int + BufferKey string + FileName string "optional" + FileData file + } + + conditions { + var app_id int + app_id = DBFind("@1applications").Where({"id": $AppId, "deleted": 0}).One("id") + if !app_id { + warning LangRes("@1app_not_found", "en") + } + if $BufferKey == "" { + warning LangRes("@1buffer_key_empty", "en") + } + } + + action { + var buffer_data map + if $FileName != "" { + buffer_data["binary_id"] = @1UploadFile("Name,Data,ApplicationId", $FileName, $FileData, Int($AppId)) + } else { + buffer_data["binary_id"] = @1UploadFile("Data,ApplicationId", $FileData, Int($AppId)) + } + @1BufferManager("Action,Key,Val", "set", $BufferKey, JSONEncode(buffer_data)) + } +} \ No newline at end of file diff --git a/src/system/contracts/BufferManager.sim b/src/system/contracts/BufferManager.sim new file mode 100644 index 000000000..63156c94e --- /dev/null +++ b/src/system/contracts/BufferManager.sim @@ -0,0 +1,56 @@ +contract BufferManager { + data { + Action string + Key string + Val string "optional" + } + + func decodeArray(s string) array { + var ar array + if HasPrefix($buf["value"], "[") { + ar = JSONDecode($buf["value"]) + } + return ar + } + + action { + $emptyVal = JSONEncode("") + $buf = DBFind("@1buffer_data").Where({"ecosystem": $ecosystem_id, "key": $Key, "account": $account_id}).Row() + if !$buf { + var buf map, id int + id = DBInsert("@1buffer_data", {"ecosystem": $ecosystem_id, "key": $Key, "value": $emptyVal, "account": $account_id}) + buf["id"] = Str(id) + buf["value"] = "" + buf["account"] = $account_id + buf["key"] = Str($Key) + $buf = buf + } + var id int + id = Int($buf["id"]) + if $Action == "clean" { + DBUpdate("@1buffer_data", id, {"value": $emptyVal}) + } + if $Action == "set" { + DBUpdate("@1buffer_data", id, {"value": $Val}) + } + if $Action == "array_add_value" { + var ar array enc string + ar = decodeArray($buf["value"]) + ar = Append(ar, $Val) + enc = JSONEncode(ar) + DBUpdate("@1buffer_data", id, {"value": enc}) + } + if $Action == "array_remove_value" { + var ar arNew array i int enc string + ar = decodeArray($buf["value"]) + while i < Len(ar){ + if ar[i] != $Val{ + arNew = Append(arNew, ar[i]) + } + i = i + 1 + } + enc = JSONEncode(arNew) + DBUpdate("@1buffer_data", id, {"value": enc}) + } + } +} \ No newline at end of file diff --git a/src/system/contracts/CallDelayedContract.sim b/src/system/contracts/CallDelayedContract.sim index a7067e58c..533f45fa4 100644 --- a/src/system/contracts/CallDelayedContract.sim +++ b/src/system/contracts/CallDelayedContract.sim @@ -13,8 +13,10 @@ contract CallDelayedContract { $cur = rows[0] $limit = Int($cur["limit"]) $counter = Int($cur["counter"]) - - if $key_id != Int($cur["key_id"]) { + var account_key int + account_key = AddressToId($account_id) + + if account_key != Int($cur["key_id"]) { warning LangRes("@1access_denied", "en") } diff --git a/src/system/contracts/DelApplication.sim b/src/system/contracts/DelApplication.sim index 02b7911cd..dcec22a95 100644 --- a/src/system/contracts/DelApplication.sim +++ b/src/system/contracts/DelApplication.sim @@ -5,6 +5,8 @@ contract DelApplication { } conditions { + DeveloperCondition() + if !DBFind("@1applications").Columns("id,ecosystem").Where({"id": $ApplicationId, "ecosystem": $ecosystem_id}) { warning LangRes("@1item_not_found", "en") } diff --git a/src/system/contracts/DeveloperCondition.sim b/src/system/contracts/DeveloperCondition.sim index 4a9891d92..a52b726dc 100644 --- a/src/system/contracts/DeveloperCondition.sim +++ b/src/system/contracts/DeveloperCondition.sim @@ -1,26 +1,25 @@ -// This contract is used to set "developer" rights. +// This contract is used to set "developer" rights. // Usually the "developer" role is used for this. // The role ID is written to the ecosystem parameter and can be changed. // The contract requests the role ID from the ecosystem parameter and the contract checks the rights. contract DeveloperCondition { conditions { - if EcosysParam("founder_account") == $key_id { + // check for Founder + if EcosysParam("founder_account") == AddressToId($account_id) { return } - $system_app_id = DBFind("@1applications").Where({"ecosystem": $ecosystem_id, "name": "System"}).One("id") - var role_id_param string - role_id_param = AppParam(Int($system_app_id), "role_developer", $ecosystem_id) - if Size(role_id_param) == 0 { - warning "Sorry, you do not have access to this action" - } - - var role_id int - role_id = Int(role_id_param) + // check for Developer role + var app_id int role_id string + app_id = Int(DBFind("@1applications").Where({"ecosystem": $ecosystem_id, "name": "System"}).One("id")) + role_id = AppParam(app_id, "role_developer", $ecosystem_id) - if !RoleAccess(role_id) { - warning "Sorry, you do not have access to this action" + if Size(role_id) == 0 { + warning "DeveloperCondition: Sorry, you do not have access to this action" + } + if !RoleAccess(Int(role_id)) { + warning "DeveloperCondition: Sorry, you do not have access to this action" } } } \ No newline at end of file diff --git a/src/system/contracts/EditAppParam.sim b/src/system/contracts/EditAppParam.sim index b4a3ad05a..300c86514 100644 --- a/src/system/contracts/EditAppParam.sim +++ b/src/system/contracts/EditAppParam.sim @@ -10,6 +10,8 @@ contract EditAppParam { } conditions { + DeveloperCondition() + if !DBFind("@1app_params").Columns("id,ecosystem").Where({"id": $Id, "ecosystem": $ecosystem_id}) { warning LangRes("@1item_not_found", "en") } diff --git a/src/system/contracts/EditApplication.sim b/src/system/contracts/EditApplication.sim index b421764b7..cdad34272 100644 --- a/src/system/contracts/EditApplication.sim +++ b/src/system/contracts/EditApplication.sim @@ -9,6 +9,8 @@ contract EditApplication { } conditions { + DeveloperCondition() + if !DBFind("@1applications").Columns("id,ecosystem").Where({"id": $ApplicationId, "ecosystem": $ecosystem_id}) { warning LangRes("@1item_not_found", "en") } diff --git a/src/system/contracts/EditBlock.sim b/src/system/contracts/EditBlock.sim index db7690a24..3aa20eea7 100644 --- a/src/system/contracts/EditBlock.sim +++ b/src/system/contracts/EditBlock.sim @@ -10,6 +10,8 @@ contract EditBlock { } conditions { + DeveloperCondition() + if !DBFind("@1blocks").Columns("id,ecosystem").Where({"id": $Id, "ecosystem": $ecosystem_id}) { warning LangRes("@1item_not_found", "en") } diff --git a/src/system/contracts/EditColumn.sim b/src/system/contracts/EditColumn.sim index e776043e3..3338576fb 100644 --- a/src/system/contracts/EditColumn.sim +++ b/src/system/contracts/EditColumn.sim @@ -7,6 +7,8 @@ contract EditColumn { } conditions { + DeveloperCondition() + $TableName = ToLower($TableName) if !DBFind("@1tables").Columns("name,ecosystem").Where({"name": $TableName, "ecosystem": $ecosystem_id}) { warning LangRes("@1item_not_found", "en") diff --git a/src/system/contracts/EditContract.sim b/src/system/contracts/EditContract.sim index a7dedaffb..9cea897c6 100644 --- a/src/system/contracts/EditContract.sim +++ b/src/system/contracts/EditContract.sim @@ -1,15 +1,17 @@ contract EditContract { data { - Id int + Id int Value string "optional" Conditions string "optional" } func onlyConditions() bool { - return $Conditions && !$Value + return $Conditions && !$Value } conditions { + DeveloperCondition() + RowConditions("@1contracts", $Id, onlyConditions()) if $Conditions { ValidateCondition($Conditions, $ecosystem_id) diff --git a/src/system/contracts/EditDelayedContract.sim b/src/system/contracts/EditDelayedContract.sim index eaf185a98..1b2cfd6b5 100644 --- a/src/system/contracts/EditDelayedContract.sim +++ b/src/system/contracts/EditDelayedContract.sim @@ -10,6 +10,8 @@ contract EditDelayedContract { } conditions { + DeveloperCondition() + ConditionById("delayed_contracts", true) if !HasPrefix($Contract, "@") { @@ -30,7 +32,8 @@ contract EditDelayedContract { } action { - DBUpdate("@1delayed_contracts", $Id, {"contract": $Contract,"key_id": $key_id, - "block_id": $BlockID,"every_block": $EveryBlock, "counter": 0,"limit": $Limit, "deleted": $Deleted,"conditions": $Conditions}) + var account_key int + account_key = AddressToId($account_id) + DBUpdate("@1delayed_contracts", $Id, {"contract": $Contract, "key_id": account_key, "block_id": $BlockID, "every_block": $EveryBlock, "counter": 0, "limit": $Limit, "deleted": $Deleted, "conditions": $Conditions}) } } \ No newline at end of file diff --git a/src/system/contracts/EditEcosystemName.sim b/src/system/contracts/EditEcosystemName.sim index 3ec90e38b..dd06f9ada 100644 --- a/src/system/contracts/EditEcosystemName.sim +++ b/src/system/contracts/EditEcosystemName.sim @@ -5,6 +5,8 @@ contract EditEcosystemName { } conditions { + DeveloperCondition() + var rows array rows = DBFind("@1ecosystems").Where({"id": $EcosystemID}) if !Len(rows) { diff --git a/src/system/contracts/EditLang.sim b/src/system/contracts/EditLang.sim index 0ab51cd2c..8ba12e71e 100644 --- a/src/system/contracts/EditLang.sim +++ b/src/system/contracts/EditLang.sim @@ -5,6 +5,8 @@ contract EditLang { } conditions { + DeveloperCondition() + EvalCondition("@1parameters", "changing_language", "value") $lang = DBFind("@1languages").Where({"id": $Id, "ecosystem": $ecosystem_id}).Row() if !$lang { diff --git a/src/system/contracts/EditMenu.sim b/src/system/contracts/EditMenu.sim index cf1f0b5da..d0827847a 100644 --- a/src/system/contracts/EditMenu.sim +++ b/src/system/contracts/EditMenu.sim @@ -11,6 +11,8 @@ contract EditMenu { } conditions { + DeveloperCondition() + if !DBFind("@1menu").Columns("id,ecosystem").Where({"id": $Id, "ecosystem": $ecosystem_id}) { warning LangRes("@1item_not_found", "en") } diff --git a/src/system/contracts/EditPage.sim b/src/system/contracts/EditPage.sim index 3ee10cd55..c08b790d5 100644 --- a/src/system/contracts/EditPage.sim +++ b/src/system/contracts/EditPage.sim @@ -27,6 +27,8 @@ contract EditPage { } conditions { + DeveloperCondition() + if !DBFind("@1pages").Columns("id,ecosystem").Where({"id": $Id, "ecosystem": $ecosystem_id}) { warning LangRes("@1item_not_found", "en") } diff --git a/src/system/contracts/EditParameter.sim b/src/system/contracts/EditParameter.sim index cd098460f..b92b95590 100644 --- a/src/system/contracts/EditParameter.sim +++ b/src/system/contracts/EditParameter.sim @@ -10,6 +10,8 @@ contract EditParameter { } conditions { + DeveloperCondition() + $Id = Int($Id) RowConditions("@1parameters", $Id, onlyConditions()) if $Conditions { @@ -18,7 +20,9 @@ contract EditParameter { $Name = DBFind("@1parameters").Where({"id": $Id, "ecosystem": $ecosystem_id}).One("name") if $Name == "founder_account" { - if !DBFind("@1members").Where({"id": $Value, "ecosystem": $ecosystem_id}).One("id") { + var account string + account = IdToAddress(Int($Value)) + if !DBFind("@1keys").Where({"account": account, "ecosystem": $ecosystem_id, "deleted": 0}).One("id") { warning Sprintf(LangRes("@1template_user_not_found", "en"), $Value) } } diff --git a/src/system/contracts/EditSection.sim b/src/system/contracts/EditSection.sim index 28a40f7f6..13c3583e0 100644 --- a/src/system/contracts/EditSection.sim +++ b/src/system/contracts/EditSection.sim @@ -8,6 +8,8 @@ contract EditSection { } conditions { + DeveloperCondition() + if DBFind("@1sections").Where({"urlname": $Urlname, "ecosystem": $ecosystem_id}) { warning LangRes("@1section_exist", "en") } @@ -24,7 +26,7 @@ contract EditSection { warning LangRes("@1main_section_warning", "en") } } - if !DBFind("@1sections").Columns("id").Where({"id": $Id, "ecosystem": $ecosystem_id}) { + if !DBFind("@1sections").Where({"id": $Id, "ecosystem": $ecosystem_id}).Columns("id") { warning Sprintf(LangRes("@1template_section_not_exist", "en"), $Id) } } diff --git a/src/system/contracts/EditTable.sim b/src/system/contracts/EditTable.sim index c6a71de17..1584b3c3d 100644 --- a/src/system/contracts/EditTable.sim +++ b/src/system/contracts/EditTable.sim @@ -8,6 +8,8 @@ contract EditTable { } conditions { + DeveloperCondition() + if !$InsertPerm { info LangRes("@1insert_condition_empty", "en") } diff --git a/src/system/contracts/Export.sim b/src/system/contracts/Export.sim index 1f9ccedf2..5b31dfb4a 100644 --- a/src/system/contracts/Export.sim +++ b/src/system/contracts/Export.sim @@ -99,8 +99,10 @@ contract Export { } conditions { + DeveloperCondition() + var buf app map - buf = DBFind("@1buffer_data").Columns("id,value->app_id,value->app_name").Where({"member_id": $key_id, "key": "export", "ecosystem": $ecosystem_id}).Row() + buf = DBFind("@1buffer_data").Columns("id,value->app_id,value->app_name").Where({"account": $account_id, "key": "export", "ecosystem": $ecosystem_id}).Row() if !buf { warning LangRes("@1app_not_selected", "en") } @@ -114,7 +116,6 @@ contract Export { $AppConditions = app["conditions"] $menus_names = [] - } action { diff --git a/src/system/contracts/ExportNewApp.sim b/src/system/contracts/ExportNewApp.sim index 3e80b07e8..8ba3da616 100644 --- a/src/system/contracts/ExportNewApp.sim +++ b/src/system/contracts/ExportNewApp.sim @@ -4,6 +4,8 @@ contract ExportNewApp { } conditions { + DeveloperCondition() + $app_map = DBFind("@1applications").Columns("id,name").Where({"id": $ApplicationId, "ecosystem": $ecosystem_id}).Row() if !$app_map{ warning LangRes("@1app_not_found", "en") @@ -24,7 +26,7 @@ contract ExportNewApp { if Len(pages_array) > 0 { var where_for_menu map - where_for_menu["name"] = {"$in" : pages_array} + where_for_menu["name"] = {"$in": pages_array} i = 0 var menu_ret array @@ -54,11 +56,6 @@ contract ExportNewApp { value["count_menu"] = "0" } - $buffer_id = DBFind("@1buffer_data").Where({"member_id": $key_id, "key": "export", "ecosystem": $ecosystem_id}).One("id") - if !$buffer_id { - DBInsert("@1buffer_data", {"member_id":$key_id,"key": "export", "value": value}) - } else { - DBUpdate("@1buffer_data", Int($buffer_id), {"value": value}) - } + @1BufferManager("Action,Key,Val", "set", "export", JSONEncode(value)) } } \ No newline at end of file diff --git a/src/system/contracts/Import.sim b/src/system/contracts/Import.sim index f819cdcb4..bea0c4e39 100644 --- a/src/system/contracts/Import.sim +++ b/src/system/contracts/Import.sim @@ -4,14 +4,16 @@ contract Import { } conditions { + DeveloperCondition() + $ApplicationId = 0 var app_map map - app_map = DBFind("@1buffer_data").Columns("value->app_name").Where({"key": "import_info", "member_id": $key_id, "ecosystem": $ecosystem_id}).Row() + app_map = DBFind("@1buffer_data").Columns("value->app_name").Where({"key": "import_info", "account": $account_id, "ecosystem": $ecosystem_id}).Row() if app_map { var app_id int ival string ival = Str(app_map["value.app_name"]) - app_id = DBFind("@1applications").Columns("id").Where({"name": ival, "ecosystem": $ecosystem_id}).One("id") + app_id = DBFind("@1applications").Where({"name": ival, "ecosystem": $ecosystem_id}).One("id") if app_id { $ApplicationId = Int(app_id) } diff --git a/src/system/contracts/ImportUpload.sim b/src/system/contracts/ImportUpload.sim index 65df867ea..2e78b3c61 100644 --- a/src/system/contracts/ImportUpload.sim +++ b/src/system/contracts/ImportUpload.sim @@ -4,28 +4,16 @@ contract ImportUpload { } conditions { + DeveloperCondition() + $Data = BytesToString($Data["Body"]) $limit = 10 // data piece size of import } action { // init buffer_data, cleaning old buffer - var initJson map - $import_id = DBFind("@1buffer_data").Where({"member_id": $key_id, "key": "import", "ecosystem": $ecosystem_id}).One("id") - if $import_id { - $import_id = Int($import_id) - DBUpdate("@1buffer_data", $import_id, {"value": initJson}) - } else { - $import_id = DBInsert("@1buffer_data", {"member_id": $key_id, "key": "import", "value": initJson, "ecosystem": $ecosystem_id}) - } - - $info_id = DBFind("@1buffer_data").Where({"member_id": $key_id, "key": "import_info", "ecosystem": $ecosystem_id}).One("id") - if $info_id { - $info_id = Int($info_id) - DBUpdate("@1buffer_data", $info_id, {"value": initJson}) - } else { - $info_id = DBInsert("@1buffer_data", {"member_id": $key_id,"key": "import_info", "value": initJson, "ecosystem": $ecosystem_id}) - } + @1BufferManager("Action,Key,Val", "clean", "import", "") + @1BufferManager("Action,Key,Val", "clean", "import_info", "") var input map arrData array input = JSONDecode($Data) @@ -107,15 +95,15 @@ contract ImportUpload { input["data"] = sliced // storing - DBUpdate("@1buffer_data", $import_id, {"value": input}) - DBUpdate("@1buffer_data", $info_id, {"value": inf}) + @1BufferManager("Action,Key,Val", "set", "import", JSONEncode(input)) + @1BufferManager("Action,Key,Val", "set", "import_info", JSONEncode(inf)) var name string name = Str(input["name"]) var cndns string cndns = Str(input["conditions"]) - if !DBFind("@1applications").Columns("id").Where({"name": name, "ecosystem": $ecosystem_id}).One("id") { + if !DBFind("@1applications").Where({"name": name, "ecosystem": $ecosystem_id}).One("id") { DBInsert("@1applications", {"name": name, "conditions": cndns, "ecosystem": $ecosystem_id}) } } diff --git a/src/system/contracts/ItemChangeAppId.sim b/src/system/contracts/ItemChangeAppId.sim index 515818fc5..07e87e580 100644 --- a/src/system/contracts/ItemChangeAppId.sim +++ b/src/system/contracts/ItemChangeAppId.sim @@ -6,6 +6,8 @@ contract ItemChangeAppId { } conditions { + DeveloperCondition() + if !DBFind($Table).Where({"id": $Id, "ecosystem": $ecosystem_id}).Row() { warning LangRes("@1item_not_found", "en") } diff --git a/src/system/contracts/MainCondition.sim b/src/system/contracts/MainCondition.sim index bb04a7b2a..a2196fdaa 100644 --- a/src/system/contracts/MainCondition.sim +++ b/src/system/contracts/MainCondition.sim @@ -1,6 +1,9 @@ +// This contract is used to set "Founder" rights. + contract MainCondition { conditions { - if EcosysParam("founder_account") != $key_id { + // check for Founder + if EcosysParam("founder_account") != AddressToId($account_id) { warning "MainCondition: Sorry, you do not have access to this action" } } diff --git a/src/system/contracts/NewAppParam.sim b/src/system/contracts/NewAppParam.sim index c01b4b418..c647a5dff 100644 --- a/src/system/contracts/NewAppParam.sim +++ b/src/system/contracts/NewAppParam.sim @@ -7,13 +7,15 @@ contract NewAppParam { } conditions { + DeveloperCondition() + ValidateCondition($Conditions, $ecosystem_id) if $ApplicationId == 0 { warning LangRes("@1aid_cannot_zero", "en") } - if DBFind("@1app_params").Columns("id").Where({"name": $Name, "ecosystem": $ecosystem_id, "app_id": $ApplicationId}).One("id") { + if DBFind("@1app_params").Where({"name": $Name, "ecosystem": $ecosystem_id, "app_id": $ApplicationId}).One("id") { warning Sprintf(LangRes("@1template_appparam_exists", "en"), $Name) } } diff --git a/src/system/contracts/NewApplication.sim b/src/system/contracts/NewApplication.sim index cb1b82851..89e135712 100644 --- a/src/system/contracts/NewApplication.sim +++ b/src/system/contracts/NewApplication.sim @@ -5,13 +5,15 @@ contract NewApplication { } conditions { + DeveloperCondition() + ValidateCondition($Conditions, $ecosystem_id) if Size($Name) == 0 { warning LangRes("@1app_name_missing", "en") } - if DBFind("@1applications").Columns("id").Where({"name": $Name, "ecosystem": $ecosystem_id}).One("id") { + if DBFind("@1applications").Where({"name": $Name, "ecosystem": $ecosystem_id}).One("id") { warning Sprintf(LangRes("@1template_app_exists", "en"), $Name) } } diff --git a/src/system/contracts/NewBlock.sim b/src/system/contracts/NewBlock.sim index 52d2ca590..31ffd566b 100644 --- a/src/system/contracts/NewBlock.sim +++ b/src/system/contracts/NewBlock.sim @@ -7,13 +7,15 @@ contract NewBlock { } conditions { + DeveloperCondition() + ValidateCondition($Conditions, $ecosystem_id) if $ApplicationId == 0 { warning LangRes("@1aid_cannot_zero", "en") } - if DBFind("@1blocks").Columns("id").Where({"name": $Name, "ecosystem": $ecosystem_id}).One("id") { + if DBFind("@1blocks").Where({"name": $Name, "ecosystem": $ecosystem_id}).One("id") { warning Sprintf(LangRes("@1template_block_exists", "en"), $Name) } } diff --git a/src/system/contracts/NewColumn.sim b/src/system/contracts/NewColumn.sim index a7dea0163..d43f2a7fe 100644 --- a/src/system/contracts/NewColumn.sim +++ b/src/system/contracts/NewColumn.sim @@ -8,6 +8,8 @@ contract NewColumn { } conditions { + DeveloperCondition() + var permissions map permissions["update"] = $UpdatePerm permissions["read"] = $ReadPerm diff --git a/src/system/contracts/NewContract.sim b/src/system/contracts/NewContract.sim index e607312c2..3d4fac0e7 100644 --- a/src/system/contracts/NewContract.sim +++ b/src/system/contracts/NewContract.sim @@ -7,6 +7,8 @@ contract NewContract { } conditions { + DeveloperCondition() + ValidateCondition($Conditions,$ecosystem_id) if $ApplicationId == 0 { diff --git a/src/system/contracts/NewDelayedContract.sim b/src/system/contracts/NewDelayedContract.sim index a361047ec..55d1c8276 100644 --- a/src/system/contracts/NewDelayedContract.sim +++ b/src/system/contracts/NewDelayedContract.sim @@ -8,6 +8,8 @@ contract NewDelayedContract { } conditions { + DeveloperCondition() + ValidateCondition($Conditions, $ecosystem_id) if !HasPrefix($Contract, "@") { @@ -28,6 +30,8 @@ contract NewDelayedContract { } action { - DBInsert("@1delayed_contracts", {"contract": $Contract, "key_id": $key_id, "block_id": $BlockID, "every_block": $EveryBlock, "limit": $Limit, "conditions": $Conditions}) + var account_key int + account_key = AddressToId($account_id) + DBInsert("@1delayed_contracts", {"contract": $Contract, "key_id": account_key, "block_id": $BlockID, "every_block": $EveryBlock, "limit": $Limit, "conditions": $Conditions}) } } \ No newline at end of file diff --git a/src/system/contracts/NewEcosystem.sim b/src/system/contracts/NewEcosystem.sim index 8207f0098..7d9fdc762 100644 --- a/src/system/contracts/NewEcosystem.sim +++ b/src/system/contracts/NewEcosystem.sim @@ -4,12 +4,16 @@ contract NewEcosystem { } conditions { + DeveloperCondition() + if !$Name { warning LangRes("@1ecosystem_name_empty", "en") } } action { - $result = CreateEcosystem($key_id, $Name) + var account_key int + account_key = AddressToId($account_id) + $result = CreateEcosystem(account_key, $Name) } } \ No newline at end of file diff --git a/src/system/contracts/NewLang.sim b/src/system/contracts/NewLang.sim index c084c631a..a49e20bd7 100644 --- a/src/system/contracts/NewLang.sim +++ b/src/system/contracts/NewLang.sim @@ -5,8 +5,10 @@ contract NewLang { } conditions { + DeveloperCondition() + EvalCondition("@1parameters", "changing_language", "value") - if DBFind("@1languages").Columns("id").Where({"name": $Name, "ecosystem": $ecosystem_id}).One("id") { + if DBFind("@1languages").Where({"name": $Name, "ecosystem": $ecosystem_id}).One("id") { warning Sprintf(LangRes("@1template_langres_exists", "en"), $Name) } } diff --git a/src/system/contracts/NewMenu.sim b/src/system/contracts/NewMenu.sim index 016e50fa9..7587e1edf 100644 --- a/src/system/contracts/NewMenu.sim +++ b/src/system/contracts/NewMenu.sim @@ -7,9 +7,11 @@ contract NewMenu { } conditions { + DeveloperCondition() + ValidateCondition($Conditions,$ecosystem_id) - if DBFind("@1menu").Columns("id").Where({"name": $Name, "ecosystem": $ecosystem_id}).One("id") { + if DBFind("@1menu").Where({"name": $Name, "ecosystem": $ecosystem_id}).One("id") { warning Sprintf(LangRes("@1template_menu_exists", "en"), $Name) } } diff --git a/src/system/contracts/NewPage.sim b/src/system/contracts/NewPage.sim index c6c689b2a..689780413 100644 --- a/src/system/contracts/NewPage.sim +++ b/src/system/contracts/NewPage.sim @@ -25,13 +25,15 @@ contract NewPage { } conditions { + DeveloperCondition() + ValidateCondition($Conditions,$ecosystem_id) if $ApplicationId == 0 { warning LangRes("@1aid_cannot_zero", "en") } - if DBFind("@1pages").Columns("id").Where({"name": $Name, "ecosystem": $ecosystem_id}).One("id") { + if DBFind("@1pages").Where({"name": $Name, "ecosystem": $ecosystem_id}).One("id") { warning Sprintf(LangRes("@1template_page_exists", "en"), $Name) } diff --git a/src/system/contracts/NewParameter.sim b/src/system/contracts/NewParameter.sim index 03dbe9925..968af307f 100644 --- a/src/system/contracts/NewParameter.sim +++ b/src/system/contracts/NewParameter.sim @@ -6,9 +6,11 @@ contract NewParameter { } conditions { + DeveloperCondition() + ValidateCondition($Conditions, $ecosystem_id) - if DBFind("@1parameters").Columns("id").Where({"name": $Name, "ecosystem": $ecosystem_id}).One("id") { + if DBFind("@1parameters").Where({"name": $Name, "ecosystem": $ecosystem_id}).One("id") { warning Sprintf(LangRes("@1template_parameter_exists", "en"), $Name) } } diff --git a/src/system/contracts/NewSection.sim b/src/system/contracts/NewSection.sim index f99ed4ef5..b4dedf957 100644 --- a/src/system/contracts/NewSection.sim +++ b/src/system/contracts/NewSection.sim @@ -7,6 +7,8 @@ contract NewSection { } conditions { + DeveloperCondition() + if $Status < 0 || $Status > 2 { warning LangRes("@1status_must_0_2", "en") } diff --git a/src/system/contracts/NewTable.sim b/src/system/contracts/NewTable.sim index 948c9e720..38a0b88fd 100644 --- a/src/system/contracts/NewTable.sim +++ b/src/system/contracts/NewTable.sim @@ -7,6 +7,8 @@ contract NewTable { } conditions { + DeveloperCondition() + if $ApplicationId == 0 { warning LangRes("@1aid_cannot_zero", "en") } diff --git a/src/system/contracts/NewUser.sim b/src/system/contracts/NewUser.sim index 53a8def89..5a5757047 100644 --- a/src/system/contracts/NewUser.sim +++ b/src/system/contracts/NewUser.sim @@ -1,20 +1,45 @@ contract NewUser { data { - NewPubkey string + NewPubkey string "optional" + Account string "optional" } + conditions { - $id = PubToID($NewPubkey) - if $id == 0 { - error LangRes("@1wrong_pub", "en") + $newId = PubToID($NewPubkey) + + if $newId == 0 { + warning LangRes("@1wrong_pub", "en") } - if DBFind("keys").Columns("id").WhereId($id).One("id") != nil { - error LangRes("@1template_user_exists", "en") + if DBFind("@1keys").Where({"id": $newId, "ecosystem": $ecosystem_id}).One("id") != nil { + warning Sprintf(LangRes("@1template_user_exists", "en"), IdToAddress($newId)) } - } - action { + + if Size($NewPubkey) == 0 { + warning "You did not enter the public key" + } + $pub = HexToPub($NewPubkey) - $account = IdToAddress($id) $amount = Money(1000) * Money(1000000000000000000) - DBInsert("keys", {"id": $id, "account": $account, "pub": $pub, "amount": $amount, "ecosystem": 1}) + + if Size($Account) > 0 { + $k_id = DBFind("@1keys").Where({"account": $Account, "ecosystem": $ecosystem_id, "deleted": 0}).One("id") + if $k_id == nil { + warning "Account not found" + } + } + } + + action { + if Size($Account) > 0 { + $account = $Account + DBInsert("keys", {"id": $newId, "account": $account, "pub": $pub, "amount": $amount, "ecosystem": 1}) + $result = $account + + DBUpdate("@1keys", Int($k_id), {"deleted": 1}) + } else { + $account = IdToAddress($newId) + DBInsert("keys", {"id": $newId, "account": $account, "pub": $pub, "amount": $amount, "ecosystem": 1}) + $result = $account + } } } \ No newline at end of file diff --git a/src/system/contracts/NodeOwnerCondition.sim b/src/system/contracts/NodeOwnerCondition.sim index 3bb7f52c1..359389de1 100644 --- a/src/system/contracts/NodeOwnerCondition.sim +++ b/src/system/contracts/NodeOwnerCondition.sim @@ -8,7 +8,7 @@ contract NodeOwnerCondition { var i int while i < Len($full_nodes) { $fn = $full_nodes[i] - if $fn["key_id"] == $key_id { + if $fn["key_id"] == AddressToId($account_id) { return true } i = i + 1 diff --git a/src/system/contracts/PlatformAppsInstall.sim b/src/system/contracts/PlatformAppsInstall.sim index 226f2804d..f2c8636da 100644 --- a/src/system/contracts/PlatformAppsInstall.sim +++ b/src/system/contracts/PlatformAppsInstall.sim @@ -2,6 +2,8 @@ contract PlatformAppsInstall { data {} conditions { + DeveloperCondition() + $basic_id = DBFind("@1applications").Where({"ecosystem": 1, "name": "Basic", "deleted": 0}).One("id") $system_id = DBFind("@1applications").Where({"ecosystem": 1, "name": "System", "deleted": 0}).One("id") } diff --git a/src/system/contracts/SectionLevelDown.sim b/src/system/contracts/SectionLevelDown.sim index 5e312f1a4..2a3d112cb 100644 --- a/src/system/contracts/SectionLevelDown.sim +++ b/src/system/contracts/SectionLevelDown.sim @@ -4,10 +4,12 @@ contract SectionLevelDown { } conditions { - if !DBFind("@1sections").Columns("id").Where({"id": $Id, "ecosystem": $ecosystem_id}) { + DeveloperCondition() + + if !DBFind("@1sections").Where({"id": $Id, "ecosystem": $ecosystem_id}).Columns("id") { warning Sprintf(LangRes("@1template_section_not_exist", "en"), $Id) } - $next = DBFind("@1sections").Columns("id").Where({"id": {"$gt": $Id}, "ecosystem": $ecosystem_id}) + $next = DBFind("@1sections").Where({"id": {"$gt": $Id}, "ecosystem": $ecosystem_id}).Columns("id") if !$next { warning LangRes("@1section_already_bottom", "en") } @@ -17,7 +19,7 @@ contract SectionLevelDown { var next_id int var last_id int next_id = $Id + 1 - $max_id = DBFind("@1sections").Columns("id").Order({"id":"-1"}).One("id") + $max_id = DBFind("@1sections").Order({"id": "-1"}).One("id") last_id = $max_id + 1 DBUpdate("@1sections", next_id, {"id":last_id}) DBUpdate("@1sections", $Id, {"id":next_id}) diff --git a/src/system/contracts/SectionLevelUp.sim b/src/system/contracts/SectionLevelUp.sim index ecb48411e..489c99ad1 100644 --- a/src/system/contracts/SectionLevelUp.sim +++ b/src/system/contracts/SectionLevelUp.sim @@ -4,10 +4,12 @@ contract SectionLevelUp { } conditions { - if !DBFind("@1sections").Columns("id").Where({"id": $Id, "ecosystem": $ecosystem_id}) { + DeveloperCondition() + + if !DBFind("@1sections").Where({"id": $Id, "ecosystem": $ecosystem_id}).Columns("id") { warning Sprintf(LangRes("@1template_section_not_exist", "en"), $Id) } - $next = DBFind("@1sections").Columns("id").Where({"id": {"$lt": $Id}, "ecosystem": $ecosystem_id}) + $next = DBFind("@1sections").Where({"id": {"$lt": $Id}, "ecosystem": $ecosystem_id}).Columns("id") if !$next { warning LangRes("@1section_already_top", "en") } @@ -17,7 +19,7 @@ contract SectionLevelUp { var next_id int var last_id int next_id = $Id - 1 - $max_id = DBFind("@1sections").Columns("id").Order({"id":"-1"}).One("id") + $max_id = DBFind("@1sections").Order({"id": "-1"}).One("id") last_id = $max_id + 1 DBUpdate("@1sections", next_id, {"id":last_id}) DBUpdate("@1sections", $Id, {"id":next_id}) diff --git a/src/system/contracts/SectionRoles.sim b/src/system/contracts/SectionRoles.sim index 684abf0f5..391bd8f57 100644 --- a/src/system/contracts/SectionRoles.sim +++ b/src/system/contracts/SectionRoles.sim @@ -6,6 +6,8 @@ contract SectionRoles { } conditions { + DeveloperCondition() + if $Operation == "add" { var roles_id map json array i int roles_id = DBFind("@1sections").Columns("roles_access").Where({"id": $Id, "ecosystem": $ecosystem_id}).Row() diff --git a/src/system/contracts/SelectApp.sim b/src/system/contracts/SelectApp.sim index 5634cdac0..de8ad67ca 100644 --- a/src/system/contracts/SelectApp.sim +++ b/src/system/contracts/SelectApp.sim @@ -4,6 +4,8 @@ contract SelectApp { } conditions { + DeveloperCondition() + $app = DBFind("@1applications").Columns("id,name").Where({"id": $ApplicationId, "ecosystem": $ecosystem_id}).Row() if !$app { LangRes("@1app_not_found", "en") @@ -11,15 +13,10 @@ contract SelectApp { } action { - var value map bufferId int + var value map value["app_id"] = Str($ApplicationId) value["app_name"] = $app["name"] - bufferId = Int(DBFind("@1buffer_data").Where({"member_id": $key_id, "key": "export", "ecosystem": $ecosystem_id}).One("id")) - if bufferId > 0 { - DBUpdate("@1buffer_data", bufferId, {"value": value}) - } else { - DBInsert("@1buffer_data", {"member_id": $key_id,"key": "export","value": value, ecosystem: $ecosystem_id}) - } + @1BufferManager("Action,Key,Val", "set", "export", JSONEncode(value)) } } \ No newline at end of file diff --git a/src/system/contracts/UnbindWallet.sim b/src/system/contracts/UnbindWallet.sim index 9b5881c81..9d910cc1f 100644 --- a/src/system/contracts/UnbindWallet.sim +++ b/src/system/contracts/UnbindWallet.sim @@ -4,6 +4,8 @@ contract UnbindWallet { } conditions { + DeveloperCondition() + $cur = DBFind("@1contracts").Columns("id,conditions,wallet_id").Where({"id": $Id, "ecosystem": $ecosystem_id}).Row() if !$cur { warning Sprintf(LangRes("@1contract_x_not_exist", "en"), $Id) @@ -11,7 +13,7 @@ contract UnbindWallet { if Int($cur["wallet_id"]) == 0 { warning Sprintf(LangRes("@1contract_x_unbinded_already", "en"), $Id) } - if $key_id != Int($cur["wallet_id"]) { + if AddressToId($account_id) != Int($cur["wallet_id"]) { warning LangRes("@1contract_cannot_unbind", "en") } RowConditions("@1contracts", $Id, false) diff --git a/src/system/contracts/UpdateMetrics.sim b/src/system/contracts/UpdateMetrics.sim index b0de02e6d..c80fa3734 100644 --- a/src/system/contracts/UpdateMetrics.sim +++ b/src/system/contracts/UpdateMetrics.sim @@ -17,7 +17,7 @@ contract UpdateMetrics { inmap["key"] = v["key"] inmap["metric"] = v["metric"] - id = Int(DBFind("@1metrics").Columns("id").Where(inmap).One("id")) + id = Int(DBFind("@1metrics").Where(inmap).One("id")) var ival int if id != 0 { ival = Int(v["value"]) diff --git a/src/system/contracts/UploadBinary.sim b/src/system/contracts/UploadBinary.sim index 350358304..c9bd030e6 100644 --- a/src/system/contracts/UploadBinary.sim +++ b/src/system/contracts/UploadBinary.sim @@ -4,10 +4,19 @@ contract UploadBinary { Name string Data bytes DataMimeType string "optional" + MemberAccount string "optional" } conditions { - $Id = Int(DBFind("@1binaries").Columns("id").Where({"app_id": $ApplicationId, "member_id": $key_id, "name": $Name, "ecosystem": $ecosystem_id}).One("id")) + DeveloperCondition() + + if Size($MemberAccount) > 0 { + $UserID = $MemberAccount + } else { + $UserID = $account_id + } + + $Id = Int(DBFind("@1binaries").Where({"app_id": $ApplicationId, "account": $UserID, "name": $Name, "ecosystem": $ecosystem_id}).One("id")) if $Id == 0 { if $ApplicationId == 0 { @@ -27,9 +36,9 @@ contract UploadBinary { if $Id != 0 { DBUpdate("@1binaries", $Id, {"data": $Data, "hash": hash, "mime_type": $DataMimeType}) } else { - $Id = DBInsert("@1binaries", {"app_id": $ApplicationId, "member_id": $key_id, "name": $Name, "data": $Data, "hash": hash, "mime_type": $DataMimeType, "ecosystem": $ecosystem_id}) + $Id = DBInsert("@1binaries", {"app_id": $ApplicationId, "account": $UserID, "name": $Name, "data": $Data, "hash": hash, "mime_type": $DataMimeType, "ecosystem": $ecosystem_id}) } $result = $Id } -} +} \ No newline at end of file diff --git a/src/system/pages/app_binary.ptl b/src/system/pages/app_binary.ptl index 4c208314b..624b79385 100644 --- a/src/system/pages/app_binary.ptl +++ b/src/system/pages/app_binary.ptl @@ -1,49 +1,62 @@ -DBFind(@1buffer_data, src_buffer).Columns("value->app_id").Where({"key": export, "member_id": #key_id#, "ecosystem": #ecosystem_id#}).Vars(buffer) -If(#buffer_value_app_id# > 0){ - DBFind(@1applications, src_app).Where({"id": #buffer_value_app_id#, "ecosystem": #ecosystem_id#}).Vars("application") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) - Div(mr-lg ml-lg){ - SetTitle($@1binaries$: #application_name#) - AddToolButton(Title:$@1binary_upload$, Page: @1app_upload_binary, Icon: icon-plus, PageParams: "application_id=#application_id#") +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + DBFind("@1buffer_data", src_buffer).Columns("value->app_id").Where({"key": "export", "account": "#account_id#", "ecosystem": "#ecosystem_id#"}).Vars(buffer) + If(#buffer_value_app_id# > 0){ + DBFind("@1applications", src_app).Where({"id": "#buffer_value_app_id#", "ecosystem": "#ecosystem_id#"}).Vars(application) - SetVar(this_table, @1binaries).(this_page, @1app_binary).(pager_limit, 50) - SetVar(where, {"app_id": #buffer_value_app_id#, "ecosystem": #ecosystem_id#}) - SetVar(hideLink, 0) - Include(@1pager_header) - Include(@1admin_link) + Div(mr-lg ml-lg){ + SetTitle($@1binaries$: #application_name#) + AddToolButton(Title:$@1binary_upload$, Page: @1app_upload_binary, Icon: icon-plus, PageParams: "application_id=#application_id#") - DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#).Custom(_name){ - LinkPage(Page: @1app_upload_binary, PageParams: "id=#id#,application_id=#buffer_value_app_id#", Body: #name#) - }.Custom(_img){ - Div(pull-right){ - Image(Src: Binary().ById(#id#), Class: preview).Style(height: 40px; widht 40px;) - } - }.Count(cnt) + SetVar(this_table, @1binaries).(this_page, @1app_binary).(pager_limit, 50) + SetVar(where, {"app_id": "#buffer_value_app_id#", "ecosystem": "#ecosystem_id#"}) + SetVar(hideLink, 0) + Include(@1pager_header) + Include(@1admin_link) + + DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#).Custom(_name){ + LinkPage(Page: @1app_upload_binary, PageParams: "id=#id#,application_id=#buffer_value_app_id#", Body: #name#) + }.Custom(_img){ + Div(pull-right){ + Image(Src: Binary().ById(#id#), Class: preview).Style(height: 40px; widht 40px;) + } + }.Count(cnt) - Form(panel panel-primary){ - Div(panel-body){ - Div(row){ - Div(col-md-#width# col-sm-12){ - If(#cnt#>0){ - Div(list-group-item){ - Div(row){ - Div(col-md-12){ - Table(src,"=_name,=data,=_img") + Form(panel panel-primary){ + Div(panel-body){ + Div(row){ + Div(col-md-#width# col-sm-12){ + If(#cnt#>0){ + Div(list-group-item){ + Div(row){ + Div(col-md-12){ + Table(src,"=_name,=data,=_img") + } } } } } } - } - Div(mt){ - Include(@1pager) + Div(mt){ + Include(@1pager) + } } } } + }.Else{ + SetTitle($@1binaries$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1apps_select_error$) + } } }.Else{ SetTitle($@1binaries$) Div(breadcrumb){ - Span(Class: text-muted, Body: $@1apps_select_error$) + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) } } \ No newline at end of file diff --git a/src/system/pages/app_blocks.ptl b/src/system/pages/app_blocks.ptl index 4c8c18509..4ec3f55b4 100644 --- a/src/system/pages/app_blocks.ptl +++ b/src/system/pages/app_blocks.ptl @@ -1,48 +1,61 @@ -DBFind(@1buffer_data, src_buffer).Columns("value->app_id").Where({"key": export, "member_id": #key_id#, "ecosystem": #ecosystem_id#}).Vars(buffer) -If(#buffer_value_app_id# > 0){ - DBFind(@1applications, src_app).Where({"id": #buffer_value_app_id#, "ecosystem": #ecosystem_id#}).Vars("application") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) - Div(mr-lg ml-lg){ - SetTitle($@1blocks$: #application_name#) - AddToolButton(Title: $@1create$, Page: editor, Icon: icon-plus, PageParams: "create=block,appId=#buffer_value_app_id#") +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + DBFind("@1buffer_data", src_buffer).Columns("value->app_id").Where({"key": "export", "account": "#account_id#", "ecosystem": "#ecosystem_id#"}).Vars(buffer) + If(#buffer_value_app_id# > 0){ + DBFind("@1applications", src_app).Where({"id": "#buffer_value_app_id#", "ecosystem": "#ecosystem_id#"}).Vars(application) - SetVar(this_table, @1blocks).(this_page, @1app_blocks).(pager_limit, 50) - SetVar(where, {"app_id": #buffer_value_app_id#, "ecosystem": #ecosystem_id#}) - Include(@1pager_header) - Include(@1admin_link) + Div(mr-lg ml-lg){ + SetTitle($@1blocks$: #application_name#) + AddToolButton(Title: $@1create$, Page: editor, Icon: icon-plus, PageParams: "create=block,appId=#buffer_value_app_id#") - DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#) + SetVar(this_table, @1blocks).(this_page, @1app_blocks).(pager_limit, 50) + SetVar(where, {"app_id": "#buffer_value_app_id#", "ecosystem": "#ecosystem_id#"}) + Include(@1pager_header) + Include(@1admin_link) - Form(panel panel-primary){ - Div(panel-body){ - Div(row){ - ForList(src){ - Div(col-md-#width# col-sm-12){ - Div(list-group-item){ - Div(row){ - Div(col-md-4){ - LinkPage(Body: "#name#", Class: text-primary, Page: editor, PageParams: "open=block,name=#name#") - } - Div(col-md-8){ - Div(pull-right){ - LinkPage(Body: Em(Class: fa fa-history), Class: text-primary h4 mh-sm, Page: @1history, PageParams: "id=#id#,type=block") - LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4 mh-sm, Page: @1properties_edit, PageParams: "edit_property_id=#id#,type=block") + DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#) + + Form(panel panel-primary){ + Div(panel-body){ + Div(row){ + ForList(src){ + Div(col-md-#width# col-sm-12){ + Div(list-group-item){ + Div(row){ + Div(col-md-4){ + LinkPage(Body: "#name#", Class: text-primary, Page: editor, PageParams: "open=block,name=#name#") + } + Div(col-md-8){ + Div(pull-right){ + LinkPage(Body: Em(Class: fa fa-history), Class: text-primary h4 mh-sm, Page: @1history, PageParams: "id=#id#,type=block") + LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4 mh-sm, Page: @1properties_edit, PageParams: "edit_property_id=#id#,type=block") + } } } } } } } - } - Div(mt){ - Include(@1pager) + Div(mt){ + Include(@1pager) + } } } } + }.Else{ + SetTitle($@1blocks$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1apps_select_error$) + } } }.Else{ SetTitle($@1blocks$) Div(breadcrumb){ - Span(Class: text-muted, Body: $@1apps_select_error$) + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) } } \ No newline at end of file diff --git a/src/system/pages/app_contracts.ptl b/src/system/pages/app_contracts.ptl index e1f6ca11d..6b8423c22 100644 --- a/src/system/pages/app_contracts.ptl +++ b/src/system/pages/app_contracts.ptl @@ -1,38 +1,46 @@ -DBFind(@1buffer_data, src_buffer).Columns("value->app_id").Where({"key": export, "member_id": #key_id#, "ecosystem": #ecosystem_id#}).Vars(buffer) -If(#buffer_value_app_id# > 0){ - DBFind(@1applications, src_app).Where({"id": #buffer_value_app_id#, "ecosystem": #ecosystem_id#}).Vars("application") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) - Div(mr-lg ml-lg){ - SetTitle($@1contracts$: #application_name#) - AddToolButton(Title: $@1create$, Page: editor, Icon: icon-plus, PageParams: "create=contract,appId=#buffer_value_app_id#") +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + DBFind("@1buffer_data", src_buffer).Columns("value->app_id").Where({"key": "export", "account": "#account_id#", "ecosystem": "#ecosystem_id#"}).Vars(buffer) + If(#buffer_value_app_id# > 0){ + DBFind("@1applications", src_app).Where({"id": "#buffer_value_app_id#", "ecosystem": "#ecosystem_id#"}).Vars(application) - SetVar(this_table, @1contracts).(this_page, @1app_contracts).(pager_limit, 50) - SetVar(where, {"app_id": #buffer_value_app_id#, "ecosystem": #ecosystem_id#}) - Include(@1pager_header) - Include(@1admin_link) + Div(mr-lg ml-lg){ + SetTitle($@1contracts$: #application_name#) + AddToolButton(Title: $@1create$, Page: editor, Icon: icon-plus, PageParams: "create=contract,appId=#buffer_value_app_id#") - DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#) + SetVar(this_table, @1contracts).(this_page, @1app_contracts).(pager_limit, 50) + SetVar(where, {"app_id": "#buffer_value_app_id#", "ecosystem": "#ecosystem_id#"}) + Include(@1pager_header) + Include(@1admin_link) - Form(panel panel-primary){ - Div(panel-body){ - Div(row){ - ForList(src){ - Div(col-md-#width# col-sm-12){ - Div(list-group-item){ - Div(row){ - Div(col-md-4){ - LinkPage(Body: #name#, Class: text-primary, Page: editor, PageParams: "open=contract,name=#name#") - } - Div(col-md-8){ - Div(pull-right){ - LinkPage(Body: Em(Class: fa fa-history), Class: text-primary h4 mh-sm, Page: @1history, PageParams: "id=#id#,type=contract") - LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4 mh-sm, Page: @1properties_edit, PageParams: "edit_property_id=#id#,type=contract") + DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#) + + Form(panel panel-primary){ + Div(panel-body){ + Div(row){ + ForList(src){ + Div(col-md-#width# col-sm-12){ + Div(list-group-item){ + Div(row){ + Div(col-md-4){ + LinkPage(Body: #name#, Class: text-primary, Page: editor, PageParams: "open=contract,name=#name#") } - Div(pull-right){ - If(#wallet_id# != 0){ - Span(Class: h5, Body: Em(Class: fa fa-check)).Style(margin-right: 50px;) - }.Else{ - Span(Class: h5 text-muted, Body: Em(Class: fa fa-minus)).Style(margin-right: 50px;) + Div(col-md-8){ + Div(pull-right){ + LinkPage(Body: Em(Class: fa fa-history), Class: text-primary h4 mh-sm, Page: @1history, PageParams: "id=#id#,type=contract") + LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4 mh-sm, Page: @1properties_edit, PageParams: "edit_property_id=#id#,type=contract") + } + Div(pull-right){ + If(#wallet_id# != 0){ + Span(Class: h5, Body: Em(Class: fa fa-check)).Style(margin-right: 50px;) + }.Else{ + Span(Class: h5 text-muted, Body: Em(Class: fa fa-minus)).Style(margin-right: 50px;) + } } } } @@ -40,16 +48,21 @@ If(#buffer_value_app_id# > 0){ } } } - } - Div(mt){ - Include(@1pager) + Div(mt){ + Include(@1pager) + } } } } + }.Else{ + SetTitle($@1contracts$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1apps_select_error$) + } } }.Else{ SetTitle($@1contracts$) Div(breadcrumb){ - Span(Class: text-muted, Body: $@1apps_select_error$) + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) } } \ No newline at end of file diff --git a/src/system/pages/app_edit.ptl b/src/system/pages/app_edit.ptl index 017448b58..f41bf5835 100644 --- a/src/system/pages/app_edit.ptl +++ b/src/system/pages/app_edit.ptl @@ -1,52 +1,65 @@ -Div(content-wrapper){ - SetTitle($@1application$) - Div(breadcrumb){ - LinkPage($@1applications$, @1apps_list) - Span(/).Style(margin-right: 10px; margin-left: 10px;) - If(#id# > 0){ - Span(Class: text-muted, Body: $@1editing$) - }.Else{ - Span(Class: text-muted, Body: $@1new_app$) - } - } +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) - Form(){ - If(#id# > 0){ - DBFind(@1applications, src_apps).Columns("id,name,conditions,deleted").Where({"id": #id#, "ecosystem": #ecosystem_id#}).Vars("application") - Div(form-group){ - Label($@1name$) - Input(Name: Name, Disabled: "true", Value: #application_name#) - } - Div(form-group){ - Label($@1change_conditions$) - Input(Name: Conditions, Value: #application_conditions#) +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + Div(content-wrapper){ + SetTitle($@1application$) + Div(breadcrumb){ + LinkPage($@1applications$, @1apps_list) + Span(/).Style(margin-right: 10px; margin-left: 10px;) + If(#id# > 0){ + Span(Class: text-muted, Body: $@1editing$) + }.Else{ + Span(Class: text-muted, Body: $@1new_app$) } - Div(form-group){ - Div(row){ - Div(text-left col-md-6){ - If(#application_deleted# == 0){ - Button(Body: $@1delete$, Class: btn btn-danger, Page: @1apps_list, Contract: @1DelApplication, Params: "ApplicationId=#application_id#,Value=1") + } + + Form(){ + If(#id# > 0){ + DBFind("@1applications", src_apps).Columns("id,name,conditions,deleted").Where({"id": "#id#", "ecosystem": "#ecosystem_id#"}).Vars(application) + Div(form-group){ + Label($@1name$) + Input(Name: Name, Disabled: "true", Value: #application_name#) + } + Div(form-group){ + Label($@1change_conditions$) + Input(Name: Conditions, Value: #application_conditions#) + } + Div(form-group){ + Div(row){ + Div(text-left col-md-6){ + If(#application_deleted# == 0){ + Button(Body: $@1delete$, Class: btn btn-danger, Page: @1apps_list, Contract: @1DelApplication, Params: "ApplicationId=#application_id#,Value=1") + } + } + Div(text-right col-md-6){ + Button(Body: $@1save$, Class: btn btn-primary, Page: @1apps_list, Contract: @1EditApplication, Params: "ApplicationId=#id#") } - } - Div(text-right col-md-6){ - Button(Body: $@1save$, Class: btn btn-primary, Page: @1apps_list, Contract: @1EditApplication, Params: "ApplicationId=#id#") } } - } - }.Else{ - Div(form-group){ - Label($@1name$) - Input(Name: Name) - } - Div(form-group){ - Label($@1change_conditions$) - Input(Name: Conditions) - } - Div(form-group){ - Div(text-right){ - Button(Body: $@1save$, Class: btn btn-primary, Page: @1apps_list, Contract: @1NewApplication) + }.Else{ + Div(form-group){ + Label($@1name$) + Input(Name: Name) + } + Div(form-group){ + Label($@1change_conditions$) + Input(Name: Conditions) + } + Div(form-group){ + Div(text-right){ + Button(Body: $@1save$, Class: btn btn-primary, Page: @1apps_list, Contract: @1NewApplication) + } } } } } +}.Else{ + SetTitle($@1application$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) + } } \ No newline at end of file diff --git a/src/system/pages/app_langres.ptl b/src/system/pages/app_langres.ptl index 11472b3fa..b410dec98 100644 --- a/src/system/pages/app_langres.ptl +++ b/src/system/pages/app_langres.ptl @@ -1,43 +1,56 @@ -SetVar(this_page, @1app_langres).(this_table, @1languages) -Include(@1pager_header) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) -SetTitle("$@1lang_res$") -Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$@1application_lang_res$")) -AddToolButton(Title: "$@1create$", Page: @1langres_add, Icon: icon-plus) +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + SetVar(this_page, @1app_langres).(this_table, @1languages) + Include(@1pager_header) -If(#search#){ - SetVar(where, {"ecosystem": #ecosystem_id#, {"$or": [{"name": {"$ilike": "#search#"}}, {"res": {"$ilike": "#search#"}}]}}) -}.Else{ - SetVar(where, {"ecosystem": #ecosystem_id#}) -} + SetTitle("$@1lang_res$") + Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$@1application_lang_res$")) + AddToolButton(Title: "$@1create$", Page: @1langres_add, Icon: icon-plus) + + If(#search#){ + SetVar(where, {"ecosystem": "#ecosystem_id#", "$or": [{"name": {"$ilike": "#search#"}}, {"res": {"$ilike": "#search#"}}]}) + }.Else{ + SetVar(where, {"ecosystem": "#ecosystem_id#"}) + } -Div(list-group-item ml-lg mr-lg pt-lg){ - SetVar(search_name, LangRes(@1name)) - Include(@1search) -} + Div(list-group-item ml-lg mr-lg pt-lg){ + SetVar(search_name, LangRes(@1name)) + Include(@1search) + } -DBFind(#this_table#, src).Where(#where#).Order({"name": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(lang_name){ - LinkPage(Page: @1langres_edit, Class: text-primary h5, Body: "#name#", PageParams: "lang_id=#id#") -}.Custom(_res){ - Span(Class: text-muted h6, Body: "#res#") -}.Count(count) + DBFind(#this_table#, src).Where(#where#).Order({"name": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(lang_name){ + LinkPage(Page: @1langres_edit, Class: text-primary h5, Body: "#name#", PageParams: "lang_id=#id#") + }.Custom(_res){ + Span(Class: text-muted h6, Body: "#res#") + }.Count(count) -Div(fullscreen){ - Div(table-responsive ml-lg mr-lg){ - Div(list-group-item){ - If(#count# > 0){ - Table(src, "$@1name$=lang_name,$@1value$=_res") - }.Else{ - Div(Class: text-center h4 text-muted, Body: "$@1lang_res$ $@1not_founded$") - } - }.Style( - margin-top:-15px; - tbody > tr:nth-of-type(odd) { - background-color: #f8f9fc; - } - ) + Div(fullscreen){ + Div(table-responsive ml-lg mr-lg){ + Div(list-group-item){ + If(#count# > 0){ + Table(src, "$@1name$=lang_name,$@1value$=_res") + }.Else{ + Div(Class: text-center h4 text-muted, Body: "$@1lang_res$ $@1not_founded$") + } + }.Style( + margin-top:-15px; + tbody > tr:nth-of-type(odd) { + background-color: #f8f9fc; + } + ) + } + } + Div(mt-sm ml-lg mr-sm mb-sm){ + Include(@1pager) + } +}.Else{ + SetTitle($@1lang_res$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) } -} -Div(mt-sm ml-lg mr-sm mb-sm){ - Include(@1pager) } \ No newline at end of file diff --git a/src/system/pages/app_pages.ptl b/src/system/pages/app_pages.ptl index 439c35652..9ddf2e70f 100644 --- a/src/system/pages/app_pages.ptl +++ b/src/system/pages/app_pages.ptl @@ -1,49 +1,62 @@ -DBFind(@1buffer_data, src_buffer).Columns("value->app_id").Where({"key": export, "member_id": #key_id#, "ecosystem": #ecosystem_id#}).Vars(buffer) -If(#buffer_value_app_id# > 0){ - DBFind(@1applications, src_app).Where({"id": #buffer_value_app_id#, "ecosystem": #ecosystem_id#}).Vars("application") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) - Div(mr-lg ml-lg){ - SetTitle($@1pages$ : #application_name#) - AddToolButton(Title: $@1create$, Page: editor, Icon: icon-plus, PageParams: "create=page,appId=#buffer_value_app_id#") +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + DBFind("@1buffer_data", src_buffer).Columns("value->app_id").Where({"key": "export", "account": "#account_id#", "ecosystem": "#ecosystem_id#"}).Vars(buffer) + If(#buffer_value_app_id# > 0){ + DBFind("@1applications", src_app).Where({"id": "#buffer_value_app_id#", "ecosystem": "#ecosystem_id#"}).Vars(application) - SetVar(this_table, @1pages).(this_page, @1app_pages).(pager_limit, 50) - SetVar(where, {"app_id": #buffer_value_app_id#, "ecosystem": #ecosystem_id#}) - Include(@1pager_header) - Include(@1admin_link) + Div(mr-lg ml-lg){ + SetTitle($@1pages$ : #application_name#) + AddToolButton(Title: $@1create$, Page: editor, Icon: icon-plus, PageParams: "create=page,appId=#buffer_value_app_id#") - DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#) + SetVar(this_table, @1pages).(this_page, @1app_pages).(pager_limit, 50) + SetVar(where, {"app_id": "#buffer_value_app_id#", "ecosystem": "#ecosystem_id#"}) + Include(@1pager_header) + Include(@1admin_link) - Form(panel panel-primary){ - Div(panel-body){ - Div(row){ - ForList(src){ - Div(col-md-#width# col-sm-12){ - Div(list-group-item){ - Div(row){ - Div(col-md-4){ - LinkPage(Body: #name#, Class: text-primary, Page: editor, PageParams: "open=page,name=#name#") - } - Div(col-md-8){ - Div(pull-right){ - LinkPage(Body: Em(Class: fa fa-eye), Class: text-primary h4 mh-sm, Page: "#name#") - LinkPage(Body: Em(Class: fa fa-history), Class: text-primary h4 mh-sm, Page: @1history, PageParams: "id=#id#,type=page") - LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4 mh-sm, Page: @1properties_edit, PageParams: "edit_property_id=#id#,type=page") + DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#) + + Form(panel panel-primary){ + Div(panel-body){ + Div(row){ + ForList(src){ + Div(col-md-#width# col-sm-12){ + Div(list-group-item){ + Div(row){ + Div(col-md-4){ + LinkPage(Body: #name#, Class: text-primary, Page: editor, PageParams: "open=page,name=#name#") + } + Div(col-md-8){ + Div(pull-right){ + LinkPage(Body: Em(Class: fa fa-eye), Class: text-primary h4 mh-sm, Page: "#name#") + LinkPage(Body: Em(Class: fa fa-history), Class: text-primary h4 mh-sm, Page: @1history, PageParams: "id=#id#,type=page") + LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4 mh-sm, Page: @1properties_edit, PageParams: "edit_property_id=#id#,type=page") + } } } } } } } - } - Div(mt){ - Include(@1pager) + Div(mt){ + Include(@1pager) + } } } } + }.Else{ + SetTitle($@1pages$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1apps_select_error$) + } } }.Else{ SetTitle($@1pages$) Div(breadcrumb){ - Span(Class: text-muted, Body: $@1apps_select_error$) + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) } } \ No newline at end of file diff --git a/src/system/pages/app_params.ptl b/src/system/pages/app_params.ptl index 2386fc7e6..71e93f0ad 100644 --- a/src/system/pages/app_params.ptl +++ b/src/system/pages/app_params.ptl @@ -1,45 +1,58 @@ -DBFind(@1buffer_data, src_buffer).Columns("value->app_id").Where({"key": export, "member_id": #key_id#, "ecosystem": #ecosystem_id#}).Vars(buffer) -If(#buffer_value_app_id# > 0){ - DBFind(@1applications, src_app).Where({"id": #buffer_value_app_id#, "ecosystem": #ecosystem_id#}).Vars("application") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) - Div(mr-lg ml-lg){ - SetTitle($@1app_params$: #application_name#) - AddToolButton(Title: $@1create$, Page: @1app_params_edit, Icon: icon-plus, PageParams: "application_id=#application_id#,create=create") +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + DBFind("@1buffer_data", src_buffer).Columns("value->app_id").Where({"key": "export", "account": "#account_id#", "ecosystem": "#ecosystem_id#"}).Vars(buffer) + If(#buffer_value_app_id# > 0){ + DBFind("@1applications", src_app).Where({"id": "#buffer_value_app_id#", "ecosystem": "#ecosystem_id#"}).Vars(application) - SetVar(this_table, @1app_params).(this_page, @1app_params).(pager_limit, 50) - SetVar(where, {"app_id": #buffer_value_app_id#, "ecosystem": #ecosystem_id#}) - Include(@1pager_header) - Include(@1admin_link) + Div(mr-lg ml-lg){ + SetTitle($@1app_params$: #application_name#) + AddToolButton(Title: $@1create$, Page: @1app_params_edit, Icon: icon-plus, PageParams: "application_id=#application_id#,create=create") - DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#) + SetVar(this_table, @1app_params).(this_page, @1app_params).(pager_limit, 50) + SetVar(where, {"app_id": "#buffer_value_app_id#", "ecosystem": "#ecosystem_id#"}) + Include(@1pager_header) + Include(@1admin_link) - Form(panel panel-primary){ - Div(panel-body){ - Div(row){ - ForList(src){ - Div(col-md-#width# col-sm-12){ - Div(list-group-item){ - Div(row){ - Div(col-md-4){ - LinkPage(Body: "#name#", Class: text-primary, Page: @1app_params_edit, PageParams: "id=#id#") - } - Div(col-md-8){ - Span(Class: text-muted h6, Body: "#value#") + DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#) + + Form(panel panel-primary){ + Div(panel-body){ + Div(row){ + ForList(src){ + Div(col-md-#width# col-sm-12){ + Div(list-group-item){ + Div(row){ + Div(col-md-4){ + LinkPage(Body: "#name#", Class: text-primary, Page: @1app_params_edit, PageParams: "id=#id#") + } + Div(col-md-8){ + Span(Class: text-muted h6, Body: "#value#") + } } } } } } - } - Div(mt){ - Include(@1pager) + Div(mt){ + Include(@1pager) + } } } } + }.Else{ + SetTitle($@1app_params$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1apps_select_error$) + } } }.Else{ SetTitle($@1app_params$) Div(breadcrumb){ - Span(Class: text-muted, Body: $@1apps_select_error$) + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) } } \ No newline at end of file diff --git a/src/system/pages/app_params_edit.ptl b/src/system/pages/app_params_edit.ptl index c17c1efa9..42f3ed4e6 100644 --- a/src/system/pages/app_params_edit.ptl +++ b/src/system/pages/app_params_edit.ptl @@ -1,50 +1,63 @@ -If(#back_page#){}.Else{ - SetVar(back_page, @1app_params) -} -Div(content-wrapper){ - If(#create# == create){ - SetVar(param_name, "$@1new_parameter$") - }.Else{ - DBFind(@1app_params, src_params).Where({"id": #id#, "ecosystem": #ecosystem_id#}).Vars("param") - } +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) - SetTitle($@1app_param$) - Div(Class: breadcrumb){ - LinkPage($@1app_params$, @1app_params) - Span(/).Style(margin-right: 10px; margin-left: 10px;) - Span(Class: text-muted, Body: #param_name#) +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + If(#back_page#){}.Else{ + SetVar(back_page, @1app_params) } + Div(content-wrapper){ + If(#create# == create){ + SetVar(param_name, "$@1new_parameter$") + }.Else{ + DBFind("@1app_params", src_params).Where({"id": "#id#", "ecosystem": "#ecosystem_id#"}).Vars(param) + } - Form(){ - Div(form-group){ - Label("$@1name$") - If(#create# == create){ - Input(Name: name) - }.Else{ - Input(Name: name, Value: #param_name#, Disabled: "true") - } + SetTitle($@1app_param$) + Div(Class: breadcrumb){ + LinkPage($@1app_params$, @1app_params) + Span(/).Style(margin-right: 10px; margin-left: 10px;) + Span(Class: text-muted, Body: #param_name#) } - Div(form-group){ - If(#create# == create){ - Input(Type: textarea, Name: value).Style(height: 500px !important;) - }.Else{ - Input(Type: textarea, Name: value, Value: "#param_value#").Style(height: 500px !important;) + + Form(){ + Div(form-group){ + Label("$@1name$") + If(#create# == create){ + Input(Name: name) + }.Else{ + Input(Name: name, Value: #param_name#, Disabled: "true") + } } - } - Div(form-group){ - Label($@1change_conditions$) - If(#create# == create){ - Input(Name: conditions) - }.Else{ - Input(Name: conditions, Value: #param_conditions#) + Div(form-group){ + If(#create# == create){ + Input(Type: textarea, Name: value).Style(height: 500px !important;) + }.Else{ + Input(Type: textarea, Name: value, Value: "#param_value#").Style(height: 500px !important;) + } } - } - Div(form-group text-right){ - If(#create# == create){ - Button(Class: btn btn-primary, Body: $@1save$, Contract: @1NewAppParam, Params: "Name=Val(name),Value=Val(value),Conditions=Val(conditions),ApplicationId=#application_id#", Page: #back_page#) - }.Else{ - Button(Class: btn btn-primary, Body: $@1save$, Contract: @1EditAppParam, Params: "Id=#id#,Value=Val(value),Conditions=Val(conditions)", Page: #back_page#) + Div(form-group){ + Label($@1change_conditions$) + If(#create# == create){ + Input(Name: conditions) + }.Else{ + Input(Name: conditions, Value: #param_conditions#) + } + } + Div(form-group text-right){ + If(#create# == create){ + Button(Class: btn btn-primary, Body: $@1save$, Contract: @1NewAppParam, Params: "Name=Val(name),Value=Val(value),Conditions=Val(conditions),ApplicationId=#application_id#", Page: #back_page#) + }.Else{ + Button(Class: btn btn-primary, Body: $@1save$, Contract: @1EditAppParam, Params: "Id=#id#,Value=Val(value),Conditions=Val(conditions)", Page: #back_page#) + } } } } +}.Else{ + SetTitle($@1new_parameter$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) + } } \ No newline at end of file diff --git a/src/system/pages/app_tables.ptl b/src/system/pages/app_tables.ptl index 1f561f0b4..6ae457efe 100644 --- a/src/system/pages/app_tables.ptl +++ b/src/system/pages/app_tables.ptl @@ -1,51 +1,64 @@ -DBFind(@1buffer_data, src_buffer).Columns("value->app_id").Where({"key": export, "member_id": #key_id#, "ecosystem": #ecosystem_id#}).Vars(buffer) -If(#buffer_value_app_id# > 0){ - DBFind(@1applications, src_app).Where({"id": #buffer_value_app_id#, "ecosystem": #ecosystem_id#}).Vars("application") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) - Div(mr-lg ml-lg){ - SetTitle($@1tables$: #application_name#) - AddToolButton(Title: $@1create$, Page: @1table_create, Icon: icon-plus, PageParams: "application_id=#application_id#") +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + DBFind("@1buffer_data", src_buffer).Columns("value->app_id").Where({"key": "export", "account": "#account_id#", "ecosystem": "#ecosystem_id#"}).Vars(buffer) + If(#buffer_value_app_id# > 0){ + DBFind("@1applications", src_app).Where({"id": "#buffer_value_app_id#", "ecosystem": "#ecosystem_id#"}).Vars(application) - SetVar(this_table, @1tables).(this_page, @1app_tables).(pager_limit, 50) - SetVar(where, {"app_id": #buffer_value_app_id#, "ecosystem": #ecosystem_id#}) - Include(@1pager_header) - Include(@1admin_link) + Div(mr-lg ml-lg){ + SetTitle($@1tables$: #application_name#) + AddToolButton(Title: $@1create$, Page: @1table_create, Icon: icon-plus, PageParams: "application_id=#application_id#") - DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#) + SetVar(this_table, @1tables).(this_page, @1app_tables).(pager_limit, 50) + SetVar(where, {"app_id": "#buffer_value_app_id#", "ecosystem": "#ecosystem_id#"}) + Include(@1pager_header) + Include(@1admin_link) - Form(panel panel-primary){ - Div(panel-body){ - Div(row){ - ForList(src){ - Div(col-md-#width# col-sm-12){ - Div(list-group-item){ - Div(row){ - Div(col-md-4){ - LinkPage(Page: @1table_view, Class: text-primary h5, Body: "#name#", PageParams: "tabl_id=#id#") - } - Div(col-md-8){ - Div(pull-right){ - LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4, Page: @1table_edit, PageParams: "tabl_id=#id#") + DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#) + + Form(panel panel-primary){ + Div(panel-body){ + Div(row){ + ForList(src){ + Div(col-md-#width# col-sm-12){ + Div(list-group-item){ + Div(row){ + Div(col-md-4){ + LinkPage(Page: @1table_view, Class: text-primary h5, Body: "#name#", PageParams: "tabl_id=#id#") } - Div(pull-right){ - DBFind(#name#).Columns("id").Count(countvar) - Span(Class: h5 text-muted, Body: #countvar#).Style(margin-right: 50px;) + Div(col-md-8){ + Div(pull-right){ + LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4, Page: @1table_edit, PageParams: "tabl_id=#id#") + } + Div(pull-right){ + DBFind(#name#).Columns("id").Count(countvar) + Span(Class: h5 text-muted, Body: #countvar#).Style(margin-right: 50px;) + } } } } } } } - } - Div(mt){ - Include(@1pager) + Div(mt){ + Include(@1pager) + } } } } + }.Else{ + SetTitle($@1tables$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1apps_select_error$) + } } }.Else{ SetTitle($@1tables$) Div(breadcrumb){ - Span(Class: text-muted, Body: $@1apps_select_error$) + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) } } \ No newline at end of file diff --git a/src/system/pages/app_upload_binary.ptl b/src/system/pages/app_upload_binary.ptl index e6c7e63ad..ea707e4c8 100644 --- a/src/system/pages/app_upload_binary.ptl +++ b/src/system/pages/app_upload_binary.ptl @@ -1,36 +1,49 @@ -Div(content-wrapper){ - SetTitle($@1binaries$) - Div(breadcrumb){ - LinkPage($@1binaries$, @1app_binary) - Span(/).Style(margin-right: 10px; margin-left: 10px;) - If(#id# > 0){ - Span($@1edit$, text-muted) - DBFind(@1binaries).Columns(name).Where({"id": #id#, "ecosystem": #ecosystem_id#}).Vars(binary) - }.Else{ - Span($@1button_upload$, text-muted) - } - } +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) - Form(){ - Div(form-group){ - Div(text-left){ - Label($@1name$) - } +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + Div(content-wrapper){ + SetTitle($@1binaries$) + Div(breadcrumb){ + LinkPage($@1binaries$, @1app_binary) + Span(/).Style(margin-right: 10px; margin-left: 10px;) If(#id# > 0){ - Input(Name: Name, Disabled: disabled, Value: #binary_name#) + Span($@1edit$, text-muted) + DBFind("@1binaries").Where({"id": "#id#", "ecosystem": "#ecosystem_id#"}).Columns(name).Vars(binary) }.Else{ - Input(Name: Name) + Span($@1button_upload$, text-muted) } } - Div(form-group){ - Div(text-left){ - Label($@1file$) + + Form(){ + Div(form-group){ + Div(text-left){ + Label($@1name$) + } + If(#id# > 0){ + Input(Name: Name, Disabled: disabled, Value: #binary_name#) + }.Else{ + Input(Name: Name) + } + } + Div(form-group){ + Div(text-left){ + Label($@1file$) + } + Input(Name: Data, Type: file) + } + Div(form-group text-right){ + Input(Name: ApplicationId, Value: #application_id#, Class: hidden) + Button(Body: $@1button_upload$, Contract: @1UploadFile, Class: btn btn-primary, Page: @1app_binary) } - Input(Name: Data, Type: file) - } - Div(form-group text-right){ - Input(Name: ApplicationId, Value: #application_id#, Class: hidden) - Button(Body: $@1button_upload$, Contract: @1UploadFile, Class: btn btn-primary, Page: @1app_binary) } } +}.Else{ + SetTitle($@1binaries$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) + } } \ No newline at end of file diff --git a/src/system/pages/apps_catalog.ptl b/src/system/pages/apps_catalog.ptl index 00cd00fda..712eff9e8 100644 --- a/src/system/pages/apps_catalog.ptl +++ b/src/system/pages/apps_catalog.ptl @@ -1,53 +1,66 @@ -SetVar(this_page, @1apps_catalog).(this_table, @1applications) -Include(@1pager_header) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) -SetTitle($@1apps_catalog$) -Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: $@1apps_catalog_desc$)) +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + SetVar(this_page, @1apps_catalog).(this_table, @1applications) + Include(@1pager_header) -If(#search#){ - SetVar(where, {"ecosystem": 1, "deleted": 0, "name": {"$ilike": "#search#"}}) -}.Else{ - SetVar(where, {"ecosystem": 1, "deleted": 0}) -} + SetTitle($@1apps_catalog$) + Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: $@1apps_catalog_desc$)) + + If(#search#){ + SetVar(where, {"ecosystem": 1, "deleted": 0, "name": {"$ilike": "#search#"}}) + }.Else{ + SetVar(where, {"ecosystem": 1, "deleted": 0}) + } -Div(list-group-item ml-lg mr-lg pt-lg){ - SetVar(search_name, LangRes(@1name)) - Include(@1search) -} + Div(list-group-item ml-lg mr-lg pt-lg){ + SetVar(search_name, LangRes(@1name)) + Include(@1search) + } -DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(inst_app){ - If(#ecosystem_id# != 1){ - SetVar(config_id,0) - DBFind(@1applications).Where({"name": #name#, "ecosystem": #ecosystem_id#}).Count(inst_app) - DBFind(@1app_params).Where({"app_id": #id#, "ecosystem": 1, "name": "config"}).Vars(config) - If(#config_id# > 0){ - If(#inst_app# == 0){ - Button(Class: btn-xs pull-right btn-link, Contract: @1AppInstall, Params: "ApplicationId=#id#", Page: #this_page#){ - Span(Class: h5, Body: $@1install$) + DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(inst_app){ + If(#ecosystem_id# != 1){ + SetVar(config_id,0) + DBFind("@1applications").Where({"name": "#name#", "ecosystem": "#ecosystem_id#"}).Count(inst_app) + DBFind("@1app_params").Where({"app_id": "#id#", "ecosystem": 1, "name": "config"}).Vars(config) + If(#config_id# > 0){ + If(#inst_app# == 0){ + Button(Class: btn-xs pull-right btn-link, Contract: @1AppInstall, Params: "ApplicationId=#id#", Page: #this_page#){ + Span(Class: h5, Body: $@1install$) + } + }.Else{ + Span(Body: $@1installed$, Class: text-muted pull-right) } - }.Else{ - Span(Body: $@1installed$, Class: text-muted pull-right) } } - } -}.Count(count) + }.Count(count) -Div(fullscreen){ - Div(table-responsive ml-lg mr-lg){ - Div(list-group-item){ - If(#count# > 0){ - Table(src, "ID=id,$@1name$=name,=inst_app") - }.Else{ - Div(Class: text-center h4 text-muted, Body: "$@1applications$ $@1not_founded$") - } - }.Style( - margin-top:-15px; - tbody > tr:nth-of-type(odd) { - background-color: #f8f9fc; - } - ) + Div(fullscreen){ + Div(table-responsive ml-lg mr-lg){ + Div(list-group-item){ + If(#count# > 0){ + Table(src, "ID=id,$@1name$=name,=inst_app") + }.Else{ + Div(Class: text-center h4 text-muted, Body: "$@1applications$ $@1not_founded$") + } + }.Style( + margin-top:-15px; + tbody > tr:nth-of-type(odd) { + background-color: #f8f9fc; + } + ) + } + } + Div(mt-sm ml-lg mr-sm mb-sm){ + Include(@1pager) + } +}.Else{ + SetTitle($@1apps_catalog$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) } -} -Div(mt-sm ml-lg mr-sm mb-sm){ - Include(@1pager) } \ No newline at end of file diff --git a/src/system/pages/apps_list.ptl b/src/system/pages/apps_list.ptl index e4d66529a..bf82648ec 100644 --- a/src/system/pages/apps_list.ptl +++ b/src/system/pages/apps_list.ptl @@ -1,60 +1,73 @@ -SetVar(this_page, @1apps_list).(this_table, @1applications) -Include(@1pager_header) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) -SetTitle("$@1applications$") -Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$@1apps_list$")) -AddToolButton(Title: $@1import$, Page: @1import_upload, Icon: icon-cloud-upload) -AddToolButton(Title: $@1apps_inactive$, Page: @1apps_list_inactive, Icon: icon-close) -AddToolButton(Title: $@1create$, Page: @1app_edit, Icon: icon-plus) +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + SetVar(this_page, @1apps_list).(this_table, @1applications) + Include(@1pager_header) -If(#search#){ - SetVar(where, {"ecosystem": #ecosystem_id#, "deleted": 0, {"$or":[{"name": {"$ilike": "#search#"}}]}}) -}.Else{ - SetVar(where, {"ecosystem": #ecosystem_id#, "deleted": 0}) -} - -Div(list-group-item ml-lg mr-lg pt-lg){ - SetVar(search_name, LangRes(@1name)) - Include(@1search) -} + SetTitle("$@1applications$") + Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$@1apps_list$")) + AddToolButton(Title: $@1import$, Page: @1import_upload, Icon: icon-cloud-upload) + AddToolButton(Title: $@1apps_inactive$, Page: @1apps_list_inactive, Icon: icon-close) + AddToolButton(Title: $@1create$, Page: @1app_edit, Icon: icon-plus) -DBFind(@1buffer_data, src_buffer).Columns("value->app_id,value->app_name,value->menu_name,value->menu_id,value->count_menu").Where({"key": export, "member_id": #key_id#, "ecosystem": #ecosystem_id#}).Vars(buffer) -DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_export){ - Button(Class: btn-xs btn-link, Contract: @1ExportNewApp, Params: "ApplicationId=#id#", Page: @1export_resources){ - Span(Class: h5, Body: "$@1export$") - } -}.Custom(custom_name){ - If(#id#==#buffer_value_app_id#){ - Button(Class: btn-xs btn-link, Page: @1app_contracts){ - Span(Class: h5, Body: #name#) - } + If(#search#){ + SetVar(where, {"ecosystem": "#ecosystem_id#", "deleted": 0, "name": {"$ilike": "#search#"}}) }.Else{ - Button(Class: btn-link btn-xs, Contract: @1SelectApp, Params: "ApplicationId=#id#", Page: @1app_contracts){ - Span(Class: h5, Body: #name#) - } + SetVar(where, {"ecosystem": "#ecosystem_id#", "deleted": 0}) } -}.Custom(custom_actions){ - Span(Class: pull-right){ - LinkPage(Class: text-primary h4, Body: Em(Class: fa fa-cogs), Page: @1app_edit, PageParams: "id=#id#") + + Div(list-group-item ml-lg mr-lg pt-lg){ + SetVar(search_name, LangRes(@1name)) + Include(@1search) } -}.Count(count) -Div(fullscreen){ - Div(table-responsive ml-lg mr-lg){ - Div(list-group-item){ - If(#count# > 0){ - Table(src, "$@1name$=custom_name,$@1conditions$=conditions,$@1export$=_export,=custom_actions") - }.Else{ - Div(Class: text-center h4 text-muted, Body: "$@1applications$ $@1not_founded$") + DBFind("@1buffer_data", src_buffer).Columns("value->app_id,value->app_name,value->menu_name,value->menu_id,value->count_menu").Where({"key": "export", "account": "#account_id#", "ecosystem": "#ecosystem_id#"}).Vars(buffer) + DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_export){ + Button(Class: btn-xs btn-link, Contract: @1ExportNewApp, Params: "ApplicationId=#id#", Page: @1export_resources){ + Span(Class: h5, Body: "$@1export$") + } + }.Custom(custom_name){ + If(#id#==#buffer_value_app_id#){ + Button(Class: btn-xs btn-link, Page: @1app_contracts){ + Span(Class: h5, Body: #name#) } - }.Style( - margin-top:-15px; - tbody > tr:nth-of-type(odd) { - background-color: #f8f9fc; + }.Else{ + Button(Class: btn-link btn-xs, Contract: @1SelectApp, Params: "ApplicationId=#id#", Page: @1app_contracts){ + Span(Class: h5, Body: #name#) } - ) + } + }.Custom(custom_actions){ + Span(Class: pull-right){ + LinkPage(Class: text-primary h4, Body: Em(Class: fa fa-cogs), Page: @1app_edit, PageParams: "id=#id#") + } + }.Count(count) + + Div(fullscreen){ + Div(table-responsive ml-lg mr-lg){ + Div(list-group-item){ + If(#count# > 0){ + Table(src, "$@1name$=custom_name,$@1conditions$=conditions,$@1export$=_export,=custom_actions") + }.Else{ + Div(Class: text-center h4 text-muted, Body: "$@1applications$ $@1not_founded$") + } + }.Style( + margin-top:-15px; + tbody > tr:nth-of-type(odd) { + background-color: #f8f9fc; + } + ) + } + } + Div(mt-sm ml-lg mr-sm mb-sm){ + Include(@1pager) + } +}.Else{ + SetTitle($@1applications$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) } -} -Div(mt-sm ml-lg mr-sm mb-sm){ - Include(@1pager) } \ No newline at end of file diff --git a/src/system/pages/apps_list_inactive.ptl b/src/system/pages/apps_list_inactive.ptl index 57510a6ef..bbab7e8fa 100644 --- a/src/system/pages/apps_list_inactive.ptl +++ b/src/system/pages/apps_list_inactive.ptl @@ -1,48 +1,61 @@ -SetVar(this_page, @1apps_list_inactive).(this_table, @1applications) -Include(@1pager_header) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) -SetTitle("$@1apps_inactive$") -Span(Class: h5 m0 mb ml-lg){ - LinkPage(Class: ml-sm, Body: $@1applications$, Page: @1apps_list) - Span(Class: text-muted, Body: /).Style(margin-right: 10px; margin-left: 10px;) - Span(Class: text-muted, Body: "$@1apps_inactive$") -}.Style( - display: inline-block; -) +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + SetVar(this_page, @1apps_list_inactive).(this_table, @1applications) + Include(@1pager_header) -If(#search#){ - SetVar(where, {"ecosystem": #ecosystem_id#, "deleted": 1, {"$or":[{"name": {"$ilike": "#search#"}}]}}) -}.Else{ - SetVar(where, {"ecosystem": #ecosystem_id#, "deleted": 1}) -} + SetTitle("$@1apps_inactive$") + Span(Class: h5 m0 mb ml-lg){ + LinkPage(Class: ml-sm, Body: $@1applications$, Page: @1apps_list) + Span(Class: text-muted, Body: /).Style(margin-right: 10px; margin-left: 10px;) + Span(Class: text-muted, Body: "$@1apps_inactive$") + }.Style( + display: inline-block; + ) -Div(list-group-item ml-lg mr-lg pt-lg){ - SetVar(search_name, LangRes(@1name)) - Include(@1search) -} + If(#search#){ + SetVar(where, {"ecosystem": "#ecosystem_id#", "deleted": 1, "name": {"$ilike": "#search#"}}) + }.Else{ + SetVar(where, {"ecosystem": "#ecosystem_id#", "deleted": 1}) + } -DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_actions){ - Span(Class: pull-right){ - Button(Class: btn btn-link, Page: @1apps_list_inactive, Contract: @1DelApplication, Params: "ApplicationId=#id#", Body: "$@1restore$") + Div(list-group-item ml-lg mr-lg pt-lg){ + SetVar(search_name, LangRes(@1name)) + Include(@1search) } -}.Count(count) -Div(fullscreen){ - Div(table-responsive ml-lg mr-lg){ - Div(list-group-item){ - If(#count# > 0){ - Table(src, "$@1name$=name,$@1conditions$=conditions,=_actions") - }.Else{ - Div(Class: text-center h4 text-muted, Body: "$@1inactive_warning$") - } - }.Style( - margin-top:-15px; - tbody > tr:nth-of-type(odd) { - background-color: #f8f9fc; - } - ) + DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_actions){ + Span(Class: pull-right){ + Button(Class: btn btn-link, Page: @1apps_list_inactive, Contract: @1DelApplication, Params: "ApplicationId=#id#", Body: "$@1restore$") + } + }.Count(count) + + Div(fullscreen){ + Div(table-responsive ml-lg mr-lg){ + Div(list-group-item){ + If(#count# > 0){ + Table(src, "$@1name$=name,$@1conditions$=conditions,=_actions") + }.Else{ + Div(Class: text-center h4 text-muted, Body: "$@1inactive_warning$") + } + }.Style( + margin-top:-15px; + tbody > tr:nth-of-type(odd) { + background-color: #f8f9fc; + } + ) + } + } + Div(mt-sm ml-lg mr-sm mb-sm){ + Include(@1pager) + } +}.Else{ + SetTitle($@1apps_inactive$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) } -} -Div(mt-sm ml-lg mr-sm mb-sm){ - Include(@1pager) } \ No newline at end of file diff --git a/src/system/pages/column_add.ptl b/src/system/pages/column_add.ptl index 9d3521250..6c00c1165 100644 --- a/src/system/pages/column_add.ptl +++ b/src/system/pages/column_add.ptl @@ -1,46 +1,59 @@ -Div(content-wrapper){ - SetTitle($@1new_column$) - Div(breadcrumb){ - Div(){ - LinkPage($@1tables$, @1app_tables) - Span(/).Style(margin-right: 10px; margin-left: 10px;) - LinkPage($@1edit_table$, @1table_edit, PageParams:"tabl_id=#tabl_id#") - Span(/).Style(margin-right: 10px; margin-left: 10px;) - Span($@1new_column$, text-muted) - } - } +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) - Form(panel panel-default){ - Div(panel-body){ - Div(form-group){ - Label($@1column$) - Input(Name: ColumnName) +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + Div(content-wrapper){ + SetTitle($@1new_column$) + Div(breadcrumb){ + Div(){ + LinkPage($@1tables$, @1app_tables) + Span(/).Style(margin-right: 10px; margin-left: 10px;) + LinkPage($@1edit_table$, @1table_edit, PageParams:"tabl_id=#tabl_id#") + Span(/).Style(margin-right: 10px; margin-left: 10px;) + Span($@1new_column$, text-muted) } - Div(form-group){ - Data(src_type,"type,name"){ - text,"Text" - number,"Number" - varchar,"Varchar" - datetime,"Date/Time" - money,"Money" - double,"Double" - character,"Character" - json,"JSON" + } + + Form(panel panel-default){ + Div(panel-body){ + Div(form-group){ + Label($@1column$) + Input(Name: ColumnName) + } + Div(form-group){ + Data(src_type,"type,name"){ + text,"Text" + number,"Number" + varchar,"Varchar" + datetime,"Date/Time" + money,"Money" + double,"Double" + character,"Character" + json,"JSON" + } + Label($@1type$) + Select(Name: Coltype, Source: src_type, NameColumn: name, ValueColumn: type, Value:"text") + } + Div(form-group){ + Label($@1updating$) + Input(Name: UpdateColumn, Value: "true") + } + Div(form-group){ + Label($@1reading$) + Input(Name: ReadColumn, Value: "true") } - Label($@1type$) - Select(Name: Coltype, Source: src_type, NameColumn: name, ValueColumn: type, Value:"text") - } - Div(form-group){ - Label($@1updating$) - Input(Name: UpdateColumn, Value: "true") } - Div(form-group){ - Label($@1reading$) - Input(Name: ReadColumn, Value: "true") + Div(panel-footer clearfix text-right){ + Button(Body: $@1column_add$, Contract: @1NewColumn, Class: btn btn-primary, Page: @1table_edit, PageParams: "tabl_id=#tabl_id#", Params: "TableName=#next_table_name#,Name=Val(ColumnName),Type=Val(Coltype),UpdatePerm=Val(UpdateColumn),ReadPerm=Val(ReadColumn)") } } - Div(panel-footer clearfix text-right){ - Button(Body: $@1column_add$, Contract: @1NewColumn, Class: btn btn-primary, Page: @1table_edit, PageParams: "tabl_id=#tabl_id#", Params: "TableName=#next_table_name#,Name=Val(ColumnName),Type=Val(Coltype),UpdatePerm=Val(UpdateColumn),ReadPerm=Val(ReadColumn)") - } + } +}.Else{ + SetTitle($@1new_column$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) } } \ No newline at end of file diff --git a/src/system/pages/column_edit.ptl b/src/system/pages/column_edit.ptl index a5b893769..7ccabd91d 100644 --- a/src/system/pages/column_edit.ptl +++ b/src/system/pages/column_edit.ptl @@ -1,92 +1,105 @@ -Div(content-wrapper){ - SetTitle($@1edit_column$) - Div(breadcrumb){ - Div(){ - LinkPage($@1tables$, @1app_tables) - Span(/,mh) - LinkPage($@1edit_table$, @1table_edit, PageParams:"tabl_id=#tabl_id#") - Span(/,mh) - Span($@1edit_column$, text-muted) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) + +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + Div(content-wrapper){ + SetTitle($@1edit_column$) + Div(breadcrumb){ + Div(){ + LinkPage($@1tables$, @1app_tables) + Span(/,mh) + LinkPage($@1edit_table$, @1table_edit, PageParams:"tabl_id=#tabl_id#") + Span(/,mh) + Span($@1edit_column$, text-muted) + } } - } - DBFind(@1tables).Columns("id,name,columns,conditions").Where({"id": #tabl_id#, "ecosystem": #ecosystem_id#}).Vars(table) - JsonToSource(src_columns, #table_columns#) - Form(panel panel-default){ - Div(panel-body){ - ForList(src_columns){ - If(#key# == #name_column#){ - Div(form-group){ - Label($@1column$) - Input(Name: ColumnName, Disabled: "true", Value: #name_column#) - } - Div(form-group){ - Label($@1type$) - SetVar(col_type, GetColumnType(#table_name#, #key#)) - If(#col_type# == character){ - SetVar(input_type, "Character") - } - If(#col_type# == text){ - SetVar(input_type, "Text") - } - If(#col_type# == number){ - SetVar(input_type, "Number") - } - If(#col_type# == money){ - SetVar(input_type, "Money") - } - If(#col_type# == varchar){ - SetVar(input_type, "Varchar") - } - If(#col_type# == datetime){ - SetVar(input_type, "Date/Time") - } - If(#col_type# == double){ - SetVar(input_type, "Double") - } - If(#col_type# == json){ - SetVar(input_type, "JSON") - } - If(#col_type# == bytea){ - SetVar(input_type, "Binary Data") + DBFind("@1tables").Columns("id,name,columns,conditions").Where({"id": "#tabl_id#", "ecosystem": "#ecosystem_id#"}).Vars(table) + JsonToSource(src_columns, #table_columns#) + Form(panel panel-default){ + Div(panel-body){ + ForList(src_columns){ + If(#key# == #name_column#){ + Div(form-group){ + Label($@1column$) + Input(Name: ColumnName, Disabled: "true", Value: #name_column#) } - If(#col_type# == uuid){ - SetVar(input_type, "UUID") + Div(form-group){ + Label($@1type$) + SetVar(col_type, GetColumnType(#table_name#, #key#)) + If(#col_type# == character){ + SetVar(input_type, "Character") + } + If(#col_type# == text){ + SetVar(input_type, "Text") + } + If(#col_type# == number){ + SetVar(input_type, "Number") + } + If(#col_type# == money){ + SetVar(input_type, "Money") + } + If(#col_type# == varchar){ + SetVar(input_type, "Varchar") + } + If(#col_type# == datetime){ + SetVar(input_type, "Date/Time") + } + If(#col_type# == double){ + SetVar(input_type, "Double") + } + If(#col_type# == json){ + SetVar(input_type, "JSON") + } + If(#col_type# == bytea){ + SetVar(input_type, "Binary Data") + } + If(#col_type# == uuid){ + SetVar(input_type, "UUID") + } + Input(Name: Coltype, Disabled: "true", Value: #input_type#) } - Input(Name: Coltype, Disabled: "true", Value: #input_type#) - } - SetVar(isObject,0) - JsonToSource(condition,#value#) - ForList(condition){ - SetVar(isObject,1) - If(#key#==read){ + SetVar(isObject,0) + JsonToSource(condition,#value#) + ForList(condition){ + SetVar(isObject,1) + If(#key#==read){ + Div(form-group){ + Label($@1reading$) + Input(Name: ReadColumn, Value: #value#) + } + }.ElseIf(#key#==update){ + Div(form-group){ + Label($@1updating$) + Input(Name: UpdateColumn, Value: #value#) + } + } + } + If(#isObject#==0){ Div(form-group){ Label($@1reading$) - Input(Name: ReadColumn, Value: #value#) + Input(Name: ReadColumn, Value: true) } - }.ElseIf(#key#==update){ Div(form-group){ Label($@1updating$) Input(Name: UpdateColumn, Value: #value#) } } } - If(#isObject#==0){ - Div(form-group){ - Label($@1reading$) - Input(Name: ReadColumn, Value: true) - } - Div(form-group){ - Label($@1updating$) - Input(Name: UpdateColumn, Value: #value#) - } - } } } + Div(panel-footer clearfix text-right){ + Button(Body: $@1save$, Contract: @1EditColumn, Class: btn btn-primary, Page: @1table_edit, PageParams: "tabl_id=#tabl_id#", Params: "TableName=#table_name#,Name=Val(ColumnName),Type=Val(Coltype),UpdatePerm=Val(UpdateColumn),ReadPerm=Val(ReadColumn)") + } } - Div(panel-footer clearfix text-right){ - Button(Body: $@1save$, Contract: @1EditColumn, Class: btn btn-primary, Page: @1table_edit, PageParams: "tabl_id=#tabl_id#", Params: "TableName=#table_name#,Name=Val(ColumnName),Type=Val(Coltype),UpdatePerm=Val(UpdateColumn),ReadPerm=Val(ReadColumn)") - } + } +}.Else{ + SetTitle($@1edit_column$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) } } \ No newline at end of file diff --git a/src/system/pages/developer_index.ptl b/src/system/pages/developer_index.ptl index bb6f3bebf..ec136f035 100644 --- a/src/system/pages/developer_index.ptl +++ b/src/system/pages/developer_index.ptl @@ -1,257 +1,265 @@ -SetVar(this_page, @1developer_index).(deleters_count,0) -DBFind(@1contracts).Where({"name": ItemChangeAppId, "ecosystem": 1}).Count(changer_count) -DBFind(@1applications,src_apps).Where({"deleted": 0, "ecosystem": #ecosystem_id#}).Order(id).Count(apps_count) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) -If(And(#Restore#,#Table#,#Id#)){ - Form(){ - Select(Name:AppId, NameColumn: name, ValueColumn: id, Source: src_apps, Class:mb) - Div(){ - Button(Class: btn btn-default, Page: #this_page#, PageParams: "appid=0", Body: "$@1cancel$") - Button(Class: btn btn-primary pull-right, Page: #this_page#, PageParams: "appid=Val(AppId)", Contract: @1ItemChangeAppId, Params: "Table=#Table#,Id=#Id#,AppId=Val(AppId)", Body: "$@1confirm_button$") - } - } -}.ElseIf(#block#){ - Span(Class: h5 m0 mb ml-lg){ - LinkPage(Class: ml-sm, Body: $@1dashboard$, Page: #this_page#) - Span(Class: text-muted mh-sm, Body: /) - Span(Class: text-muted, Body: $@1block$: #block#) - }.Style( - display: inline-block; - ) - Include(Name:#block#) -}.Else{ - DBFind(@1buffer_data).Columns("value->app_id").Where({"key": export, "member_id": #key_id#, "ecosystem": #ecosystem_id#}).Vars(buffer) - If(#Single#==binaries){ - Data(tables, "Table,Page,Name"){ - @1binaries,@1app_upload_binary,$@1binaries$ - } - }.ElseIf(#Single#==languages){ - Data(tables, "Table,Cols,Page,Name"){ - @1languages,"id,name,res",@1langres_add,$@1lang_res$ +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + SetVar(this_page, @1developer_index).(deleters_count,0) + DBFind("@1contracts").Where({"name": "ItemChangeAppId", "ecosystem": 1}).Count(changer_count) + DBFind("@1applications",src_apps).Where({"deleted": 0, "ecosystem": "#ecosystem_id#"}).Order("id").Count(apps_count) + + If(And(#Restore#,#Table#,#Id#)){ + Form(){ + Select(Name:AppId, NameColumn: name, ValueColumn: id, Source: src_apps, Class:mb) + Div(){ + Button(Class: btn btn-default, Page: #this_page#, PageParams: "appid=0", Body: "$@1cancel$") + Button(Class: btn btn-primary pull-right, Page: #this_page#, PageParams: "appid=Val(AppId)", Contract: @1ItemChangeAppId, Params: "Table=#Table#,Id=#Id#,AppId=Val(AppId)", Body: "$@1confirm_button$") + } } + }.ElseIf(#block#){ + Span(Class: h5 m0 mb ml-lg){ + LinkPage(Class: ml-sm, Body: $@1dashboard$, Page: #this_page#) + Span(Class: text-muted mh-sm, Body: /) + Span(Class: text-muted, Body: $@1block$: #block#) + }.Style( + display: inline-block; + ) + Include(Name:#block#) }.Else{ - Data(tables, "Table,Cols,Page,Name"){ - @1contracts,"id,app_id,name,wallet_id",editor,$@1contracts$ - @1pages,"id,app_id,name",editor,$@1pages$ - @1blocks,"id,app_id,name",editor, $@1blocks$ - @1tables,"id,app_id,name",@1table_create,$@1tables$ - @1app_params,"id,app_id,name,value",@1app_params_edit,$@1app_params$ + DBFind("@1buffer_data").Columns("value->app_id").Where({"key": "export", "account": "#account_id#", "ecosystem": "#ecosystem_id#"}).Vars(buffer) + If(#Single#==binaries){ + Data(tables, "Table,Page,Name"){ + @1binaries,@1app_upload_binary,$@1binaries$ + } + }.ElseIf(#Single#==languages){ + Data(tables, "Table,Cols,Page,Name"){ + @1languages,"id,name,res",@1langres_add,$@1lang_res$ + } + }.Else{ + Data(tables, "Table,Cols,Page,Name"){ + @1contracts,"id,app_id,name,wallet_id",editor,$@1contracts$ + @1pages,"id,app_id,name",editor,$@1pages$ + @1blocks,"id,app_id,name",editor, $@1blocks$ + @1tables,"id,app_id,name",@1table_create,$@1tables$ + @1app_params,"id,app_id,name,value",@1app_params_edit,$@1app_params$ + } } - } - SetVar(active_btn,"btn btn-info").(create_icon,fa fa-plus-square).(cols,3) + SetVar(active_btn,"btn btn-info").(create_icon,fa fa-plus-square).(cols,3) - If(#appid#!=""){ - SetVar(where, {"app_id": #appid#, "ecosystem": #ecosystem_id#}) - }.Else{ - If(#buffer_value_app_id#>0){ - DBFind(@1applications).Where({"id": #buffer_value_app_id#, "deleted": 0, "ecosystem": #ecosystem_id#}).Vars(check) - If(#check_id# > 0){ - SetVar(appid,#buffer_value_app_id#).(where, {"app_id": #appid#, "ecosystem": #ecosystem_id#}) + If(#appid#!=""){ + SetVar(where, {"app_id": "#appid#", "ecosystem": "#ecosystem_id#"}) + }.Else{ + If(#buffer_value_app_id#>0){ + DBFind("@1applications").Where({"id": "#buffer_value_app_id#", "deleted": 0, "ecosystem": "#ecosystem_id#"}).Vars(check) + If(#check_id# > 0){ + SetVar(appid, #buffer_value_app_id#).(where, {"app_id": "#appid#", "ecosystem": "#ecosystem_id#"}) + }.Else{ + SetVar(where, {"id": {"$gt": 0}, "ecosystem": "#ecosystem_id#"}).(appid, 1) + } }.Else{ - SetVar(where,{"id":{"$gt":0}, "ecosystem": #ecosystem_id#}).(appid,1) + SetVar(where, {"id": {"$gt": 0}, "ecosystem": "#ecosystem_id#"}).(appid, 1) } - }.Else{ - SetVar(where, {"id": {"$gt": 0}, "ecosystem": #ecosystem_id#}).(appid,1) } - } - If(#appid#==0){ - SetVar(application_name,trash) - }.ElseIf(#appid#>0){ - DBFind(@1applications).Where({"id": #appid#, "ecosystem": #ecosystem_id#}).Vars(application) - } - If(And(#appid# == 1,#ecosystem_id# != 1)){ - SetTitle($@1dashboard$: $@1select_application$) - }.Else{ - SetTitle($@1dashboard$: #application_name#) - } + If(#appid#==0){ + SetVar(application_name,trash) + }.ElseIf(#appid#>0){ + DBFind("@1applications").Where({"id": "#appid#", "ecosystem": "#ecosystem_id#"}).Vars(application) + } + If(And(#appid# == 1,#ecosystem_id# != 1)){ + SetTitle($@1dashboard$: $@1select_application$) + }.Else{ + SetTitle($@1dashboard$: #application_name#) + } - Div(mr-lg ml-lg){ - Div(){ - If(#Single#){ - Div(text-right){ - Button(Page: #this_page#, PageParams: "appid=#appid#", Class: btn btn-default fa fa-close mr-sm) - } - }.Else{ - Div(row){ - Div(col-sm-12 btn-group){ - ForList(src_apps){ - If(#src_apps_index#==1){ - If(#appid#==0){ - LinkPage(Class: #active_btn# disabled ml-sm, Body: Span(Class:fa fa-trash)) + Div(mr-lg ml-lg){ + Div(){ + If(#Single#){ + Div(text-right){ + Button(Page: #this_page#, PageParams: "appid=#appid#", Class: btn btn-default fa fa-close mr-sm) + } + }.Else{ + Div(row){ + Div(col-sm-12 btn-group){ + ForList(src_apps){ + If(#src_apps_index#==1){ + If(#appid#==0){ + LinkPage(Class: #active_btn# disabled ml-sm, Body: Span(Class:fa fa-trash)) + }.Else{ + LinkPage(Page: #this_page#, Class: btn btn-default ml-sm, PageParams: "appid=0", Body: Span(Class:fa fa-trash)) + } + } + If(#appid#==#id#){ + LinkPage(Class: #active_btn# disabled ml-sm, Body:"#id#:#name#") }.Else{ - LinkPage(Page: #this_page#, Class: btn btn-default ml-sm, PageParams: "appid=0", Body: Span(Class:fa fa-trash)) + LinkPage(Page: #this_page#, Class: btn btn-default ml-sm, PageParams: "appid=#id#", Body:"#id#:#name#") } } - If(#appid#==#id#){ - LinkPage(Class: #active_btn# disabled ml-sm, Body:"#id#:#name#") - }.Else{ - LinkPage(Page: #this_page#, Class: btn btn-default ml-sm, PageParams: "appid=#id#", Body:"#id#:#name#") - } } } } } - } - Div(panel panel-primary){ - Div(panel-body){ - If(And(#appid# == 1,#ecosystem_id# != 1)){ - Span(Class: text-muted,Body: $@1dashboard_hint$) - }.Else{ - SetVar(limit,250) - ForList(tables){ - If(#Table#==@1binaries){ - DBFind(#Table#, src_table).Limit(#limit#).Order({ id: -1 }).Where(#where#).Count(items_count).Custom(_name){ - LinkPage(Page: #Page#, PageParams: "id=#id#,application_id=#appid#"){#name#} - }.Custom(_img){ - Image(Src: Binary().ById(#id#), Class: preview) - } - }.ElseIf(#Table#==@1languages){ - If(#search#){ - SetVar(where, {"ecosystem": #ecosystem_id#, {"$or":[{"name": {"$ilike": "#search#"}}, {"res": {"$ilike": "#search#"}}]}}) + Div(panel panel-primary){ + Div(panel-body){ + If(And(#appid# == 1,#ecosystem_id# != 1)){ + Span(Class: text-muted,Body: $@1dashboard_hint$) + }.Else{ + SetVar(limit,250) + ForList(tables){ + If(#Table#==@1binaries){ + DBFind(#Table#, src_table).Limit(#limit#).Order({"id": "-1"}).Where(#where#).Count(items_count).Custom(_name){ + LinkPage(Page: #Page#, PageParams: "id=#id#,application_id=#appid#"){#name#} + }.Custom(_img){ + Image(Src: Binary().ById(#id#), Class: preview) + } + }.ElseIf(#Table#==@1languages){ + If(#search#){ + SetVar(where, {"ecosystem": "#ecosystem_id#", "$or": [{"name": {"$ilike": "#search#"}}, {"res": {"$ilike": "#search#"}}]}) + }.Else{ + SetVar(where, {"ecosystem": "#ecosystem_id#"}) + } + DBFind(#Table#, src_table).Limit(#limit#).Columns(#Cols#).Order("name").Where(#where#).Count(items_count) }.Else{ - SetVar(where, {"ecosystem": #ecosystem_id#}) + DBFind(#Table#, src_table).Limit(#limit#).Columns(#Cols#).Order("name").Where(#where#).Count(items_count) } - DBFind(#Table#, src_table).Limit(#limit#).Columns(#Cols#).Order("name").Where(#where#).Count(items_count) - }.Else{ - DBFind(#Table#, src_table).Limit(#limit#).Columns(#Cols#).Order("name").Where(#where#).Count(items_count) - } - Div(list-group-item clearfix){ - If(#Table#==@1languages){ - Form(){ - Div(input-group){ - Div(input-group-addon){ - LangRes(@1search) - } - Input(Name: search, Value: #search#) - Div(input-group-btn){ - Button(Class: btn btn-primary fa fa-search, Page: #this_page#, PageParams: "appid=#appid#,search=Val(search),Single=#Single#") - If(#search#){ - Button(Class: btn btn-default fa fa-close mr-sm, Page: #this_page#, PageParams: "appid=#appid#,Single=#Single#") + Div(list-group-item clearfix){ + If(#Table#==@1languages){ + Form(){ + Div(input-group){ + Div(input-group-addon){ + LangRes(@1search) + } + Input(Name: search, Value: #search#) + Div(input-group-btn){ + Button(Class: btn btn-primary fa fa-search, Page: #this_page#, PageParams: "appid=#appid#,search=Val(search),Single=#Single#") + If(#search#){ + Button(Class: btn btn-default fa fa-close mr-sm, Page: #this_page#, PageParams: "appid=#appid#,Single=#Single#") + } } } } } - } - Div(h3 pull-left mt-lg){ - #Name# - } - If(#appid#>0){ - Div(pull-right mt-lg){ - If(#Table#==@1contracts){ - LinkPage(Page: #Page#, PageParams: "create=contract,appId=#appid#"){ - Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#) - } - }.ElseIf(#Table#==@1pages){ - LinkPage(Page: #Page#, PageParams: "create=page,appId=#appid#"){ - Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#) - } - }.ElseIf(#Table#==@1blocks){ - LinkPage(Page: #Page#, PageParams: "create=block,appId=#appid#"){ - Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#) - } - }.ElseIf(#Table#==@1tables){ - LinkPage(Page: #Page#, PageParams: "application_id=#appid#"){ - Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#) - } - }.ElseIf(#Table#==@1app_params){ - LinkPage(Page: #Page#, PageParams: "application_id=#appid#,create=create"){ - Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#) - } - }.ElseIf(#Table#==@1binaries){ - LinkPage(Page: #Page#, PageParams: "application_id=#appid#"){ - Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#) - } - }.ElseIf(#Table#==@1languages){ - LinkPage(Page: #Page#){ - Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#) + Div(h3 pull-left mt-lg){ + #Name# + } + If(#appid#>0){ + Div(pull-right mt-lg){ + If(#Table#==@1contracts){ + LinkPage(Page: #Page#, PageParams: "create=contract,appId=#appid#"){ + Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#) + } + }.ElseIf(#Table#==@1pages){ + LinkPage(Page: #Page#, PageParams: "create=page,appId=#appid#"){ + Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#) + } + }.ElseIf(#Table#==@1blocks){ + LinkPage(Page: #Page#, PageParams: "create=block,appId=#appid#"){ + Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#) + } + }.ElseIf(#Table#==@1tables){ + LinkPage(Page: #Page#, PageParams: "application_id=#appid#"){ + Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#) + } + }.ElseIf(#Table#==@1app_params){ + LinkPage(Page: #Page#, PageParams: "application_id=#appid#,create=create"){ + Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#) + } + }.ElseIf(#Table#==@1binaries){ + LinkPage(Page: #Page#, PageParams: "application_id=#appid#"){ + Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#) + } + }.ElseIf(#Table#==@1languages){ + LinkPage(Page: #Page#){ + Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#) + } } } } - } - Div(row pd){ - Div(col-sm-12){ - If(#Table#==@1binaries){ - If(#items_count#>0){ - Div(items){ - Table(src_table,"=id,$@1edit_link$=_name,$@1download_link$=data,=_img") + Div(row pd){ + Div(col-sm-12){ + If(#Table#==@1binaries){ + If(#items_count#>0){ + Div(items){ + Table(src_table,"=id,$@1edit_link$=_name,$@1download_link$=data,=_img") + } + }.Else{ + Div(text-muted h4 text-center){ + #Name# $@1not_founded$ + } } }.Else{ - Div(text-muted h4 text-center){ - #Name# $@1not_founded$ - } - } - }.Else{ - SetVar(value,).(res,) - If(#items_count#>0){ - Div(cols){ - ForList(src_table){ - Div(clearfix item){ - Div(pull-right){ - If(#Table#==@1contracts){ - If(#wallet_id#!=0){ - Span($@1binded$, text-success mr-lg) + SetVar(value,).(res,) + If(#items_count#>0){ + Div(cols){ + ForList(src_table){ + Div(clearfix item){ + Div(pull-right){ + If(#Table#==@1contracts){ + If(#wallet_id#!=0){ + Span($@1binded$, text-success mr-lg) + } + LinkPage(Class: text-muted fa fa-history, Page: @1history, PageParams: "id=#id#,type=contract") + LinkPage(Class: text-muted fa fa-cogs, Page: @1properties_edit, PageParams: "edit_property_id=#id#,type=contract") + } + If(#Table#==@1pages){ + LinkPage(Class: text-muted fa fa-eye, Page: #name#) + LinkPage(Class: text-muted fa fa-history, Page: @1history, PageParams: "id=#id#,type=page") + LinkPage(Class: text-muted fa fa-cogs, Page: @1properties_edit, PageParams: "edit_property_id=#id#,type=page") + } + If(#Table#==@1blocks){ + LinkPage(Class: text-muted fa fa-eye, Page: #this_page#, PageParams:"block=#name#") + LinkPage(Class: text-muted fa fa-history, Page: @1history, PageParams: "id=#id#,type=block") + LinkPage(Class: text-muted fa fa-cogs, Page: @1properties_edit, PageParams: "edit_property_id=#id#,type=block") + } + If(#Table#==@1tables){ + LinkPage(Class: text-muted fa fa-eye, Page: @1table_view, PageParams: "tabl_id=#id#,table_name=#name#") + } + If(#Table#!=@1languages){ + If(#changer_count#==1){ + If(#appid#==0){ + Button(Class: btn-link text-muted fa fa-recycle, Page: #this_page#, PageParams: "Restore=1,Table=#Table#,Id=#id#").Popup(30, "$@1restore_select$") + }.Else{ + If(#ecosystem_id#==1){ + Button(Class: btn-link text-muted fa fa-trash, Page: #this_page#, PageParams: "appid=#appid#", Contract: ItemChangeAppId, Params: "Table=#Table#,Id=#id#,AppId=0").Alert("$@1remove_confirmation$", "$@1confirm_button$", "$@1cancel$") + }.Else{ + Button(Class: btn-link text-muted fa fa-trash, Page: #this_page#, PageParams: "appid=#appid#", Contract: @1ItemChangeAppId, Params: "Table=#Table#,Id=#id#,AppId=0").Alert("$@1remove_confirmation$", "$@1confirm_button$", "$@1cancel$") + + } + } + } } - LinkPage(Class: text-muted fa fa-history, Page: @1history, PageParams: "id=#id#,type=contract") - LinkPage(Class: text-muted fa fa-cogs, Page: @1properties_edit, PageParams: "edit_property_id=#id#,type=contract") + } + If(#Table#==@1contracts){ + LinkPage(Page: #Page#, PageParams: "open=contract,name=#name#,back_page=#this_page#"){#name#} } If(#Table#==@1pages){ - LinkPage(Class: text-muted fa fa-eye, Page: #name#) - LinkPage(Class: text-muted fa fa-history, Page: @1history, PageParams: "id=#id#,type=page") - LinkPage(Class: text-muted fa fa-cogs, Page: @1properties_edit, PageParams: "edit_property_id=#id#,type=page") + LinkPage(Page: #Page#, PageParams: "open=page,name=#name#,back_page=#this_page#"){#name#} } If(#Table#==@1blocks){ - LinkPage(Class: text-muted fa fa-eye, Page: #this_page#, PageParams:"block=#name#") - LinkPage(Class: text-muted fa fa-history, Page: @1history, PageParams: "id=#id#,type=block") - LinkPage(Class: text-muted fa fa-cogs, Page: @1properties_edit, PageParams: "edit_property_id=#id#,type=block") + LinkPage(Page: #Page#, PageParams: "open=block,name=#name#,back_page=#this_page#"){#name#} } If(#Table#==@1tables){ - LinkPage(Class: text-muted fa fa-eye, Page: @1table_view, PageParams: "tabl_id=#id#,table_name=#name#") + LinkPage(Page: @1table_edit, PageParams: "tabl_id=#id#,back_page=#this_page#"){#name#} } - If(#Table#!=@1languages){ - If(#changer_count#==1){ - If(#appid#==0){ - Button(Class: btn-link text-muted fa fa-recycle, Page: #this_page#, PageParams: "Restore=1,Table=#Table#,Id=#id#").Popup(30, "$@1restore_select$") - }.Else{ - If(#ecosystem_id#==1){ - Button(Class: btn-link text-muted fa fa-trash, Page: #this_page#, PageParams: "appid=#appid#", Contract: ItemChangeAppId, Params: "Table=#Table#,Id=#id#,AppId=0").Alert("$@1remove_confirmation$", "$@1confirm_button$", "$@1cancel$") - }.Else{ - Button(Class: btn-link text-muted fa fa-trash, Page: #this_page#, PageParams: "appid=#appid#", Contract: @1ItemChangeAppId, Params: "Table=#Table#,Id=#id#,AppId=0").Alert("$@1remove_confirmation$", "$@1confirm_button$", "$@1cancel$") - - } - } - } + If(#Table#==@1app_params){ + LinkPage(Page: #Page#, PageParams: "id=#id#,back_page=#this_page#"){#name#} + } + If(#Table#==@1languages){ + LinkPage(Page: @1langres_edit, PageParams: "lang_id=#id#,back_page=#this_page#"){#name#} + } + If(`#value#`!=""){ + :Div(text-muted){`#value#`}.Style(max-height:1.5em;overflow:hidden;) + }.ElseIf(`#res#`!=""){ + :Div(text-muted){`#res#`} } - } - If(#Table#==@1contracts){ - LinkPage(Page: #Page#, PageParams: "open=contract,name=#name#,back_page=#this_page#"){#name#} - } - If(#Table#==@1pages){ - LinkPage(Page: #Page#, PageParams: "open=page,name=#name#,back_page=#this_page#"){#name#} - } - If(#Table#==@1blocks){ - LinkPage(Page: #Page#, PageParams: "open=block,name=#name#,back_page=#this_page#"){#name#} - } - If(#Table#==@1tables){ - LinkPage(Page: @1table_edit, PageParams: "tabl_id=#id#,back_page=#this_page#"){#name#} - } - If(#Table#==@1app_params){ - LinkPage(Page: #Page#, PageParams: "id=#id#,back_page=#this_page#"){#name#} - } - If(#Table#==@1languages){ - LinkPage(Page: @1langres_edit, PageParams: "lang_id=#id#,back_page=#this_page#"){#name#} - } - If(`#value#`!=""){ - :Div(text-muted){`#value#`}.Style(max-height:1.5em;overflow:hidden;) - }.ElseIf(`#res#`!=""){ - :Div(text-muted){`#res#`} } } } - } - }.Else{ - Div(text-muted h4 text-center){ - #Name# $@1not_founded$ + }.Else{ + Div(text-muted h4 text-center){ + #Name# $@1not_founded$ + } } } } @@ -260,38 +268,43 @@ If(And(#Restore#,#Table#,#Id#)){ } } } - } - If(And(#appid# == 1,#ecosystem_id# != 1)){ - }.Else{ - If(#Single#){ + If(And(#appid# == 1,#ecosystem_id# != 1)){ }.Else{ - Div(panel-footer){ - Button(Page: #this_page#, PageParams: "Single=binaries,appid=#appid#", Class: btn btn-default mr, Body: $@1binaries$) - Button(Page: #this_page#, PageParams: "Single=languages", Class: btn btn-default, Body: $@1languages$) + If(#Single#){ + }.Else{ + Div(panel-footer){ + Button(Page: #this_page#, PageParams: "Single=binaries,appid=#appid#", Class: btn btn-default mr, Body: $@1binaries$) + Button(Page: #this_page#, PageParams: "Single=languages", Class: btn btn-default, Body: $@1languages$) + } } } } - } - }.Style( - .pull-right a { - margin-right:10px; - } - .text-muted { - color: #909fa7!important; - } - .cols { - -moz-column-count: #cols#; - -webkit-column-count: #cols#; - column-count: #cols#; - } - .item:hover { - background-color: #fafafa; - } - .items tr:hover { - background-color: #fafafa; - } - .preview { - height:30px; - } - ) + }.Style( + .pull-right a { + margin-right:10px; + } + .text-muted { + color: #909fa7!important; + } + .cols { + -moz-column-count: #cols#; + -webkit-column-count: #cols#; + column-count: #cols#; + } + .item:hover { + background-color: #fafafa; + } + .items tr:hover { + background-color: #fafafa; + } + .preview { + height:30px; + } + ) + } +}.Else{ + SetTitle($@1dashboard$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) + } } \ No newline at end of file diff --git a/src/system/pages/export_download.ptl b/src/system/pages/export_download.ptl index 75821ec68..250e251a0 100644 --- a/src/system/pages/export_download.ptl +++ b/src/system/pages/export_download.ptl @@ -1,35 +1,48 @@ -Div(fullscreen){ - SetTitle($@1export$) - Div(breadcrumb){ - Span(Class: text-muted, Body: $@1payload$) - } +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) - DBFind(Name: @1buffer_data, Source: src_buffer).Columns("value->app_name,value->app_id").Where({"key": export, "member_id": #key_id#, "ecosystem": #ecosystem_id#}).Vars(buffer) - DBFind(@1binaries, src_binaries).Where({"name": export, "member_id": #key_id#, "ecosystem": #ecosystem_id#, "app_id": #buffer_value_app_id#}).Custom(app_name){ - Span(#buffer_value_app_name#) - } - - Table(Source: src_binaries, "$@1application$=app_name,=data").Style( - tbody > tr:nth-of-type(odd) { - background-color: #fafbfc; - } - tbody > tr > td { - word-break: break-all; - font-weight: 400; - font-size: 13px; - color: #666; - border-top: 1px solid #eee; - vertical-align: middle; - } - tr > *:first-child { - padding-left:20px; +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + Div(fullscreen){ + SetTitle($@1export$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1payload$) } - tr > *:last-child { - padding-right:20px; - text-align:right; - } - thead { - background-color: #eee; + + DBFind("@1buffer_data", src_buffer).Columns("value->app_name,value->app_id").Where({"key": "export", "account": "#account_id#", "ecosystem": "#ecosystem_id#"}).Vars(buffer) + DBFind("@1binaries", src_binaries).Where({"name": "export", "account": "#account_id#", "ecosystem": "#ecosystem_id#", "app_id": "#buffer_value_app_id#"}).Custom(app_name){ + Span(#buffer_value_app_name#) } - ) + + Table(Source: src_binaries, "$@1application$=app_name,=data").Style( + tbody > tr:nth-of-type(odd) { + background-color: #fafbfc; + } + tbody > tr > td { + word-break: break-all; + font-weight: 400; + font-size: 13px; + color: #666; + border-top: 1px solid #eee; + vertical-align: middle; + } + tr > *:first-child { + padding-left:20px; + } + tr > *:last-child { + padding-right:20px; + text-align:right; + } + thead { + background-color: #eee; + } + ) + } +}.Else{ + SetTitle($@1export$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) + } } \ No newline at end of file diff --git a/src/system/pages/export_resources.ptl b/src/system/pages/export_resources.ptl index af905e8e9..e9d6a5145 100644 --- a/src/system/pages/export_resources.ptl +++ b/src/system/pages/export_resources.ptl @@ -1,101 +1,114 @@ -SetVar(this_page, @1export_resources).(pager_limit, 25) -Div(content-wrapper){ - If(#page_par#){ - SetVar(res_type, #page_par#) - } - - SetTitle($@1application_export$) - Div(breadcrumb text-muted){ - $@1application_export_select$ - } - DBFind(@1buffer_data).Columns("value->app_id,value->app_name,value->menu_name,value->menu_id,value->count_menu").Where({"key": export, "member_id": #key_id#, "ecosystem": #ecosystem_id#}).Vars(buffer) - Include(@1export_link) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) - If(#buffer_value_app_id# > 0){ - If(#res_type#=="pages"){ - SetVar(this_table, @1pages).(where, {"app_id": #buffer_value_app_id#}).(page_par, "pages") - Include(@1pager_header) - DBFind(@1pages, src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({"app_id": #buffer_value_app_id#, "ecosystem": #ecosystem_id#}).Custom(_cbox){ - Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1) - }.Order("id") +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + SetVar(this_page, @1export_resources).(pager_limit, 25) + Div(content-wrapper){ + If(#page_par#){ + SetVar(res_type, #page_par#) } - If(#res_type#=="blocks"){ - SetVar(this_table, @1blocks).(where, {"app_id": #buffer_value_app_id#}).(page_par, "blocks") - Include(@1pager_header) - DBFind(@1blocks, src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({"app_id": #buffer_value_app_id#, "ecosystem": #ecosystem_id#}).Custom(_cbox){ - Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1) - }.Order("id") + + SetTitle($@1application_export$) + Div(breadcrumb text-muted){ + $@1application_export_select$ } - If(#res_type#=="menu"){ - SetVar(this_table, @1menu).(where, {"id": {"$in": [#buffer_value_menu_id#]}}).(page_par, "menu") - Include(@1pager_header) - DBFind(@1menu, src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({"id": {"$in": [#buffer_value_menu_id#]}, "ecosystem": #ecosystem_id#}).Custom(_cbox){ - Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1) - }.Order("id") + DBFind("@1buffer_data").Columns("value->app_id,value->app_name,value->menu_name,value->menu_id,value->count_menu").Where({"key": "export", "account": "#account_id#", "ecosystem": "#ecosystem_id#"}).Vars(buffer) + Include(@1export_link) + + If(#buffer_value_app_id# > 0){ + If(#res_type#=="pages"){ + SetVar(this_table, @1pages).(where, {"app_id": #buffer_value_app_id#}).(page_par, "pages") + Include(@1pager_header) + DBFind("@1pages", src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({"app_id": "#buffer_value_app_id#", "ecosystem": "#ecosystem_id#"}).Custom(_cbox){ + Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1) + }.Order("id") + } + If(#res_type#=="blocks"){ + SetVar(this_table, @1blocks).(where, {"app_id": #buffer_value_app_id#}).(page_par, "blocks") + Include(@1pager_header) + DBFind("@1blocks", src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({"app_id": "#buffer_value_app_id#", "ecosystem": "#ecosystem_id#"}).Custom(_cbox){ + Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1) + }.Order("id") + } + If(#res_type#=="menu"){ + SetVar(this_table, @1menu).(where, {"id": {"$in": [#buffer_value_menu_id#]}}).(page_par, "menu") + Include(@1pager_header) + DBFind("@1menu", src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({"id": {"$in": [#buffer_value_menu_id#]}, "ecosystem": "#ecosystem_id#"}).Custom(_cbox){ + Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1) + }.Order("id") + } + If(#res_type#=="parameters"){ + SetVar(this_table, @1app_params).(where, {"app_id": #buffer_value_app_id#}).(page_par, "parameters") + Include(@1pager_header) + DBFind("@1app_params", src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({"app_id": "#buffer_value_app_id#", "ecosystem": "#ecosystem_id#"}).Custom(_cbox){ + Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1) + }.Order("id") + } + If(#res_type#=="languages"){ + SetVar(this_table, @1languages).(page_par, "languages") + Include(@1pager_header) + DBFind("@1languages", src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({"id": 0}).Custom(_cbox){ + Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1) + }.Order("id") + } + If(#res_type#=="contracts"){ + SetVar(this_table, @1contracts).(where, {"app_id": #buffer_value_app_id#}).(page_par, "contracts") + Include(@1pager_header) + DBFind("@1contracts", src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({"app_id": "#buffer_value_app_id#", "ecosystem": "#ecosystem_id#"}).Custom(_cbox){ + Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1) + }.Order("id") + } + If(#res_type#=="tables"){ + SetVar(this_table, @1tables).(where, {"app_id": #buffer_value_app_id#}).(page_par, "tables") + Include(@1pager_header) + DBFind("@1tables", src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({"app_id": "#buffer_value_app_id#", "ecosystem": "#ecosystem_id#"}).Custom(_cbox){ + Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1) + }.Order("id") + } } - If(#res_type#=="parameters"){ - SetVar(this_table, @1app_params).(where, {"app_id": #buffer_value_app_id#}).(page_par, "parameters") - Include(@1pager_header) - DBFind(@1app_params, src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({"app_id": #buffer_value_app_id#, "ecosystem": #ecosystem_id#}).Custom(_cbox){ - Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1) - }.Order("id") + Div(row){ + Div(col-md-9){ + Table(src, "ID=id,$@1name$=name,=_cbox") + If(#pages_count# > #pager_limit#){ + Include(@1pager) + } + } + Div(col-md-3){ + Include(@1export_info) + } } - If(#res_type#=="languages"){ - SetVar(this_table, @1languages).(page_par, "languages") - Include(@1pager_header) - DBFind(@1languages, src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({"id": 0}).Custom(_cbox){ - Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1) - }.Order("id") + }.Style( + tbody > tr:nth-of-type(odd) { + background-color: #fafbfc; } - If(#res_type#=="contracts"){ - SetVar(this_table, @1contracts).(where, {"app_id": #buffer_value_app_id#}).(page_par, "contracts") - Include(@1pager_header) - DBFind(@1contracts, src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({"app_id": #buffer_value_app_id#, "ecosystem": #ecosystem_id#}).Custom(_cbox){ - Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1) - }.Order("id") + tbody > tr > td { + word-break: break-all; + font-weight: 400; + font-size: 13px; + color: #666; + border-top: 1px solid #eee; + vertical-align: middle; + padding: 8px 20px !important; } - If(#res_type#=="tables"){ - SetVar(this_table, @1tables).(where, {"app_id": #buffer_value_app_id#}).(page_par, "tables") - Include(@1pager_header) - DBFind(@1tables, src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({"app_id": #buffer_value_app_id#, "ecosystem": #ecosystem_id#}).Custom(_cbox){ - Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1) - }.Order("id") + tr > *:first-child { + padding-left:20px; + width: 80px; } - } - Div(row){ - Div(col-md-9){ - Table(src, "ID=id,$@1name$=name,=_cbox") - If(#pages_count# > #pager_limit#){ - Include(@1pager) - } + tr > *:last-child { + padding-right:15px; + width: 50px; + text-align:right; } - Div(col-md-3){ - Include(@1export_info) + thead { + background-color: #eee; } + ) +}.Else{ + SetTitle($@1application_export$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) } -}.Style( - tbody > tr:nth-of-type(odd) { - background-color: #fafbfc; - } - tbody > tr > td { - word-break: break-all; - font-weight: 400; - font-size: 13px; - color: #666; - border-top: 1px solid #eee; - vertical-align: middle; - padding: 8px 20px !important; - } - tr > *:first-child { - padding-left:20px; - width: 80px; - } - tr > *:last-child { - padding-right:15px; - width: 50px; - text-align:right; - } - thead { - background-color: #eee; - } -) \ No newline at end of file +} \ No newline at end of file diff --git a/src/system/pages/history.ptl b/src/system/pages/history.ptl index 42191d847..7ecf0ba1f 100644 --- a/src/system/pages/history.ptl +++ b/src/system/pages/history.ptl @@ -1,131 +1,144 @@ -SetVar(this_page, @1history) -If(#view_mode# == ""){ - SetVar(view_mode, "compact") -} -If(#view_mode# == compact){ - SetVar(compact_button, "bg-gray-lighter") - SetVar(full_button, "bg-gray") -}.Else{ - SetVar(full_button, "bg-gray-lighter") - SetVar(compact_button, "bg-gray") -} -SetVar(element_id, #id#) -If(#type# == page){ - DBFind(@1pages).Where({"id": #element_id#, "ecosystem": #ecosystem_id#}).Limit(1).Vars("res") - SetTitle($@1page_history$: #res_name#) - SetVar(contract_name, "@1EditPage") - GetHistory(Source: src_history, Name: pages, Id: #element_id#) -}.ElseIf(#type# == block){ - DBFind(@1blocks).Where({"id": #element_id#, "ecosystem": #ecosystem_id#}).Limit(1).Vars("res") - SetTitle($@1block_history$: #res_name#) - SetVar(contract_name, "@1EditBlock") - GetHistory(Source: src_history, Name: blocks, Id: #element_id#) -}.ElseIf(#type# == contract){ - DBFind(@1contracts).Where({"id": #element_id#, "ecosystem": #ecosystem_id#}).Limit(1).Vars("res") - SetTitle($@1contract_history$: #res_name#) - SetVar(contract_name, "@1EditContract") - GetHistory(Source: src_history, Name: contracts, Id: #element_id#) -}.ElseIf(#type# == menu){ - DBFind(@1menu).Where({"id": #element_id#, "ecosystem": #ecosystem_id#}).Limit(1).Vars("res") - SetTitle($@1menu_history$: #res_name#) - SetVar(contract_name, "@1EditMenu") - GetHistory(Source: src_history, Name: menu, Id: #element_id#) -} +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) -Div(mr-lg text-right){ - Button(Page: #this_page#, PageParams: "view_mode=compact,type=#type#,id=#element_id#", Class: btn #compact_button# mr-sm, Body: Em(Class: fa fa-bars) $@1compact$) - Button(Page: #this_page#, PageParams: "view_mode=full,type=#type#,id=#element_id#", Class: btn #full_button# mr-sm, Body: Em(Class: fa fa-arrows-alt) $@1full$) -}.Style(margin-top: -33px; z-index: 1001;) +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + SetVar(this_page, @1history) + If(#view_mode# == ""){ + SetVar(view_mode, "compact") + } + If(#view_mode# == compact){ + SetVar(compact_button, "bg-gray-lighter") + SetVar(full_button, "bg-gray") + }.Else{ + SetVar(full_button, "bg-gray-lighter") + SetVar(compact_button, "bg-gray") + } + SetVar(element_id, #id#) + If(#type# == page){ + DBFind("@1pages").Where({"id": "#element_id#", "ecosystem": "#ecosystem_id#"}).Limit(1).Vars(res) + SetTitle($@1page_history$: #res_name#) + SetVar(contract_name, "@1EditPage") + GetHistory(Source: src_history, Name: pages, Id: #element_id#) + }.ElseIf(#type# == block){ + DBFind("@1blocks").Where({"id": "#element_id#", "ecosystem": "#ecosystem_id#"}).Limit(1).Vars(res) + SetTitle($@1block_history$: #res_name#) + SetVar(contract_name, "@1EditBlock") + GetHistory(Source: src_history, Name: blocks, Id: #element_id#) + }.ElseIf(#type# == contract){ + DBFind("@1contracts").Where({"id": "#element_id#", "ecosystem": "#ecosystem_id#"}).Limit(1).Vars(res) + SetTitle($@1contract_history$: #res_name#) + SetVar(contract_name, "@1EditContract") + GetHistory(Source: src_history, Name: contracts, Id: #element_id#) + }.ElseIf(#type# == menu){ + DBFind("@1menu").Where({"id": "#element_id#", "ecosystem": "#ecosystem_id#"}).Limit(1).Vars(res) + SetTitle($@1menu_history$: #res_name#) + SetVar(contract_name, "@1EditMenu") + GetHistory(Source: src_history, Name: menu, Id: #element_id#) + } -Div(fullscreen){ - Div(list-group-item ml-lg mr-lg){ - Div(table){ - Div(table__head){ - Div(table__row){ - Div(table__cell){$@1id$} - Div(table__cell){$@1value$} - Div(table__cell){} + Div(mr-lg text-right){ + Button(Page: #this_page#, PageParams: "view_mode=compact,type=#type#,id=#element_id#", Class: btn #compact_button# mr-sm, Body: Em(Class: fa fa-bars) $@1compact$) + Button(Page: #this_page#, PageParams: "view_mode=full,type=#type#,id=#element_id#", Class: btn #full_button# mr-sm, Body: Em(Class: fa fa-arrows-alt) $@1full$) + }.Style(margin-top: -33px; z-index: 1001;) + + Div(fullscreen){ + Div(list-group-item ml-lg mr-lg){ + Div(table){ + Div(table__head){ + Div(table__row){ + Div(table__cell){$@1id$} + Div(table__cell){$@1value$} + Div(table__cell){} + } } - } - Div(table__row){ - Div(table__cell table__cell_collapse){$@1current$} - Div(table__cell){ - If(#view_mode# == compact){ - VarAsIs(value_as_is, #res_value#) - Span(#value_as_is#) - }.ElseIf(#view_mode# == full){ - VarAsIs(value_as_is, #res_value#) - Code(#value_as_is#) + Div(table__row){ + Div(table__cell table__cell_collapse){$@1current$} + Div(table__cell){ + If(#view_mode# == compact){ + VarAsIs(value_as_is, #res_value#) + Span(#value_as_is#) + }.ElseIf(#view_mode# == full){ + VarAsIs(value_as_is, #res_value#) + Code(#value_as_is#) + } } + Div(table__cell table__cell_collapse){} } - Div(table__cell table__cell_collapse){} - } - ForList(src_history){ - If(#id#>0){ - Div(table__row){ - Div(table__cell table__cell_collapse){#id#} - Div(table__cell){ - If(#view_mode# == compact){ - VarAsIs(value_as_is, #value#) - Span(#value_as_is#) - }.ElseIf(#view_mode# == full){ - VarAsIs(value_as_is, #value#) - Code(#value_as_is#) + ForList(src_history){ + If(#id#>0){ + Div(table__row){ + Div(table__cell table__cell_collapse){#id#} + Div(table__cell){ + If(#view_mode# == compact){ + VarAsIs(value_as_is, #value#) + Span(#value_as_is#) + }.ElseIf(#view_mode# == full){ + VarAsIs(value_as_is, #value#) + Code(#value_as_is#) + } + } + Div(table__cell table__cell_collapse){ + Div(text-right){ + Button(Class: btn bg-gray-lighter mr-sm, Body: Em(Class: fa fa-eye), Page: @1history_compare, PageParams: "type=#type#,element_id=#element_id#,history_id=#id#") + Button(Class: btn bg-gray-lighter, Body: Em(Class: fa fa-undo), Page: #this_page#, PageParams: "type=#type#,id=#element_id#,view_mode=#view_mode#", Contract: #contract_name#, Params: "Id=#element_id#,Value=#value_as_is#").Alert(Text: "$@1want_restore_history_value$", ConfirmButton: "$@1yes$", CancelButton: "$@1no$", Icon: icon-question) + }.Style(min-width: 120px;) } - } - Div(table__cell table__cell_collapse){ - Div(text-right){ - Button(Class: btn bg-gray-lighter mr-sm, Body: Em(Class: fa fa-eye), Page: @1history_compare, PageParams: "type=#type#,element_id=#element_id#,history_id=#id#") - Button(Class: btn bg-gray-lighter, Body: Em(Class: fa fa-undo), Page: #this_page#, PageParams: "type=#type#,id=#element_id#,view_mode=#view_mode#", Contract: #contract_name#, Params: "Id=#element_id#,Value=#value_as_is#").Alert(Text: "$@1want_restore_history_value$", ConfirmButton: "$@1yes$", CancelButton: "$@1no$", Icon: icon-question) - }.Style(min-width: 120px;) } } } } } - } -}.Style( - .table { - display: table; - } + }.Style( + .table { + display: table; + } - .table > div:not(.table__body) { - display: table-row-group; - } + .table > div:not(.table__body) { + display: table-row-group; + } - .table .table__head { - display: table-header-group; - } + .table .table__head { + display: table-header-group; + } - .table .table__head .table__cell { - font-weight: 700; - color: #888; - background: #fff !important; - border-left: 0 !important; - border-right: 0 !important; - border-top: 0 !important; - } + .table .table__head .table__cell { + font-weight: 700; + color: #888; + background: #fff !important; + border-left: 0 !important; + border-right: 0 !important; + border-top: 0 !important; + } - .table .table__row { - display: table-row; - flex-direction: row; - flex-wrap: no-wrap; - } + .table .table__row { + display: table-row; + flex-direction: row; + flex-wrap: no-wrap; + } - .table .table__row:nth-child(even) { - background: #f8f9fc; - } + .table .table__row:nth-child(even) { + background: #f8f9fc; + } - .table .table__row .table__cell { - border-top: solid 1px #eee; - } + .table .table__row .table__cell { + border-top: solid 1px #eee; + } - .table .table__cell { - display: table-cell; - padding: 8px 10px; - } + .table .table__cell { + display: table-cell; + padding: 8px 10px; + } - .table .table__cell.table__cell_collapse { - width: 1px; + .table .table__cell.table__cell_collapse { + width: 1px; + } + ) +}.Else{ + SetTitle($@1page_history$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) } -) \ No newline at end of file +} \ No newline at end of file diff --git a/src/system/pages/history_compare.ptl b/src/system/pages/history_compare.ptl index 13947ae10..a62960c0a 100644 --- a/src/system/pages/history_compare.ptl +++ b/src/system/pages/history_compare.ptl @@ -1,98 +1,111 @@ -SetVar(back_page, @1history) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) -If(#type# == page){ - DBFind(@1pages).Where({"id": #element_id#, "ecosystem": #ecosystem_id#}).Limit(1).Vars("res") - SetTitle($@1page_history$: #res_name# [$@1id$: #history_id#]) - SetVar(contract_name, "@1EditPage") - GetHistory(Source: src_history, Name: pages, Id: #element_id#, RollbackId: #history_id#) -}.ElseIf(#type# == block){ - DBFind(@1blocks).Where({"id": #element_id#, "ecosystem": #ecosystem_id#}).Limit(1).Vars("res") - SetTitle($@1block_history$: #res_name# [$@1id$: #history_id#]) - SetVar(contract_name, "@1EditBlock") - GetHistory(Source: src_history, Name: blocks, Id: #element_id#, RollbackId: #history_id#) -}.ElseIf(#type# == contract){ - DBFind(@1contracts).Where({"id": #element_id#, "ecosystem": #ecosystem_id#}).Limit(1).Vars("res") - SetTitle($@1contract_history$: #res_name# [$@1id$: #history_id#]) - SetVar(contract_name, "@1EditContract") - GetHistory(Source: src_history, Name: contracts, Id: #element_id#, RollbackId: #history_id#) -}.ElseIf(#type# == menu){ - DBFind(@1menu).Where({"id": #element_id#, "ecosystem": #ecosystem_id#}).Limit(1).Vars("res") - SetTitle($@1menu_history$: #res_name# [$@1id$: #history_id#]) - SetVar(contract_name, "@1EditMenu") - GetHistory(Source: src_history, Name: menu, Id: #element_id#, RollbackId: #history_id#) -} +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + SetVar(back_page, @1history) -Div(fullscreen){ - Div(list-group-item ml-lg mr-lg){ - Div(table){ - Div(table__head){ - Div(table__row){ - Div(table__cell){$@1current_value$} - Div(table__cell){$@1history_value$} - } - } - ForList(src_history){ - Div(table__row){ - Div(table__cell){ - VarAsIs(value_as_is, #res_value#) - Code(#value_as_is#) + If(#type# == page){ + DBFind("@1pages").Where({"id": "#element_id#", "ecosystem": "#ecosystem_id#"}).Limit(1).Vars(res) + SetTitle($@1page_history$: #res_name# [$@1id$: #history_id#]) + SetVar(contract_name, "@1EditPage") + GetHistory(Source: src_history, Name: pages, Id: #element_id#, RollbackId: #history_id#) + }.ElseIf(#type# == block){ + DBFind("@1blocks").Where({"id": "#element_id#", "ecosystem": "#ecosystem_id#"}).Limit(1).Vars(res) + SetTitle($@1block_history$: #res_name# [$@1id$: #history_id#]) + SetVar(contract_name, "@1EditBlock") + GetHistory(Source: src_history, Name: blocks, Id: #element_id#, RollbackId: #history_id#) + }.ElseIf(#type# == contract){ + DBFind("@1contracts").Where({"id": "#element_id#", "ecosystem": "#ecosystem_id#"}).Limit(1).Vars(res) + SetTitle($@1contract_history$: #res_name# [$@1id$: #history_id#]) + SetVar(contract_name, "@1EditContract") + GetHistory(Source: src_history, Name: contracts, Id: #element_id#, RollbackId: #history_id#) + }.ElseIf(#type# == menu){ + DBFind("@1menu").Where({"id": "#element_id#", "ecosystem": "#ecosystem_id#"}).Limit(1).Vars(res) + SetTitle($@1menu_history$: #res_name# [$@1id$: #history_id#]) + SetVar(contract_name, "@1EditMenu") + GetHistory(Source: src_history, Name: menu, Id: #element_id#, RollbackId: #history_id#) + } + + Div(fullscreen){ + Div(list-group-item ml-lg mr-lg){ + Div(table){ + Div(table__head){ + Div(table__row){ + Div(table__cell){$@1current_value$} + Div(table__cell){$@1history_value$} } - Div(table__cell table__cell_collapse){ - VarAsIs(value_as_is, #value#) - Code(#value_as_is#) + } + ForList(src_history){ + Div(table__row){ + Div(table__cell){ + VarAsIs(value_as_is, #res_value#) + Code(#value_as_is#) + } + Div(table__cell table__cell_collapse){ + VarAsIs(value_as_is, #value#) + Code(#value_as_is#) + } } } } + Div(text-center){ + Button(Page: #back_page#, PageParams: "type=#type#,id=#element_id#", Class: btn bg-gray-lighter, Body: $@1back$) + Button(Contract: #contract_name#, Params: "Id=#element_id#,Value=#value_as_is#", Page: #back_page#, PageParams: "type=#type#,id=#element_id#", Class: btn btn-primary, Body: $@1restore$).Alert(Text: "$@1want_restore_history_value$", ConfirmButton: "$@1yes$", CancelButton: "$@1no$", Icon: icon-question) + } } - Div(text-center){ - Button(Page: #back_page#, PageParams: "type=#type#,id=#element_id#", Class: btn bg-gray-lighter, Body: $@1back$) - Button(Contract: #contract_name#, Params: "Id=#element_id#,Value=#value_as_is#", Page: #back_page#, PageParams: "type=#type#,id=#element_id#", Class: btn btn-primary, Body: $@1restore$).Alert(Text: "$@1want_restore_history_value$", ConfirmButton: "$@1yes$", CancelButton: "$@1no$", Icon: icon-question) + }.Style( + .table { + display: table; + margin-bottom: 10px; } - } -}.Style( - .table { - display: table; - margin-bottom: 10px; - } - .table > div:not(.table__body) { - display: table-row-group; - } + .table > div:not(.table__body) { + display: table-row-group; + } - .table .table__head { - display: table-header-group; - } + .table .table__head { + display: table-header-group; + } - .table .table__head .table__cell { - font-weight: 700; - color: #888; - background: #fff !important; - border-left: 0 !important; - border-right: 0 !important; - border-top: 0 !important; - } + .table .table__head .table__cell { + font-weight: 700; + color: #888; + background: #fff !important; + border-left: 0 !important; + border-right: 0 !important; + border-top: 0 !important; + } - .table .table__row { - display: table-row; - flex-direction: row; - flex-wrap: no-wrap; - } + .table .table__row { + display: table-row; + flex-direction: row; + flex-wrap: no-wrap; + } - .table .table__row:nth-child(odd) { - background: #f8f9fc; - } + .table .table__row:nth-child(odd) { + background: #f8f9fc; + } - .table .table__row .table__cell { - border-top: solid 1px #eee; - width: 50%; - } + .table .table__row .table__cell { + border-top: solid 1px #eee; + width: 50%; + } - .table .table__cell { - display: table-cell; - padding: 8px 10px; - } + .table .table__cell { + display: table-cell; + padding: 8px 10px; + } - .table .table__cell.table__cell_collapse { - width: 1px; + .table .table__cell.table__cell_collapse { + width: 1px; + } + ) +}.Else{ + SetTitle($@1page_history$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) } -) \ No newline at end of file +} \ No newline at end of file diff --git a/src/system/pages/import_app.ptl b/src/system/pages/import_app.ptl index d329cf682..afbdcd452 100644 --- a/src/system/pages/import_app.ptl +++ b/src/system/pages/import_app.ptl @@ -1,6 +1,6 @@ Div(content-wrapper){ - DBFind(@1buffer_data).Columns("id,value->name,value->data").Where({"key": import, "member_id": #key_id#, "ecosystem": #ecosystem_id#}).Vars(import) - DBFind(@1buffer_data).Columns("value->app_name,value->pages,value->pages_count,value->blocks,value->blocks_count,value->menu,value->menu_count,value->parameters,value->parameters_count,value->languages,value->languages_count,value->contracts,value->contracts_count,value->tables,value->tables_count").Where({"key": import_info, "member_id": #key_id#, "ecosystem": #ecosystem_id#}).Vars(info) + DBFind("@1buffer_data").Columns("id,value->name,value->data").Where({"key": "import", "account": "#account_id#", "ecosystem": "#ecosystem_id#"}).Vars(import) + DBFind("@1buffer_data").Columns("value->app_name,value->pages,value->pages_count,value->blocks,value->blocks_count,value->menu,value->menu_count,value->parameters,value->parameters_count,value->languages,value->languages_count,value->contracts,value->contracts_count,value->tables,value->tables_count").Where({"key": "import_info", "account": "#account_id#", "ecosystem": "#ecosystem_id#"}).Vars(info) SetTitle("$@1import$ - #info_value_app_name#") Data(data_info, "DataName,DataCount,DataInfo"){ diff --git a/src/system/pages/import_upload.ptl b/src/system/pages/import_upload.ptl index 59872a424..d2333d05c 100644 --- a/src/system/pages/import_upload.ptl +++ b/src/system/pages/import_upload.ptl @@ -1,5 +1,5 @@ Div(content-wrapper){ - DBFind(@1roles).Where({"ecosystem": #ecosystem_id#}).Count(roles_count) + DBFind("@1roles").Where({"ecosystem": "#ecosystem_id#"}).Count(roles_count) If(Or(#ecosystem_id#==1,#roles_count#>0)){ SetTitle($@1import$) Div(breadcrumb){ diff --git a/src/system/pages/langres_add.ptl b/src/system/pages/langres_add.ptl index 46b24a292..a863a0c71 100644 --- a/src/system/pages/langres_add.ptl +++ b/src/system/pages/langres_add.ptl @@ -1,65 +1,78 @@ -If(#name#){}.Else{ - SetVar(name,) -} -Div(content-wrapper){ - SetTitle($@1lang_res$) - Div(Class: breadcrumb){ - LinkPage($@1lang_res$, @1app_langres) - Span(/).Style(margin-right: 10px; margin-left: 10px;) - Span(Class: text-muted, Body: $@1new_langres$) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) + +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + If(#name#){}.Else{ + SetVar(name,) } + Div(content-wrapper){ + SetTitle($@1lang_res$) + Div(Class: breadcrumb){ + LinkPage($@1lang_res$, @1app_langres) + Span(/).Style(margin-right: 10px; margin-left: 10px;) + Span(Class: text-muted, Body: $@1new_langres$) + } - Form(panel panel-default){ - Div(panel-body){ - Div(row){ - Div(col-md-12){ - Label($@1name$) - Input(Name:Name, Value:#name#) + Form(panel panel-default){ + Div(panel-body){ + Div(row){ + Div(col-md-12){ + Label($@1name$) + Input(Name:Name, Value:#name#) + } } - } - Div(row text-muted){ - Div(col-md-1 mt-lg){ - Label(){$@1localization$} + Div(row text-muted){ + Div(col-md-1 mt-lg){ + Label(){$@1localization$} + } + Div(col-md-10 mt-lg){ + Label(){$@1value$} + } + Div(col-md-1 mt-lg){ + Label(){$@1action$} + } } - Div(col-md-10 mt-lg){ - Label(){$@1value$} + If(#cs#==""){ + SetVar(cs,0) } - Div(col-md-1 mt-lg){ - Label(){$@1action$} + If(#del# == 1){ + SetVar(cs,Calculate(#cs# - 1)) + }.Else{ + SetVar(cs,Calculate(#cs# + 1)) } - } - If(#cs#==""){ - SetVar(cs,0) - } - If(#del# == 1){ - SetVar(cs,Calculate(#cs# - 1)) - }.Else{ - SetVar(cs,Calculate(#cs# + 1)) - } - Range(params_range, 0, #cs#) - ForList(Source: params_range){ - Div(row mt-sm){ - Div(col-md-1){ - Input(Name:LocaleArr) - }.Style(input {padding: 6px;text-align:center;}) - Div(col-md-10){ - Input(Name:ValueArr) - } - Div(col-md-1){ - If(And(#cs#==#params_range_index#,#cs#>1)){ - Button(Class:fa fa-trash btn btn-default, PageParams: "cs=#cs#,del=1", Page: @1langres_add) + Range(params_range, 0, #cs#) + ForList(Source: params_range){ + Div(row mt-sm){ + Div(col-md-1){ + Input(Name:LocaleArr) + }.Style(input {padding: 6px;text-align:center;}) + Div(col-md-10){ + Input(Name:ValueArr) + } + Div(col-md-1){ + If(And(#cs#==#params_range_index#,#cs#>1)){ + Button(Class:fa fa-trash btn btn-default, PageParams: "cs=#cs#,del=1", Page: @1langres_add) + } } } } - } - Div(row){ - Div(col-md-12 mt-lg){ - LinkPage(Body:$@1locale_add$, Page: @1langres_add, PageParams:"cs=#cs#") + Div(row){ + Div(col-md-12 mt-lg){ + LinkPage(Body:$@1locale_add$, Page: @1langres_add, PageParams:"cs=#cs#") + } } } + Div(panel-footer text-right){ + Button(Body: $@1save$, Class: btn btn-primary, Contract: @1NewLangJoint, Page: @1app_langres) + } } - Div(panel-footer text-right){ - Button(Body: $@1save$, Class: btn btn-primary, Contract: @1NewLangJoint, Page: @1app_langres) - } + } +}.Else{ + SetTitle($@1lang_res$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) } } \ No newline at end of file diff --git a/src/system/pages/langres_edit.ptl b/src/system/pages/langres_edit.ptl index ca5640f5a..02fa00cb0 100644 --- a/src/system/pages/langres_edit.ptl +++ b/src/system/pages/langres_edit.ptl @@ -1,92 +1,105 @@ -SetVar(this_page,"@1langres_edit") -If(#back_page#==""){ - SetVar(back_page,"@1app_langres") -} -Div(content-wrapper){ - SetTitle($@1lang_res$) - Div(Class: breadcrumb){ - LinkPage($@1lang_res$, @1app_langres) - Span(/).Style(margin-right: 10px; margin-left: 10px;) - Span(Class: text-muted, Body: $@1editing$) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) + +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + SetVar(this_page,"@1langres_edit") + If(#back_page#==""){ + SetVar(back_page,"@1app_langres") } + Div(content-wrapper){ + SetTitle($@1lang_res$) + Div(Class: breadcrumb){ + LinkPage($@1lang_res$, @1app_langres) + Span(/).Style(margin-right: 10px; margin-left: 10px;) + Span(Class: text-muted, Body: $@1editing$) + } - Form(panel panel-default){ - Div(panel-body){ - DBFind(@1languages, src_leng).Vars(pre).Where({"id": #lang_id#, "ecosystem": #ecosystem_id#}) - Div(row){ - Div(col-md-12){ - Label($@1name$) - Input(Name: LangName, Disabled: "true", Value: #pre_name#) + Form(panel panel-default){ + Div(panel-body){ + DBFind("@1languages", src_leng).Vars(pre).Where({"id": "#lang_id#", "ecosystem": "#ecosystem_id#"}) + Div(row){ + Div(col-md-12){ + Label($@1name$) + Input(Name: LangName, Disabled: "true", Value: #pre_name#) + } } - } - Div(row){ - Div(col-md-1 mt-lg){ - Label(Class: text-muted, Body: $@1localization$) + Div(row){ + Div(col-md-1 mt-lg){ + Label(Class: text-muted, Body: $@1localization$) + } + Div(col-md-9 mt-lg){ + Label(Class: text-muted, Body: $@1value$) + } + Div(col-md-2 mt-lg){ + Label(Class: text-muted, Body: $@1action$) + } } - Div(col-md-9 mt-lg){ - Label(Class: text-muted, Body: $@1value$) + + JsonToSource(pv, #pre_res#) + ForList(Source: pv, Index:s_ind){ + SetVar(max_sec, #s_ind#) } - Div(col-md-2 mt-lg){ - Label(Class: text-muted, Body: $@1action$) + If(#cs#==""){ + SetVar(cs, #max_sec#) + } + If(Or(#del_flag#==1,#del_data#>0)){ + SetVar(cs, Calculate(Exp:#cs#-1, Type: int)) } - } - - JsonToSource(pv, #pre_res#) - ForList(Source: pv, Index:s_ind){ - SetVar(max_sec, #s_ind#) - } - If(#cs#==""){ - SetVar(cs, #max_sec#) - } - If(Or(#del_flag#==1,#del_data#>0)){ - SetVar(cs, Calculate(Exp:#cs#-1, Type: int)) - } - SetVar(next_sec, Calculate(Exp:#cs#+1, Type: int)) - SetVar(data_sec, Calculate(Exp:#cs#-#max_sec#, Type: int)) + SetVar(next_sec, Calculate(Exp:#cs#+1, Type: int)) + SetVar(data_sec, Calculate(Exp:#cs#-#max_sec#, Type: int)) - ForList(Source: pv, Index:s_ind){ - If(#s_ind#>#cs#){ - }.Else{ + ForList(Source: pv, Index:s_ind){ + If(#s_ind#>#cs#){ + }.Else{ + Div(row){ + Div(col-md-1 mt-sm){ + Input(Name: LocaleArr, Value: `#key#`) + }.Style(input {padding: 6px;text-align:center;}) + Div(col-md-9 mt-sm){ + Input(Name: ValueArr, Value: `#value#`) + } + Div(col-md-2 mt-sm){ + If(And(#s_ind#>1,#s_ind#==#cs#)){ + Button(Body: Em(Class: fa fa-trash), Class: btn btn-default, PageParams: "lang_id=#lang_id#,cs=#cs#,del_data=#s_ind#", Page: #this_page#) + } + } + } + } + } + Range(params_range, #max_sec#, #cs#) + ForList(Source: params_range, Index:s_ind){ Div(row){ Div(col-md-1 mt-sm){ - Input(Name: LocaleArr, Value: `#key#`) + Input(Name:LocaleArr) }.Style(input {padding: 6px;text-align:center;}) Div(col-md-9 mt-sm){ - Input(Name: ValueArr, Value: `#value#`) + Input(Name:ValueArr) } Div(col-md-2 mt-sm){ - If(And(#s_ind#>1,#s_ind#==#cs#)){ - Button(Body: Em(Class: fa fa-trash), Class: btn btn-default, PageParams: "lang_id=#lang_id#,cs=#cs#,del_data=#s_ind#", Page: #this_page#) + If(#s_ind#==#data_sec#){ + Button(Body: Em(Class: fa fa-trash), Class: btn btn-default, PageParams: "lang_id=#lang_id#,cs=#cs#,del_flag=1", Page: #this_page#) } } } } - } - Range(params_range, #max_sec#, #cs#) - ForList(Source: params_range, Index:s_ind){ Div(row){ - Div(col-md-1 mt-sm){ - Input(Name:LocaleArr) - }.Style(input {padding: 6px;text-align:center;}) - Div(col-md-9 mt-sm){ - Input(Name:ValueArr) - } - Div(col-md-2 mt-sm){ - If(#s_ind#==#data_sec#){ - Button(Body: Em(Class: fa fa-trash), Class: btn btn-default, PageParams: "lang_id=#lang_id#,cs=#cs#,del_flag=1", Page: #this_page#) - } + Div(col-md-12 mt-lg){ + LinkPage(Body: $@1locale_add$, Page: @1langres_edit, PageParams: "lang_id=#lang_id#,cs=#next_sec#") } } } - Div(row){ - Div(col-md-12 mt-lg){ - LinkPage(Body: $@1locale_add$, Page: @1langres_edit, PageParams: "lang_id=#lang_id#,cs=#next_sec#") - } + Div(panel-footer text-right){ + Button(Body: $@1save$, Class: btn btn-primary, Contract: @1EditLangJoint, Params: "Id=#lang_id#", Page: #back_page#) } } - Div(panel-footer text-right){ - Button(Body: $@1save$, Class: btn btn-primary, Contract: @1EditLangJoint, Params: "Id=#lang_id#", Page: #back_page#) - } + } +}.Else{ + SetTitle($@1lang_res$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) } } \ No newline at end of file diff --git a/src/system/pages/menus_list.ptl b/src/system/pages/menus_list.ptl index 34139445b..85f216b0d 100644 --- a/src/system/pages/menus_list.ptl +++ b/src/system/pages/menus_list.ptl @@ -1,46 +1,59 @@ -SetVar(this_page, @1menus_list).(this_table, @1menu) -Include(@1pager_header) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) -SetTitle("$@1menu$") -Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$@1menu_section$")) -AddToolButton(Title: $@1create$, Page: editor, Icon: icon-plus, PageParams: "create=menu,appId=0") +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + SetVar(this_page, @1menus_list).(this_table, @1menu) + Include(@1pager_header) -If(#search#){ - SetVar(where, {"ecosystem": #ecosystem_id#, {"$or":[{name: {"$ilike": "#search#"}}]}}) -}.Else{ - SetVar(where, {"ecosystem": #ecosystem_id#}) -} + SetTitle("$@1menu$") + Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$@1menu_section$")) + AddToolButton(Title: $@1create$, Page: editor, Icon: icon-plus, PageParams: "create=menu,appId=0") -Div(list-group-item ml-lg mr-lg pt-lg){ - SetVar(search_name, LangRes(@1name)) - Include(@1search) -} + If(#search#){ + SetVar(where, {"ecosystem": "#ecosystem_id#", "name": {"$ilike": "#search#"}}) + }.Else{ + SetVar(where, {"ecosystem": "#ecosystem_id#"}) + } -DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(action){ - Span(Class: pull-right){ - LinkPage(Body: Em(Class: fa fa-history), Class: text-primary h4 mh-sm, Page: @1history, PageParams: "id=#id#,type=menu") - LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4, Page: @1properties_edit, PageParams: "edit_property_id=#id#,type=menu") + Div(list-group-item ml-lg mr-lg pt-lg){ + SetVar(search_name, LangRes(@1name)) + Include(@1search) } -}.Custom(_name){ - LinkPage(Page: editor, Class: text-primary h5, Body: "#name#", PageParams: "open=menu,name=#name#") -}.Count(count) -Div(fullscreen){ - Div(table-responsive ml-lg mr-lg){ - Div(list-group-item){ - If(#count# > 0){ - Table(src, "$@1name$=_name,$@1header$=title,$@1conditions$=conditions,=action") - }.Else{ - Div(Class: text-center h4 text-muted, Body: "$@1menu$ $@1not_founded$") - } - }.Style( - margin-top:-15px; - tbody > tr:nth-of-type(odd) { - background-color: #f8f9fc; - } - ) + DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(action){ + Span(Class: pull-right){ + LinkPage(Body: Em(Class: fa fa-history), Class: text-primary h4 mh-sm, Page: @1history, PageParams: "id=#id#,type=menu") + LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4, Page: @1properties_edit, PageParams: "edit_property_id=#id#,type=menu") + } + }.Custom(_name){ + LinkPage(Page: editor, Class: text-primary h5, Body: "#name#", PageParams: "open=menu,name=#name#") + }.Count(count) + + Div(fullscreen){ + Div(table-responsive ml-lg mr-lg){ + Div(list-group-item){ + If(#count# > 0){ + Table(src, "$@1name$=_name,$@1header$=title,$@1conditions$=conditions,=action") + }.Else{ + Div(Class: text-center h4 text-muted, Body: "$@1menu$ $@1not_founded$") + } + }.Style( + margin-top:-15px; + tbody > tr:nth-of-type(odd) { + background-color: #f8f9fc; + } + ) + } + } + Div(mt-sm ml-lg mr-sm mb-sm){ + Include(@1pager) + } +}.Else{ + SetTitle($@1menu$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) } -} -Div(mt-sm ml-lg mr-sm mb-sm){ - Include(@1pager) } \ No newline at end of file diff --git a/src/system/pages/params_edit.ptl b/src/system/pages/params_edit.ptl index b8b858762..77af8b88b 100644 --- a/src/system/pages/params_edit.ptl +++ b/src/system/pages/params_edit.ptl @@ -1,62 +1,75 @@ -If(#back_page#==""){ - SetVar(back_page, @1params_list) -} -Div(content-wrapper){ - If(#stylesheet# == stylesheet){ - DBFind(@1parameters, src_params).Where({"name": #stylesheet#, "ecosystem": #ecosystem_id#}).Vars("param") - }.Else{ - If(#id#>0){ - DBFind(@1parameters, src_params).Where({"id": #id#, "ecosystem": #ecosystem_id#}).Vars("param") - }.Else{ - SetVar(param_name, $@1new_parameter$) - } - } +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) - SetTitle($@1ecosystem_parameters$) - Div(Class: breadcrumb){ - LinkPage($@1ecosystem_parameters$, @1params_list) - Span(/).Style(margin-right: 10px; margin-left: 10px;) - Span(Class: text-muted, Body: #param_name#) +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + If(#back_page#==""){ + SetVar(back_page, @1params_list) } - Form(){ - Div(form-group){ - Label($@1name$) - If(#param_id#>0){ - Input(Name: name, Value: #param_name#, Disabled: "true") + Div(content-wrapper){ + If(#stylesheet# == stylesheet){ + DBFind("@1parameters", src_params).Where({"name": "#stylesheet#", "ecosystem": "#ecosystem_id#"}).Vars(param) + }.Else{ + If(#id#>0){ + DBFind("@1parameters", src_params).Where({"id": "#id#", "ecosystem": "#ecosystem_id#"}).Vars(param) }.Else{ - Input(Name: name) + SetVar(param_name, $@1new_parameter$) } } - Div(form-group){ - If(#param_id#>0){ - Input(Type: textarea, Name: value, Value: "#param_value#").Style(height: 500px !important;) - }.Else{ - Input(Type: textarea, Name: value).Style(height: 500px !important;) - } + + SetTitle($@1ecosystem_parameters$) + Div(Class: breadcrumb){ + LinkPage($@1ecosystem_parameters$, @1params_list) + Span(/).Style(margin-right: 10px; margin-left: 10px;) + Span(Class: text-muted, Body: #param_name#) } - Div(form-group){ - Label($@1change_conditions$) - If(#param_id#>0){ - Input(Name: conditions, Value: #param_conditions#) - }.Else{ - Input(Name: conditions) + Form(){ + Div(form-group){ + Label($@1name$) + If(#param_id#>0){ + Input(Name: name, Value: #param_name#, Disabled: "true") + }.Else{ + Input(Name: name) + } } - } - Div(form-group text-right){ - If(#param_id#>0){ - DBFind(@1applications).Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) - SetVar(tid, AppParam(App: #application_id#, Name: voting_template_ecosysparams, Ecosystem: 1)) - If(#tid# > 0){ - DBFind(@1voting_templates).Where({"ecosystem": #ecosystem_id#, "id": #tid#}).Columns("subject->voters").Vars(template) + Div(form-group){ + If(#param_id#>0){ + Input(Type: textarea, Name: value, Value: "#param_value#").Style(height: 500px !important;) + }.Else{ + Input(Type: textarea, Name: value).Style(height: 500px !important;) } - If(And(#template_subject_voters#>0,#template_subject_voters#==#role_id#)){ - Button(Class: btn btn-primary, Body: $@1voting$, Contract: @1VotingRunEditEcosysParam, Params: "Id=#param_id#,Value=Val(value)", Page: @1voting_list) + } + Div(form-group){ + Label($@1change_conditions$) + If(#param_id#>0){ + Input(Name: conditions, Value: #param_conditions#) }.Else{ - Button(Class: btn btn-primary, Body: $@1save$, Contract: @1EditParameter, Params: "Id=#param_id#,Value=Val(value),Conditions=Val(conditions)", Page: #back_page#) + Input(Name: conditions) + } + } + Div(form-group text-right){ + If(#param_id#>0){ + DBFind("@1applications").Where({"ecosystem": 1, "name": "Basic"}).Columns("name,id").Vars(application) + SetVar(tid, AppParam(App: #application_id#, Name: voting_template_ecosysparams, Ecosystem: 1)) + If(#tid# > 0){ + DBFind("@1voting_templates").Where({"ecosystem": "#ecosystem_id#", "id": "#tid#"}).Columns("subject->voters").Vars(template) + } + If(And(#template_subject_voters#>0,#template_subject_voters#==#role_id#)){ + Button(Class: btn btn-primary, Body: $@1voting$, Contract: @1VotingRunEditEcosysParam, Params: "Id=#param_id#,Value=Val(value)", Page: @1voting_list) + }.Else{ + Button(Class: btn btn-primary, Body: $@1save$, Contract: @1EditParameter, Params: "Id=#param_id#,Value=Val(value),Conditions=Val(conditions)", Page: #back_page#) + } + }.Else{ + Button(Class: btn btn-primary, Body: $@1save$, Contract: @1NewParameter, Params: "Name=Val(name),Value=Val(value),Conditions=Val(conditions)", Page: #back_page#) } - }.Else{ - Button(Class: btn btn-primary, Body: $@1save$, Contract: @1NewParameter, Params: "Name=Val(name),Value=Val(value),Conditions=Val(conditions)", Page: #back_page#) } } } +}.Else{ + SetTitle($@1ecosystem_parameters$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) + } } \ No newline at end of file diff --git a/src/system/pages/params_list.ptl b/src/system/pages/params_list.ptl index 2186e52a2..78a961cb9 100644 --- a/src/system/pages/params_list.ptl +++ b/src/system/pages/params_list.ptl @@ -1,42 +1,55 @@ -SetVar(this_page, @1params_list).(this_table, @1parameters) -Include(@1pager_header) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) -SetTitle("$@1ecosystem_parameters$") -Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$@1sysparams_section$")) -AddToolButton(Title: $@1style_manage$, Page: @1params_edit, Icon: icon-picture, PageParams:"stylesheet=stylesheet") -AddToolButton(Title: $@1create$, Page: @1params_edit, Icon: icon-plus) +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + SetVar(this_page, @1params_list).(this_table, @1parameters) + Include(@1pager_header) -If(#search#){ - SetVar(where, {"ecosystem": #ecosystem_id#, {"$or":[{name: {"$ilike": "#search#"}}]}}) -}.Else{ - SetVar(where, {"ecosystem": #ecosystem_id#}) -} + SetTitle("$@1ecosystem_parameters$") + Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$@1sysparams_section$")) + AddToolButton(Title: $@1style_manage$, Page: @1params_edit, Icon: icon-picture, PageParams:"stylesheet=stylesheet") + AddToolButton(Title: $@1create$, Page: @1params_edit, Icon: icon-plus) + + If(#search#){ + SetVar(where, {"ecosystem": "#ecosystem_id#", "name": {"$ilike": "#search#"}}) + }.Else{ + SetVar(where, {"ecosystem": "#ecosystem_id#"}) + } -Div(list-group-item ml-lg mr-lg pt-lg){ - SetVar(search_name, LangRes(@1name)) - Include(@1search) -} + Div(list-group-item ml-lg mr-lg pt-lg){ + SetVar(search_name, LangRes(@1name)) + Include(@1search) + } -DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_name){ - LinkPage(Page: @1params_edit, Class: text-primary h5, Body: "#name#", PageParams: "id=#id#") -}.Count(count) + DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_name){ + LinkPage(Page: @1params_edit, Class: text-primary h5, Body: "#name#", PageParams: "id=#id#") + }.Count(count) -Div(fullscreen){ - Div(table-responsive ml-lg mr-lg){ - Div(list-group-item){ - If(#count# > 0){ - Table(src, "$@1name$=_name,$@1value$=value,$@1conditions$=conditions") - }.Else{ - Div(Class: text-center h4 text-muted, Body: "$@1ecosystem_parameters$ $@1not_founded$") - } - }.Style( - margin-top:-15px; - tbody > tr:nth-of-type(odd) { - background-color: #f8f9fc; - } - ) + Div(fullscreen){ + Div(table-responsive ml-lg mr-lg){ + Div(list-group-item){ + If(#count# > 0){ + Table(src, "$@1name$=_name,$@1value$=value,$@1conditions$=conditions") + }.Else{ + Div(Class: text-center h4 text-muted, Body: "$@1ecosystem_parameters$ $@1not_founded$") + } + }.Style( + margin-top:-15px; + tbody > tr:nth-of-type(odd) { + background-color: #f8f9fc; + } + ) + } + } + Div(mt-sm ml-lg mr-sm mb-sm){ + Include(@1pager) + } +}.Else{ + SetTitle($@1ecosystem_parameters$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) } -} -Div(mt-sm ml-lg mr-sm mb-sm){ - Include(@1pager) } \ No newline at end of file diff --git a/src/system/pages/properties_edit.ptl b/src/system/pages/properties_edit.ptl index da6e5e174..f048dab85 100644 --- a/src/system/pages/properties_edit.ptl +++ b/src/system/pages/properties_edit.ptl @@ -1,132 +1,146 @@ -Div(Class: content-wrapper){ - SetTitle($@1edit_properties$) - Div(breadcrumb){ - Div(){ - If(#type# == page){ - LinkPage($@1pages$, @1app_pages) - Span(/).Style(margin-right: 10px; margin-left: 10px;) - Span($@1edit_page$, text-muted) - DBFind(Name: @1pages, Source: src_page).Where({"id": #edit_property_id#, "ecosystem": #ecosystem_id#}).Vars(item) - DBFind(@1menu, src_menus).Where({"ecosystem": #ecosystem_id#}) - } - If(#type# == contract){ - DBFind(Name: @1contracts, Source: src_contract).Columns("id,name,value,wallet_id,token_id,conditions,app_id").Where({"id": #edit_property_id#, "ecosystem": #ecosystem_id#}).Vars(item) - LinkPage($@1contracts$, @1app_contracts) - Span(/).Style(margin-right: 10px; margin-left: 10px;) - Span($@1edit_contract$, text-muted) - } - If(#type# == block){ - LinkPage($@1blocks$, @1app_blocks) - Span(/).Style(margin-right: 10px; margin-left: 10px;) - Span($@1edit_block$, text-muted) - DBFind(Name: @1blocks, Source: src_block).Where({"id": #edit_property_id#, "ecosystem": #ecosystem_id#}).Vars(item) - } - If(#type# == menu){ - LinkPage($@1menu$, @1menus_list) - Span(/).Style(margin-right: 10px; margin-left: 10px;) - Span($@1edit_menu$, text-muted) - DBFind(Name: @1menu, Source: src_menu).Where({"id": #edit_property_id#, "ecosystem": #ecosystem_id#}).Vars(item) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) + +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + Div(Class: content-wrapper){ + SetTitle($@1edit_properties$) + Div(breadcrumb){ + Div(){ + If(#type# == page){ + LinkPage($@1pages$, @1app_pages) + Span(/).Style(margin-right: 10px; margin-left: 10px;) + Span($@1edit_page$, text-muted) + DBFind("@1pages", src_page).Where({"id": "#edit_property_id#", "ecosystem": "#ecosystem_id#"}).Vars(item) + DBFind("@1menu", src_menus).Where({"ecosystem": "#ecosystem_id#"}) + } + If(#type# == contract){ + DBFind("@1contracts", src_contract).Columns("id,name,value,wallet_id,token_id,conditions,app_id").Where({"id": "#edit_property_id#", "ecosystem": "#ecosystem_id#"}).Vars(item) + LinkPage($@1contracts$, @1app_contracts) + Span(/).Style(margin-right: 10px; margin-left: 10px;) + Span($@1edit_contract$, text-muted) + } + If(#type# == block){ + LinkPage($@1blocks$, @1app_blocks) + Span(/).Style(margin-right: 10px; margin-left: 10px;) + Span($@1edit_block$, text-muted) + DBFind("@1blocks", src_block).Where({"id": "#edit_property_id#", "ecosystem": "#ecosystem_id#"}).Vars(item) + } + If(#type# == menu){ + LinkPage($@1menu$, @1menus_list) + Span(/).Style(margin-right: 10px; margin-left: 10px;) + Span($@1edit_menu$, text-muted) + DBFind("@1menu", src_menu).Where({"id": "#edit_property_id#", "ecosystem": "#ecosystem_id#"}).Vars(item) + } } } - } - Form(){ - Div(form-group){ - Label($@1name$) - Input(Name: Name, Value: #item_name#, Disabled: "true") - } - If(#type# == page){ - Div(form-group){ - Label($@1menu$) - Select(Name: Menu, Source: src_menus, NameColumn: name, ValueColumn: name, Value: #item_menu#) - } + Form(){ Div(form-group){ - Label($@1conditions$) - Input(Name: Conditions, Value: #item_conditions#) + Label($@1name$) + Input(Name: Name, Value: #item_name#, Disabled: "true") } - Div(form-group){ - Label($@1page_validate_count$) - Input(Name: ValidateCount, Type: number, Value: #item_validate_count#) - } - Div(form-group){ - Label($@1page_validate_mode$) - Input(Name: ValidateMode, Type: number, Value: #item_validate_mode#) - } - Div(form-group text-right){ - Button(Body: $@1save$, Class: btn btn-primary, Page: @1app_pages, Contract: @1EditPage, Params: "Menu=Val(Menu),Conditions=Val(Conditions),Id=#edit_property_id#") - } - } - If(#type# == contract){ - Div(){ + If(#type# == page){ + Div(form-group){ + Label($@1menu$) + Select(Name: Menu, Source: src_menus, NameColumn: name, ValueColumn: name, Value: #item_menu#) + } Div(form-group){ - Label($@1bind_wallet$) - Div(row){ - Div(col-md-12){ - If(#item_wallet_id# == 0){ - Input(Name: WalletV, Value: 0, Disabled: "true") - }.Else{ - If(#item_wallet_id#==#key_id#){ - Div(input-group){ + Label($@1conditions$) + Input(Name: Conditions, Value: #item_conditions#) + } + Div(form-group){ + Label($@1page_validate_count$) + Input(Name: ValidateCount, Type: number, Value: #item_validate_count#) + } + Div(form-group){ + Label($@1page_validate_mode$) + Input(Name: ValidateMode, Type: number, Value: #item_validate_mode#) + } + Div(form-group text-right){ + Button(Body: $@1save$, Class: btn btn-primary, Page: @1app_pages, Contract: @1EditPage, Params: "Menu=Val(Menu),Conditions=Val(Conditions),Id=#edit_property_id#") + } + } + If(#type# == contract){ + Div(){ + Div(form-group){ + Label($@1bind_wallet$) + Div(row){ + Div(col-md-12){ + If(#item_wallet_id# == 0){ + Input(Name: WalletV, Value: 0, Disabled: "true") + }.Else{ + SetVar(account_key, AddressToId(#account_id#)) + If(#item_wallet_id#==#account_key#){ + Div(input-group){ + SetVar(address_item_wallet_id, Address(#item_wallet_id#)) + Input(Name: WalletV, Value: #address_item_wallet_id#, Disabled: "true") + Div(input-group-btn){ + Button(Body: $@1unbind$, Class: btn bg-gray-lighter buttons, Contract: @1UnbindWallet, Params: "Id=#edit_property_id#", Page: @1properties_edit, PageParams: "edit_property_id=#edit_property_id#,type=#type#").Alert(Text: $@1want_unbind_contract$, ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question) + } + } + }.Else{ SetVar(address_item_wallet_id, Address(#item_wallet_id#)) Input(Name: WalletV, Value: #address_item_wallet_id#, Disabled: "true") - Div(input-group-btn){ - Button(Body: $@1unbind$, Class: btn bg-gray-lighter buttons, Contract: @1UnbindWallet, Params: "Id=#edit_property_id#", Page: @1properties_edit, PageParams: "edit_property_id=#edit_property_id#,type=#type#").Alert(Text: $@1want_unbind_contract$, ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question) - } } - }.Else{ - SetVar(address_item_wallet_id, Address(#item_wallet_id#)) - Input(Name: WalletV, Value: #address_item_wallet_id#, Disabled: "true") } } } } - } - Div(form-group){ - Div(row){ - Div(col-md-12){ - Span(Body: "$@1contract_binding_another_user_desc$", Class: m0 text-muted) - Div(input-group){ - Input(Name: Wallet, Placeholder: "xxxx-xxxx-xxxx-xxxx-xxxx") - Div(input-group-btn){ - Button(Body: $@1bind$, Class: btn bg-gray-lighter buttons, Contract: @1BindWallet, Params: "Id=#edit_property_id#,WalletId=Val(Wallet)", Page: @1properties_edit, PageParams: "edit_property_id=#edit_property_id#,type=#type#").Alert(Text: $@1want_bind_contract$, ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question) + Div(form-group){ + Div(row){ + Div(col-md-12){ + Span(Body: "$@1contract_binding_another_user_desc$", Class: m0 text-muted) + Div(input-group){ + Input(Name: Wallet, Placeholder: "xxxx-xxxx-xxxx-xxxx-xxxx") + Div(input-group-btn){ + Button(Body: $@1bind$, Class: btn bg-gray-lighter buttons, Contract: @1BindWallet, Params: "Id=#edit_property_id#,WalletId=Val(Wallet)", Page: @1properties_edit, PageParams: "edit_property_id=#edit_property_id#,type=#type#").Alert(Text: $@1want_bind_contract$, ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question) + } } } } } - } + Div(form-group){ + Label($@1conditions$) + Input(Name: Conditions, Value: #item_conditions#) + } + Div(form-group text-right){ + Button(Body: $@1save$, Class: btn btn-primary, Page: @1app_contracts, Contract: @1EditContract, Params: "Conditions=Val(Conditions),WalletId=Val(Wallet),Id=#edit_property_id#") + } + }.Style( + .buttons { + border: 1px solid #dde6e9; + } + ) + } + If(#type# == block){ Div(form-group){ Label($@1conditions$) Input(Name: Conditions, Value: #item_conditions#) } Div(form-group text-right){ - Button(Body: $@1save$, Class: btn btn-primary, Page: @1app_contracts, Contract: @1EditContract, Params: "Conditions=Val(Conditions),WalletId=Val(Wallet),Id=#edit_property_id#") - } - }.Style( - .buttons { - border: 1px solid #dde6e9; + Button(Body: $@1save$, Class: btn btn-primary, Page: @1app_blocks, Contract: @1EditBlock, Params: "Conditions=Val(Conditions),Id=#edit_property_id#") } - ) - } - If(#type# == block){ - Div(form-group){ - Label($@1conditions$) - Input(Name: Conditions, Value: #item_conditions#) } - Div(form-group text-right){ - Button(Body: $@1save$, Class: btn btn-primary, Page: @1app_blocks, Contract: @1EditBlock, Params: "Conditions=Val(Conditions),Id=#edit_property_id#") - } - } - If(#type# == menu){ - Div(form-group){ - Label($@1menu_title$) - Input(Name: Title, Value: #item_title#) - } - Div(form-group){ - Label($@1conditions$) - Input(Name: Conditions, Value: #item_conditions#) - } - Div(form-group text-right){ - Button(Body: $@1save$, Class: btn btn-primary, Page: @1menus_list, Contract: @1EditMenu, Params: "Conditions=Val(Conditions),Id=#edit_property_id#,NameTitle=Val(Title)") + If(#type# == menu){ + Div(form-group){ + Label($@1menu_title$) + Input(Name: Title, Value: #item_title#) + } + Div(form-group){ + Label($@1conditions$) + Input(Name: Conditions, Value: #item_conditions#) + } + Div(form-group text-right){ + Button(Body: $@1save$, Class: btn btn-primary, Page: @1menus_list, Contract: @1EditMenu, Params: "Conditions=Val(Conditions),Id=#edit_property_id#,NameTitle=Val(Title)") + } } } } +}.Else{ + SetTitle($@1edit_properties$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) + } } \ No newline at end of file diff --git a/src/system/pages/section_access.ptl b/src/system/pages/section_access.ptl index 6be304c98..c33ff01b5 100644 --- a/src/system/pages/section_access.ptl +++ b/src/system/pages/section_access.ptl @@ -1,37 +1,50 @@ -DBFind(@1sections).Where({"ecosystem": #ecosystem_id#, "id": #id#}).Vars(section) -DBFind("@1applications").Where({"ecosystem": #ecosystem_id#, "name": "System"}).Vars("system_app") +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) -Div(content-wrapper){ - SetTitle($@1section_access_rights$) - Div(Class: breadcrumb){ - LinkPage($@1sections$, @1section_list) - Span(/).Style(margin-right: 10px; margin-left: 10px;) - Span(Class: text-muted, Body: #section_title#) - } - Form(){ - Div(form-group){ - Label($@1roles_access$) - DBFind(@1roles,src_roles).Where({"ecosystem": #ecosystem_id#, "deleted": 0}).Columns("id,role_name").Order(id) - Div(input-group mb-sm){ - Select(Name: access_rid, Source:src_roles, NameColumn:role_name, ValueColumn: id) - Div(input-group-btn){ - Button(Class: btn btn-primary fa fa-plus, Page: section_access, PageParams:"id=#section_id#", Contract: @1SectionRoles, Params:"Id=#section_id#,Rid=Val(access_rid),Operation=add") +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + DBFind("@1sections").Where({"ecosystem": "#ecosystem_id#", "id": "#id#"}).Vars(section) + DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(system_app) + + Div(content-wrapper){ + SetTitle($@1section_access_rights$) + Div(Class: breadcrumb){ + LinkPage($@1sections$, @1section_list) + Span(/).Style(margin-right: 10px; margin-left: 10px;) + Span(Class: text-muted, Body: #section_title#) + } + Form(){ + Div(form-group){ + Label($@1roles_access$) + DBFind("@1roles", src_roles).Where({"ecosystem": "#ecosystem_id#", "deleted": 0}).Columns("id,role_name").Order("id") + Div(input-group mb-sm){ + Select(Name: access_rid, Source:src_roles, NameColumn:role_name, ValueColumn: id) + Div(input-group-btn){ + Button(Class: btn btn-primary fa fa-plus, Page: section_access, PageParams:"id=#section_id#", Contract: @1SectionRoles, Params:"Id=#section_id#,Rid=Val(access_rid),Operation=add") + } } - } - DBFind(@1sections).Where({"ecosystem": #ecosystem_id#, "id": #section_id#}).Columns("roles_access").Vars(json) - If(#json_roles_access#=="[]"){ - Span(Body: $@1available_sections$, Class: m0 text-muted) - }.Else{ - DBFind(@1roles,src_roles_access).Where({"ecosystem": #ecosystem_id#, "id": {"$in": #json_roles_access#}}).Columns("id,role_name") - ForList(src_roles_access){ - SetVar(role_admin, AppParam(App: #system_app_id#, Name: "role_admin")) - If(#role_id# == #role_admin#){ - Button(Class: btn btn-info mr-sm mb-sm, Page: @1section_access, PageParams:"id=#section_id#", Contract: @1SectionRoles, Params:"Id=#section_id#,Rid=#id#,Operation=remove", Body: Span(Class: fa fa-remove) #role_name#) - }.Else{ - Button(Class: btn btn-default mr-sm mb-sm, Page: @1section_access, PageParams:"id=#section_id#", Contract: @1SectionRoles, Params:"Id=#section_id#,Rid=#id#,Operation=remove", Body: Span(Class: fa fa-remove) #role_name#) + DBFind("@1sections").Where({"ecosystem": "#ecosystem_id#", "id": "#section_id#"}).Columns("roles_access").Vars(json) + If(#json_roles_access#=="[]"){ + Span(Body: $@1available_sections$, Class: m0 text-muted) + }.Else{ + DBFind("@1roles", src_roles_access).Where({"ecosystem": "#ecosystem_id#", "id": {"$in": #json_roles_access#}}).Columns("id,role_name") + ForList(src_roles_access){ + SetVar(role_admin, AppParam(App: #system_app_id#, Name: "role_admin")) + If(#role_id# == #role_admin#){ + Button(Class: btn btn-info mr-sm mb-sm, Page: @1section_access, PageParams:"id=#section_id#", Contract: @1SectionRoles, Params:"Id=#section_id#,Rid=#id#,Operation=remove", Body: Span(Class: fa fa-remove) #role_name#) + }.Else{ + Button(Class: btn btn-default mr-sm mb-sm, Page: @1section_access, PageParams:"id=#section_id#", Contract: @1SectionRoles, Params:"Id=#section_id#,Rid=#id#,Operation=remove", Body: Span(Class: fa fa-remove) #role_name#) + } } } - } + } } } +}.Else{ + SetTitle($@1section_access_rights$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) + } } \ No newline at end of file diff --git a/src/system/pages/section_add.ptl b/src/system/pages/section_add.ptl index 083200775..a0f629c6b 100644 --- a/src/system/pages/section_add.ptl +++ b/src/system/pages/section_add.ptl @@ -1,36 +1,49 @@ -Div(content-wrapper){ - SetTitle($@1section_add$) - Div(breadcrumb){ - LinkPage($@1sections$, @1section_list) - Span(/, mh) - Span(Class: text-muted, Body: $@1new_section$) - } +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) - Form(){ - Div(form-group){ - Label($@1title$) - Input(Name: Title) +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + Div(content-wrapper){ + SetTitle($@1section_add$) + Div(breadcrumb){ + LinkPage($@1sections$, @1section_list) + Span(/, mh) + Span(Class: text-muted, Body: $@1new_section$) } - Div(form-group){ - Data(src_status, "name,value"){ - $@1hidden_section$,0 - $@1regular_section$,1 - $@1main_section$,2 + + Form(){ + Div(form-group){ + Label($@1title$) + Input(Name: Title) + } + Div(form-group){ + Data(src_status, "name,value"){ + $@1hidden_section$,0 + $@1regular_section$,1 + $@1main_section$,2 + } + Label($@1status$) + Select(Name: Status, Value: #section_status#, Source: src_status, NameColumn: "name", ValueColumn: "value") + Span(Body: $@1main_section_warning$, Class: m0 text-muted) + } + Div(form-group){ + Label($@1link$) + Input(Name: Urlname) + } + Div(form-group){ + Label($@1section_main_page$) + Input(Name: Page) + } + Div(form-group){ + Button(Class: btn btn-primary, Body: $@1save$, Contract: @1NewSection, Page: @1section_list) } - Label($@1status$) - Select(Name: Status, Value: #section_status#, Source: src_status, NameColumn: "name", ValueColumn: "value") - Span(Body: $@1main_section_warning$, Class: m0 text-muted) - } - Div(form-group){ - Label($@1link$) - Input(Name: Urlname) - } - Div(form-group){ - Label($@1section_main_page$) - Input(Name: Page) - } - Div(form-group){ - Button(Class: btn btn-primary, Body: $@1save$, Contract: @1NewSection, Page: @1section_list) } } +}.Else{ + SetTitle($@1section_add$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) + } } \ No newline at end of file diff --git a/src/system/pages/section_edit.ptl b/src/system/pages/section_edit.ptl index 15f1f47cd..0ddb22ec3 100644 --- a/src/system/pages/section_edit.ptl +++ b/src/system/pages/section_edit.ptl @@ -1,45 +1,58 @@ -DBFind(@1sections).Where({"ecosystem": #ecosystem_id#, "id": #id#}).Vars(section) -Div(content-wrapper){ - SetTitle($@1section_edit$) - Div(breadcrumb){ - LinkPage($@1sections$, @1section_list) - Span(/, mh) - Span(Class: text-muted, Body: #section_title#) - } +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) - Form(){ - Div(form-group){ - Label($@1title$) - Input(Name: Title, Value: #section_title#) +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + DBFind("@1sections").Where({"ecosystem": "#ecosystem_id#", "id": "#id#"}).Vars(section) + Div(content-wrapper){ + SetTitle($@1section_edit$) + Div(breadcrumb){ + LinkPage($@1sections$, @1section_list) + Span(/, mh) + Span(Class: text-muted, Body: #section_title#) } - Div(form-group){ - Data(src_status, "name,value"){ - $@1hidden_section$,0 - $@1regular_section$,1 - $@1main_section$,2 + + Form(){ + Div(form-group){ + Label($@1title$) + Input(Name: Title, Value: #section_title#) } - Label($@1status$) - If(#section_status#==2){ - Input(Name: placeholder, Value: "$@1main_section$", Disabled: "true") - Span(Body: $@1main_section_warning$, Class: m0 text-muted) - }.Else{ - Select(Name: Status, Value: #section_status#, Source: src_status, NameColumn: "name", ValueColumn: "value") + Div(form-group){ + Data(src_status, "name,value"){ + $@1hidden_section$,0 + $@1regular_section$,1 + $@1main_section$,2 + } + Label($@1status$) + If(#section_status#==2){ + Input(Name: placeholder, Value: "$@1main_section$", Disabled: "true") + Span(Body: $@1main_section_warning$, Class: m0 text-muted) + }.Else{ + Select(Name: Status, Value: #section_status#, Source: src_status, NameColumn: "name", ValueColumn: "value") + } } - } - Div(form-group){ - Label($@1link$) - Input(Name: Urlname, Value: #section_urlname#) - } - Div(form-group){ - Label($@1section_main_page$) - Input(Name: Page, Value: #section_page#) - } - Div(form-group){ - If(#section_status#==2){ - Button(Class: btn btn-primary, Body: $@1save$, Contract: @1EditSection, Page: @1section_list, Params: "Id=#section_id#,Status=#section_status#") - }.Else{ - Button(Class: btn btn-primary, Body: $@1save$, Contract: @1EditSection, Page: @1section_list, Params: "Id=#section_id#") + Div(form-group){ + Label($@1link$) + Input(Name: Urlname, Value: #section_urlname#) + } + Div(form-group){ + Label($@1section_main_page$) + Input(Name: Page, Value: #section_page#) + } + Div(form-group){ + If(#section_status#==2){ + Button(Class: btn btn-primary, Body: $@1save$, Contract: @1EditSection, Page: @1section_list, Params: "Id=#section_id#,Status=#section_status#") + }.Else{ + Button(Class: btn btn-primary, Body: $@1save$, Contract: @1EditSection, Page: @1section_list, Params: "Id=#section_id#") + } } } } +}.Else{ + SetTitle($@1section_edit$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) + } } \ No newline at end of file diff --git a/src/system/pages/section_list.ptl b/src/system/pages/section_list.ptl index 930a9fe97..97aa1c7cf 100644 --- a/src/system/pages/section_list.ptl +++ b/src/system/pages/section_list.ptl @@ -1,58 +1,71 @@ -SetVar(this_page, @1section_list).(this_table, @1sections) -Include(@1pager_header) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) -SetTitle("$@1sections$") -Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$@1sections_manage_page$")) -AddToolButton(Title: $@1create$, Page: @1section_add, Icon: icon-plus) +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + SetVar(this_page, @1section_list).(this_table, @1sections) + Include(@1pager_header) -If(#search#){ - SetVar(where, {"ecosystem": #ecosystem_id#, {"$or": [{title: {"$ilike": "#search#"}}]}}) -}.Else{ - SetVar(where, {"ecosystem": #ecosystem_id#}) -} - -Div(list-group-item ml-lg mr-lg pt-lg){ - SetVar(search_name, LangRes(@1title)) - Include(@1search) -} + SetTitle("$@1sections$") + Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: "$@1sections_manage_page$")) + AddToolButton(Title: $@1create$, Page: @1section_add, Icon: icon-plus) -DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(custom_status){ - If(#status# == 0){ - $@1hidden_section$ + If(#search#){ + SetVar(where, {"ecosystem": "#ecosystem_id#", "title": {"$ilike": "#search#"}}) + }.Else{ + SetVar(where, {"ecosystem": "#ecosystem_id#"}) } - If(#status# == 1){ - $@1regular_section$ + + Div(list-group-item ml-lg mr-lg pt-lg){ + SetVar(search_name, LangRes(@1title)) + Include(@1search) } - If(#status# == 2){ - $@1main_section$ + + DBFind(#this_table#, src).Where(#where#).Order({"id": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(custom_status){ + If(#status# == 0){ + $@1hidden_section$ + } + If(#status# == 1){ + $@1regular_section$ + } + If(#status# == 2){ + $@1main_section$ + } + }.Custom(custom_order){ + Button(Body: Em(Class: fa fa-arrow-down), Class: btn-xs btn-link, Page: @1section_list, Contract: @1SectionLevelDown, Params: "Id=#id#") + Button(Body: Em(Class: fa fa-arrow-up), Class: btn-xs btn-link, Page: @1section_list, Contract: @1SectionLevelUp, Params: "Id=#id#") + }.Custom(custom_action){ + Span(Class: pull-right){ + LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4, Page: @1section_access, PageParams: "id=#id#") + } + }.Custom(_title){ + LinkPage(Page: @1section_edit, Class: text-primary h5, Body: "#title#", PageParams: "id=#id#") + }.Count(count) + + Div(fullscreen){ + Div(table-responsive ml-lg mr-lg){ + Div(list-group-item){ + If(#count# > 0){ + Table(src, "$@1title$=_title,$@1link$=urlname,$@1section_page$=page,$@1status$=custom_status,=custom_order,=custom_action") + }.Else{ + Div(Class: text-center h4 text-muted, Body: "$@1sections$ $@1not_founded$") + } + }.Style( + margin-top:-15px; + tbody > tr:nth-of-type(odd) { + background-color: #f8f9fc; + } + ) + } } -}.Custom(custom_order){ - Button(Body: Em(Class: fa fa-arrow-down), Class: btn-xs btn-link, Page: @1section_list, Contract: @1SectionLevelDown, Params: "Id=#id#") - Button(Body: Em(Class: fa fa-arrow-up), Class: btn-xs btn-link, Page: @1section_list, Contract: @1SectionLevelUp, Params: "Id=#id#") -}.Custom(custom_action){ - Span(Class: pull-right){ - LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4, Page: @1section_access, PageParams: "id=#id#") + Div(mt-sm ml-lg mr-sm mb-sm){ + Include(@1pager) } -}.Custom(_title){ - LinkPage(Page: @1section_edit, Class: text-primary h5, Body: "#title#", PageParams: "id=#id#") -}.Count(count) - -Div(fullscreen){ - Div(table-responsive ml-lg mr-lg){ - Div(list-group-item){ - If(#count# > 0){ - Table(src, "$@1title$=_title,$@1link$=urlname,$@1section_page$=page,$@1status$=custom_status,=custom_order,=custom_action") - }.Else{ - Div(Class: text-center h4 text-muted, Body: "$@1sections$ $@1not_founded$") - } - }.Style( - margin-top:-15px; - tbody > tr:nth-of-type(odd) { - background-color: #f8f9fc; - } - ) +}.Else{ + SetTitle($@1sections$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) } -} -Div(mt-sm ml-lg mr-sm mb-sm){ - Include(@1pager) } \ No newline at end of file diff --git a/src/system/pages/table_create.ptl b/src/system/pages/table_create.ptl index ad70623de..5d13a2b70 100644 --- a/src/system/pages/table_create.ptl +++ b/src/system/pages/table_create.ptl @@ -1,101 +1,114 @@ -Div(content-wrapper){ - SetTitle($@1table_create$) - Div(breadcrumb){ - Div(){ - LinkPage($@1tables$, @1app_tables) - Span(/).Style(margin-right: 10px; margin-left: 10px;) - Span($@1table_create$, text-muted) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) + +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + Div(content-wrapper){ + SetTitle($@1table_create$) + Div(breadcrumb){ + Div(){ + LinkPage($@1tables$, @1app_tables) + Span(/).Style(margin-right: 10px; margin-left: 10px;) + Span($@1table_create$, text-muted) + } } - } - Data(src_type,"type,name"){ - text,"Text" - number,"Number" - varchar,"Varchar" - datetime,"Date/Time" - money,"Money" - double,"Double" - character,"Character" - json,"JSON" - } - Form(){ - Div(panel panel-default){ - Div(panel-body){ - Div(row){ - Div(col-sm-12){ - Label($@1name$) - Input(Name:Name) - } - } - Div(row mt-lg){ - Div(col-xs-4 col-md-4){ - Label(Class: text-muted, Body: $@1columns$) - Input(Name:disinp, Disabled: true, Value: id) - } - Div(col-xs-6 col-md-7){ - Label(Class: text-muted, Body: $@1type$) - Input(Name: disinp, Disabled: true, Value: Number) - } - Div(col-xs-2 col-md-1){ - Label(Class: text-muted, Body: $@1actions$) + Data(src_type,"type,name"){ + text,"Text" + number,"Number" + varchar,"Varchar" + datetime,"Date/Time" + money,"Money" + double,"Double" + character,"Character" + json,"JSON" + } + Form(){ + Div(panel panel-default){ + Div(panel-body){ + Div(row){ + Div(col-sm-12){ + Label($@1name$) + Input(Name:Name) + } } - } - If(#cs#==""){ - SetVar(cs, Calculate( Exp: 0, Type: int)) - } - If(#del# == 1){ - SetVar(cs, Calculate( Exp: #cs# - 1, Type: int)) - }.Else{ - SetVar(cs, Calculate( Exp: #cs# + 1, Type: int)) - } - Range(params_range, 0, #cs#) - ForList(Source: params_range){ - Div(row mt-sm){ + Div(row mt-lg){ Div(col-xs-4 col-md-4){ - Input(Name:ColumnsArr) + Label(Class: text-muted, Body: $@1columns$) + Input(Name:disinp, Disabled: true, Value: id) } Div(col-xs-6 col-md-7){ - Select(Name: TypesArr, Source: src_type, NameColumn: name, ValueColumn: type) + Label(Class: text-muted, Body: $@1type$) + Input(Name: disinp, Disabled: true, Value: Number) } Div(col-xs-2 col-md-1){ - If(And(#cs#==#params_range_index#, #cs# > 1)){ - Button(Body: Em(Class: fa fa-trash), Class: btn btn-default, PageParams: "cs=#cs#,del=1,application_id=#application_id#", Page: @1table_create) + Label(Class: text-muted, Body: $@1actions$) + } + } + If(#cs#==""){ + SetVar(cs, Calculate( Exp: 0, Type: int)) + } + If(#del# == 1){ + SetVar(cs, Calculate( Exp: #cs# - 1, Type: int)) + }.Else{ + SetVar(cs, Calculate( Exp: #cs# + 1, Type: int)) + } + Range(params_range, 0, #cs#) + ForList(Source: params_range){ + Div(row mt-sm){ + Div(col-xs-4 col-md-4){ + Input(Name:ColumnsArr) + } + Div(col-xs-6 col-md-7){ + Select(Name: TypesArr, Source: src_type, NameColumn: name, ValueColumn: type) + } + Div(col-xs-2 col-md-1){ + If(And(#cs#==#params_range_index#, #cs# > 1)){ + Button(Body: Em(Class: fa fa-trash), Class: btn btn-default, PageParams: "cs=#cs#,del=1,application_id=#application_id#", Page: @1table_create) + } } } } } + Div(panel-footer text-right){ + Button(Body: $@1column_add$, Class: btn btn-primary, Page: @1table_create, PageParams: "cs=#cs#,application_id=#application_id#") + } } - Div(panel-footer text-right){ - Button(Body: $@1column_add$, Class: btn btn-primary, Page: @1table_create, PageParams: "cs=#cs#,application_id=#application_id#") - } - } - Div(row){ - Div(col-xs-6 col-sm-6 col-md-6){ - Div(panel panel-default){ - Div(panel-heading, Body: $@1write_permissions$) - Div(panel-body){ - Div(form-group){ - Label($@1insert$) - Input(Name: InsertPerm, Value: ContractConditions("MainCondition")) - } - Div(form-group){ - Label($@1updating$) - Input(Name: UpdatePerm, Value: ContractConditions("MainCondition")) - } - Div(form-group){ - Label($@1new_column$) - Input(Name: NewColumnPerm, Value: ContractConditions("MainCondition")) + Div(row){ + Div(col-xs-6 col-sm-6 col-md-6){ + Div(panel panel-default){ + Div(panel-heading, Body: $@1write_permissions$) + Div(panel-body){ + Div(form-group){ + Label($@1insert$) + Input(Name: InsertPerm, Value: ContractConditions("MainCondition")) + } + Div(form-group){ + Label($@1updating$) + Input(Name: UpdatePerm, Value: ContractConditions("MainCondition")) + } + Div(form-group){ + Label($@1new_column$) + Input(Name: NewColumnPerm, Value: ContractConditions("MainCondition")) + } + Div(form-group){ + Label($@1reading$) + Input(Name: ReadPerm, Value: "true") + } } - Div(form-group){ - Label($@1reading$) - Input(Name: ReadPerm, Value: "true") + Div(panel-footer text-right){ + Button(Body: $@1save$, Class: btn btn-primary, Contract: @1NewTableJoint, Page: @1app_tables, Params: "ApplicationId=#application_id#") } } - Div(panel-footer text-right){ - Button(Body: $@1save$, Class: btn btn-primary, Contract: @1NewTableJoint, Page: @1app_tables, Params: "ApplicationId=#application_id#") - } } } } } +}.Else{ + SetTitle($@1table_create$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) + } } \ No newline at end of file diff --git a/src/system/pages/table_edit.ptl b/src/system/pages/table_edit.ptl index 2d73a3ee7..e7a254196 100644 --- a/src/system/pages/table_edit.ptl +++ b/src/system/pages/table_edit.ptl @@ -1,141 +1,154 @@ -Div(content-wrapper){ - DBFind(@1tables).Columns("id,name,columns,conditions,permissions->insert,permissions->update,permissions->new_column,permissions->read").Vars(pre).Where({"id": #tabl_id#, "ecosystem": #ecosystem_id#}) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) - SetTitle($@1tables$) - Div(breadcrumb){ - Div(){ - LinkPage($@1tables$, @1app_tables) - Span(/, mh) - LinkPage(#pre_name#, @1table_view,, "tabl_id=#tabl_id#") - Span(/, mh) - Span($@1edit_table$, text-muted) +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + Div(content-wrapper){ + DBFind("@1tables").Columns("id,name,columns,conditions,permissions->insert,permissions->update,permissions->new_column,permissions->read").Vars(pre).Where({"id": "#tabl_id#", "ecosystem": "#ecosystem_id#"}) + + SetTitle($@1tables$) + Div(breadcrumb){ + Div(){ + LinkPage($@1tables$, @1app_tables) + Span(/, mh) + LinkPage(#pre_name#, @1table_view,, "tabl_id=#tabl_id#") + Span(/, mh) + Span($@1edit_table$, text-muted) + } } - } - Form(){ - Div(panel panel-default){ - Div(panel-body){ - Div(row){ - Div(col-xs-3 col-md-3 h4){ - Label($@1name$) - } - Div(col-xs-2 col-md-2 h4){ - Label($@1type$) - } - Div(col-xs-5 col-md-5 h4){ - Label($@1conditions$) - } - Div(col-xs-2 col-md-2 text-right){ + Form(){ + Div(panel panel-default){ + Div(panel-body){ + Div(row){ + Div(col-xs-3 col-md-3 h4){ + Label($@1name$) + } + Div(col-xs-2 col-md-2 h4){ + Label($@1type$) + } + Div(col-xs-5 col-md-5 h4){ + Label($@1conditions$) + } + Div(col-xs-2 col-md-2 text-right){ + } } - } - JsonToSource(src_columns, #pre_columns#) - ForList(src_columns){ - SetVar(name_column,#key#) - Div(list-group-item){ - Div(row){ - Div(col-xs-3 col-md-3 h5){ - Span(#key#) - } - Div(col-xs-2 col-md-2 h5){ - SetVar(col_type,GetColumnType(#pre_name#, #key#)) - If(#col_type# == text){ - Span("Text") - }.ElseIf(#col_type# == number){ - Span("Number") - }.ElseIf(#col_type# == money){ - Span("Money") - }.ElseIf(#col_type# == varchar){ - Span("Varchar") - }.ElseIf(#col_type# == datetime){ - Span("Date/Time") - }.ElseIf(#col_type# == double){ - Span("Double") - }.ElseIf(#col_type# == character){ - Span("Character") - }.ElseIf(#col_type# == json){ - Span("JSON") - }.ElseIf(#col_type# == bytea){ - Span("Binary Data") - }.ElseIf(#col_type# == uuid){ - Span("UUID") + JsonToSource(src_columns, #pre_columns#) + ForList(src_columns){ + SetVar(name_column,#key#) + Div(list-group-item){ + Div(row){ + Div(col-xs-3 col-md-3 h5){ + Span(#key#) } - } - Div(col-xs-5 col-md-5){ - SetVar(isObject,0) - JsonToSource(condition,#value#) - ForList(condition){ - SetVar(isObject,1) - If(#key#==read){ + Div(col-xs-2 col-md-2 h5){ + SetVar(col_type,GetColumnType(#pre_name#, #key#)) + If(#col_type# == text){ + Span("Text") + }.ElseIf(#col_type# == number){ + Span("Number") + }.ElseIf(#col_type# == money){ + Span("Money") + }.ElseIf(#col_type# == varchar){ + Span("Varchar") + }.ElseIf(#col_type# == datetime){ + Span("Date/Time") + }.ElseIf(#col_type# == double){ + Span("Double") + }.ElseIf(#col_type# == character){ + Span("Character") + }.ElseIf(#col_type# == json){ + Span("JSON") + }.ElseIf(#col_type# == bytea){ + Span("Binary Data") + }.ElseIf(#col_type# == uuid){ + Span("UUID") + } + } + Div(col-xs-5 col-md-5){ + SetVar(isObject,0) + JsonToSource(condition,#value#) + ForList(condition){ + SetVar(isObject,1) + If(#key#==read){ + Div(){ + Span($@1reading$:,text-muted) + Span(#value#,ml-sm) + } + }.ElseIf(#key#==update){ + Div(){ + Span($@1updating$:,text-muted) + Span(#value#,ml-sm) + } + } + } + If(#isObject#==0){ Div(){ Span($@1reading$:,text-muted) - Span(#value#,ml-sm) + Span(true,ml-sm) } - }.ElseIf(#key#==update){ Div(){ Span($@1updating$:,text-muted) Span(#value#,ml-sm) } } } - If(#isObject#==0){ - Div(){ - Span($@1reading$:,text-muted) - Span(true,ml-sm) - } - Div(){ - Span($@1updating$:,text-muted) - Span(#value#,ml-sm) - } + Div(col-xs-2 col-md-2 text-right){ + Button(Body: $@1edit$, Class: btn btn-primary, Page: @1column_edit, PageParams: "name_column=#name_column#,tabl_id=#tabl_id#") } } - Div(col-xs-2 col-md-2 text-right){ - Button(Body: $@1edit$, Class: btn btn-primary, Page: @1column_edit, PageParams: "name_column=#name_column#,tabl_id=#tabl_id#") - } } } } + Div(panel-footer text-right){ + Button(Body: $@1column_add$, Class: btn btn-primary, Page: @1column_add, PageParams: "next_table_name=#pre_name#,tabl_id=#tabl_id#") + } } - Div(panel-footer text-right){ - Button(Body: $@1column_add$, Class: btn btn-primary, Page: @1column_add, PageParams: "next_table_name=#pre_name#,tabl_id=#tabl_id#") - } - } - Div(row){ - Div(col-xs-6 col-md-6){ - Div(panel panel-default){ - Div(panel-heading){$@1write_permissions$} - Div(panel-body){ - Div(form-group){ - Label($@1insert$) - Input(Name: InsertPerm, Type: text, Value: #pre_permissions_insert#) - } - Div(form-group){ - Label($@1updating$) - Input(Name: UpdatePerm, Type: text, Value: #pre_permissions_update#) - } - Div(form-group){ - Label($@1new_column$) - Input(Name: NewColumnPerm, Type: text, Value: #pre_permissions_new_column#) + Div(row){ + Div(col-xs-6 col-md-6){ + Div(panel panel-default){ + Div(panel-heading){$@1write_permissions$} + Div(panel-body){ + Div(form-group){ + Label($@1insert$) + Input(Name: InsertPerm, Type: text, Value: #pre_permissions_insert#) + } + Div(form-group){ + Label($@1updating$) + Input(Name: UpdatePerm, Type: text, Value: #pre_permissions_update#) + } + Div(form-group){ + Label($@1new_column$) + Input(Name: NewColumnPerm, Type: text, Value: #pre_permissions_new_column#) + } + Div(form-group){ + Label($@1reading$) + Input(Name: ReadPerm, Type: text, Value: #pre_permissions_read#) + } } - Div(form-group){ - Label($@1reading$) - Input(Name: ReadPerm, Type: text, Value: #pre_permissions_read#) + Div(panel-footer text-right){ + Button(Body: $@1save$, Class: btn btn-primary, Contract: @1EditTable, Page: @1app_tables, Params: "Name=#pre_name#") } } - Div(panel-footer text-right){ - Button(Body: $@1save$, Class: btn btn-primary, Contract: @1EditTable, Page: @1app_tables, Params: "Name=#pre_name#") - } } - } - Div(col-xs-6 col-md-6){ - Div(panel panel-default){ - Div(panel-heading){$@1conditions_for_change$} - Div(panel-body){ - Div(form-group){ - Input(Name: Insert_condition, Disabled: true, Type: text, Value: #pre_conditions#) + Div(col-xs-6 col-md-6){ + Div(panel panel-default){ + Div(panel-heading){$@1conditions_for_change$} + Div(panel-body){ + Div(form-group){ + Input(Name: Insert_condition, Disabled: true, Type: text, Value: #pre_conditions#) + } } } } } } } +}.Else{ + SetTitle($@1tables$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) + } } \ No newline at end of file diff --git a/src/system/pages/table_view.ptl b/src/system/pages/table_view.ptl index 9b2b8ecd6..763163396 100644 --- a/src/system/pages/table_view.ptl +++ b/src/system/pages/table_view.ptl @@ -1,37 +1,50 @@ -If(#page_par#!=""){ - SetVar(Name: tabl_id, Value: #page_par#) -}.Else{ - SetVar(Name: page_par, Value: #tabl_id#) -} -DBFind(@1tables).Where({"id": #tabl_id#, "ecosystem": #ecosystem_id#}).Columns("id,name").Vars(pre) +DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "System"}).Vars(application) +SetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer)) +SetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin)) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_developer_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(developer_access) +DBFind("@1roles_participants").Where({"ecosystem": "#ecosystem_id#", "$and": [{"role->id": {"$in": [#role_admin_id#]}}, {"role->id": "#role_id#"}], "member->account": "#account_id#", "deleted": 0}).Vars(admin_access) + +If(Or(#developer_access_id#>0,#admin_access_id#>0)){ + If(#page_par#!=""){ + SetVar(Name: tabl_id, Value: #page_par#) + }.Else{ + SetVar(Name: page_par, Value: #tabl_id#) + } + DBFind("@1tables").Where({"id": "#tabl_id#", "ecosystem": "#ecosystem_id#"}).Columns("id,name").Vars(pre) -SetTitle($@1tables$) -Div(breadcrumb){ - LinkPage($@1tables$, @1app_tables) - Span(/,mh) - Span(#pre_name#, text-muted) - Span(/,mh) - LinkPage(Body:$@1edit$, Page: @1table_edit, PageParams: "tabl_id=#tabl_id#") -} + SetTitle($@1tables$) + Div(breadcrumb){ + LinkPage($@1tables$, @1app_tables) + Span(/,mh) + Span(#pre_name#, text-muted) + Span(/,mh) + LinkPage(Body:$@1edit$, Page: @1table_edit, PageParams: "tabl_id=#tabl_id#") + } -SetVar(this_table, #pre_name#).(this_page, @1table_view).(pager_limit, 50) -SetVar(where, {"id": {"$neq": 0}}) -Include(@1pager_header) + SetVar(this_table, #pre_name#).(this_page, @1table_view).(pager_limit, 50) + SetVar(where, {"id": {"$neq": 0}}) + Include(@1pager_header) -DBFind(#this_table#, src).Limit(#pager_limit#).Offset(#pager_offset#).Where(#where#) + DBFind(#this_table#, src).Limit(#pager_limit#).Offset(#pager_offset#).Where(#where#) -Div(fullscreen){ - Div(table-responsive ml-lg mr-lg){ - Div(list-group-item){ - Table(src) - }.Style( - margin-top:-10px; - tbody > tr:nth-of-type(odd) { - background-color: #f8f9fc; - } - ) + Div(fullscreen){ + Div(table-responsive ml-lg mr-lg){ + Div(list-group-item){ + Table(src) + }.Style( + margin-top:-10px; + tbody > tr:nth-of-type(odd) { + background-color: #f8f9fc; + } + ) + } + } + Div(mt-sm ml-lg mr-sm mb-sm){ + Include(@1pager) + } +}.Else{ + SetTitle($@1tables$) + Div(breadcrumb){ + Span(Class: text-muted, Body: $@1role_change_no_view_permission$) } -} -Div(mt-sm ml-lg mr-sm mb-sm){ - Include(@1pager) } \ No newline at end of file diff --git a/src/system/struct.dot b/src/system/struct.dot index 92f30a5a4..09bd4ab64 100644 --- a/src/system/struct.dot +++ b/src/system/struct.dot @@ -1,29 +1,32 @@ digraph G { fontsize="24"; -label="system\nWednesday, 20-Feb-19 14:38:37 +10"; +label="system\nSunday, 07-Jul-19 12:06:44 +10"; nojustify=true; ordering=out; rankdir=LR; size="30"; "developer_menu\nmenu" [color=blue, fontcolor=blue, group=menus, shape=record]; "developer_resources\nmenu" [color=blue, fontcolor=blue, group=menus, shape=record]; -"1buffer_data\ntable" -> "app_binary\npage" "1applications\ntable" -> "app_binary\npage" +"1roles_participants\ntable" -> "app_binary\npage" +"1buffer_data\ntable" -> "app_binary\npage" "src\ntable" -> "app_binary\npage" "app_binary\npage" -> "@1pager_header\nblock" [ color=green, label=include ] "app_binary\npage" -> "@1admin_link\nblock" [ color=green, label=include ] "app_binary\npage" -> "@1pager\nblock" [ color=green, label=include ] "app_binary\npage" [color=green, fontcolor=green, group=pages, shape=record]; -"1buffer_data\ntable" -> "app_blocks\npage" "1applications\ntable" -> "app_blocks\npage" +"1roles_participants\ntable" -> "app_blocks\npage" +"1buffer_data\ntable" -> "app_blocks\npage" "src\ntable" -> "app_blocks\npage" "app_blocks\npage" -> "editor\npage" [ color=green ] "app_blocks\npage" -> "@1pager_header\nblock" [ color=green, label=include ] "app_blocks\npage" -> "@1admin_link\nblock" [ color=green, label=include ] "app_blocks\npage" -> "@1pager\nblock" [ color=green, label=include ] "app_blocks\npage" [color=green, fontcolor=green, group=pages, shape=record]; -"1buffer_data\ntable" -> "app_contracts\npage" "1applications\ntable" -> "app_contracts\npage" +"1roles_participants\ntable" -> "app_contracts\npage" +"1buffer_data\ntable" -> "app_contracts\npage" "src\ntable" -> "app_contracts\npage" "app_contracts\npage" -> "editor\npage" [ color=green ] "app_contracts\npage" -> "@1pager_header\nblock" [ color=green, label=include ] @@ -34,22 +37,27 @@ size="30"; "app_edit\npage" -> "@1EditApplication\ncontract" [ color=red ] "app_edit\npage" -> "@1NewApplication\ncontract" [ color=red ] "1applications\ntable" -> "app_edit\npage" +"1roles_participants\ntable" -> "app_edit\npage" "app_edit\npage" [color=green, fontcolor=green, group=pages, shape=record]; +"1applications\ntable" -> "app_langres\npage" +"1roles_participants\ntable" -> "app_langres\npage" "src\ntable" -> "app_langres\npage" "app_langres\npage" -> "@1pager_header\nblock" [ color=green, label=include ] "app_langres\npage" -> "@1search\nblock" [ color=green, label=include ] "app_langres\npage" -> "@1pager\nblock" [ color=green, label=include ] "app_langres\npage" [color=green, fontcolor=green, group=pages, shape=record]; -"1buffer_data\ntable" -> "app_pages\npage" "1applications\ntable" -> "app_pages\npage" +"1roles_participants\ntable" -> "app_pages\npage" +"1buffer_data\ntable" -> "app_pages\npage" "src\ntable" -> "app_pages\npage" "app_pages\npage" -> "editor\npage" [ color=green ] "app_pages\npage" -> "@1pager_header\nblock" [ color=green, label=include ] "app_pages\npage" -> "@1admin_link\nblock" [ color=green, label=include ] "app_pages\npage" -> "@1pager\nblock" [ color=green, label=include ] "app_pages\npage" [color=green, fontcolor=green, group=pages, shape=record]; -"1buffer_data\ntable" -> "app_params\npage" "1applications\ntable" -> "app_params\npage" +"1roles_participants\ntable" -> "app_params\npage" +"1buffer_data\ntable" -> "app_params\npage" "src\ntable" -> "app_params\npage" "app_params\npage" -> "@1pager_header\nblock" [ color=green, label=include ] "app_params\npage" -> "@1admin_link\nblock" [ color=green, label=include ] @@ -57,10 +65,13 @@ size="30"; "app_params\npage" [color=green, fontcolor=green, group=pages, shape=record]; "app_params_edit\npage" -> "@1NewAppParam\ncontract" [ color=red ] "app_params_edit\npage" -> "@1EditAppParam\ncontract" [ color=red ] +"1applications\ntable" -> "app_params_edit\npage" +"1roles_participants\ntable" -> "app_params_edit\npage" "1app_params\ntable" -> "app_params_edit\npage" "app_params_edit\npage" [color=green, fontcolor=green, group=pages, shape=record]; -"1buffer_data\ntable" -> "app_tables\npage" "1applications\ntable" -> "app_tables\npage" +"1roles_participants\ntable" -> "app_tables\npage" +"1buffer_data\ntable" -> "app_tables\npage" "src\ntable" -> "app_tables\npage" "id\ntable" -> "app_tables\npage" "app_tables\npage" -> "@1pager_header\nblock" [ color=green, label=include ] @@ -68,11 +79,14 @@ size="30"; "app_tables\npage" -> "@1pager\nblock" [ color=green, label=include ] "app_tables\npage" [color=green, fontcolor=green, group=pages, shape=record]; "app_upload_binary\npage" -> "@1UploadFile\ncontract" [ color=red ] +"1applications\ntable" -> "app_upload_binary\npage" +"1roles_participants\ntable" -> "app_upload_binary\npage" "1binaries\ntable" -> "app_upload_binary\npage" "app_upload_binary\npage" [color=green, fontcolor=green, group=pages, shape=record]; "apps_catalog\npage" -> "@1AppInstall\ncontract" [ color=red ] -"src\ntable" -> "apps_catalog\npage" "1applications\ntable" -> "apps_catalog\npage" +"1roles_participants\ntable" -> "apps_catalog\npage" +"src\ntable" -> "apps_catalog\npage" "1app_params\ntable" -> "apps_catalog\npage" "apps_catalog\npage" -> "@1pager_header\nblock" [ color=green, label=include ] "apps_catalog\npage" -> "@1search\nblock" [ color=green, label=include ] @@ -80,6 +94,8 @@ size="30"; "apps_catalog\npage" [color=green, fontcolor=green, group=pages, shape=record]; "apps_list\npage" -> "@1ExportNewApp\ncontract" [ color=red ] "apps_list\npage" -> "@1SelectApp\ncontract" [ color=red ] +"1applications\ntable" -> "apps_list\npage" +"1roles_participants\ntable" -> "apps_list\npage" "1buffer_data\ntable" -> "apps_list\npage" "src\ntable" -> "apps_list\npage" "apps_list\npage" -> "@1pager_header\nblock" [ color=green, label=include ] @@ -87,27 +103,38 @@ size="30"; "apps_list\npage" -> "@1pager\nblock" [ color=green, label=include ] "apps_list\npage" [color=green, fontcolor=green, group=pages, shape=record]; "apps_list_inactive\npage" -> "@1DelApplication\ncontract" [ color=red ] +"1applications\ntable" -> "apps_list_inactive\npage" +"1roles_participants\ntable" -> "apps_list_inactive\npage" "src\ntable" -> "apps_list_inactive\npage" "apps_list_inactive\npage" -> "@1pager_header\nblock" [ color=green, label=include ] "apps_list_inactive\npage" -> "@1search\nblock" [ color=green, label=include ] "apps_list_inactive\npage" -> "@1pager\nblock" [ color=green, label=include ] "apps_list_inactive\npage" [color=green, fontcolor=green, group=pages, shape=record]; "column_add\npage" -> "@1NewColumn\ncontract" [ color=red ] +"1applications\ntable" -> "column_add\npage" +"1roles_participants\ntable" -> "column_add\npage" "column_add\npage" [color=green, fontcolor=green, group=pages, shape=record]; "column_edit\npage" -> "@1EditColumn\ncontract" [ color=red ] +"1applications\ntable" -> "column_edit\npage" +"1roles_participants\ntable" -> "column_edit\npage" "1tables\ntable" -> "column_edit\npage" "column_edit\npage" [color=green, fontcolor=green, group=pages, shape=record]; "developer_index\npage" -> "@1ItemChangeAppId\ncontract" [ color=red ] "developer_index\npage" -> "ItemChangeAppId\ncontract" [ color=red ] -"1contracts\ntable" -> "developer_index\npage" "1applications\ntable" -> "developer_index\npage" +"1roles_participants\ntable" -> "developer_index\npage" +"1contracts\ntable" -> "developer_index\npage" "1buffer_data\ntable" -> "developer_index\npage" "src_table\ntable" -> "developer_index\npage" "developer_index\npage" -> "#block#\nblock" [ color=green, label=include ] "developer_index\npage" [color=green, fontcolor=green, group=pages, shape=record]; +"1applications\ntable" -> "export_download\npage" +"1roles_participants\ntable" -> "export_download\npage" "1buffer_data\ntable" -> "export_download\npage" "1binaries\ntable" -> "export_download\npage" "export_download\npage" [color=green, fontcolor=green, group=pages, shape=record]; +"1applications\ntable" -> "export_resources\npage" +"1roles_participants\ntable" -> "export_resources\npage" "1buffer_data\ntable" -> "export_resources\npage" "1pages\ntable" -> "export_resources\npage" "1blocks\ntable" -> "export_resources\npage" @@ -121,11 +148,15 @@ size="30"; "export_resources\npage" -> "@1pager\nblock" [ color=green, label=include ] "export_resources\npage" -> "@1export_info\nblock" [ color=green, label=include ] "export_resources\npage" [color=green, fontcolor=green, group=pages, shape=record]; +"1applications\ntable" -> "history\npage" +"1roles_participants\ntable" -> "history\npage" "1pages\ntable" -> "history\npage" "1blocks\ntable" -> "history\npage" "1contracts\ntable" -> "history\npage" "1menu\ntable" -> "history\npage" "history\npage" [color=green, fontcolor=green, group=pages, shape=record]; +"1applications\ntable" -> "history_compare\npage" +"1roles_participants\ntable" -> "history_compare\npage" "1pages\ntable" -> "history_compare\npage" "1blocks\ntable" -> "history_compare\npage" "1contracts\ntable" -> "history_compare\npage" @@ -137,10 +168,16 @@ size="30"; "1roles\ntable" -> "import_upload\npage" "import_upload\npage" [color=green, fontcolor=green, group=pages, shape=record]; "langres_add\npage" -> "@1NewLangJoint\ncontract" [ color=red ] +"1applications\ntable" -> "langres_add\npage" +"1roles_participants\ntable" -> "langres_add\npage" "langres_add\npage" [color=green, fontcolor=green, group=pages, shape=record]; "langres_edit\npage" -> "@1EditLangJoint\ncontract" [ color=red ] +"1applications\ntable" -> "langres_edit\npage" +"1roles_participants\ntable" -> "langres_edit\npage" "1languages\ntable" -> "langres_edit\npage" "langres_edit\npage" [color=green, fontcolor=green, group=pages, shape=record]; +"1applications\ntable" -> "menus_list\npage" +"1roles_participants\ntable" -> "menus_list\npage" "src\ntable" -> "menus_list\npage" "menus_list\npage" -> "editor\npage" [ color=green ] "menus_list\npage" -> "@1pager_header\nblock" [ color=green, label=include ] @@ -150,10 +187,13 @@ size="30"; "params_edit\npage" -> "@1VotingRunEditEcosysParam\ncontract" [ color=red ] "params_edit\npage" -> "@1EditParameter\ncontract" [ color=red ] "params_edit\npage" -> "@1NewParameter\ncontract" [ color=red ] -"1parameters\ntable" -> "params_edit\npage" "1applications\ntable" -> "params_edit\npage" +"1roles_participants\ntable" -> "params_edit\npage" +"1parameters\ntable" -> "params_edit\npage" "1voting_templates\ntable" -> "params_edit\npage" "params_edit\npage" [color=green, fontcolor=green, group=pages, shape=record]; +"1applications\ntable" -> "params_list\npage" +"1roles_participants\ntable" -> "params_list\npage" "src\ntable" -> "params_list\npage" "params_list\npage" -> "@1pager_header\nblock" [ color=green, label=include ] "params_list\npage" -> "@1search\nblock" [ color=green, label=include ] @@ -165,34 +205,49 @@ size="30"; "properties_edit\npage" -> "@1EditContract\ncontract" [ color=red ] "properties_edit\npage" -> "@1EditBlock\ncontract" [ color=red ] "properties_edit\npage" -> "@1EditMenu\ncontract" [ color=red ] +"1applications\ntable" -> "properties_edit\npage" +"1roles_participants\ntable" -> "properties_edit\npage" "1pages\ntable" -> "properties_edit\npage" "1menu\ntable" -> "properties_edit\npage" "1contracts\ntable" -> "properties_edit\npage" "1blocks\ntable" -> "properties_edit\npage" "properties_edit\npage" [color=green, fontcolor=green, group=pages, shape=record]; "section_access\npage" -> "@1SectionRoles\ncontract" [ color=red ] -"1sections\ntable" -> "section_access\npage" "1applications\ntable" -> "section_access\npage" +"1roles_participants\ntable" -> "section_access\npage" +"1sections\ntable" -> "section_access\npage" "1roles\ntable" -> "section_access\npage" "section_access\npage" -> "section_access\npage" [ color=green ] "section_access\npage" [color=green, fontcolor=green, group=pages, shape=record]; "section_add\npage" -> "@1NewSection\ncontract" [ color=red ] +"1applications\ntable" -> "section_add\npage" +"1roles_participants\ntable" -> "section_add\npage" "section_add\npage" [color=green, fontcolor=green, group=pages, shape=record]; "section_edit\npage" -> "@1EditSection\ncontract" [ color=red ] +"1applications\ntable" -> "section_edit\npage" +"1roles_participants\ntable" -> "section_edit\npage" "1sections\ntable" -> "section_edit\npage" "section_edit\npage" [color=green, fontcolor=green, group=pages, shape=record]; "section_list\npage" -> "@1SectionLevelDown\ncontract" [ color=red ] "section_list\npage" -> "@1SectionLevelUp\ncontract" [ color=red ] +"1applications\ntable" -> "section_list\npage" +"1roles_participants\ntable" -> "section_list\npage" "src\ntable" -> "section_list\npage" "section_list\npage" -> "@1pager_header\nblock" [ color=green, label=include ] "section_list\npage" -> "@1search\nblock" [ color=green, label=include ] "section_list\npage" -> "@1pager\nblock" [ color=green, label=include ] "section_list\npage" [color=green, fontcolor=green, group=pages, shape=record]; "table_create\npage" -> "@1NewTableJoint\ncontract" [ color=red ] +"1applications\ntable" -> "table_create\npage" +"1roles_participants\ntable" -> "table_create\npage" "table_create\npage" [color=green, fontcolor=green, group=pages, shape=record]; "table_edit\npage" -> "@1EditTable\ncontract" [ color=red ] +"1applications\ntable" -> "table_edit\npage" +"1roles_participants\ntable" -> "table_edit\npage" "1tables\ntable" -> "table_edit\npage" "table_edit\npage" [color=green, fontcolor=green, group=pages, shape=record]; +"1applications\ntable" -> "table_view\npage" +"1roles_participants\ntable" -> "table_view\npage" "1tables\ntable" -> "table_view\npage" "src\ntable" -> "table_view\npage" "table_view\npage" -> "@1pager_header\nblock" [ color=green, label=include ] @@ -232,12 +287,19 @@ size="30"; "1notifications\ntable" -> "BindWallet\ncontract" "1contracts\ntable" -> "BindWallet\ncontract" "BindWallet\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; +"BufferFileUpload\ncontract" -> "BufferManager\ncontract" [ color=red ] +"BufferFileUpload\ncontract" -> "UploadFile\ncontract" [ color=red ] +"1applications\ntable" -> "BufferFileUpload\ncontract" +"BufferFileUpload\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; +"1buffer_data\ntable" -> "BufferManager\ncontract" +"BufferManager\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; "1delayed_contracts\ntable" -> "CallDelayedContract\ncontract" "CallDelayedContract\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; "CheckNodesBan\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; "1applications\ntable" -> "DelApplication\ncontract" "DelApplication\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; "1applications\ntable" -> "DeveloperCondition\ncontract" +"1roles_participants\ntable" -> "DeveloperCondition\ncontract" "DeveloperCondition\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; "1app_params\ntable" -> "EditAppParam\ncontract" "EditAppParam\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; @@ -261,7 +323,7 @@ size="30"; "1pages\ntable" -> "EditPage\ncontract" "EditPage\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; "1parameters\ntable" -> "EditParameter\ncontract" -"1members\ntable" -> "EditParameter\ncontract" +"1keys\ntable" -> "EditParameter\ncontract" "EditParameter\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; "1sections\ntable" -> "EditSection\ncontract" "EditSection\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; @@ -329,9 +391,12 @@ size="30"; "NewTableJoint\ncontract" -> "NewColumn\ncontract" [ color=red ] "NewTableJoint\ncontract" -> "NewTable\ncontract" [ color=red ] "NewTableJoint\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; +"NewUser\ncontract" -> "BufferManager\ncontract" [ color=red ] +"NewUser\ncontract" -> "keys\ntable" [ color="" ] "1keys\ntable" -> "NewUser\ncontract" "NewUser\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; "NodeOwnerCondition\ncontract" -> "MainCondition\ncontract" [ color=red ] +"NodeOwnerCondition\ncontract" -> "full_nodes\ncontract" [ color=red ] "NodeOwnerCondition\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; "PlatformAppsInstall\ncontract" -> "AppInstall\ncontract" [ color=red ] "1applications\ntable" -> "PlatformAppsInstall\ncontract" @@ -350,10 +415,11 @@ size="30"; "UpdateMetrics\ncontract" -> "MainCondition\ncontract" [ color=red ] "1metrics\ntable" -> "UpdateMetrics\ncontract" "UpdateMetrics\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; -"1votings\ntable" -> "UpdateSysParam\ncontract" +"UpdateSysParam\ncontract" -> "AdminCondition\ncontract" [ color=red ] "UpdateSysParam\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; "1binaries\ntable" -> "UploadBinary\ncontract" "UploadBinary\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; "UploadFile\ncontract" -> "UploadBinary\ncontract" [ color=red ] "UploadFile\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; +"full_nodes\ncontract" [color=red, fontcolor=red, group=contracts, shape=record]; } diff --git a/system.json b/system.json index 52bd7297e..cd7ae4340 100644 --- a/system.json +++ b/system.json @@ -5,13 +5,13 @@ { "Name": "admin_link", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "If(#sort#==1){\n SetVar(sort_name, \"{id:1}\")\n}.ElseIf(#sort#==2){\n SetVar(sort_name, \"{id:-1}\")\n}.ElseIf(#sort#==3){\n SetVar(sort_name, \"{name: 1}\")\n}.ElseIf(#sort#==4){\n SetVar(sort_name, \"{name: -1}\")\n}.Else{\n SetVar(sort, \"1\")\n SetVar(sort_name, \"{id:1}\")\n}\n\nIf(Or(#width#==12,#width#==6,#width#==4)){\n}.Else{\n SetVar(width, \"12\")\n}\n\nForm(){\n Div(clearfix){\n Div(pull-left ml-sm){\n DBFind(@1applications,apps).Where({\"ecosystem\": #ecosystem_id#})\n Select(Name:AppId, Source:apps, NameColumn: name, ValueColumn: id, Value: #buffer_value_app_id#, Class: bg-gray-lighter).Style(border: 0px; padding-top: 4px;)\n }\n Div(pull-left ml-sm){\n Button(Class: btn bg-gray fa fa-refresh, Page: #this_page#, PageParams: \"sort=#sort#,width=#width#,current_page=#current_page#\", Contract: @1SelectApp, Params: \"ApplicationId=Val(AppId)\")\n }\n Div(pull-right){\n If(#sort#==1){\n Button(Body: Em(Class: fa fa-long-arrow-down) Sort by ID, Class: btn bg-gray-lighter ml-sm, Page: #this_page#, PageParams: \"sort=2,width=#width#,current_page=#current_page#\")\n }.ElseIf(#sort#==2){\n Button(Body: Em(Class: fa fa-long-arrow-up) Sort by ID, Class: btn bg-gray-lighter ml-sm, Page: #this_page#, PageParams: \"sort=1,width=#width#,current_page=#current_page#\")\n }.Else{\n Button(Body: Sort by ID, Class: btn bg-gray ml-sm, Page: #this_page#, PageParams: \"sort=1,width=#width#,current_page=#current_page#\")\n }\n If(#sort#==3){\n Button(Body: Em(Class: fa fa-long-arrow-down) Sort by NAME, Class: btn bg-gray-lighter ml-sm mr-sm, Page: #this_page#, PageParams: \"sort=4,width=#width#,current_page=#current_page#\")\n }.ElseIf(#sort#==4){\n Button(Body: Em(Class: fa fa-long-arrow-up) Sort by NAME, Class: btn bg-gray-lighter ml-sm mr-sm, Page: #this_page#, PageParams: \"sort=3,width=#width#,current_page=#current_page#\")\n }.Else{\n Button(Body: Sort by NAME, Class: btn bg-gray ml-sm mr-sm, Page: #this_page#, PageParams: \"sort=3,width=#width#,current_page=#current_page#\")\n }\n }\n Div(pull-right){\n If(#hideLink#==0){\n }.ElseIf(#width#==12){\n Button(Body: Em(Class: fa fa-bars), Class: btn bg-gray-lighter mr-sm, Page: #this_page#, PageParams: \"sort=#sort#,width=12,current_page=#current_page#\")\n }.Else{\n Button(Body: Em(Class: fa fa-bars), Class: btn bg-gray mr-sm, Page: #this_page#, PageParams: \"sort=#sort#,width=12,current_page=#current_page#\")\n }\n If(#hideLink#==0){\n }.ElseIf(#width#==6){\n Button(Body: Em(Class: fa fa-th-large), Class: btn bg-gray-lighter mr-sm, Page: #this_page#, PageParams: \"sort=#sort#,width=6,current_page=#current_page#\")\n }.Else{\n Button(Body: Em(Class: fa fa-th-large), Class: btn bg-gray mr-sm, Page: #this_page#, PageParams: \"sort=#sort#,width=6,current_page=#current_page#\")\n }\n If(#hideLink#==0){\n }.ElseIf(#width#==4){\n Button(Body: Em(Class: fa fa-th), Class: btn bg-gray-lighter mr-sm, Page: #this_page#, PageParams: \"sort=#sort#,width=4,current_page=#current_page#\")\n }.Else{\n Button(Body: Em(Class: fa fa-th), Class: btn bg-gray mr-sm, Page: #this_page#, PageParams: \"sort=#sort#,width=4,current_page=#current_page#\")\n }\n }\n }\n}.Style(\n height: 33px;\n overflow: hidden;\n)", + "Value": "If(#sort#==1){\n SetVar(sort_name, \"{id: 1}\")\n}.ElseIf(#sort#==2){\n SetVar(sort_name, \"{id: -1}\")\n}.ElseIf(#sort#==3){\n SetVar(sort_name, \"{name: 1}\")\n}.ElseIf(#sort#==4){\n SetVar(sort_name, \"{name: -1}\")\n}.Else{\n SetVar(sort, \"1\")\n SetVar(sort_name, \"{id: 1}\")\n}\n\nIf(Or(#width#==12,#width#==6,#width#==4)){\n}.Else{\n SetVar(width, \"12\")\n}\n\nForm(){\n Div(clearfix){\n Div(pull-left ml-sm){\n DBFind(\"@1applications\",apps).Where({\"ecosystem\": \"#ecosystem_id#\"})\n Select(Name:AppId, Source:apps, NameColumn: name, ValueColumn: id, Value: #buffer_value_app_id#, Class: bg-gray-lighter).Style(border: 0px; padding-top: 4px;)\n }\n Div(pull-left ml-sm){\n Button(Class: btn bg-gray fa fa-refresh, Page: #this_page#, PageParams: \"sort=#sort#,width=#width#,current_page=#current_page#\", Contract: @1SelectApp, Params: \"ApplicationId=Val(AppId)\")\n }\n Div(pull-right){\n If(#sort#==1){\n Button(Body: Em(Class: fa fa-long-arrow-down) Sort by ID, Class: btn bg-gray-lighter ml-sm, Page: #this_page#, PageParams: \"sort=2,width=#width#,current_page=#current_page#\")\n }.ElseIf(#sort#==2){\n Button(Body: Em(Class: fa fa-long-arrow-up) Sort by ID, Class: btn bg-gray-lighter ml-sm, Page: #this_page#, PageParams: \"sort=1,width=#width#,current_page=#current_page#\")\n }.Else{\n Button(Body: Sort by ID, Class: btn bg-gray ml-sm, Page: #this_page#, PageParams: \"sort=1,width=#width#,current_page=#current_page#\")\n }\n If(#sort#==3){\n Button(Body: Em(Class: fa fa-long-arrow-down) Sort by NAME, Class: btn bg-gray-lighter ml-sm mr-sm, Page: #this_page#, PageParams: \"sort=4,width=#width#,current_page=#current_page#\")\n }.ElseIf(#sort#==4){\n Button(Body: Em(Class: fa fa-long-arrow-up) Sort by NAME, Class: btn bg-gray-lighter ml-sm mr-sm, Page: #this_page#, PageParams: \"sort=3,width=#width#,current_page=#current_page#\")\n }.Else{\n Button(Body: Sort by NAME, Class: btn bg-gray ml-sm mr-sm, Page: #this_page#, PageParams: \"sort=3,width=#width#,current_page=#current_page#\")\n }\n }\n Div(pull-right){\n If(#hideLink#==0){\n }.ElseIf(#width#==12){\n Button(Body: Em(Class: fa fa-bars), Class: btn bg-gray-lighter mr-sm, Page: #this_page#, PageParams: \"sort=#sort#,width=12,current_page=#current_page#\")\n }.Else{\n Button(Body: Em(Class: fa fa-bars), Class: btn bg-gray mr-sm, Page: #this_page#, PageParams: \"sort=#sort#,width=12,current_page=#current_page#\")\n }\n If(#hideLink#==0){\n }.ElseIf(#width#==6){\n Button(Body: Em(Class: fa fa-th-large), Class: btn bg-gray-lighter mr-sm, Page: #this_page#, PageParams: \"sort=#sort#,width=6,current_page=#current_page#\")\n }.Else{\n Button(Body: Em(Class: fa fa-th-large), Class: btn bg-gray mr-sm, Page: #this_page#, PageParams: \"sort=#sort#,width=6,current_page=#current_page#\")\n }\n If(#hideLink#==0){\n }.ElseIf(#width#==4){\n Button(Body: Em(Class: fa fa-th), Class: btn bg-gray-lighter mr-sm, Page: #this_page#, PageParams: \"sort=#sort#,width=4,current_page=#current_page#\")\n }.Else{\n Button(Body: Em(Class: fa fa-th), Class: btn bg-gray mr-sm, Page: #this_page#, PageParams: \"sort=#sort#,width=4,current_page=#current_page#\")\n }\n }\n }\n}.Style(\n height: 33px;\n overflow: hidden;\n)", "Type": "blocks" }, { "Name": "export_info", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1buffer_data).Columns(\"value->app_id,value->app_name,value->menu_name,value->menu_id,value->count_menu\").Where({\"key\": 'export', \"member_id\": #key_id#, \"ecosystem\": #ecosystem_id#}).Vars(buffer)\n\nIf(#buffer_value_app_id# > 0){\n DBFind(@1pages, src_pages).Where({\"app_id\": #buffer_value_app_id#, \"ecosystem\": #ecosystem_id#}).Limit(250).Order(\"name\").Count(count_pages)\n DBFind(@1blocks, src_blocks).Where({\"app_id\": #buffer_value_app_id#, \"ecosystem\": #ecosystem_id#}).Limit(250).Order(\"name\").Count(count_blocks)\n DBFind(@1app_params, src_parameters).Where({\"app_id\": #buffer_value_app_id#, \"ecosystem\": #ecosystem_id#}).Limit(250).Order(\"name\").Count(count_parameters)\n DBFind(@1languages, src_languages).Where({\"id\": 0}).Limit(250).Order(\"name\").Count(count_languages)\n DBFind(@1contracts, src_contracts).Where({\"app_id\": #buffer_value_app_id#, \"ecosystem\": #ecosystem_id#}).Limit(250).Order(\"name\").Count(count_contracts)\n DBFind(@1tables, src_tables).Where({\"app_id\": #buffer_value_app_id#, \"ecosystem\": #ecosystem_id#}).Limit(250).Order(\"name\").Count(count_tables)\n}\n\nDiv(panel panel-primary){\n If(#buffer_value_app_id# > 0){\n Div(){\n Button(Body: \"$@1export$ - #buffer_value_app_name#\", Class: btn btn-primary btn-block, Page: @1export_download, Contract: @1Export)\n }\n }.Else{\n Div(panel-heading, \"$@1export$\")\n }\n Form(){\n Div(list-group-item){\n Div(clearfix){\n Div(pull-left){\n Span(\"$@1pages$\")\n }\n Div(pull-right){\n If(#count_pages# > 0){\n Span(\"(#count_pages#)\")\n }.Else{\n Span(\"(0)\")\n }\n }\n }\n Div(row){\n Div(col-md-12 text-left text-muted){\n If(#count_pages# > 0){\n ForList(src_pages){\n Span(Class: h6, Body: \"#name#, \")\n }\n }.Else{\n Span(Class: h6, Body: \"$@1nothing_selected$\")\n }\n }\n }\n }\n Div(list-group-item){\n Div(clearfix){\n Div(pull-left){\n Span(\"$@1blocks$\")\n }\n Div(pull-right){\n If(#count_blocks# > 0){\n Span(\"(#count_blocks#)\")\n }.Else{\n Span(\"(0)\")\n }\n }\n }\n Div(row){\n Div(col-md-12 text-left text-muted){\n If(#count_blocks# > 0){\n ForList(src_blocks){\n Span(Class: h6, Body: \"#name#, \")\n }\n }.Else{\n Span(Class: h6, Body: \"$@1nothing_selected$\")\n }\n }\n }\n }\n Div(list-group-item){\n Div(clearfix){\n Div(pull-left){\n Span(\"$@1menu$\")\n }\n Div(pull-right){\n If(#buffer_value_app_id# > 0){\n Span(\"(#buffer_value_count_menu#)\")\n }.Else{\n Span(\"(0)\")\n }\n }\n }\n Div(row){\n Div(col-md-12 text-left text-muted){\n If(And(#buffer_value_app_id#>0,#buffer_value_count_menu#>0)){\n Span(Class: h6, Body:\"#buffer_value_menu_name#\")\n }.Else{\n Span(Class: h6, Body:\"$@1nothing_selected$\")\n }\n }\n }\n }\n Div(list-group-item){\n Div(clearfix){\n Div(pull-left){\n Span(\"$@1params$\")\n }\n Div(pull-right){\n If(#count_parameters# > 0){\n Span(\"(#count_parameters#)\")\n }.Else{\n Span(\"(0)\")\n }\n }\n }\n Div(row){\n Div(col-md-12 text-left text-muted){\n If(#count_parameters# > 0){\n ForList(src_parameters){\n Span(Class: h6, Body: \"#name#, \")\n }\n }.Else{\n Span(Class: h6, Body: \"$@1nothing_selected$\")\n }\n }\n }\n }\n Div(list-group-item){\n Div(clearfix){\n Div(pull-left){\n Span(\"$@1lang_res$\")\n }\n Div(pull-right){\n If(#count_languages# > 0){\n Span(\"(#count_languages#)\")\n }.Else{\n Span(\"(0)\")\n }\n }\n }\n Div(row){\n Div(col-md-12 text-left text-muted){\n If(#count_languages# > 0){\n ForList(src_languages){\n Span(Class: h6, Body: \"#name#, \")\n }\n }.Else{\n Span(Class: h6, Body: \"$@1nothing_selected$\")\n }\n }\n }\n }\n Div(list-group-item){\n Div(clearfix){\n Div(pull-left){\n Span(\"$@1contracts$\")\n }\n Div(pull-right){\n If(#count_contracts# > 0){\n Span(\"(#count_contracts#)\")\n }.Else{\n Span(\"(0)\")\n }\n }\n }\n Div(row){\n Div(col-md-12 text-left text-muted){\n If(#count_contracts# > 0){\n ForList(src_contracts){\n Span(Class: h6, Body: \"#name#, \")\n }\n }.Else{\n Span(Class: h6, Body: \"$@1nothing_selected$\")\n }\n }\n }\n }\n Div(list-group-item){\n Div(clearfix){\n Div(pull-left){\n Span($@1tables$)\n }\n Div(pull-right){\n If(#count_tables# > 0){\n Span(\"(#count_tables#)\")\n }.Else{\n Span(\"(0)\")\n }\n }\n }\n Div(row){\n Div(col-md-12 text-left text-muted){\n If(#count_tables# > 0){\n ForList(src_tables){\n Span(Class: h6, Body: \"#name#, \")\n }\n }.Else{\n Span(Class: h6, Body: \"$@1nothing_selected$\")\n }\n }\n }\n }\n If(#buffer_value_app_id# > 0){\n Div(panel-footer text-right){\n Button(Body: $@1export$, Class: btn btn-primary, Page: @1export_download, Contract: @1Export)\n }\n }\n }\n}", + "Value": "DBFind(\"@1buffer_data\").Columns(\"value->app_id,value->app_name,value->menu_name,value->menu_id,value->count_menu\").Where({\"key\": \"export\", \"account\": \"#account_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(buffer)\n\nIf(#buffer_value_app_id# > 0){\n DBFind(\"@1pages\", src_pages).Where({\"app_id\": \"#buffer_value_app_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Limit(250).Order(\"name\").Count(count_pages)\n DBFind(\"@1blocks\", src_blocks).Where({\"app_id\": \"#buffer_value_app_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Limit(250).Order(\"name\").Count(count_blocks)\n DBFind(\"@1app_params\", src_parameters).Where({\"app_id\": \"#buffer_value_app_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Limit(250).Order(\"name\").Count(count_parameters)\n DBFind(\"@1languages\", src_languages).Where({\"id\": 0}).Limit(250).Order(\"name\").Count(count_languages)\n DBFind(\"@1contracts\", src_contracts).Where({\"app_id\": \"#buffer_value_app_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Limit(250).Order(\"name\").Count(count_contracts)\n DBFind(\"@1tables\", src_tables).Where({\"app_id\": \"#buffer_value_app_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Limit(250).Order(\"name\").Count(count_tables)\n}\n\nDiv(panel panel-primary){\n If(#buffer_value_app_id# > 0){\n Div(){\n Button(Body: \"$@1export$ - #buffer_value_app_name#\", Class: btn btn-primary btn-block, Page: @1export_download, Contract: @1Export)\n }\n }.Else{\n Div(panel-heading, \"$@1export$\")\n }\n Form(){\n Div(list-group-item){\n Div(clearfix){\n Div(pull-left){\n Span(\"$@1pages$\")\n }\n Div(pull-right){\n If(#count_pages# > 0){\n Span(\"(#count_pages#)\")\n }.Else{\n Span(\"(0)\")\n }\n }\n }\n Div(row){\n Div(col-md-12 text-left text-muted){\n If(#count_pages# > 0){\n ForList(src_pages){\n Span(Class: h6, Body: \"#name#, \")\n }\n }.Else{\n Span(Class: h6, Body: \"$@1nothing_selected$\")\n }\n }\n }\n }\n Div(list-group-item){\n Div(clearfix){\n Div(pull-left){\n Span(\"$@1blocks$\")\n }\n Div(pull-right){\n If(#count_blocks# > 0){\n Span(\"(#count_blocks#)\")\n }.Else{\n Span(\"(0)\")\n }\n }\n }\n Div(row){\n Div(col-md-12 text-left text-muted){\n If(#count_blocks# > 0){\n ForList(src_blocks){\n Span(Class: h6, Body: \"#name#, \")\n }\n }.Else{\n Span(Class: h6, Body: \"$@1nothing_selected$\")\n }\n }\n }\n }\n Div(list-group-item){\n Div(clearfix){\n Div(pull-left){\n Span(\"$@1menu$\")\n }\n Div(pull-right){\n If(#buffer_value_app_id# > 0){\n Span(\"(#buffer_value_count_menu#)\")\n }.Else{\n Span(\"(0)\")\n }\n }\n }\n Div(row){\n Div(col-md-12 text-left text-muted){\n If(And(#buffer_value_app_id#>0,#buffer_value_count_menu#>0)){\n Span(Class: h6, Body:\"#buffer_value_menu_name#\")\n }.Else{\n Span(Class: h6, Body:\"$@1nothing_selected$\")\n }\n }\n }\n }\n Div(list-group-item){\n Div(clearfix){\n Div(pull-left){\n Span(\"$@1params$\")\n }\n Div(pull-right){\n If(#count_parameters# > 0){\n Span(\"(#count_parameters#)\")\n }.Else{\n Span(\"(0)\")\n }\n }\n }\n Div(row){\n Div(col-md-12 text-left text-muted){\n If(#count_parameters# > 0){\n ForList(src_parameters){\n Span(Class: h6, Body: \"#name#, \")\n }\n }.Else{\n Span(Class: h6, Body: \"$@1nothing_selected$\")\n }\n }\n }\n }\n Div(list-group-item){\n Div(clearfix){\n Div(pull-left){\n Span(\"$@1lang_res$\")\n }\n Div(pull-right){\n If(#count_languages# > 0){\n Span(\"(#count_languages#)\")\n }.Else{\n Span(\"(0)\")\n }\n }\n }\n Div(row){\n Div(col-md-12 text-left text-muted){\n If(#count_languages# > 0){\n ForList(src_languages){\n Span(Class: h6, Body: \"#name#, \")\n }\n }.Else{\n Span(Class: h6, Body: \"$@1nothing_selected$\")\n }\n }\n }\n }\n Div(list-group-item){\n Div(clearfix){\n Div(pull-left){\n Span(\"$@1contracts$\")\n }\n Div(pull-right){\n If(#count_contracts# > 0){\n Span(\"(#count_contracts#)\")\n }.Else{\n Span(\"(0)\")\n }\n }\n }\n Div(row){\n Div(col-md-12 text-left text-muted){\n If(#count_contracts# > 0){\n ForList(src_contracts){\n Span(Class: h6, Body: \"#name#, \")\n }\n }.Else{\n Span(Class: h6, Body: \"$@1nothing_selected$\")\n }\n }\n }\n }\n Div(list-group-item){\n Div(clearfix){\n Div(pull-left){\n Span($@1tables$)\n }\n Div(pull-right){\n If(#count_tables# > 0){\n Span(\"(#count_tables#)\")\n }.Else{\n Span(\"(0)\")\n }\n }\n }\n Div(row){\n Div(col-md-12 text-left text-muted){\n If(#count_tables# > 0){\n ForList(src_tables){\n Span(Class: h6, Body: \"#name#, \")\n }\n }.Else{\n Span(Class: h6, Body: \"$@1nothing_selected$\")\n }\n }\n }\n }\n If(#buffer_value_app_id# > 0){\n Div(panel-footer text-right){\n Button(Body: $@1export$, Class: btn btn-primary, Page: @1export_download, Contract: @1Export)\n }\n }\n }\n}", "Type": "blocks" }, { @@ -69,13 +69,13 @@ "Type": "app_params" }, { - "Name": "role_candidate_for_validators", + "Name": "role_consortium_member", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", "Value": "0", "Type": "app_params" }, { - "Name": "role_consensus", + "Name": "role_consortium_member_candidate", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", "Value": "0", "Type": "app_params" @@ -104,291 +104,297 @@ "Value": "0", "Type": "app_params" }, - { - "Name": "role_validator", - "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "0", - "Type": "app_params" - }, { "Name": "app_binary", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1buffer_data, src_buffer).Columns(\"value->app_id\").Where({\"key\": export, \"member_id\": #key_id#, \"ecosystem\": #ecosystem_id#}).Vars(buffer)\nIf(#buffer_value_app_id# > 0){\n DBFind(@1applications, src_app).Where({\"id\": #buffer_value_app_id#, \"ecosystem\": #ecosystem_id#}).Vars(\"application\")\n\n Div(mr-lg ml-lg){\n SetTitle($@1binaries$: #application_name#)\n AddToolButton(Title:$@1binary_upload$, Page: @1app_upload_binary, Icon: icon-plus, PageParams: \"application_id=#application_id#\")\n\n SetVar(this_table, @1binaries).(this_page, @1app_binary).(pager_limit, 50)\n SetVar(where, {\"app_id\": #buffer_value_app_id#, \"ecosystem\": #ecosystem_id#})\n SetVar(hideLink, 0)\n Include(@1pager_header)\n Include(@1admin_link)\n\n DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#).Custom(_name){\n LinkPage(Page: @1app_upload_binary, PageParams: \"id=#id#,application_id=#buffer_value_app_id#\", Body: #name#)\n }.Custom(_img){\n Div(pull-right){\n Image(Src: Binary().ById(#id#), Class: preview).Style(height: 40px; widht 40px;)\n }\n }.Count(cnt)\n\n Form(panel panel-primary){\n Div(panel-body){\n Div(row){\n Div(col-md-#width# col-sm-12){\n If(#cnt#>0){\n Div(list-group-item){\n Div(row){\n Div(col-md-12){\n Table(src,\"=_name,=data,=_img\")\n }\n }\n }\n }\n }\n }\n Div(mt){\n Include(@1pager)\n }\n }\n }\n }\n}.Else{\n SetTitle($@1binaries$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1apps_select_error$)\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n DBFind(\"@1buffer_data\", src_buffer).Columns(\"value->app_id\").Where({\"key\": \"export\", \"account\": \"#account_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(buffer)\n If(#buffer_value_app_id# > 0){\n DBFind(\"@1applications\", src_app).Where({\"id\": \"#buffer_value_app_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(application)\n\n Div(mr-lg ml-lg){\n SetTitle($@1binaries$: #application_name#)\n AddToolButton(Title:$@1binary_upload$, Page: @1app_upload_binary, Icon: icon-plus, PageParams: \"application_id=#application_id#\")\n\n SetVar(this_table, @1binaries).(this_page, @1app_binary).(pager_limit, 50)\n SetVar(where, {\"app_id\": \"#buffer_value_app_id#\", \"ecosystem\": \"#ecosystem_id#\"})\n SetVar(hideLink, 0)\n Include(@1pager_header)\n Include(@1admin_link)\n\n DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#).Custom(_name){\n LinkPage(Page: @1app_upload_binary, PageParams: \"id=#id#,application_id=#buffer_value_app_id#\", Body: #name#)\n }.Custom(_img){\n Div(pull-right){\n Image(Src: Binary().ById(#id#), Class: preview).Style(height: 40px; widht 40px;)\n }\n }.Count(cnt)\n\n Form(panel panel-primary){\n Div(panel-body){\n Div(row){\n Div(col-md-#width# col-sm-12){\n If(#cnt#>0){\n Div(list-group-item){\n Div(row){\n Div(col-md-12){\n Table(src,\"=_name,=data,=_img\")\n }\n }\n }\n }\n }\n }\n Div(mt){\n Include(@1pager)\n }\n }\n }\n }\n }.Else{\n SetTitle($@1binaries$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1apps_select_error$)\n }\n }\n}.Else{\n SetTitle($@1binaries$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_resources", "Type": "pages" }, { "Name": "app_blocks", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1buffer_data, src_buffer).Columns(\"value->app_id\").Where({\"key\": export, \"member_id\": #key_id#, \"ecosystem\": #ecosystem_id#}).Vars(buffer)\nIf(#buffer_value_app_id# > 0){\n DBFind(@1applications, src_app).Where({\"id\": #buffer_value_app_id#, \"ecosystem\": #ecosystem_id#}).Vars(\"application\")\n\n Div(mr-lg ml-lg){\n SetTitle($@1blocks$: #application_name#)\n AddToolButton(Title: $@1create$, Page: editor, Icon: icon-plus, PageParams: \"create=block,appId=#buffer_value_app_id#\")\n\n SetVar(this_table, @1blocks).(this_page, @1app_blocks).(pager_limit, 50)\n SetVar(where, {\"app_id\": #buffer_value_app_id#, \"ecosystem\": #ecosystem_id#})\n Include(@1pager_header)\n Include(@1admin_link)\n\n DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#)\n\n Form(panel panel-primary){\n Div(panel-body){\n Div(row){\n ForList(src){\n Div(col-md-#width# col-sm-12){\n Div(list-group-item){\n Div(row){\n Div(col-md-4){\n LinkPage(Body: \"#name#\", Class: text-primary, Page: editor, PageParams: \"open=block,name=#name#\")\n }\n Div(col-md-8){\n Div(pull-right){\n LinkPage(Body: Em(Class: fa fa-history), Class: text-primary h4 mh-sm, Page: @1history, PageParams: \"id=#id#,type=block\")\n LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4 mh-sm, Page: @1properties_edit, PageParams: \"edit_property_id=#id#,type=block\")\n }\n }\n }\n }\n }\n }\n }\n Div(mt){\n Include(@1pager)\n }\n }\n }\n }\n}.Else{\n SetTitle($@1blocks$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1apps_select_error$)\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n DBFind(\"@1buffer_data\", src_buffer).Columns(\"value->app_id\").Where({\"key\": \"export\", \"account\": \"#account_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(buffer)\n If(#buffer_value_app_id# > 0){\n DBFind(\"@1applications\", src_app).Where({\"id\": \"#buffer_value_app_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(application)\n\n Div(mr-lg ml-lg){\n SetTitle($@1blocks$: #application_name#)\n AddToolButton(Title: $@1create$, Page: editor, Icon: icon-plus, PageParams: \"create=block,appId=#buffer_value_app_id#\")\n\n SetVar(this_table, @1blocks).(this_page, @1app_blocks).(pager_limit, 50)\n SetVar(where, {\"app_id\": \"#buffer_value_app_id#\", \"ecosystem\": \"#ecosystem_id#\"})\n Include(@1pager_header)\n Include(@1admin_link)\n\n DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#)\n\n Form(panel panel-primary){\n Div(panel-body){\n Div(row){\n ForList(src){\n Div(col-md-#width# col-sm-12){\n Div(list-group-item){\n Div(row){\n Div(col-md-4){\n LinkPage(Body: \"#name#\", Class: text-primary, Page: editor, PageParams: \"open=block,name=#name#\")\n }\n Div(col-md-8){\n Div(pull-right){\n LinkPage(Body: Em(Class: fa fa-history), Class: text-primary h4 mh-sm, Page: @1history, PageParams: \"id=#id#,type=block\")\n LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4 mh-sm, Page: @1properties_edit, PageParams: \"edit_property_id=#id#,type=block\")\n }\n }\n }\n }\n }\n }\n }\n Div(mt){\n Include(@1pager)\n }\n }\n }\n }\n }.Else{\n SetTitle($@1blocks$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1apps_select_error$)\n }\n }\n}.Else{\n SetTitle($@1blocks$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_resources", "Type": "pages" }, { "Name": "app_contracts", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1buffer_data, src_buffer).Columns(\"value->app_id\").Where({\"key\": export, \"member_id\": #key_id#, \"ecosystem\": #ecosystem_id#}).Vars(buffer)\nIf(#buffer_value_app_id# > 0){\n DBFind(@1applications, src_app).Where({\"id\": #buffer_value_app_id#, \"ecosystem\": #ecosystem_id#}).Vars(\"application\")\n\n Div(mr-lg ml-lg){\n SetTitle($@1contracts$: #application_name#)\n AddToolButton(Title: $@1create$, Page: editor, Icon: icon-plus, PageParams: \"create=contract,appId=#buffer_value_app_id#\")\n\n SetVar(this_table, @1contracts).(this_page, @1app_contracts).(pager_limit, 50)\n SetVar(where, {\"app_id\": #buffer_value_app_id#, \"ecosystem\": #ecosystem_id#})\n Include(@1pager_header)\n Include(@1admin_link)\n\n DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#)\n\n Form(panel panel-primary){\n Div(panel-body){\n Div(row){\n ForList(src){\n Div(col-md-#width# col-sm-12){\n Div(list-group-item){\n Div(row){\n Div(col-md-4){\n LinkPage(Body: #name#, Class: text-primary, Page: editor, PageParams: \"open=contract,name=#name#\")\n }\n Div(col-md-8){\n Div(pull-right){\n LinkPage(Body: Em(Class: fa fa-history), Class: text-primary h4 mh-sm, Page: @1history, PageParams: \"id=#id#,type=contract\")\n LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4 mh-sm, Page: @1properties_edit, PageParams: \"edit_property_id=#id#,type=contract\")\n }\n Div(pull-right){\n If(#wallet_id# != 0){\n Span(Class: h5, Body: Em(Class: fa fa-check)).Style(margin-right: 50px;)\n }.Else{\n Span(Class: h5 text-muted, Body: Em(Class: fa fa-minus)).Style(margin-right: 50px;)\n }\n }\n }\n }\n }\n }\n }\n }\n Div(mt){\n Include(@1pager)\n }\n }\n }\n }\n}.Else{\n SetTitle($@1contracts$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1apps_select_error$)\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n DBFind(\"@1buffer_data\", src_buffer).Columns(\"value->app_id\").Where({\"key\": \"export\", \"account\": \"#account_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(buffer)\n If(#buffer_value_app_id# > 0){\n DBFind(\"@1applications\", src_app).Where({\"id\": \"#buffer_value_app_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(application)\n\n Div(mr-lg ml-lg){\n SetTitle($@1contracts$: #application_name#)\n AddToolButton(Title: $@1create$, Page: editor, Icon: icon-plus, PageParams: \"create=contract,appId=#buffer_value_app_id#\")\n\n SetVar(this_table, @1contracts).(this_page, @1app_contracts).(pager_limit, 50)\n SetVar(where, {\"app_id\": \"#buffer_value_app_id#\", \"ecosystem\": \"#ecosystem_id#\"})\n Include(@1pager_header)\n Include(@1admin_link)\n\n DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#)\n\n Form(panel panel-primary){\n Div(panel-body){\n Div(row){\n ForList(src){\n Div(col-md-#width# col-sm-12){\n Div(list-group-item){\n Div(row){\n Div(col-md-4){\n LinkPage(Body: #name#, Class: text-primary, Page: editor, PageParams: \"open=contract,name=#name#\")\n }\n Div(col-md-8){\n Div(pull-right){\n LinkPage(Body: Em(Class: fa fa-history), Class: text-primary h4 mh-sm, Page: @1history, PageParams: \"id=#id#,type=contract\")\n LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4 mh-sm, Page: @1properties_edit, PageParams: \"edit_property_id=#id#,type=contract\")\n }\n Div(pull-right){\n If(#wallet_id# != 0){\n Span(Class: h5, Body: Em(Class: fa fa-check)).Style(margin-right: 50px;)\n }.Else{\n Span(Class: h5 text-muted, Body: Em(Class: fa fa-minus)).Style(margin-right: 50px;)\n }\n }\n }\n }\n }\n }\n }\n }\n Div(mt){\n Include(@1pager)\n }\n }\n }\n }\n }.Else{\n SetTitle($@1contracts$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1apps_select_error$)\n }\n }\n}.Else{\n SetTitle($@1contracts$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_resources", "Type": "pages" }, { "Name": "app_edit", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Div(content-wrapper){\n SetTitle($@1application$)\n Div(breadcrumb){\n LinkPage($@1applications$, @1apps_list)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n If(#id# > 0){\n Span(Class: text-muted, Body: $@1editing$)\n }.Else{\n Span(Class: text-muted, Body: $@1new_app$)\n }\n }\n\n Form(){\n If(#id# > 0){\n DBFind(@1applications, src_apps).Columns(\"id,name,conditions,deleted\").Where({\"id\": #id#, \"ecosystem\": #ecosystem_id#}).Vars(\"application\")\n Div(form-group){\n Label($@1name$)\n Input(Name: Name, Disabled: \"true\", Value: #application_name#)\n }\n Div(form-group){\n Label($@1change_conditions$)\n Input(Name: Conditions, Value: #application_conditions#)\n }\n Div(form-group){\n Div(row){\n Div(text-left col-md-6){\n If(#application_deleted# == 0){\n Button(Body: $@1delete$, Class: btn btn-danger, Page: @1apps_list, Contract: @1DelApplication, Params: \"ApplicationId=#application_id#,Value=1\")\n }\n }\n Div(text-right col-md-6){\n Button(Body: $@1save$, Class: btn btn-primary, Page: @1apps_list, Contract: @1EditApplication, Params: \"ApplicationId=#id#\")\n }\n }\n }\n }.Else{\n Div(form-group){\n Label($@1name$)\n Input(Name: Name)\n }\n Div(form-group){\n Label($@1change_conditions$)\n Input(Name: Conditions)\n }\n Div(form-group){\n Div(text-right){\n Button(Body: $@1save$, Class: btn btn-primary, Page: @1apps_list, Contract: @1NewApplication)\n }\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n Div(content-wrapper){\n SetTitle($@1application$)\n Div(breadcrumb){\n LinkPage($@1applications$, @1apps_list)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n If(#id# > 0){\n Span(Class: text-muted, Body: $@1editing$)\n }.Else{\n Span(Class: text-muted, Body: $@1new_app$)\n }\n }\n\n Form(){\n If(#id# > 0){\n DBFind(\"@1applications\", src_apps).Columns(\"id,name,conditions,deleted\").Where({\"id\": \"#id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(application)\n Div(form-group){\n Label($@1name$)\n Input(Name: Name, Disabled: \"true\", Value: #application_name#)\n }\n Div(form-group){\n Label($@1change_conditions$)\n Input(Name: Conditions, Value: #application_conditions#)\n }\n Div(form-group){\n Div(row){\n Div(text-left col-md-6){\n If(#application_deleted# == 0){\n Button(Body: $@1delete$, Class: btn btn-danger, Page: @1apps_list, Contract: @1DelApplication, Params: \"ApplicationId=#application_id#,Value=1\")\n }\n }\n Div(text-right col-md-6){\n Button(Body: $@1save$, Class: btn btn-primary, Page: @1apps_list, Contract: @1EditApplication, Params: \"ApplicationId=#id#\")\n }\n }\n }\n }.Else{\n Div(form-group){\n Label($@1name$)\n Input(Name: Name)\n }\n Div(form-group){\n Label($@1change_conditions$)\n Input(Name: Conditions)\n }\n Div(form-group){\n Div(text-right){\n Button(Body: $@1save$, Class: btn btn-primary, Page: @1apps_list, Contract: @1NewApplication)\n }\n }\n }\n }\n }\n}.Else{\n SetTitle($@1application$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "app_langres", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1app_langres).(this_table, @1languages)\nInclude(@1pager_header)\n\nSetTitle(\"$@1lang_res$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1application_lang_res$\"))\nAddToolButton(Title: \"$@1create$\", Page: @1langres_add, Icon: icon-plus)\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": #ecosystem_id#, {\"$or\": [{\"name\": {\"$ilike\": \"#search#\"}}, {\"res\": {\"$ilike\": \"#search#\"}}]}})\n}.Else{\n SetVar(where, {\"ecosystem\": #ecosystem_id#})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1name))\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"name\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(lang_name){\n LinkPage(Page: @1langres_edit, Class: text-primary h5, Body: \"#name#\", PageParams: \"lang_id=#id#\")\n}.Custom(_res){\n Span(Class: text-muted h6, Body: \"#res#\")\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1name$=lang_name,$@1value$=_res\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1lang_res$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n SetVar(this_page, @1app_langres).(this_table, @1languages)\n Include(@1pager_header)\n\n SetTitle(\"$@1lang_res$\")\n Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1application_lang_res$\"))\n AddToolButton(Title: \"$@1create$\", Page: @1langres_add, Icon: icon-plus)\n\n If(#search#){\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"$or\": [{\"name\": {\"$ilike\": \"#search#\"}}, {\"res\": {\"$ilike\": \"#search#\"}}]})\n }.Else{\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\"})\n }\n\n Div(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1name))\n Include(@1search)\n }\n\n DBFind(#this_table#, src).Where(#where#).Order({\"name\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(lang_name){\n LinkPage(Page: @1langres_edit, Class: text-primary h5, Body: \"#name#\", PageParams: \"lang_id=#id#\")\n }.Custom(_res){\n Span(Class: text-muted h6, Body: \"#res#\")\n }.Count(count)\n\n Div(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1name$=lang_name,$@1value$=_res\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1lang_res$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n }\n Div(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n }\n}.Else{\n SetTitle($@1lang_res$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "app_pages", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1buffer_data, src_buffer).Columns(\"value->app_id\").Where({\"key\": export, \"member_id\": #key_id#, \"ecosystem\": #ecosystem_id#}).Vars(buffer)\nIf(#buffer_value_app_id# > 0){\n DBFind(@1applications, src_app).Where({\"id\": #buffer_value_app_id#, \"ecosystem\": #ecosystem_id#}).Vars(\"application\")\n\n Div(mr-lg ml-lg){\n SetTitle($@1pages$ : #application_name#)\n AddToolButton(Title: $@1create$, Page: editor, Icon: icon-plus, PageParams: \"create=page,appId=#buffer_value_app_id#\")\n\n SetVar(this_table, @1pages).(this_page, @1app_pages).(pager_limit, 50)\n SetVar(where, {\"app_id\": #buffer_value_app_id#, \"ecosystem\": #ecosystem_id#})\n Include(@1pager_header)\n Include(@1admin_link)\n\n DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#)\n\n Form(panel panel-primary){\n Div(panel-body){\n Div(row){\n ForList(src){\n Div(col-md-#width# col-sm-12){\n Div(list-group-item){\n Div(row){\n Div(col-md-4){\n LinkPage(Body: #name#, Class: text-primary, Page: editor, PageParams: \"open=page,name=#name#\")\n }\n Div(col-md-8){\n Div(pull-right){\n LinkPage(Body: Em(Class: fa fa-eye), Class: text-primary h4 mh-sm, Page: \"#name#\")\n LinkPage(Body: Em(Class: fa fa-history), Class: text-primary h4 mh-sm, Page: @1history, PageParams: \"id=#id#,type=page\")\n LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4 mh-sm, Page: @1properties_edit, PageParams: \"edit_property_id=#id#,type=page\")\n }\n }\n }\n }\n }\n }\n }\n Div(mt){\n Include(@1pager)\n }\n }\n }\n }\n}.Else{\n SetTitle($@1pages$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1apps_select_error$)\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n DBFind(\"@1buffer_data\", src_buffer).Columns(\"value->app_id\").Where({\"key\": \"export\", \"account\": \"#account_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(buffer)\n If(#buffer_value_app_id# > 0){\n DBFind(\"@1applications\", src_app).Where({\"id\": \"#buffer_value_app_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(application)\n\n Div(mr-lg ml-lg){\n SetTitle($@1pages$ : #application_name#)\n AddToolButton(Title: $@1create$, Page: editor, Icon: icon-plus, PageParams: \"create=page,appId=#buffer_value_app_id#\")\n\n SetVar(this_table, @1pages).(this_page, @1app_pages).(pager_limit, 50)\n SetVar(where, {\"app_id\": \"#buffer_value_app_id#\", \"ecosystem\": \"#ecosystem_id#\"})\n Include(@1pager_header)\n Include(@1admin_link)\n\n DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#)\n\n Form(panel panel-primary){\n Div(panel-body){\n Div(row){\n ForList(src){\n Div(col-md-#width# col-sm-12){\n Div(list-group-item){\n Div(row){\n Div(col-md-4){\n LinkPage(Body: #name#, Class: text-primary, Page: editor, PageParams: \"open=page,name=#name#\")\n }\n Div(col-md-8){\n Div(pull-right){\n LinkPage(Body: Em(Class: fa fa-eye), Class: text-primary h4 mh-sm, Page: \"#name#\")\n LinkPage(Body: Em(Class: fa fa-history), Class: text-primary h4 mh-sm, Page: @1history, PageParams: \"id=#id#,type=page\")\n LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4 mh-sm, Page: @1properties_edit, PageParams: \"edit_property_id=#id#,type=page\")\n }\n }\n }\n }\n }\n }\n }\n Div(mt){\n Include(@1pager)\n }\n }\n }\n }\n }.Else{\n SetTitle($@1pages$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1apps_select_error$)\n }\n }\n}.Else{\n SetTitle($@1pages$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_resources", "Type": "pages" }, { "Name": "app_params", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1buffer_data, src_buffer).Columns(\"value->app_id\").Where({\"key\": export, \"member_id\": #key_id#, \"ecosystem\": #ecosystem_id#}).Vars(buffer)\nIf(#buffer_value_app_id# > 0){\n DBFind(@1applications, src_app).Where({\"id\": #buffer_value_app_id#, \"ecosystem\": #ecosystem_id#}).Vars(\"application\")\n\n Div(mr-lg ml-lg){\n SetTitle($@1app_params$: #application_name#)\n AddToolButton(Title: $@1create$, Page: @1app_params_edit, Icon: icon-plus, PageParams: \"application_id=#application_id#,create=create\")\n\n SetVar(this_table, @1app_params).(this_page, @1app_params).(pager_limit, 50)\n SetVar(where, {\"app_id\": #buffer_value_app_id#, \"ecosystem\": #ecosystem_id#})\n Include(@1pager_header)\n Include(@1admin_link)\n\n DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#)\n\n Form(panel panel-primary){\n Div(panel-body){\n Div(row){\n ForList(src){\n Div(col-md-#width# col-sm-12){\n Div(list-group-item){\n Div(row){\n Div(col-md-4){\n LinkPage(Body: \"#name#\", Class: text-primary, Page: @1app_params_edit, PageParams: \"id=#id#\")\n }\n Div(col-md-8){\n Span(Class: text-muted h6, Body: \"#value#\")\n }\n }\n }\n }\n }\n }\n Div(mt){\n Include(@1pager)\n }\n }\n }\n }\n}.Else{\n SetTitle($@1app_params$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1apps_select_error$)\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n DBFind(\"@1buffer_data\", src_buffer).Columns(\"value->app_id\").Where({\"key\": \"export\", \"account\": \"#account_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(buffer)\n If(#buffer_value_app_id# > 0){\n DBFind(\"@1applications\", src_app).Where({\"id\": \"#buffer_value_app_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(application)\n\n Div(mr-lg ml-lg){\n SetTitle($@1app_params$: #application_name#)\n AddToolButton(Title: $@1create$, Page: @1app_params_edit, Icon: icon-plus, PageParams: \"application_id=#application_id#,create=create\")\n\n SetVar(this_table, @1app_params).(this_page, @1app_params).(pager_limit, 50)\n SetVar(where, {\"app_id\": \"#buffer_value_app_id#\", \"ecosystem\": \"#ecosystem_id#\"})\n Include(@1pager_header)\n Include(@1admin_link)\n\n DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#)\n\n Form(panel panel-primary){\n Div(panel-body){\n Div(row){\n ForList(src){\n Div(col-md-#width# col-sm-12){\n Div(list-group-item){\n Div(row){\n Div(col-md-4){\n LinkPage(Body: \"#name#\", Class: text-primary, Page: @1app_params_edit, PageParams: \"id=#id#\")\n }\n Div(col-md-8){\n Span(Class: text-muted h6, Body: \"#value#\")\n }\n }\n }\n }\n }\n }\n Div(mt){\n Include(@1pager)\n }\n }\n }\n }\n }.Else{\n SetTitle($@1app_params$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1apps_select_error$)\n }\n }\n}.Else{\n SetTitle($@1app_params$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_resources", "Type": "pages" }, { "Name": "app_params_edit", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "If(#back_page#){}.Else{\n SetVar(back_page, @1app_params)\n}\nDiv(content-wrapper){\n If(#create# == create){\n SetVar(param_name, \"$@1new_parameter$\")\n }.Else{\n DBFind(@1app_params, src_params).Where({\"id\": #id#, \"ecosystem\": #ecosystem_id#}).Vars(\"param\")\n }\n\n SetTitle($@1app_param$)\n Div(Class: breadcrumb){\n LinkPage($@1app_params$, @1app_params)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n Span(Class: text-muted, Body: #param_name#)\n }\n\n Form(){\n Div(form-group){\n Label(\"$@1name$\")\n If(#create# == create){\n Input(Name: name)\n }.Else{\n Input(Name: name, Value: #param_name#, Disabled: \"true\")\n }\n }\n Div(form-group){\n If(#create# == create){\n Input(Type: textarea, Name: value).Style(height: 500px !important;)\n }.Else{\n Input(Type: textarea, Name: value, Value: \"#param_value#\").Style(height: 500px !important;)\n }\n }\n Div(form-group){\n Label($@1change_conditions$)\n If(#create# == create){\n Input(Name: conditions)\n }.Else{\n Input(Name: conditions, Value: #param_conditions#)\n }\n }\n Div(form-group text-right){\n If(#create# == create){\n Button(Class: btn btn-primary, Body: $@1save$, Contract: @1NewAppParam, Params: \"Name=Val(name),Value=Val(value),Conditions=Val(conditions),ApplicationId=#application_id#\", Page: #back_page#)\n }.Else{\n Button(Class: btn btn-primary, Body: $@1save$, Contract: @1EditAppParam, Params: \"Id=#id#,Value=Val(value),Conditions=Val(conditions)\", Page: #back_page#)\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n If(#back_page#){}.Else{\n SetVar(back_page, @1app_params)\n }\n Div(content-wrapper){\n If(#create# == create){\n SetVar(param_name, \"$@1new_parameter$\")\n }.Else{\n DBFind(\"@1app_params\", src_params).Where({\"id\": \"#id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(param)\n }\n\n SetTitle($@1app_param$)\n Div(Class: breadcrumb){\n LinkPage($@1app_params$, @1app_params)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n Span(Class: text-muted, Body: #param_name#)\n }\n\n Form(){\n Div(form-group){\n Label(\"$@1name$\")\n If(#create# == create){\n Input(Name: name)\n }.Else{\n Input(Name: name, Value: #param_name#, Disabled: \"true\")\n }\n }\n Div(form-group){\n If(#create# == create){\n Input(Type: textarea, Name: value).Style(height: 500px !important;)\n }.Else{\n Input(Type: textarea, Name: value, Value: \"#param_value#\").Style(height: 500px !important;)\n }\n }\n Div(form-group){\n Label($@1change_conditions$)\n If(#create# == create){\n Input(Name: conditions)\n }.Else{\n Input(Name: conditions, Value: #param_conditions#)\n }\n }\n Div(form-group text-right){\n If(#create# == create){\n Button(Class: btn btn-primary, Body: $@1save$, Contract: @1NewAppParam, Params: \"Name=Val(name),Value=Val(value),Conditions=Val(conditions),ApplicationId=#application_id#\", Page: #back_page#)\n }.Else{\n Button(Class: btn btn-primary, Body: $@1save$, Contract: @1EditAppParam, Params: \"Id=#id#,Value=Val(value),Conditions=Val(conditions)\", Page: #back_page#)\n }\n }\n }\n }\n}.Else{\n SetTitle($@1new_parameter$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "app_tables", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1buffer_data, src_buffer).Columns(\"value->app_id\").Where({\"key\": export, \"member_id\": #key_id#, \"ecosystem\": #ecosystem_id#}).Vars(buffer)\nIf(#buffer_value_app_id# > 0){\n DBFind(@1applications, src_app).Where({\"id\": #buffer_value_app_id#, \"ecosystem\": #ecosystem_id#}).Vars(\"application\")\n\n Div(mr-lg ml-lg){\n SetTitle($@1tables$: #application_name#)\n AddToolButton(Title: $@1create$, Page: @1table_create, Icon: icon-plus, PageParams: \"application_id=#application_id#\")\n\n SetVar(this_table, @1tables).(this_page, @1app_tables).(pager_limit, 50)\n SetVar(where, {\"app_id\": #buffer_value_app_id#, \"ecosystem\": #ecosystem_id#})\n Include(@1pager_header)\n Include(@1admin_link)\n\n DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#)\n\n Form(panel panel-primary){\n Div(panel-body){\n Div(row){\n ForList(src){\n Div(col-md-#width# col-sm-12){\n Div(list-group-item){\n Div(row){\n Div(col-md-4){\n LinkPage(Page: @1table_view, Class: text-primary h5, Body: \"#name#\", PageParams: \"tabl_id=#id#\")\n }\n Div(col-md-8){\n Div(pull-right){\n LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4, Page: @1table_edit, PageParams: \"tabl_id=#id#\")\n }\n Div(pull-right){\n DBFind(#name#).Columns(\"id\").Count(countvar)\n Span(Class: h5 text-muted, Body: #countvar#).Style(margin-right: 50px;)\n }\n }\n }\n }\n }\n }\n }\n Div(mt){\n Include(@1pager)\n }\n }\n }\n }\n}.Else{\n SetTitle($@1tables$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1apps_select_error$)\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n DBFind(\"@1buffer_data\", src_buffer).Columns(\"value->app_id\").Where({\"key\": \"export\", \"account\": \"#account_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(buffer)\n If(#buffer_value_app_id# > 0){\n DBFind(\"@1applications\", src_app).Where({\"id\": \"#buffer_value_app_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(application)\n\n Div(mr-lg ml-lg){\n SetTitle($@1tables$: #application_name#)\n AddToolButton(Title: $@1create$, Page: @1table_create, Icon: icon-plus, PageParams: \"application_id=#application_id#\")\n\n SetVar(this_table, @1tables).(this_page, @1app_tables).(pager_limit, 50)\n SetVar(where, {\"app_id\": \"#buffer_value_app_id#\", \"ecosystem\": \"#ecosystem_id#\"})\n Include(@1pager_header)\n Include(@1admin_link)\n\n DBFind(#this_table#, src).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where(#where#)\n\n Form(panel panel-primary){\n Div(panel-body){\n Div(row){\n ForList(src){\n Div(col-md-#width# col-sm-12){\n Div(list-group-item){\n Div(row){\n Div(col-md-4){\n LinkPage(Page: @1table_view, Class: text-primary h5, Body: \"#name#\", PageParams: \"tabl_id=#id#\")\n }\n Div(col-md-8){\n Div(pull-right){\n LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4, Page: @1table_edit, PageParams: \"tabl_id=#id#\")\n }\n Div(pull-right){\n DBFind(#name#).Columns(\"id\").Count(countvar)\n Span(Class: h5 text-muted, Body: #countvar#).Style(margin-right: 50px;)\n }\n }\n }\n }\n }\n }\n }\n Div(mt){\n Include(@1pager)\n }\n }\n }\n }\n }.Else{\n SetTitle($@1tables$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1apps_select_error$)\n }\n }\n}.Else{\n SetTitle($@1tables$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_resources", "Type": "pages" }, { "Name": "app_upload_binary", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Div(content-wrapper){\n SetTitle($@1binaries$)\n Div(breadcrumb){\n LinkPage($@1binaries$, @1app_binary)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n If(#id# > 0){\n Span($@1edit$, text-muted)\n DBFind(@1binaries).Columns(name).Where({\"id\": #id#, \"ecosystem\": #ecosystem_id#}).Vars(binary)\n }.Else{\n Span($@1button_upload$, text-muted)\n }\n }\n\n Form(){\n Div(form-group){\n Div(text-left){\n Label($@1name$)\n }\n If(#id# > 0){\n Input(Name: Name, Disabled: disabled, Value: #binary_name#)\n }.Else{\n Input(Name: Name)\n }\n }\n Div(form-group){\n Div(text-left){\n Label($@1file$)\n }\n Input(Name: Data, Type: file)\n }\n Div(form-group text-right){\n Input(Name: ApplicationId, Value: #application_id#, Class: hidden)\n Button(Body: $@1button_upload$, Contract: @1UploadFile, Class: btn btn-primary, Page: @1app_binary)\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n Div(content-wrapper){\n SetTitle($@1binaries$)\n Div(breadcrumb){\n LinkPage($@1binaries$, @1app_binary)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n If(#id# > 0){\n Span($@1edit$, text-muted)\n DBFind(\"@1binaries\").Where({\"id\": \"#id#\", \"ecosystem\": \"#ecosystem_id#\"}).Columns(name).Vars(binary)\n }.Else{\n Span($@1button_upload$, text-muted)\n }\n }\n\n Form(){\n Div(form-group){\n Div(text-left){\n Label($@1name$)\n }\n If(#id# > 0){\n Input(Name: Name, Disabled: disabled, Value: #binary_name#)\n }.Else{\n Input(Name: Name)\n }\n }\n Div(form-group){\n Div(text-left){\n Label($@1file$)\n }\n Input(Name: Data, Type: file)\n }\n Div(form-group text-right){\n Input(Name: ApplicationId, Value: #application_id#, Class: hidden)\n Button(Body: $@1button_upload$, Contract: @1UploadFile, Class: btn btn-primary, Page: @1app_binary)\n }\n }\n }\n}.Else{\n SetTitle($@1binaries$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "apps_catalog", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1apps_catalog).(this_table, @1applications)\nInclude(@1pager_header)\n\nSetTitle($@1apps_catalog$)\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: $@1apps_catalog_desc$))\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": 1, \"deleted\": 0, \"name\": {\"$ilike\": \"#search#\"}})\n}.Else{\n SetVar(where, {\"ecosystem\": 1, \"deleted\": 0})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1name))\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(inst_app){\n If(#ecosystem_id# != 1){\n SetVar(config_id,0)\n DBFind(@1applications).Where({\"name\": #name#, \"ecosystem\": #ecosystem_id#}).Count(inst_app)\n DBFind(@1app_params).Where({\"app_id\": #id#, \"ecosystem\": 1, \"name\": \"config\"}).Vars(config)\n If(#config_id# > 0){\n If(#inst_app# == 0){\n Button(Class: btn-xs pull-right btn-link, Contract: @1AppInstall, Params: \"ApplicationId=#id#\", Page: #this_page#){\n Span(Class: h5, Body: $@1install$)\n }\n }.Else{\n Span(Body: $@1installed$, Class: text-muted pull-right)\n }\n }\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"ID=id,$@1name$=name,=inst_app\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1applications$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n SetVar(this_page, @1apps_catalog).(this_table, @1applications)\n Include(@1pager_header)\n\n SetTitle($@1apps_catalog$)\n Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: $@1apps_catalog_desc$))\n\n If(#search#){\n SetVar(where, {\"ecosystem\": 1, \"deleted\": 0, \"name\": {\"$ilike\": \"#search#\"}})\n }.Else{\n SetVar(where, {\"ecosystem\": 1, \"deleted\": 0})\n }\n\n Div(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1name))\n Include(@1search)\n }\n\n DBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(inst_app){\n If(#ecosystem_id# != 1){\n SetVar(config_id,0)\n DBFind(\"@1applications\").Where({\"name\": \"#name#\", \"ecosystem\": \"#ecosystem_id#\"}).Count(inst_app)\n DBFind(\"@1app_params\").Where({\"app_id\": \"#id#\", \"ecosystem\": 1, \"name\": \"config\"}).Vars(config)\n If(#config_id# > 0){\n If(#inst_app# == 0){\n Button(Class: btn-xs pull-right btn-link, Contract: @1AppInstall, Params: \"ApplicationId=#id#\", Page: #this_page#){\n Span(Class: h5, Body: $@1install$)\n }\n }.Else{\n Span(Body: $@1installed$, Class: text-muted pull-right)\n }\n }\n }\n }.Count(count)\n\n Div(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"ID=id,$@1name$=name,=inst_app\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1applications$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n }\n Div(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n }\n}.Else{\n SetTitle($@1apps_catalog$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "apps_list", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1apps_list).(this_table, @1applications)\nInclude(@1pager_header)\n\nSetTitle(\"$@1applications$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1apps_list$\"))\nAddToolButton(Title: $@1import$, Page: @1import_upload, Icon: icon-cloud-upload)\nAddToolButton(Title: $@1apps_inactive$, Page: @1apps_list_inactive, Icon: icon-close)\nAddToolButton(Title: $@1create$, Page: @1app_edit, Icon: icon-plus)\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": #ecosystem_id#, \"deleted\": 0, {\"$or\":[{\"name\": {\"$ilike\": \"#search#\"}}]}})\n}.Else{\n SetVar(where, {\"ecosystem\": #ecosystem_id#, \"deleted\": 0})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1name))\n Include(@1search)\n}\n\nDBFind(@1buffer_data, src_buffer).Columns(\"value->app_id,value->app_name,value->menu_name,value->menu_id,value->count_menu\").Where({\"key\": export, \"member_id\": #key_id#, \"ecosystem\": #ecosystem_id#}).Vars(buffer)\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_export){\n Button(Class: btn-xs btn-link, Contract: @1ExportNewApp, Params: \"ApplicationId=#id#\", Page: @1export_resources){\n Span(Class: h5, Body: \"$@1export$\")\n }\n}.Custom(custom_name){\n If(#id#==#buffer_value_app_id#){\n Button(Class: btn-xs btn-link, Page: @1app_contracts){\n Span(Class: h5, Body: #name#)\n }\n }.Else{\n Button(Class: btn-link btn-xs, Contract: @1SelectApp, Params: \"ApplicationId=#id#\", Page: @1app_contracts){\n Span(Class: h5, Body: #name#)\n }\n }\n}.Custom(custom_actions){\n Span(Class: pull-right){\n LinkPage(Class: text-primary h4, Body: Em(Class: fa fa-cogs), Page: @1app_edit, PageParams: \"id=#id#\")\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1name$=custom_name,$@1conditions$=conditions,$@1export$=_export,=custom_actions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1applications$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n SetVar(this_page, @1apps_list).(this_table, @1applications)\n Include(@1pager_header)\n\n SetTitle(\"$@1applications$\")\n Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1apps_list$\"))\n AddToolButton(Title: $@1import$, Page: @1import_upload, Icon: icon-cloud-upload)\n AddToolButton(Title: $@1apps_inactive$, Page: @1apps_list_inactive, Icon: icon-close)\n AddToolButton(Title: $@1create$, Page: @1app_edit, Icon: icon-plus)\n\n If(#search#){\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0, \"name\": {\"$ilike\": \"#search#\"}})\n }.Else{\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0})\n }\n\n Div(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1name))\n Include(@1search)\n }\n\n DBFind(\"@1buffer_data\", src_buffer).Columns(\"value->app_id,value->app_name,value->menu_name,value->menu_id,value->count_menu\").Where({\"key\": \"export\", \"account\": \"#account_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(buffer)\n DBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_export){\n Button(Class: btn-xs btn-link, Contract: @1ExportNewApp, Params: \"ApplicationId=#id#\", Page: @1export_resources){\n Span(Class: h5, Body: \"$@1export$\")\n }\n }.Custom(custom_name){\n If(#id#==#buffer_value_app_id#){\n Button(Class: btn-xs btn-link, Page: @1app_contracts){\n Span(Class: h5, Body: #name#)\n }\n }.Else{\n Button(Class: btn-link btn-xs, Contract: @1SelectApp, Params: \"ApplicationId=#id#\", Page: @1app_contracts){\n Span(Class: h5, Body: #name#)\n }\n }\n }.Custom(custom_actions){\n Span(Class: pull-right){\n LinkPage(Class: text-primary h4, Body: Em(Class: fa fa-cogs), Page: @1app_edit, PageParams: \"id=#id#\")\n }\n }.Count(count)\n\n Div(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1name$=custom_name,$@1conditions$=conditions,$@1export$=_export,=custom_actions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1applications$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n }\n Div(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n }\n}.Else{\n SetTitle($@1applications$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "apps_list_inactive", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1apps_list_inactive).(this_table, @1applications)\nInclude(@1pager_header)\n\nSetTitle(\"$@1apps_inactive$\")\nSpan(Class: h5 m0 mb ml-lg){\n LinkPage(Class: ml-sm, Body: $@1applications$, Page: @1apps_list)\n Span(Class: text-muted, Body: /).Style(margin-right: 10px; margin-left: 10px;)\n Span(Class: text-muted, Body: \"$@1apps_inactive$\")\n}.Style(\n display: inline-block;\n)\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": #ecosystem_id#, \"deleted\": 1, {\"$or\":[{\"name\": {\"$ilike\": \"#search#\"}}]}})\n}.Else{\n SetVar(where, {\"ecosystem\": #ecosystem_id#, \"deleted\": 1})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1name))\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_actions){\n Span(Class: pull-right){\n Button(Class: btn btn-link, Page: @1apps_list_inactive, Contract: @1DelApplication, Params: \"ApplicationId=#id#\", Body: \"$@1restore$\")\n }\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1name$=name,$@1conditions$=conditions,=_actions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1inactive_warning$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n SetVar(this_page, @1apps_list_inactive).(this_table, @1applications)\n Include(@1pager_header)\n\n SetTitle(\"$@1apps_inactive$\")\n Span(Class: h5 m0 mb ml-lg){\n LinkPage(Class: ml-sm, Body: $@1applications$, Page: @1apps_list)\n Span(Class: text-muted, Body: /).Style(margin-right: 10px; margin-left: 10px;)\n Span(Class: text-muted, Body: \"$@1apps_inactive$\")\n }.Style(\n display: inline-block;\n )\n\n If(#search#){\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 1, \"name\": {\"$ilike\": \"#search#\"}})\n }.Else{\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 1})\n }\n\n Div(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1name))\n Include(@1search)\n }\n\n DBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_actions){\n Span(Class: pull-right){\n Button(Class: btn btn-link, Page: @1apps_list_inactive, Contract: @1DelApplication, Params: \"ApplicationId=#id#\", Body: \"$@1restore$\")\n }\n }.Count(count)\n\n Div(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1name$=name,$@1conditions$=conditions,=_actions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1inactive_warning$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n }\n Div(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n }\n}.Else{\n SetTitle($@1apps_inactive$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "column_add", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Div(content-wrapper){\n SetTitle($@1new_column$)\n Div(breadcrumb){\n Div(){\n LinkPage($@1tables$, @1app_tables)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n LinkPage($@1edit_table$, @1table_edit, PageParams:\"tabl_id=#tabl_id#\")\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n Span($@1new_column$, text-muted)\n }\n }\n\n Form(panel panel-default){\n Div(panel-body){\n Div(form-group){\n Label($@1column$)\n Input(Name: ColumnName)\n }\n Div(form-group){\n Data(src_type,\"type,name\"){\n text,\"Text\"\n number,\"Number\"\n varchar,\"Varchar\"\n datetime,\"Date/Time\"\n money,\"Money\"\n double,\"Double\"\n character,\"Character\"\n json,\"JSON\"\n }\n Label($@1type$)\n Select(Name: Coltype, Source: src_type, NameColumn: name, ValueColumn: type, Value:\"text\")\n }\n Div(form-group){\n Label($@1updating$)\n Input(Name: UpdateColumn, Value: \"true\")\n }\n Div(form-group){\n Label($@1reading$)\n Input(Name: ReadColumn, Value: \"true\")\n }\n }\n Div(panel-footer clearfix text-right){\n Button(Body: $@1column_add$, Contract: @1NewColumn, Class: btn btn-primary, Page: @1table_edit, PageParams: \"tabl_id=#tabl_id#\", Params: \"TableName=#next_table_name#,Name=Val(ColumnName),Type=Val(Coltype),UpdatePerm=Val(UpdateColumn),ReadPerm=Val(ReadColumn)\")\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n Div(content-wrapper){\n SetTitle($@1new_column$)\n Div(breadcrumb){\n Div(){\n LinkPage($@1tables$, @1app_tables)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n LinkPage($@1edit_table$, @1table_edit, PageParams:\"tabl_id=#tabl_id#\")\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n Span($@1new_column$, text-muted)\n }\n }\n\n Form(panel panel-default){\n Div(panel-body){\n Div(form-group){\n Label($@1column$)\n Input(Name: ColumnName)\n }\n Div(form-group){\n Data(src_type,\"type,name\"){\n text,\"Text\"\n number,\"Number\"\n varchar,\"Varchar\"\n datetime,\"Date/Time\"\n money,\"Money\"\n double,\"Double\"\n character,\"Character\"\n json,\"JSON\"\n }\n Label($@1type$)\n Select(Name: Coltype, Source: src_type, NameColumn: name, ValueColumn: type, Value:\"text\")\n }\n Div(form-group){\n Label($@1updating$)\n Input(Name: UpdateColumn, Value: \"true\")\n }\n Div(form-group){\n Label($@1reading$)\n Input(Name: ReadColumn, Value: \"true\")\n }\n }\n Div(panel-footer clearfix text-right){\n Button(Body: $@1column_add$, Contract: @1NewColumn, Class: btn btn-primary, Page: @1table_edit, PageParams: \"tabl_id=#tabl_id#\", Params: \"TableName=#next_table_name#,Name=Val(ColumnName),Type=Val(Coltype),UpdatePerm=Val(UpdateColumn),ReadPerm=Val(ReadColumn)\")\n }\n }\n }\n}.Else{\n SetTitle($@1new_column$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "column_edit", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Div(content-wrapper){\n SetTitle($@1edit_column$)\n Div(breadcrumb){\n Div(){\n LinkPage($@1tables$, @1app_tables)\n Span(/,mh)\n LinkPage($@1edit_table$, @1table_edit, PageParams:\"tabl_id=#tabl_id#\")\n Span(/,mh)\n Span($@1edit_column$, text-muted)\n }\n }\n\n DBFind(@1tables).Columns(\"id,name,columns,conditions\").Where({\"id\": #tabl_id#, \"ecosystem\": #ecosystem_id#}).Vars(table)\n JsonToSource(src_columns, #table_columns#)\n Form(panel panel-default){\n Div(panel-body){\n ForList(src_columns){\n If(#key# == #name_column#){\n Div(form-group){\n Label($@1column$)\n Input(Name: ColumnName, Disabled: \"true\", Value: #name_column#)\n }\n Div(form-group){\n Label($@1type$)\n SetVar(col_type, GetColumnType(#table_name#, #key#))\n If(#col_type# == character){\n SetVar(input_type, \"Character\")\n }\n If(#col_type# == text){\n SetVar(input_type, \"Text\")\n }\n If(#col_type# == number){\n SetVar(input_type, \"Number\")\n }\n If(#col_type# == money){\n SetVar(input_type, \"Money\")\n }\n If(#col_type# == varchar){\n SetVar(input_type, \"Varchar\")\n }\n If(#col_type# == datetime){\n SetVar(input_type, \"Date/Time\")\n }\n If(#col_type# == double){\n SetVar(input_type, \"Double\")\n }\n If(#col_type# == json){\n SetVar(input_type, \"JSON\")\n }\n If(#col_type# == bytea){\n SetVar(input_type, \"Binary Data\")\n }\n If(#col_type# == uuid){\n SetVar(input_type, \"UUID\")\n }\n Input(Name: Coltype, Disabled: \"true\", Value: #input_type#)\n }\n\n SetVar(isObject,0)\n JsonToSource(condition,#value#)\n ForList(condition){\n SetVar(isObject,1)\n If(#key#==read){\n Div(form-group){\n Label($@1reading$)\n Input(Name: ReadColumn, Value: #value#)\n }\n }.ElseIf(#key#==update){\n Div(form-group){\n Label($@1updating$)\n Input(Name: UpdateColumn, Value: #value#)\n }\n }\n }\n If(#isObject#==0){\n Div(form-group){\n Label($@1reading$)\n Input(Name: ReadColumn, Value: true)\n }\n Div(form-group){\n Label($@1updating$)\n Input(Name: UpdateColumn, Value: #value#)\n }\n }\n }\n }\n }\n Div(panel-footer clearfix text-right){\n Button(Body: $@1save$, Contract: @1EditColumn, Class: btn btn-primary, Page: @1table_edit, PageParams: \"tabl_id=#tabl_id#\", Params: \"TableName=#table_name#,Name=Val(ColumnName),Type=Val(Coltype),UpdatePerm=Val(UpdateColumn),ReadPerm=Val(ReadColumn)\")\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n Div(content-wrapper){\n SetTitle($@1edit_column$)\n Div(breadcrumb){\n Div(){\n LinkPage($@1tables$, @1app_tables)\n Span(/,mh)\n LinkPage($@1edit_table$, @1table_edit, PageParams:\"tabl_id=#tabl_id#\")\n Span(/,mh)\n Span($@1edit_column$, text-muted)\n }\n }\n\n DBFind(\"@1tables\").Columns(\"id,name,columns,conditions\").Where({\"id\": \"#tabl_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(table)\n JsonToSource(src_columns, #table_columns#)\n Form(panel panel-default){\n Div(panel-body){\n ForList(src_columns){\n If(#key# == #name_column#){\n Div(form-group){\n Label($@1column$)\n Input(Name: ColumnName, Disabled: \"true\", Value: #name_column#)\n }\n Div(form-group){\n Label($@1type$)\n SetVar(col_type, GetColumnType(#table_name#, #key#))\n If(#col_type# == character){\n SetVar(input_type, \"Character\")\n }\n If(#col_type# == text){\n SetVar(input_type, \"Text\")\n }\n If(#col_type# == number){\n SetVar(input_type, \"Number\")\n }\n If(#col_type# == money){\n SetVar(input_type, \"Money\")\n }\n If(#col_type# == varchar){\n SetVar(input_type, \"Varchar\")\n }\n If(#col_type# == datetime){\n SetVar(input_type, \"Date/Time\")\n }\n If(#col_type# == double){\n SetVar(input_type, \"Double\")\n }\n If(#col_type# == json){\n SetVar(input_type, \"JSON\")\n }\n If(#col_type# == bytea){\n SetVar(input_type, \"Binary Data\")\n }\n If(#col_type# == uuid){\n SetVar(input_type, \"UUID\")\n }\n Input(Name: Coltype, Disabled: \"true\", Value: #input_type#)\n }\n\n SetVar(isObject,0)\n JsonToSource(condition,#value#)\n ForList(condition){\n SetVar(isObject,1)\n If(#key#==read){\n Div(form-group){\n Label($@1reading$)\n Input(Name: ReadColumn, Value: #value#)\n }\n }.ElseIf(#key#==update){\n Div(form-group){\n Label($@1updating$)\n Input(Name: UpdateColumn, Value: #value#)\n }\n }\n }\n If(#isObject#==0){\n Div(form-group){\n Label($@1reading$)\n Input(Name: ReadColumn, Value: true)\n }\n Div(form-group){\n Label($@1updating$)\n Input(Name: UpdateColumn, Value: #value#)\n }\n }\n }\n }\n }\n Div(panel-footer clearfix text-right){\n Button(Body: $@1save$, Contract: @1EditColumn, Class: btn btn-primary, Page: @1table_edit, PageParams: \"tabl_id=#tabl_id#\", Params: \"TableName=#table_name#,Name=Val(ColumnName),Type=Val(Coltype),UpdatePerm=Val(UpdateColumn),ReadPerm=Val(ReadColumn)\")\n }\n }\n }\n}.Else{\n SetTitle($@1edit_column$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "developer_index", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1developer_index).(deleters_count,0)\nDBFind(@1contracts).Where({\"name\": ItemChangeAppId, \"ecosystem\": 1}).Count(changer_count)\nDBFind(@1applications,src_apps).Where({\"deleted\": 0, \"ecosystem\": #ecosystem_id#}).Order(id).Count(apps_count)\n\nIf(And(#Restore#,#Table#,#Id#)){\n Form(){\n Select(Name:AppId, NameColumn: name, ValueColumn: id, Source: src_apps, Class:mb)\n Div(){\n Button(Class: btn btn-default, Page: #this_page#, PageParams: \"appid=0\", Body: \"$@1cancel$\")\n Button(Class: btn btn-primary pull-right, Page: #this_page#, PageParams: \"appid=Val(AppId)\", Contract: @1ItemChangeAppId, Params: \"Table=#Table#,Id=#Id#,AppId=Val(AppId)\", Body: \"$@1confirm_button$\")\n }\n }\n}.ElseIf(#block#){\n Span(Class: h5 m0 mb ml-lg){\n LinkPage(Class: ml-sm, Body: $@1dashboard$, Page: #this_page#)\n Span(Class: text-muted mh-sm, Body: /)\n Span(Class: text-muted, Body: $@1block$: #block#)\n }.Style(\n display: inline-block;\n )\n Include(Name:#block#)\n}.Else{\n DBFind(@1buffer_data).Columns(\"value->app_id\").Where({\"key\": export, \"member_id\": #key_id#, \"ecosystem\": #ecosystem_id#}).Vars(buffer)\n If(#Single#==binaries){\n Data(tables, \"Table,Page,Name\"){\n @1binaries,@1app_upload_binary,$@1binaries$\n }\n }.ElseIf(#Single#==languages){\n Data(tables, \"Table,Cols,Page,Name\"){\n @1languages,\"id,name,res\",@1langres_add,$@1lang_res$\n }\n }.Else{\n Data(tables, \"Table,Cols,Page,Name\"){\n @1contracts,\"id,app_id,name,wallet_id\",editor,$@1contracts$\n @1pages,\"id,app_id,name\",editor,$@1pages$\n @1blocks,\"id,app_id,name\",editor, $@1blocks$\n @1tables,\"id,app_id,name\",@1table_create,$@1tables$\n @1app_params,\"id,app_id,name,value\",@1app_params_edit,$@1app_params$\n }\n }\n SetVar(active_btn,\"btn btn-info\").(create_icon,fa fa-plus-square).(cols,3)\n\n If(#appid#!=\"\"){\n SetVar(where, {\"app_id\": #appid#, \"ecosystem\": #ecosystem_id#})\n }.Else{\n If(#buffer_value_app_id#>0){\n DBFind(@1applications).Where({\"id\": #buffer_value_app_id#, \"deleted\": 0, \"ecosystem\": #ecosystem_id#}).Vars(check)\n If(#check_id# > 0){\n SetVar(appid,#buffer_value_app_id#).(where, {\"app_id\": #appid#, \"ecosystem\": #ecosystem_id#})\n }.Else{\n SetVar(where,{\"id\":{\"$gt\":0}, \"ecosystem\": #ecosystem_id#}).(appid,1)\n }\n }.Else{\n SetVar(where, {\"id\": {\"$gt\": 0}, \"ecosystem\": #ecosystem_id#}).(appid,1)\n }\n }\n\n If(#appid#==0){\n SetVar(application_name,trash)\n }.ElseIf(#appid#>0){\n DBFind(@1applications).Where({\"id\": #appid#, \"ecosystem\": #ecosystem_id#}).Vars(application)\n }\n If(And(#appid# == 1,#ecosystem_id# != 1)){\n SetTitle($@1dashboard$: $@1select_application$)\n }.Else{\n SetTitle($@1dashboard$: #application_name#)\n }\n\n Div(mr-lg ml-lg){\n Div(){\n If(#Single#){\n Div(text-right){\n Button(Page: #this_page#, PageParams: \"appid=#appid#\", Class: btn btn-default fa fa-close mr-sm)\n }\n }.Else{\n Div(row){\n Div(col-sm-12 btn-group){\n ForList(src_apps){\n If(#src_apps_index#==1){\n If(#appid#==0){\n LinkPage(Class: #active_btn# disabled ml-sm, Body: Span(Class:fa fa-trash))\n }.Else{\n LinkPage(Page: #this_page#, Class: btn btn-default ml-sm, PageParams: \"appid=0\", Body: Span(Class:fa fa-trash))\n }\n }\n If(#appid#==#id#){\n LinkPage(Class: #active_btn# disabled ml-sm, Body:\"#id#:#name#\")\n }.Else{\n LinkPage(Page: #this_page#, Class: btn btn-default ml-sm, PageParams: \"appid=#id#\", Body:\"#id#:#name#\")\n }\n }\n }\n }\n }\n }\n Div(panel panel-primary){\n Div(panel-body){\n If(And(#appid# == 1,#ecosystem_id# != 1)){\n Span(Class: text-muted,Body: $@1dashboard_hint$)\n }.Else{\n SetVar(limit,250)\n ForList(tables){\n If(#Table#==@1binaries){\n DBFind(#Table#, src_table).Limit(#limit#).Order({ id: -1 }).Where(#where#).Count(items_count).Custom(_name){\n LinkPage(Page: #Page#, PageParams: \"id=#id#,application_id=#appid#\"){#name#}\n }.Custom(_img){\n Image(Src: Binary().ById(#id#), Class: preview)\n }\n }.ElseIf(#Table#==@1languages){\n If(#search#){\n SetVar(where, {\"ecosystem\": #ecosystem_id#, {\"$or\":[{\"name\": {\"$ilike\": \"#search#\"}}, {\"res\": {\"$ilike\": \"#search#\"}}]}})\n }.Else{\n SetVar(where, {\"ecosystem\": #ecosystem_id#})\n }\n DBFind(#Table#, src_table).Limit(#limit#).Columns(#Cols#).Order(\"name\").Where(#where#).Count(items_count)\n }.Else{\n DBFind(#Table#, src_table).Limit(#limit#).Columns(#Cols#).Order(\"name\").Where(#where#).Count(items_count)\n }\n Div(list-group-item clearfix){\n If(#Table#==@1languages){\n Form(){\n Div(input-group){\n Div(input-group-addon){\n LangRes(@1search)\n }\n Input(Name: search, Value: #search#)\n Div(input-group-btn){\n Button(Class: btn btn-primary fa fa-search, Page: #this_page#, PageParams: \"appid=#appid#,search=Val(search),Single=#Single#\")\n If(#search#){\n Button(Class: btn btn-default fa fa-close mr-sm, Page: #this_page#, PageParams: \"appid=#appid#,Single=#Single#\")\n }\n }\n }\n }\n }\n Div(h3 pull-left mt-lg){\n #Name#\n }\n If(#appid#>0){\n Div(pull-right mt-lg){\n If(#Table#==@1contracts){\n LinkPage(Page: #Page#, PageParams: \"create=contract,appId=#appid#\"){\n Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#)\n }\n }.ElseIf(#Table#==@1pages){\n LinkPage(Page: #Page#, PageParams: \"create=page,appId=#appid#\"){\n Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#)\n }\n }.ElseIf(#Table#==@1blocks){\n LinkPage(Page: #Page#, PageParams: \"create=block,appId=#appid#\"){\n Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#)\n }\n }.ElseIf(#Table#==@1tables){\n LinkPage(Page: #Page#, PageParams: \"application_id=#appid#\"){\n Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#)\n }\n }.ElseIf(#Table#==@1app_params){\n LinkPage(Page: #Page#, PageParams: \"application_id=#appid#,create=create\"){\n Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#)\n }\n }.ElseIf(#Table#==@1binaries){\n LinkPage(Page: #Page#, PageParams: \"application_id=#appid#\"){\n Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#)\n }\n }.ElseIf(#Table#==@1languages){\n LinkPage(Page: #Page#){\n Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#)\n }\n }\n }\n }\n Div(row pd){\n Div(col-sm-12){\n If(#Table#==@1binaries){\n If(#items_count#>0){\n Div(items){\n Table(src_table,\"=id,$@1edit_link$=_name,$@1download_link$=data,=_img\")\n }\n }.Else{\n Div(text-muted h4 text-center){\n #Name# $@1not_founded$\n }\n }\n }.Else{\n SetVar(value,).(res,)\n If(#items_count#>0){\n Div(cols){\n ForList(src_table){\n Div(clearfix item){\n Div(pull-right){\n If(#Table#==@1contracts){\n If(#wallet_id#!=0){\n Span($@1binded$, text-success mr-lg)\n }\n LinkPage(Class: text-muted fa fa-history, Page: @1history, PageParams: \"id=#id#,type=contract\")\n LinkPage(Class: text-muted fa fa-cogs, Page: @1properties_edit, PageParams: \"edit_property_id=#id#,type=contract\")\n }\n If(#Table#==@1pages){\n LinkPage(Class: text-muted fa fa-eye, Page: #name#)\n LinkPage(Class: text-muted fa fa-history, Page: @1history, PageParams: \"id=#id#,type=page\")\n LinkPage(Class: text-muted fa fa-cogs, Page: @1properties_edit, PageParams: \"edit_property_id=#id#,type=page\")\n }\n If(#Table#==@1blocks){\n LinkPage(Class: text-muted fa fa-eye, Page: #this_page#, PageParams:\"block=#name#\")\n LinkPage(Class: text-muted fa fa-history, Page: @1history, PageParams: \"id=#id#,type=block\")\n LinkPage(Class: text-muted fa fa-cogs, Page: @1properties_edit, PageParams: \"edit_property_id=#id#,type=block\")\n }\n If(#Table#==@1tables){\n LinkPage(Class: text-muted fa fa-eye, Page: @1table_view, PageParams: \"tabl_id=#id#,table_name=#name#\")\n }\n If(#Table#!=@1languages){\n If(#changer_count#==1){\n If(#appid#==0){\n Button(Class: btn-link text-muted fa fa-recycle, Page: #this_page#, PageParams: \"Restore=1,Table=#Table#,Id=#id#\").Popup(30, \"$@1restore_select$\")\n }.Else{\n If(#ecosystem_id#==1){\n Button(Class: btn-link text-muted fa fa-trash, Page: #this_page#, PageParams: \"appid=#appid#\", Contract: ItemChangeAppId, Params: \"Table=#Table#,Id=#id#,AppId=0\").Alert(\"$@1remove_confirmation$\", \"$@1confirm_button$\", \"$@1cancel$\")\n }.Else{\n Button(Class: btn-link text-muted fa fa-trash, Page: #this_page#, PageParams: \"appid=#appid#\", Contract: @1ItemChangeAppId, Params: \"Table=#Table#,Id=#id#,AppId=0\").Alert(\"$@1remove_confirmation$\", \"$@1confirm_button$\", \"$@1cancel$\")\n\n }\n }\n }\n }\n }\n If(#Table#==@1contracts){\n LinkPage(Page: #Page#, PageParams: \"open=contract,name=#name#,back_page=#this_page#\"){#name#}\n }\n If(#Table#==@1pages){\n LinkPage(Page: #Page#, PageParams: \"open=page,name=#name#,back_page=#this_page#\"){#name#}\n }\n If(#Table#==@1blocks){\n LinkPage(Page: #Page#, PageParams: \"open=block,name=#name#,back_page=#this_page#\"){#name#}\n }\n If(#Table#==@1tables){\n LinkPage(Page: @1table_edit, PageParams: \"tabl_id=#id#,back_page=#this_page#\"){#name#}\n }\n If(#Table#==@1app_params){\n LinkPage(Page: #Page#, PageParams: \"id=#id#,back_page=#this_page#\"){#name#}\n }\n If(#Table#==@1languages){\n LinkPage(Page: @1langres_edit, PageParams: \"lang_id=#id#,back_page=#this_page#\"){#name#}\n }\n If(`#value#`!=\"\"){\n :Div(text-muted){`#value#`}.Style(max-height:1.5em;overflow:hidden;)\n }.ElseIf(`#res#`!=\"\"){\n :Div(text-muted){`#res#`}\n }\n }\n }\n }\n }.Else{\n Div(text-muted h4 text-center){\n #Name# $@1not_founded$\n }\n }\n }\n }\n }\n }\n }\n }\n }\n If(And(#appid# == 1,#ecosystem_id# != 1)){\n }.Else{\n If(#Single#){\n }.Else{\n Div(panel-footer){\n Button(Page: #this_page#, PageParams: \"Single=binaries,appid=#appid#\", Class: btn btn-default mr, Body: $@1binaries$)\n Button(Page: #this_page#, PageParams: \"Single=languages\", Class: btn btn-default, Body: $@1languages$)\n }\n }\n }\n }\n }.Style(\n .pull-right a {\n margin-right:10px;\n }\n .text-muted {\n color: #909fa7!important;\n }\n .cols {\n -moz-column-count: #cols#;\n -webkit-column-count: #cols#;\n column-count: #cols#;\n }\n .item:hover {\n background-color: #fafafa;\n }\n .items tr:hover {\n background-color: #fafafa;\n }\n .preview {\n height:30px;\n }\n )\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n SetVar(this_page, @1developer_index).(deleters_count,0)\n DBFind(\"@1contracts\").Where({\"name\": \"ItemChangeAppId\", \"ecosystem\": 1}).Count(changer_count)\n DBFind(\"@1applications\",src_apps).Where({\"deleted\": 0, \"ecosystem\": \"#ecosystem_id#\"}).Order(\"id\").Count(apps_count)\n\n If(And(#Restore#,#Table#,#Id#)){\n Form(){\n Select(Name:AppId, NameColumn: name, ValueColumn: id, Source: src_apps, Class:mb)\n Div(){\n Button(Class: btn btn-default, Page: #this_page#, PageParams: \"appid=0\", Body: \"$@1cancel$\")\n Button(Class: btn btn-primary pull-right, Page: #this_page#, PageParams: \"appid=Val(AppId)\", Contract: @1ItemChangeAppId, Params: \"Table=#Table#,Id=#Id#,AppId=Val(AppId)\", Body: \"$@1confirm_button$\")\n }\n }\n }.ElseIf(#block#){\n Span(Class: h5 m0 mb ml-lg){\n LinkPage(Class: ml-sm, Body: $@1dashboard$, Page: #this_page#)\n Span(Class: text-muted mh-sm, Body: /)\n Span(Class: text-muted, Body: $@1block$: #block#)\n }.Style(\n display: inline-block;\n )\n Include(Name:#block#)\n }.Else{\n DBFind(\"@1buffer_data\").Columns(\"value->app_id\").Where({\"key\": \"export\", \"account\": \"#account_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(buffer)\n If(#Single#==binaries){\n Data(tables, \"Table,Page,Name\"){\n @1binaries,@1app_upload_binary,$@1binaries$\n }\n }.ElseIf(#Single#==languages){\n Data(tables, \"Table,Cols,Page,Name\"){\n @1languages,\"id,name,res\",@1langres_add,$@1lang_res$\n }\n }.Else{\n Data(tables, \"Table,Cols,Page,Name\"){\n @1contracts,\"id,app_id,name,wallet_id\",editor,$@1contracts$\n @1pages,\"id,app_id,name\",editor,$@1pages$\n @1blocks,\"id,app_id,name\",editor, $@1blocks$\n @1tables,\"id,app_id,name\",@1table_create,$@1tables$\n @1app_params,\"id,app_id,name,value\",@1app_params_edit,$@1app_params$\n }\n }\n SetVar(active_btn,\"btn btn-info\").(create_icon,fa fa-plus-square).(cols,3)\n\n If(#appid#!=\"\"){\n SetVar(where, {\"app_id\": \"#appid#\", \"ecosystem\": \"#ecosystem_id#\"})\n }.Else{\n If(#buffer_value_app_id#>0){\n DBFind(\"@1applications\").Where({\"id\": \"#buffer_value_app_id#\", \"deleted\": 0, \"ecosystem\": \"#ecosystem_id#\"}).Vars(check)\n If(#check_id# > 0){\n SetVar(appid, #buffer_value_app_id#).(where, {\"app_id\": \"#appid#\", \"ecosystem\": \"#ecosystem_id#\"})\n }.Else{\n SetVar(where, {\"id\": {\"$gt\": 0}, \"ecosystem\": \"#ecosystem_id#\"}).(appid, 1)\n }\n }.Else{\n SetVar(where, {\"id\": {\"$gt\": 0}, \"ecosystem\": \"#ecosystem_id#\"}).(appid, 1)\n }\n }\n\n If(#appid#==0){\n SetVar(application_name,trash)\n }.ElseIf(#appid#>0){\n DBFind(\"@1applications\").Where({\"id\": \"#appid#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(application)\n }\n If(And(#appid# == 1,#ecosystem_id# != 1)){\n SetTitle($@1dashboard$: $@1select_application$)\n }.Else{\n SetTitle($@1dashboard$: #application_name#)\n }\n\n Div(mr-lg ml-lg){\n Div(){\n If(#Single#){\n Div(text-right){\n Button(Page: #this_page#, PageParams: \"appid=#appid#\", Class: btn btn-default fa fa-close mr-sm)\n }\n }.Else{\n Div(row){\n Div(col-sm-12 btn-group){\n ForList(src_apps){\n If(#src_apps_index#==1){\n If(#appid#==0){\n LinkPage(Class: #active_btn# disabled ml-sm, Body: Span(Class:fa fa-trash))\n }.Else{\n LinkPage(Page: #this_page#, Class: btn btn-default ml-sm, PageParams: \"appid=0\", Body: Span(Class:fa fa-trash))\n }\n }\n If(#appid#==#id#){\n LinkPage(Class: #active_btn# disabled ml-sm, Body:\"#id#:#name#\")\n }.Else{\n LinkPage(Page: #this_page#, Class: btn btn-default ml-sm, PageParams: \"appid=#id#\", Body:\"#id#:#name#\")\n }\n }\n }\n }\n }\n }\n Div(panel panel-primary){\n Div(panel-body){\n If(And(#appid# == 1,#ecosystem_id# != 1)){\n Span(Class: text-muted,Body: $@1dashboard_hint$)\n }.Else{\n SetVar(limit,250)\n ForList(tables){\n If(#Table#==@1binaries){\n DBFind(#Table#, src_table).Limit(#limit#).Order({\"id\": \"-1\"}).Where(#where#).Count(items_count).Custom(_name){\n LinkPage(Page: #Page#, PageParams: \"id=#id#,application_id=#appid#\"){#name#}\n }.Custom(_img){\n Image(Src: Binary().ById(#id#), Class: preview)\n }\n }.ElseIf(#Table#==@1languages){\n If(#search#){\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"$or\": [{\"name\": {\"$ilike\": \"#search#\"}}, {\"res\": {\"$ilike\": \"#search#\"}}]})\n }.Else{\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\"})\n }\n DBFind(#Table#, src_table).Limit(#limit#).Columns(#Cols#).Order(\"name\").Where(#where#).Count(items_count)\n }.Else{\n DBFind(#Table#, src_table).Limit(#limit#).Columns(#Cols#).Order(\"name\").Where(#where#).Count(items_count)\n }\n Div(list-group-item clearfix){\n If(#Table#==@1languages){\n Form(){\n Div(input-group){\n Div(input-group-addon){\n LangRes(@1search)\n }\n Input(Name: search, Value: #search#)\n Div(input-group-btn){\n Button(Class: btn btn-primary fa fa-search, Page: #this_page#, PageParams: \"appid=#appid#,search=Val(search),Single=#Single#\")\n If(#search#){\n Button(Class: btn btn-default fa fa-close mr-sm, Page: #this_page#, PageParams: \"appid=#appid#,Single=#Single#\")\n }\n }\n }\n }\n }\n Div(h3 pull-left mt-lg){\n #Name#\n }\n If(#appid#>0){\n Div(pull-right mt-lg){\n If(#Table#==@1contracts){\n LinkPage(Page: #Page#, PageParams: \"create=contract,appId=#appid#\"){\n Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#)\n }\n }.ElseIf(#Table#==@1pages){\n LinkPage(Page: #Page#, PageParams: \"create=page,appId=#appid#\"){\n Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#)\n }\n }.ElseIf(#Table#==@1blocks){\n LinkPage(Page: #Page#, PageParams: \"create=block,appId=#appid#\"){\n Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#)\n }\n }.ElseIf(#Table#==@1tables){\n LinkPage(Page: #Page#, PageParams: \"application_id=#appid#\"){\n Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#)\n }\n }.ElseIf(#Table#==@1app_params){\n LinkPage(Page: #Page#, PageParams: \"application_id=#appid#,create=create\"){\n Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#)\n }\n }.ElseIf(#Table#==@1binaries){\n LinkPage(Page: #Page#, PageParams: \"application_id=#appid#\"){\n Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#)\n }\n }.ElseIf(#Table#==@1languages){\n LinkPage(Page: #Page#){\n Em(Class: #create_icon#) $@1create_button$ Em(Class: #create_icon#)\n }\n }\n }\n }\n Div(row pd){\n Div(col-sm-12){\n If(#Table#==@1binaries){\n If(#items_count#>0){\n Div(items){\n Table(src_table,\"=id,$@1edit_link$=_name,$@1download_link$=data,=_img\")\n }\n }.Else{\n Div(text-muted h4 text-center){\n #Name# $@1not_founded$\n }\n }\n }.Else{\n SetVar(value,).(res,)\n If(#items_count#>0){\n Div(cols){\n ForList(src_table){\n Div(clearfix item){\n Div(pull-right){\n If(#Table#==@1contracts){\n If(#wallet_id#!=0){\n Span($@1binded$, text-success mr-lg)\n }\n LinkPage(Class: text-muted fa fa-history, Page: @1history, PageParams: \"id=#id#,type=contract\")\n LinkPage(Class: text-muted fa fa-cogs, Page: @1properties_edit, PageParams: \"edit_property_id=#id#,type=contract\")\n }\n If(#Table#==@1pages){\n LinkPage(Class: text-muted fa fa-eye, Page: #name#)\n LinkPage(Class: text-muted fa fa-history, Page: @1history, PageParams: \"id=#id#,type=page\")\n LinkPage(Class: text-muted fa fa-cogs, Page: @1properties_edit, PageParams: \"edit_property_id=#id#,type=page\")\n }\n If(#Table#==@1blocks){\n LinkPage(Class: text-muted fa fa-eye, Page: #this_page#, PageParams:\"block=#name#\")\n LinkPage(Class: text-muted fa fa-history, Page: @1history, PageParams: \"id=#id#,type=block\")\n LinkPage(Class: text-muted fa fa-cogs, Page: @1properties_edit, PageParams: \"edit_property_id=#id#,type=block\")\n }\n If(#Table#==@1tables){\n LinkPage(Class: text-muted fa fa-eye, Page: @1table_view, PageParams: \"tabl_id=#id#,table_name=#name#\")\n }\n If(#Table#!=@1languages){\n If(#changer_count#==1){\n If(#appid#==0){\n Button(Class: btn-link text-muted fa fa-recycle, Page: #this_page#, PageParams: \"Restore=1,Table=#Table#,Id=#id#\").Popup(30, \"$@1restore_select$\")\n }.Else{\n If(#ecosystem_id#==1){\n Button(Class: btn-link text-muted fa fa-trash, Page: #this_page#, PageParams: \"appid=#appid#\", Contract: ItemChangeAppId, Params: \"Table=#Table#,Id=#id#,AppId=0\").Alert(\"$@1remove_confirmation$\", \"$@1confirm_button$\", \"$@1cancel$\")\n }.Else{\n Button(Class: btn-link text-muted fa fa-trash, Page: #this_page#, PageParams: \"appid=#appid#\", Contract: @1ItemChangeAppId, Params: \"Table=#Table#,Id=#id#,AppId=0\").Alert(\"$@1remove_confirmation$\", \"$@1confirm_button$\", \"$@1cancel$\")\n\n }\n }\n }\n }\n }\n If(#Table#==@1contracts){\n LinkPage(Page: #Page#, PageParams: \"open=contract,name=#name#,back_page=#this_page#\"){#name#}\n }\n If(#Table#==@1pages){\n LinkPage(Page: #Page#, PageParams: \"open=page,name=#name#,back_page=#this_page#\"){#name#}\n }\n If(#Table#==@1blocks){\n LinkPage(Page: #Page#, PageParams: \"open=block,name=#name#,back_page=#this_page#\"){#name#}\n }\n If(#Table#==@1tables){\n LinkPage(Page: @1table_edit, PageParams: \"tabl_id=#id#,back_page=#this_page#\"){#name#}\n }\n If(#Table#==@1app_params){\n LinkPage(Page: #Page#, PageParams: \"id=#id#,back_page=#this_page#\"){#name#}\n }\n If(#Table#==@1languages){\n LinkPage(Page: @1langres_edit, PageParams: \"lang_id=#id#,back_page=#this_page#\"){#name#}\n }\n If(`#value#`!=\"\"){\n :Div(text-muted){`#value#`}.Style(max-height:1.5em;overflow:hidden;)\n }.ElseIf(`#res#`!=\"\"){\n :Div(text-muted){`#res#`}\n }\n }\n }\n }\n }.Else{\n Div(text-muted h4 text-center){\n #Name# $@1not_founded$\n }\n }\n }\n }\n }\n }\n }\n }\n }\n If(And(#appid# == 1,#ecosystem_id# != 1)){\n }.Else{\n If(#Single#){\n }.Else{\n Div(panel-footer){\n Button(Page: #this_page#, PageParams: \"Single=binaries,appid=#appid#\", Class: btn btn-default mr, Body: $@1binaries$)\n Button(Page: #this_page#, PageParams: \"Single=languages\", Class: btn btn-default, Body: $@1languages$)\n }\n }\n }\n }\n }.Style(\n .pull-right a {\n margin-right:10px;\n }\n .text-muted {\n color: #909fa7!important;\n }\n .cols {\n -moz-column-count: #cols#;\n -webkit-column-count: #cols#;\n column-count: #cols#;\n }\n .item:hover {\n background-color: #fafafa;\n }\n .items tr:hover {\n background-color: #fafafa;\n }\n .preview {\n height:30px;\n }\n )\n }\n}.Else{\n SetTitle($@1dashboard$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "export_download", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Div(fullscreen){\n SetTitle($@1export$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1payload$)\n }\n\n DBFind(Name: @1buffer_data, Source: src_buffer).Columns(\"value->app_name,value->app_id\").Where({\"key\": export, \"member_id\": #key_id#, \"ecosystem\": #ecosystem_id#}).Vars(buffer)\n DBFind(@1binaries, src_binaries).Where({\"name\": export, \"member_id\": #key_id#, \"ecosystem\": #ecosystem_id#, \"app_id\": #buffer_value_app_id#}).Custom(app_name){\n Span(#buffer_value_app_name#)\n }\n\n Table(Source: src_binaries, \"$@1application$=app_name,=data\").Style(\n tbody > tr:nth-of-type(odd) {\n background-color: #fafbfc;\n }\n tbody > tr > td {\n word-break: break-all;\n font-weight: 400;\n font-size: 13px;\n color: #666;\n border-top: 1px solid #eee;\n vertical-align: middle;\n }\n tr > *:first-child {\n padding-left:20px;\n }\n tr > *:last-child {\n padding-right:20px;\n text-align:right;\n }\n thead {\n background-color: #eee;\n }\n )\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n Div(fullscreen){\n SetTitle($@1export$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1payload$)\n }\n\n DBFind(\"@1buffer_data\", src_buffer).Columns(\"value->app_name,value->app_id\").Where({\"key\": \"export\", \"account\": \"#account_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(buffer)\n DBFind(\"@1binaries\", src_binaries).Where({\"name\": \"export\", \"account\": \"#account_id#\", \"ecosystem\": \"#ecosystem_id#\", \"app_id\": \"#buffer_value_app_id#\"}).Custom(app_name){\n Span(#buffer_value_app_name#)\n }\n\n Table(Source: src_binaries, \"$@1application$=app_name,=data\").Style(\n tbody > tr:nth-of-type(odd) {\n background-color: #fafbfc;\n }\n tbody > tr > td {\n word-break: break-all;\n font-weight: 400;\n font-size: 13px;\n color: #666;\n border-top: 1px solid #eee;\n vertical-align: middle;\n }\n tr > *:first-child {\n padding-left:20px;\n }\n tr > *:last-child {\n padding-right:20px;\n text-align:right;\n }\n thead {\n background-color: #eee;\n }\n )\n }\n}.Else{\n SetTitle($@1export$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "export_resources", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1export_resources).(pager_limit, 25)\nDiv(content-wrapper){\n If(#page_par#){\n SetVar(res_type, #page_par#)\n }\n\n SetTitle($@1application_export$)\n Div(breadcrumb text-muted){\n $@1application_export_select$\n }\n DBFind(@1buffer_data).Columns(\"value->app_id,value->app_name,value->menu_name,value->menu_id,value->count_menu\").Where({\"key\": export, \"member_id\": #key_id#, \"ecosystem\": #ecosystem_id#}).Vars(buffer)\n Include(@1export_link)\n\n If(#buffer_value_app_id# > 0){\n If(#res_type#==\"pages\"){\n SetVar(this_table, @1pages).(where, {\"app_id\": #buffer_value_app_id#}).(page_par, \"pages\")\n Include(@1pager_header)\n DBFind(@1pages, src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({\"app_id\": #buffer_value_app_id#, \"ecosystem\": #ecosystem_id#}).Custom(_cbox){\n Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1)\n }.Order(\"id\")\n }\n If(#res_type#==\"blocks\"){\n SetVar(this_table, @1blocks).(where, {\"app_id\": #buffer_value_app_id#}).(page_par, \"blocks\")\n Include(@1pager_header)\n DBFind(@1blocks, src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({\"app_id\": #buffer_value_app_id#, \"ecosystem\": #ecosystem_id#}).Custom(_cbox){\n Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1)\n }.Order(\"id\")\n }\n If(#res_type#==\"menu\"){\n SetVar(this_table, @1menu).(where, {\"id\": {\"$in\": [#buffer_value_menu_id#]}}).(page_par, \"menu\")\n Include(@1pager_header)\n DBFind(@1menu, src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({\"id\": {\"$in\": [#buffer_value_menu_id#]}, \"ecosystem\": #ecosystem_id#}).Custom(_cbox){\n Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1)\n }.Order(\"id\")\n }\n If(#res_type#==\"parameters\"){\n SetVar(this_table, @1app_params).(where, {\"app_id\": #buffer_value_app_id#}).(page_par, \"parameters\")\n Include(@1pager_header)\n DBFind(@1app_params, src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({\"app_id\": #buffer_value_app_id#, \"ecosystem\": #ecosystem_id#}).Custom(_cbox){\n Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1)\n }.Order(\"id\")\n }\n If(#res_type#==\"languages\"){\n SetVar(this_table, @1languages).(page_par, \"languages\")\n Include(@1pager_header)\n DBFind(@1languages, src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({\"id\": 0}).Custom(_cbox){\n Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1)\n }.Order(\"id\")\n }\n If(#res_type#==\"contracts\"){\n SetVar(this_table, @1contracts).(where, {\"app_id\": #buffer_value_app_id#}).(page_par, \"contracts\")\n Include(@1pager_header)\n DBFind(@1contracts, src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({\"app_id\": #buffer_value_app_id#, \"ecosystem\": #ecosystem_id#}).Custom(_cbox){\n Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1)\n }.Order(\"id\")\n }\n If(#res_type#==\"tables\"){\n SetVar(this_table, @1tables).(where, {\"app_id\": #buffer_value_app_id#}).(page_par, \"tables\")\n Include(@1pager_header)\n DBFind(@1tables, src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({\"app_id\": #buffer_value_app_id#, \"ecosystem\": #ecosystem_id#}).Custom(_cbox){\n Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1)\n }.Order(\"id\")\n }\n }\n Div(row){\n Div(col-md-9){\n Table(src, \"ID=id,$@1name$=name,=_cbox\")\n If(#pages_count# > #pager_limit#){\n Include(@1pager)\n }\n }\n Div(col-md-3){\n Include(@1export_info)\n }\n }\n}.Style(\n tbody > tr:nth-of-type(odd) {\n background-color: #fafbfc;\n }\n tbody > tr > td {\n word-break: break-all;\n font-weight: 400;\n font-size: 13px;\n color: #666;\n border-top: 1px solid #eee;\n vertical-align: middle;\n padding: 8px 20px !important;\n }\n tr > *:first-child {\n padding-left:20px;\n width: 80px;\n }\n tr > *:last-child {\n padding-right:15px;\n width: 50px;\n text-align:right;\n }\n thead {\n background-color: #eee;\n }\n)", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n SetVar(this_page, @1export_resources).(pager_limit, 25)\n Div(content-wrapper){\n If(#page_par#){\n SetVar(res_type, #page_par#)\n }\n\n SetTitle($@1application_export$)\n Div(breadcrumb text-muted){\n $@1application_export_select$\n }\n DBFind(\"@1buffer_data\").Columns(\"value->app_id,value->app_name,value->menu_name,value->menu_id,value->count_menu\").Where({\"key\": \"export\", \"account\": \"#account_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(buffer)\n Include(@1export_link)\n\n If(#buffer_value_app_id# > 0){\n If(#res_type#==\"pages\"){\n SetVar(this_table, @1pages).(where, {\"app_id\": #buffer_value_app_id#}).(page_par, \"pages\")\n Include(@1pager_header)\n DBFind(\"@1pages\", src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({\"app_id\": \"#buffer_value_app_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Custom(_cbox){\n Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1)\n }.Order(\"id\")\n }\n If(#res_type#==\"blocks\"){\n SetVar(this_table, @1blocks).(where, {\"app_id\": #buffer_value_app_id#}).(page_par, \"blocks\")\n Include(@1pager_header)\n DBFind(\"@1blocks\", src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({\"app_id\": \"#buffer_value_app_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Custom(_cbox){\n Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1)\n }.Order(\"id\")\n }\n If(#res_type#==\"menu\"){\n SetVar(this_table, @1menu).(where, {\"id\": {\"$in\": [#buffer_value_menu_id#]}}).(page_par, \"menu\")\n Include(@1pager_header)\n DBFind(\"@1menu\", src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({\"id\": {\"$in\": [#buffer_value_menu_id#]}, \"ecosystem\": \"#ecosystem_id#\"}).Custom(_cbox){\n Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1)\n }.Order(\"id\")\n }\n If(#res_type#==\"parameters\"){\n SetVar(this_table, @1app_params).(where, {\"app_id\": #buffer_value_app_id#}).(page_par, \"parameters\")\n Include(@1pager_header)\n DBFind(\"@1app_params\", src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({\"app_id\": \"#buffer_value_app_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Custom(_cbox){\n Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1)\n }.Order(\"id\")\n }\n If(#res_type#==\"languages\"){\n SetVar(this_table, @1languages).(page_par, \"languages\")\n Include(@1pager_header)\n DBFind(\"@1languages\", src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({\"id\": 0}).Custom(_cbox){\n Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1)\n }.Order(\"id\")\n }\n If(#res_type#==\"contracts\"){\n SetVar(this_table, @1contracts).(where, {\"app_id\": #buffer_value_app_id#}).(page_par, \"contracts\")\n Include(@1pager_header)\n DBFind(\"@1contracts\", src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({\"app_id\": \"#buffer_value_app_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Custom(_cbox){\n Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1)\n }.Order(\"id\")\n }\n If(#res_type#==\"tables\"){\n SetVar(this_table, @1tables).(where, {\"app_id\": #buffer_value_app_id#}).(page_par, \"tables\")\n Include(@1pager_header)\n DBFind(\"@1tables\", src).Count(pages_count).Limit(#pager_limit#).Order(#sort_name#).Offset(#pager_offset#).Where({\"app_id\": \"#buffer_value_app_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Custom(_cbox){\n Input(Name: cbox, Type: checkbox, Value: true, Disabled: 1)\n }.Order(\"id\")\n }\n }\n Div(row){\n Div(col-md-9){\n Table(src, \"ID=id,$@1name$=name,=_cbox\")\n If(#pages_count# > #pager_limit#){\n Include(@1pager)\n }\n }\n Div(col-md-3){\n Include(@1export_info)\n }\n }\n }.Style(\n tbody > tr:nth-of-type(odd) {\n background-color: #fafbfc;\n }\n tbody > tr > td {\n word-break: break-all;\n font-weight: 400;\n font-size: 13px;\n color: #666;\n border-top: 1px solid #eee;\n vertical-align: middle;\n padding: 8px 20px !important;\n }\n tr > *:first-child {\n padding-left:20px;\n width: 80px;\n }\n tr > *:last-child {\n padding-right:15px;\n width: 50px;\n text-align:right;\n }\n thead {\n background-color: #eee;\n }\n )\n}.Else{\n SetTitle($@1application_export$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "history", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1history)\nIf(#view_mode# == \"\"){\n SetVar(view_mode, \"compact\")\n}\nIf(#view_mode# == compact){\n SetVar(compact_button, \"bg-gray-lighter\")\n SetVar(full_button, \"bg-gray\")\n}.Else{\n SetVar(full_button, \"bg-gray-lighter\")\n SetVar(compact_button, \"bg-gray\")\n}\nSetVar(element_id, #id#)\nIf(#type# == page){\n DBFind(@1pages).Where({\"id\": #element_id#, \"ecosystem\": #ecosystem_id#}).Limit(1).Vars(\"res\")\n SetTitle($@1page_history$: #res_name#)\n SetVar(contract_name, \"@1EditPage\")\n GetHistory(Source: src_history, Name: pages, Id: #element_id#)\n}.ElseIf(#type# == block){\n DBFind(@1blocks).Where({\"id\": #element_id#, \"ecosystem\": #ecosystem_id#}).Limit(1).Vars(\"res\")\n SetTitle($@1block_history$: #res_name#)\n SetVar(contract_name, \"@1EditBlock\")\n GetHistory(Source: src_history, Name: blocks, Id: #element_id#)\n}.ElseIf(#type# == contract){\n DBFind(@1contracts).Where({\"id\": #element_id#, \"ecosystem\": #ecosystem_id#}).Limit(1).Vars(\"res\")\n SetTitle($@1contract_history$: #res_name#)\n SetVar(contract_name, \"@1EditContract\")\n GetHistory(Source: src_history, Name: contracts, Id: #element_id#)\n}.ElseIf(#type# == menu){\n DBFind(@1menu).Where({\"id\": #element_id#, \"ecosystem\": #ecosystem_id#}).Limit(1).Vars(\"res\")\n SetTitle($@1menu_history$: #res_name#)\n SetVar(contract_name, \"@1EditMenu\")\n GetHistory(Source: src_history, Name: menu, Id: #element_id#)\n}\n\nDiv(mr-lg text-right){\n Button(Page: #this_page#, PageParams: \"view_mode=compact,type=#type#,id=#element_id#\", Class: btn #compact_button# mr-sm, Body: Em(Class: fa fa-bars) $@1compact$)\n Button(Page: #this_page#, PageParams: \"view_mode=full,type=#type#,id=#element_id#\", Class: btn #full_button# mr-sm, Body: Em(Class: fa fa-arrows-alt) $@1full$)\n}.Style(margin-top: -33px; z-index: 1001;)\n\nDiv(fullscreen){\n Div(list-group-item ml-lg mr-lg){\n Div(table){\n Div(table__head){\n Div(table__row){\n Div(table__cell){$@1id$}\n Div(table__cell){$@1value$}\n Div(table__cell){}\n }\n }\n Div(table__row){\n Div(table__cell table__cell_collapse){$@1current$}\n Div(table__cell){\n If(#view_mode# == compact){\n VarAsIs(value_as_is, #res_value#)\n Span(#value_as_is#)\n }.ElseIf(#view_mode# == full){\n VarAsIs(value_as_is, #res_value#)\n Code(#value_as_is#)\n }\n }\n Div(table__cell table__cell_collapse){}\n }\n ForList(src_history){\n If(#id#>0){\n Div(table__row){\n Div(table__cell table__cell_collapse){#id#}\n Div(table__cell){\n If(#view_mode# == compact){\n VarAsIs(value_as_is, #value#)\n Span(#value_as_is#)\n }.ElseIf(#view_mode# == full){\n VarAsIs(value_as_is, #value#)\n Code(#value_as_is#)\n }\n }\n Div(table__cell table__cell_collapse){\n Div(text-right){\n Button(Class: btn bg-gray-lighter mr-sm, Body: Em(Class: fa fa-eye), Page: @1history_compare, PageParams: \"type=#type#,element_id=#element_id#,history_id=#id#\")\n Button(Class: btn bg-gray-lighter, Body: Em(Class: fa fa-undo), Page: #this_page#, PageParams: \"type=#type#,id=#element_id#,view_mode=#view_mode#\", Contract: #contract_name#, Params: \"Id=#element_id#,Value=#value_as_is#\").Alert(Text: \"$@1want_restore_history_value$\", ConfirmButton: \"$@1yes$\", CancelButton: \"$@1no$\", Icon: icon-question)\n }.Style(min-width: 120px;)\n }\n }\n }\n }\n }\n }\n}.Style(\n .table {\n display: table;\n }\n\n .table > div:not(.table__body) {\n display: table-row-group;\n }\n\n .table .table__head {\n display: table-header-group;\n }\n\n .table .table__head .table__cell {\n font-weight: 700;\n color: #888;\n background: #fff !important;\n border-left: 0 !important;\n border-right: 0 !important;\n border-top: 0 !important;\n }\n\n .table .table__row {\n display: table-row;\n flex-direction: row;\n flex-wrap: no-wrap;\n }\n\n .table .table__row:nth-child(even) {\n background: #f8f9fc;\n }\n\n .table .table__row .table__cell {\n border-top: solid 1px #eee;\n }\n\n .table .table__cell {\n display: table-cell;\n padding: 8px 10px;\n }\n\n .table .table__cell.table__cell_collapse {\n width: 1px;\n }\n)", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n SetVar(this_page, @1history)\n If(#view_mode# == \"\"){\n SetVar(view_mode, \"compact\")\n }\n If(#view_mode# == compact){\n SetVar(compact_button, \"bg-gray-lighter\")\n SetVar(full_button, \"bg-gray\")\n }.Else{\n SetVar(full_button, \"bg-gray-lighter\")\n SetVar(compact_button, \"bg-gray\")\n }\n SetVar(element_id, #id#)\n If(#type# == page){\n DBFind(\"@1pages\").Where({\"id\": \"#element_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Limit(1).Vars(res)\n SetTitle($@1page_history$: #res_name#)\n SetVar(contract_name, \"@1EditPage\")\n GetHistory(Source: src_history, Name: pages, Id: #element_id#)\n }.ElseIf(#type# == block){\n DBFind(\"@1blocks\").Where({\"id\": \"#element_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Limit(1).Vars(res)\n SetTitle($@1block_history$: #res_name#)\n SetVar(contract_name, \"@1EditBlock\")\n GetHistory(Source: src_history, Name: blocks, Id: #element_id#)\n }.ElseIf(#type# == contract){\n DBFind(\"@1contracts\").Where({\"id\": \"#element_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Limit(1).Vars(res)\n SetTitle($@1contract_history$: #res_name#)\n SetVar(contract_name, \"@1EditContract\")\n GetHistory(Source: src_history, Name: contracts, Id: #element_id#)\n }.ElseIf(#type# == menu){\n DBFind(\"@1menu\").Where({\"id\": \"#element_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Limit(1).Vars(res)\n SetTitle($@1menu_history$: #res_name#)\n SetVar(contract_name, \"@1EditMenu\")\n GetHistory(Source: src_history, Name: menu, Id: #element_id#)\n }\n\n Div(mr-lg text-right){\n Button(Page: #this_page#, PageParams: \"view_mode=compact,type=#type#,id=#element_id#\", Class: btn #compact_button# mr-sm, Body: Em(Class: fa fa-bars) $@1compact$)\n Button(Page: #this_page#, PageParams: \"view_mode=full,type=#type#,id=#element_id#\", Class: btn #full_button# mr-sm, Body: Em(Class: fa fa-arrows-alt) $@1full$)\n }.Style(margin-top: -33px; z-index: 1001;)\n\n Div(fullscreen){\n Div(list-group-item ml-lg mr-lg){\n Div(table){\n Div(table__head){\n Div(table__row){\n Div(table__cell){$@1id$}\n Div(table__cell){$@1value$}\n Div(table__cell){}\n }\n }\n Div(table__row){\n Div(table__cell table__cell_collapse){$@1current$}\n Div(table__cell){\n If(#view_mode# == compact){\n VarAsIs(value_as_is, #res_value#)\n Span(#value_as_is#)\n }.ElseIf(#view_mode# == full){\n VarAsIs(value_as_is, #res_value#)\n Code(#value_as_is#)\n }\n }\n Div(table__cell table__cell_collapse){}\n }\n ForList(src_history){\n If(#id#>0){\n Div(table__row){\n Div(table__cell table__cell_collapse){#id#}\n Div(table__cell){\n If(#view_mode# == compact){\n VarAsIs(value_as_is, #value#)\n Span(#value_as_is#)\n }.ElseIf(#view_mode# == full){\n VarAsIs(value_as_is, #value#)\n Code(#value_as_is#)\n }\n }\n Div(table__cell table__cell_collapse){\n Div(text-right){\n Button(Class: btn bg-gray-lighter mr-sm, Body: Em(Class: fa fa-eye), Page: @1history_compare, PageParams: \"type=#type#,element_id=#element_id#,history_id=#id#\")\n Button(Class: btn bg-gray-lighter, Body: Em(Class: fa fa-undo), Page: #this_page#, PageParams: \"type=#type#,id=#element_id#,view_mode=#view_mode#\", Contract: #contract_name#, Params: \"Id=#element_id#,Value=#value_as_is#\").Alert(Text: \"$@1want_restore_history_value$\", ConfirmButton: \"$@1yes$\", CancelButton: \"$@1no$\", Icon: icon-question)\n }.Style(min-width: 120px;)\n }\n }\n }\n }\n }\n }\n }.Style(\n .table {\n display: table;\n }\n\n .table > div:not(.table__body) {\n display: table-row-group;\n }\n\n .table .table__head {\n display: table-header-group;\n }\n\n .table .table__head .table__cell {\n font-weight: 700;\n color: #888;\n background: #fff !important;\n border-left: 0 !important;\n border-right: 0 !important;\n border-top: 0 !important;\n }\n\n .table .table__row {\n display: table-row;\n flex-direction: row;\n flex-wrap: no-wrap;\n }\n\n .table .table__row:nth-child(even) {\n background: #f8f9fc;\n }\n\n .table .table__row .table__cell {\n border-top: solid 1px #eee;\n }\n\n .table .table__cell {\n display: table-cell;\n padding: 8px 10px;\n }\n\n .table .table__cell.table__cell_collapse {\n width: 1px;\n }\n )\n}.Else{\n SetTitle($@1page_history$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "history_compare", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(back_page, @1history)\n\nIf(#type# == page){\n DBFind(@1pages).Where({\"id\": #element_id#, \"ecosystem\": #ecosystem_id#}).Limit(1).Vars(\"res\")\n SetTitle($@1page_history$: #res_name# [$@1id$: #history_id#])\n SetVar(contract_name, \"@1EditPage\")\n GetHistory(Source: src_history, Name: pages, Id: #element_id#, RollbackId: #history_id#)\n}.ElseIf(#type# == block){\n DBFind(@1blocks).Where({\"id\": #element_id#, \"ecosystem\": #ecosystem_id#}).Limit(1).Vars(\"res\")\n SetTitle($@1block_history$: #res_name# [$@1id$: #history_id#])\n SetVar(contract_name, \"@1EditBlock\")\n GetHistory(Source: src_history, Name: blocks, Id: #element_id#, RollbackId: #history_id#)\n}.ElseIf(#type# == contract){\n DBFind(@1contracts).Where({\"id\": #element_id#, \"ecosystem\": #ecosystem_id#}).Limit(1).Vars(\"res\")\n SetTitle($@1contract_history$: #res_name# [$@1id$: #history_id#])\n SetVar(contract_name, \"@1EditContract\")\n GetHistory(Source: src_history, Name: contracts, Id: #element_id#, RollbackId: #history_id#)\n}.ElseIf(#type# == menu){\n DBFind(@1menu).Where({\"id\": #element_id#, \"ecosystem\": #ecosystem_id#}).Limit(1).Vars(\"res\")\n SetTitle($@1menu_history$: #res_name# [$@1id$: #history_id#])\n SetVar(contract_name, \"@1EditMenu\")\n GetHistory(Source: src_history, Name: menu, Id: #element_id#, RollbackId: #history_id#)\n}\n\nDiv(fullscreen){\n Div(list-group-item ml-lg mr-lg){\n Div(table){\n Div(table__head){\n Div(table__row){\n Div(table__cell){$@1current_value$}\n Div(table__cell){$@1history_value$}\n }\n }\n ForList(src_history){\n Div(table__row){\n Div(table__cell){\n VarAsIs(value_as_is, #res_value#)\n Code(#value_as_is#)\n }\n Div(table__cell table__cell_collapse){\n VarAsIs(value_as_is, #value#)\n Code(#value_as_is#)\n }\n }\n }\n }\n Div(text-center){\n Button(Page: #back_page#, PageParams: \"type=#type#,id=#element_id#\", Class: btn bg-gray-lighter, Body: $@1back$)\n Button(Contract: #contract_name#, Params: \"Id=#element_id#,Value=#value_as_is#\", Page: #back_page#, PageParams: \"type=#type#,id=#element_id#\", Class: btn btn-primary, Body: $@1restore$).Alert(Text: \"$@1want_restore_history_value$\", ConfirmButton: \"$@1yes$\", CancelButton: \"$@1no$\", Icon: icon-question)\n }\n }\n}.Style(\n .table {\n display: table;\n margin-bottom: 10px;\n }\n\n .table > div:not(.table__body) {\n display: table-row-group;\n }\n\n .table .table__head {\n display: table-header-group;\n }\n\n .table .table__head .table__cell {\n font-weight: 700;\n color: #888;\n background: #fff !important;\n border-left: 0 !important;\n border-right: 0 !important;\n border-top: 0 !important;\n }\n\n .table .table__row {\n display: table-row;\n flex-direction: row;\n flex-wrap: no-wrap;\n }\n\n .table .table__row:nth-child(odd) {\n background: #f8f9fc;\n }\n\n .table .table__row .table__cell {\n border-top: solid 1px #eee;\n width: 50%;\n }\n\n .table .table__cell {\n display: table-cell;\n padding: 8px 10px;\n }\n\n .table .table__cell.table__cell_collapse {\n width: 1px;\n }\n)", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n SetVar(back_page, @1history)\n\n If(#type# == page){\n DBFind(\"@1pages\").Where({\"id\": \"#element_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Limit(1).Vars(res)\n SetTitle($@1page_history$: #res_name# [$@1id$: #history_id#])\n SetVar(contract_name, \"@1EditPage\")\n GetHistory(Source: src_history, Name: pages, Id: #element_id#, RollbackId: #history_id#)\n }.ElseIf(#type# == block){\n DBFind(\"@1blocks\").Where({\"id\": \"#element_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Limit(1).Vars(res)\n SetTitle($@1block_history$: #res_name# [$@1id$: #history_id#])\n SetVar(contract_name, \"@1EditBlock\")\n GetHistory(Source: src_history, Name: blocks, Id: #element_id#, RollbackId: #history_id#)\n }.ElseIf(#type# == contract){\n DBFind(\"@1contracts\").Where({\"id\": \"#element_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Limit(1).Vars(res)\n SetTitle($@1contract_history$: #res_name# [$@1id$: #history_id#])\n SetVar(contract_name, \"@1EditContract\")\n GetHistory(Source: src_history, Name: contracts, Id: #element_id#, RollbackId: #history_id#)\n }.ElseIf(#type# == menu){\n DBFind(\"@1menu\").Where({\"id\": \"#element_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Limit(1).Vars(res)\n SetTitle($@1menu_history$: #res_name# [$@1id$: #history_id#])\n SetVar(contract_name, \"@1EditMenu\")\n GetHistory(Source: src_history, Name: menu, Id: #element_id#, RollbackId: #history_id#)\n }\n\n Div(fullscreen){\n Div(list-group-item ml-lg mr-lg){\n Div(table){\n Div(table__head){\n Div(table__row){\n Div(table__cell){$@1current_value$}\n Div(table__cell){$@1history_value$}\n }\n }\n ForList(src_history){\n Div(table__row){\n Div(table__cell){\n VarAsIs(value_as_is, #res_value#)\n Code(#value_as_is#)\n }\n Div(table__cell table__cell_collapse){\n VarAsIs(value_as_is, #value#)\n Code(#value_as_is#)\n }\n }\n }\n }\n Div(text-center){\n Button(Page: #back_page#, PageParams: \"type=#type#,id=#element_id#\", Class: btn bg-gray-lighter, Body: $@1back$)\n Button(Contract: #contract_name#, Params: \"Id=#element_id#,Value=#value_as_is#\", Page: #back_page#, PageParams: \"type=#type#,id=#element_id#\", Class: btn btn-primary, Body: $@1restore$).Alert(Text: \"$@1want_restore_history_value$\", ConfirmButton: \"$@1yes$\", CancelButton: \"$@1no$\", Icon: icon-question)\n }\n }\n }.Style(\n .table {\n display: table;\n margin-bottom: 10px;\n }\n\n .table > div:not(.table__body) {\n display: table-row-group;\n }\n\n .table .table__head {\n display: table-header-group;\n }\n\n .table .table__head .table__cell {\n font-weight: 700;\n color: #888;\n background: #fff !important;\n border-left: 0 !important;\n border-right: 0 !important;\n border-top: 0 !important;\n }\n\n .table .table__row {\n display: table-row;\n flex-direction: row;\n flex-wrap: no-wrap;\n }\n\n .table .table__row:nth-child(odd) {\n background: #f8f9fc;\n }\n\n .table .table__row .table__cell {\n border-top: solid 1px #eee;\n width: 50%;\n }\n\n .table .table__cell {\n display: table-cell;\n padding: 8px 10px;\n }\n\n .table .table__cell.table__cell_collapse {\n width: 1px;\n }\n )\n}.Else{\n SetTitle($@1page_history$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "import_app", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Div(content-wrapper){\n DBFind(@1buffer_data).Columns(\"id,value->name,value->data\").Where({\"key\": import, \"member_id\": #key_id#, \"ecosystem\": #ecosystem_id#}).Vars(import)\n DBFind(@1buffer_data).Columns(\"value->app_name,value->pages,value->pages_count,value->blocks,value->blocks_count,value->menu,value->menu_count,value->parameters,value->parameters_count,value->languages,value->languages_count,value->contracts,value->contracts_count,value->tables,value->tables_count\").Where({\"key\": import_info, \"member_id\": #key_id#, \"ecosystem\": #ecosystem_id#}).Vars(info)\n\n SetTitle(\"$@1import$ - #info_value_app_name#\")\n Data(data_info, \"DataName,DataCount,DataInfo\"){\n Pages,\"#info_value_pages_count#\",\"#info_value_pages#\"\n Blocks,\"#info_value_blocks_count#\",\"#info_value_blocks#\"\n Menu,\"#info_value_menu_count#\",\"#info_value_menu#\"\n Parameters,\"#info_value_parameters_count#\",\"#info_value_parameters#\"\n Language resources,\"#info_value_languages_count#\",\"#info_value_languages#\"\n Contracts,\"#info_value_contracts_count#\",\"#info_value_contracts#\"\n Tables,\"#info_value_tables_count#\",\"#info_value_tables#\"\n }\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1import_data$)\n }\n\n Div(panel panel-primary){\n ForList(data_info){\n Div(list-group-item){\n Div(row){\n Div(col-md-10 mc-sm text-left){\n Span(Class: text-bold, Body: \"#DataName#\")\n }\n Div(col-md-2 mc-sm text-right){\n If(#DataCount# > 0){\n Span(Class: text-bold, Body: \"(#DataCount#)\")\n }.Else{\n Span(Class: text-muted, Body: \"(0)\")\n }\n }\n }\n Div(row){\n Div(col-md-12 mc-sm text-left){\n If(#DataCount# > 0){\n Span(Class: h6, Body: \"#DataInfo#\")\n }.Else{\n Span(Class: text-muted h6, Body: $@1nothing_selected$)\n }\n }\n }\n }\n }\n If(#import_id# > 0){\n Div(list-group-item text-right){\n VarAsIs(imp_data, \"#import_value_data#\")\n Button(Body: $@1import$, Class: btn btn-primary, Page: @1apps_list).CompositeContract(@1Import, \"#imp_data#\")\n }\n }\n }\n}", + "Value": "Div(content-wrapper){\n DBFind(\"@1buffer_data\").Columns(\"id,value->name,value->data\").Where({\"key\": \"import\", \"account\": \"#account_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(import)\n DBFind(\"@1buffer_data\").Columns(\"value->app_name,value->pages,value->pages_count,value->blocks,value->blocks_count,value->menu,value->menu_count,value->parameters,value->parameters_count,value->languages,value->languages_count,value->contracts,value->contracts_count,value->tables,value->tables_count\").Where({\"key\": \"import_info\", \"account\": \"#account_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(info)\n\n SetTitle(\"$@1import$ - #info_value_app_name#\")\n Data(data_info, \"DataName,DataCount,DataInfo\"){\n Pages,\"#info_value_pages_count#\",\"#info_value_pages#\"\n Blocks,\"#info_value_blocks_count#\",\"#info_value_blocks#\"\n Menu,\"#info_value_menu_count#\",\"#info_value_menu#\"\n Parameters,\"#info_value_parameters_count#\",\"#info_value_parameters#\"\n Language resources,\"#info_value_languages_count#\",\"#info_value_languages#\"\n Contracts,\"#info_value_contracts_count#\",\"#info_value_contracts#\"\n Tables,\"#info_value_tables_count#\",\"#info_value_tables#\"\n }\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1import_data$)\n }\n\n Div(panel panel-primary){\n ForList(data_info){\n Div(list-group-item){\n Div(row){\n Div(col-md-10 mc-sm text-left){\n Span(Class: text-bold, Body: \"#DataName#\")\n }\n Div(col-md-2 mc-sm text-right){\n If(#DataCount# > 0){\n Span(Class: text-bold, Body: \"(#DataCount#)\")\n }.Else{\n Span(Class: text-muted, Body: \"(0)\")\n }\n }\n }\n Div(row){\n Div(col-md-12 mc-sm text-left){\n If(#DataCount# > 0){\n Span(Class: h6, Body: \"#DataInfo#\")\n }.Else{\n Span(Class: text-muted h6, Body: $@1nothing_selected$)\n }\n }\n }\n }\n }\n If(#import_id# > 0){\n Div(list-group-item text-right){\n VarAsIs(imp_data, \"#import_value_data#\")\n Button(Body: $@1import$, Class: btn btn-primary, Page: @1apps_list).CompositeContract(@1Import, \"#imp_data#\")\n }\n }\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "import_upload", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Div(content-wrapper){\n DBFind(@1roles).Where({\"ecosystem\": #ecosystem_id#}).Count(roles_count)\n If(Or(#ecosystem_id#==1,#roles_count#>0)){\n SetTitle($@1import$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1payload_select$)\n }\n Form(panel panel-primary){\n Div(list-group-item){\n Input(Name: Data, Type: file)\n }\n Div(list-group-item text-right){\n Button(Body: $@1load$, Class: btn btn-primary, Contract: @1ImportUpload, Page: @1import_app)\n }\n }\n }.Else{\n Div(panel panel-primary){\n Div(list-group-item text-center){\n P(Class: h3 m0 text-bold, Body: $@1installing_platform_apps$)\n }\n Div(list-group-item){\n Span(Class: h4, Body: $@1installing_text$)\n }\n Div(panel-footer text-right clearfix){\n Button(Body: $@1platform_apps_install$, Class: btn btn-primary, Page: @1apps_list).CompositeContract(@1PlatformAppsInstall, \"[{}]\").CompositeContract(@1RolesInstall, \"[{}]\")\n }\n }\n }\n}", + "Value": "Div(content-wrapper){\n DBFind(\"@1roles\").Where({\"ecosystem\": \"#ecosystem_id#\"}).Count(roles_count)\n If(Or(#ecosystem_id#==1,#roles_count#>0)){\n SetTitle($@1import$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1payload_select$)\n }\n Form(panel panel-primary){\n Div(list-group-item){\n Input(Name: Data, Type: file)\n }\n Div(list-group-item text-right){\n Button(Body: $@1load$, Class: btn btn-primary, Contract: @1ImportUpload, Page: @1import_app)\n }\n }\n }.Else{\n Div(panel panel-primary){\n Div(list-group-item text-center){\n P(Class: h3 m0 text-bold, Body: $@1installing_platform_apps$)\n }\n Div(list-group-item){\n Span(Class: h4, Body: $@1installing_text$)\n }\n Div(panel-footer text-right clearfix){\n Button(Body: $@1platform_apps_install$, Class: btn btn-primary, Page: @1apps_list).CompositeContract(@1PlatformAppsInstall, \"[{}]\").CompositeContract(@1RolesInstall, \"[{}]\")\n }\n }\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "langres_add", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "If(#name#){}.Else{\n SetVar(name,)\n}\nDiv(content-wrapper){\n SetTitle($@1lang_res$)\n Div(Class: breadcrumb){\n LinkPage($@1lang_res$, @1app_langres)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n Span(Class: text-muted, Body: $@1new_langres$)\n }\n\n Form(panel panel-default){\n Div(panel-body){\n Div(row){\n Div(col-md-12){\n Label($@1name$)\n Input(Name:Name, Value:#name#)\n }\n }\n Div(row text-muted){\n Div(col-md-1 mt-lg){\n Label(){$@1localization$}\n }\n Div(col-md-10 mt-lg){\n Label(){$@1value$}\n }\n Div(col-md-1 mt-lg){\n Label(){$@1action$}\n }\n }\n If(#cs#==\"\"){\n SetVar(cs,0)\n }\n If(#del# == 1){\n SetVar(cs,Calculate(#cs# - 1))\n }.Else{\n SetVar(cs,Calculate(#cs# + 1))\n }\n Range(params_range, 0, #cs#)\n ForList(Source: params_range){\n Div(row mt-sm){\n Div(col-md-1){\n Input(Name:LocaleArr)\n }.Style(input {padding: 6px;text-align:center;})\n Div(col-md-10){\n Input(Name:ValueArr)\n }\n Div(col-md-1){\n If(And(#cs#==#params_range_index#,#cs#>1)){\n Button(Class:fa fa-trash btn btn-default, PageParams: \"cs=#cs#,del=1\", Page: @1langres_add)\n }\n }\n }\n }\n Div(row){\n Div(col-md-12 mt-lg){\n LinkPage(Body:$@1locale_add$, Page: @1langres_add, PageParams:\"cs=#cs#\")\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1save$, Class: btn btn-primary, Contract: @1NewLangJoint, Page: @1app_langres)\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n If(#name#){}.Else{\n SetVar(name,)\n }\n Div(content-wrapper){\n SetTitle($@1lang_res$)\n Div(Class: breadcrumb){\n LinkPage($@1lang_res$, @1app_langres)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n Span(Class: text-muted, Body: $@1new_langres$)\n }\n\n Form(panel panel-default){\n Div(panel-body){\n Div(row){\n Div(col-md-12){\n Label($@1name$)\n Input(Name:Name, Value:#name#)\n }\n }\n Div(row text-muted){\n Div(col-md-1 mt-lg){\n Label(){$@1localization$}\n }\n Div(col-md-10 mt-lg){\n Label(){$@1value$}\n }\n Div(col-md-1 mt-lg){\n Label(){$@1action$}\n }\n }\n If(#cs#==\"\"){\n SetVar(cs,0)\n }\n If(#del# == 1){\n SetVar(cs,Calculate(#cs# - 1))\n }.Else{\n SetVar(cs,Calculate(#cs# + 1))\n }\n Range(params_range, 0, #cs#)\n ForList(Source: params_range){\n Div(row mt-sm){\n Div(col-md-1){\n Input(Name:LocaleArr)\n }.Style(input {padding: 6px;text-align:center;})\n Div(col-md-10){\n Input(Name:ValueArr)\n }\n Div(col-md-1){\n If(And(#cs#==#params_range_index#,#cs#>1)){\n Button(Class:fa fa-trash btn btn-default, PageParams: \"cs=#cs#,del=1\", Page: @1langres_add)\n }\n }\n }\n }\n Div(row){\n Div(col-md-12 mt-lg){\n LinkPage(Body:$@1locale_add$, Page: @1langres_add, PageParams:\"cs=#cs#\")\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1save$, Class: btn btn-primary, Contract: @1NewLangJoint, Page: @1app_langres)\n }\n }\n }\n}.Else{\n SetTitle($@1lang_res$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "langres_edit", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page,\"@1langres_edit\")\nIf(#back_page#==\"\"){\n SetVar(back_page,\"@1app_langres\")\n}\nDiv(content-wrapper){\n SetTitle($@1lang_res$)\n Div(Class: breadcrumb){\n LinkPage($@1lang_res$, @1app_langres)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n Span(Class: text-muted, Body: $@1editing$)\n }\n\n Form(panel panel-default){\n Div(panel-body){\n DBFind(@1languages, src_leng).Vars(pre).Where({\"id\": #lang_id#, \"ecosystem\": #ecosystem_id#})\n Div(row){\n Div(col-md-12){\n Label($@1name$)\n Input(Name: LangName, Disabled: \"true\", Value: #pre_name#)\n }\n }\n Div(row){\n Div(col-md-1 mt-lg){\n Label(Class: text-muted, Body: $@1localization$)\n }\n Div(col-md-9 mt-lg){\n Label(Class: text-muted, Body: $@1value$)\n }\n Div(col-md-2 mt-lg){\n Label(Class: text-muted, Body: $@1action$)\n }\n }\n\n JsonToSource(pv, #pre_res#)\n ForList(Source: pv, Index:s_ind){\n SetVar(max_sec, #s_ind#)\n }\n If(#cs#==\"\"){\n SetVar(cs, #max_sec#)\n }\n If(Or(#del_flag#==1,#del_data#>0)){\n SetVar(cs, Calculate(Exp:#cs#-1, Type: int))\n }\n\n SetVar(next_sec, Calculate(Exp:#cs#+1, Type: int))\n SetVar(data_sec, Calculate(Exp:#cs#-#max_sec#, Type: int))\n\n ForList(Source: pv, Index:s_ind){\n If(#s_ind#>#cs#){\n }.Else{\n Div(row){\n Div(col-md-1 mt-sm){\n Input(Name: LocaleArr, Value: `#key#`)\n }.Style(input {padding: 6px;text-align:center;})\n Div(col-md-9 mt-sm){\n Input(Name: ValueArr, Value: `#value#`)\n }\n Div(col-md-2 mt-sm){\n If(And(#s_ind#>1,#s_ind#==#cs#)){\n Button(Body: Em(Class: fa fa-trash), Class: btn btn-default, PageParams: \"lang_id=#lang_id#,cs=#cs#,del_data=#s_ind#\", Page: #this_page#)\n }\n }\n }\n }\n }\n Range(params_range, #max_sec#, #cs#)\n ForList(Source: params_range, Index:s_ind){\n Div(row){\n Div(col-md-1 mt-sm){\n Input(Name:LocaleArr)\n }.Style(input {padding: 6px;text-align:center;})\n Div(col-md-9 mt-sm){\n Input(Name:ValueArr)\n }\n Div(col-md-2 mt-sm){\n If(#s_ind#==#data_sec#){\n Button(Body: Em(Class: fa fa-trash), Class: btn btn-default, PageParams: \"lang_id=#lang_id#,cs=#cs#,del_flag=1\", Page: #this_page#)\n }\n }\n }\n }\n Div(row){\n Div(col-md-12 mt-lg){\n LinkPage(Body: $@1locale_add$, Page: @1langres_edit, PageParams: \"lang_id=#lang_id#,cs=#next_sec#\")\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1save$, Class: btn btn-primary, Contract: @1EditLangJoint, Params: \"Id=#lang_id#\", Page: #back_page#)\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n SetVar(this_page,\"@1langres_edit\")\n If(#back_page#==\"\"){\n SetVar(back_page,\"@1app_langres\")\n }\n Div(content-wrapper){\n SetTitle($@1lang_res$)\n Div(Class: breadcrumb){\n LinkPage($@1lang_res$, @1app_langres)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n Span(Class: text-muted, Body: $@1editing$)\n }\n\n Form(panel panel-default){\n Div(panel-body){\n DBFind(\"@1languages\", src_leng).Vars(pre).Where({\"id\": \"#lang_id#\", \"ecosystem\": \"#ecosystem_id#\"})\n Div(row){\n Div(col-md-12){\n Label($@1name$)\n Input(Name: LangName, Disabled: \"true\", Value: #pre_name#)\n }\n }\n Div(row){\n Div(col-md-1 mt-lg){\n Label(Class: text-muted, Body: $@1localization$)\n }\n Div(col-md-9 mt-lg){\n Label(Class: text-muted, Body: $@1value$)\n }\n Div(col-md-2 mt-lg){\n Label(Class: text-muted, Body: $@1action$)\n }\n }\n\n JsonToSource(pv, #pre_res#)\n ForList(Source: pv, Index:s_ind){\n SetVar(max_sec, #s_ind#)\n }\n If(#cs#==\"\"){\n SetVar(cs, #max_sec#)\n }\n If(Or(#del_flag#==1,#del_data#>0)){\n SetVar(cs, Calculate(Exp:#cs#-1, Type: int))\n }\n\n SetVar(next_sec, Calculate(Exp:#cs#+1, Type: int))\n SetVar(data_sec, Calculate(Exp:#cs#-#max_sec#, Type: int))\n\n ForList(Source: pv, Index:s_ind){\n If(#s_ind#>#cs#){\n }.Else{\n Div(row){\n Div(col-md-1 mt-sm){\n Input(Name: LocaleArr, Value: `#key#`)\n }.Style(input {padding: 6px;text-align:center;})\n Div(col-md-9 mt-sm){\n Input(Name: ValueArr, Value: `#value#`)\n }\n Div(col-md-2 mt-sm){\n If(And(#s_ind#>1,#s_ind#==#cs#)){\n Button(Body: Em(Class: fa fa-trash), Class: btn btn-default, PageParams: \"lang_id=#lang_id#,cs=#cs#,del_data=#s_ind#\", Page: #this_page#)\n }\n }\n }\n }\n }\n Range(params_range, #max_sec#, #cs#)\n ForList(Source: params_range, Index:s_ind){\n Div(row){\n Div(col-md-1 mt-sm){\n Input(Name:LocaleArr)\n }.Style(input {padding: 6px;text-align:center;})\n Div(col-md-9 mt-sm){\n Input(Name:ValueArr)\n }\n Div(col-md-2 mt-sm){\n If(#s_ind#==#data_sec#){\n Button(Body: Em(Class: fa fa-trash), Class: btn btn-default, PageParams: \"lang_id=#lang_id#,cs=#cs#,del_flag=1\", Page: #this_page#)\n }\n }\n }\n }\n Div(row){\n Div(col-md-12 mt-lg){\n LinkPage(Body: $@1locale_add$, Page: @1langres_edit, PageParams: \"lang_id=#lang_id#,cs=#next_sec#\")\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1save$, Class: btn btn-primary, Contract: @1EditLangJoint, Params: \"Id=#lang_id#\", Page: #back_page#)\n }\n }\n }\n}.Else{\n SetTitle($@1lang_res$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "menus_list", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1menus_list).(this_table, @1menu)\nInclude(@1pager_header)\n\nSetTitle(\"$@1menu$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1menu_section$\"))\nAddToolButton(Title: $@1create$, Page: editor, Icon: icon-plus, PageParams: \"create=menu,appId=0\")\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": #ecosystem_id#, {\"$or\":[{name: {\"$ilike\": \"#search#\"}}]}})\n}.Else{\n SetVar(where, {\"ecosystem\": #ecosystem_id#})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1name))\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(action){\n Span(Class: pull-right){\n LinkPage(Body: Em(Class: fa fa-history), Class: text-primary h4 mh-sm, Page: @1history, PageParams: \"id=#id#,type=menu\")\n LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4, Page: @1properties_edit, PageParams: \"edit_property_id=#id#,type=menu\")\n }\n}.Custom(_name){\n LinkPage(Page: editor, Class: text-primary h5, Body: \"#name#\", PageParams: \"open=menu,name=#name#\")\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1name$=_name,$@1header$=title,$@1conditions$=conditions,=action\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1menu$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n SetVar(this_page, @1menus_list).(this_table, @1menu)\n Include(@1pager_header)\n\n SetTitle(\"$@1menu$\")\n Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1menu_section$\"))\n AddToolButton(Title: $@1create$, Page: editor, Icon: icon-plus, PageParams: \"create=menu,appId=0\")\n\n If(#search#){\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"name\": {\"$ilike\": \"#search#\"}})\n }.Else{\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\"})\n }\n\n Div(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1name))\n Include(@1search)\n }\n\n DBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(action){\n Span(Class: pull-right){\n LinkPage(Body: Em(Class: fa fa-history), Class: text-primary h4 mh-sm, Page: @1history, PageParams: \"id=#id#,type=menu\")\n LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4, Page: @1properties_edit, PageParams: \"edit_property_id=#id#,type=menu\")\n }\n }.Custom(_name){\n LinkPage(Page: editor, Class: text-primary h5, Body: \"#name#\", PageParams: \"open=menu,name=#name#\")\n }.Count(count)\n\n Div(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1name$=_name,$@1header$=title,$@1conditions$=conditions,=action\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1menu$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n }\n Div(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n }\n}.Else{\n SetTitle($@1menu$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "params_edit", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "If(#back_page#==\"\"){\n SetVar(back_page, @1params_list)\n}\nDiv(content-wrapper){\n If(#stylesheet# == stylesheet){\n DBFind(@1parameters, src_params).Where({\"name\": #stylesheet#, \"ecosystem\": #ecosystem_id#}).Vars(\"param\")\n }.Else{\n If(#id#>0){\n DBFind(@1parameters, src_params).Where({\"id\": #id#, \"ecosystem\": #ecosystem_id#}).Vars(\"param\")\n }.Else{\n SetVar(param_name, $@1new_parameter$)\n }\n }\n\n SetTitle($@1ecosystem_parameters$)\n Div(Class: breadcrumb){\n LinkPage($@1ecosystem_parameters$, @1params_list)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n Span(Class: text-muted, Body: #param_name#)\n }\n Form(){\n Div(form-group){\n Label($@1name$)\n If(#param_id#>0){\n Input(Name: name, Value: #param_name#, Disabled: \"true\")\n }.Else{\n Input(Name: name)\n }\n }\n Div(form-group){\n If(#param_id#>0){\n Input(Type: textarea, Name: value, Value: \"#param_value#\").Style(height: 500px !important;)\n }.Else{\n Input(Type: textarea, Name: value).Style(height: 500px !important;)\n }\n }\n Div(form-group){\n Label($@1change_conditions$)\n If(#param_id#>0){\n Input(Name: conditions, Value: #param_conditions#)\n }.Else{\n Input(Name: conditions)\n }\n }\n Div(form-group text-right){\n If(#param_id#>0){\n DBFind(@1applications).Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\n SetVar(tid, AppParam(App: #application_id#, Name: voting_template_ecosysparams, Ecosystem: 1))\n If(#tid# > 0){\n DBFind(@1voting_templates).Where({\"ecosystem\": #ecosystem_id#, \"id\": #tid#}).Columns(\"subject->voters\").Vars(template)\n }\n If(And(#template_subject_voters#>0,#template_subject_voters#==#role_id#)){\n Button(Class: btn btn-primary, Body: $@1voting$, Contract: @1VotingRunEditEcosysParam, Params: \"Id=#param_id#,Value=Val(value)\", Page: @1voting_list)\n }.Else{\n Button(Class: btn btn-primary, Body: $@1save$, Contract: @1EditParameter, Params: \"Id=#param_id#,Value=Val(value),Conditions=Val(conditions)\", Page: #back_page#)\n }\n }.Else{\n Button(Class: btn btn-primary, Body: $@1save$, Contract: @1NewParameter, Params: \"Name=Val(name),Value=Val(value),Conditions=Val(conditions)\", Page: #back_page#)\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n If(#back_page#==\"\"){\n SetVar(back_page, @1params_list)\n }\n Div(content-wrapper){\n If(#stylesheet# == stylesheet){\n DBFind(\"@1parameters\", src_params).Where({\"name\": \"#stylesheet#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(param)\n }.Else{\n If(#id#>0){\n DBFind(\"@1parameters\", src_params).Where({\"id\": \"#id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(param)\n }.Else{\n SetVar(param_name, $@1new_parameter$)\n }\n }\n\n SetTitle($@1ecosystem_parameters$)\n Div(Class: breadcrumb){\n LinkPage($@1ecosystem_parameters$, @1params_list)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n Span(Class: text-muted, Body: #param_name#)\n }\n Form(){\n Div(form-group){\n Label($@1name$)\n If(#param_id#>0){\n Input(Name: name, Value: #param_name#, Disabled: \"true\")\n }.Else{\n Input(Name: name)\n }\n }\n Div(form-group){\n If(#param_id#>0){\n Input(Type: textarea, Name: value, Value: \"#param_value#\").Style(height: 500px !important;)\n }.Else{\n Input(Type: textarea, Name: value).Style(height: 500px !important;)\n }\n }\n Div(form-group){\n Label($@1change_conditions$)\n If(#param_id#>0){\n Input(Name: conditions, Value: #param_conditions#)\n }.Else{\n Input(Name: conditions)\n }\n }\n Div(form-group text-right){\n If(#param_id#>0){\n DBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\"}).Columns(\"name,id\").Vars(application)\n SetVar(tid, AppParam(App: #application_id#, Name: voting_template_ecosysparams, Ecosystem: 1))\n If(#tid# > 0){\n DBFind(\"@1voting_templates\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#tid#\"}).Columns(\"subject->voters\").Vars(template)\n }\n If(And(#template_subject_voters#>0,#template_subject_voters#==#role_id#)){\n Button(Class: btn btn-primary, Body: $@1voting$, Contract: @1VotingRunEditEcosysParam, Params: \"Id=#param_id#,Value=Val(value)\", Page: @1voting_list)\n }.Else{\n Button(Class: btn btn-primary, Body: $@1save$, Contract: @1EditParameter, Params: \"Id=#param_id#,Value=Val(value),Conditions=Val(conditions)\", Page: #back_page#)\n }\n }.Else{\n Button(Class: btn btn-primary, Body: $@1save$, Contract: @1NewParameter, Params: \"Name=Val(name),Value=Val(value),Conditions=Val(conditions)\", Page: #back_page#)\n }\n }\n }\n }\n}.Else{\n SetTitle($@1ecosystem_parameters$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "params_list", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1params_list).(this_table, @1parameters)\nInclude(@1pager_header)\n\nSetTitle(\"$@1ecosystem_parameters$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1sysparams_section$\"))\nAddToolButton(Title: $@1style_manage$, Page: @1params_edit, Icon: icon-picture, PageParams:\"stylesheet=stylesheet\")\nAddToolButton(Title: $@1create$, Page: @1params_edit, Icon: icon-plus)\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": #ecosystem_id#, {\"$or\":[{name: {\"$ilike\": \"#search#\"}}]}})\n}.Else{\n SetVar(where, {\"ecosystem\": #ecosystem_id#})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1name))\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_name){\n LinkPage(Page: @1params_edit, Class: text-primary h5, Body: \"#name#\", PageParams: \"id=#id#\")\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1name$=_name,$@1value$=value,$@1conditions$=conditions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1ecosystem_parameters$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n SetVar(this_page, @1params_list).(this_table, @1parameters)\n Include(@1pager_header)\n\n SetTitle(\"$@1ecosystem_parameters$\")\n Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1sysparams_section$\"))\n AddToolButton(Title: $@1style_manage$, Page: @1params_edit, Icon: icon-picture, PageParams:\"stylesheet=stylesheet\")\n AddToolButton(Title: $@1create$, Page: @1params_edit, Icon: icon-plus)\n\n If(#search#){\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"name\": {\"$ilike\": \"#search#\"}})\n }.Else{\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\"})\n }\n\n Div(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1name))\n Include(@1search)\n }\n\n DBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(_name){\n LinkPage(Page: @1params_edit, Class: text-primary h5, Body: \"#name#\", PageParams: \"id=#id#\")\n }.Count(count)\n\n Div(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1name$=_name,$@1value$=value,$@1conditions$=conditions\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1ecosystem_parameters$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n }\n Div(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n }\n}.Else{\n SetTitle($@1ecosystem_parameters$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "properties_edit", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Div(Class: content-wrapper){\n SetTitle($@1edit_properties$)\n Div(breadcrumb){\n Div(){\n If(#type# == page){\n LinkPage($@1pages$, @1app_pages)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n Span($@1edit_page$, text-muted)\n DBFind(Name: @1pages, Source: src_page).Where({\"id\": #edit_property_id#, \"ecosystem\": #ecosystem_id#}).Vars(item)\n DBFind(@1menu, src_menus).Where({\"ecosystem\": #ecosystem_id#})\n }\n If(#type# == contract){\n DBFind(Name: @1contracts, Source: src_contract).Columns(\"id,name,value,wallet_id,token_id,conditions,app_id\").Where({\"id\": #edit_property_id#, \"ecosystem\": #ecosystem_id#}).Vars(item)\n LinkPage($@1contracts$, @1app_contracts)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n Span($@1edit_contract$, text-muted)\n }\n If(#type# == block){\n LinkPage($@1blocks$, @1app_blocks)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n Span($@1edit_block$, text-muted)\n DBFind(Name: @1blocks, Source: src_block).Where({\"id\": #edit_property_id#, \"ecosystem\": #ecosystem_id#}).Vars(item)\n }\n If(#type# == menu){\n LinkPage($@1menu$, @1menus_list)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n Span($@1edit_menu$, text-muted)\n DBFind(Name: @1menu, Source: src_menu).Where({\"id\": #edit_property_id#, \"ecosystem\": #ecosystem_id#}).Vars(item)\n }\n }\n }\n Form(){\n Div(form-group){\n Label($@1name$)\n Input(Name: Name, Value: #item_name#, Disabled: \"true\")\n }\n If(#type# == page){\n Div(form-group){\n Label($@1menu$)\n Select(Name: Menu, Source: src_menus, NameColumn: name, ValueColumn: name, Value: #item_menu#)\n }\n Div(form-group){\n Label($@1conditions$)\n Input(Name: Conditions, Value: #item_conditions#)\n }\n Div(form-group){\n Label($@1page_validate_count$)\n Input(Name: ValidateCount, Type: number, Value: #item_validate_count#)\n }\n Div(form-group){\n Label($@1page_validate_mode$)\n Input(Name: ValidateMode, Type: number, Value: #item_validate_mode#)\n }\n Div(form-group text-right){\n Button(Body: $@1save$, Class: btn btn-primary, Page: @1app_pages, Contract: @1EditPage, Params: \"Menu=Val(Menu),Conditions=Val(Conditions),Id=#edit_property_id#\")\n }\n }\n If(#type# == contract){\n Div(){\n Div(form-group){\n Label($@1bind_wallet$)\n Div(row){\n Div(col-md-12){\n If(#item_wallet_id# == 0){\n Input(Name: WalletV, Value: 0, Disabled: \"true\")\n }.Else{\n If(#item_wallet_id#==#key_id#){\n Div(input-group){\n SetVar(address_item_wallet_id, Address(#item_wallet_id#))\n Input(Name: WalletV, Value: #address_item_wallet_id#, Disabled: \"true\")\n Div(input-group-btn){\n Button(Body: $@1unbind$, Class: btn bg-gray-lighter buttons, Contract: @1UnbindWallet, Params: \"Id=#edit_property_id#\", Page: @1properties_edit, PageParams: \"edit_property_id=#edit_property_id#,type=#type#\").Alert(Text: $@1want_unbind_contract$, ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n }.Else{\n SetVar(address_item_wallet_id, Address(#item_wallet_id#))\n Input(Name: WalletV, Value: #address_item_wallet_id#, Disabled: \"true\")\n }\n }\n }\n }\n }\n Div(form-group){\n Div(row){\n Div(col-md-12){\n Span(Body: \"$@1contract_binding_another_user_desc$\", Class: m0 text-muted)\n Div(input-group){\n Input(Name: Wallet, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\")\n Div(input-group-btn){\n Button(Body: $@1bind$, Class: btn bg-gray-lighter buttons, Contract: @1BindWallet, Params: \"Id=#edit_property_id#,WalletId=Val(Wallet)\", Page: @1properties_edit, PageParams: \"edit_property_id=#edit_property_id#,type=#type#\").Alert(Text: $@1want_bind_contract$, ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n }\n }\n }\n Div(form-group){\n Label($@1conditions$)\n Input(Name: Conditions, Value: #item_conditions#)\n }\n Div(form-group text-right){\n Button(Body: $@1save$, Class: btn btn-primary, Page: @1app_contracts, Contract: @1EditContract, Params: \"Conditions=Val(Conditions),WalletId=Val(Wallet),Id=#edit_property_id#\")\n }\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n }\n )\n }\n If(#type# == block){\n Div(form-group){\n Label($@1conditions$)\n Input(Name: Conditions, Value: #item_conditions#)\n }\n Div(form-group text-right){\n Button(Body: $@1save$, Class: btn btn-primary, Page: @1app_blocks, Contract: @1EditBlock, Params: \"Conditions=Val(Conditions),Id=#edit_property_id#\")\n }\n }\n If(#type# == menu){\n Div(form-group){\n Label($@1menu_title$)\n Input(Name: Title, Value: #item_title#)\n }\n Div(form-group){\n Label($@1conditions$)\n Input(Name: Conditions, Value: #item_conditions#)\n }\n Div(form-group text-right){\n Button(Body: $@1save$, Class: btn btn-primary, Page: @1menus_list, Contract: @1EditMenu, Params: \"Conditions=Val(Conditions),Id=#edit_property_id#,NameTitle=Val(Title)\")\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n Div(Class: content-wrapper){\n SetTitle($@1edit_properties$)\n Div(breadcrumb){\n Div(){\n If(#type# == page){\n LinkPage($@1pages$, @1app_pages)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n Span($@1edit_page$, text-muted)\n DBFind(\"@1pages\", src_page).Where({\"id\": \"#edit_property_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(item)\n DBFind(\"@1menu\", src_menus).Where({\"ecosystem\": \"#ecosystem_id#\"})\n }\n If(#type# == contract){\n DBFind(\"@1contracts\", src_contract).Columns(\"id,name,value,wallet_id,token_id,conditions,app_id\").Where({\"id\": \"#edit_property_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(item)\n LinkPage($@1contracts$, @1app_contracts)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n Span($@1edit_contract$, text-muted)\n }\n If(#type# == block){\n LinkPage($@1blocks$, @1app_blocks)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n Span($@1edit_block$, text-muted)\n DBFind(\"@1blocks\", src_block).Where({\"id\": \"#edit_property_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(item)\n }\n If(#type# == menu){\n LinkPage($@1menu$, @1menus_list)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n Span($@1edit_menu$, text-muted)\n DBFind(\"@1menu\", src_menu).Where({\"id\": \"#edit_property_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Vars(item)\n }\n }\n }\n Form(){\n Div(form-group){\n Label($@1name$)\n Input(Name: Name, Value: #item_name#, Disabled: \"true\")\n }\n If(#type# == page){\n Div(form-group){\n Label($@1menu$)\n Select(Name: Menu, Source: src_menus, NameColumn: name, ValueColumn: name, Value: #item_menu#)\n }\n Div(form-group){\n Label($@1conditions$)\n Input(Name: Conditions, Value: #item_conditions#)\n }\n Div(form-group){\n Label($@1page_validate_count$)\n Input(Name: ValidateCount, Type: number, Value: #item_validate_count#)\n }\n Div(form-group){\n Label($@1page_validate_mode$)\n Input(Name: ValidateMode, Type: number, Value: #item_validate_mode#)\n }\n Div(form-group text-right){\n Button(Body: $@1save$, Class: btn btn-primary, Page: @1app_pages, Contract: @1EditPage, Params: \"Menu=Val(Menu),Conditions=Val(Conditions),Id=#edit_property_id#\")\n }\n }\n If(#type# == contract){\n Div(){\n Div(form-group){\n Label($@1bind_wallet$)\n Div(row){\n Div(col-md-12){\n If(#item_wallet_id# == 0){\n Input(Name: WalletV, Value: 0, Disabled: \"true\")\n }.Else{\n SetVar(account_key, AddressToId(#account_id#))\n If(#item_wallet_id#==#account_key#){\n Div(input-group){\n SetVar(address_item_wallet_id, Address(#item_wallet_id#))\n Input(Name: WalletV, Value: #address_item_wallet_id#, Disabled: \"true\")\n Div(input-group-btn){\n Button(Body: $@1unbind$, Class: btn bg-gray-lighter buttons, Contract: @1UnbindWallet, Params: \"Id=#edit_property_id#\", Page: @1properties_edit, PageParams: \"edit_property_id=#edit_property_id#,type=#type#\").Alert(Text: $@1want_unbind_contract$, ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n }.Else{\n SetVar(address_item_wallet_id, Address(#item_wallet_id#))\n Input(Name: WalletV, Value: #address_item_wallet_id#, Disabled: \"true\")\n }\n }\n }\n }\n }\n Div(form-group){\n Div(row){\n Div(col-md-12){\n Span(Body: \"$@1contract_binding_another_user_desc$\", Class: m0 text-muted)\n Div(input-group){\n Input(Name: Wallet, Placeholder: \"xxxx-xxxx-xxxx-xxxx-xxxx\")\n Div(input-group-btn){\n Button(Body: $@1bind$, Class: btn bg-gray-lighter buttons, Contract: @1BindWallet, Params: \"Id=#edit_property_id#,WalletId=Val(Wallet)\", Page: @1properties_edit, PageParams: \"edit_property_id=#edit_property_id#,type=#type#\").Alert(Text: $@1want_bind_contract$, ConfirmButton: $@1yes$, CancelButton: $@1no$, Icon: question)\n }\n }\n }\n }\n }\n Div(form-group){\n Label($@1conditions$)\n Input(Name: Conditions, Value: #item_conditions#)\n }\n Div(form-group text-right){\n Button(Body: $@1save$, Class: btn btn-primary, Page: @1app_contracts, Contract: @1EditContract, Params: \"Conditions=Val(Conditions),WalletId=Val(Wallet),Id=#edit_property_id#\")\n }\n }.Style(\n .buttons {\n border: 1px solid #dde6e9;\n }\n )\n }\n If(#type# == block){\n Div(form-group){\n Label($@1conditions$)\n Input(Name: Conditions, Value: #item_conditions#)\n }\n Div(form-group text-right){\n Button(Body: $@1save$, Class: btn btn-primary, Page: @1app_blocks, Contract: @1EditBlock, Params: \"Conditions=Val(Conditions),Id=#edit_property_id#\")\n }\n }\n If(#type# == menu){\n Div(form-group){\n Label($@1menu_title$)\n Input(Name: Title, Value: #item_title#)\n }\n Div(form-group){\n Label($@1conditions$)\n Input(Name: Conditions, Value: #item_conditions#)\n }\n Div(form-group text-right){\n Button(Body: $@1save$, Class: btn btn-primary, Page: @1menus_list, Contract: @1EditMenu, Params: \"Conditions=Val(Conditions),Id=#edit_property_id#,NameTitle=Val(Title)\")\n }\n }\n }\n }\n}.Else{\n SetTitle($@1edit_properties$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "section_access", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1sections).Where({\"ecosystem\": #ecosystem_id#, \"id\": #id#}).Vars(section)\nDBFind(\"@1applications\").Where({\"ecosystem\": #ecosystem_id#, \"name\": \"System\"}).Vars(\"system_app\")\n\nDiv(content-wrapper){\n SetTitle($@1section_access_rights$)\n Div(Class: breadcrumb){\n LinkPage($@1sections$, @1section_list)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n Span(Class: text-muted, Body: #section_title#)\n }\n Form(){\n Div(form-group){\n Label($@1roles_access$)\n DBFind(@1roles,src_roles).Where({\"ecosystem\": #ecosystem_id#, \"deleted\": 0}).Columns(\"id,role_name\").Order(id)\n Div(input-group mb-sm){\n Select(Name: access_rid, Source:src_roles, NameColumn:role_name, ValueColumn: id)\n Div(input-group-btn){\n Button(Class: btn btn-primary fa fa-plus, Page: section_access, PageParams:\"id=#section_id#\", Contract: @1SectionRoles, Params:\"Id=#section_id#,Rid=Val(access_rid),Operation=add\")\n }\n }\n DBFind(@1sections).Where({\"ecosystem\": #ecosystem_id#, \"id\": #section_id#}).Columns(\"roles_access\").Vars(json)\n If(#json_roles_access#==\"[]\"){\n Span(Body: $@1available_sections$, Class: m0 text-muted)\n }.Else{\n DBFind(@1roles,src_roles_access).Where({\"ecosystem\": #ecosystem_id#, \"id\": {\"$in\": #json_roles_access#}}).Columns(\"id,role_name\")\n ForList(src_roles_access){\n SetVar(role_admin, AppParam(App: #system_app_id#, Name: \"role_admin\"))\n If(#role_id# == #role_admin#){\n Button(Class: btn btn-info mr-sm mb-sm, Page: @1section_access, PageParams:\"id=#section_id#\", Contract: @1SectionRoles, Params:\"Id=#section_id#,Rid=#id#,Operation=remove\", Body: Span(Class: fa fa-remove) #role_name#)\n }.Else{\n Button(Class: btn btn-default mr-sm mb-sm, Page: @1section_access, PageParams:\"id=#section_id#\", Contract: @1SectionRoles, Params:\"Id=#section_id#,Rid=#id#,Operation=remove\", Body: Span(Class: fa fa-remove) #role_name#)\n }\n }\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n DBFind(\"@1sections\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#id#\"}).Vars(section)\n DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(system_app)\n\n Div(content-wrapper){\n SetTitle($@1section_access_rights$)\n Div(Class: breadcrumb){\n LinkPage($@1sections$, @1section_list)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n Span(Class: text-muted, Body: #section_title#)\n }\n Form(){\n Div(form-group){\n Label($@1roles_access$)\n DBFind(\"@1roles\", src_roles).Where({\"ecosystem\": \"#ecosystem_id#\", \"deleted\": 0}).Columns(\"id,role_name\").Order(\"id\")\n Div(input-group mb-sm){\n Select(Name: access_rid, Source:src_roles, NameColumn:role_name, ValueColumn: id)\n Div(input-group-btn){\n Button(Class: btn btn-primary fa fa-plus, Page: section_access, PageParams:\"id=#section_id#\", Contract: @1SectionRoles, Params:\"Id=#section_id#,Rid=Val(access_rid),Operation=add\")\n }\n }\n DBFind(\"@1sections\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#section_id#\"}).Columns(\"roles_access\").Vars(json)\n If(#json_roles_access#==\"[]\"){\n Span(Body: $@1available_sections$, Class: m0 text-muted)\n }.Else{\n DBFind(\"@1roles\", src_roles_access).Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": {\"$in\": #json_roles_access#}}).Columns(\"id,role_name\")\n ForList(src_roles_access){\n SetVar(role_admin, AppParam(App: #system_app_id#, Name: \"role_admin\"))\n If(#role_id# == #role_admin#){\n Button(Class: btn btn-info mr-sm mb-sm, Page: @1section_access, PageParams:\"id=#section_id#\", Contract: @1SectionRoles, Params:\"Id=#section_id#,Rid=#id#,Operation=remove\", Body: Span(Class: fa fa-remove) #role_name#)\n }.Else{\n Button(Class: btn btn-default mr-sm mb-sm, Page: @1section_access, PageParams:\"id=#section_id#\", Contract: @1SectionRoles, Params:\"Id=#section_id#,Rid=#id#,Operation=remove\", Body: Span(Class: fa fa-remove) #role_name#)\n }\n }\n }\n }\n }\n }\n}.Else{\n SetTitle($@1section_access_rights$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "section_add", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Div(content-wrapper){\n SetTitle($@1section_add$)\n Div(breadcrumb){\n LinkPage($@1sections$, @1section_list)\n Span(/, mh)\n Span(Class: text-muted, Body: $@1new_section$)\n }\n\n Form(){\n Div(form-group){\n Label($@1title$)\n Input(Name: Title)\n }\n Div(form-group){\n Data(src_status, \"name,value\"){\n $@1hidden_section$,0\n $@1regular_section$,1\n $@1main_section$,2\n }\n Label($@1status$)\n Select(Name: Status, Value: #section_status#, Source: src_status, NameColumn: \"name\", ValueColumn: \"value\")\n Span(Body: $@1main_section_warning$, Class: m0 text-muted)\n }\n Div(form-group){\n Label($@1link$)\n Input(Name: Urlname)\n }\n Div(form-group){\n Label($@1section_main_page$)\n Input(Name: Page)\n }\n Div(form-group){\n Button(Class: btn btn-primary, Body: $@1save$, Contract: @1NewSection, Page: @1section_list)\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n Div(content-wrapper){\n SetTitle($@1section_add$)\n Div(breadcrumb){\n LinkPage($@1sections$, @1section_list)\n Span(/, mh)\n Span(Class: text-muted, Body: $@1new_section$)\n }\n\n Form(){\n Div(form-group){\n Label($@1title$)\n Input(Name: Title)\n }\n Div(form-group){\n Data(src_status, \"name,value\"){\n $@1hidden_section$,0\n $@1regular_section$,1\n $@1main_section$,2\n }\n Label($@1status$)\n Select(Name: Status, Value: #section_status#, Source: src_status, NameColumn: \"name\", ValueColumn: \"value\")\n Span(Body: $@1main_section_warning$, Class: m0 text-muted)\n }\n Div(form-group){\n Label($@1link$)\n Input(Name: Urlname)\n }\n Div(form-group){\n Label($@1section_main_page$)\n Input(Name: Page)\n }\n Div(form-group){\n Button(Class: btn btn-primary, Body: $@1save$, Contract: @1NewSection, Page: @1section_list)\n }\n }\n }\n}.Else{\n SetTitle($@1section_add$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "section_edit", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "DBFind(@1sections).Where({\"ecosystem\": #ecosystem_id#, \"id\": #id#}).Vars(section)\nDiv(content-wrapper){\n SetTitle($@1section_edit$)\n Div(breadcrumb){\n LinkPage($@1sections$, @1section_list)\n Span(/, mh)\n Span(Class: text-muted, Body: #section_title#)\n }\n\n Form(){\n Div(form-group){\n Label($@1title$)\n Input(Name: Title, Value: #section_title#)\n }\n Div(form-group){\n Data(src_status, \"name,value\"){\n $@1hidden_section$,0\n $@1regular_section$,1\n $@1main_section$,2\n }\n Label($@1status$)\n If(#section_status#==2){\n Input(Name: placeholder, Value: \"$@1main_section$\", Disabled: \"true\")\n Span(Body: $@1main_section_warning$, Class: m0 text-muted)\n }.Else{\n Select(Name: Status, Value: #section_status#, Source: src_status, NameColumn: \"name\", ValueColumn: \"value\")\n }\n }\n Div(form-group){\n Label($@1link$)\n Input(Name: Urlname, Value: #section_urlname#)\n }\n Div(form-group){\n Label($@1section_main_page$)\n Input(Name: Page, Value: #section_page#)\n }\n Div(form-group){\n If(#section_status#==2){\n Button(Class: btn btn-primary, Body: $@1save$, Contract: @1EditSection, Page: @1section_list, Params: \"Id=#section_id#,Status=#section_status#\")\n }.Else{\n Button(Class: btn btn-primary, Body: $@1save$, Contract: @1EditSection, Page: @1section_list, Params: \"Id=#section_id#\")\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n DBFind(\"@1sections\").Where({\"ecosystem\": \"#ecosystem_id#\", \"id\": \"#id#\"}).Vars(section)\n Div(content-wrapper){\n SetTitle($@1section_edit$)\n Div(breadcrumb){\n LinkPage($@1sections$, @1section_list)\n Span(/, mh)\n Span(Class: text-muted, Body: #section_title#)\n }\n\n Form(){\n Div(form-group){\n Label($@1title$)\n Input(Name: Title, Value: #section_title#)\n }\n Div(form-group){\n Data(src_status, \"name,value\"){\n $@1hidden_section$,0\n $@1regular_section$,1\n $@1main_section$,2\n }\n Label($@1status$)\n If(#section_status#==2){\n Input(Name: placeholder, Value: \"$@1main_section$\", Disabled: \"true\")\n Span(Body: $@1main_section_warning$, Class: m0 text-muted)\n }.Else{\n Select(Name: Status, Value: #section_status#, Source: src_status, NameColumn: \"name\", ValueColumn: \"value\")\n }\n }\n Div(form-group){\n Label($@1link$)\n Input(Name: Urlname, Value: #section_urlname#)\n }\n Div(form-group){\n Label($@1section_main_page$)\n Input(Name: Page, Value: #section_page#)\n }\n Div(form-group){\n If(#section_status#==2){\n Button(Class: btn btn-primary, Body: $@1save$, Contract: @1EditSection, Page: @1section_list, Params: \"Id=#section_id#,Status=#section_status#\")\n }.Else{\n Button(Class: btn btn-primary, Body: $@1save$, Contract: @1EditSection, Page: @1section_list, Params: \"Id=#section_id#\")\n }\n }\n }\n }\n}.Else{\n SetTitle($@1section_edit$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "section_list", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "SetVar(this_page, @1section_list).(this_table, @1sections)\nInclude(@1pager_header)\n\nSetTitle(\"$@1sections$\")\nSpan(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1sections_manage_page$\"))\nAddToolButton(Title: $@1create$, Page: @1section_add, Icon: icon-plus)\n\nIf(#search#){\n SetVar(where, {\"ecosystem\": #ecosystem_id#, {\"$or\": [{title: {\"$ilike\": \"#search#\"}}]}})\n}.Else{\n SetVar(where, {\"ecosystem\": #ecosystem_id#})\n}\n\nDiv(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1title))\n Include(@1search)\n}\n\nDBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(custom_status){\n If(#status# == 0){\n $@1hidden_section$\n }\n If(#status# == 1){\n $@1regular_section$\n }\n If(#status# == 2){\n $@1main_section$\n }\n}.Custom(custom_order){\n Button(Body: Em(Class: fa fa-arrow-down), Class: btn-xs btn-link, Page: @1section_list, Contract: @1SectionLevelDown, Params: \"Id=#id#\")\n Button(Body: Em(Class: fa fa-arrow-up), Class: btn-xs btn-link, Page: @1section_list, Contract: @1SectionLevelUp, Params: \"Id=#id#\")\n}.Custom(custom_action){\n Span(Class: pull-right){\n LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4, Page: @1section_access, PageParams: \"id=#id#\")\n }\n}.Custom(_title){\n LinkPage(Page: @1section_edit, Class: text-primary h5, Body: \"#title#\", PageParams: \"id=#id#\")\n}.Count(count)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1title$=_title,$@1link$=urlname,$@1section_page$=page,$@1status$=custom_status,=custom_order,=custom_action\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1sections$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n SetVar(this_page, @1section_list).(this_table, @1sections)\n Include(@1pager_header)\n\n SetTitle(\"$@1sections$\")\n Span(Class: text-muted h5 m0 mb ml-lg, Body: Span(Class: ml-sm, Body: \"$@1sections_manage_page$\"))\n AddToolButton(Title: $@1create$, Page: @1section_add, Icon: icon-plus)\n\n If(#search#){\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\", \"title\": {\"$ilike\": \"#search#\"}})\n }.Else{\n SetVar(where, {\"ecosystem\": \"#ecosystem_id#\"})\n }\n\n Div(list-group-item ml-lg mr-lg pt-lg){\n SetVar(search_name, LangRes(@1title))\n Include(@1search)\n }\n\n DBFind(#this_table#, src).Where(#where#).Order({\"id\": 1}).Limit(#pager_limit#).Offset(#pager_offset#).Custom(custom_status){\n If(#status# == 0){\n $@1hidden_section$\n }\n If(#status# == 1){\n $@1regular_section$\n }\n If(#status# == 2){\n $@1main_section$\n }\n }.Custom(custom_order){\n Button(Body: Em(Class: fa fa-arrow-down), Class: btn-xs btn-link, Page: @1section_list, Contract: @1SectionLevelDown, Params: \"Id=#id#\")\n Button(Body: Em(Class: fa fa-arrow-up), Class: btn-xs btn-link, Page: @1section_list, Contract: @1SectionLevelUp, Params: \"Id=#id#\")\n }.Custom(custom_action){\n Span(Class: pull-right){\n LinkPage(Body: Em(Class: fa fa-cogs), Class: text-primary h4, Page: @1section_access, PageParams: \"id=#id#\")\n }\n }.Custom(_title){\n LinkPage(Page: @1section_edit, Class: text-primary h5, Body: \"#title#\", PageParams: \"id=#id#\")\n }.Count(count)\n\n Div(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n If(#count# > 0){\n Table(src, \"$@1title$=_title,$@1link$=urlname,$@1section_page$=page,$@1status$=custom_status,=custom_order,=custom_action\")\n }.Else{\n Div(Class: text-center h4 text-muted, Body: \"$@1sections$ $@1not_founded$\")\n }\n }.Style(\n margin-top:-15px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n }\n Div(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n }\n}.Else{\n SetTitle($@1sections$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "table_create", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Div(content-wrapper){\n SetTitle($@1table_create$)\n Div(breadcrumb){\n Div(){\n LinkPage($@1tables$, @1app_tables)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n Span($@1table_create$, text-muted)\n }\n }\n\n Data(src_type,\"type,name\"){\n text,\"Text\"\n number,\"Number\"\n varchar,\"Varchar\"\n datetime,\"Date/Time\"\n money,\"Money\"\n double,\"Double\"\n character,\"Character\"\n json,\"JSON\"\n }\n Form(){\n Div(panel panel-default){\n Div(panel-body){\n Div(row){\n Div(col-sm-12){\n Label($@1name$)\n Input(Name:Name)\n }\n }\n Div(row mt-lg){\n Div(col-xs-4 col-md-4){\n Label(Class: text-muted, Body: $@1columns$)\n Input(Name:disinp, Disabled: true, Value: id)\n }\n Div(col-xs-6 col-md-7){\n Label(Class: text-muted, Body: $@1type$)\n Input(Name: disinp, Disabled: true, Value: Number)\n }\n Div(col-xs-2 col-md-1){\n Label(Class: text-muted, Body: $@1actions$)\n }\n }\n If(#cs#==\"\"){\n SetVar(cs, Calculate( Exp: 0, Type: int))\n }\n If(#del# == 1){\n SetVar(cs, Calculate( Exp: #cs# - 1, Type: int))\n }.Else{\n SetVar(cs, Calculate( Exp: #cs# + 1, Type: int))\n }\n Range(params_range, 0, #cs#)\n ForList(Source: params_range){\n Div(row mt-sm){\n Div(col-xs-4 col-md-4){\n Input(Name:ColumnsArr)\n }\n Div(col-xs-6 col-md-7){\n Select(Name: TypesArr, Source: src_type, NameColumn: name, ValueColumn: type)\n }\n Div(col-xs-2 col-md-1){\n If(And(#cs#==#params_range_index#, #cs# > 1)){\n Button(Body: Em(Class: fa fa-trash), Class: btn btn-default, PageParams: \"cs=#cs#,del=1,application_id=#application_id#\", Page: @1table_create)\n }\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1column_add$, Class: btn btn-primary, Page: @1table_create, PageParams: \"cs=#cs#,application_id=#application_id#\")\n }\n }\n Div(row){\n Div(col-xs-6 col-sm-6 col-md-6){\n Div(panel panel-default){\n Div(panel-heading, Body: $@1write_permissions$)\n Div(panel-body){\n Div(form-group){\n Label($@1insert$)\n Input(Name: InsertPerm, Value: ContractConditions(\"MainCondition\"))\n }\n Div(form-group){\n Label($@1updating$)\n Input(Name: UpdatePerm, Value: ContractConditions(\"MainCondition\"))\n }\n Div(form-group){\n Label($@1new_column$)\n Input(Name: NewColumnPerm, Value: ContractConditions(\"MainCondition\"))\n }\n Div(form-group){\n Label($@1reading$)\n Input(Name: ReadPerm, Value: \"true\")\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1save$, Class: btn btn-primary, Contract: @1NewTableJoint, Page: @1app_tables, Params: \"ApplicationId=#application_id#\")\n }\n }\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n Div(content-wrapper){\n SetTitle($@1table_create$)\n Div(breadcrumb){\n Div(){\n LinkPage($@1tables$, @1app_tables)\n Span(/).Style(margin-right: 10px; margin-left: 10px;)\n Span($@1table_create$, text-muted)\n }\n }\n\n Data(src_type,\"type,name\"){\n text,\"Text\"\n number,\"Number\"\n varchar,\"Varchar\"\n datetime,\"Date/Time\"\n money,\"Money\"\n double,\"Double\"\n character,\"Character\"\n json,\"JSON\"\n }\n Form(){\n Div(panel panel-default){\n Div(panel-body){\n Div(row){\n Div(col-sm-12){\n Label($@1name$)\n Input(Name:Name)\n }\n }\n Div(row mt-lg){\n Div(col-xs-4 col-md-4){\n Label(Class: text-muted, Body: $@1columns$)\n Input(Name:disinp, Disabled: true, Value: id)\n }\n Div(col-xs-6 col-md-7){\n Label(Class: text-muted, Body: $@1type$)\n Input(Name: disinp, Disabled: true, Value: Number)\n }\n Div(col-xs-2 col-md-1){\n Label(Class: text-muted, Body: $@1actions$)\n }\n }\n If(#cs#==\"\"){\n SetVar(cs, Calculate( Exp: 0, Type: int))\n }\n If(#del# == 1){\n SetVar(cs, Calculate( Exp: #cs# - 1, Type: int))\n }.Else{\n SetVar(cs, Calculate( Exp: #cs# + 1, Type: int))\n }\n Range(params_range, 0, #cs#)\n ForList(Source: params_range){\n Div(row mt-sm){\n Div(col-xs-4 col-md-4){\n Input(Name:ColumnsArr)\n }\n Div(col-xs-6 col-md-7){\n Select(Name: TypesArr, Source: src_type, NameColumn: name, ValueColumn: type)\n }\n Div(col-xs-2 col-md-1){\n If(And(#cs#==#params_range_index#, #cs# > 1)){\n Button(Body: Em(Class: fa fa-trash), Class: btn btn-default, PageParams: \"cs=#cs#,del=1,application_id=#application_id#\", Page: @1table_create)\n }\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1column_add$, Class: btn btn-primary, Page: @1table_create, PageParams: \"cs=#cs#,application_id=#application_id#\")\n }\n }\n Div(row){\n Div(col-xs-6 col-sm-6 col-md-6){\n Div(panel panel-default){\n Div(panel-heading, Body: $@1write_permissions$)\n Div(panel-body){\n Div(form-group){\n Label($@1insert$)\n Input(Name: InsertPerm, Value: ContractConditions(\"MainCondition\"))\n }\n Div(form-group){\n Label($@1updating$)\n Input(Name: UpdatePerm, Value: ContractConditions(\"MainCondition\"))\n }\n Div(form-group){\n Label($@1new_column$)\n Input(Name: NewColumnPerm, Value: ContractConditions(\"MainCondition\"))\n }\n Div(form-group){\n Label($@1reading$)\n Input(Name: ReadPerm, Value: \"true\")\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1save$, Class: btn btn-primary, Contract: @1NewTableJoint, Page: @1app_tables, Params: \"ApplicationId=#application_id#\")\n }\n }\n }\n }\n }\n }\n}.Else{\n SetTitle($@1table_create$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "table_edit", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "Div(content-wrapper){\n DBFind(@1tables).Columns(\"id,name,columns,conditions,permissions->insert,permissions->update,permissions->new_column,permissions->read\").Vars(pre).Where({\"id\": #tabl_id#, \"ecosystem\": #ecosystem_id#})\n\n SetTitle($@1tables$)\n Div(breadcrumb){\n Div(){\n LinkPage($@1tables$, @1app_tables)\n Span(/, mh)\n LinkPage(#pre_name#, @1table_view,, \"tabl_id=#tabl_id#\")\n Span(/, mh)\n Span($@1edit_table$, text-muted)\n }\n }\n\n Form(){\n Div(panel panel-default){\n Div(panel-body){\n Div(row){\n Div(col-xs-3 col-md-3 h4){\n Label($@1name$)\n }\n Div(col-xs-2 col-md-2 h4){\n Label($@1type$)\n }\n Div(col-xs-5 col-md-5 h4){\n Label($@1conditions$)\n }\n Div(col-xs-2 col-md-2 text-right){\n }\n }\n JsonToSource(src_columns, #pre_columns#)\n ForList(src_columns){\n SetVar(name_column,#key#)\n Div(list-group-item){\n Div(row){\n Div(col-xs-3 col-md-3 h5){\n Span(#key#)\n }\n Div(col-xs-2 col-md-2 h5){\n SetVar(col_type,GetColumnType(#pre_name#, #key#))\n If(#col_type# == text){\n Span(\"Text\")\n }.ElseIf(#col_type# == number){\n Span(\"Number\")\n }.ElseIf(#col_type# == money){\n Span(\"Money\")\n }.ElseIf(#col_type# == varchar){\n Span(\"Varchar\")\n }.ElseIf(#col_type# == datetime){\n Span(\"Date/Time\")\n }.ElseIf(#col_type# == double){\n Span(\"Double\")\n }.ElseIf(#col_type# == character){\n Span(\"Character\")\n }.ElseIf(#col_type# == json){\n Span(\"JSON\")\n }.ElseIf(#col_type# == bytea){\n Span(\"Binary Data\")\n }.ElseIf(#col_type# == uuid){\n Span(\"UUID\")\n }\n }\n Div(col-xs-5 col-md-5){\n SetVar(isObject,0)\n JsonToSource(condition,#value#)\n ForList(condition){\n SetVar(isObject,1)\n If(#key#==read){\n Div(){\n Span($@1reading$:,text-muted)\n Span(#value#,ml-sm)\n }\n }.ElseIf(#key#==update){\n Div(){\n Span($@1updating$:,text-muted)\n Span(#value#,ml-sm)\n }\n }\n }\n If(#isObject#==0){\n Div(){\n Span($@1reading$:,text-muted)\n Span(true,ml-sm)\n }\n Div(){\n Span($@1updating$:,text-muted)\n Span(#value#,ml-sm)\n }\n }\n }\n Div(col-xs-2 col-md-2 text-right){\n Button(Body: $@1edit$, Class: btn btn-primary, Page: @1column_edit, PageParams: \"name_column=#name_column#,tabl_id=#tabl_id#\")\n }\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1column_add$, Class: btn btn-primary, Page: @1column_add, PageParams: \"next_table_name=#pre_name#,tabl_id=#tabl_id#\")\n }\n }\n Div(row){\n Div(col-xs-6 col-md-6){\n Div(panel panel-default){\n Div(panel-heading){$@1write_permissions$}\n Div(panel-body){\n Div(form-group){\n Label($@1insert$)\n Input(Name: InsertPerm, Type: text, Value: #pre_permissions_insert#)\n }\n Div(form-group){\n Label($@1updating$)\n Input(Name: UpdatePerm, Type: text, Value: #pre_permissions_update#)\n }\n Div(form-group){\n Label($@1new_column$)\n Input(Name: NewColumnPerm, Type: text, Value: #pre_permissions_new_column#)\n }\n Div(form-group){\n Label($@1reading$)\n Input(Name: ReadPerm, Type: text, Value: #pre_permissions_read#)\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1save$, Class: btn btn-primary, Contract: @1EditTable, Page: @1app_tables, Params: \"Name=#pre_name#\")\n }\n }\n }\n Div(col-xs-6 col-md-6){\n Div(panel panel-default){\n Div(panel-heading){$@1conditions_for_change$}\n Div(panel-body){\n Div(form-group){\n Input(Name: Insert_condition, Disabled: true, Type: text, Value: #pre_conditions#)\n }\n }\n }\n }\n }\n }\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n Div(content-wrapper){\n DBFind(\"@1tables\").Columns(\"id,name,columns,conditions,permissions->insert,permissions->update,permissions->new_column,permissions->read\").Vars(pre).Where({\"id\": \"#tabl_id#\", \"ecosystem\": \"#ecosystem_id#\"})\n\n SetTitle($@1tables$)\n Div(breadcrumb){\n Div(){\n LinkPage($@1tables$, @1app_tables)\n Span(/, mh)\n LinkPage(#pre_name#, @1table_view,, \"tabl_id=#tabl_id#\")\n Span(/, mh)\n Span($@1edit_table$, text-muted)\n }\n }\n\n Form(){\n Div(panel panel-default){\n Div(panel-body){\n Div(row){\n Div(col-xs-3 col-md-3 h4){\n Label($@1name$)\n }\n Div(col-xs-2 col-md-2 h4){\n Label($@1type$)\n }\n Div(col-xs-5 col-md-5 h4){\n Label($@1conditions$)\n }\n Div(col-xs-2 col-md-2 text-right){\n }\n }\n JsonToSource(src_columns, #pre_columns#)\n ForList(src_columns){\n SetVar(name_column,#key#)\n Div(list-group-item){\n Div(row){\n Div(col-xs-3 col-md-3 h5){\n Span(#key#)\n }\n Div(col-xs-2 col-md-2 h5){\n SetVar(col_type,GetColumnType(#pre_name#, #key#))\n If(#col_type# == text){\n Span(\"Text\")\n }.ElseIf(#col_type# == number){\n Span(\"Number\")\n }.ElseIf(#col_type# == money){\n Span(\"Money\")\n }.ElseIf(#col_type# == varchar){\n Span(\"Varchar\")\n }.ElseIf(#col_type# == datetime){\n Span(\"Date/Time\")\n }.ElseIf(#col_type# == double){\n Span(\"Double\")\n }.ElseIf(#col_type# == character){\n Span(\"Character\")\n }.ElseIf(#col_type# == json){\n Span(\"JSON\")\n }.ElseIf(#col_type# == bytea){\n Span(\"Binary Data\")\n }.ElseIf(#col_type# == uuid){\n Span(\"UUID\")\n }\n }\n Div(col-xs-5 col-md-5){\n SetVar(isObject,0)\n JsonToSource(condition,#value#)\n ForList(condition){\n SetVar(isObject,1)\n If(#key#==read){\n Div(){\n Span($@1reading$:,text-muted)\n Span(#value#,ml-sm)\n }\n }.ElseIf(#key#==update){\n Div(){\n Span($@1updating$:,text-muted)\n Span(#value#,ml-sm)\n }\n }\n }\n If(#isObject#==0){\n Div(){\n Span($@1reading$:,text-muted)\n Span(true,ml-sm)\n }\n Div(){\n Span($@1updating$:,text-muted)\n Span(#value#,ml-sm)\n }\n }\n }\n Div(col-xs-2 col-md-2 text-right){\n Button(Body: $@1edit$, Class: btn btn-primary, Page: @1column_edit, PageParams: \"name_column=#name_column#,tabl_id=#tabl_id#\")\n }\n }\n }\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1column_add$, Class: btn btn-primary, Page: @1column_add, PageParams: \"next_table_name=#pre_name#,tabl_id=#tabl_id#\")\n }\n }\n Div(row){\n Div(col-xs-6 col-md-6){\n Div(panel panel-default){\n Div(panel-heading){$@1write_permissions$}\n Div(panel-body){\n Div(form-group){\n Label($@1insert$)\n Input(Name: InsertPerm, Type: text, Value: #pre_permissions_insert#)\n }\n Div(form-group){\n Label($@1updating$)\n Input(Name: UpdatePerm, Type: text, Value: #pre_permissions_update#)\n }\n Div(form-group){\n Label($@1new_column$)\n Input(Name: NewColumnPerm, Type: text, Value: #pre_permissions_new_column#)\n }\n Div(form-group){\n Label($@1reading$)\n Input(Name: ReadPerm, Type: text, Value: #pre_permissions_read#)\n }\n }\n Div(panel-footer text-right){\n Button(Body: $@1save$, Class: btn btn-primary, Contract: @1EditTable, Page: @1app_tables, Params: \"Name=#pre_name#\")\n }\n }\n }\n Div(col-xs-6 col-md-6){\n Div(panel panel-default){\n Div(panel-heading){$@1conditions_for_change$}\n Div(panel-body){\n Div(form-group){\n Input(Name: Insert_condition, Disabled: true, Type: text, Value: #pre_conditions#)\n }\n }\n }\n }\n }\n }\n }\n}.Else{\n SetTitle($@1tables$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "table_view", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "If(#page_par#!=\"\"){\n SetVar(Name: tabl_id, Value: #page_par#)\n}.Else{\n SetVar(Name: page_par, Value: #tabl_id#)\n}\nDBFind(@1tables).Where({\"id\": #tabl_id#, \"ecosystem\": #ecosystem_id#}).Columns(\"id,name\").Vars(pre)\n\nSetTitle($@1tables$)\nDiv(breadcrumb){\n LinkPage($@1tables$, @1app_tables)\n Span(/,mh)\n Span(#pre_name#, text-muted)\n Span(/,mh)\n LinkPage(Body:$@1edit$, Page: @1table_edit, PageParams: \"tabl_id=#tabl_id#\")\n}\n\nSetVar(this_table, #pre_name#).(this_page, @1table_view).(pager_limit, 50)\nSetVar(where, {\"id\": {\"$neq\": 0}})\nInclude(@1pager_header)\n\nDBFind(#this_table#, src).Limit(#pager_limit#).Offset(#pager_offset#).Where(#where#)\n\nDiv(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n Table(src)\n }.Style(\n margin-top:-10px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n}\nDiv(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n}", + "Value": "DBFind(\"@1applications\").Where({\"ecosystem\": \"#ecosystem_id#\", \"name\": \"System\"}).Vars(application)\nSetVar(role_developer_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_developer))\nSetVar(role_admin_id, AppParam(Ecosystem: #ecosystem_id#, App: #application_id#, Name: role_admin))\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_developer_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(developer_access)\nDBFind(\"@1roles_participants\").Where({\"ecosystem\": \"#ecosystem_id#\", \"$and\": [{\"role->id\": {\"$in\": [#role_admin_id#]}}, {\"role->id\": \"#role_id#\"}], \"member->account\": \"#account_id#\", \"deleted\": 0}).Vars(admin_access)\n\nIf(Or(#developer_access_id#>0,#admin_access_id#>0)){\n If(#page_par#!=\"\"){\n SetVar(Name: tabl_id, Value: #page_par#)\n }.Else{\n SetVar(Name: page_par, Value: #tabl_id#)\n }\n DBFind(\"@1tables\").Where({\"id\": \"#tabl_id#\", \"ecosystem\": \"#ecosystem_id#\"}).Columns(\"id,name\").Vars(pre)\n\n SetTitle($@1tables$)\n Div(breadcrumb){\n LinkPage($@1tables$, @1app_tables)\n Span(/,mh)\n Span(#pre_name#, text-muted)\n Span(/,mh)\n LinkPage(Body:$@1edit$, Page: @1table_edit, PageParams: \"tabl_id=#tabl_id#\")\n }\n\n SetVar(this_table, #pre_name#).(this_page, @1table_view).(pager_limit, 50)\n SetVar(where, {\"id\": {\"$neq\": 0}})\n Include(@1pager_header)\n\n DBFind(#this_table#, src).Limit(#pager_limit#).Offset(#pager_offset#).Where(#where#)\n\n Div(fullscreen){\n Div(table-responsive ml-lg mr-lg){\n Div(list-group-item){\n Table(src)\n }.Style(\n margin-top:-10px;\n tbody > tr:nth-of-type(odd) {\n background-color: #f8f9fc;\n }\n )\n }\n }\n Div(mt-sm ml-lg mr-sm mb-sm){\n Include(@1pager)\n }\n}.Else{\n SetTitle($@1tables$)\n Div(breadcrumb){\n Span(Class: text-muted, Body: $@1role_change_no_view_permission$)\n }\n}", "Menu": "developer_menu", "Type": "pages" }, { "Name": "AdminCondition", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "// This contract is used to set \"admin\" rights.\n// Usually the \"admin\" role is used for this.\n// The role ID is written to the ecosystem parameter and can be changed.\n// The contract requests the role ID from the ecosystem parameter and the contract checks the rights.\n\ncontract AdminCondition {\n conditions {\n if EcosysParam(\"founder_account\") == $key_id {\n return\n }\n\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n var role_id_param string\n role_id_param = AppParam(Int($system_app_id), \"role_admin\", $ecosystem_id)\n if Size(role_id_param) == 0 {\n warning \"Sorry, you do not have access to this action\"\n }\n\n var role_id int\n role_id = Int(role_id_param)\n\n if !RoleAccess(role_id) {\n warning \"Sorry, you do not have access to this action\"\n }\n }\n}", + "Value": "// This contract is used to set \"admin\" rights.\n// Usually the \"admin\" role is used for this.\n// The role ID is written to the ecosystem parameter and can be changed.\n// The contract requests the role ID from the ecosystem parameter and the contract checks the rights.\n\ncontract AdminCondition {\n conditions {\n // check for Founder\n if EcosysParam(\"founder_account\") == AddressToId($account_id) {\n return\n }\n\n // check for Admin role\n var app_id int role_id string\n app_id = Int(DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\"))\n role_id = AppParam(app_id, \"role_admin\", $ecosystem_id)\n\n if Size(role_id) == 0 {\n warning \"AdminCondition: Sorry, you do not have access to this action\"\n }\n if !RoleAccess(Int(role_id)) {\n warning \"AdminCondition: Sorry, you do not have access to this action\"\n }\n }\n}", + "Type": "contracts" + }, + { + "Name": "DeveloperCondition", + "Conditions": "ContractConditions(\"@1DeveloperCondition\")", + "Value": "// This contract is used to set \"developer\" rights. \n// Usually the \"developer\" role is used for this.\n// The role ID is written to the ecosystem parameter and can be changed.\n// The contract requests the role ID from the ecosystem parameter and the contract checks the rights.\n\ncontract DeveloperCondition {\n conditions {\n // check for Founder\n if EcosysParam(\"founder_account\") == AddressToId($account_id) {\n return\n }\n\n // check for Developer role\n var app_id int role_id string\n app_id = Int(DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\"))\n role_id = AppParam(app_id, \"role_developer\", $ecosystem_id)\n\n if Size(role_id) == 0 {\n warning \"DeveloperCondition: Sorry, you do not have access to this action\"\n }\n if !RoleAccess(Int(role_id)) {\n warning \"DeveloperCondition: Sorry, you do not have access to this action\"\n }\n }\n}", "Type": "contracts" }, { "Name": "NewApplication", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract NewApplication {\n data {\n Name string\n Conditions string\n }\n\n conditions {\n ValidateCondition($Conditions, $ecosystem_id)\n\n if Size($Name) == 0 {\n warning LangRes(\"@1app_name_missing\", \"en\")\n }\n\n if DBFind(\"@1applications\").Columns(\"id\").Where({\"name\": $Name, \"ecosystem\": $ecosystem_id}).One(\"id\") {\n warning Sprintf(LangRes(\"@1template_app_exists\", \"en\"), $Name)\n }\n }\n\n action {\n $result = DBInsert(\"@1applications\", {\"name\": $Name, \"conditions\": $Conditions, \"ecosystem\": $ecosystem_id})\n }\n}", + "Value": "contract NewApplication {\n data {\n Name string\n Conditions string\n }\n\n conditions {\n DeveloperCondition()\n\n ValidateCondition($Conditions, $ecosystem_id)\n\n if Size($Name) == 0 {\n warning LangRes(\"@1app_name_missing\", \"en\")\n }\n\n if DBFind(\"@1applications\").Where({\"name\": $Name, \"ecosystem\": $ecosystem_id}).One(\"id\") {\n warning Sprintf(LangRes(\"@1template_app_exists\", \"en\"), $Name)\n }\n }\n\n action {\n $result = DBInsert(\"@1applications\", {\"name\": $Name, \"conditions\": $Conditions, \"ecosystem\": $ecosystem_id})\n }\n}", "Type": "contracts" }, { "Name": "AppendMenu", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract AppendMenu {\n data {\n Id int\n Value string\n }\n\n conditions {\n ConditionById(\"menu\", false)\n }\n\n action {\n var row map\n row = DBFind(\"@1menu\").Columns(\"value\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row()\n var val string\n val = row[\"value\"] + \"\\r\\n\" + $Value\n DBUpdate(\"@1menu\", $Id, {\"value\": val})\n\n }\n}", + "Value": "contract AppendMenu {\n data {\n Id int\n Value string\n }\n\n conditions {\n DeveloperCondition()\n\n ConditionById(\"menu\", false)\n }\n\n action {\n var row map\n row = DBFind(\"@1menu\").Columns(\"value\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row()\n var val string\n val = row[\"value\"] + \"\\r\\n\" + $Value\n DBUpdate(\"@1menu\", $Id, {\"value\": val})\n }\n}", "Type": "contracts" }, { "Name": "AppendPage", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract AppendPage {\n data {\n Id int\n Value string\n }\n\n conditions {\n RowConditions(\"@1pages\", $Id, false)\n }\n\n action {\n var value string\n var row map\n row = DBFind(\"@1pages\").Columns(\"value\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id})Row()\n value = row[\"value\"]\n if Contains(value, \"PageEnd:\") {\n value = Replace(value, \"PageEnd:\", $Value) + \"\\r\\nPageEnd:\"\n } else {\n value = value + \"\\r\\n\" + $Value\n }\n DBUpdate(\"@1pages\", $Id, {\"value\": value })\n }\n}", + "Value": "contract AppendPage {\n data {\n Id int\n Value string\n }\n\n conditions {\n DeveloperCondition()\n\n RowConditions(\"@1pages\", $Id, false)\n }\n\n action {\n var value string\n var row map\n row = DBFind(\"@1pages\").Columns(\"value\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id})Row()\n value = row[\"value\"]\n if Contains(value, \"PageEnd:\") {\n value = Replace(value, \"PageEnd:\", $Value) + \"\\r\\nPageEnd:\"\n } else {\n value = value + \"\\r\\n\" + $Value\n }\n DBUpdate(\"@1pages\", $Id, {\"value\": value })\n }\n}", "Type": "contracts" }, { "Name": "BindWallet", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract BindWallet {\n data {\n Id int\n WalletId string \"optional\"\n }\n\n func sendInvite() {\n if GetContractByName(\"@1NotificationsSend\") == 0 {\n warning LangRes(\"@1notifications_install_needed\", \"en\")\n } else {\n var w_id int\n w_id = AddressToId($WalletId)\n $request = DBFind(\"@1notifications\").Columns(\"id\").Where({\"recipient->member_id\": w_id, \"page_name\": \"contract_bind_request\", \"page_params->contract_id\": $Id, \"ecosystem\": $ecosystem_id, \"closed\": 0})\n if $request {\n warning LangRes(\"@1request_sent_already\", \"en\")\n }\n\n var notific params map\n params[\"contract_id\"] = $Id\n params[\"contract_name\"] = $cur[\"name\"]\n notific[\"MemberId\"] = AddressToId($WalletId)\n notific[\"Sender\"] = 1\n notific[\"Icon\"] = \"icon icon-link\"\n notific[\"Header\"] = LangRes(\"@1request_contract_binding\", \"en\")\n notific[\"Body\"] = LangRes(\"@1details_view\", \"en\")\n notific[\"Page\"] = \"contract_bind_request\"\n notific[\"Params\"] = params\n CallContract(\"@1NotificationsSend\", notific)\n }\n }\n\n func closeInvite() {\n if GetContractByName(\"@1NotificationsClose\") == 0 {\n warning LangRes(\"@1notifications_install_needed\", \"en\")\n } else {\n $request = DBFind(\"@1notifications\").Columns(\"id\").Where({\"recipient->member_id\": $key_id, \"page_name\": \"contract_bind_request\", \"page_params->contract_id\": $Id, \"ecosystem\": $ecosystem_id, \"closed\": 0})\n var i int r map\n while i < Len($request) {\n r = $request[i]\n var params map\n params[\"NotificId\"] = Int(r[\"id\"])\n CallContract(\"@1NotificationsClose\", params)\n i = i + 1\n }\n }\n }\n\n conditions {\n $cur = DBFind(\"@1contracts\").Columns(\"id,name,conditions,wallet_id\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row()\n if !$cur {\n warning Sprintf(LangRes(\"@1contract_x_not_exist\", \"en\"), $Id)\n }\n if $WalletId != \"\" && AddressToId($WalletId) == 0 {\n warning LangRes(\"@1wallet_not_found\", \"en\")\n }\n RowConditions(\"@1contracts\", $Id, false)\n }\n\n action {\n if $WalletId == \"\" || AddressToId($WalletId) == $key_id {\n BndWallet($Id, $ecosystem_id)\n closeInvite()\n } else {\n sendInvite()\n }\n }\n}", + "Value": "contract BindWallet {\n data {\n Id int\n WalletId string \"optional\"\n }\n\n func sendInvite() {\n if GetContractByName(\"@1NotificationsSend\") == 0 {\n warning LangRes(\"@1notifications_install_needed\", \"en\")\n } else {\n $request = DBFind(\"@1notifications\").Where({\"recipient->account\": $WalletId, \"page_name\": \"contract_bind_request\", \"page_params->contract_id\": $Id, \"ecosystem\": $ecosystem_id, \"closed\": 0}).Columns(\"id\")\n if $request {\n warning LangRes(\"@1request_sent_already\", \"en\")\n }\n\n var notific params map\n params[\"contract_id\"] = $Id\n params[\"contract_name\"] = $cur[\"name\"]\n notific[\"MemberAccount\"] = $WalletId\n notific[\"Sender\"] = 1\n notific[\"Icon\"] = \"icon icon-link\"\n notific[\"Header\"] = LangRes(\"@1request_contract_binding\", \"en\")\n notific[\"Body\"] = LangRes(\"@1details_view\", \"en\")\n notific[\"Page\"] = \"contract_bind_request\"\n notific[\"Params\"] = params\n CallContract(\"@1NotificationsSend\", notific)\n }\n }\n\n func closeInvite() {\n if GetContractByName(\"@1NotificationsClose\") == 0 {\n warning LangRes(\"@1notifications_install_needed\", \"en\")\n } else {\n $request = DBFind(\"@1notifications\").Where({\"recipient->account\": $account_id, \"page_name\": \"contract_bind_request\", \"page_params->contract_id\": $Id, \"ecosystem\": $ecosystem_id, \"closed\": 0}).Columns(\"id\")\n var i int r map\n while i < Len($request) {\n r = $request[i]\n var params map\n params[\"NotificId\"] = Int(r[\"id\"])\n CallContract(\"@1NotificationsClose\", params)\n i = i + 1\n }\n }\n }\n\n conditions {\n DeveloperCondition()\n\n $cur = DBFind(\"@1contracts\").Columns(\"id,name,conditions,wallet_id\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row()\n if !$cur {\n warning Sprintf(LangRes(\"@1contract_x_not_exist\", \"en\"), $Id)\n }\n if Size($WalletId) == 0 {\n warning LangRes(\"@1wallet_not_found\", \"en\")\n }\n RowConditions(\"@1contracts\", $Id, false)\n }\n\n action {\n if $WalletId == \"\" || $WalletId == $account_id {\n BndWallet($Id, $ecosystem_id)\n closeInvite()\n } else {\n sendInvite()\n }\n }\n}", + "Type": "contracts" + }, + { + "Name": "BufferManager", + "Conditions": "ContractConditions(\"@1DeveloperCondition\")", + "Value": "contract BufferManager {\n data {\n Action string\n Key string\n Val string \"optional\"\n }\n\n func decodeArray(s string) array {\n var ar array\n if HasPrefix($buf[\"value\"], \"[\") {\n ar = JSONDecode($buf[\"value\"])\n }\n return ar\n }\n\n action {\n $emptyVal = JSONEncode(\"\")\n $buf = DBFind(\"@1buffer_data\").Where({\"ecosystem\": $ecosystem_id, \"key\": $Key, \"account\": $account_id}).Row()\n if !$buf {\n var buf map, id int\n id = DBInsert(\"@1buffer_data\", {\"ecosystem\": $ecosystem_id, \"key\": $Key, \"value\": $emptyVal, \"account\": $account_id})\n buf[\"id\"] = Str(id)\n buf[\"value\"] = \"\"\n buf[\"account\"] = $account_id\n buf[\"key\"] = Str($Key)\n $buf = buf\n }\n var id int\n id = Int($buf[\"id\"])\n if $Action == \"clean\" {\n DBUpdate(\"@1buffer_data\", id, {\"value\": $emptyVal})\n }\n if $Action == \"set\" {\n DBUpdate(\"@1buffer_data\", id, {\"value\": $Val})\n }\n if $Action == \"array_add_value\" {\n var ar array enc string\n ar = decodeArray($buf[\"value\"])\n ar = Append(ar, $Val)\n enc = JSONEncode(ar)\n DBUpdate(\"@1buffer_data\", id, {\"value\": enc})\n }\n if $Action == \"array_remove_value\" {\n var ar arNew array i int enc string\n ar = decodeArray($buf[\"value\"])\n while i < Len(ar){\n if ar[i] != $Val{\n arNew = Append(arNew, ar[i])\n }\n i = i + 1\n }\n enc = JSONEncode(arNew)\n DBUpdate(\"@1buffer_data\", id, {\"value\": enc})\n }\n }\n}", "Type": "contracts" }, { "Name": "CallDelayedContract", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract CallDelayedContract {\n data {\n Id int\n }\n\n conditions {\n var rows array\n rows = DBFind(\"@1delayed_contracts\").Where({\"id\": $Id, \"deleted\": 0})\n\n if !Len(rows) {\n warning Sprintf(LangRes(\"@1template_delayed_contract_not_exist\", \"en\"), $Id)\n }\n $cur = rows[0]\n $limit = Int($cur[\"limit\"])\n $counter = Int($cur[\"counter\"])\n\n if $key_id != Int($cur[\"key_id\"]) {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n if $block < Int($cur[\"block_id\"]) {\n warning Sprintf(LangRes(\"@1template_delayed_contract_error\", \"en\"), $Id, $cur[\"block_id\"], $block)\n }\n\n if $limit > 0 && $counter >= $limit {\n warning Sprintf(LangRes(\"@1template_delayed_contract_limited\", \"en\"), $Id)\n }\n }\n\n action {\n $counter = $counter + 1\n\n var block_id int\n block_id = $block\n if $limit == 0 || $limit > $counter {\n block_id = block_id + Int($cur[\"every_block\"])\n }\n\n DBUpdate(\"@1delayed_contracts\", $Id, {\"counter\": $counter, \"block_id\": block_id})\n\n var params map\n CallContract($cur[\"contract\"], params)\n }\n}", + "Value": "contract CallDelayedContract {\n data {\n Id int\n }\n\n conditions {\n var rows array\n rows = DBFind(\"@1delayed_contracts\").Where({\"id\": $Id, \"deleted\": 0})\n\n if !Len(rows) {\n warning Sprintf(LangRes(\"@1template_delayed_contract_not_exist\", \"en\"), $Id)\n }\n $cur = rows[0]\n $limit = Int($cur[\"limit\"])\n $counter = Int($cur[\"counter\"])\n var account_key int\n account_key = AddressToId($account_id)\n \n if account_key != Int($cur[\"key_id\"]) {\n warning LangRes(\"@1access_denied\", \"en\")\n }\n\n if $block < Int($cur[\"block_id\"]) {\n warning Sprintf(LangRes(\"@1template_delayed_contract_error\", \"en\"), $Id, $cur[\"block_id\"], $block)\n }\n\n if $limit > 0 && $counter >= $limit {\n warning Sprintf(LangRes(\"@1template_delayed_contract_limited\", \"en\"), $Id)\n }\n }\n\n action {\n $counter = $counter + 1\n\n var block_id int\n block_id = $block\n if $limit == 0 || $limit > $counter {\n block_id = block_id + Int($cur[\"every_block\"])\n }\n\n DBUpdate(\"@1delayed_contracts\", $Id, {\"counter\": $counter, \"block_id\": block_id})\n\n var params map\n CallContract($cur[\"contract\"], params)\n }\n}", "Type": "contracts" }, { @@ -398,63 +404,63 @@ "Type": "contracts" }, { - "Name": "DelApplication", + "Name": "UploadBinary", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract DelApplication {\n data {\n ApplicationId int\n Value int \"optional\"\n }\n\n conditions {\n if !DBFind(\"@1applications\").Columns(\"id,ecosystem\").Where({\"id\": $ApplicationId, \"ecosystem\": $ecosystem_id}) {\n warning LangRes(\"@1item_not_found\", \"en\")\n }\n\n if $Value < 0 || $Value > 1 {\n warning LangRes(\"@1value_incorrect\", \"en\")\n }\n RowConditions(\"@1applications\", $ApplicationId, false)\n }\n\n action {\n DBUpdate(\"@1applications\", $ApplicationId, {\"deleted\": $Value})\n }\n}", + "Value": "contract UploadBinary {\n data {\n ApplicationId int\n Name string\n Data bytes\n DataMimeType string \"optional\"\n MemberAccount string \"optional\"\n }\n\n conditions {\n DeveloperCondition()\n\n if Size($MemberAccount) > 0 {\n $UserID = $MemberAccount\n } else {\n $UserID = $account_id\n }\n\n $Id = Int(DBFind(\"@1binaries\").Where({\"app_id\": $ApplicationId, \"account\": $UserID, \"name\": $Name, \"ecosystem\": $ecosystem_id}).One(\"id\"))\n\n if $Id == 0 {\n if $ApplicationId == 0 {\n warning LangRes(\"@1aid_cannot_zero\", \"en\")\n }\n }\n }\n\n action {\n var hash string\n hash = Hash($Data)\n\n if $DataMimeType == \"\" {\n $DataMimeType = \"application/octet-stream\"\n }\n\n if $Id != 0 {\n DBUpdate(\"@1binaries\", $Id, {\"data\": $Data, \"hash\": hash, \"mime_type\": $DataMimeType})\n } else {\n $Id = DBInsert(\"@1binaries\", {\"app_id\": $ApplicationId, \"account\": $UserID, \"name\": $Name, \"data\": $Data, \"hash\": hash, \"mime_type\": $DataMimeType, \"ecosystem\": $ecosystem_id})\n }\n\n $result = $Id\n }\n}", "Type": "contracts" }, { - "Name": "DeveloperCondition", + "Name": "DelApplication", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "// This contract is used to set \"developer\" rights.\n// Usually the \"developer\" role is used for this.\n// The role ID is written to the ecosystem parameter and can be changed.\n// The contract requests the role ID from the ecosystem parameter and the contract checks the rights.\n\ncontract DeveloperCondition {\n conditions {\n if EcosysParam(\"founder_account\") == $key_id {\n return\n }\n\n $system_app_id = DBFind(\"@1applications\").Where({\"ecosystem\": $ecosystem_id, \"name\": \"System\"}).One(\"id\")\n var role_id_param string\n role_id_param = AppParam(Int($system_app_id), \"role_developer\", $ecosystem_id)\n if Size(role_id_param) == 0 {\n warning \"Sorry, you do not have access to this action\"\n }\n\n var role_id int\n role_id = Int(role_id_param)\n\n if !RoleAccess(role_id) {\n warning \"Sorry, you do not have access to this action\"\n }\n }\n}", + "Value": "contract DelApplication {\n data {\n ApplicationId int\n Value int \"optional\"\n }\n\n conditions {\n DeveloperCondition()\n\n if !DBFind(\"@1applications\").Columns(\"id,ecosystem\").Where({\"id\": $ApplicationId, \"ecosystem\": $ecosystem_id}) {\n warning LangRes(\"@1item_not_found\", \"en\")\n }\n\n if $Value < 0 || $Value > 1 {\n warning LangRes(\"@1value_incorrect\", \"en\")\n }\n RowConditions(\"@1applications\", $ApplicationId, false)\n }\n\n action {\n DBUpdate(\"@1applications\", $ApplicationId, {\"deleted\": $Value})\n }\n}", "Type": "contracts" }, { "Name": "EditAppParam", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract EditAppParam {\n data {\n Id int\n Value string \"optional\"\n Conditions string \"optional\"\n }\n\n func onlyConditions() bool {\n return $Conditions && !$Value\n }\n\n conditions {\n if !DBFind(\"@1app_params\").Columns(\"id,ecosystem\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}) {\n warning LangRes(\"@1item_not_found\", \"en\")\n }\n\n RowConditions(\"@1app_params\", $Id, onlyConditions())\n if $Conditions {\n ValidateCondition($Conditions, $ecosystem_id)\n }\n }\n\n action {\n var pars map\n if $Value {\n pars[\"value\"] = $Value\n }\n if $Conditions {\n pars[\"conditions\"] = $Conditions\n }\n if pars {\n DBUpdate(\"@1app_params\", $Id, pars)\n }\n }\n}", + "Value": "contract EditAppParam {\n data {\n Id int\n Value string \"optional\"\n Conditions string \"optional\"\n }\n\n func onlyConditions() bool {\n return $Conditions && !$Value\n }\n\n conditions {\n DeveloperCondition()\n\n if !DBFind(\"@1app_params\").Columns(\"id,ecosystem\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}) {\n warning LangRes(\"@1item_not_found\", \"en\")\n }\n\n RowConditions(\"@1app_params\", $Id, onlyConditions())\n if $Conditions {\n ValidateCondition($Conditions, $ecosystem_id)\n }\n }\n\n action {\n var pars map\n if $Value {\n pars[\"value\"] = $Value\n }\n if $Conditions {\n pars[\"conditions\"] = $Conditions\n }\n if pars {\n DBUpdate(\"@1app_params\", $Id, pars)\n }\n }\n}", "Type": "contracts" }, { "Name": "EditApplication", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract EditApplication {\n data {\n ApplicationId int\n Conditions string \"optional\"\n }\n\n func onlyConditions() bool {\n return $Conditions && false\n }\n\n conditions {\n if !DBFind(\"@1applications\").Columns(\"id,ecosystem\").Where({\"id\": $ApplicationId, \"ecosystem\": $ecosystem_id}) {\n warning LangRes(\"@1item_not_found\", \"en\")\n }\n\n RowConditions(\"@1applications\", $ApplicationId, onlyConditions())\n if $Conditions {\n ValidateCondition($Conditions, $ecosystem_id)\n }\n }\n\n action {\n var pars map\n if $Conditions {\n pars[\"conditions\"] = $Conditions\n }\n if pars {\n DBUpdate(\"@1applications\", $ApplicationId, pars)\n }\n }\n}", + "Value": "contract EditApplication {\n data {\n ApplicationId int\n Conditions string \"optional\"\n }\n\n func onlyConditions() bool {\n return $Conditions && false\n }\n\n conditions {\n DeveloperCondition()\n\n if !DBFind(\"@1applications\").Columns(\"id,ecosystem\").Where({\"id\": $ApplicationId, \"ecosystem\": $ecosystem_id}) {\n warning LangRes(\"@1item_not_found\", \"en\")\n }\n\n RowConditions(\"@1applications\", $ApplicationId, onlyConditions())\n if $Conditions {\n ValidateCondition($Conditions, $ecosystem_id)\n }\n }\n\n action {\n var pars map\n if $Conditions {\n pars[\"conditions\"] = $Conditions\n }\n if pars {\n DBUpdate(\"@1applications\", $ApplicationId, pars)\n }\n }\n}", "Type": "contracts" }, { "Name": "EditBlock", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract EditBlock {\n data {\n Id int\n Value string \"optional\"\n Conditions string \"optional\"\n }\n\n func onlyConditions() bool {\n return $Conditions && !$Value\n }\n\n conditions {\n if !DBFind(\"@1blocks\").Columns(\"id,ecosystem\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}) {\n warning LangRes(\"@1item_not_found\", \"en\")\n }\n RowConditions(\"@1blocks\", $Id, onlyConditions())\n if $Conditions {\n ValidateCondition($Conditions, $ecosystem_id)\n }\n }\n\n action {\n var pars map\n if $Value {\n pars[\"value\"] = $Value\n }\n if $Conditions {\n pars[\"conditions\"] = $Conditions\n }\n if pars {\n DBUpdate(\"@1blocks\", $Id, pars)\n }\n }\n}", + "Value": "contract EditBlock {\n data {\n Id int\n Value string \"optional\"\n Conditions string \"optional\"\n }\n\n func onlyConditions() bool {\n return $Conditions && !$Value\n }\n\n conditions {\n DeveloperCondition()\n\n if !DBFind(\"@1blocks\").Columns(\"id,ecosystem\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}) {\n warning LangRes(\"@1item_not_found\", \"en\")\n }\n RowConditions(\"@1blocks\", $Id, onlyConditions())\n if $Conditions {\n ValidateCondition($Conditions, $ecosystem_id)\n }\n }\n\n action {\n var pars map\n if $Value {\n pars[\"value\"] = $Value\n }\n if $Conditions {\n pars[\"conditions\"] = $Conditions\n }\n if pars {\n DBUpdate(\"@1blocks\", $Id, pars)\n }\n }\n}", "Type": "contracts" }, { "Name": "EditColumn", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract EditColumn {\n data {\n TableName string\n Name string\n UpdatePerm string\n ReadPerm string\n }\n\n conditions {\n $TableName = ToLower($TableName)\n if !DBFind(\"@1tables\").Columns(\"name,ecosystem\").Where({\"name\": $TableName, \"ecosystem\": $ecosystem_id}) {\n warning LangRes(\"@1item_not_found\", \"en\")\n }\n var permissions map\n permissions[\"update\"] = $UpdatePerm\n permissions[\"read\"] = $ReadPerm\n $Permissions = permissions\n ColumnCondition($TableName, $Name, \"\", JSONEncode($Permissions))\n }\n\n action {\n PermColumn($TableName, $Name, JSONEncode($Permissions))\n }\n}", + "Value": "contract EditColumn {\n data {\n TableName string\n Name string\n UpdatePerm string\n ReadPerm string\n }\n\n conditions {\n DeveloperCondition()\n\n $TableName = ToLower($TableName)\n if !DBFind(\"@1tables\").Columns(\"name,ecosystem\").Where({\"name\": $TableName, \"ecosystem\": $ecosystem_id}) {\n warning LangRes(\"@1item_not_found\", \"en\")\n }\n var permissions map\n permissions[\"update\"] = $UpdatePerm\n permissions[\"read\"] = $ReadPerm\n $Permissions = permissions\n ColumnCondition($TableName, $Name, \"\", JSONEncode($Permissions))\n }\n\n action {\n PermColumn($TableName, $Name, JSONEncode($Permissions))\n }\n}", "Type": "contracts" }, { "Name": "EditContract", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract EditContract {\n data {\n Id int\n Value string \"optional\"\n Conditions string \"optional\"\n }\n\n func onlyConditions() bool {\n return $Conditions && !$Value\n }\n\n conditions {\n RowConditions(\"@1contracts\", $Id, onlyConditions())\n if $Conditions {\n ValidateCondition($Conditions, $ecosystem_id)\n }\n $cur = DBFind(\"@1contracts\").Columns(\"id,value,conditions,wallet_id,token_id\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row()\n if !$cur {\n warning Sprintf(LangRes(\"@1template_contract_not_exist\", \"en\"), $Id)\n }\n if $Value {\n ValidateEditContractNewValue($Value, $cur[\"value\"])\n }\n\n $recipient = Int($cur[\"wallet_id\"])\n }\n\n action {\n UpdateContract($Id, $Value, $Conditions, $recipient, $cur[\"token_id\"])\n }\n}", + "Value": "contract EditContract {\n data {\n Id int \n Value string \"optional\"\n Conditions string \"optional\"\n }\n\n func onlyConditions() bool {\n return $Conditions && !$Value \n }\n\n conditions {\n DeveloperCondition()\n\n RowConditions(\"@1contracts\", $Id, onlyConditions())\n if $Conditions {\n ValidateCondition($Conditions, $ecosystem_id)\n }\n $cur = DBFind(\"@1contracts\").Columns(\"id,value,conditions,wallet_id,token_id\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row()\n if !$cur {\n warning Sprintf(LangRes(\"@1template_contract_not_exist\", \"en\"), $Id)\n }\n if $Value {\n ValidateEditContractNewValue($Value, $cur[\"value\"])\n }\n\n $recipient = Int($cur[\"wallet_id\"])\n }\n\n action {\n UpdateContract($Id, $Value, $Conditions, $recipient, $cur[\"token_id\"])\n }\n}", "Type": "contracts" }, { "Name": "EditDelayedContract", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract EditDelayedContract {\n data {\n Id int\n Contract string\n EveryBlock int\n Conditions string\n BlockID int \"optional\"\n Limit int \"optional\"\n Deleted int \"optional\"\n }\n\n conditions {\n ConditionById(\"delayed_contracts\", true)\n\n if !HasPrefix($Contract, \"@\") {\n $Contract = \"@\" + Str($ecosystem_id) + $Contract\n }\n\n if GetContractByName($Contract) == 0 {\n warning Sprintf(LangRes(\"@1template_unknown_contract\", \"en\"), $Contract)\n }\n\n if $BlockID == 0 {\n $BlockID = $block + $EveryBlock\n }\n\n if $BlockID <= $block {\n warning LangRes(\"@1blockid_must_greater\", \"en\")\n }\n }\n\n action {\n DBUpdate(\"@1delayed_contracts\", $Id, {\"contract\": $Contract,\"key_id\": $key_id,\n \"block_id\": $BlockID,\"every_block\": $EveryBlock, \"counter\": 0,\"limit\": $Limit, \"deleted\": $Deleted,\"conditions\": $Conditions})\n }\n}", + "Value": "contract EditDelayedContract {\n data {\n Id int\n Contract string\n EveryBlock int\n Conditions string\n BlockID int \"optional\"\n Limit int \"optional\"\n Deleted int \"optional\"\n }\n\n conditions {\n DeveloperCondition()\n\n ConditionById(\"delayed_contracts\", true)\n\n if !HasPrefix($Contract, \"@\") {\n $Contract = \"@\" + Str($ecosystem_id) + $Contract\n }\n\n if GetContractByName($Contract) == 0 {\n warning Sprintf(LangRes(\"@1template_unknown_contract\", \"en\"), $Contract)\n }\n\n if $BlockID == 0 {\n $BlockID = $block + $EveryBlock\n }\n\n if $BlockID <= $block {\n warning LangRes(\"@1blockid_must_greater\", \"en\")\n }\n }\n\n action {\n var account_key int\n account_key = AddressToId($account_id)\n DBUpdate(\"@1delayed_contracts\", $Id, {\"contract\": $Contract, \"key_id\": account_key, \"block_id\": $BlockID, \"every_block\": $EveryBlock, \"counter\": 0, \"limit\": $Limit, \"deleted\": $Deleted, \"conditions\": $Conditions})\n }\n}", "Type": "contracts" }, { "Name": "EditEcosystemName", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract EditEcosystemName {\n data {\n EcosystemID int\n NewName string\n }\n\n conditions {\n var rows array\n rows = DBFind(\"@1ecosystems\").Where({\"id\": $EcosystemID})\n if !Len(rows) {\n warning Sprintf(LangRes(\"@1template_eco_not_exist\", \"en\"), $EcosystemID)\n }\n }\n\n action {\n EditEcosysName($EcosystemID, $NewName)\n }\n}", + "Value": "contract EditEcosystemName {\n data {\n EcosystemID int\n NewName string\n }\n\n conditions {\n DeveloperCondition()\n\n var rows array\n rows = DBFind(\"@1ecosystems\").Where({\"id\": $EcosystemID})\n if !Len(rows) {\n warning Sprintf(LangRes(\"@1template_eco_not_exist\", \"en\"), $EcosystemID)\n }\n }\n\n action {\n EditEcosysName($EcosystemID, $NewName)\n }\n}", "Type": "contracts" }, { "Name": "EditLang", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract EditLang {\n data {\n Id int\n Trans string\n }\n\n conditions {\n EvalCondition(\"@1parameters\", \"changing_language\", \"value\")\n $lang = DBFind(\"@1languages\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row()\n if !$lang {\n warning LangRes(\"@1item_not_found\", \"en\")\n }\n }\n\n action {\n EditLanguage($Id, $lang[\"name\"], $Trans)\n }\n}", + "Value": "contract EditLang {\n data {\n Id int\n Trans string\n }\n\n conditions {\n DeveloperCondition()\n\n EvalCondition(\"@1parameters\", \"changing_language\", \"value\")\n $lang = DBFind(\"@1languages\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row()\n if !$lang {\n warning LangRes(\"@1item_not_found\", \"en\")\n }\n }\n\n action {\n EditLanguage($Id, $lang[\"name\"], $Trans)\n }\n}", "Type": "contracts" }, { @@ -466,79 +472,79 @@ { "Name": "EditMenu", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract EditMenu {\n data {\n Id int\n Value string \"optional\"\n Title string \"optional\"\n Conditions string \"optional\"\n }\n\n func onlyConditions() bool {\n return $Conditions && !$Value && !$Title\n }\n\n conditions {\n if !DBFind(\"@1menu\").Columns(\"id,ecosystem\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}) {\n warning LangRes(\"@1item_not_found\", \"en\")\n }\n RowConditions(\"@1menu\", $Id, onlyConditions())\n if $Conditions {\n ValidateCondition($Conditions, $ecosystem_id)\n }\n }\n\n action {\n var pars map\n if $Value {\n pars[\"value\"] = $Value\n }\n if $Title {\n pars[\"title\"] = $Title\n }\n if $Conditions {\n pars[\"conditions\"] = $Conditions\n }\n if pars {\n DBUpdate(\"@1menu\", $Id, pars)\n }\n }\n}", + "Value": "contract EditMenu {\n data {\n Id int\n Value string \"optional\"\n Title string \"optional\"\n Conditions string \"optional\"\n }\n\n func onlyConditions() bool {\n return $Conditions && !$Value && !$Title\n }\n\n conditions {\n DeveloperCondition()\n\n if !DBFind(\"@1menu\").Columns(\"id,ecosystem\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}) {\n warning LangRes(\"@1item_not_found\", \"en\")\n }\n RowConditions(\"@1menu\", $Id, onlyConditions())\n if $Conditions {\n ValidateCondition($Conditions, $ecosystem_id)\n }\n }\n\n action {\n var pars map\n if $Value {\n pars[\"value\"] = $Value\n }\n if $Title {\n pars[\"title\"] = $Title\n }\n if $Conditions {\n pars[\"conditions\"] = $Conditions\n }\n if pars {\n DBUpdate(\"@1menu\", $Id, pars)\n }\n }\n}", "Type": "contracts" }, { "Name": "EditPage", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract EditPage {\n data {\n Id int\n Value string \"optional\"\n Menu string \"optional\"\n Conditions string \"optional\"\n ValidateCount int \"optional\"\n ValidateMode string \"optional\"\n }\n\n func onlyConditions() bool {\n return $Conditions && !$Value && !$Menu && !$ValidateCount\n }\n\n func preparePageValidateCount(count int) int {\n var min, max int\n min = Int(EcosysParam(\"min_page_validate_count\"))\n max = Int(EcosysParam(\"max_page_validate_count\"))\n if count < min {\n count = min\n } else {\n if count > max {\n count = max\n }\n }\n return count\n }\n\n conditions {\n if !DBFind(\"@1pages\").Columns(\"id,ecosystem\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}) {\n warning LangRes(\"@1item_not_found\", \"en\")\n }\n RowConditions(\"@1pages\", $Id, onlyConditions())\n if $Conditions {\n ValidateCondition($Conditions, $ecosystem_id)\n }\n $ValidateCount = preparePageValidateCount($ValidateCount)\n }\n\n action {\n var pars map\n if $Value {\n pars[\"value\"] = $Value\n }\n if $Menu {\n pars[\"menu\"] = $Menu\n }\n if $Conditions {\n pars[\"conditions\"] = $Conditions\n }\n if $ValidateCount {\n pars[\"validate_count\"] = $ValidateCount\n }\n if $ValidateMode {\n if $ValidateMode != \"1\" {\n $ValidateMode = \"0\"\n }\n pars[\"validate_mode\"] = $ValidateMode\n }\n if pars {\n DBUpdate(\"@1pages\", $Id, pars)\n }\n }\n}", + "Value": "contract EditPage {\n data {\n Id int\n Value string \"optional\"\n Menu string \"optional\"\n Conditions string \"optional\"\n ValidateCount int \"optional\"\n ValidateMode string \"optional\"\n }\n\n func onlyConditions() bool {\n return $Conditions && !$Value && !$Menu && !$ValidateCount\n }\n\n func preparePageValidateCount(count int) int {\n var min, max int\n min = Int(EcosysParam(\"min_page_validate_count\"))\n max = Int(EcosysParam(\"max_page_validate_count\"))\n if count < min {\n count = min\n } else {\n if count > max {\n count = max\n }\n }\n return count\n }\n\n conditions {\n DeveloperCondition()\n\n if !DBFind(\"@1pages\").Columns(\"id,ecosystem\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}) {\n warning LangRes(\"@1item_not_found\", \"en\")\n }\n RowConditions(\"@1pages\", $Id, onlyConditions())\n if $Conditions {\n ValidateCondition($Conditions, $ecosystem_id)\n }\n $ValidateCount = preparePageValidateCount($ValidateCount)\n }\n\n action {\n var pars map\n if $Value {\n pars[\"value\"] = $Value\n }\n if $Menu {\n pars[\"menu\"] = $Menu\n }\n if $Conditions {\n pars[\"conditions\"] = $Conditions\n }\n if $ValidateCount {\n pars[\"validate_count\"] = $ValidateCount\n }\n if $ValidateMode {\n if $ValidateMode != \"1\" {\n $ValidateMode = \"0\"\n }\n pars[\"validate_mode\"] = $ValidateMode\n }\n if pars {\n DBUpdate(\"@1pages\", $Id, pars)\n }\n }\n}", "Type": "contracts" }, { "Name": "EditParameter", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract EditParameter {\n data {\n Id int\n Value string \"optional\"\n Conditions string \"optional\"\n }\n\n func onlyConditions() bool {\n return $Conditions && !$Value\n }\n\n conditions {\n $Id = Int($Id)\n RowConditions(\"@1parameters\", $Id, onlyConditions())\n if $Conditions {\n ValidateCondition($Conditions, $ecosystem_id)\n }\n\n $Name = DBFind(\"@1parameters\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).One(\"name\")\n if $Name == \"founder_account\" {\n if !DBFind(\"@1members\").Where({\"id\": $Value, \"ecosystem\": $ecosystem_id}).One(\"id\") {\n warning Sprintf(LangRes(\"@1template_user_not_found\", \"en\"), $Value)\n }\n }\n if $Name == \"max_block_user_tx\" || $Name == \"money_digit\" || $Name == \"max_sum\" || $Name == \"min_page_validate_count\" || $Name == \"max_page_validate_count\" {\n if Size($Value) == 0 {\n warning LangRes(\"@1value_not_received\", \"en\")\n }\n if Int($Value) <= 0 {\n warning LangRes(\"@1value_must_greater_zero\", \"en\")\n }\n }\n }\n\n action {\n var pars map\n if $Value {\n if $Value == `\"\"` {\n pars[\"value\"] = \"\"\n } else {\n pars[\"value\"] = $Value\n }\n }\n if $Conditions {\n pars[\"conditions\"] = $Conditions\n }\n if pars {\n DBUpdate(\"@1parameters\", $Id, pars)\n }\n }\n}", + "Value": "contract EditParameter {\n data {\n Id int\n Value string \"optional\"\n Conditions string \"optional\"\n }\n\n func onlyConditions() bool {\n return $Conditions && !$Value\n }\n\n conditions {\n DeveloperCondition()\n\n $Id = Int($Id)\n RowConditions(\"@1parameters\", $Id, onlyConditions())\n if $Conditions {\n ValidateCondition($Conditions, $ecosystem_id)\n }\n\n $Name = DBFind(\"@1parameters\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).One(\"name\")\n if $Name == \"founder_account\" {\n var account string\n account = IdToAddress(Int($Value))\n if !DBFind(\"@1keys\").Where({\"account\": account, \"ecosystem\": $ecosystem_id, \"deleted\": 0}).One(\"id\") {\n warning Sprintf(LangRes(\"@1template_user_not_found\", \"en\"), $Value)\n }\n }\n if $Name == \"max_block_user_tx\" || $Name == \"money_digit\" || $Name == \"max_sum\" || $Name == \"min_page_validate_count\" || $Name == \"max_page_validate_count\" {\n if Size($Value) == 0 {\n warning LangRes(\"@1value_not_received\", \"en\")\n }\n if Int($Value) <= 0 {\n warning LangRes(\"@1value_must_greater_zero\", \"en\")\n }\n }\n }\n\n action {\n var pars map\n if $Value {\n if $Value == `\"\"` {\n pars[\"value\"] = \"\"\n } else {\n pars[\"value\"] = $Value\n }\n }\n if $Conditions {\n pars[\"conditions\"] = $Conditions\n }\n if pars {\n DBUpdate(\"@1parameters\", $Id, pars)\n }\n }\n}", "Type": "contracts" }, { "Name": "EditSection", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract EditSection {\n data {\n Id int\n Title string\n Status int\n Urlname string\n Page string\n }\n\n conditions {\n if DBFind(\"@1sections\").Where({\"urlname\": $Urlname, \"ecosystem\": $ecosystem_id}) {\n warning LangRes(\"@1section_exist\", \"en\")\n }\n if !DBFind(\"@1sections\").Columns(\"id,ecosystem\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}) {\n warning LangRes(\"@1item_not_found\", \"en\")\n }\n if $Status < 0 || $Status > 2 {\n warning LangRes(\"@1status_must_0_2\", \"en\")\n }\n if $Status == 0 || $Status == 1 {\n var status_check map\n status_check = DBFind(\"@1sections\").Columns(\"id,status\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row()\n if Int(JSONDecode(status_check[\"status\"])) == 2 {\n warning LangRes(\"@1main_section_warning\", \"en\")\n }\n }\n if !DBFind(\"@1sections\").Columns(\"id\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}) {\n warning Sprintf(LangRes(\"@1template_section_not_exist\", \"en\"), $Id)\n }\n }\n\n action {\n if $Status == 2 {\n var status_check map\n var curr_id int\n status_check = DBFind(\"@1sections\").Columns(\"id,status\").Where({\"status\": $Status, \"ecosystem\": $ecosystem_id}).Row()\n curr_id = Int(JSONDecode(status_check[\"id\"]))\n DBUpdate(\"@1sections\", curr_id, {\"status\":1})\n }\n DBUpdate(\"@1sections\", $Id, {\"title\":$Title,\"status\":$Status,\"urlname\":$Urlname,\"page\":$Page})\n }\n}", + "Value": "contract EditSection {\n data {\n Id int\n Title string\n Status int\n Urlname string\n Page string\n }\n\n conditions {\n DeveloperCondition()\n\n if DBFind(\"@1sections\").Where({\"urlname\": $Urlname, \"ecosystem\": $ecosystem_id}) {\n warning LangRes(\"@1section_exist\", \"en\")\n }\n if !DBFind(\"@1sections\").Columns(\"id,ecosystem\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}) {\n warning LangRes(\"@1item_not_found\", \"en\")\n }\n if $Status < 0 || $Status > 2 {\n warning LangRes(\"@1status_must_0_2\", \"en\")\n }\n if $Status == 0 || $Status == 1 {\n var status_check map\n status_check = DBFind(\"@1sections\").Columns(\"id,status\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row()\n if Int(JSONDecode(status_check[\"status\"])) == 2 {\n warning LangRes(\"@1main_section_warning\", \"en\")\n }\n }\n if !DBFind(\"@1sections\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Columns(\"id\") {\n warning Sprintf(LangRes(\"@1template_section_not_exist\", \"en\"), $Id)\n }\n }\n\n action {\n if $Status == 2 {\n var status_check map\n var curr_id int\n status_check = DBFind(\"@1sections\").Columns(\"id,status\").Where({\"status\": $Status, \"ecosystem\": $ecosystem_id}).Row()\n curr_id = Int(JSONDecode(status_check[\"id\"]))\n DBUpdate(\"@1sections\", curr_id, {\"status\":1})\n }\n DBUpdate(\"@1sections\", $Id, {\"title\":$Title,\"status\":$Status,\"urlname\":$Urlname,\"page\":$Page})\n }\n}", "Type": "contracts" }, { "Name": "EditTable", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract EditTable {\n data {\n Name string\n InsertPerm string\n UpdatePerm string\n ReadPerm string\n NewColumnPerm string\n }\n\n conditions {\n if !$InsertPerm {\n info LangRes(\"@1insert_condition_empty\", \"en\")\n }\n if !$UpdatePerm {\n info LangRes(\"@1update_condition_empty\", \"en\")\n }\n if !$ReadPerm {\n info LangRes(\"@1read_condition_empty\", \"en\")\n }\n if !$NewColumnPerm {\n info LangRes(\"@1new_column_condition_empty\", \"en\")\n }\n\n var permissions map\n permissions[\"insert\"] = $InsertPerm\n permissions[\"update\"] = $UpdatePerm\n permissions[\"read\"] = $ReadPerm\n permissions[\"new_column\"] = $NewColumnPerm\n $Permissions = permissions\n TableConditions($Name, \"\", JSONEncode($Permissions))\n }\n\n action {\n PermTable($Name, JSONEncode($Permissions))\n }\n}", + "Value": "contract EditTable {\n data {\n Name string\n InsertPerm string\n UpdatePerm string\n ReadPerm string\n NewColumnPerm string\n }\n\n conditions {\n DeveloperCondition()\n\n if !$InsertPerm {\n info LangRes(\"@1insert_condition_empty\", \"en\")\n }\n if !$UpdatePerm {\n info LangRes(\"@1update_condition_empty\", \"en\")\n }\n if !$ReadPerm {\n info LangRes(\"@1read_condition_empty\", \"en\")\n }\n if !$NewColumnPerm {\n info LangRes(\"@1new_column_condition_empty\", \"en\")\n }\n\n var permissions map\n permissions[\"insert\"] = $InsertPerm\n permissions[\"update\"] = $UpdatePerm\n permissions[\"read\"] = $ReadPerm\n permissions[\"new_column\"] = $NewColumnPerm\n $Permissions = permissions\n TableConditions($Name, \"\", JSONEncode($Permissions))\n }\n\n action {\n PermTable($Name, JSONEncode($Permissions))\n }\n}", "Type": "contracts" }, { - "Name": "UploadBinary", + "Name": "UploadFile", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract UploadBinary {\n data {\n ApplicationId int\n Name string\n Data bytes\n DataMimeType string \"optional\"\n }\n\n conditions {\n $Id = Int(DBFind(\"@1binaries\").Columns(\"id\").Where({\"app_id\": $ApplicationId, \"member_id\": $key_id, \"name\": $Name, \"ecosystem\": $ecosystem_id}).One(\"id\"))\n\n if $Id == 0 {\n if $ApplicationId == 0 {\n warning LangRes(\"@1aid_cannot_zero\", \"en\")\n }\n }\n }\n\n action {\n var hash string\n hash = Hash($Data)\n\n if $DataMimeType == \"\" {\n $DataMimeType = \"application/octet-stream\"\n }\n\n if $Id != 0 {\n DBUpdate(\"@1binaries\", $Id, {\"data\": $Data, \"hash\": hash, \"mime_type\": $DataMimeType})\n } else {\n $Id = DBInsert(\"@1binaries\", {\"app_id\": $ApplicationId, \"member_id\": $key_id, \"name\": $Name, \"data\": $Data, \"hash\": hash, \"mime_type\": $DataMimeType, \"ecosystem\": $ecosystem_id})\n }\n\n $result = $Id\n }\n}\n", + "Value": "contract UploadFile {\n data {\n ApplicationId int\n Data file\n Name string \"optional\"\n }\n\n conditions {\n if $Name == \"\" {\n $Name = $Data[\"Name\"]\n }\n $Body = $Data[\"Body\"]\n $DataMimeType = $Data[\"MimeType\"]\n }\n\n action {\n $Id = @1UploadBinary(\"ApplicationId,Name,Data,DataMimeType\", $ApplicationId, $Name, $Body, $DataMimeType)\n $result = $Id\n }\n}", "Type": "contracts" }, { "Name": "ExportNewApp", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract ExportNewApp {\n data {\n ApplicationId int\n }\n\n conditions {\n $app_map = DBFind(\"@1applications\").Columns(\"id,name\").Where({\"id\": $ApplicationId, \"ecosystem\": $ecosystem_id}).Row()\n if !$app_map{\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n }\n\n action {\n var i int pages_array menu_name_array menu_id_array pages_ret array\n // Search menu\n pages_ret = DBFind(\"@1pages\").Where({\"app_id\": $ApplicationId, \"ecosystem\": $ecosystem_id})\n while i < Len(pages_ret) {\n var page_map map\n page_map = pages_ret[i]\n\n pages_array = Append(pages_array, Sprintf(\"%v\", Str(page_map[\"menu\"])))\n i = i + 1\n }\n\n if Len(pages_array) > 0 {\n var where_for_menu map\n where_for_menu[\"name\"] = {\"$in\" : pages_array}\n\n i = 0\n var menu_ret array\n menu_ret = DBFind(\"@1menu\").Where(where_for_menu)\n while i < Len(menu_ret) {\n var menu_map map\n menu_map = menu_ret[i]\n\n menu_name_array = Append(menu_name_array, Str(menu_map[\"name\"]))\n menu_id_array = Append(menu_id_array, Str(menu_map[\"id\"]))\n i = i + 1\n }\n }\n\n // Creating settings\n var value map\n value[\"app_id\"] = Str($ApplicationId)\n value[\"app_name\"] = Str($app_map[\"name\"])\n\n if Len(menu_name_array) > 0 {\n value[\"menu_id\"] = Str(Join(menu_id_array, \", \"))\n value[\"menu_name\"] = Str(Join(menu_name_array, \", \"))\n value[\"count_menu\"] = Str(Len(menu_name_array))\n } else {\n value[\"menu_id\"] = \"0\"\n value[\"menu_name\"] = \"\"\n value[\"count_menu\"] = \"0\"\n }\n\n $buffer_id = DBFind(\"@1buffer_data\").Where({\"member_id\": $key_id, \"key\": \"export\", \"ecosystem\": $ecosystem_id}).One(\"id\")\n if !$buffer_id {\n DBInsert(\"@1buffer_data\", {\"member_id\":$key_id,\"key\": \"export\", \"value\": value})\n } else {\n DBUpdate(\"@1buffer_data\", Int($buffer_id), {\"value\": value})\n }\n }\n}", + "Value": "contract ExportNewApp {\n data {\n ApplicationId int\n }\n\n conditions {\n DeveloperCondition()\n\n $app_map = DBFind(\"@1applications\").Columns(\"id,name\").Where({\"id\": $ApplicationId, \"ecosystem\": $ecosystem_id}).Row()\n if !$app_map{\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n }\n\n action {\n var i int pages_array menu_name_array menu_id_array pages_ret array\n // Search menu\n pages_ret = DBFind(\"@1pages\").Where({\"app_id\": $ApplicationId, \"ecosystem\": $ecosystem_id})\n while i < Len(pages_ret) {\n var page_map map\n page_map = pages_ret[i]\n\n pages_array = Append(pages_array, Sprintf(\"%v\", Str(page_map[\"menu\"])))\n i = i + 1\n }\n\n if Len(pages_array) > 0 {\n var where_for_menu map\n where_for_menu[\"name\"] = {\"$in\": pages_array}\n\n i = 0\n var menu_ret array\n menu_ret = DBFind(\"@1menu\").Where(where_for_menu)\n while i < Len(menu_ret) {\n var menu_map map\n menu_map = menu_ret[i]\n\n menu_name_array = Append(menu_name_array, Str(menu_map[\"name\"]))\n menu_id_array = Append(menu_id_array, Str(menu_map[\"id\"]))\n i = i + 1\n }\n }\n\n // Creating settings\n var value map\n value[\"app_id\"] = Str($ApplicationId)\n value[\"app_name\"] = Str($app_map[\"name\"])\n\n if Len(menu_name_array) > 0 {\n value[\"menu_id\"] = Str(Join(menu_id_array, \", \"))\n value[\"menu_name\"] = Str(Join(menu_name_array, \", \"))\n value[\"count_menu\"] = Str(Len(menu_name_array))\n } else {\n value[\"menu_id\"] = \"0\"\n value[\"menu_name\"] = \"\"\n value[\"count_menu\"] = \"0\"\n }\n\n @1BufferManager(\"Action,Key,Val\", \"set\", \"export\", JSONEncode(value))\n }\n}", "Type": "contracts" }, { "Name": "Import", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract Import {\n data {\n Data string\n }\n\n conditions {\n $ApplicationId = 0\n var app_map map\n app_map = DBFind(\"@1buffer_data\").Columns(\"value->app_name\").Where({\"key\": \"import_info\", \"member_id\": $key_id, \"ecosystem\": $ecosystem_id}).Row()\n\n if app_map {\n var app_id int ival string\n ival = Str(app_map[\"value.app_name\"])\n app_id = DBFind(\"@1applications\").Columns(\"id\").Where({\"name\": ival, \"ecosystem\": $ecosystem_id}).One(\"id\")\n if app_id {\n $ApplicationId = Int(app_id)\n }\n }\n }\n\n action {\n var editors, creators map\n editors[\"pages\"] = \"EditPage\"\n editors[\"blocks\"] = \"EditBlock\"\n editors[\"menu\"] = \"EditMenu\"\n editors[\"app_params\"] = \"EditAppParam\"\n editors[\"languages\"] = \"EditLang\"\n editors[\"contracts\"] = \"EditContract\"\n editors[\"tables\"] = \"\" // nothing\n\n creators[\"pages\"] = \"NewPage\"\n creators[\"blocks\"] = \"NewBlock\"\n creators[\"menu\"] = \"NewMenu\"\n creators[\"app_params\"] = \"NewAppParam\"\n creators[\"languages\"] = \"NewLang\"\n creators[\"contracts\"] = \"NewContract\"\n creators[\"tables\"] = \"NewTable\"\n\n var dataImport array\n dataImport = JSONDecode($Data)\n var i int\n while i < Len(dataImport) {\n var item cdata map type name string\n cdata = dataImport[i]\n if cdata {\n cdata[\"ApplicationId\"] = $ApplicationId\n type = cdata[\"Type\"]\n name = cdata[\"Name\"]\n // Println(Sprintf(\"import %v: %v\", type, cdata[\"Name\"]))\n\n var tbl string\n tbl = \"@1\" + Str(type)\n if type == \"app_params\" {\n item = DBFind(tbl).Where({\"name\": name, \"ecosystem\": $ecosystem_id, \"app_id\": $ApplicationId}).Row()\n } else {\n item = DBFind(tbl).Where({\"name\": name, \"ecosystem\": $ecosystem_id}).Row()\n }\n var contractName string\n if item {\n contractName = editors[type]\n cdata[\"Id\"] = Int(item[\"id\"])\n if type == \"contracts\" {\n if item[\"conditions\"] == \"false\" {\n // ignore updating impossible\n contractName = \"\"\n }\n } elif type == \"menu\" {\n var menu menuItem string\n menu = Replace(item[\"value\"], \" \", \"\")\n menu = Replace(menu, \"\\n\", \"\")\n menu = Replace(menu, \"\\r\", \"\")\n menuItem = Replace(cdata[\"Value\"], \" \", \"\")\n menuItem = Replace(menuItem, \"\\n\", \"\")\n menuItem = Replace(menuItem, \"\\r\", \"\")\n if Contains(menu, menuItem) {\n // ignore repeated\n contractName = \"\"\n } else {\n cdata[\"Value\"] = item[\"value\"] + \"\\n\" + cdata[\"Value\"]\n }\n }\n } else {\n contractName = creators[type]\n }\n\n if contractName != \"\" {\n CallContract(contractName, cdata)\n }\n }\n i = i + 1\n }\n // Println(Sprintf(\"> time: %v\", $time))\n }\n}", + "Value": "contract Import {\n data {\n Data string\n }\n\n conditions {\n DeveloperCondition()\n\n $ApplicationId = 0\n var app_map map\n app_map = DBFind(\"@1buffer_data\").Columns(\"value->app_name\").Where({\"key\": \"import_info\", \"account\": $account_id, \"ecosystem\": $ecosystem_id}).Row()\n\n if app_map {\n var app_id int ival string\n ival = Str(app_map[\"value.app_name\"])\n app_id = DBFind(\"@1applications\").Where({\"name\": ival, \"ecosystem\": $ecosystem_id}).One(\"id\")\n if app_id {\n $ApplicationId = Int(app_id)\n }\n }\n }\n\n action {\n var editors, creators map\n editors[\"pages\"] = \"EditPage\"\n editors[\"blocks\"] = \"EditBlock\"\n editors[\"menu\"] = \"EditMenu\"\n editors[\"app_params\"] = \"EditAppParam\"\n editors[\"languages\"] = \"EditLang\"\n editors[\"contracts\"] = \"EditContract\"\n editors[\"tables\"] = \"\" // nothing\n\n creators[\"pages\"] = \"NewPage\"\n creators[\"blocks\"] = \"NewBlock\"\n creators[\"menu\"] = \"NewMenu\"\n creators[\"app_params\"] = \"NewAppParam\"\n creators[\"languages\"] = \"NewLang\"\n creators[\"contracts\"] = \"NewContract\"\n creators[\"tables\"] = \"NewTable\"\n\n var dataImport array\n dataImport = JSONDecode($Data)\n var i int\n while i < Len(dataImport) {\n var item cdata map type name string\n cdata = dataImport[i]\n if cdata {\n cdata[\"ApplicationId\"] = $ApplicationId\n type = cdata[\"Type\"]\n name = cdata[\"Name\"]\n // Println(Sprintf(\"import %v: %v\", type, cdata[\"Name\"]))\n\n var tbl string\n tbl = \"@1\" + Str(type)\n if type == \"app_params\" {\n item = DBFind(tbl).Where({\"name\": name, \"ecosystem\": $ecosystem_id, \"app_id\": $ApplicationId}).Row()\n } else {\n item = DBFind(tbl).Where({\"name\": name, \"ecosystem\": $ecosystem_id}).Row()\n }\n var contractName string\n if item {\n contractName = editors[type]\n cdata[\"Id\"] = Int(item[\"id\"])\n if type == \"contracts\" {\n if item[\"conditions\"] == \"false\" {\n // ignore updating impossible\n contractName = \"\"\n }\n } elif type == \"menu\" {\n var menu menuItem string\n menu = Replace(item[\"value\"], \" \", \"\")\n menu = Replace(menu, \"\\n\", \"\")\n menu = Replace(menu, \"\\r\", \"\")\n menuItem = Replace(cdata[\"Value\"], \" \", \"\")\n menuItem = Replace(menuItem, \"\\n\", \"\")\n menuItem = Replace(menuItem, \"\\r\", \"\")\n if Contains(menu, menuItem) {\n // ignore repeated\n contractName = \"\"\n } else {\n cdata[\"Value\"] = item[\"value\"] + \"\\n\" + cdata[\"Value\"]\n }\n }\n } else {\n contractName = creators[type]\n }\n\n if contractName != \"\" {\n CallContract(contractName, cdata)\n }\n }\n i = i + 1\n }\n // Println(Sprintf(\"> time: %v\", $time))\n }\n}", "Type": "contracts" }, { "Name": "ImportUpload", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract ImportUpload {\n data {\n Data file\n }\n\n conditions {\n $Data = BytesToString($Data[\"Body\"])\n $limit = 10 // data piece size of import\n }\n\n action {\n // init buffer_data, cleaning old buffer\n var initJson map\n $import_id = DBFind(\"@1buffer_data\").Where({\"member_id\": $key_id, \"key\": \"import\", \"ecosystem\": $ecosystem_id}).One(\"id\")\n if $import_id {\n $import_id = Int($import_id)\n DBUpdate(\"@1buffer_data\", $import_id, {\"value\": initJson})\n } else {\n $import_id = DBInsert(\"@1buffer_data\", {\"member_id\": $key_id, \"key\": \"import\", \"value\": initJson, \"ecosystem\": $ecosystem_id})\n }\n\n $info_id = DBFind(\"@1buffer_data\").Where({\"member_id\": $key_id, \"key\": \"import_info\", \"ecosystem\": $ecosystem_id}).One(\"id\")\n if $info_id {\n $info_id = Int($info_id)\n DBUpdate(\"@1buffer_data\", $info_id, {\"value\": initJson})\n } else {\n $info_id = DBInsert(\"@1buffer_data\", {\"member_id\": $key_id,\"key\": \"import_info\", \"value\": initJson, \"ecosystem\": $ecosystem_id})\n }\n\n var input map arrData array\n input = JSONDecode($Data)\n arrData = input[\"data\"]\n\n var pages_arr blocks_arr menu_arr parameters_arr languages_arr contracts_arr tables_arr array\n\n // IMPORT INFO\n var i lenArrData int item map\n lenArrData = Len(arrData)\n while i < lenArrData {\n item = arrData[i]\n\n if item[\"Type\"] == \"pages\" {\n pages_arr = Append(pages_arr, item[\"Name\"])\n } elif item[\"Type\"] == \"blocks\" {\n blocks_arr = Append(blocks_arr, item[\"Name\"])\n } elif item[\"Type\"] == \"menu\" {\n menu_arr = Append(menu_arr, item[\"Name\"])\n } elif item[\"Type\"] == \"app_params\" {\n parameters_arr = Append(parameters_arr, item[\"Name\"])\n } elif item[\"Type\"] == \"languages\" {\n languages_arr = Append(languages_arr, item[\"Name\"])\n } elif item[\"Type\"] == \"contracts\" {\n contracts_arr = Append(contracts_arr, item[\"Name\"])\n } elif item[\"Type\"] == \"tables\" {\n tables_arr = Append(tables_arr, item[\"Name\"])\n }\n\n i = i + 1\n }\n\n var inf map\n inf[\"app_name\"] = input[\"name\"]\n inf[\"pages\"] = Join(pages_arr, \", \")\n inf[\"pages_count\"] = Len(pages_arr)\n inf[\"blocks\"] = Join(blocks_arr, \", \")\n inf[\"blocks_count\"] = Len(blocks_arr)\n inf[\"menu\"] = Join(menu_arr, \", \")\n inf[\"menu_count\"] = Len(menu_arr)\n inf[\"parameters\"] = Join(parameters_arr, \", \")\n inf[\"parameters_count\"] = Len(parameters_arr)\n inf[\"languages\"] = Join(languages_arr, \", \")\n inf[\"languages_count\"] = Len(languages_arr)\n inf[\"contracts\"] = Join(contracts_arr, \", \")\n inf[\"contracts_count\"] = Len(contracts_arr)\n inf[\"tables\"] = Join(tables_arr, \", \")\n inf[\"tables_count\"] = Len(tables_arr)\n\n if 0 == inf[\"pages_count\"] + inf[\"blocks_count\"] + inf[\"menu_count\"] + inf[\"parameters_count\"] + inf[\"languages_count\"] + inf[\"contracts_count\"] + inf[\"tables_count\"] {\n warning \"Invalid or empty import file\"\n }\n\n // IMPORT DATA\n // the contracts is imported in one piece, the rest is cut under the $limit\n var sliced contracts array\n i = 0\n while i < lenArrData {\n var items array l int item map\n while l < $limit && (i + l < lenArrData) {\n item = arrData[i + l]\n if item[\"Type\"] == \"contracts\" {\n contracts = Append(contracts, item)\n } else {\n items = Append(items, item)\n }\n l = l + 1\n }\n var batch map\n batch[\"Data\"] = JSONEncode(items)\n sliced = Append(sliced, batch)\n i = i + $limit\n }\n if Len(contracts) > 0 {\n var batch map\n batch[\"Data\"] = JSONEncode(contracts)\n sliced = Append(sliced, batch)\n }\n input[\"data\"] = sliced\n\n // storing\n DBUpdate(\"@1buffer_data\", $import_id, {\"value\": input})\n DBUpdate(\"@1buffer_data\", $info_id, {\"value\": inf})\n\n var name string\n name = Str(input[\"name\"])\n var cndns string\n cndns = Str(input[\"conditions\"])\n\n if !DBFind(\"@1applications\").Columns(\"id\").Where({\"name\": name, \"ecosystem\": $ecosystem_id}).One(\"id\") {\n DBInsert(\"@1applications\", {\"name\": name, \"conditions\": cndns, \"ecosystem\": $ecosystem_id})\n }\n }\n}", + "Value": "contract ImportUpload {\n data {\n Data file\n }\n\n conditions {\n DeveloperCondition()\n\n $Data = BytesToString($Data[\"Body\"])\n $limit = 10 // data piece size of import\n }\n\n action {\n // init buffer_data, cleaning old buffer\n @1BufferManager(\"Action,Key,Val\", \"clean\", \"import\", \"\")\n @1BufferManager(\"Action,Key,Val\", \"clean\", \"import_info\", \"\")\n\n var input map arrData array\n input = JSONDecode($Data)\n arrData = input[\"data\"]\n\n var pages_arr blocks_arr menu_arr parameters_arr languages_arr contracts_arr tables_arr array\n\n // IMPORT INFO\n var i lenArrData int item map\n lenArrData = Len(arrData)\n while i < lenArrData {\n item = arrData[i]\n\n if item[\"Type\"] == \"pages\" {\n pages_arr = Append(pages_arr, item[\"Name\"])\n } elif item[\"Type\"] == \"blocks\" {\n blocks_arr = Append(blocks_arr, item[\"Name\"])\n } elif item[\"Type\"] == \"menu\" {\n menu_arr = Append(menu_arr, item[\"Name\"])\n } elif item[\"Type\"] == \"app_params\" {\n parameters_arr = Append(parameters_arr, item[\"Name\"])\n } elif item[\"Type\"] == \"languages\" {\n languages_arr = Append(languages_arr, item[\"Name\"])\n } elif item[\"Type\"] == \"contracts\" {\n contracts_arr = Append(contracts_arr, item[\"Name\"])\n } elif item[\"Type\"] == \"tables\" {\n tables_arr = Append(tables_arr, item[\"Name\"])\n }\n\n i = i + 1\n }\n\n var inf map\n inf[\"app_name\"] = input[\"name\"]\n inf[\"pages\"] = Join(pages_arr, \", \")\n inf[\"pages_count\"] = Len(pages_arr)\n inf[\"blocks\"] = Join(blocks_arr, \", \")\n inf[\"blocks_count\"] = Len(blocks_arr)\n inf[\"menu\"] = Join(menu_arr, \", \")\n inf[\"menu_count\"] = Len(menu_arr)\n inf[\"parameters\"] = Join(parameters_arr, \", \")\n inf[\"parameters_count\"] = Len(parameters_arr)\n inf[\"languages\"] = Join(languages_arr, \", \")\n inf[\"languages_count\"] = Len(languages_arr)\n inf[\"contracts\"] = Join(contracts_arr, \", \")\n inf[\"contracts_count\"] = Len(contracts_arr)\n inf[\"tables\"] = Join(tables_arr, \", \")\n inf[\"tables_count\"] = Len(tables_arr)\n\n if 0 == inf[\"pages_count\"] + inf[\"blocks_count\"] + inf[\"menu_count\"] + inf[\"parameters_count\"] + inf[\"languages_count\"] + inf[\"contracts_count\"] + inf[\"tables_count\"] {\n warning \"Invalid or empty import file\"\n }\n\n // IMPORT DATA\n // the contracts is imported in one piece, the rest is cut under the $limit\n var sliced contracts array\n i = 0\n while i < lenArrData {\n var items array l int item map\n while l < $limit && (i + l < lenArrData) {\n item = arrData[i + l]\n if item[\"Type\"] == \"contracts\" {\n contracts = Append(contracts, item)\n } else {\n items = Append(items, item)\n }\n l = l + 1\n }\n var batch map\n batch[\"Data\"] = JSONEncode(items)\n sliced = Append(sliced, batch)\n i = i + $limit\n }\n if Len(contracts) > 0 {\n var batch map\n batch[\"Data\"] = JSONEncode(contracts)\n sliced = Append(sliced, batch)\n }\n input[\"data\"] = sliced\n\n // storing\n @1BufferManager(\"Action,Key,Val\", \"set\", \"import\", JSONEncode(input))\n @1BufferManager(\"Action,Key,Val\", \"set\", \"import_info\", JSONEncode(inf))\n\n var name string\n name = Str(input[\"name\"])\n var cndns string\n cndns = Str(input[\"conditions\"])\n\n if !DBFind(\"@1applications\").Where({\"name\": name, \"ecosystem\": $ecosystem_id}).One(\"id\") {\n DBInsert(\"@1applications\", {\"name\": name, \"conditions\": cndns, \"ecosystem\": $ecosystem_id})\n }\n }\n}", "Type": "contracts" }, { "Name": "ItemChangeAppId", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract ItemChangeAppId {\n data {\n Table string\n AppId int\n Id int\n }\n\n conditions {\n if !DBFind($Table).Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row() {\n warning LangRes(\"@1item_not_found\", \"en\")\n }\n }\n\n action {\n DBUpdate($Table, $Id, {\"app_id\": $AppId})\n }\n}", + "Value": "contract ItemChangeAppId {\n data {\n Table string\n AppId int\n Id int\n }\n\n conditions {\n DeveloperCondition()\n\n if !DBFind($Table).Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row() {\n warning LangRes(\"@1item_not_found\", \"en\")\n }\n }\n\n action {\n DBUpdate($Table, $Id, {\"app_id\": $AppId})\n }\n}", "Type": "contracts" }, { "Name": "MainCondition", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract MainCondition {\n conditions {\n if EcosysParam(\"founder_account\") != $key_id {\n warning \"MainCondition: Sorry, you do not have access to this action\"\n }\n }\n}", + "Value": "// This contract is used to set \"Founder\" rights.\n\ncontract MainCondition {\n conditions {\n // check for Founder\n if EcosysParam(\"founder_account\") != AddressToId($account_id) {\n warning \"MainCondition: Sorry, you do not have access to this action\"\n }\n }\n}", "Type": "contracts" }, { "Name": "NewAppParam", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract NewAppParam {\n data {\n ApplicationId int\n Name string\n Value string\n Conditions string\n }\n\n conditions {\n ValidateCondition($Conditions, $ecosystem_id)\n\n if $ApplicationId == 0 {\n warning LangRes(\"@1aid_cannot_zero\", \"en\")\n }\n\n if DBFind(\"@1app_params\").Columns(\"id\").Where({\"name\": $Name, \"ecosystem\": $ecosystem_id, \"app_id\": $ApplicationId}).One(\"id\") {\n warning Sprintf(LangRes(\"@1template_appparam_exists\", \"en\"), $Name)\n }\n }\n\n action {\n DBInsert(\"@1app_params\", {\"app_id\": $ApplicationId, \"name\": $Name, \"value\": $Value, \"conditions\": $Conditions, \"ecosystem\": $ecosystem_id})\n }\n}", + "Value": "contract NewAppParam {\n data {\n ApplicationId int\n Name string\n Value string\n Conditions string\n }\n\n conditions {\n DeveloperCondition()\n\n ValidateCondition($Conditions, $ecosystem_id)\n\n if $ApplicationId == 0 {\n warning LangRes(\"@1aid_cannot_zero\", \"en\")\n }\n\n if DBFind(\"@1app_params\").Where({\"name\": $Name, \"ecosystem\": $ecosystem_id, \"app_id\": $ApplicationId}).One(\"id\") {\n warning Sprintf(LangRes(\"@1template_appparam_exists\", \"en\"), $Name)\n }\n }\n\n action {\n DBInsert(\"@1app_params\", {\"app_id\": $ApplicationId, \"name\": $Name, \"value\": $Value, \"conditions\": $Conditions, \"ecosystem\": $ecosystem_id})\n }\n}", "Type": "contracts" }, { "Name": "AppInstall", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract AppInstall {\n data {\n ApplicationId int\n }\n\n conditions {\n $check_app = DBFind(\"@1applications\").Columns(\"id,ecosystem,name,conditions\").Where({\"id\": $ApplicationId, \"ecosystem\": 1}).Row()\n if !$check_app[\"id\"] {\n warning LangRes(\"@1item_not_found\", \"en\")\n }\n\n $check_config = DBFind(\"@1app_params\").Where({\"app_id\": $ApplicationId, \"ecosystem\": 1, \"name\": \"config\"}).Row()\n if !$check_config[\"id\"] {\n warning LangRes(\"@1config_not_find\", \"en\")\n }\n $application_config = Str($check_config[\"value\"])\n\n var config_map map\n config_map = JSONDecode($application_config)\n $app_name = Str(config_map[\"name\"])\n $app_condition = Str(config_map[\"conditions\"])\n $app_data = config_map[\"data\"]\n }\n\n action {\n //new_app\n if !DBFind(\"@1applications\").Columns(\"id,ecosystem,name\").Where({\"name\": $app_name, \"ecosystem\": $ecosystem_id}).One(\"id\") {\n @1NewApplication(\"Name,Conditions\", $app_name, $app_condition)\n }\n\n //buffer data for import contract\n var app_ins map\n app_ins[\"app_name\"] = $app_name\n\n $import_id = DBFind(\"@1buffer_data\").Where({\"member_id\": $key_id, \"key\": \"import_info\", \"ecosystem\": $ecosystem_id}).One(\"id\")\n if $import_id {\n $import_id = Int($import_id)\n DBUpdate(\"@1buffer_data\", $import_id, {\"value\": app_ins})\n } else {\n DBInsert(\"@1buffer_data\", {\"member_id\": $key_id, \"key\": \"import_info\", \"value\": app_ins, \"ecosystem\": $ecosystem_id})\n }\n\n //import\n var i int\n while i < Len($app_data) {\n $one_item = $app_data[i]\n $one_item_arr = \"[\" + JSONEncode($one_item) + \"]\"\n Import(\"Data\", $one_item_arr)\n i = i + 1\n }\n }\n}", + "Value": "contract AppInstall {\n data {\n ApplicationId int\n }\n\n conditions {\n DeveloperCondition()\n\n $check_app = DBFind(\"@1applications\").Columns(\"id,ecosystem,name,conditions\").Where({\"id\": $ApplicationId, \"ecosystem\": 1}).Row()\n if !$check_app[\"id\"] {\n warning LangRes(\"@1item_not_found\", \"en\")\n }\n\n $check_config = DBFind(\"@1app_params\").Where({\"app_id\": $ApplicationId, \"ecosystem\": 1, \"name\": \"config\"}).Row()\n if !$check_config[\"id\"] {\n warning LangRes(\"@1config_not_find\", \"en\")\n }\n $application_config = Str($check_config[\"value\"])\n\n var config_map map\n config_map = JSONDecode($application_config)\n $app_name = Str(config_map[\"name\"])\n $app_condition = Str(config_map[\"conditions\"])\n $app_data = config_map[\"data\"]\n }\n\n action {\n //new_app\n if !DBFind(\"@1applications\").Columns(\"id,ecosystem,name\").Where({\"name\": $app_name, \"ecosystem\": $ecosystem_id}).One(\"id\") {\n @1NewApplication(\"Name,Conditions\", $app_name, $app_condition)\n }\n\n //buffer data for import contract\n var app_ins map\n app_ins[\"app_name\"] = $app_name\n\n @1BufferManager(\"Action,Key,Val\", \"set\", \"import_info\", JSONEncode(app_ins))\n\n //import\n var i int\n while i < Len($app_data) {\n $one_item = $app_data[i]\n $one_item_arr = \"[\" + JSONEncode($one_item) + \"]\"\n Import(\"Data\", $one_item_arr)\n i = i + 1\n }\n }\n}", "Type": "contracts" }, { @@ -550,37 +556,37 @@ { "Name": "NewBlock", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract NewBlock {\n data {\n ApplicationId int\n Name string\n Value string\n Conditions string\n }\n\n conditions {\n ValidateCondition($Conditions, $ecosystem_id)\n\n if $ApplicationId == 0 {\n warning LangRes(\"@1aid_cannot_zero\", \"en\")\n }\n\n if DBFind(\"@1blocks\").Columns(\"id\").Where({\"name\": $Name, \"ecosystem\": $ecosystem_id}).One(\"id\") {\n warning Sprintf(LangRes(\"@1template_block_exists\", \"en\"), $Name)\n }\n }\n\n action {\n DBInsert(\"@1blocks\", {\"name\": $Name, \"value\": $Value, \"conditions\": $Conditions, \"app_id\": $ApplicationId, \"ecosystem\": $ecosystem_id})\n }\n}", + "Value": "contract NewBlock {\n data {\n ApplicationId int\n Name string\n Value string\n Conditions string\n }\n\n conditions {\n DeveloperCondition()\n\n ValidateCondition($Conditions, $ecosystem_id)\n\n if $ApplicationId == 0 {\n warning LangRes(\"@1aid_cannot_zero\", \"en\")\n }\n\n if DBFind(\"@1blocks\").Where({\"name\": $Name, \"ecosystem\": $ecosystem_id}).One(\"id\") {\n warning Sprintf(LangRes(\"@1template_block_exists\", \"en\"), $Name)\n }\n }\n\n action {\n DBInsert(\"@1blocks\", {\"name\": $Name, \"value\": $Value, \"conditions\": $Conditions, \"app_id\": $ApplicationId, \"ecosystem\": $ecosystem_id})\n }\n}", "Type": "contracts" }, { "Name": "NewColumn", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract NewColumn {\n data {\n TableName string\n Name string\n Type string\n UpdatePerm string\n ReadPerm string\n }\n\n conditions {\n var permissions map\n permissions[\"update\"] = $UpdatePerm\n permissions[\"read\"] = $ReadPerm\n $Permissions = permissions\n ColumnCondition($TableName, $Name, $Type, JSONEncode($Permissions))\n }\n\n action {\n CreateColumn($TableName, $Name, $Type, JSONEncode($Permissions))\n }\n}", + "Value": "contract NewColumn {\n data {\n TableName string\n Name string\n Type string\n UpdatePerm string\n ReadPerm string\n }\n\n conditions {\n DeveloperCondition()\n\n var permissions map\n permissions[\"update\"] = $UpdatePerm\n permissions[\"read\"] = $ReadPerm\n $Permissions = permissions\n ColumnCondition($TableName, $Name, $Type, JSONEncode($Permissions))\n }\n\n action {\n CreateColumn($TableName, $Name, $Type, JSONEncode($Permissions))\n }\n}", "Type": "contracts" }, { "Name": "NewContract", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract NewContract {\n data {\n ApplicationId int\n Value string\n Conditions string\n TokenEcosystem int \"optional\"\n }\n\n conditions {\n ValidateCondition($Conditions,$ecosystem_id)\n\n if $ApplicationId == 0 {\n warning LangRes(\"@1aid_cannot_zero\", \"en\")\n }\n\n $contract_name = ContractName($Value)\n\n if !$contract_name {\n warning LangRes(\"@1contract_name_missing\", \"en\")\n }\n\n if !$TokenEcosystem {\n $TokenEcosystem = 1\n } else {\n if !SysFuel($TokenEcosystem) {\n warning Sprintf(LangRes(\"@1template_eco_isnot_system\", \"en\"), $TokenEcosystem)\n }\n }\n }\n\n action {\n $result = CreateContract($contract_name, $Value, $Conditions, $TokenEcosystem, $ApplicationId)\n }\n}", + "Value": "contract NewContract {\n data {\n ApplicationId int\n Value string\n Conditions string\n TokenEcosystem int \"optional\"\n }\n\n conditions {\n DeveloperCondition()\n\n ValidateCondition($Conditions,$ecosystem_id)\n\n if $ApplicationId == 0 {\n warning LangRes(\"@1aid_cannot_zero\", \"en\")\n }\n\n $contract_name = ContractName($Value)\n\n if !$contract_name {\n warning LangRes(\"@1contract_name_missing\", \"en\")\n }\n\n if !$TokenEcosystem {\n $TokenEcosystem = 1\n } else {\n if !SysFuel($TokenEcosystem) {\n warning Sprintf(LangRes(\"@1template_eco_isnot_system\", \"en\"), $TokenEcosystem)\n }\n }\n }\n\n action {\n $result = CreateContract($contract_name, $Value, $Conditions, $TokenEcosystem, $ApplicationId)\n }\n}", "Type": "contracts" }, { "Name": "NewDelayedContract", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract NewDelayedContract {\n data {\n Contract string\n EveryBlock int\n Conditions string\n BlockID int \"optional\"\n Limit int \"optional\"\n }\n\n conditions {\n ValidateCondition($Conditions, $ecosystem_id)\n\n if !HasPrefix($Contract, \"@\") {\n $Contract = \"@\" + Str($ecosystem_id) + $Contract\n }\n\n if GetContractByName($Contract) == 0 {\n warning Sprintf(LangRes(\"@1template_unknown_contract\", \"en\"), $Contract)\n }\n\n if $BlockID == 0 {\n $BlockID = $block + $EveryBlock\n }\n\n if $BlockID <= $block {\n warning LangRes(\"@1blockid_must_greater\", \"en\")\n }\n }\n\n action {\n DBInsert(\"@1delayed_contracts\", {\"contract\": $Contract, \"key_id\": $key_id, \"block_id\": $BlockID, \"every_block\": $EveryBlock, \"limit\": $Limit, \"conditions\": $Conditions})\n }\n}", + "Value": "contract NewDelayedContract {\n data {\n Contract string\n EveryBlock int\n Conditions string\n BlockID int \"optional\"\n Limit int \"optional\"\n }\n\n conditions {\n DeveloperCondition()\n\n ValidateCondition($Conditions, $ecosystem_id)\n\n if !HasPrefix($Contract, \"@\") {\n $Contract = \"@\" + Str($ecosystem_id) + $Contract\n }\n\n if GetContractByName($Contract) == 0 {\n warning Sprintf(LangRes(\"@1template_unknown_contract\", \"en\"), $Contract)\n }\n\n if $BlockID == 0 {\n $BlockID = $block + $EveryBlock\n }\n\n if $BlockID <= $block {\n warning LangRes(\"@1blockid_must_greater\", \"en\")\n }\n }\n\n action {\n var account_key int\n account_key = AddressToId($account_id)\n DBInsert(\"@1delayed_contracts\", {\"contract\": $Contract, \"key_id\": account_key, \"block_id\": $BlockID, \"every_block\": $EveryBlock, \"limit\": $Limit, \"conditions\": $Conditions})\n }\n}", "Type": "contracts" }, { "Name": "NewEcosystem", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract NewEcosystem {\n data {\n Name string\n }\n\n conditions {\n if !$Name {\n warning LangRes(\"@1ecosystem_name_empty\", \"en\")\n }\n }\n\n action {\n $result = CreateEcosystem($key_id, $Name)\n }\n}", + "Value": "contract NewEcosystem {\n data {\n Name string\n }\n\n conditions {\n DeveloperCondition()\n\n if !$Name {\n warning LangRes(\"@1ecosystem_name_empty\", \"en\")\n }\n }\n\n action {\n var account_key int\n account_key = AddressToId($account_id)\n $result = CreateEcosystem(account_key, $Name)\n }\n}", "Type": "contracts" }, { "Name": "NewLang", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract NewLang {\n data {\n Name string\n Trans string\n }\n\n conditions {\n EvalCondition(\"@1parameters\", \"changing_language\", \"value\")\n if DBFind(\"@1languages\").Columns(\"id\").Where({\"name\": $Name, \"ecosystem\": $ecosystem_id}).One(\"id\") {\n warning Sprintf(LangRes(\"@1template_langres_exists\", \"en\"), $Name)\n }\n }\n\n action {\n CreateLanguage($Name, $Trans)\n }\n}", + "Value": "contract NewLang {\n data {\n Name string\n Trans string\n }\n\n conditions {\n DeveloperCondition()\n\n EvalCondition(\"@1parameters\", \"changing_language\", \"value\")\n if DBFind(\"@1languages\").Where({\"name\": $Name, \"ecosystem\": $ecosystem_id}).One(\"id\") {\n warning Sprintf(LangRes(\"@1template_langres_exists\", \"en\"), $Name)\n }\n }\n\n action {\n CreateLanguage($Name, $Trans)\n }\n}", "Type": "contracts" }, { @@ -592,31 +598,31 @@ { "Name": "NewMenu", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract NewMenu {\n data {\n Name string\n Value string\n Title string \"optional\"\n Conditions string\n }\n\n conditions {\n ValidateCondition($Conditions,$ecosystem_id)\n\n if DBFind(\"@1menu\").Columns(\"id\").Where({\"name\": $Name, \"ecosystem\": $ecosystem_id}).One(\"id\") {\n warning Sprintf(LangRes(\"@1template_menu_exists\", \"en\"), $Name)\n }\n }\n\n action {\n DBInsert(\"@1menu\", {\"name\": $Name, \"value\": $Value, \"title\": $Title, \"conditions\": $Conditions, \"ecosystem\": $ecosystem_id})\n }\n}", + "Value": "contract NewMenu {\n data {\n Name string\n Value string\n Title string \"optional\"\n Conditions string\n }\n\n conditions {\n DeveloperCondition()\n\n ValidateCondition($Conditions,$ecosystem_id)\n\n if DBFind(\"@1menu\").Where({\"name\": $Name, \"ecosystem\": $ecosystem_id}).One(\"id\") {\n warning Sprintf(LangRes(\"@1template_menu_exists\", \"en\"), $Name)\n }\n }\n\n action {\n DBInsert(\"@1menu\", {\"name\": $Name, \"value\": $Value, \"title\": $Title, \"conditions\": $Conditions, \"ecosystem\": $ecosystem_id})\n }\n}", "Type": "contracts" }, { "Name": "NewPage", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract NewPage {\n data {\n ApplicationId int\n Name string\n Value string\n Menu string\n Conditions string\n ValidateCount int \"optional\"\n ValidateMode string \"optional\"\n }\n\n func preparePageValidateCount(count int) int {\n var min, max int\n min = Int(EcosysParam(\"min_page_validate_count\"))\n max = Int(EcosysParam(\"max_page_validate_count\"))\n\n if count < min {\n count = min\n } else {\n if count > max {\n count = max\n }\n }\n return count\n }\n\n conditions {\n ValidateCondition($Conditions,$ecosystem_id)\n\n if $ApplicationId == 0 {\n warning LangRes(\"@1aid_cannot_zero\", \"en\")\n }\n\n if DBFind(\"@1pages\").Columns(\"id\").Where({\"name\": $Name, \"ecosystem\": $ecosystem_id}).One(\"id\") {\n warning Sprintf(LangRes(\"@1template_page_exists\", \"en\"), $Name)\n }\n\n $ValidateCount = preparePageValidateCount($ValidateCount)\n\n if $ValidateMode {\n if $ValidateMode != \"1\" {\n $ValidateMode = \"0\"\n }\n }\n }\n\n action {\n DBInsert(\"@1pages\", {\"name\": $Name,\"value\": $Value, \"menu\": $Menu,\n \"validate_count\": $ValidateCount, \"validate_mode\": $ValidateMode, \"conditions\": $Conditions, \"app_id\": $ApplicationId, \"ecosystem\": $ecosystem_id})\n }\n}", + "Value": "contract NewPage {\n data {\n ApplicationId int\n Name string\n Value string\n Menu string\n Conditions string\n ValidateCount int \"optional\"\n ValidateMode string \"optional\"\n }\n\n func preparePageValidateCount(count int) int {\n var min, max int\n min = Int(EcosysParam(\"min_page_validate_count\"))\n max = Int(EcosysParam(\"max_page_validate_count\"))\n\n if count < min {\n count = min\n } else {\n if count > max {\n count = max\n }\n }\n return count\n }\n\n conditions {\n DeveloperCondition()\n\n ValidateCondition($Conditions,$ecosystem_id)\n\n if $ApplicationId == 0 {\n warning LangRes(\"@1aid_cannot_zero\", \"en\")\n }\n\n if DBFind(\"@1pages\").Where({\"name\": $Name, \"ecosystem\": $ecosystem_id}).One(\"id\") {\n warning Sprintf(LangRes(\"@1template_page_exists\", \"en\"), $Name)\n }\n\n $ValidateCount = preparePageValidateCount($ValidateCount)\n\n if $ValidateMode {\n if $ValidateMode != \"1\" {\n $ValidateMode = \"0\"\n }\n }\n }\n\n action {\n DBInsert(\"@1pages\", {\"name\": $Name,\"value\": $Value, \"menu\": $Menu,\n \"validate_count\": $ValidateCount, \"validate_mode\": $ValidateMode, \"conditions\": $Conditions, \"app_id\": $ApplicationId, \"ecosystem\": $ecosystem_id})\n }\n}", "Type": "contracts" }, { "Name": "NewParameter", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract NewParameter {\n data {\n Name string\n Value string\n Conditions string\n }\n\n conditions {\n ValidateCondition($Conditions, $ecosystem_id)\n\n if DBFind(\"@1parameters\").Columns(\"id\").Where({\"name\": $Name, \"ecosystem\": $ecosystem_id}).One(\"id\") {\n warning Sprintf(LangRes(\"@1template_parameter_exists\", \"en\"), $Name)\n }\n }\n\n action {\n DBInsert(\"@1parameters\", {\"name\": $Name, \"value\": $Value, \"conditions\": $Conditions, \"ecosystem\": $ecosystem_id})\n }\n}", + "Value": "contract NewParameter {\n data {\n Name string\n Value string\n Conditions string\n }\n\n conditions {\n DeveloperCondition()\n\n ValidateCondition($Conditions, $ecosystem_id)\n\n if DBFind(\"@1parameters\").Where({\"name\": $Name, \"ecosystem\": $ecosystem_id}).One(\"id\") {\n warning Sprintf(LangRes(\"@1template_parameter_exists\", \"en\"), $Name)\n }\n }\n\n action {\n DBInsert(\"@1parameters\", {\"name\": $Name, \"value\": $Value, \"conditions\": $Conditions, \"ecosystem\": $ecosystem_id})\n }\n}", "Type": "contracts" }, { "Name": "NewSection", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract NewSection {\n data {\n Title string\n Status int\n Urlname string\n Page string\n }\n\n conditions {\n if $Status < 0 || $Status > 2 {\n warning LangRes(\"@1status_must_0_2\", \"en\")\n }\n if DBFind(\"@1sections\").Where({\"urlname\": $Urlname, \"ecosystem\": $ecosystem_id}) {\n warning LangRes(\"@1section_exist\", \"en\")\n }\n }\n\n action {\n if $Status == 2 {\n var status_check map\n var curr_id int\n status_check = DBFind(\"@1sections\").Where({\"status\": $Status}).Columns(\"id,status\").Row()\n curr_id = Int(JSONDecode(status_check[\"id\"]))\n DBUpdate(\"@1sections\", curr_id, {\"status\":1})\n }\n var roles_access array\n roles_access = JSONEncode(roles_access)\n DBInsert(\"@1sections\", {\"title\": $Title, \"status\": $Status, \"urlname\": $Urlname, \"page\": $Page, \"roles_access\": roles_access, \"ecosystem\": $ecosystem_id})\n }\n}", + "Value": "contract NewSection {\n data {\n Title string\n Status int\n Urlname string\n Page string\n }\n\n conditions {\n DeveloperCondition()\n\n if $Status < 0 || $Status > 2 {\n warning LangRes(\"@1status_must_0_2\", \"en\")\n }\n if DBFind(\"@1sections\").Where({\"urlname\": $Urlname, \"ecosystem\": $ecosystem_id}) {\n warning LangRes(\"@1section_exist\", \"en\")\n }\n }\n\n action {\n if $Status == 2 {\n var status_check map\n var curr_id int\n status_check = DBFind(\"@1sections\").Where({\"status\": $Status}).Columns(\"id,status\").Row()\n curr_id = Int(JSONDecode(status_check[\"id\"]))\n DBUpdate(\"@1sections\", curr_id, {\"status\":1})\n }\n var roles_access array\n roles_access = JSONEncode(roles_access)\n DBInsert(\"@1sections\", {\"title\": $Title, \"status\": $Status, \"urlname\": $Urlname, \"page\": $Page, \"roles_access\": roles_access, \"ecosystem\": $ecosystem_id})\n }\n}", "Type": "contracts" }, { "Name": "NewTable", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract NewTable {\n data {\n ApplicationId int\n Name string\n Columns string\n Permissions string\n }\n\n conditions {\n if $ApplicationId == 0 {\n warning LangRes(\"@1aid_cannot_zero\", \"en\")\n }\n TableConditions($Name, $Columns, $Permissions)\n }\n\n action {\n CreateTable($Name, $Columns, $Permissions, $ApplicationId)\n }\n}", + "Value": "contract NewTable {\n data {\n ApplicationId int\n Name string\n Columns string\n Permissions string\n }\n\n conditions {\n DeveloperCondition()\n\n if $ApplicationId == 0 {\n warning LangRes(\"@1aid_cannot_zero\", \"en\")\n }\n TableConditions($Name, $Columns, $Permissions)\n }\n\n action {\n CreateTable($Name, $Columns, $Permissions, $ApplicationId)\n }\n}", "Type": "contracts" }, { @@ -628,55 +634,55 @@ { "Name": "NewUser", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract NewUser {\n data {\n NewPubkey string\n }\n conditions {\n $id = PubToID($NewPubkey)\n if $id == 0 {\n error LangRes(\"@1wrong_pub\", \"en\")\n }\n if DBFind(\"keys\").Columns(\"id\").WhereId($id).One(\"id\") != nil {\n error LangRes(\"@1template_user_exists\", \"en\")\n }\n }\n action {\n $pub = HexToPub($NewPubkey)\n $account = IdToAddress($id)\n $amount = Money(1000) * Money(1000000000000000000)\n DBInsert(\"keys\", {\"id\": $id, \"account\": $account, \"pub\": $pub, \"amount\": $amount, \"ecosystem\": 1})\n }\n}", + "Value": "contract NewUser {\n data {\n NewPubkey string \"optional\"\n Account string \"optional\"\n }\n\n conditions {\n $newId = PubToID($NewPubkey)\n \n if $newId == 0 {\n warning LangRes(\"@1wrong_pub\", \"en\")\n }\n if DBFind(\"@1keys\").Where({\"id\": $newId, \"ecosystem\": $ecosystem_id}).One(\"id\") != nil {\n warning Sprintf(LangRes(\"@1template_user_exists\", \"en\"), IdToAddress($newId))\n }\n\n if Size($NewPubkey) == 0 {\n warning \"You did not enter the public key\"\n }\n\n $pub = HexToPub($NewPubkey)\n $amount = Money(1000) * Money(1000000000000000000)\n\n if Size($Account) > 0 {\n $k_id = DBFind(\"@1keys\").Where({\"account\": $Account, \"ecosystem\": $ecosystem_id, \"deleted\": 0}).One(\"id\") \n if $k_id == nil {\n warning \"Account not found\"\n }\n }\n }\n\n action {\n if Size($Account) > 0 {\n $account = $Account\n DBInsert(\"keys\", {\"id\": $newId, \"account\": $account, \"pub\": $pub, \"amount\": $amount, \"ecosystem\": 1})\n $result = $account\n\n DBUpdate(\"@1keys\", Int($k_id), {\"deleted\": 1})\n } else {\n $account = IdToAddress($newId)\n DBInsert(\"keys\", {\"id\": $newId, \"account\": $account, \"pub\": $pub, \"amount\": $amount, \"ecosystem\": 1})\n $result = $account\n }\n }\n}", "Type": "contracts" }, { "Name": "NodeOwnerCondition", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract NodeOwnerCondition {\n conditions {\n $raw_full_nodes = SysParamString(\"full_nodes\")\n if Size($raw_full_nodes) == 0 {\n ContractConditions(\"MainCondition\")\n } else {\n $full_nodes = JSONDecode($raw_full_nodes)\n var i int\n while i < Len($full_nodes) {\n $fn = $full_nodes[i]\n if $fn[\"key_id\"] == $key_id {\n return true\n }\n i = i + 1\n }\n warning \"Sorry, you do not have access to this action.\"\n }\n }\n}", + "Value": "contract NodeOwnerCondition {\n conditions {\n $raw_full_nodes = SysParamString(\"full_nodes\")\n if Size($raw_full_nodes) == 0 {\n ContractConditions(\"MainCondition\")\n } else {\n $full_nodes = JSONDecode($raw_full_nodes)\n var i int\n while i < Len($full_nodes) {\n $fn = $full_nodes[i]\n if $fn[\"key_id\"] == AddressToId($account_id) {\n return true\n }\n i = i + 1\n }\n warning \"Sorry, you do not have access to this action.\"\n }\n }\n}", "Type": "contracts" }, { "Name": "PlatformAppsInstall", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract PlatformAppsInstall {\n data {}\n\n conditions {\n $basic_id = DBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\", \"deleted\": 0}).One(\"id\")\n $system_id = DBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"System\", \"deleted\": 0}).One(\"id\")\n }\n\n action {\n if $ecosystem_id != 1 {\n @1AppInstall(\"ApplicationId\", $system_id)\n @1AppInstall(\"ApplicationId\", $basic_id)\n }\n }\n}", + "Value": "contract PlatformAppsInstall {\n data {}\n\n conditions {\n DeveloperCondition()\n\n $basic_id = DBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"Basic\", \"deleted\": 0}).One(\"id\")\n $system_id = DBFind(\"@1applications\").Where({\"ecosystem\": 1, \"name\": \"System\", \"deleted\": 0}).One(\"id\")\n }\n\n action {\n if $ecosystem_id != 1 {\n @1AppInstall(\"ApplicationId\", $system_id)\n @1AppInstall(\"ApplicationId\", $basic_id)\n }\n }\n}", "Type": "contracts" }, { "Name": "SectionLevelDown", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract SectionLevelDown {\n data {\n Id int\n }\n\n conditions {\n if !DBFind(\"@1sections\").Columns(\"id\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}) {\n warning Sprintf(LangRes(\"@1template_section_not_exist\", \"en\"), $Id)\n }\n $next = DBFind(\"@1sections\").Columns(\"id\").Where({\"id\": {\"$gt\": $Id}, \"ecosystem\": $ecosystem_id})\n if !$next {\n warning LangRes(\"@1section_already_bottom\", \"en\")\n }\n }\n\n action {\n var next_id int\n var last_id int\n next_id = $Id + 1\n $max_id = DBFind(\"@1sections\").Columns(\"id\").Order({\"id\":\"-1\"}).One(\"id\")\n last_id = $max_id + 1\n DBUpdate(\"@1sections\", next_id, {\"id\":last_id})\n DBUpdate(\"@1sections\", $Id, {\"id\":next_id})\n DBUpdate(\"@1sections\", last_id, {\"id\":$Id})\n }\n}", + "Value": "contract SectionLevelDown {\n data {\n Id int\n }\n\n conditions {\n DeveloperCondition()\n\n if !DBFind(\"@1sections\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Columns(\"id\") {\n warning Sprintf(LangRes(\"@1template_section_not_exist\", \"en\"), $Id)\n }\n $next = DBFind(\"@1sections\").Where({\"id\": {\"$gt\": $Id}, \"ecosystem\": $ecosystem_id}).Columns(\"id\")\n if !$next {\n warning LangRes(\"@1section_already_bottom\", \"en\")\n }\n }\n\n action {\n var next_id int\n var last_id int\n next_id = $Id + 1\n $max_id = DBFind(\"@1sections\").Order({\"id\": \"-1\"}).One(\"id\")\n last_id = $max_id + 1\n DBUpdate(\"@1sections\", next_id, {\"id\":last_id})\n DBUpdate(\"@1sections\", $Id, {\"id\":next_id})\n DBUpdate(\"@1sections\", last_id, {\"id\":$Id})\n }\n}", "Type": "contracts" }, { "Name": "SectionLevelUp", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract SectionLevelUp {\n data {\n Id int\n }\n\n conditions {\n if !DBFind(\"@1sections\").Columns(\"id\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}) {\n warning Sprintf(LangRes(\"@1template_section_not_exist\", \"en\"), $Id)\n }\n $next = DBFind(\"@1sections\").Columns(\"id\").Where({\"id\": {\"$lt\": $Id}, \"ecosystem\": $ecosystem_id})\n if !$next {\n warning LangRes(\"@1section_already_top\", \"en\")\n }\n }\n\n action {\n var next_id int\n var last_id int\n next_id = $Id - 1\n $max_id = DBFind(\"@1sections\").Columns(\"id\").Order({\"id\":\"-1\"}).One(\"id\")\n last_id = $max_id + 1\n DBUpdate(\"@1sections\", next_id, {\"id\":last_id})\n DBUpdate(\"@1sections\", $Id, {\"id\":next_id})\n DBUpdate(\"@1sections\", last_id, {\"id\":$Id})\n }\n}", + "Value": "contract SectionLevelUp {\n data {\n Id int\n }\n\n conditions {\n DeveloperCondition()\n\n if !DBFind(\"@1sections\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Columns(\"id\") {\n warning Sprintf(LangRes(\"@1template_section_not_exist\", \"en\"), $Id)\n }\n $next = DBFind(\"@1sections\").Where({\"id\": {\"$lt\": $Id}, \"ecosystem\": $ecosystem_id}).Columns(\"id\")\n if !$next {\n warning LangRes(\"@1section_already_top\", \"en\")\n }\n }\n\n action {\n var next_id int\n var last_id int\n next_id = $Id - 1\n $max_id = DBFind(\"@1sections\").Order({\"id\": \"-1\"}).One(\"id\")\n last_id = $max_id + 1\n DBUpdate(\"@1sections\", next_id, {\"id\":last_id})\n DBUpdate(\"@1sections\", $Id, {\"id\":next_id})\n DBUpdate(\"@1sections\", last_id, {\"id\":$Id})\n }\n}", "Type": "contracts" }, { "Name": "SectionRoles", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract SectionRoles {\n data {\n Id int\n Rid int\n Operation string\n }\n\n conditions {\n if $Operation == \"add\" {\n var roles_id map json array i int\n roles_id = DBFind(\"@1sections\").Columns(\"roles_access\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row()\n json = JSONDecode(roles_id[\"roles_access\"])\n while i < Len(json) {\n if json[i] == $Rid {\n warning LangRes(\"@1role_already_permission\", \"en\")\n }\n i = i + 1\n }\n }\n }\n\n action {\n var roles_array array\n roles_array = DBFind(\"@1sections\").Columns(\"roles_access\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).One(\"roles_access\")\n if $Operation == \"add\" {\n if roles_array == \"[]\" {\n var roles_id array\n roles_id[0] = $Rid\n roles_id = JSONEncode(roles_id)\n DBUpdate(\"@1sections\", $Id, {\"roles_access\":roles_id})\n } else {\n var roles_id map\n var json array\n roles_id = DBFind(\"@1sections\").Columns(\"roles_access\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row()\n json = JSONDecode(roles_id[\"roles_access\"])\n json = Append(json, $Rid)\n json = JSONEncode(json)\n DBUpdate(\"@1sections\", $Id, {\"roles_access\":json})\n }\n }\n if $Operation == \"remove\" {\n var json array\n var roles_id map\n roles_id = DBFind(\"@1sections\").Columns(\"roles_access\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row()\n json = JSONDecode(roles_id[\"roles_access\"])\n if Len(json) == 1 {\n var roles_access array\n roles_access = JSONEncode(roles_access)\n DBUpdate(\"@1sections\", $Id, {\"roles_access\":roles_access})\n } else {\n var buffer string\n buffer = Join(json, \",\")\n if Contains(buffer, Str($Rid)) {\n buffer = Replace(buffer, `,` + Str($Rid), ``)\n }\n if HasPrefix(buffer, Str($Rid)) {\n buffer = Replace(buffer, Str($Rid) + `,`, ``)\n }\n json = Split(buffer, \",\")\n json = JSONEncode(json)\n DBUpdate(\"@1sections\", $Id, {\"roles_access\":json})\n }\n }\n }\n}", + "Value": "contract SectionRoles {\n data {\n Id int\n Rid int\n Operation string\n }\n\n conditions {\n DeveloperCondition()\n\n if $Operation == \"add\" {\n var roles_id map json array i int\n roles_id = DBFind(\"@1sections\").Columns(\"roles_access\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row()\n json = JSONDecode(roles_id[\"roles_access\"])\n while i < Len(json) {\n if json[i] == $Rid {\n warning LangRes(\"@1role_already_permission\", \"en\")\n }\n i = i + 1\n }\n }\n }\n\n action {\n var roles_array array\n roles_array = DBFind(\"@1sections\").Columns(\"roles_access\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).One(\"roles_access\")\n if $Operation == \"add\" {\n if roles_array == \"[]\" {\n var roles_id array\n roles_id[0] = $Rid\n roles_id = JSONEncode(roles_id)\n DBUpdate(\"@1sections\", $Id, {\"roles_access\":roles_id})\n } else {\n var roles_id map\n var json array\n roles_id = DBFind(\"@1sections\").Columns(\"roles_access\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row()\n json = JSONDecode(roles_id[\"roles_access\"])\n json = Append(json, $Rid)\n json = JSONEncode(json)\n DBUpdate(\"@1sections\", $Id, {\"roles_access\":json})\n }\n }\n if $Operation == \"remove\" {\n var json array\n var roles_id map\n roles_id = DBFind(\"@1sections\").Columns(\"roles_access\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row()\n json = JSONDecode(roles_id[\"roles_access\"])\n if Len(json) == 1 {\n var roles_access array\n roles_access = JSONEncode(roles_access)\n DBUpdate(\"@1sections\", $Id, {\"roles_access\":roles_access})\n } else {\n var buffer string\n buffer = Join(json, \",\")\n if Contains(buffer, Str($Rid)) {\n buffer = Replace(buffer, `,` + Str($Rid), ``)\n }\n if HasPrefix(buffer, Str($Rid)) {\n buffer = Replace(buffer, Str($Rid) + `,`, ``)\n }\n json = Split(buffer, \",\")\n json = JSONEncode(json)\n DBUpdate(\"@1sections\", $Id, {\"roles_access\":json})\n }\n }\n }\n}", "Type": "contracts" }, { "Name": "SelectApp", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract SelectApp {\n data {\n ApplicationId int\n }\n\n conditions {\n $app = DBFind(\"@1applications\").Columns(\"id,name\").Where({\"id\": $ApplicationId, \"ecosystem\": $ecosystem_id}).Row()\n if !$app {\n LangRes(\"@1app_not_found\", \"en\")\n }\n }\n\n action {\n var value map bufferId int\n value[\"app_id\"] = Str($ApplicationId)\n value[\"app_name\"] = $app[\"name\"]\n\n bufferId = Int(DBFind(\"@1buffer_data\").Where({\"member_id\": $key_id, \"key\": \"export\", \"ecosystem\": $ecosystem_id}).One(\"id\"))\n if bufferId > 0 {\n DBUpdate(\"@1buffer_data\", bufferId, {\"value\": value})\n } else {\n DBInsert(\"@1buffer_data\", {\"member_id\": $key_id,\"key\": \"export\",\"value\": value, ecosystem: $ecosystem_id})\n }\n }\n}", + "Value": "contract SelectApp {\n data {\n ApplicationId int\n }\n\n conditions {\n DeveloperCondition()\n\n $app = DBFind(\"@1applications\").Columns(\"id,name\").Where({\"id\": $ApplicationId, \"ecosystem\": $ecosystem_id}).Row()\n if !$app {\n LangRes(\"@1app_not_found\", \"en\")\n }\n }\n\n action {\n var value map\n value[\"app_id\"] = Str($ApplicationId)\n value[\"app_name\"] = $app[\"name\"]\n\n @1BufferManager(\"Action,Key,Val\", \"set\", \"export\", JSONEncode(value))\n }\n}", "Type": "contracts" }, { "Name": "UnbindWallet", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract UnbindWallet {\n data {\n Id int\n }\n\n conditions {\n $cur = DBFind(\"@1contracts\").Columns(\"id,conditions,wallet_id\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row()\n if !$cur {\n warning Sprintf(LangRes(\"@1contract_x_not_exist\", \"en\"), $Id)\n }\n if Int($cur[\"wallet_id\"]) == 0 {\n warning Sprintf(LangRes(\"@1contract_x_unbinded_already\", \"en\"), $Id)\n }\n if $key_id != Int($cur[\"wallet_id\"]) {\n warning LangRes(\"@1contract_cannot_unbind\", \"en\")\n }\n RowConditions(\"@1contracts\", $Id, false)\n }\n\n action {\n UnbndWallet($Id, $ecosystem_id)\n }\n}", + "Value": "contract UnbindWallet {\n data {\n Id int\n }\n\n conditions {\n DeveloperCondition()\n\n $cur = DBFind(\"@1contracts\").Columns(\"id,conditions,wallet_id\").Where({\"id\": $Id, \"ecosystem\": $ecosystem_id}).Row()\n if !$cur {\n warning Sprintf(LangRes(\"@1contract_x_not_exist\", \"en\"), $Id)\n }\n if Int($cur[\"wallet_id\"]) == 0 {\n warning Sprintf(LangRes(\"@1contract_x_unbinded_already\", \"en\"), $Id)\n }\n if AddressToId($account_id) != Int($cur[\"wallet_id\"]) {\n warning LangRes(\"@1contract_cannot_unbind\", \"en\")\n }\n RowConditions(\"@1contracts\", $Id, false)\n }\n\n action {\n UnbndWallet($Id, $ecosystem_id)\n }\n}", "Type": "contracts" }, { "Name": "UpdateMetrics", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract UpdateMetrics {\n conditions {\n ContractConditions(\"MainCondition\")\n }\n\n action {\n var values array\n values = DBCollectMetrics()\n\n var i, id int\n var v map\n while (i < Len(values)) {\n var inmap map\n\n v = values[i]\n inmap[\"time\"] = v[\"time\"]\n inmap[\"key\"] = v[\"key\"]\n inmap[\"metric\"] = v[\"metric\"]\n\n id = Int(DBFind(\"@1metrics\").Columns(\"id\").Where(inmap).One(\"id\"))\n var ival int\n if id != 0 {\n ival = Int(v[\"value\"])\n DBUpdate(\"@1metrics\", id, {\"value\": ival})\n } else {\n inmap[\"value\"] = Int(v[\"value\"])\n DBInsert(\"@1metrics\", inmap )\n }\n i = i + 1\n }\n }\n}", + "Value": "contract UpdateMetrics {\n conditions {\n ContractConditions(\"MainCondition\")\n }\n\n action {\n var values array\n values = DBCollectMetrics()\n\n var i, id int\n var v map\n while (i < Len(values)) {\n var inmap map\n\n v = values[i]\n inmap[\"time\"] = v[\"time\"]\n inmap[\"key\"] = v[\"key\"]\n inmap[\"metric\"] = v[\"metric\"]\n\n id = Int(DBFind(\"@1metrics\").Where(inmap).One(\"id\"))\n var ival int\n if id != 0 {\n ival = Int(v[\"value\"])\n DBUpdate(\"@1metrics\", id, {\"value\": ival})\n } else {\n inmap[\"value\"] = Int(v[\"value\"])\n DBInsert(\"@1metrics\", inmap )\n }\n i = i + 1\n }\n }\n}", "Type": "contracts" }, { @@ -688,13 +694,13 @@ { "Name": "Export", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract Export {\n data {}\n\n func createExport(items array) string {\n var res map\n res[\"name\"] = $AppName\n res[\"conditions\"] = $AppConditions\n res[\"data\"] = items\n return JSONEncodeIndent(res, \" \")\n }\n\n func mapping(res map, resKey string, item map itemKey string){\n if item[itemKey] {\n res[resKey] = Str(item[itemKey])\n }\n }\n\n func prepareItem(item map, type string) string {\n var res map\n res[\"Type\"] = type\n mapping(res, \"Name\", item, \"name\")\n mapping(res, \"Value\", item, \"value\")\n mapping(res, \"Conditions\", item, \"conditions\")\n mapping(res, \"Menu\", item, \"menu\")\n mapping(res, \"Title\", item, \"title\")\n mapping(res, \"Trans\", item, \"res\")\n mapping(res, \"Columns\", item, \"columns\")\n mapping(res, \"Permissions\", item, \"permissions\")\n mapping(res, \"Confirmation\", item, \"confirmation\")\n return res\n }\n\n func getColumnsWithType(table_name string, columnsJSON string) string {\n var colsMap map result columns array\n colsMap = JSONDecode(columnsJSON)\n columns = GetMapKeys(colsMap)\n var i int\n while i < Len(columns) {\n if Size(columns[i]) > 0 {\n var col map\n col[\"name\"] = columns[i]\n col[\"conditions\"] = colsMap[col[\"name\"]]\n col[\"type\"] = GetColumnType(table_name, col[\"name\"])\n result = Append(result, col)\n }\n i = i + 1\n }\n return JSONEncode(result)\n }\n\n func exportTable(type string, result array) array {\n var items array limit offset i lenItems int item map\n limit = 250\n while true {\n var rows array where map\n if type == \"menu\" {\n if Len($menus_names) > 0 {\n where[\"name\"] = {\"$in\": $menus_names}\n where[\"ecosystem\"] = $ecosystem_id\n }\n } else {\n where[\"app_id\"] = $AppID\n where[\"ecosystem\"] = $ecosystem_id\n }\n if where {\n var tbl string\n tbl = \"@1\" + Str(type)\n if tbl == \"@1languages\" {\n rows = DBFind(tbl).Limit(limit).Offset(offset).Where({\"ecosystem\": $ecosystem_id})\n } else {\n rows = DBFind(tbl).Limit(limit).Offset(offset).Where(where)\n }\n }\n if Len(rows) > 0{\n i = 0\n while i < Len(rows){\n items = Append(items, rows[i])\n i = i + 1\n }\n } else {\n break\n }\n offset = offset + limit\n }\n i = 0\n lenItems = Len(items)\n while i < lenItems {\n item = items[i]\n if type == \"tables\" {\n item[\"columns\"] = getColumnsWithType(item[\"name\"], item[\"columns\"])\n }\n result = Append(result, prepareItem(item, type))\n if type == \"pages\" {\n $menus_names = Append($menus_names, Sprintf(\"'%v'\", item[\"menu\"]))\n }\n i = i + 1\n }\n return result\n }\n\n conditions {\n var buf app map\n buf = DBFind(\"@1buffer_data\").Columns(\"id,value->app_id,value->app_name\").Where({\"member_id\": $key_id, \"key\": \"export\", \"ecosystem\": $ecosystem_id}).Row()\n if !buf {\n warning LangRes(\"@1app_not_selected\", \"en\")\n }\n $AppID = Int(buf[\"value.app_id\"])\n $AppName = Str(buf[\"value.app_name\"])\n\n app = DBFind(\"@1applications\").Columns(\"id,conditions\").Where({\"id\": $AppID, \"ecosystem\": $ecosystem_id}).Row()\n if !app {\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n $AppConditions = app[\"conditions\"]\n\n $menus_names = []\n\n }\n\n action {\n var exportJSON string items array\n items = exportTable(\"pages\", items)\n items = exportTable(\"contracts\", items)\n items = exportTable(\"blocks\", items)\n items = exportTable(\"app_params\", items)\n items = exportTable(\"tables\", items)\n items = exportTable(\"menu\", items)\n\n exportJSON = createExport(items)\n UploadBinary(\"Name,Data,ApplicationId,DataMimeType\", \"export\", exportJSON, $AppID, \"application/json\")\n }\n}", + "Value": "contract Export {\n data {}\n\n func createExport(items array) string {\n var res map\n res[\"name\"] = $AppName\n res[\"conditions\"] = $AppConditions\n res[\"data\"] = items\n return JSONEncodeIndent(res, \" \")\n }\n\n func mapping(res map, resKey string, item map itemKey string){\n if item[itemKey] {\n res[resKey] = Str(item[itemKey])\n }\n }\n\n func prepareItem(item map, type string) string {\n var res map\n res[\"Type\"] = type\n mapping(res, \"Name\", item, \"name\")\n mapping(res, \"Value\", item, \"value\")\n mapping(res, \"Conditions\", item, \"conditions\")\n mapping(res, \"Menu\", item, \"menu\")\n mapping(res, \"Title\", item, \"title\")\n mapping(res, \"Trans\", item, \"res\")\n mapping(res, \"Columns\", item, \"columns\")\n mapping(res, \"Permissions\", item, \"permissions\")\n mapping(res, \"Confirmation\", item, \"confirmation\")\n return res\n }\n\n func getColumnsWithType(table_name string, columnsJSON string) string {\n var colsMap map result columns array\n colsMap = JSONDecode(columnsJSON)\n columns = GetMapKeys(colsMap)\n var i int\n while i < Len(columns) {\n if Size(columns[i]) > 0 {\n var col map\n col[\"name\"] = columns[i]\n col[\"conditions\"] = colsMap[col[\"name\"]]\n col[\"type\"] = GetColumnType(table_name, col[\"name\"])\n result = Append(result, col)\n }\n i = i + 1\n }\n return JSONEncode(result)\n }\n\n func exportTable(type string, result array) array {\n var items array limit offset i lenItems int item map\n limit = 250\n while true {\n var rows array where map\n if type == \"menu\" {\n if Len($menus_names) > 0 {\n where[\"name\"] = {\"$in\": $menus_names}\n where[\"ecosystem\"] = $ecosystem_id\n }\n } else {\n where[\"app_id\"] = $AppID\n where[\"ecosystem\"] = $ecosystem_id\n }\n if where {\n var tbl string\n tbl = \"@1\" + Str(type)\n if tbl == \"@1languages\" {\n rows = DBFind(tbl).Limit(limit).Offset(offset).Where({\"ecosystem\": $ecosystem_id})\n } else {\n rows = DBFind(tbl).Limit(limit).Offset(offset).Where(where)\n }\n }\n if Len(rows) > 0{\n i = 0\n while i < Len(rows){\n items = Append(items, rows[i])\n i = i + 1\n }\n } else {\n break\n }\n offset = offset + limit\n }\n i = 0\n lenItems = Len(items)\n while i < lenItems {\n item = items[i]\n if type == \"tables\" {\n item[\"columns\"] = getColumnsWithType(item[\"name\"], item[\"columns\"])\n }\n result = Append(result, prepareItem(item, type))\n if type == \"pages\" {\n $menus_names = Append($menus_names, Sprintf(\"'%v'\", item[\"menu\"]))\n }\n i = i + 1\n }\n return result\n }\n\n conditions {\n DeveloperCondition()\n\n var buf app map\n buf = DBFind(\"@1buffer_data\").Columns(\"id,value->app_id,value->app_name\").Where({\"account\": $account_id, \"key\": \"export\", \"ecosystem\": $ecosystem_id}).Row()\n if !buf {\n warning LangRes(\"@1app_not_selected\", \"en\")\n }\n $AppID = Int(buf[\"value.app_id\"])\n $AppName = Str(buf[\"value.app_name\"])\n\n app = DBFind(\"@1applications\").Columns(\"id,conditions\").Where({\"id\": $AppID, \"ecosystem\": $ecosystem_id}).Row()\n if !app {\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n $AppConditions = app[\"conditions\"]\n\n $menus_names = []\n }\n\n action {\n var exportJSON string items array\n items = exportTable(\"pages\", items)\n items = exportTable(\"contracts\", items)\n items = exportTable(\"blocks\", items)\n items = exportTable(\"app_params\", items)\n items = exportTable(\"tables\", items)\n items = exportTable(\"menu\", items)\n\n exportJSON = createExport(items)\n UploadBinary(\"Name,Data,ApplicationId,DataMimeType\", \"export\", exportJSON, $AppID, \"application/json\")\n }\n}", "Type": "contracts" }, { - "Name": "UploadFile", + "Name": "BufferFileUpload", "Conditions": "ContractConditions(\"@1DeveloperCondition\")", - "Value": "contract UploadFile {\n data {\n ApplicationId int\n Data file\n Name string \"optional\"\n }\n\n conditions {\n if $Name == \"\" {\n $Name = $Data[\"Name\"]\n }\n $Body = $Data[\"Body\"]\n $DataMimeType = $Data[\"MimeType\"]\n }\n\n action {\n $Id = @1UploadBinary(\"ApplicationId,Name,Data,DataMimeType\", $ApplicationId, $Name, $Body, $DataMimeType)\n $result = $Id\n }\n}", + "Value": "contract BufferFileUpload {\n data {\n AppId int\n BufferKey string\n FileName string \"optional\"\n FileData file\n }\n\n conditions {\n var app_id int\n app_id = DBFind(\"@1applications\").Where({\"id\": $AppId, \"deleted\": 0}).One(\"id\")\n if !app_id {\n warning LangRes(\"@1app_not_found\", \"en\")\n }\n if $BufferKey == \"\" {\n warning LangRes(\"@1buffer_key_empty\", \"en\")\n }\n }\n\n action {\n var buffer_data map\n if $FileName != \"\" {\n buffer_data[\"binary_id\"] = @1UploadFile(\"Name,Data,ApplicationId\", $FileName, $FileData, Int($AppId))\n } else {\n buffer_data[\"binary_id\"] = @1UploadFile(\"Data,ApplicationId\", $FileData, Int($AppId))\n }\n @1BufferManager(\"Action,Key,Val\", \"set\", $BufferKey, JSONEncode(buffer_data))\n }\n}", "Type": "contracts" } ]